#
whycq
2023-03-22 a4b95f039ae59662454df8a7541b270006c515c1
pages/login/login.vue
@@ -235,7 +235,6 @@
            let that = this;
            uni.getSystemInfo({
               success: (res) => {
                  console.log(res.platform);
                  if (res.platform == "android") {
                     that.AndroidCheckUpdate();
                  }
@@ -247,24 +246,20 @@
            let that = this;
            plus.runtime.getProperty(plus.runtime.appid, (wgtinfo) => {
               that.version = wgtinfo.version //客户端版本号
               console.log('当前app版本信息:' + that.version);
            })
            setTimeout(()=>{
               that.getUpdateVersion()
            },1000)
            },100)
         },
         // 校验版本
         getUpdateVersion() {
            console.log(this.version);
            let that = this
            let type = 0
            if (that.baseUrl == 'http://undefined:undefined/undefined') {
               return
            }
            console.log(2);
            
            let url = that.baseUrl + '/appVersion/checkUpdate/' + that.version + '/' + type
            console.log(url);
            uni.request({
               url: url,
               method: 'GET',
@@ -289,21 +284,17 @@
         downWgt() {
            let that = this;
            const downloadUrl = that.baseUrl + "/appVersion/downloadApp/" + that.filename
            console.log(downloadUrl);
            uni.showLoading({
               title: '更新中……'
            })
            console.log('*************************************');
            const downloadTask = uni.downloadFile({ //执行下载
               url: downloadUrl, //下载地址
               timeout: 1000 * 30, //30秒超时时间
               success: downloadResult => { //下载成功
                  console.log(downloadResult);
                  // that.showdownLine = false
                  that.showdownLine = false
                  uni.hideLoading();
                  console.log('downloadResult.statusCode' + downloadResult.statusCode)
                  if (downloadResult.statusCode == 200) {
                     console.log('更新中')
                     uni.showModal({
                        title: '',
                        content: '更新成功,确定现在重启吗?',
@@ -323,15 +314,22 @@
                           }
                        }
                     });
                  } else {
                     uni.hideLoading();
                     that.showdownLine = false
                     uni.showToast({
                        title:'请先上传安装包',
                        icon: 'error'
                     })
                  }
               },
               fail: err => {
                  uni.hideLoading();
                  that.showdownLine = false
                  that.$u.toast(err.errMsg)
                  console.log(err)
                  that.$u.toast(downloadResult.errMsg)
               },
               complete: com => {
                  console.log(com)
               }
            });