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 |  408 +++++++++++++++++++++++++++++++++++++---------------------
 1 files changed, 259 insertions(+), 149 deletions(-)

diff --git a/pages/BasePages/main.vue b/pages/BasePages/main.vue
index 99476ef..4a68a39 100644
--- a/pages/BasePages/main.vue
+++ b/pages/BasePages/main.vue
@@ -1,164 +1,274 @@
 <template>
-  <uni-base-page :footer="false">
-    <view slot="page">
-      <view v-if="loginInfo.hasLogin">
-        <!-- 鏁欏瑙嗛銆佸叕鍙稿唴閮ㄥ浼犲浘鐗囩瓑 -->
-        <swiper indicator-dots="true" :autoplay="true" :interval="3000">
-          <swiper-item v-for="(img,key) in imgUrls" :key="key">
-            <image :src="img"/>
-          </swiper-item>
-        </swiper>
-        <!-- 閫氭姤鎵硅瘎銆佹秷鎭璀︺�佸叕鍛娿�佹姤鍛� -->
-        <uni-notice-bar :show-icon="true" :scrollable="true" :speed="30" :single="true"
-                        text="閫氭姤鎵硅瘎,娑堟伅棰勮,鍏憡/鎶ュ憡,鎻愮ず娑堟伅,閫氭姤鎵硅瘎,娑堟伅棰勮,鍏憡/鎶ュ憡,鎻愮ず娑堟伅,閫氭姤鎵硅瘎,娑堟伅棰勮,鍏憡/鎶ュ憡,鎻愮ず娑堟伅,閫氭姤鎵硅瘎,娑堟伅棰勮,鍏憡/鎶ュ憡,鎻愮ず娑堟伅,閫氭姤鎵硅瘎,娑堟伅棰勮,鍏憡/鎶ュ憡,鎻愮ず娑堟伅,閫氭姤鎵硅瘎,娑堟伅棰勮,鍏憡/鎶ュ憡,鎻愮ず娑堟伅,閫氭姤鎵硅瘎,娑堟伅棰勮,鍏憡/鎶ュ憡,鎻愮ず娑堟伅,"/>
-        <!-- 鐢ㄦ埛绯荤粺鑿滃崟妯″潡 -->
-        <view class="example-body">
-          <uni-grid :column="col" :showBorder="true">
-            <uni-grid-item v-for="(item, index) in userMenu" :index="index" :key="index">
-              <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"
-                                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>
-              </navigator>
-            </uni-grid-item>
-          </uni-grid>
-        </view>
-      </view>
-      <view v-if="!loginInfo.hasLogin">
-        <view class="title">
-          鎮ㄥソ 娓稿銆�
-        </view>
-        <view class="ul">
-          <view>杩欐槸 XXMES 棣栭〉銆�</view>
-          <view>鍦� 鈥滄垜鐨勨�� 涓偣鍑� 鈥滅櫥褰曗�� 鍙互 鈥滅櫥褰曟偍鐨勮处鎴封��</view>
-        </view>
-      </view>
-    </view>
-  </uni-base-page>
+	<uni-base-page :footer="false">
+		<view slot="page">
+			<view v-if="loginInfo.hasLogin">
+				<!-- 鏁欏瑙嗛銆佸叕鍙稿唴閮ㄥ浼犲浘鐗囩瓑 -->
+				<swiper indicator-dots="true" :autoplay="true" :interval="3000">
+					<swiper-item v-for="(img,key) in imgUrls" :key="key">
+						<image :src="img" />
+					</swiper-item>
+				</swiper>
+				<!-- 閫氭姤鎵硅瘎銆佹秷鎭璀︺�佸叕鍛娿�佹姤鍛� -->
+				<uni-notice-bar :show-icon="true" :scrollable="true" :speed="30" :single="true"
+					text="閫氭姤鎵硅瘎,娑堟伅棰勮,鍏憡/鎶ュ憡,鎻愮ず娑堟伅,閫氭姤鎵硅瘎,娑堟伅棰勮,鍏憡/鎶ュ憡,鎻愮ず娑堟伅,閫氭姤鎵硅瘎,娑堟伅棰勮,鍏憡/鎶ュ憡,鎻愮ず娑堟伅,閫氭姤鎵硅瘎,娑堟伅棰勮,鍏憡/鎶ュ憡,鎻愮ず娑堟伅,閫氭姤鎵硅瘎,娑堟伅棰勮,鍏憡/鎶ュ憡,鎻愮ず娑堟伅,閫氭姤鎵硅瘎,娑堟伅棰勮,鍏憡/鎶ュ憡,鎻愮ず娑堟伅,閫氭姤鎵硅瘎,娑堟伅棰勮,鍏憡/鎶ュ憡,鎻愮ず娑堟伅," />
+				<!-- 鐢ㄦ埛绯荤粺鑿滃崟妯″潡 -->
+				<view class="example-body">
+					<uni-grid :column="col" :showBorder="true">
+						<uni-grid-item v-for="(item, index) in userMenu" :index="index" :key="index">
+							<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 && 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 && 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>
+				</view>
+			</view>
+			<view v-if="!loginInfo.hasLogin">
+				<view class="title">
+					鎮ㄥソ 娓稿銆�
+				</view>
+				<view class="ul">
+					<view>杩欐槸 XXMES 棣栭〉銆�</view>
+					<view>鍦� 鈥滄垜鐨勨�� 涓偣鍑� 鈥滅櫥褰曗�� 鍙互 鈥滅櫥褰曟偍鐨勮处鎴封��</view>
+				</view>
+			</view>
+		</view>
+	</uni-base-page>
 </template>
 
 <script>
