doway-coms 1.4.35 → 1.4.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/packages/utils/request.js +21 -9
package/package.json
CHANGED
|
@@ -28,12 +28,28 @@ service.interceptors.request.use(
|
|
|
28
28
|
// respone interceptor
|
|
29
29
|
service.interceptors.response.use(
|
|
30
30
|
response => {
|
|
31
|
-
// store.dispatch(
|
|
32
|
-
// "setLastRequireTime",
|
|
33
|
-
// moment().format("YYYY-MM-DD HH:mm:ss")
|
|
34
|
-
// );
|
|
35
|
-
|
|
36
31
|
const res = response.data
|
|
32
|
+
// 导出文件进入判断
|
|
33
|
+
if (res instanceof Blob) {
|
|
34
|
+
if (res.type === 'application/json') {
|
|
35
|
+
const enc = new TextDecoder('utf-8');
|
|
36
|
+
res.arrayBuffer().then((buffer) => {
|
|
37
|
+
const tempData = JSON.parse(enc.decode(new Uint8Array(buffer))) || {};
|
|
38
|
+
if (tempData['code'] && tempData['code'] === 500) {
|
|
39
|
+
notification.error({
|
|
40
|
+
message: '错误信息',
|
|
41
|
+
top:"100px",
|
|
42
|
+
description: h => {
|
|
43
|
+
return h('div', null, [
|
|
44
|
+
h('p', { domProps: { innerHTML: tempData['msg'] } }, null)
|
|
45
|
+
])
|
|
46
|
+
}
|
|
47
|
+
})
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
return response;
|
|
52
|
+
}
|
|
37
53
|
if (res.status === 200 || res.code === 200) {
|
|
38
54
|
return response.data
|
|
39
55
|
}
|
|
@@ -41,7 +57,6 @@ service.interceptors.response.use(
|
|
|
41
57
|
return response.data
|
|
42
58
|
}
|
|
43
59
|
if (res.code === 401) {
|
|
44
|
-
// alert('会话过期2');
|
|
45
60
|
store.dispatch('logOut')
|
|
46
61
|
return Promise.reject(res.msg)
|
|
47
62
|
}
|
|
@@ -53,10 +68,7 @@ service.interceptors.response.use(
|
|
|
53
68
|
h('p', { domProps: { innerHTML: res.msg } }, null)
|
|
54
69
|
])
|
|
55
70
|
}
|
|
56
|
-
// description:parseContent.content
|
|
57
71
|
})
|
|
58
|
-
|
|
59
|
-
// notification['error']({ message: '错误信息', description: res.msg })
|
|
60
72
|
return Promise.reject(res.msg)
|
|
61
73
|
},
|
|
62
74
|
error => {
|