From 18db0dbf100ff81ead99b1d6a3daa6c4c26e5d91 Mon Sep 17 00:00:00 2001
From: zjh <2207896513@qq.com>
Date: 星期六, 26 四月 2025 16:31:29 +0800
Subject: [PATCH] 代码提交

---
 pages/BasePages/main.vue |  434 +++++++++++++++++++++++++++++++----------------------
 1 files changed, 253 insertions(+), 181 deletions(-)

diff --git a/pages/BasePages/main.vue b/pages/BasePages/main.vue
index e598365..1557079 100644
--- a/pages/BasePages/main.vue
+++ b/pages/BasePages/main.vue
@@ -1,199 +1,271 @@
 <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="msg"/>
-        <!-- 鐢ㄦ埛绯荤粺鑿滃崟妯″潡 -->
-        <view class="example-body">
-          <uni-grid :column="col" :showBorder="false">
-            <uni-grid-item v-for="(item, index) in userMenu" :index="index" :key="index" class="grid-item">
-              <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/WARBAAHtml.png"></image>
-           <!--       <uni-notice-bar v-if="item.pagE_VIEW.length>6" :speed="30"
+	<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="msg" />
+				<!-- 鐢ㄦ埛绯荤粺鑿滃崟妯″潡 -->
+				<view class="example-body">
+					<uni-grid :column="col" :showBorder="false">
+						<uni-grid-item v-for="(item, index) in userMenu" :index="index" :key="index" class="grid-item">
+							<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/WARBAAHtml.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 class="text" style="text-align: center;padding:5px 0px 5px 0px">{{ 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>
+								<text class="text"
+									style="text-align: center;padding:5px 0px 5px 0px">{{ 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, //鑿滃崟鍒楁暟
-      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) => {
+	export default {
+		data() {
+			return {
+				loginInfo: this.$loginInfo,
+				color: this.$defaultColor,
+				userMenu: [],
+				imgUrls: [
+					"../../static/img/SN-GG.png",
+					"../../static/img/SN-GG1.png"
+				],
+				col: 4, //鑿滃崟鍒楁暟
+				msg: "瀹佹尝骞挎繁绉戞妧鏈夐檺鍏徃",
+				updateChecked: false
 
-        },
-        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
-          });
-        }
-      })
-    }
-  },
-  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);
-    }
+			};
+		},
+		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();
+					}
+				});
+				
+
+			},
+			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() {
+				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);
+					}
+				})
+				
+			},
 
 
-  },
-  onShow() {
-    // this.getIsMsg();
-  },
-  onPullDownRefresh() {
-    if (this.loginInfo.hasLogin)
-      this.getMenu(true);
-  },
-}
+			downloadNewApk(apkUrl) {
+				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);
+				this.checkForUpdate();
+			}
+
+
+		},
+		onShow() {
+			// this.getIsMsg();
+		},
+		onPullDownRefresh() {
+			if (this.loginInfo.hasLogin)
+				this.getMenu(true);
+		},
+	}
 </script>
 
 <style>
-.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; */
-}
-.grid-item {
-	display: flex;
-	  flex-wrap: wrap;
-	height: 100% !important;
-    display: flex;
-    flex-direction: column;
-    align-items: stretch; /* 淇濊瘉鍨傜洿鎷変几浠ラ�傚簲鍐呭 */
+	.text {
+		/* color: #ffffff; */
+		/* font-size: 15px; */
+		font-weight: 900;
 	}
-.grid-item-box {
-  flex: 1;
-  /* position: relative;*/
-  /* #ifndef APP-NVUE */
-  display: flex;
-  /* #endif */
-  flex-direction: column;
-  align-items: center;
-  justify-content: center;
-  padding: 5px;
-}
 
-.imgMenu {
-  width: 100rpx;
-  height: 100rpx;
-}
+	.example-body {
+		flex-direction: row;
+		flex-wrap: wrap;
+		justify-content: center;
+		padding: 0;
+		font-size: 14px;
+		/* background-color: #ffffff; */
+	}
 
-image,
-swiper,
-.img-view {
-  width: 100%;
-  height: 350rpx;
-  margin-bottom: 10rpx;
-}
+	.grid-item {
+		display: flex;
+		flex-wrap: wrap;
+		height: 100% !important;
+		display: flex;
+		flex-direction: column;
+		align-items: stretch;
+		/* 淇濊瘉鍨傜洿鎷変几浠ラ�傚簲鍐呭 */
+	}
 
-.example-body {
-  flex-direction: row;
-  justify-content: flex-start;
-}
+	.grid-item-box {
+		flex: 1;
+		/* position: relative;*/
+		/* #ifndef APP-NVUE */
+		display: flex;
+		/* #endif */
+		flex-direction: column;
+		align-items: center;
+		justify-content: center;
+		padding: 5px;
+	}
+
+	.imgMenu {
+		width: 100rpx;
+		height: 100rpx;
+	}
+
+	image,
+	swiper,
+	.img-view {
+		width: 100%;
+		height: 350rpx;
+		margin-bottom: 10rpx;
+	}
+
+	.example-body {
+		flex-direction: row;
+		justify-content: flex-start;
+	}
 </style>
\ No newline at end of file

--
Gitblit v1.9.3