From e9d68d1928d5d308228be93009e8e933427e041c Mon Sep 17 00:00:00 2001
From: hejianhao <15708179461@qq.com>
Date: 星期五, 28 八月 2026 11:27:09 +0800
Subject: [PATCH] fix0806: 没有版本更新需要展示标签

---
 traditionalApp/utils/app-version.js |   29 ++++++++++++++++++++++++++---
 1 files changed, 26 insertions(+), 3 deletions(-)

diff --git a/traditionalApp/utils/app-version.js b/traditionalApp/utils/app-version.js
index 8e6b9e1..528fd5c 100644
--- a/traditionalApp/utils/app-version.js
+++ b/traditionalApp/utils/app-version.js
@@ -49,15 +49,18 @@
 			versionName: ''
 		}
 		if (typeof plus === 'undefined' || !plus.runtime || typeof plus.runtime.getProperty !== 'function') {
+			console.log('[APP版本] 系统版本信息', fallbackInfo)
 			resolve(fallbackInfo)
 			return
 		}
 		plus.runtime.getProperty(plus.runtime.appid, (info) => {
-			resolve({
+			const runtimeInfo = {
 				platform: resolvePlatform(),
 				versionCode: normalizeVersionCode(info && info.versionCode),
 				versionName: normalizeText(info && info.version)
-			})
+			}
+			console.log('[APP版本] 系统版本信息', runtimeInfo)
+			resolve(runtimeInfo)
 		})
 	})
 }
@@ -96,6 +99,7 @@
 				'content-type': 'application/json'
 			},
 			success: (res) => {
+				console.log('[APP版本] 后台接口数据', JSON.stringify(res.data || {}))
 				resolve(res.data || {})
 			},
 			fail: reject
@@ -168,16 +172,35 @@
 		plus.runtime.openURL(downloadUrl)
 		return
 	}
+	let lastProgress = -1
+	const downloadWaiting = plus.nativeUI.showWaiting('正在下载 0%', {
+		modal: true,
+		back: 'none'
+	})
 	const downloadTask = plus.downloader.createDownload(downloadUrl, {}, (download, status) => {
+		downloadWaiting.close()
 		if (status !== 200 || !download.filename) {
 			handleUpdateFailure('安装包下载失败,请重试')
 			return
 		}
 		const apkPath = plus.io.convertLocalFileSystemURL(download.filename)
-		plus.runtime.install(apkPath, {}, undefined, () => {
+		plus.runtime.install(apkPath, {}, () => {
+		}, () => {
 			handleUpdateFailure('安装失败,请重试')
 		})
 	})
+	downloadTask.addEventListener('statechanged', (download) => {
+		const totalSize = Number(download.totalSize || 0)
+		if (totalSize <= 0) {
+			return
+		}
+		const progress = Math.min(100, Math.floor(Number(download.downloadedSize || 0) * 100 / totalSize))
+		if (progress === lastProgress) {
+			return
+		}
+		lastProgress = progress
+		downloadWaiting.setTitle(`正在下载 ${progress}%`)
+	})
 	downloadTask.start()
 }
 

--
Gitblit v1.7.1