jt
2024-03-05 c291afa1f4cac515f4cef644103114ea03689ff9
pages/login/index.vue
@@ -283,6 +283,50 @@
               });
               return;
            }
            var ser = this.userServer.split('/');
            var $this = this;
            if(ser[1] == 'mobox3'){ //判断当前网址是否是mobox3
               var url = 'http://'+this.userServer+'/Program/version.txt';
               // console.log(url);
               uni.request({
                  url: url, // 指定JS文件的完整路径
                  method: 'GET',
                  success(res) {
                     console.log(res);
                     if (res && res.statusCode === 200) {
                        //获取当前版本号
                        var VersionName = res.data; //更新包名称
                        var versionInfo = res.data.split('_');
                        var versionNum = versionInfo[2].replace(".apk", ""); //版本编码
                        var VersionCode = versionInfo[2].replace(".apk", "").replace(".", "").replace(".", ""); //服务端版本号
                        // this.downloadUrl = resp.PdaUrl+"/"+VersionName; //app下载链接
                        $this.downloadUrl = "http://" + $this.userServer + "/Program/" + VersionName; //app下载链接this.
                        var isver = $this.compare(versionNum,version);
                        if (isver) {
                           $this.$refs.promotion.open();
                        } else {
                           console.log('当前已是最新版本')
                        }
                     } else {
                        uni.showModal({
                           title: "提示",
                           content: '请求失败:'+ err,
                           showCancel: false,
                           confirmText: "取消"
                        });
                     }
                  },
                  fail(err) {
                     // 错误处理逻辑
                     uni.showModal({
                        title: "错误",
                        content: '获取'+url+'文件失败:'+ err,
                        showCancel: false,
                        confirmText: "取消"
                     });
                  }
               });
            }else{
            var dataInfo = {
               server: this.userServer
            };
@@ -299,10 +343,10 @@
                     const VersionCode = resp.VersionCode; //版本编码
                     const versionNum = resp.Version; //服务端版本号
                     // this.downloadUrl = resp.PdaUrl+"/"+VersionName; //app下载链接
                     this.downloadUrl = "http://" + this.userServer + "/Program/" + VersionName; //app下载链接this.
                     var isver = this.compare(versionNum,version);
                        $this.downloadUrl = "http://" + $this.userServer + "/Program/" + VersionName; //app下载链接this.
                        var isver = $this.compare(versionNum,version);
                     if (isver) {
                        this.$refs.promotion.open();
                           $this.$refs.promotion.open();
                     } else {
                        console.log('当前已是最新版本')
                     }
@@ -324,6 +368,7 @@
                  confirmText: "取消"
               });
            });
            }
         },
         compare(curV, reqV) {
            var arr1 = curV.toString().split('.');