From 74e6e4431b82fcd30e31f59b91bcdf2c8a5cf3f8 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期四, 09 四月 2026 13:12:51 +0800
Subject: [PATCH] 升级app 1.部署修改
---
src/pages/login.vue | 100 ++++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 96 insertions(+), 4 deletions(-)
diff --git a/src/pages/login.vue b/src/pages/login.vue
index 9135392..29bc9bb 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,12 +169,55 @@
function loginSuccess(result) {
// 璁剧疆鐢ㄦ埛淇℃伅
userStore.getInfo().then(res => {
+ const userId = res.user.userId;
+ // 鑾峰彇璺敱鏉冮檺
+ 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);
+ });
}
// 灏嗗鎴风鎺ㄩ�佹爣璇嗗彂閫佸埌鏈嶅姟鍣�
@@ -196,6 +248,35 @@
}
// 椤甸潰鍔犺浇鏃舵鏌ユ槸鍚︽湁淇濆瓨鐨勫瘑鐮�
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 {
+ // @ts-ignore
+ if (plus?.runtime?.version) {
+ // @ts-ignore
+ versionName.value = plus.runtime.version;
+ console.log("[login-version] 褰撳墠鐜=APP-PLUS锛岀増鏈�=", versionName.value);
+ }
+ } catch (e) {
+ // 鑾峰彇澶辫触鏃朵娇鐢ㄩ粯璁ゅ��
+ console.log("[login-version] APP-PLUS 鑾峰彇鐗堟湰澶辫触:", e);
+ }
+ // #endif
+ console.log("[login-version] 鏈�缁堢増鏈彿:", versionName.value);
+
loadPassword();
getUserLoginFacotryList();
});
@@ -299,4 +380,15 @@
}
}
}
+
+ .version-wrap {
+ width: 100%;
+ text-align: center;
+ margin-top: 20px;
+ }
+
+ .version-text {
+ font-size: 12px;
+ color: #999;
+ }
</style>
--
Gitblit v1.9.3