From 75ce4571e95ce33a0b9f909df8f794def653e47c Mon Sep 17 00:00:00 2001 From: liudong <liudong> Date: 星期一, 12 八月 2024 10:12:04 +0800 Subject: [PATCH] 修改系统内的::v-deep警告 --- 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