From affb0876f58e628c31fee12cf8cf7e9f1748142c Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期三, 23 七月 2025 11:27:09 +0800
Subject: [PATCH] 1.生产管理联调
---
src/store/modules/user.js | 38 +++++++++++++++++++++++++++++++++-----
1 files changed, 33 insertions(+), 5 deletions(-)
diff --git a/src/store/modules/user.js b/src/store/modules/user.js
index 24e6871..7c392fc 100644
--- a/src/store/modules/user.js
+++ b/src/store/modules/user.js
@@ -1,4 +1,4 @@
-import { login, logout, getInfo } from '@/api/login'
+import {login, logout, getInfo, loginCheck, loginCheckFactory} from '@/api/login'
import { getToken, setToken, removeToken } from '@/utils/auth'
import { isHttp, isEmpty } from "@/utils/validate"
import defAva from '@/assets/images/profile.jpg'
@@ -37,9 +37,7 @@
getInfo().then(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
@@ -49,6 +47,9 @@
this.id = user.userId
this.name = user.userName
this.avatar = avatar
+ this.currentFactoryName = user.currentFactoryName
+ this.nickName = user.nickName
+ this.currentDeptId = user.tenantId
resolve(res)
}).catch(error => {
reject(error)
@@ -68,7 +69,34 @@
reject(error)
})
})
- }
+ },
+ // 鐧诲綍鏍¢獙
+ loginCheck(userInfo) {
+ const username = userInfo.username.trim()
+ const password = userInfo.password
+ return new Promise((resolve, reject) => {
+ loginCheck(username, password).then(res => {
+ resolve(res)
+ }).catch(error => {
+ reject(error)
+ })
+ })
+ },
+ // 閮ㄩ棬鐧诲綍
+ loginCheckFactory(userInfo) {
+ const username = userInfo.username.trim()
+ const password = userInfo.password
+ const factoryId = userInfo.currentFatoryId
+ return new Promise((resolve, reject) => {
+ loginCheckFactory(username, password, factoryId).then(res => {
+ setToken(res.token)
+ this.token = res.token
+ resolve()
+ }).catch(error => {
+ reject(error)
+ })
+ })
+ },
}
})
--
Gitblit v1.9.3