5.26修改所有已出现的bug和优化。

This commit is contained in:
hyt 2024-05-27 11:24:30 +08:00
parent 6fd6341960
commit 9e1ae938f8
4 changed files with 40 additions and 32 deletions

View File

@ -37,6 +37,8 @@ let timer = null
let isRefreshing = false
//重试队列
let requests = []
// 在模块作用域定义一个全局标志变量
let isHandlingTokenInvalid = false
axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8'
// 创建axios实例
@ -111,7 +113,6 @@ service.interceptors.request.use(
// 响应拦截器
service.interceptors.response.use(
(res) => {
console.log(res, '相应拦截器拦截内容')
// 请求完成时清除唯一标识符
const requestIdentifier = `${res.config.url}-${res.config.method}`
const index = requests.indexOf(requestIdentifier)
@ -133,37 +134,43 @@ service.interceptors.response.use(
}
if (code === '500') {
MessageBox.confirm(msg, '系统提示', {
confirmButtonText: '确定',
showCancelButton: false,
showClose: false,
closeOnClickModal: false,
closeOnPressEscape: false,
type: 'error'
})
.then(() => {
console.log(res, '相应拦截器拦截内容')
if (msg === 'token无效') {
// 判断是否在处理 token 无效情况
if (msg === 'token无效' && isHandlingTokenInvalid) return
if (msg === 'token无效' && !isHandlingTokenInvalid) {
isHandlingTokenInvalid = true;
MessageBox.confirm('token过期请重新登录', '系统提示', {
confirmButtonText: '确定',
showCancelButton: false,
showClose: false,
closeOnClickModal: false,
closeOnPressEscape: false,
type: 'error'
})
.then(() => {
store.dispatch('LogOut').then(() => {
route.replace({
path: '/login'
})
})
}
if (res.config.headers.dj==='queryTreeById') {
store.dispatch('LogOut').then(() => {
route.replace({
path: '/login'
})
})
}
})
.catch(() => {
})
return Promise.reject(new Error(msg))
});
// 重置标志变量
isHandlingTokenInvalid = false;
});
})
.catch(() => {
// 处理取消逻辑
isHandlingTokenInvalid = false;
});
} else {
// 其他错误处理
MessageBox.confirm(msg, '系统提示', {
confirmButtonText: '确定',
showCancelButton: false,
showClose: false,
closeOnClickModal: false,
closeOnPressEscape: false,
type: 'error'
});
}
return Promise.reject(new Error(msg));
} else if (code == '1002') {
MessageBox.confirm(msg, '系统提示', {

View File

@ -16,7 +16,7 @@
</el-select>
</div>
<div class="chunk">
<el-input placeholder="应用名称、厂商" v-model="searchForm.nameOrManufacturer" @keyup.enter.native="submitsearchForm">
<el-input placeholder="应用名称、厂商" v-model="searchForm.nameOrManufacturer" @change="submitsearchForm">
<i slot="suffix" class="el-input__icon el-icon-search" @click="submitsearchForm"></i>
</el-input>
</div>

View File

@ -882,8 +882,9 @@ export default {
return mainItem.sublistMdmModuleDbFileds.some((item, index02) => {
if (!item.chName) {
this.$vmNews(`数据表第${index + 1}行表中的${index02 + 1}行表字段数据填写不全`, 'warning')
return true
}
return true
})
})
if (flag) return

View File

@ -5,7 +5,7 @@
<div class="search">
<div class="chunk">
<el-input placeholder="主数据名称" v-model="searchForm.mdmName"
@keyup.enter.native="submitsearchForm">
@change="submitsearchForm">
<i slot="suffix" class="el-input__icon el-icon-search" @click="submitsearchForm"></i>
</el-input>
</div>