|
|
@@ -3,6 +3,7 @@ import config from '@/config'
|
|
|
import { getToken } from '@/utils/auth'
|
|
|
import errorCode from '@/utils/errorCode'
|
|
|
import { toast, showConfirm, tansParams } from '@/utils/common'
|
|
|
+import i18 from '@/utils/i18.js'
|
|
|
|
|
|
let timeout = 10000
|
|
|
const baseUrl = config.baseUrl
|
|
|
@@ -35,14 +36,14 @@ const upload = config => {
|
|
|
if (code === 200) {
|
|
|
resolve(result)
|
|
|
} else if (code == 401) {
|
|
|
- showConfirm("登录状态已过期,您可以继续留在该页面,或者重新登录?").then(res => {
|
|
|
+ showConfirm(i18("登录状态已过期,您可以继续留在该页面,或者重新登录?")).then(res => {
|
|
|
if (res.confirm) {
|
|
|
store.dispatch('LogOut').then(res => {
|
|
|
uni.reLaunch({ url: '/pages/login/login' })
|
|
|
})
|
|
|
}
|
|
|
})
|
|
|
- reject('无效的会话,或者会话已过期,请重新登录。')
|
|
|
+ reject(i18('无效的会话,或者会话已过期,请重新登录。'))
|
|
|
} else if (code === 500) {
|
|
|
toast(msg)
|
|
|
reject('500')
|
|
|
@@ -54,11 +55,11 @@ const upload = config => {
|
|
|
fail: (error) => {
|
|
|
let { message } = error
|
|
|
if (message == 'Network Error') {
|
|
|
- message = '后端接口连接异常'
|
|
|
+ message = i18('后端接口连接异常')
|
|
|
} else if (message.includes('timeout')) {
|
|
|
- message = '系统接口请求超时'
|
|
|
+ message = i18('系统接口请求超时')
|
|
|
} else if (message.includes('Request failed with status code')) {
|
|
|
- message = '系统接口' + message.substr(message.length - 3) + '异常'
|
|
|
+ message = 'System API' + message.substr(message.length - 3) + 'Exception'
|
|
|
}
|
|
|
toast(message)
|
|
|
reject(error)
|