From 9aae2af6f3937a7d99ec619b51f457002cef969f Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期一, 03 十一月 2025 14:29:37 +0800
Subject: [PATCH] 档案管理-添加导出功能
---
src/store/modules/user.js | 31 ++++++++++++++++++++++++++++++-
1 files changed, 30 insertions(+), 1 deletions(-)
diff --git a/src/store/modules/user.js b/src/store/modules/user.js
index 7c392fc..057af50 100644
--- a/src/store/modules/user.js
+++ b/src/store/modules/user.js
@@ -1,7 +1,8 @@
-import {login, logout, getInfo, loginCheck, loginCheckFactory} from '@/api/login'
+import {login, logout, getInfo, loginCheck, loginCheckFactory,tideLogin} from '@/api/login'
import { getToken, setToken, removeToken } from '@/utils/auth'
import { isHttp, isEmpty } from "@/utils/validate"
import defAva from '@/assets/images/profile.jpg'
+import { defineStore } from 'pinia'
const useUserStore = defineStore(
'user',
@@ -31,6 +32,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}`;
+ },
// 鑾峰彇鐢ㄦ埛淇℃伅
getInfo() {
return new Promise((resolve, reject) => {
@@ -49,7 +60,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)
@@ -97,6 +110,22 @@
})
})
},
+ TideLogin(code) {
+ return new Promise((resolve, reject) => {
+ tideLogin(code)
+ .then((res) => {
+ setToken(res.token);
+ this.token = res.token
+ Vue.prototype.uploadHeader = {
+ Authorization: "Bearer " + res.token,
+ };
+ resolve();
+ })
+ .catch((error) => {
+ reject(error);
+ });
+ });
+ },
}
})
--
Gitblit v1.9.3