-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
147 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
import menu from './modules/menu'; | ||
import layout from './modules/layout'; | ||
import api from './modules/api'; | ||
|
||
const en_US = { | ||
...menu, | ||
...layout, | ||
...api, | ||
}; | ||
|
||
export default en_US; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
const api = { | ||
'api.errorTip': 'Error Tip', | ||
'api.errMsg401': 'The user does not have permission!', | ||
'api.errMsg403': 'The user is authorized, but access is forbidden!', | ||
'api.errMsg404': 'Network request error, the resource was not found!', | ||
'api.errMsg405': 'Network request error, request method not allowed!', | ||
'api.errMsg408': 'Network request timed out!', | ||
'api.errMsg500': 'Server error, please contact the administrator!', | ||
'api.errMsg501': 'The network is not implemented!', | ||
'api.errMsg502': 'Network Error!', | ||
'api.errMsg503': | ||
'The service is unavailable, the server is temporarily overloaded or maintained!', | ||
'api.errMsg504': 'Network timeout!', | ||
'api.errMsg505': 'The http version does not support the request!', | ||
}; | ||
|
||
export default api; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
import menu from './modules/menu'; | ||
import layout from './modules/layout'; | ||
import api from './modules/api'; | ||
|
||
const zh_CN = { | ||
...menu, | ||
...layout, | ||
...api, | ||
}; | ||
|
||
export default zh_CN; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
const api = { | ||
'api.errorTip': '错误提示', | ||
'api.errMsg401': '用户没有权限!', | ||
'api.errMsg403': '用户得到授权,但是访问是被禁止的。!', | ||
'api.errMsg404': '网络请求错误,未找到该资源!', | ||
'api.errMsg405': '网络请求错误,请求方法未允许!', | ||
'api.errMsg408': '网络请求超时!', | ||
'api.errMsg500': '服务器错误,请联系管理员!', | ||
'api.errMsg501': '网络未实现!', | ||
'api.errMsg502': '网络错误!', | ||
'api.errMsg503': '服务不可用,服务器暂时过载或维护!', | ||
'api.errMsg504': '网络超时!', | ||
'api.errMsg505': 'http版本不支持该请求!', | ||
}; | ||
|
||
export default api; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,61 +1,58 @@ | ||
import { message } from 'antd'; | ||
import type { ErrorMessageMode } from '#/axios'; | ||
// import i18n from '@/locales'; | ||
// import { useMessage } from '@/hooks/web/useMessage'; | ||
// const { createErrorModal, createErrorMsg } = useMessage(); | ||
import { getIntlFormatMessage } from '@/locales'; | ||
import { createErrorModal, createErrorMsg } from '@/hooks/web/useMessage'; | ||
|
||
export function checkStatus( | ||
status: number, | ||
msg: string, | ||
errorMessageMode: ErrorMessageMode = 'message', | ||
): void { | ||
// const { t } = i18n.global; | ||
const errMessage = ''; | ||
let errMessage = ''; | ||
|
||
// switch (status) { | ||
// case 400: | ||
// errMessage = `${msg}`; | ||
// break; | ||
// case 401: | ||
// errMessage = t('api.errMsg401'); | ||
// break; | ||
// case 403: | ||
// errMessage = t('api.errMsg403'); | ||
// break; | ||
// case 404: | ||
// errMessage = t('api.errMsg404'); | ||
// break; | ||
// case 405: | ||
// errMessage = t('api.errMsg405'); | ||
// break; | ||
// case 408: | ||
// errMessage = t('api.errMsg408'); | ||
// break; | ||
// case 500: | ||
// errMessage = t('api.errMsg500'); | ||
// break; | ||
// case 501: | ||
// errMessage = t('api.errMsg501'); | ||
// break; | ||
// case 502: | ||
// errMessage = t('api.errMsg502'); | ||
// break; | ||
// case 503: | ||
// errMessage = t('api.errMsg503'); | ||
// break; | ||
// case 504: | ||
// errMessage = t('api.errMsg504'); | ||
// break; | ||
// case 505: | ||
// errMessage = t('api.errMsg505'); | ||
// break; | ||
// default: | ||
// } | ||
switch (status) { | ||
case 400: | ||
errMessage = `${msg}`; | ||
break; | ||
case 401: | ||
errMessage = getIntlFormatMessage('api.errMsg401'); | ||
break; | ||
case 403: | ||
errMessage = getIntlFormatMessage('api.errMsg403'); | ||
break; | ||
case 404: | ||
errMessage = getIntlFormatMessage('api.errMsg404'); | ||
break; | ||
case 405: | ||
errMessage = getIntlFormatMessage('api.errMsg405'); | ||
break; | ||
case 408: | ||
errMessage = getIntlFormatMessage('api.errMsg408'); | ||
break; | ||
case 500: | ||
errMessage = getIntlFormatMessage('api.errMsg500'); | ||
break; | ||
case 501: | ||
errMessage = getIntlFormatMessage('api.errMsg501'); | ||
break; | ||
case 502: | ||
errMessage = getIntlFormatMessage('api.errMsg502'); | ||
break; | ||
case 503: | ||
errMessage = getIntlFormatMessage('api.errMsg503'); | ||
break; | ||
case 504: | ||
errMessage = getIntlFormatMessage('api.errMsg504'); | ||
break; | ||
case 505: | ||
errMessage = getIntlFormatMessage('api.errMsg505'); | ||
break; | ||
default: | ||
} | ||
if (errMessage) { | ||
if (errorMessageMode === 'modal') { | ||
message.error(msg); | ||
createErrorModal(errMessage); | ||
} else if (errorMessageMode === 'message') { | ||
message.error(msg); | ||
createErrorMsg(errMessage); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters