xz_gangba/app.js

60 lines
1.9 KiB
JavaScript
Raw Normal View History

2020-06-23 19:14:44 +08:00
//app.js
2020-06-26 11:52:30 +08:00
var restAjax = require('utils/restAjax.js');
var dialog = require('utils/dialog.js');
2020-06-23 19:14:44 +08:00
App({
2020-07-11 19:03:52 +08:00
loginUrl: 'https://www.wgink.ink/usercenter',
usercenterUrl: 'https://www.wgink.ink/usercenter',
newsUrl: 'https://www.wgink.ink/news',
newsContentUrl: 'https://www.wgink.ink',
libraryUrl: 'https://www.wgink.ink/library',
2020-08-06 16:54:34 +08:00
<<<<<<< HEAD
2020-08-06 16:51:52 +08:00
venueUrl: 'http://192.168.0.109:8082/venuebooking',
activityUrl: 'http://192.168.0.111:8080/culturalactivity',
volunteerUrl: 'https://www.wgink.ink/volunteer',
2020-08-06 16:54:34 +08:00
=======
2020-07-11 19:03:52 +08:00
venueUrl: 'https://www.wgink.ink/venuebooking',
2020-08-06 14:57:56 +08:00
activityUrl: 'http://192.168.0.111:8080/culturalactivity',
2020-07-29 16:35:24 +08:00
volunteerUrl: 'http://192.168.0.111:8888/volunteer',
2020-08-06 16:54:34 +08:00
>>>>>>> 8555f8c2cd310ce9fdc19a34346841205d404f1a
2020-07-11 19:03:52 +08:00
liveUrl: 'https://www.wgink.ink/live',
liveRecordUrl: 'https://www.wgink.ink',
socialUrl: 'https://www.wgink.ink/social',
2020-06-26 11:52:30 +08:00
restAjax: restAjax,
dialog: dialog,
2020-06-23 19:14:44 +08:00
onLaunch: function () {
// 展示本地存储能力
var logs = wx.getStorageSync('logs') || []
logs.unshift(Date.now())
wx.setStorageSync('logs', logs)
// 登录
wx.login({
success: res => {
// 发送 res.code 到后台换取 openId, sessionKey, unionId
}
})
// 获取用户信息
wx.getSetting({
success: res => {
if (res.authSetting['scope.userInfo']) {
// 已经授权,可以直接调用 getUserInfo 获取头像昵称,不会弹框
wx.getUserInfo({
success: res => {
// 可以将 res 发送给后台解码出 unionId
this.globalData.userInfo = res.userInfo
// 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
// 所以此处加入 callback 以防止这种情况
if (this.userInfoReadyCallback) {
this.userInfoReadyCallback(res)
}
}
})
}
}
})
},
globalData: {
userInfo: null
}
})