|
@@ -12,6 +12,7 @@ import { rewardEventTrackClick } from '@/api/integral'
|
|
|
import { getSuffixAfterPrefix } from '@/utils/prefixUrl'
|
|
|
import { encryptionFun } from '@/utils/openEncryption'
|
|
|
import { useSystem } from '@/store/system'
|
|
|
+import { sendError } from '@/api/system'
|
|
|
|
|
|
import qs from 'qs'
|
|
|
|
|
@@ -26,6 +27,8 @@ const getEventList = () => {
|
|
|
}
|
|
|
getEventList()
|
|
|
|
|
|
+const errorData = []
|
|
|
+
|
|
|
const options = {
|
|
|
// 显示操作成功消息 默认不显示
|
|
|
showSuccess: false,
|
|
@@ -140,10 +143,8 @@ http.interceptors.request.use(
|
|
|
...typeof config.data === 'string' ? JSON.parse(config.data) : config.data,
|
|
|
...typeof config.params === 'string' ? JSON.parse(config.params) : config.params
|
|
|
}
|
|
|
- console.log(123, '->timeDifference:', systemInfo.timeDifference)
|
|
|
if (!systemInfo?.timeDifference) {
|
|
|
const _difference = await getTimeDifference()
|
|
|
- console.log(123, '->打印_difference:', _difference)
|
|
|
setTimeDifference(_difference)
|
|
|
}
|
|
|
|
|
@@ -152,7 +153,7 @@ http.interceptors.request.use(
|
|
|
body,
|
|
|
appId: 'web_client',
|
|
|
AppSecret: 'fa0fc0b5098b974b',
|
|
|
- timestamp: new Date().getTime() + systemInfo.timeDifference,
|
|
|
+ timestamp: new Date().getTime() + systemInfo?.timeDifference,
|
|
|
})
|
|
|
const content = {
|
|
|
data: config.data,
|
|
@@ -215,6 +216,8 @@ http.interceptors.response.use(
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+ const config = response.config
|
|
|
+
|
|
|
// 自定处理【loading 加载中】:如果需要显示 loading,则关闭 loading
|
|
|
response.config.custom.showLoading && closeLoading();
|
|
|
|
|
@@ -238,6 +241,17 @@ http.interceptors.response.use(
|
|
|
}
|
|
|
return Promise.reject(response.data);
|
|
|
}
|
|
|
+ const code = response.data.code || 200
|
|
|
+
|
|
|
+ const _index = errorData.findIndex(e => e.url === config.url && e.time === +config.header.timestamp)
|
|
|
+ if (_index > -1) {
|
|
|
+ const _d = errorData.splice(_index, 1)
|
|
|
+ const _item = _d[0]
|
|
|
+ // 保存错误信息
|
|
|
+ if (code === 400) {
|
|
|
+ sendError({ content: JSON.stringify(_item.content), mark: _item.time + '' })
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
// 自定义处理【showSuccess 成功提示】:如果需要显示成功提示,则显示成功提示
|
|
|
if (response.config.custom.showSuccess && response.config.custom.successMsg !== '' && response.data.code === 0) {
|