forked from Bupt-Gantch/MiniProgram
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
72 lines (70 loc) · 1.59 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
70
71
72
//app.js
var chinese = require("/utils/Chinese.js")
var english = require("/utils/English.js")
App({
onLaunch: function () {
var _this = this;
// 展示本地存储能力
var logs = wx.getStorageSync('logs') || []
logs.unshift(Date.now())
wx.setStorageSync('logs', logs);
// 监测网络状态
var cleanId = setInterval(
function(){
wx.getNetworkType({
success: function(res) {
var netWorkType = res.networkType;
if(netWorkType === 'none'){
_this.globalData.netStatus = false;
}else{
_this.globalData.netStatus = true;
}
},
})
},1000)
// clearInterval
},
// onHide:function(){
// clearInterval(cleanId);
// },
//改变语言
getLanuage: function (lastLanuage) {
if (lastLanuage == "中文") {
return chinese.Content
} else {
return english.Content
}
},
//下载图片
dowloadimage:function (url) {
wx.downloadFile({
url:url,
success:function(res){
console.log(res.tempFilePath)
return res.tempFilePath
}
})
},
onShareAppMessage: function (res) {
return {
title: '冠川智能',
path: '/pages/loading/loading',
success: function () { },
fail: function () { }
}
},
globalData: {
language:"中文",
userInfo: null,
customerId:null,
gatewayCustomerId:null,
openid: null,
unionid:null,
code:null,
getwayId:null,
gatewayName:null,
gatewayId:null,
netStatus:true,
phoneNumber:null,
},
})