From 5422df60ff6a9751c52dc21d145b6e1d88c514ae Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期三, 26 十一月 2025 10:18:15 +0800
Subject: [PATCH] fix: 添加版本可见

---
 .env.development          |   12 +-
 src/pages/login/index.vue |   48 +++++++
 src/pages/mine/index.vue  |   53 ++++++++
 src/manifest.json         |  222 ++++++++++++++++++------------------
 4 files changed, 214 insertions(+), 121 deletions(-)

diff --git a/.env.development b/.env.development
index f4aacbb..83c7fe3 100644
--- a/.env.development
+++ b/.env.development
@@ -7,13 +7,13 @@
 VITE_APP_PORT = 4096
 
 # API 鍩虹璺緞锛屽紑鍙戠幆澧冧笅鐨勮姹傚墠缂�
-#VITE_APP_BASE_API = 'http://114.132.189.42:7002/mes'
 # VITE_APP_BASE_API = 'http://114.132.189.42:7002/mes'
-VITE_APP_BASE_API = 'http://192.168.10.119:7002/mes' # 閭硅
-# VITE_APP_BASE_API = 'http://192.168.100.131:7002/mes' #
+# VITE_APP_BASE_API = 'http://114.132.189.42:7002/mes'
+# VITE_APP_BASE_API = 'http://192.168.10.119:7002/mes' # 閭硅
+VITE_APP_BASE_API = 'http://192.168.100.131:7002/mes' #
 
 # API 鏈嶅姟鍣ㄧ殑 URL
-#VITE_APP_API_URL = 'http://114.132.189.42:7002/mes'
-VITE_APP_API_URL = 'http://192.168.10.119:7002/mes'
-# VITE_APP_API_URL = 'http://192.168.100.131:7002/mes' #
+# VITE_APP_API_URL = 'http://114.132.189.42:7002/mes'
+# VITE_APP_API_URL = 'http://192.168.10.119:7002/mes'
+VITE_APP_API_URL = 'http://192.168.100.131:7002/mes' #
 
