From 9a960facf1f7e3a886e9184b7ae7a0a64974505f Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期三, 29 十月 2025 14:06:01 +0800
Subject: [PATCH] 设备台账添加合计
---
src/store/modules/user.js | 17 +++++++++++++----
1 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/src/store/modules/user.js b/src/store/modules/user.js
index 89e9c2b..a007574 100644
--- a/src/store/modules/user.js
+++ b/src/store/modules/user.js
@@ -31,16 +31,23 @@
})
})
},
+ getCurrentTime() {
+ const now = new Date();
+ const year = now.getFullYear(); // 鑾峰彇骞翠唤
+ const month = String(now.getMonth() + 1).padStart(2, '0'); // 鏈堜唤浠�0寮�濮嬶紝瑕�+1锛屽苟琛ラ浂
+ const day = String(now.getDate()).padStart(2, '0'); // 鏃ユ湡琛ラ浂
+ const hours = String(now.getHours()).padStart(2, '0'); // 灏忔椂琛ラ浂
+ const minutes = String(now.getMinutes()).padStart(2, '0'); // 鍒嗛挓琛ラ浂
+ const seconds = String(now.getSeconds()).padStart(2, '0'); // 绉掓暟琛ラ浂
+ return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
+ },
// 鑾峰彇鐢ㄦ埛淇℃伅
getInfo() {
return new Promise((resolve, reject) => {
getInfo().then(res => {
- console.log('user',res)
const user = res.user
let avatar = user.avatar || ""
- if (!isHttp(avatar)) {
- avatar = (isEmpty(avatar)) ? defAva : import.meta.env.VITE_APP_BASE_API + avatar
- }
+ avatar = import.meta.env.VITE_APP_BASE_API + '/profile/' + avatar
if (res.roles && res.roles.length > 0) { // 楠岃瘉杩斿洖鐨剅oles鏄惁鏄竴涓潪绌烘暟缁�
this.roles = res.roles
this.permissions = res.permissions
@@ -52,7 +59,9 @@
this.avatar = avatar
this.currentFactoryName = user.currentFactoryName
this.nickName = user.nickName
+ this.roleName = user.roles[0].roleName
this.currentDeptId = user.tenantId
+ this.currentLoginTime = this.getCurrentTime()
resolve(res)
}).catch(error => {
reject(error)
--
Gitblit v1.9.3