Skip to content

Commit

Permalink
add
Browse files Browse the repository at this point in the history
  • Loading branch information
richard1015 committed May 3, 2018
1 parent 5fd0e64 commit 71f8132
Show file tree
Hide file tree
Showing 37 changed files with 1,388 additions and 0 deletions.
Binary file added .DS_Store
Binary file not shown.
131 changes: 131 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
//app.js
var apiHelper = require("utils/api.js");
App({
onLaunch: function () {
var self = this
console.log('App Launch')
// 获取手机信息
wx.getSystemInfo({
success: function (res) {
let model = res.model.substring(0, res.model.lastIndexOf("X")) + "X";
if (model == 'iPhone X') {
self.globalData.isIphoneX = true //判断是否为iPhone X 默认为值false,iPhone X 值为true
}
}
})
// 获取用户信息
self.getUserInfo(function (res) {
return
//获取openId
self.getUserOpenId(res, function (error, openid) {
if (error) {
console.error(error)
} else {
// userInfo.openId = openid;
// //提交用户信息
// apiHelper.paramData.cmd = "/wxuser"; //cmd
// apiHelper.paramData.param = userInfo;
// apiHelper.post((res) => {
// if (res.State == 0) {
// console.log('用户信息提交成功')
// }
// });
}
});
})

},
onShow: function () {
console.log('App Show')
},
onHide: function () {
console.log('App Hide')
},
globalData: {
userInfo: null,
hasLogin: false,
openid: null,
isIphoneX: false
},
// lazy loadin userInfo
getUserInfo: function (callback) {
var self = this;
wx.getSetting({
success: res => {
if (res.authSetting['scope.userInfo']) {
// 已经授权,可以直接调用 getUserInfo 获取头像昵称,不会弹框
wx.getUserInfo({
success: res => {
// 可以将 res 发送给后台解码出 unionId
self.globalData.userInfo = res.userInfo
// 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
// 所以此处加入 callback 以防止这种情况
if (callback) {
callback(res)
}
}
})
} else {
wx.authorize({
scope: 'scope.userInfo',
success() {
// 用户已经同意小程序使用录音功能,后续调用 wx.startRecord 接口不会弹窗询问
wx.getUserInfo({
success: res => {
// 可以将 res 发送给后台解码出 unionId
self.globalData.userInfo = res.userInfo
// 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
// 所以此处加入 callback 以防止这种情况
if (callback) {
callback(res)
}
}
})
},
fail(ex) {
console.log(ex)
self.getUserInfo();
}
})
}
}
})


},
// lazy loading openid
getUserOpenId: function (res, callback) {
var self = this

if (self.globalData.openid) {
callback(null, self.globalData.openid)
} else {
wx.login({
success: function (data) {
res.code = data.code;
// console.log(res)
//获取openId
apiHelper.paramData.cmd = "wx/wxcallback"; //cmd
apiHelper.paramData.param = {
code: encodeURIComponent(res.code),
encryptedData: encodeURIComponent(res.rawData),
iv: encodeURIComponent(res.iv)
};
// apiHelper.errorMsgState = false;
apiHelper.loadingState = false;
apiHelper.post((res) => {
if (res.State == 0) {
// console.log('拉取openid成功', res.Value)
self.globalData.openid = res.Value
callback(null, self.globalData.openid)
}
});
},
fail: function (err) {
console.log('wx.login 接口调用失败,将无法正常使用开放接口等服务', err)
callback(err)
}
})
}
}
})
14 changes: 14 additions & 0 deletions app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"pages": [
"pages/contentShare/contentShare",
"pages/content/content",
"pages/index/index",
"pages/contentDetails/contentDetails"
],
"window": {
"backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#fff",
"navigationBarTitleText": "留学新闻",
"navigationBarTextStyle": "black"
}
}
49 changes: 49 additions & 0 deletions app.wxss
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/**app.wxss**/
@import "./font.wxss";

.header {
width: 100%;
height: 257rpx;
position: absolute;
top: 0;
z-index: -1;
}

.header .map {
width: 100%;
height: 100%;
}

.foot {
width: 100%;
height: 552rpx;
bottom: 0;
position: absolute;
z-index: -1;
}

.foot .foottext {
color: #e83428;
font-size: 22rpx;
font-weight: bold;
position: absolute;
text-align: center;
width: 100%;
bottom: 24rpx;
}

.foot .footimg {
width: 100%;
height: 100%;
position: absolute;
left: 0;
top: 0;
}

.hand {
height: 429rpx;
width: 273rpx;
position: absolute;
right: -90rpx;
top: 813rpx;
}
12 changes: 12 additions & 0 deletions config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* 小程序配置文件
*/

