86 lines
2.4 KiB
JavaScript
86 lines
2.4 KiB
JavaScript
|
import gulpError from './utils/gulpError';
|
||
|
App({
|
||
|
onLaunch() {
|
||
|
|
||
|
},
|
||
|
UpdateManager(){
|
||
|
|
||
|
//微信小程序用户及时更新到最新版本
|
||
|
const updateManager = wx.getUpdateManager()
|
||
|
updateManager.onCheckForUpdate(function (res) {
|
||
|
// 请求完新版本信息的回调
|
||
|
console.log('是否有新版本: ', +res.hasUpdate)
|
||
|
if (!res.hasUpdate) {
|
||
|
wx.hideLoading()
|
||
|
}else{
|
||
|
wx.showLoading({
|
||
|
title: '新版本加载中..',
|
||
|
mask: true
|
||
|
})
|
||
|
}
|
||
|
})
|
||
|
updateManager.onUpdateReady(function () {
|
||
|
wx.hideLoading()
|
||
|
wx.showModal({
|
||
|
title: '更新提示',
|
||
|
content: '新版本已经准备好,是否重启应用?(如您之前已登录过,更新后直接点击授权登录即可)',
|
||
|
showCancel: false,
|
||
|
success: function (res) {
|
||
|
if (res.confirm) {
|
||
|
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
|
||
|
updateManager.applyUpdate()
|
||
|
}
|
||
|
}
|
||
|
})
|
||
|
})
|
||
|
updateManager.onUpdateFailed(function () {
|
||
|
wx.hideLoading();
|
||
|
wx.showModal({
|
||
|
title: '提示',
|
||
|
content: '检查到有新版本,但下载失败,请检查网络后重试',
|
||
|
showCancel: false
|
||
|
})
|
||
|
})
|
||
|
setTimeout(wx.hideLoading, 5000)
|
||
|
},
|
||
|
onShow() {
|
||
|
this.UpdateManager()
|
||
|
if (gulpError !== 'gulpErrorPlaceHolder') {
|
||
|
wx.redirectTo({
|
||
|
url: `/pages/gulp-error/index?gulpError=${gulpError}`,
|
||
|
});
|
||
|
}
|
||
|
},
|
||
|
globalData: {
|
||
|
systemInfo: null, //客户端设备信息
|
||
|
userInfo: null,
|
||
|
url: 'https://wt.lidinghb.com',
|
||
|
fileUrl: 'https://wt.lidinghb.com/static/img/',
|
||
|
tabBar: {
|
||
|
"backgroundColor": "#ffffff",
|
||
|
"color": "#979795",
|
||
|
"selectedColor": "#1c1c1b",
|
||
|
"list": [{
|
||
|
"pagePath": "/pages/index/index",
|
||
|
"iconPath": "icon/icon_home.png",
|
||
|
"selectedIconPath": "icon/icon_home_HL.png",
|
||
|
"text": "首页"
|
||
|
},
|
||
|
{
|
||
|
"pagePath": "/pages/middle/middle",
|
||
|
"iconPath": "icon/icon_release.png",
|
||
|
"isSpecial": true,
|
||
|
"text": "发布"
|
||
|
},
|
||
|
{
|
||
|
"pagePath": "/pages/mine/mine",
|
||
|
"iconPath": "icon/icon_mine.png",
|
||
|
"selectedIconPath": "icon/icon_mine_HL.png",
|
||
|
"text": "我的"
|
||
|
}
|
||
|
]
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
|
||
|
//# sourceMappingURL=app.js.map
|