|
@@ -118,27 +118,44 @@ export async function wxLoginFn(update) {
|
|
|
|
|
|
|
|
//启动更新逻辑 shish 2020.5.18
|
|
//启动更新逻辑 shish 2020.5.18
|
|
|
if (subRes.data.update == 1) {
|
|
if (subRes.data.update == 1) {
|
|
|
- const updateManager = wx.getUpdateManager()
|
|
|
|
|
- console.log('请求完新版本信息的回调')
|
|
|
|
|
- updateManager.onCheckForUpdate(function (res) {
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ const updateManager = uni.getUpdateManager();
|
|
|
|
|
+ updateManager.onCheckForUpdate(function(res) {
|
|
|
// 请求完新版本信息的回调
|
|
// 请求完新版本信息的回调
|
|
|
- console.log(res.hasUpdate)
|
|
|
|
|
- })
|
|
|
|
|
- updateManager.onUpdateReady(function () {
|
|
|
|
|
- wx.showModal({
|
|
|
|
|
- title: '更新提示',
|
|
|
|
|
- content: '新版本已经准备好,是否重启应用?',
|
|
|
|
|
|
|
+ if (res.hasUpdate) {
|
|
|
|
|
+ updateManager.onUpdateReady(function(res2) {
|
|
|
|
|
+ uni.showModal({
|
|
|
|
|
+ title: '更新提示',
|
|
|
|
|
+ content: '发现新版本,请重启应用',
|
|
|
|
|
+ cancelColor:'#eeeeee',
|
|
|
|
|
+ confirmColor:'#FF0000',
|
|
|
|
|
+ success(res2) {
|
|
|
|
|
+ if (res2.confirm) {
|
|
|
|
|
+ // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
|
|
|
|
|
+ updateManager.applyUpdate();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ updateManager.onUpdateFailed(function(res) {
|
|
|
|
|
+ // 新的版本下载失败
|
|
|
|
|
+ uni.showModal({
|
|
|
|
|
+ title: '提示',
|
|
|
|
|
+ content: '检查到有新版本,但下载失败,请检查网络连接',
|
|
|
success(res) {
|
|
success(res) {
|
|
|
if (res.confirm) {
|
|
if (res.confirm) {
|
|
|
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
|
|
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
|
|
|
- updateManager.applyUpdate()
|
|
|
|
|
|
|
+ updateManager.applyUpdate();
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- })
|
|
|
|
|
- })
|
|
|
|
|
- updateManager.onUpdateFailed(function () {
|
|
|
|
|
- // 新版本下载失败
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ });
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
})
|
|
})
|