refactor: 增加系统超时提示

This commit is contained in:
wangjiahao 2024-11-27 13:02:59 +08:00
parent 708f0c6a90
commit b89425404e
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: '多行输入',