diff --git a/src/manifest.json b/src/manifest.json
index 0e465c5..515033e 100644
--- a/src/manifest.json
+++ b/src/manifest.json
@@ -1,116 +1,116 @@
 {
-  "name": "绾跨紗涓婃姤",
-  "appid": "__UNI__F64E0A4",
-  "description": "",
-  "versionName": "1.0.15",
-  "versionCode": "100",
-  "transformPx": false,
-  /* 5+App鐗规湁鐩稿叧 */
-  "app-plus": {
-    "usingComponents": true,
-    "nvueStyleCompiler": "uni-app",
-    "compilerVersion": 3,
-    "compatible": {
-      "ignoreVersion": true // true琛ㄧず蹇界暐鐗堟湰妫�鏌ユ彁绀烘锛孒BuilderX1.9.0鍙婁互涓婄増鏈敮鎸�
-    },
-    "splashscreen": {
-      "alwaysShowBeforeRender": true,
-      "waiting": true,
-      "autoclose": true,
-      "delay": 0
-    },
-    /* 妯″潡閰嶇疆 */
-    "modules": {
-      "Camera": {},
-      "Gallery": {}
-    },
-    /* 搴旂敤鍙戝竷淇℃伅 */
-    "distribute": {
-      /* android鎵撳寘閰嶇疆 */
-      "android": {
-        "permissions": [
-          "<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
-          "<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
-          "<uses-permission android:name=\"android.permission.VIBRATE\"/>",
-          "<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
-          "<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
-          "<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
-          "<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
-          "<uses-permission android:name=\"android.permission.CAMERA\"/>",
-          "<uses-permission android:name=\"android.permission.READ_EXTERNAL_STORAGE\"/>",
-          "<uses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\"/>",
-          "<uses-permission android:name=\"android.permission.READ_MEDIA_IMAGES\"/>",
-          "<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
-          "<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
-          "<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
-          "<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
-          "<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
-          "<uses-feature android:name=\"android.hardware.camera\"/>",
-          "<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>",
-          "<uses-permission android:name=\"android.permission.RECEIVE_BOOT_COMPLETED\"/>"
-        ]
-      },
-      /* ios鎵撳寘閰嶇疆 */
-      "ios": {
-        "dSYMs": false
-      },
-      /* SDK閰嶇疆 */
-      "sdkConfigs": {},
-      "icons": {
-        "android": {
-          "hdpi": "unpackage/res/icons/72x72.png",
-          "xhdpi": "unpackage/res/icons/96x96.png",
-          "xxhdpi": "unpackage/res/icons/144x144.png",
-          "xxxhdpi": "unpackage/res/icons/192x192.png"
+    "name" : "绾跨紗涓婃姤",
+    "appid" : "__UNI__F64E0A4",
+    "description" : "",
+    "versionName" : "1.0.20",
+    "versionCode" : "100",
+    "transformPx" : false,
+    /* 5+App鐗规湁鐩稿叧 */
+    "app-plus" : {
+        "usingComponents" : true,
+        "nvueStyleCompiler" : "uni-app",
+        "compilerVersion" : 3,
+        "compatible" : {
+            "ignoreVersion" : true // true琛ㄧず蹇界暐鐗堟湰妫�鏌ユ彁绀烘锛孒BuilderX1.9.0鍙婁互涓婄増鏈敮鎸�
         },
-        "ios": {
-          "appstore": "unpackage/res/icons/1024x1024.png",
-          "ipad": {
-            "app": "unpackage/res/icons/76x76.png",
-            "app@2x": "unpackage/res/icons/152x152.png",
-            "notification": "unpackage/res/icons/20x20.png",
-            "notification@2x": "unpackage/res/icons/40x40.png",
-            "proapp@2x": "unpackage/res/icons/167x167.png",
-            "settings": "unpackage/res/icons/29x29.png",
-            "settings@2x": "unpackage/res/icons/58x58.png",
-            "spotlight": "unpackage/res/icons/40x40.png",
-            "spotlight@2x": "unpackage/res/icons/80x80.png"
-          },
-          "iphone": {
-            "app@2x": "unpackage/res/icons/120x120.png",
-            "app@3x": "unpackage/res/icons/180x180.png",
-            "notification@2x": "unpackage/res/icons/40x40.png",
-            "notification@3x": "unpackage/res/icons/60x60.png",
-            "settings@2x": "unpackage/res/icons/58x58.png",
-            "settings@3x": "unpackage/res/icons/87x87.png",
-            "spotlight@2x": "unpackage/res/icons/80x80.png",
-            "spotlight@3x": "unpackage/res/icons/120x120.png"
-          }
+        "splashscreen" : {
+            "alwaysShowBeforeRender" : true,
+            "waiting" : true,
+            "autoclose" : true,
+            "delay" : 0
+        },
+        /* 妯″潡閰嶇疆 */
+        "modules" : {
+            "Camera" : {},
+            "Gallery" : {}
+        },
+        /* 搴旂敤鍙戝竷淇℃伅 */
+        "distribute" : {
+            /* android鎵撳寘閰嶇疆 */
+            "android" : {
+                "permissions" : [
+                    "<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
+                    "<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
+                    "<uses-permission android:name=\"android.permission.VIBRATE\"/>",
+                    "<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
+                    "<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
+                    "<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
+                    "<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
+                    "<uses-permission android:name=\"android.permission.CAMERA\"/>",
+                    "<uses-permission android:name=\"android.permission.READ_EXTERNAL_STORAGE\"/>",
+                    "<uses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\"/>",
+                    "<uses-permission android:name=\"android.permission.READ_MEDIA_IMAGES\"/>",
+                    "<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
+                    "<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
+                    "<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
+                    "<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
+                    "<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
+                    "<uses-feature android:name=\"android.hardware.camera\"/>",
+                    "<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>",
+                    "<uses-permission android:name=\"android.permission.RECEIVE_BOOT_COMPLETED\"/>"
+                ]
+            },
+            /* ios鎵撳寘閰嶇疆 */
+            "ios" : {
+                "dSYMs" : false
+            },
+            /* SDK閰嶇疆 */
+            "sdkConfigs" : {},
+            "icons" : {
+                "android" : {
+                    "hdpi" : "unpackage/res/icons/72x72.png",
+                    "xhdpi" : "unpackage/res/icons/96x96.png",
+                    "xxhdpi" : "unpackage/res/icons/144x144.png",
+                    "xxxhdpi" : "unpackage/res/icons/192x192.png"
+                },
+                "ios" : {
+                    "appstore" : "unpackage/res/icons/1024x1024.png",
+                    "ipad" : {
+                        "app" : "unpackage/res/icons/76x76.png",
+                        "app@2x" : "unpackage/res/icons/152x152.png",
+                        "notification" : "unpackage/res/icons/20x20.png",
+                        "notification@2x" : "unpackage/res/icons/40x40.png",
+                        "proapp@2x" : "unpackage/res/icons/167x167.png",
+                        "settings" : "unpackage/res/icons/29x29.png",
+                        "settings@2x" : "unpackage/res/icons/58x58.png",
+                        "spotlight" : "unpackage/res/icons/40x40.png",
+                        "spotlight@2x" : "unpackage/res/icons/80x80.png"
+                    },
+                    "iphone" : {
+                        "app@2x" : "unpackage/res/icons/120x120.png",
+                        "app@3x" : "unpackage/res/icons/180x180.png",
+                        "notification@2x" : "unpackage/res/icons/40x40.png",
+                        "notification@3x" : "unpackage/res/icons/60x60.png",
+                        "settings@2x" : "unpackage/res/icons/58x58.png",
+                        "settings@3x" : "unpackage/res/icons/87x87.png",
+                        "spotlight@2x" : "unpackage/res/icons/80x80.png",
+                        "spotlight@3x" : "unpackage/res/icons/120x120.png"
+                    }
+                }
+            }
         }
-      }
-    }
-  },
-  /* 蹇簲鐢ㄧ壒鏈夌浉鍏� */
-  "quickapp": {},
-  /* 灏忕▼搴忕壒鏈夌浉鍏� */
-  "mp-weixin": {
-    "appid": "",
-    "setting": {
-      "urlCheck": false
     },
-    "usingComponents": true
-  },
-  "mp-alipay": {
-    "usingComponents": true
-  },
-  "mp-baidu": {
-    "usingComponents": true
-  },
-  "mp-toutiao": {
-    "usingComponents": true
-  },
-  "uniStatistics": {
-    "enable": false
-  },
-  "vueVersion": "3"
+    /* 蹇簲鐢ㄧ壒鏈夌浉鍏� */
+    "quickapp" : {},
+    /* 灏忕▼搴忕壒鏈夌浉鍏� */
+    "mp-weixin" : {
+        "appid" : "",
+        "setting" : {
+            "urlCheck" : false
+        },
+        "usingComponents" : true
+    },
+    "mp-alipay" : {
+        "usingComponents" : true
+    },
+    "mp-baidu" : {
+        "usingComponents" : true
+    },
+    "mp-toutiao" : {
+        "usingComponents" : true
+    },
+    "uniStatistics" : {
+        "enable" : false
+    },
+    "vueVersion" : "3"
 }
diff --git a/src/pages/login/index.vue b/src/pages/login/index.vue
index cdeb5b4..a33808c 100644
--- a/src/pages/login/index.vue
+++ b/src/pages/login/index.vue
@@ -75,6 +75,11 @@
           <text class="text">鍜�</text>
           <text class="link" @click="navigateToPrivacy">銆婇殣绉佹斂绛栥��</text>
         </view>
+
+        <!-- 鐗堟湰鍙� -->
+        <view class="version">
+          <text class="version-text">鐗堟湰鍙凤細{{ versionName }}</text>
+        </view>
       </view>
     </view>
 
@@ -87,12 +92,41 @@
 import { type LoginFormData } from "@/api/auth";
 import { useUserStore } from "@/store/modules/user";
 import { useToast } from "wot-design-uni";
-import { ref } from "vue";
+import { ref, onMounted } from "vue";
 
 const loginFormRef = ref();
 const toast = useToast();
 const loading = ref(false);
 const userStore = useUserStore();
+
+// 鐗堟湰鍙�
+const versionName = ref("1.0.16");
+
+// 鑾峰彇鐗堟湰鍙�
+onMounted(() => {
+  // #ifdef MP-WEIXIN
+  try {
+    const accountInfo = uni.getAccountInfoSync();
+    if (accountInfo?.miniProgram?.version) {
+      versionName.value = accountInfo.miniProgram.version;
+    }
+  } catch (e) {
+    // 鑾峰彇澶辫触鏃朵娇鐢ㄩ粯璁ゅ��
+  }
+  // #endif
+
+  // #ifdef APP-PLUS
+  try {
+    // @ts-ignore
+    if (plus?.runtime?.version) {
+      // @ts-ignore
+      versionName.value = plus.runtime.version;
+    }
+  } catch (e) {
+    // 鑾峰彇澶辫触鏃朵娇鐢ㄩ粯璁ゅ��
+  }
+  // #endif
+});
 
 // 鐧诲綍琛ㄥ崟鏁版嵁
 const loginFormData = ref<LoginFormData>({
@@ -384,4 +418,16 @@
 .agreement .link {
   color: #165dff;
 }
+
+.version {
+  display: flex;
+  justify-content: center;
+  margin-top: 20rpx;
+  margin-bottom: 20rpx;
+}
+
+.version-text {
+  font-size: 22rpx;
+  color: #9ca3af;
+}
 </style>
diff --git a/src/pages/mine/index.vue b/src/pages/mine/index.vue
index b164c37..5772f62 100644
--- a/src/pages/mine/index.vue
+++ b/src/pages/mine/index.vue
@@ -7,7 +7,7 @@
         <view class="avatar-container" @click="navigateToProfile">
           <image
             class="avatar"
-            :src="isLogin ? userInfo!.avatar : defaultAvatar"
+            :src="isLogin ? userInfo?.avatar : defaultAvatar"
             mode="aspectFill"
           />
           <view v-if="isLogin" class="avatar-edit">
@@ -16,7 +16,7 @@
         </view>
         <view class="user-details">
           <block v-if="isLogin">
-            <view class="nickname">{{ userInfo!.nickname || "鍖垮悕鐢ㄦ埛" }}</view>
+            <view class="nickname">{{ userInfo?.nickname || "鍖垮悕鐢ㄦ埛" }}</view>
             <view class="user-id">ID: {{ userInfo?.username || "0000000" }}</view>
           </block>
           <block v-else>
@@ -215,6 +215,11 @@
       <wd-button class="logout-btn" @click="handleLogout">閫�鍑虹櫥褰�</wd-button>
     </view>
 
+    <!-- 鐗堟湰鍙� -->
+    <view class="version">
+      <text class="version-text">鐗堟湰鍙凤細{{ versionName }}</text>
+    </view>
+
     <wd-toast />
   </view>
 </template>
@@ -223,7 +228,7 @@
 import { useToast } from "wot-design-uni";
 import { useUserStore } from "@/store/modules/user";
 import { useThemeStore } from "@/store/modules/theme";
-import { computed } from "vue";
+import { computed, ref, onMounted } from "vue";
 
 const toast = useToast();
 const userStore = useUserStore();
@@ -231,6 +236,35 @@
 const userInfo = computed(() => userStore.userInfo);
 const isLogin = computed(() => !!userInfo.value);
 const defaultAvatar = "/static/images/default-avatar.png";
+
+// 鐗堟湰鍙�
+const versionName = ref("1.0.16");
+
+// 鑾峰彇鐗堟湰鍙�
+onMounted(() => {
+  // #ifdef MP-WEIXIN
+  try {
+    const accountInfo = uni.getAccountInfoSync();
+    if (accountInfo?.miniProgram?.version) {
+      versionName.value = accountInfo.miniProgram.version;
+    }
+  } catch (e) {
+    // 鑾峰彇澶辫触鏃朵娇鐢ㄩ粯璁ゅ��
+  }
+  // #endif
+
+  // #ifdef APP-PLUS
+  try {
+    // @ts-ignore
+    if (plus?.runtime?.version) {
+      // @ts-ignore
+      versionName.value = plus.runtime.version;
+    }
+  } catch (e) {
+    // 鑾峰彇澶辫触鏃朵娇鐢ㄩ粯璁ゅ��
+  }
+  // #endif
+});
 
 // 鐧诲綍
 const navigateToLoginPage = () => {
@@ -661,4 +695,17 @@
     }
   }
 }
+
+// 鐗堟湰鍙�
+.version {
+  display: flex;
+  justify-content: center;
+  margin-top: 20rpx;
+  margin-bottom: 40rpx;
+}
+
+.version-text {
+  font-size: 22rpx;
+  color: #9ca3af;
+}
 </style>

--
Gitblit v1.9.3