From 1ea0d85b0fe2e7e4427fd484a9342d964c831b3d Mon Sep 17 00:00:00 2001 From: zhouwx <1175765986@qq.com> Date: 星期三, 06 八月 2025 15:15:00 +0800 Subject: [PATCH] 修改 --- src/store/modules/user.js | 18 ++++++++++++++++-- 1 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/store/modules/user.js b/src/store/modules/user.js index 4451a04..7fdf5a5 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -3,6 +3,8 @@ import defAva from '@/assets/images/profile.jpg' import Cookies from "js-cookie"; import {getUserById} from "@/api/hazardousChemicals/user"; +import {getConfigById} from "@/api/hazardousChemicals/config"; +import {ElMessage} from "element-plus"; const useUserStore = defineStore( 'user', { @@ -27,8 +29,20 @@ setToken(res.data.token) if(res.data && res.data.id){ const info = await getUserById(res.data.id); - if(info.data.code === 200){} - Cookies.set('userInfo',JSON.stringify(info.data)) + if(info.code === 200){ + Cookies.set('userInfo',JSON.stringify(info.data)) + } + if(info.data.userType == 3){ + ElMessage.warning('监管部门账号不可登录') + loading.value = false + return + } + if(info.data.userType != 0){ + const con = await getConfigById(res.data.companyId); + if(con.code === 200){ + Cookies.set('configInfo',JSON.stringify(con.data)) + } + } } this.token = res.data.token resolve() -- Gitblit v1.9.2