From 304f9efb86e72eb3ce239fd69b2f4516b4438c6a Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期四, 09 四月 2026 15:29:59 +0800
Subject: [PATCH] Merge branch 'dev_new' of http://114.132.189.42:9002/r/product-inventory-APP-before into dev_new
---
src/pages/login.vue | 119 +++++++++++++++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 110 insertions(+), 9 deletions(-)
diff --git a/src/pages/login.vue b/src/pages/login.vue
index f717c26..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>
@@ -48,16 +51,22 @@
icon: "none",
});
};
- import { userLoginFacotryList, updateClientId } from "@/api/login";
+ import {
+ userLoginFacotryList,
+ updateClientId,
+ getNoticeCount,
+ } from "@/api/login";
import { ref, onMounted } from "vue";
import useUserStore from "@/store/modules/user";
import { getWxCode } from "@/utils/geek";
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: "",
@@ -160,18 +169,55 @@
function loginSuccess(result) {
// 璁剧疆鐢ㄦ埛淇℃伅
userStore.getInfo().then(res => {
+ const userId = res.user.userId;
// 鑾峰彇璺敱鏉冮檺
- userStore.getRouters().then(() => {
- console.log("璺敱鏉冮檺鑾峰彇鎴愬姛");
- }).catch(error => {
- console.error("鑾峰彇璺敱鏉冮檺澶辫触:", error);
- });
+ userStore
+ .getRouters()
+ .then(() => {
+ console.log("璺敱鏉冮檺鑾峰彇鎴愬姛");
+ })
+ .catch(error => {
+ console.error("鑾峰彇璺敱鏉冮檺澶辫触:", error);
+ });
// 鐧诲綍鎴愬姛鍚庯紝灏嗗鎴风鎺ㄩ�佹爣璇嗗彂閫佸埌鏈嶅姟鍣�
sendClientIdToServer();
- uni.switchTab({
- url: "/pages/index",
- });
+ // 鍚姩瀹氭椂鑾峰彇鏈娑堟伅鏁伴噺鐨勫畾鏃跺櫒
+ startNoticeCountTimer(userId);
+ uni.switchTab({ url: "/pages/index" });
});
+ }
+
+ // 鍚姩瀹氭椂鑾峰彇鏈娑堟伅鏁伴噺鐨勫畾鏃跺櫒
+ function startNoticeCountTimer(userId) {
+ // 绔嬪嵆鑾峰彇涓�娆℃湭璇绘秷鎭暟閲�
+ updateNoticeCount(userId);
+ // 璁剧疆瀹氭椂鍣紝姣�30绉掕幏鍙栦竴娆�
+ setInterval(() => {
+ updateNoticeCount(userId);
+ }, 30000);
+ }
+
+ // 鏇存柊鏈娑堟伅鏁伴噺
+ function updateNoticeCount(userId) {
+ getNoticeCount(userId)
+ .then(res => {
+ const count = res.data || 0;
+ console.log("鏈娑堟伅鏁伴噺:", count);
+ // 鏇存柊tabbar鐨勮鏍�
+ if (count > 0) {
+ uni.setTabBarBadge({
+ index: 2, // 娑堟伅鏍囩椤电殑绱㈠紩
+ text: count.toString(),
+ });
+ } else {
+ uni.removeTabBarBadge({
+ index: 2,
+ });
+ }
+ })
+ .catch(error => {
+ console.error("鑾峰彇鏈娑堟伅鏁伴噺澶辫触:", error);
+ });
}
// 灏嗗鎴风鎺ㄩ�佹爣璇嗗彂閫佸埌鏈嶅姟鍣�
@@ -202,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();
});
@@ -305,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