From 900e4776223c2a42d8859fc8cd635c13ffcfb3b5 Mon Sep 17 00:00:00 2001
From: 如洲 陈 <1278080563@qq.com>
Date: 星期二, 30 九月 2025 11:12:13 +0800
Subject: [PATCH] 出库检优化

---
 pages/BasePages/main.vue |   85 ++++++++++++++++++++++++++----------------
 1 files changed, 52 insertions(+), 33 deletions(-)

diff --git a/pages/BasePages/main.vue b/pages/BasePages/main.vue
index a8d1302..4a68a39 100644
--- a/pages/BasePages/main.vue
+++ b/pages/BasePages/main.vue
@@ -18,11 +18,11 @@
 							<navigator navigateTo class="grid-item-box" hover-class="none" :url="`../${item.path}`">
 								<image v-if="item.icoimg" class="imgMenu" :src="`${item.icoimg}`"></image>
 								<image v-else class="imgMenu" src="/static/img/imgMenu/APP01.png"></image>
-								<uni-notice-bar v-if="item.pagE_VIEW.length>6" :speed="30"
+					<uni-notice-bar v-if="item.pagE_VIEW && item.pagE_VIEW.length>6" :speed="30"
 									style="padding:0;margin-bottom:0;font-weight: 900;" textSize="13px"
-									background-color="#ffffff" color="#000000" :scrollable="item.pagE_VIEW.length>6"
-									:single="true" :text="item.pagE_VIEW" />
-								<text v-else class="text">{{ item.pagE_VIEW }}</text>
+								background-color="#ffffff" color="#000000" :scrollable="item.pagE_VIEW && item.pagE_VIEW.length>6"
+								:single="true" :text="item.pagE_VIEW || ''" />
+								<text v-else class="text">{{ item.pagE_VIEW || '' }}</text>
 							</navigator>
 						</uni-grid-item>
 					</uni-grid>
@@ -53,6 +53,8 @@
 					"../../static/img/SN-GG1.png"
 				],
 				col: 4, //鑿滃崟鍒楁暟
+				updateChecked: false,
+				msg: "",
 			};
 		},
 		methods: {
@@ -100,35 +102,48 @@
 				})
 			},
 			checkForUpdate() {
-							this.$post({
-								url: "/Login/getAppUpgradeInfo",
-								data: {}
-							}).then(res => {
-								
-								let newVersion = res.data.version;
-								let currentVersion = uni.getSystemInfoSync(); // 鑾峰彇褰撳墠 APK 鐗堟湰鍙�
-								 
-								if (newVersion > currentVersion.appVersion) {
-									uni.showModal({
-										title: "鍙戠幇鏂扮増鏈�",
-										content: "鏄惁涓嬭浇鏈�鏂扮増鏈�?",
-										success: (modalRes) => {
-											if (modalRes.confirm) {
-												this.downloadNewApk(res.data.apkUrl);
-											}
-										}
-									});
-									//this.downloadNewApk(res.data.apkUrl);
-									this.updateChecked = true; // 鏍囪鏇存柊宸叉鏌ヨ繃
-									//      // 濡傛灉鏈夋柊鐗堟湰锛屽紑濮嬩笅杞�
-									//download(res.data.apkUrl);
+				if (this.updateChecked) return;
+				if (!this.$post || typeof this.$post !== 'function') return;
+				this.$post({
+					url: "/Login/getAppUpgradeInfo",
+					data: {}
+				}).then(res => {
+					const newVersion = res && res.data ? res.data.version : null;
+					const sysInfo = uni.getSystemInfoSync();
+					const currentVersion = sysInfo && sysInfo.appVersion ? sysInfo.appVersion : null;
+					if (!newVersion || !currentVersion) {
+						this.updateChecked = true;
+						return; // 闈� APP 绔垨缂哄皯鐗堟湰淇℃伅鏃惰烦杩�
+					}
+					// 绠�鍗曟瘮杈冿紝涓嶅鐞嗗鏉傝涔夌増鏈�
+					if (String(newVersion) !== String(currentVersion)) {
+						uni.showModal({
+							title: "鍙戠幇鏂扮増鏈�",
+							content: "鏄惁涓嬭浇鏈�鏂扮増鏈�?",
+							success: (modalRes) => {
+								if (modalRes.confirm) {
+									this.downloadNewApk(res.data.apkUrl);
 								}
-							})
-							
-						},
+							}
+						});
+						this.updateChecked = true;
+					}
+				}).catch(err => {
+					console.error('getAppUpgradeInfo error:', err);
+					this.updateChecked = true;
+				})
+			},
 			
 			
 						downloadNewApk(apkUrl) {
+							if (typeof plus === "undefined" || !plus.runtime) {
+								uni.showToast({
+									title: "浠呮敮鎸佸湪APP鍐呮洿鏂�",
+									icon: "none",
+									duration: 2000
+								});
+								return;
+							}
 							uni.showToast({
 								title: "寮�濮嬩笅杞芥洿鏂�...",
 								icon: "none",
@@ -191,16 +206,20 @@
 				});
 			} else {
 				this.getMenu(true);
-				// 妫�鏌ュ簲鐢ㄦ洿鏂�
-				this.checkForUpdate();
+				// 妫�鏌ュ簲鐢ㄦ洿鏂帮紙浠� APP 绔級
+				if (typeof plus !== "undefined") {
+					this.checkForUpdate();
+				}
 			}
 
 		},
 		onPullDownRefresh() {
 			if (this.loginInfo.hasLogin) {
 				this.getMenu(true);
-				// 涓嬫媺鍒锋柊鏃朵篃妫�鏌ユ洿鏂�
-				this.checkForUpdate();
+				// 涓嬫媺鍒锋柊鏃朵篃妫�鏌ユ洿鏂帮紙浠� APP 绔級
+				if (typeof plus !== "undefined") {
+					this.checkForUpdate();
+				}
 			}
 		},
 

--
Gitblit v1.9.3