|
@@ -563,24 +563,33 @@ export default {
|
|
|
updateManager.onCheckForUpdate(function (res) {
|
|
updateManager.onCheckForUpdate(function (res) {
|
|
|
// 请求完新版本信息的回调
|
|
// 请求完新版本信息的回调
|
|
|
console.log('++++++++++onCheckForUpdate++++++++++',res.hasUpdate);
|
|
console.log('++++++++++onCheckForUpdate++++++++++',res.hasUpdate);
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
- updateManager.onUpdateReady(function (res) {
|
|
|
|
|
- uni.showModal({
|
|
|
|
|
- title: '更新提示',
|
|
|
|
|
- content: '新版本已经准备好,是否重启应用?',
|
|
|
|
|
- success(res) {
|
|
|
|
|
- if (res.confirm) {
|
|
|
|
|
- // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
|
|
|
|
|
- updateManager.applyUpdate();
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
- updateManager.onUpdateFailed(function (res) {
|
|
|
|
|
- // 新的版本下载失败
|
|
|
|
|
|
|
+ if (res.hasUpdate){
|
|
|
|
|
+
|
|
|
|
|
+ updateManager.onUpdateReady(function (res) {
|
|
|
|
|
+ console.log('+++++++++onUpdateReady+++++++++++++',res)
|
|
|
|
|
+ uni.showModal({
|
|
|
|
|
+ title: '更新提示',
|
|
|
|
|
+ content: '新版本已经准备好,是否重启应用?',
|
|
|
|
|
+ showCancel:false,
|
|
|
|
|
+ success(res) {
|
|
|
|
|
+ if (res.confirm) {
|
|
|
|
|
+ // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
|
|
|
|
|
+ updateManager.applyUpdate();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ updateManager.onUpdateFailed(function (res) {
|
|
|
|
|
+ // 新的版本下载失败
|
|
|
|
|
+ console.log('+++++++++onUpdateFailed+++++++++++++',res)
|
|
|
|
|
+ uni.showModal({
|
|
|
|
|
+ title: '更新提示',
|
|
|
|
|
+ content: '检测到小程序更新,但是下载失败,请检查网络',
|
|
|
|
|
+ showCancel:false
|
|
|
|
|
+ });
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
|
|
|