-export default {
-  data() {
-    return {
-      loginInfo: this.$loginInfo,
-      color: this.$defaultColor,
-      userMenu: [],
-      imgUrls: [
-        "../../static/img/SN-GG.png",
-        "../../static/img/SN-GG1.png"
-      ],
-      col: 4, //鑿滃崟鍒楁暟
-    };
-  },
-  methods: {
-    getMenu(isShowMask) {
-      if (isShowMask) uni.showLoading({
-        mask: true,
-        title: "鍔犺浇涓�..."
-      });
-      this.$getUserMenu({
-        type: 'sys',
-        programId: this.loginInfo.sysNumber,
-        success: (res) => {
-          this.userMenu = res;
-          uni.stopPullDownRefresh();
-        },
-        fail: (err) => {
+	export default {
+		data() {
+			return {
+				loginInfo: this.$loginInfo,
+				color: this.$defaultColor,
+				userMenu: [],
+				imgUrls: [
+					"../../static/img/SN-GG.png",
+					"../../static/img/SN-GG1.png"
+				],
+				col: 4, //鑿滃崟鍒楁暟
+				updateChecked: false,
+				msg: "",
+			};
+		},
+		methods: {
+			getMenu(isShowMask) {
+				if (isShowMask) uni.showLoading({
+					mask: true,
+					title: "鍔犺浇涓�..."
+				});
+				this.$getUserMenu({
+					type: 'sys',
+					programId: this.loginInfo.sysNumber,
+					success: (res) => {
+						this.userMenu = res;
+						uni.stopPullDownRefresh();
+					},
+					fail: (err) => {
 
-        },
-        complete() {
-          if (isShowMask) uni.hideLoading();
-        }
-      });
-    }
-  },
-  onLoad() {
-    if (!this.loginInfo.hasLogin) {
-      uni.showModal({
-        title: '鏈櫥褰�',
-        content: '鎮ㄦ湭鐧诲綍锛岄渶瑕佺櫥褰曞悗鎵嶈兘缁х画',
-        /**
-         * 濡傛灉闇�瑕佸己鍒剁櫥褰曪紝涓嶆樉绀哄彇娑堟寜閽�
-         */
-        showCancel: !this.loginInfo.forcedLogin,
-        success: (res) => {
-          if (res.confirm) {
-            /**
-             * 濡傛灉闇�瑕佸己鍒剁櫥褰曪紝浣跨敤reLaunch鏂瑰紡
-             */
-            if (this.loginInfo.forcedLogin) {
-              uni.reLaunch({
-                url: 'login'
-              });
-            } else {
-              uni.navigateTo({
-                url: 'login'
-              });
-            }
-          }
-        }
-      });
-    } else {
-      this.getMenu(true);
-    }
+					},
+					complete() {
+						if (isShowMask) uni.hideLoading();
+					}
+				});
+			},
+			getIsMsg() {
+				this.$post({
+					url: "/MessageCenter/IsShow",
+					data: {
+						createBy: this.$loginInfo.account,
+						isShow: 1,
+					},
+				}).then(res => {
+					if (res.data.tbBillList > 0) {
+						this.msg = "鎮ㄦ湁鏂扮殑寮傚父寰呭鐞�/鎮ㄦ湁鏂扮殑寮傚父寰呭鐞�";
+						//灞曠ず鍥炬爣
+						uni.showTabBarRedDot({
+							index: 1
+						});
+					} else {
+						this.msg = "瀹佹尝骞挎繁绉戞妧鏈夐檺鍏徃";
+						//灞曠ず鍥炬爣
+						uni.hideTabBarRedDot({
+							index: 1
+						});
+					}
+				})
+			},
+			checkForUpdate() {
+				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",
+								duration: 2000
+							});
+			
+							uni.downloadFile({
+								url: apkUrl,
+								success: (res) => {
+									if (res.statusCode === 200) {
+										plus.runtime.install(res.tempFilePath, {
+											force: true
+										}, function() {
+											console.log("瀹夎鎴愬姛锛岄噸鍚簲鐢�");
+											//plus.runtime.restart();
+											//plus.runtime.quit();
+											// uni.navigateBack()
+										}, function(e) {
+											console.error("瀹夎澶辫触:", e);
+										});
+									}
+								},
+								fail: (err) => {
+									console.error("涓嬭浇澶辫触:", err);
+									uni.showToast({
+										title: "涓嬭浇澶辫触锛岃妫�鏌ョ綉缁�",
+										icon: "none",
+										duration: 2000
+									});
+								}
+							});
+						}
+					
+		},
+		onLoad() {
+			if (!this.loginInfo.hasLogin) {
+				uni.showModal({
+					title: '鏈櫥褰�',
+					content: '鎮ㄦ湭鐧诲綍锛岄渶瑕佺櫥褰曞悗鎵嶈兘缁х画',
+					/**
+					 * 濡傛灉闇�瑕佸己鍒剁櫥褰曪紝涓嶆樉绀哄彇娑堟寜閽�
+					 */
+					showCancel: !this.loginInfo.forcedLogin,
+					success: (res) => {
+						if (res.confirm) {
+							/**
+							 * 濡傛灉闇�瑕佸己鍒剁櫥褰曪紝浣跨敤reLaunch鏂瑰紡
+							 */
+							if (this.loginInfo.forcedLogin) {
+								uni.reLaunch({
+									url: 'login'
+								});
+							} else {
+								uni.navigateTo({
+									url: 'login'
+								});
+							}
+						}
+					}
+				});
+			} else {
+				this.getMenu(true);
+				// 妫�鏌ュ簲鐢ㄦ洿鏂帮紙浠� APP 绔級
+				if (typeof plus !== "undefined") {
+					this.checkForUpdate();
+				}
+			}
 
-  },
-  onPullDownRefresh() {
-    if (this.loginInfo.hasLogin)
-      this.getMenu(true);
-  },
-}
+		},
+		onPullDownRefresh() {
+			if (this.loginInfo.hasLogin) {
+				this.getMenu(true);
+				// 涓嬫媺鍒锋柊鏃朵篃妫�鏌ユ洿鏂帮紙浠� APP 绔級
+				if (typeof plus !== "undefined") {
+					this.checkForUpdate();
+				}
+			}
+		},
+
+	}
 </script>
 
 <style>
