【优化】优化多次弹窗
This commit is contained in:
parent
7116d314b5
commit
a3570d1ecd
@ -24,7 +24,8 @@ const app = {
|
|||||||
autoHideHeader: false,
|
autoHideHeader: false,
|
||||||
color: null,
|
color: null,
|
||||||
weak: false,
|
weak: false,
|
||||||
multiTab: true
|
multiTab: true,
|
||||||
|
hasError: false
|
||||||
},
|
},
|
||||||
mutations: {
|
mutations: {
|
||||||
SET_SIDEBAR_TYPE: (state, type) => {
|
SET_SIDEBAR_TYPE: (state, type) => {
|
||||||
@ -74,6 +75,9 @@ const app = {
|
|||||||
TOGGLE_MULTI_TAB: (state, bool) => {
|
TOGGLE_MULTI_TAB: (state, bool) => {
|
||||||
Vue.ls.set(DEFAULT_MULTI_TAB, bool)
|
Vue.ls.set(DEFAULT_MULTI_TAB, bool)
|
||||||
state.multiTab = bool
|
state.multiTab = bool
|
||||||
|
},
|
||||||
|
SET_HAS_ERROR: (state, bool) => {
|
||||||
|
state.hasError = bool
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
@ -115,6 +119,9 @@ const app = {
|
|||||||
},
|
},
|
||||||
ToggleMultiTab ({ commit }, bool) {
|
ToggleMultiTab ({ commit }, bool) {
|
||||||
commit('TOGGLE_MULTI_TAB', bool)
|
commit('TOGGLE_MULTI_TAB', bool)
|
||||||
|
},
|
||||||
|
SetHasError ({ commit }, bool) {
|
||||||
|
commit('SET_HAS_ERROR', bool)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import store from '@/store'
|
import store from '@/store'
|
||||||
|
// import router from './router'
|
||||||
import { message, Modal, notification } from 'ant-design-vue' /// es/notification
|
import { message, Modal, notification } from 'ant-design-vue' /// es/notification
|
||||||
import { VueAxios } from './axios'
|
import { VueAxios } from './axios'
|
||||||
import { ACCESS_TOKEN } from '@/store/mutation-types'
|
import { ACCESS_TOKEN } from '@/store/mutation-types'
|
||||||
@ -62,23 +63,28 @@ service.interceptors.response.use((response) => {
|
|||||||
if (response.request.responseType === 'blob') {
|
if (response.request.responseType === 'blob') {
|
||||||
return response
|
return response
|
||||||
}
|
}
|
||||||
|
const resData = response.data
|
||||||
const code = response.data.code
|
const code = response.data.code
|
||||||
|
if (!store.state.app.hasError) {
|
||||||
if (code === 1011006 || code === 1011007 || code === 1011008 || code === 1011009) {
|
if (code === 1011006 || code === 1011007 || code === 1011008 || code === 1011009) {
|
||||||
Modal.error({
|
Modal.error({
|
||||||
title: '提示:',
|
title: '提示:',
|
||||||
content: response.data.message,
|
content: resData.message,
|
||||||
okText: '重新登录',
|
okText: '重新登录',
|
||||||
onOk: () => {
|
onOk: () => {
|
||||||
Vue.ls.remove(ACCESS_TOKEN)
|
Vue.ls.remove(ACCESS_TOKEN)
|
||||||
|
store.dispatch('SetHasError', false)
|
||||||
window.location.reload()
|
window.location.reload()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
} else if (code === 1013002 || code === 1016002 || code === 1015002) {
|
store.dispatch('SetHasError', true)
|
||||||
|
}
|
||||||
|
if (code === 1013002 || code === 1016002 || code === 1015002) {
|
||||||
message.error(response.data.message)
|
message.error(response.data.message)
|
||||||
return response.data
|
return response.data
|
||||||
} else {
|
|
||||||
return response.data
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
return resData
|
||||||
}, err)
|
}, err)
|
||||||
|
|
||||||
const installer = {
|
const installer = {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user