Browse Source

【接口看板】 数据获取失败路由守护优化开发

faster_AG_grid
安虹睿 1 year ago
parent
commit
002c00837a
  1. 19
      PC/InterFace.Dash/src/permission.js

19
PC/InterFace.Dash/src/permission.js

@ -60,6 +60,16 @@ const toPageInit = async (to, from, next) => {
}
// 获取数据失败处理
const getErrHandle = (to, from, next) => {
let isAutoLogin = JSON.parse(localStorage.getItem('isConfigLogin')) || to.query.loginName
Message.error(getErrMsg)
if(!isAutoLogin){
store.dispatch("user/logout")
}
NProgress.done()
}
// 跳转处理
const toNextHandle = async (to, from, next) => {
let isFresh = false
@ -67,8 +77,7 @@ const toNextHandle = async (to, from, next) => {
// 获取表头转义
if(!store.getters.columZHList){
await store.dispatch('definition/getColumZHList').catch(()=>{
Message.error(getErrMsg)
NProgress.done()
getErrHandle(to, from, next)
})
}
@ -84,16 +93,14 @@ const toNextHandle = async (to, from, next) => {
}
})
.catch(()=>{
Message.error(getErrMsg)
NProgress.done()
getErrHandle(to, from, next)
})
}
// 获取枚举数据
if(!store.getters.enumList || store.getters.enumList.length <= 0){
await store.dispatch('definition/getDefinitionConfig').catch(()=>{
Message.error(getErrMsg)
NProgress.done()
getErrHandle(to, from, next)
})
}

Loading…
Cancel
Save