fix
This commit is contained in:
@@ -2,9 +2,40 @@
|
|||||||
App<IAppOption>({
|
App<IAppOption>({
|
||||||
globalData: {},
|
globalData: {},
|
||||||
onLaunch() {
|
onLaunch() {
|
||||||
|
const updateManager = wx.getUpdateManager()
|
||||||
|
|
||||||
|
updateManager.onCheckForUpdate(function (res) {
|
||||||
|
// 请求完新版本信息的回调
|
||||||
|
console.log('是否有新版本', res.hasUpdate)
|
||||||
|
})
|
||||||
|
|
||||||
|
updateManager.onUpdateReady(function () {
|
||||||
|
// 新版本下载完毕,强制重启应用
|
||||||
|
wx.showModal({
|
||||||
|
title: '更新提示',
|
||||||
|
content: '新版本已就绪,即将重启应用',
|
||||||
|
showCancel: false,
|
||||||
|
success: function (res) {
|
||||||
|
if (res.confirm) {
|
||||||
|
// 强制重启,应用新版本
|
||||||
|
updateManager.applyUpdate()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
updateManager.onUpdateFailed(function () {
|
||||||
|
// 新版本下载失败
|
||||||
|
wx.showModal({
|
||||||
|
title: '更新提示',
|
||||||
|
content: '新版本下载失败,请检查网络后重试',
|
||||||
|
showCancel: false
|
||||||
|
})
|
||||||
|
})
|
||||||
const envVersion = wx.getAccountInfoSync().miniProgram.envVersion
|
const envVersion = wx.getAccountInfoSync().miniProgram.envVersion
|
||||||
if (envVersion !== 'release') {
|
if (envVersion !== 'release') {
|
||||||
wx.reLaunch({ url: '/pages/tools/index' })
|
wx.reLaunch({ url: '/pages/tools/index' })
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user