From 025e46e11cb2962fd7692adfa401333758cc779b Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期二, 02 九月 2025 14:00:34 +0800
Subject: [PATCH] 修改组件

---
 src/store/modules/user.ts |   96 ++++++++++++++++++++++++------------------------
 1 files changed, 48 insertions(+), 48 deletions(-)

diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts
index db4dc32..7b9c873 100644
--- a/src/store/modules/user.ts
+++ b/src/store/modules/user.ts
@@ -13,55 +13,55 @@
 const useUserStore = defineStore("user", {
   state: () => ({
     token: getToken(),
-      id: "",
+    id: "",
     name: "",
     avatar: "",
-      currentFactoryName: "",
-      nickName: "",
-      roleName: "",
-      currentDeptId: "",
-      currentLoginTime: "",
+    currentFactoryName: "",
+    nickName: "",
+    roleName: "",
+    currentDeptId: "",
+    currentLoginTime: "",
     roles: Array(),
     permissions: [],
   }),
   actions: {
-      // 閮ㄩ棬鐧诲綍
-      loginCheckFactory(userInfo: any) {
-          const username = userInfo.username.trim()
-          const password = userInfo.password
-          const factoryId = userInfo.factoryId
-          return new Promise((resolve, reject) => {
-              loginCheckFactory(username, password, factoryId).then((res: any) => {
-                  setToken(res.token)
-                  this.token = res.token
-                  resolve(null)
-              }).catch((error: any) => {
-                  reject(error)
-              })
-          })
-      },
+    // 閮ㄩ棬鐧诲綍
+    loginCheckFactory(userInfo: any) {
+      const username = userInfo.username.trim()
+      const password = userInfo.password
+      const factoryId = userInfo.factoryId
+      return new Promise((resolve, reject) => {
+        loginCheckFactory(username, password, factoryId).then((res: any) => {
+          setToken(res.token)
+          this.token = res.token
+          resolve(null)
+        }).catch((error: any) => {
+          reject(error)
+        })
+      })
+    },
     // 鑾峰彇鐢ㄦ埛淇℃伅
     getInfo() {
       return new Promise((resolve, reject) => {
         getInfo()
           .then((res: any) => {
-              const user = res.user
-              let avatar = user.avatar || ""
-              avatar = config.baseUrl + '/profile/' + avatar
-              if (res.roles && res.roles.length > 0) { // 楠岃瘉杩斿洖鐨剅oles鏄惁鏄竴涓潪绌烘暟缁�
-                  this.roles = res.roles
-                  this.permissions = res.permissions
-              } else {
-                  this.roles = ['ROLE_DEFAULT']
-              }
-              this.id = user.userId
-              this.name = user.userName
-              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()
+            const user = res.user
+            let avatar = user.avatar || ""
+            avatar = config.baseUrl + '/profile/' + avatar
+            if (res.roles && res.roles.length > 0) { // 楠岃瘉杩斿洖鐨剅oles鏄惁鏄竴涓潪绌烘暟缁�
+              this.roles = res.roles
+              this.permissions = res.permissions
+            } else {
+              this.roles = ['ROLE_DEFAULT']
+            }
+            this.id = user.userId
+            this.name = user.userName
+            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) => {
@@ -87,16 +87,16 @@
           });
       });
     },
-      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}`;
-      },
+    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}`;
+    },
   },
 });
 

--
Gitblit v1.9.3