-
Notifications
You must be signed in to change notification settings - Fork 49
/
Copy pathapp.js
40 lines (40 loc) · 958 Bytes
/
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
40
//app.js
App({
onLaunch: function () {
//存储数据,测试使用
},
setUserInfo: function (userInfo) {
var that = this;
that.globalData.userInfo = userInfo;
that.globalData.hasLogin = true;
},
getUserInfo: function () {
var that = this;
return that.globalData.userInfo;
},
checkLogin: function () {
var that = this;
if (that.globalData.hasLogin) {
return true;
} else {
return false;
}
},
loginOut: function (obj) {
var that = this;
that.globalData.userInfo = null;
that.globalData.hasLogin = false;
wx.removeStorage({
key: 'utoken',
success: function () {
wx.navigateTo({
url: '../login/login'
});
}
})
},
globalData: {
userInfo: null,
hasLogin: false
}
});