mirror of
http://112.124.100.131/ebiz-ai/ebiz-ai-knowledge-manage.git
synced 2025-12-13 12:56:49 +08:00
feat(user): 添加用户角色获取和存储功能
- 在 user store 中添加 roles 状态和 SET_ROLES mutation - 在 getters 中添加 roles 属性 - 修改 permission.js 中的逻辑,增加对用户角色的判断 - 更新 request.js 中的 401 错误处理方式 - 在 404.vue 中更新版权信息
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
import axios from 'axios'
|
||||
import { MessageBox, Message, Loading } from 'element-ui'
|
||||
import store from '@/store'
|
||||
import { getToken } from '@/assets/js/utils/auth'
|
||||
import { getToken, removeToken } from '@/assets/js/utils/auth'
|
||||
import router from '@/router'
|
||||
|
||||
// create an axios instance
|
||||
const service = axios.create({
|
||||
@@ -61,15 +62,12 @@ service.interceptors.response.use(
|
||||
if (res.code === 401) {
|
||||
MessageBox.confirm('登录状态已过期,请重新登录', '系统提示', {
|
||||
confirmButtonText: '重新登录',
|
||||
cancelButtonText: '取消',
|
||||
showCancelButton: false,
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
removeToken()
|
||||
router.push({ path: '/login' })
|
||||
})
|
||||
.then(() => {
|
||||
store.dispatch('user/resetToken').then(() => {
|
||||
location.reload()
|
||||
})
|
||||
})
|
||||
.catch(() => {})
|
||||
} else if (res.code === 500) {
|
||||
Message({
|
||||
message: res.message,
|
||||
|
||||
Reference in New Issue
Block a user