diff --git a/PC/InterFace.Dash/src/permission.js b/PC/InterFace.Dash/src/permission.js index 04e4b43..bec85f3 100644 --- a/PC/InterFace.Dash/src/permission.js +++ b/PC/InterFace.Dash/src/permission.js @@ -19,7 +19,9 @@ router.beforeEach(async (to, from, next) => { // 获取表头转义 if(!store.getters.columZHList || store.getters.columZHList.length <= 0){ - await store.dispatch('definition/getColumZHList') + await store.dispatch('definition/getColumZHList',()=>{ + NProgress.done() + }) } // 获取菜单数据 @@ -74,6 +76,7 @@ router.beforeEach(async (to, from, next) => { console.log("-------用户信息获取成功-------") localStorage.setItem('alreadyTryLogin',true) next(to) + NProgress.done() // next({ // ...to, // query:{ @@ -114,6 +117,7 @@ router.beforeEach(async (to, from, next) => { }, replace: true }) + NProgress.done() } } } diff --git a/PC/InterFace.Dash/src/store/modules/definition.js b/PC/InterFace.Dash/src/store/modules/definition.js index f8a6563..1a6dfb4 100644 --- a/PC/InterFace.Dash/src/store/modules/definition.js +++ b/PC/InterFace.Dash/src/store/modules/definition.js @@ -148,13 +148,18 @@ const actions = { }) }, // 获取表头转义 - getColumZHList({ commit }) { - return new Promise(resolve => { - getInterfaceBoard().then(res=>{ + getColumZHList({ commit },errCallback) { + return new Promise((resolve,reject) => { + getInterfaceBoard() + .then(res=>{ let _zh = res.resources[localStorage.getItem('columnsApiNamesZh')].texts; commit('SET_COLUMZH_LIST', _zh) resolve(res) }) + .catch(err=>{ + if(errCallback)errCallback() + reject(err) + }) }) } } @@ -164,5 +169,4 @@ export default { state, mutations, actions -} - \ No newline at end of file +} \ No newline at end of file diff --git a/PC/InterFace.Dash/src/utils/request.js b/PC/InterFace.Dash/src/utils/request.js index 625a868..387ff13 100644 --- a/PC/InterFace.Dash/src/utils/request.js +++ b/PC/InterFace.Dash/src/utils/request.js @@ -91,6 +91,15 @@ service.interceptors.response.use( // } }, error => { + if(!error.response || !error.response.data){ + Message({ + message: '访问出错,请重试', + type: 'error', + duration: 5 * 1000, + showClose:true + }) + return Promise.reject(error) + } let err = error.response.data.error // for debug if (err && err.validationErrors) { for (let item in err.validationErrors) { diff --git a/PC/UI.WinIn.FasterZ.Job/src/permission.js b/PC/UI.WinIn.FasterZ.Job/src/permission.js index 04e4b43..07ffcf1 100644 --- a/PC/UI.WinIn.FasterZ.Job/src/permission.js +++ b/PC/UI.WinIn.FasterZ.Job/src/permission.js @@ -19,7 +19,9 @@ router.beforeEach(async (to, from, next) => { // 获取表头转义 if(!store.getters.columZHList || store.getters.columZHList.length <= 0){ - await store.dispatch('definition/getColumZHList') + await store.dispatch('definition/getColumZHList',()=>{ + NProgress.done() + }) } // 获取菜单数据 diff --git a/PC/UI.WinIn.FasterZ.Job/src/store/modules/definition.js b/PC/UI.WinIn.FasterZ.Job/src/store/modules/definition.js index f8a6563..1a6dfb4 100644 --- a/PC/UI.WinIn.FasterZ.Job/src/store/modules/definition.js +++ b/PC/UI.WinIn.FasterZ.Job/src/store/modules/definition.js @@ -148,13 +148,18 @@ const actions = { }) }, // 获取表头转义 - getColumZHList({ commit }) { - return new Promise(resolve => { - getInterfaceBoard().then(res=>{ + getColumZHList({ commit },errCallback) { + return new Promise((resolve,reject) => { + getInterfaceBoard() + .then(res=>{ let _zh = res.resources[localStorage.getItem('columnsApiNamesZh')].texts; commit('SET_COLUMZH_LIST', _zh) resolve(res) }) + .catch(err=>{ + if(errCallback)errCallback() + reject(err) + }) }) } } @@ -164,5 +169,4 @@ export default { state, mutations, actions -} - \ No newline at end of file +} \ No newline at end of file diff --git a/PC/UI.WinIn.FasterZ.Job/src/utils/request.js b/PC/UI.WinIn.FasterZ.Job/src/utils/request.js index 625a868..387ff13 100644 --- a/PC/UI.WinIn.FasterZ.Job/src/utils/request.js +++ b/PC/UI.WinIn.FasterZ.Job/src/utils/request.js @@ -91,6 +91,15 @@ service.interceptors.response.use( // } }, error => { + if(!error.response || !error.response.data){ + Message({ + message: '访问出错,请重试', + type: 'error', + duration: 5 * 1000, + showClose:true + }) + return Promise.reject(error) + } let err = error.response.data.error // for debug if (err && err.validationErrors) { for (let item in err.validationErrors) { diff --git a/PC/UI.WinIn.FasterZ.Store/src/permission.js b/PC/UI.WinIn.FasterZ.Store/src/permission.js index 04e4b43..b507bce 100644 --- a/PC/UI.WinIn.FasterZ.Store/src/permission.js +++ b/PC/UI.WinIn.FasterZ.Store/src/permission.js @@ -10,7 +10,6 @@ import { asyncRoutes } from '@/router' NProgress.configure({ showSpinner: false }) // NProgress Configuration - router.beforeEach(async (to, from, next) => { // start progress bar NProgress.start() @@ -19,7 +18,9 @@ router.beforeEach(async (to, from, next) => { // 获取表头转义 if(!store.getters.columZHList || store.getters.columZHList.length <= 0){ - await store.dispatch('definition/getColumZHList') + await store.dispatch('definition/getColumZHList',()=>{ + NProgress.done() + }) } // 获取菜单数据 @@ -74,6 +75,7 @@ router.beforeEach(async (to, from, next) => { console.log("-------用户信息获取成功-------") localStorage.setItem('alreadyTryLogin',true) next(to) + NProgress.done() // next({ // ...to, // query:{ @@ -114,6 +116,7 @@ router.beforeEach(async (to, from, next) => { }, replace: true }) + NProgress.done() } } } diff --git a/PC/UI.WinIn.FasterZ.Store/src/store/modules/definition.js b/PC/UI.WinIn.FasterZ.Store/src/store/modules/definition.js index f8a6563..1a6dfb4 100644 --- a/PC/UI.WinIn.FasterZ.Store/src/store/modules/definition.js +++ b/PC/UI.WinIn.FasterZ.Store/src/store/modules/definition.js @@ -148,13 +148,18 @@ const actions = { }) }, // 获取表头转义 - getColumZHList({ commit }) { - return new Promise(resolve => { - getInterfaceBoard().then(res=>{ + getColumZHList({ commit },errCallback) { + return new Promise((resolve,reject) => { + getInterfaceBoard() + .then(res=>{ let _zh = res.resources[localStorage.getItem('columnsApiNamesZh')].texts; commit('SET_COLUMZH_LIST', _zh) resolve(res) }) + .catch(err=>{ + if(errCallback)errCallback() + reject(err) + }) }) } } @@ -164,5 +169,4 @@ export default { state, mutations, actions -} - \ No newline at end of file +} \ No newline at end of file diff --git a/PC/UI.WinIn.FasterZ.Store/src/utils/request.js b/PC/UI.WinIn.FasterZ.Store/src/utils/request.js index 625a868..387ff13 100644 --- a/PC/UI.WinIn.FasterZ.Store/src/utils/request.js +++ b/PC/UI.WinIn.FasterZ.Store/src/utils/request.js @@ -91,6 +91,15 @@ service.interceptors.response.use( // } }, error => { + if(!error.response || !error.response.data){ + Message({ + message: '访问出错,请重试', + type: 'error', + duration: 5 * 1000, + showClose:true + }) + return Promise.reject(error) + } let err = error.response.data.error // for debug if (err && err.validationErrors) { for (let item in err.validationErrors) {