From 32eba6441a2bd61653abf2a742716878f0df0e39 Mon Sep 17 00:00:00 2001
From: liudong <liudong>
Date: 星期五, 09 八月 2024 20:47:09 +0800
Subject: [PATCH] 地址116
---
src/store/modules/user/index.ts | 15 ++++++++++++++-
1 files changed, 14 insertions(+), 1 deletions(-)
diff --git a/src/store/modules/user/index.ts b/src/store/modules/user/index.ts
index 0849edf..51faef3 100644
--- a/src/store/modules/user/index.ts
+++ b/src/store/modules/user/index.ts
@@ -10,6 +10,7 @@
import { UserState } from './types';
import useAppStore from '../app';
+
const useUserStore = defineStore('user', {
state: (): UserState => ({
name: undefined,
@@ -29,6 +30,7 @@
certification: undefined,
role: '',
resources:undefined,
+ hrefUrl:undefined
}),
getters: {
@@ -63,9 +65,10 @@
},
// Login
- async login(loginForm: LoginData) {
+ async login(loginForm: LoginData):string {
try {
const res = await userLogin(loginForm);
+
setToken(res.data.access_token);
const userInfo = {
avatar: res.data.avatar,
@@ -75,6 +78,11 @@
this.resources=res.data.resources;
setUserInfo(JSON.stringify(userInfo));
setUserResources(JSON.stringify(this.resources))
+ for (const r of this.resources) {
+ if (r.menuType == 0) {
+ return r.component
+ }
+ }
} catch (err) {
clearToken();
throw err;
@@ -95,6 +103,11 @@
this.logoutCallBack();
}
},
+
+
+ getHreFurl(url: string) {
+ this.hrefUrl=url
+ },
},
});
--
Gitblit v1.8.0