-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathapp.js
69 lines (57 loc) · 1.29 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
//app.js
App({
d: {
ceshiUrl: "https://www.xxx.com/dyxcx/public/index.php",
userId:'',
},
globalData: {
userInfo: null
},
/**
* 当小程序初始化完成时,会触发 onLaunch(全局只触发一次)
*/
onLaunch1:function(){
},
onLaunch: function () {
var that =this;
// 展示本地存储能力
var logs = wx.getStorageSync('logs') || []
logs.unshift(Date.now())
},
//获取缓存
isLogin: function (e) {
try {
var value = wx.getStorageSync('user');
if (value) {
this.globalData.userInfo = value;
var userId = this.globalData.userInfo.ID;
this.d.userId = userId;
} else {
wx.redirectTo({
url: '/pages/wxLogin/wxLogin',
});
return false;
}
} catch (e) {
wx.redirectTo({
url: '/pages/wxLogin/wxLogin',
});
return false;
}
},
/**
* 当小程序启动,或从后台进入前台显示,会触发 onShow
*/
onShow: function (options) {
},
/**
* 当小程序从前台进入后台,会触发 onHide
*/
onHide: function () {
},
/**
* 当小程序发生脚本错误,或者 api 调用失败时,会触发 onError 并带上错误信息
*/
onError: function (msg) {
},
})