var host = "https://lightapp.aoji.cn/"
// var host ="http://192.168.160.162:8001/"
var config = {
// 下面的地址配合云端 Server 工作
host
};

module.exports = config
30 changes: 30 additions & 0 deletions font.wxss
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
@font-face {
font-family: "iconfont";
src: url('//at.alicdn.com/t/font_637955_f8e72e5a0trfi529.eot?t=1524295758433'); /* IE9*/
src: url('//at.alicdn.com/t/font_637955_f8e72e5a0trfi529.eot?t=1524295758433#iefix') format('embedded-opentype'),
/* IE6-IE8 */ url('data:application/x-font-woff;charset=utf-8;base64,d09GRgABAAAAAAbQAAsAAAAACbQAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABHU1VCAAABCAAAADMAAABCsP6z7U9TLzIAAAE8AAAARAAAAFZW7kfwY21hcAAAAYAAAABhAAABnM64aZpnbHlmAAAB5AAAAuIAAANwiXfBiWhlYWQAAATIAAAALwAAADYRIlaZaGhlYQAABPgAAAAcAAAAJAffA4ZobXR4AAAFFAAAABAAAAAQD+oAAGxvY2EAAAUkAAAACgAAAAoCLgFEbWF4cAAABTAAAAAfAAAAIAEgAJluYW1lAAAFUAAAAUUAAAJtPlT+fXBvc3QAAAaYAAAANQAAAEaVy3CbeJxjYGRgYOBikGPQYWB0cfMJYeBgYGGAAJAMY05meiJQDMoDyrGAaQ4gZoOIAgCKIwNPAHicY2Bk/s04gYGVgYOpk+kMAwNDP4RmfM1gxMjBwMDEwMrMgBUEpLmmMDgwVDxjZm7438AQw9zA0AAUZgTJAQAkjgxyeJzFkMENgCAMRV8pGmIcxaNxIE+OwMSsgW3lwgR+8kr785MSgAVQ4zAyyIPgus2V8JUt/Mxlc7GT7K6Npr1PnUsiUaJTT8rKb5L/Vs/ao55j8v+uA3ti48P9NiC9+BQPfwAAAHicNZLPT9RAFMfndWi7v9gf/bmdssu2pa0IbHS725IUFk3ECNGoURPWePHA3tSDRC5GMMY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EmIOYCQgaG/2A+AwAYGQG6AHicZY9NTsMwEIVf+gekEqqoYIfkBWIBKP0Rq25YVGr3XXTfpk6bKokjx63UA3AejsAJOALcgDvwSCebNpbH37x5Y08A3OAHHo7fLfeRPVwyO3INF7gXrlN/EG6QX4SbaONVuEX9TdjHM6bCbXRheYPXuGL2hHdhDx18CNdwjU/hOvUv4Qb5W7iJO/wKt9Dx6sI+5l5XuI1HL/bHVi+cXqnlQcWhySKTOb+CmV7vkoWt0uqca1vEJlODoF9JU51pW91T7NdD5yIVWZOqCas6SYzKrdnq0AUb5/JRrxeJHoQm5Vhj/rbGAo5xBYUlDowxQhhkiMro6DtVZvSvsUPCXntWPc3ndFsU1P9zhQEC9M9cU7qy0nk6T4E9XxtSdXQrbsuelDSRXs1JErJCXta2VELqATZlV44RelzRiT8oZ0j/AAlabsgAAAB4nGNgYoAALgbsgIWRiZGZkYWRlYGxgj+1qDw1MzcxLTWvIjMxL52tPDU5I7GEgQEAi7wJZwAAAA==') format('woff'),
url('//at.alicdn.com/t/font_637955_f8e72e5a0trfi529.ttf?t=1524295758433') format('truetype'),
/* chrome,
firefox,
opera,
Safari,
Android,
iOS 4.2+*/ url('//at.alicdn.com/t/font_637955_f8e72e5a0trfi529.svg?t=1524295758433#iconfont') format('svg'); /* iOS 4.1- */
}

.iconfont {
font-family: "iconfont" !important;
font-size: 30rpx;
font-style: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}

.icon-erweimafenxiang:before {
content: "\e603";
}

.icon-wechat:before {
content: "\e600";
color: #3bd230;
}
Binary file added imgs/.DS_Store
Binary file not shown.
Binary file added imgs/0.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added imgs/link.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added imgs/save_share.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added imgs/share.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added imgs/wechat.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added libs/.DS_Store
Binary file not shown.
Loading

0 comments on commit 71f8132

Please sign in to comment.