From 6afb492942b17ebdb80f8e57af1b0df7ba5ee821 Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期四, 09 四月 2026 15:29:50 +0800
Subject: [PATCH] fix: 版本更新修改
---
src/pages/login.vue | 64 +++++++++++++++++++++++++++++++-
1 files changed, 62 insertions(+), 2 deletions(-)
diff --git a/src/pages/login.vue b/src/pages/login.vue
index d7e5953..ee49113 100644
--- a/src/pages/login.vue
+++ b/src/pages/login.vue
@@ -37,6 +37,9 @@
</up-checkbox>
</view>
</view>
+ <view class="version-wrap">
+ <text class="version-text">鐗堟湰鍙凤細{{ versionName }}</text>
+ </view>
</template>
<script setup>
@@ -59,9 +62,11 @@
import { wxLogin } from "@/api/oauth";
import { setToken } from "@/utils/auth";
import View from "@/pages/procurementManagement/procurementLedger/view.vue";
+ import config from "@/config";
const userStore = useUserStore();
const useWxLogin = ref(false); // 鏄惁浣跨敤寰俊鐧诲綍
const rememberPassword = ref(false); // 璁颁綇瀵嗙爜
+ const versionName = ref(config?.appInfo?.version || "1.0.0");
const loginForm = ref({
userName: "",
password: "",
@@ -201,12 +206,12 @@
// 鏇存柊tabbar鐨勮鏍�
if (count > 0) {
uni.setTabBarBadge({
- index: 1, // 娑堟伅鏍囩椤电殑绱㈠紩
+ index: 2, // 娑堟伅鏍囩椤电殑绱㈠紩
text: count.toString(),
});
} else {
uni.removeTabBarBadge({
- index: 1,
+ index: 2,
});
}
})
@@ -243,6 +248,50 @@
}
// 椤甸潰鍔犺浇鏃舵鏌ユ槸鍚︽湁淇濆瓨鐨勫瘑鐮�
onMounted(() => {
+ console.log("[login-version] 寮�濮嬭幏鍙栫櫥褰曢〉鐗堟湰锛岄粯璁ゅ��:", versionName.value);
+ // #ifdef MP-WEIXIN
+ try {
+ const accountInfo = uni.getAccountInfoSync();
+ if (accountInfo?.miniProgram?.version) {
+ versionName.value = accountInfo.miniProgram.version;
+ console.log("[login-version] 褰撳墠鐜=MP-WEIXIN锛岀増鏈�=", versionName.value);
+ }
+ } catch (e) {
+ // 鑾峰彇澶辫触鏃朵娇鐢ㄩ粯璁ゅ��
+ console.log("[login-version] MP-WEIXIN 鑾峰彇鐗堟湰澶辫触:", e);
+ }
+ // #endif
+
+ // #ifdef APP-PLUS
+ try {
+ // #ifdef APP-PLUS
+ // @ts-ignore
+ if (plus?.runtime?.getProperty) {
+ // @ts-ignore
+ const appid = plus.runtime.appid;
+ // @ts-ignore
+ plus.runtime.getProperty(appid, (info) => {
+ const v = info?.version || info?.versionName || "";
+ if (v) {
+ versionName.value = String(v);
+ console.log("[login-version] 褰撳墠鐜=APP-PLUS锛岀増鏈�=", versionName.value);
+ } else {
+ console.log("[login-version] APP-PLUS 鑾峰彇鍒扮殑鐗堟湰瀛楁涓虹┖锛屼娇鐢ㄩ粯璁ゅ��:", versionName.value);
+ }
+ console.log("[login-version] 鏈�缁堢増鏈彿:", versionName.value);
+ });
+ } else {
+ console.log("[login-version] APP-PLUS 鐜涓嬬己灏� getProperty锛屼娇鐢ㄩ粯璁ゅ��:", versionName.value);
+ console.log("[login-version] 鏈�缁堢増鏈彿:", versionName.value);
+ }
+ // #endif
+ } catch (e) {
+ // 鑾峰彇澶辫触鏃朵娇鐢ㄩ粯璁ゅ��
+ console.log("[login-version] APP-PLUS 鑾峰彇鐗堟湰澶辫触:", e);
+ console.log("[login-version] 鏈�缁堢増鏈彿:", versionName.value);
+ }
+ // #endif
+
loadPassword();
getUserLoginFacotryList();
});
@@ -346,4 +395,15 @@
}
}
}
+
+ .version-wrap {
+ width: 100%;
+ text-align: center;
+ margin-top: 20px;
+ }
+
+ .version-text {
+ font-size: 12px;
+ color: #999;
+ }
</style>
--
Gitblit v1.9.3