From d1958c0d72946b04b7949eee1a28c06430a73874 Mon Sep 17 00:00:00 2001
From: zhouwx <1175765986@qq.com>
Date: Thu, 13 Jun 2024 10:59:23 +0800
Subject: [PATCH] bug修改
---
src/store/modules/user.js | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/src/store/modules/user.js b/src/store/modules/user.js
index d1d60e7..ab76464 100644
--- a/src/store/modules/user.js
+++ b/src/store/modules/user.js
@@ -2,6 +2,7 @@
import { getToken, setToken, removeToken } from '@/utils/auth'
import defAva from '@/assets/images/profile.jpg'
import Cookies from "js-cookie";
+import {getUserById} from "@/api/sysUsers";
const useUserStore = defineStore(
'user',
{
@@ -20,10 +21,17 @@
const password = userInfo.password
const code = userInfo.code
const uuid = userInfo.uuid
- return new Promise((resolve, reject) => {
- login(username, password, code, uuid).then(res => {
+ const identity = userInfo.identity
+ return new Promise( (resolve, reject) => {
+ login(username, password, code, uuid, identity).then( async res => {
setToken(res.data.token)
Cookies.set('userInfo',JSON.stringify(res.data))
+ await getUserById({userId:res.data.id}).then(ress => {
+ Cookies.set('userState',JSON.stringify(ress.data.state))
+ if(res.data.identity === 1){
+ Cookies.set('attribute',JSON.stringify(ress.data.agency.attribute))
+ }
+ })
this.token = res.data.token
resolve()
}).catch(error => {
--
Gitblit v1.9.2