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

---
 src/pages/login/index.vue |   48 +++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 47 insertions(+), 1 deletions(-)

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>

--
Gitblit v1.9.3