-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.wxa
132 lines (124 loc) · 3.14 KB
/
app.wxa
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<template>
<view>
<page></page>
</view>
</template>
<script>
import system from "./static/utils/system";
var _system2 = _interopRequireDefault(system);
var _qqmapWxJssdkMin = require("./static/utils/qqmap-wx-jssdk.min.js");
var _qqmapWxJssdkMin2 = _interopRequireDefault(_qqmapWxJssdkMin);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { default: obj };
}
var thisPage = null;
export default {
config: {
usingComponents: {},
pages: [
"pages/index",
"pages/videoDetail",
"pages/userCenter"
],
window: {
navigationStyle: "custom"
},
plugins: {
tencentvideo: {
version: "1.3.16",
provider: "wxa75efa648b60994b"
}
},
networkTimeout: {
request: 10000
},
permission: {
"scope.userLocation": {
desc: "你的位置信息将用于展示"
}
},
sitemapLocation: "sitemap.json",
theme: {
"theme-color": "#39f"
}
},
globalData: {},
onLaunch(options) {
wx.setStorageSync("scene", options.scene);
system.attachInfo();
thisPage = this;
thisPage.checkVersion();
},
onShow() {
thisPage.networkStatusChangeListening();
},
networkStatusChangeListening() {
//监听网络状态变化
wx.onNetworkStatusChange(function(res) {
var isConnected = res.isConnected;
var networkType = res.networkType;
if (!isConnected) {
//未联网时
wx.showToast({
title: "当前网络可能不稳定",
icon: "none"
});
} else {
if (networkType == "2g" || networkType == "3g")
wx.showToast({
title: "当前网络信号较弱",
icon: "none"
});
else if (networkType == "unknown") {
wx.showToast({
title: "当前网络可能不稳定",
icon: "none"
});
}
}
});
},
/**
* 检查版本
*/
checkVersion() {
var updateManager = wx.getUpdateManager();
updateManager.onCheckForUpdate(function(res) {
// 请求完新版本信息的回调
if (res.hasUpdate) {
updateManager.onUpdateReady(function() {
wx.showModal({
title: "更新提示",
content: "新版本已经准备好,是否重启应用?",
success: function(res) {
if (res.confirm) {
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
updateManager.applyUpdate();
}
}
});
});
updateManager.onUpdateFailed(function() {
// 新版本下载失败
wx.showModal({
title: "更新提示",
content: "更新失败,是否重新更新?",
success: function(res) {
if (res.confirm) {
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
updateManager.applyUpdate();
}
}
});
});
}
});
},
onError(e) {
console.log(e);
}
};
</script>
<style lang="less">
@import "./static/styles/index.less";
</style>