From eab207256afedcabccc083189a20d6ba45963a86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=95=E9=98=B3=E5=BE=AE=E7=AC=911?= <12457268+sunset-smile-1@user.noreply.gitee.com> Date: Mon, 23 Dec 2024 21:26:58 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=94=B9=E7=99=BB=E5=BD=95=E9=A1=B5?= =?UTF-8?q?=E5=B1=95=E7=A4=BA=E7=95=8C=E9=9D=A2=E4=BB=A5=E5=8F=8Atoken?= =?UTF-8?q?=E7=9A=84=E8=8E=B7=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/login/component/account.vue | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/views/login/component/account.vue b/src/views/login/component/account.vue index 7ed9495..0bb88cc 100644 --- a/src/views/login/component/account.vue +++ b/src/views/login/component/account.vue @@ -104,9 +104,9 @@ const onSignIn = async () => { let res = await loginApi.login(state.ruleForm); if(res?.success){ // 存储 token 到浏览器缓存 - Session.set('token', 'fbc545a91cc94fe89296828a25a7e08e@9085553879028596738'); - // 模拟数据,对接接口时,记得删除多余代码及对应依赖的引入。用于 `/src/stores/userInfo.ts` 中不同用户登录判断(模拟数据) - Cookies.set('userName', res.data.user.realname); + Session.set('token', res.data.token); + // usertype判断登录角色 + Cookies.set('userName', res.data.user.usertype === 1 ? 'admin' : 'user'); if (!themeConfig.value.isRequestRoutes) { // 前端控制路由,2、请注意执行顺序 const isNoPower = await initFrontEndControlRoutes();