From ceb7ece71c7c70a2eabdbea64674bb4f5827961a Mon Sep 17 00:00:00 2001
From: whycq <you@example.com>
Date: 星期四, 02 二月 2023 22:01:38 +0800
Subject: [PATCH] #

---
 App.vue |   72 ++++++++++++++++++++++++++++++++++--
 1 files changed, 68 insertions(+), 4 deletions(-)

diff --git a/App.vue b/App.vue
index c8fed19..2b02d83 100644
--- a/App.vue
+++ b/App.vue
@@ -84,8 +84,8 @@
 			]
 		},
 		onShow: function() {
-			this.getVersion();
-			this.baseUrll = uni.getStorageSync("baseUrl")
+			// this.getVersion();
+			// this.baseUrll = uni.getStorageSync("baseUrl")
 			// console.log(this.baseUrll);
 			console.log('App Show')
 		},
@@ -117,9 +117,9 @@
 			getUpdateVersion() {
 				let that = this;
 				uni.request({
-					url: that.baseUrll + "/appUpdate/queryUpdate",
+					url: that.baseUrll + "/mobile/appUpdate/queryUpdate",
+					// data: {combParam: 'asd'},
 					method:'GET',
-					data: {combParam: 'asd'},
 					success(res) {
 						console.log(res);
 					}
@@ -177,6 +177,70 @@
 				});
 				complete: () => {}
 			},
+			downWgt() {
+				let that = this;
+				const downloadUrl = "http://192.168.4.188:8088/jfwms/static/appupload/android_debug.apk"
+				console.log('url:' + downloadUrl)
+				uni.showLoading({
+					title: '鏇存柊涓�︹��'
+				})
+				// return
+				const downloadTask = uni.downloadFile({ //鎵ц涓嬭浇
+					url: downloadUrl, //涓嬭浇鍦板潃
+					timeout: 1000 * 30, //30绉掕秴鏃舵椂闂�
+					success: downloadResult => { //涓嬭浇鎴愬姛
+						console.log(downloadResult);
+						that.showdownLine = false
+						uni.hideLoading();
+						console.log('downloadResult.statusCode' + downloadResult.statusCode)
+						if (downloadResult.statusCode == 200) {
+							console.log('鏇存柊涓�')
+							uni.showModal({
+								title: '',
+								content: '鏇存柊鎴愬姛锛岀‘瀹氱幇鍦ㄩ噸鍚悧锛�',
+								confirmText: '閲嶅惎',
+								confirmColor: '#EE8F57',
+								success: function(res) {
+									if (res.confirm == true) {
+										plus.runtime.install( //瀹夎
+											downloadResult.tempFilePath, {
+												force: true
+											},
+											function(res) {
+												utils.showToast('鏇存柊鎴愬姛锛岄噸鍚腑');
+												plus.runtime.restart();
+											}
+										);
+									}
+								}
+							});
+						}
+					},
+					fail: err => {
+						uni.hideLoading();
+						that.showdownLine = false
+						that.$u.toast(err.errMsg)
+						console.log(err)
+					},
+					complete: com => {
+						console.log(com)
+					}
+				});
+			
+				// 涓嬭浇杩涘害
+				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();
+					// }
+				});
+			},
 		}
 	}
 </script>

--
Gitblit v1.9.1