-.text {
-  /* color: #ffffff; */
-  /* font-size: 15px; */
-  font-weight: 900;
-}
+	.text {
+		/* color: #ffffff; */
+		/* font-size: 15px; */
+		font-weight: 900;
+	}
 
-.example-body {
-  flex-direction: row;
-  flex-wrap: wrap;
-  justify-content: center;
-  padding: 0;
-  font-size: 14px;
-  /* background-color: #ffffff; */
-}
+	.example-body {
+		flex-direction: row;
+		flex-wrap: wrap;
+		justify-content: center;
+		padding: 0;
+		font-size: 14px;
+		/* background-color: #ffffff; */
+	}
 
-.grid-item-box {
-  flex: 1;
-  /* position: relative;*/
-  /* #ifndef APP-NVUE */
-  display: flex;
-  /* #endif */
-  flex-direction: column;
-  align-items: center;
-  justify-content: center;
-  padding: 5px 0;
-}
+	.grid-item-box {
+		flex: 1;
+		/* position: relative;*/
+		/* #ifndef APP-NVUE */
+		display: flex;
+		/* #endif */
+		flex-direction: column;
+		align-items: center;
+		justify-content: center;
+		padding: 5px 0;
+	}
 
-.imgMenu {
-  width: 100rpx;
-  height: 100rpx;
-}
+	.imgMenu {
+		width: 100rpx;
+		height: 100rpx;
+	}
 
-image,
-swiper,
-.img-view {
-  width: 100%;
-  height: 350rpx;
-  margin-bottom: 10rpx;
-}
+	image,
+	swiper,
+	.img-view {
+		width: 100%;
+		height: 350rpx;
+		margin-bottom: 10rpx;
+	}
 
-.example-body {
-  flex-direction: row;
-  justify-content: flex-start;
-}
+	.example-body {
+		flex-direction: row;
+		justify-content: flex-start;
+	}
 </style>
\ No newline at end of file

--
Gitblit v1.9.3