-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
39 lines (37 loc) · 1.01 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
const { login } = require("./api/login");
App({
onLaunch: function() {
this.userLogin()
var e = wx.getSystemInfoSync()
this.globalData.statusBarHeight = e.statusBarHeight
this.globalData.windowWidth = e.windowWidth
this.globalData.windowHeight = e.windowHeight
},
globalData: {
openid: ""
},
userLogin: function() {
wx.login({
success: res => {
login({code: res.code}).then(res => {
this.globalData.openid = res.data
// wx.setStorage({
// key: constants.TOKEN,
// data: JSON.stringify(s.data.data)
// })
}).catch(err => {
wx.showToast({
title: '[002]登录失败,请重试',
icon: 'none'
})
})
},
fail: err => {
wx.showToast({
title: '[001]登录失败,请重试',
icon: 'none'
})
}
})
}
});