feat(permission): 添加store模块导入并完善路由生成错误处理
- 导入store模块用于状态管理 - 修改generateRoutes方法添加reject参数以处理异步错误 - 当获取用户菜单失败时显示中文提示信息 - 获取菜单失败时自动执行用户登出操作并拒绝Promise - 更新生产环境、测试环境配置文件中的年报服务地址
This commit is contained in:
parent
a30c81a914
commit
b81be6e5c5
|
|
@ -16,5 +16,5 @@ VUE_APP_CAS_SERVER_UNITE = 'http://10.194.188.69/cas'
|
||||||
VUE_APP_AICEPS_URL = 'http://10.201.62.87:6891/gz-aiceps-manage'
|
VUE_APP_AICEPS_URL = 'http://10.201.62.87:6891/gz-aiceps-manage'
|
||||||
|
|
||||||
# 年报服务地址 无需写/aiceps-service-web 如和aiccs同域名同端口部署则置空
|
# 年报服务地址 无需写/aiceps-service-web 如和aiccs同域名同端口部署则置空
|
||||||
VUE_APP_AICEPS_SERVICE_URL = ''
|
VUE_APP_AICEPS_SERVICE_URL = 'http://219.148.175.144:56666'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,4 +14,4 @@ VUE_APP_ENV=test129
|
||||||
VUE_APP_RANDOM_URL=http://172.22.80.156:8085/aicods_gz_old/login/sso_home.html
|
VUE_APP_RANDOM_URL=http://172.22.80.156:8085/aicods_gz_old/login/sso_home.html
|
||||||
|
|
||||||
# 年报服务地址 无需写/aiceps-service-web 如和aiccs同域名同端口部署则置空
|
# 年报服务地址 无需写/aiceps-service-web 如和aiccs同域名同端口部署则置空
|
||||||
VUE_APP_AICEPS_SERVICE_URL = ''
|
VUE_APP_AICEPS_SERVICE_URL = 'http://219.148.175.144:56666'
|
||||||
|
|
|
||||||
|
|
@ -20,4 +20,4 @@ VUE_APP_CAS_SERVER=http://10.201.62.2:6889/cas
|
||||||
VUE_APP_AICEPS_URL=http://10.201.62.87:6891/gz-aiceps-manage
|
VUE_APP_AICEPS_URL=http://10.201.62.87:6891/gz-aiceps-manage
|
||||||
|
|
||||||
# 年报服务地址 无需写/aiceps-service-web 如和aiccs同域名同端口部署则置空
|
# 年报服务地址 无需写/aiceps-service-web 如和aiccs同域名同端口部署则置空
|
||||||
VUE_APP_AICEPS_SERVICE_URL = ''
|
VUE_APP_AICEPS_SERVICE_URL = 'http://219.148.175.144:56666'
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import user from './user'
|
||||||
import { Message } from 'element-ui'
|
import { Message } from 'element-ui'
|
||||||
import Layout from '@/layout'
|
import Layout from '@/layout'
|
||||||
import Empty from '@/layout/Empty'
|
import Empty from '@/layout/Empty'
|
||||||
|
import store from '@/store'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use meta.role to determine if the current user has permission
|
* Use meta.role to determine if the current user has permission
|
||||||
|
|
@ -106,7 +107,7 @@ const mutations = {
|
||||||
|
|
||||||
const actions = {
|
const actions = {
|
||||||
generateRoutes({ commit }, roles) {
|
generateRoutes({ commit }, roles) {
|
||||||
return new Promise(resolve => {
|
return new Promise((resolve, reject) => {
|
||||||
// let accessedRoutes
|
// let accessedRoutes
|
||||||
// console.log('222', roles)
|
// console.log('222', roles)
|
||||||
// roles = ['admin']
|
// roles = ['admin']
|
||||||
|
|
@ -127,7 +128,10 @@ const actions = {
|
||||||
getUserMenus(data).then(response => {
|
getUserMenus(data).then(response => {
|
||||||
let data = response
|
let data = response
|
||||||
if (response.code !== 0) {
|
if (response.code !== 0) {
|
||||||
Message.warning(response.msg)
|
Message.warning('获取用户菜单失败')
|
||||||
|
store.dispatch('user/logout').finally(() => {
|
||||||
|
reject()
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
data = response.data.filter((item) => {
|
data = response.data.filter((item) => {
|
||||||
return item.path
|
return item.path
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue