From 9e885d8274a760a59a9f8dfd26ade186546b298d Mon Sep 17 00:00:00 2001 From: whycq <913841844@qq.com> Date: 星期日, 05 二月 2023 19:26:56 +0800 Subject: [PATCH] # --- App.vue | 21 +++++++++------------ 1 files changed, 9 insertions(+), 12 deletions(-) diff --git a/App.vue b/App.vue index a0dff61..c206b2f 100644 --- a/App.vue +++ b/App.vue @@ -4,6 +4,7 @@ globalData: { baseHttp: '', baseUrll: '', + upVersion: 0, }, onLaunch: function() { Vue.prototype.ColorList = [{ @@ -86,7 +87,6 @@ onShow: function() { this.getVersion(); this.baseUrll = uni.getStorageSync("baseUrl") - // console.log(this.baseUrll); console.log('App Show') }, onHide: function() { @@ -120,7 +120,13 @@ url: that.baseUrll + "/mobile/appUpdate/queryUpdate", method:'GET', success(res) { - console.log(res); + // 鏂癮pp鐗堟湰 + that.upVersion = Number(res.data.data) + // 褰撳墠app鐗堟湰 + let currentVersion = Number(that.version) + if(that.upVersion > currentVersion) { + that.downWgt(); //涓嬭浇鏂囦欢 + } } }) return @@ -178,8 +184,7 @@ }, downWgt() { let that = this; - const downloadUrl = "http://192.168.4.188:8088/jfwms/static/appupload/android_debug.apk" - console.log('url:' + downloadUrl) + const downloadUrl = that.baseUrll + "/static/appupload/" + that.upVersion + ".apk" uni.showLoading({ title: '鏇存柊涓�︹��' }) @@ -228,16 +233,8 @@ // 涓嬭浇杩涘害 downloadTask.onProgressUpdate(res => { - // that.$u.toast(res.progress) that.downloadNum = res.progress console.log('涓嬭浇杩涘害' + that.downloadNum); - // console.log('宸茬粡涓嬭浇鐨勬暟鎹暱搴�' + res.totalBytesWritten); - // console.log('棰勬湡闇�瑕佷笅杞界殑鏁版嵁鎬婚暱搴�' + res.totalBytesExpectedToWrite); - - // 婊¤冻娴嬭瘯鏉′欢锛屽彇娑堜笅杞戒换鍔°�� - // if (res.progress > 50) { - // downloadTask.abort(); - // } }); }, } -- Gitblit v1.9.1