This commit is contained in:
bb_pan 2025-04-17 10:47:43 +08:00
parent 8414d1c2ce
commit e3d019ec7d
1 changed files with 24 additions and 11 deletions

View File

@ -7,6 +7,8 @@ import { tansParams, blobValidate } from '@/utils/bonus'
import cache from '@/plugins/cache' import cache from '@/plugins/cache'
import { saveAs } from 'file-saver' import { saveAs } from 'file-saver'
import { decryptWithSM4, encryptWithSM4, hashWithSM3AndSalt } from '@/utils/sm' import { decryptWithSM4, encryptWithSM4, hashWithSM3AndSalt } from '@/utils/sm'
import router from '@/router'
const systemConfig = JSON.parse(localStorage.getItem('systemConfig')) || { const systemConfig = JSON.parse(localStorage.getItem('systemConfig')) || {
requestConfig: { encryptRequest: false, checkIntegrity: false, encryptResponse: false } requestConfig: { encryptRequest: false, checkIntegrity: false, encryptResponse: false }
}; };
@ -110,20 +112,31 @@ service.interceptors.response.use(res => {
if (code === 401) { if (code === 401) {
if (!isRelogin.show) { if (!isRelogin.show) {
isRelogin.show = true isRelogin.show = true
MessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', { // MessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', {
confirmButtonText: '重新登录', // confirmButtonText: '重新登录',
cancelButtonText: '取消', // cancelButtonText: '取消',
type: 'warning' // type: 'warning'
}).then(() => { // }).then(() => {
isRelogin.show = false // isRelogin.show = false
// store.dispatch('LogOut').then(() => {
// location.href = process.env.VUE_APP_BASE_API == '/dev-api' ? '/index' : '/iws/glweb/index'
// })
// }).catch(() => {
// isRelogin.show = false
// })
if (process.env.VUE_APP_BASE_API == '/iws/jxhzb-api') {
Message({ message: '无效的会话,或者会话已过期,请重新登录。', type: 'error' })
setTimeout(() => {
// 关闭页面
window.close()
}, 1500)
} else {
store.dispatch('LogOut').then(() => { store.dispatch('LogOut').then(() => {
location.href = process.env.VUE_APP_BASE_API == '/dev-api' ? '/index' : '/iws/glweb/index' router.push({ path: '/login' })
}) Message({ message: '无效的会话,或者会话已过期,请重新登录。', type: 'error' })
}).catch(() => {
isRelogin.show = false
}) })
} }
return Promise.reject('无效的会话,或者会话已过期,请重新登录。') }
} else if (code === 500) { } else if (code === 500) {
Message({ message: msg, type: 'error' }) Message({ message: msg, type: 'error' })
return Promise.reject(new Error(msg)) return Promise.reject(new Error(msg))