Merge pull request #13594 from dataease/pr@dev-v2@refactor_timeout-tips

refactor: 增加系统超时提示
This commit is contained in:
王嘉豪 2024-11-27 13:03:58 +08:00 committed by GitHub
commit c3326f2dc7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 1 deletions

View File

@ -16,7 +16,6 @@ import { config } from './config'
import { configHandler } from './refresh'
import { isMobile } from '@/utils/utils'
import { useRequestStoreWithOut } from '@/store/modules/request'
type AxiosErrorWidthLoading<T> = T & {
config: {
loading?: boolean
@ -32,6 +31,8 @@ import router from '@/router'
const { result_code } = config
import { useCache } from '@/hooks/web/useCache'
import { useI18n } from '@/hooks/web/useI18n'
const { t } = useI18n()
const { wsCache } = useCache()
const requestStore = useRequestStoreWithOut()
@ -207,6 +208,11 @@ service.interceptors.response.use(
(error: AxiosErrorWidthLoading<AxiosError>) => {
if (error.message?.includes('timeout of')) {
requestStore.resetLoadingMap()
ElMessage({
type: 'error',
message: '请求超时请稍后再试',
showClose: true
})
}
if (!error?.response) {

View File

@ -1,5 +1,6 @@
export default {
common: {
timeout_tips: '请求超时请稍后再试',
component: {
input: '单行输入',
textarea: '多行输入',