fix(http): 为请求失败提示添加错误信息参数

将原始的请求失败和域名不在白名单的提示中,新增传入err参数到多语言翻译中,展示更详细的错误信息
This commit is contained in:
2026-07-02 16:56:28 +08:00
parent d3e8b62581
commit 0cdb956065

View File

@@ -171,7 +171,7 @@ export default {
fail: (res) => { fail: (res) => {
if (res.errMsg && res.errMsg == 'request:fail url not in domain list') { if (res.errMsg && res.errMsg == 'request:fail url not in domain list') {
uni.showToast({ uni.showToast({
title: getLang().lang('http.domainNotInList', { url: Config.baseUrl }), title: getLang().lang('http.domainNotInList', { url: Config.baseUrl, err: res.errMsg }),
'icon': 'none', 'icon': 'none',
duration: 10000 duration: 10000
}); });
@@ -182,7 +182,7 @@ export default {
complete: (res) => { complete: (res) => {
if ((res.errMsg && res.errMsg != "request:ok") || (res.statusCode && [200, 500].indexOf(res.statusCode) == -1)) { if ((res.errMsg && res.errMsg != "request:ok") || (res.statusCode && [200, 500].indexOf(res.statusCode) == -1)) {
uni.showToast({ uni.showToast({
title: getLang().lang('http.requestFailed', { url: Config.baseUrl }), title: getLang().lang('http.requestFailed', { url: Config.baseUrl, err: res.errMsg }),
'icon': 'none', 'icon': 'none',
duration: 10000 duration: 10000
}); });