diff --git a/src/pages/login/login/index.vue b/src/pages/login/login/index.vue index 318781e..e26ea7b 100644 --- a/src/pages/login/login/index.vue +++ b/src/pages/login/login/index.vue @@ -152,43 +152,48 @@ export default class LoginPage extends BasePage { } Version = '1.0.1'; async update() { - await session.QueryVersion(); - if (this.Version < session.Version) { - // 版本更新提示 - uni.showModal({ - content: this.$t('message.Tip1') as string, - confirmText: this.$t('message.workArea_Confirm') as string, - cancelText: this.$t('message.Cancel') as string, - showCancel: false, - success: (res) => { - if (res.confirm) { - //确定执行下载 - let downloadApkUrl = session.url; - uni.showLoading({ - title: vm.$t('message.uploading') as string, - //title: '正在下载中..........', - }); - ////////////////uni下载方法, - uni.downloadFile({ - url: downloadApkUrl, - success: (downloadResult) => { - uni.hideLoading(); - if (downloadResult.statusCode == 200) { - //安装更新 - plus.runtime.install(downloadResult.tempFilePath as any, { force: true }, function () { - //uni.showToast('更新成功,重启'); - plus.runtime.restart(); - }); - } - }, - }); - } else if (res.cancel) { - this.go(); - } - }, - }); - return; + try { + await session.QueryVersion(); + if (this.Version < session.Version) { + // 版本更新提示 + uni.showModal({ + content: this.$t('message.Tip1') as string, + confirmText: this.$t('message.workArea_Confirm') as string, + cancelText: this.$t('message.Cancel') as string, + showCancel: false, + success: (res) => { + if (res.confirm) { + //确定执行下载 + let downloadApkUrl = session.url; + uni.showLoading({ + title: vm.$t('message.uploading') as string, + //title: '正在下载中..........', + }); + ////////////////uni下载方法, + uni.downloadFile({ + url: downloadApkUrl, + success: (downloadResult) => { + uni.hideLoading(); + if (downloadResult.statusCode == 200) { + //安装更新 + plus.runtime.install(downloadResult.tempFilePath as any, { force: true }, function () { + //uni.showToast('更新成功,重启'); + plus.runtime.restart(); + }); + } + }, + }); + } else if (res.cancel) { + this.go(); + } + }, + }); + return; + } + } catch (e) { + console.log('error', e); } + this.go(); } /////////////////无用代码无用代码