@lemon30_npm/csit-vue3 1.0.45 → 1.0.46
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/README.dev.md +146 -87
- package/dist/csit-vue3.js +739 -894
- package/dist/lib/ci-dictionary-select/index.vue.js +2 -2
- package/dist/lib/ci-dictionary-select/index.vue2.js +78 -42
- package/dist/lib/ci-upload/hooks/useUpload.js +27 -29
- package/dist/types/src/components/components-project/ci-dictionary-select/index.vue.d.ts +11 -1
- package/dist/types/src/components/components-project/ci-dictionary-select/type.d.ts +16 -1
- package/dist/types/src/components/components-project/ci-upload/index.vue.d.ts +2 -2
- package/package.json +1 -1
- package/dist/lib/axios/index.js +0 -67
- package/dist/lib/axios/middlewares/middleware-executor.js +0 -15
- package/dist/lib/axios/middlewares/request-middlewares/addXRequestedWith.js +0 -12
- package/dist/lib/axios/middlewares/request-middlewares/dafeiyiqi-disposeGetUrlParams.js +0 -17
- package/dist/lib/axios/middlewares/request-middlewares/logRequest.js +0 -7
- package/dist/lib/axios/middlewares/response-middlewares/formatResponseData.js +0 -7
- package/dist/lib/axios/middlewares/response-middlewares/handle-error/errorMessages.js +0 -14
- package/dist/lib/axios/middlewares/response-middlewares/handle-error/handleError.js +0 -35
- package/dist/lib/axios/middlewares/response-middlewares/handle-success/handleFileStream.js +0 -11
- package/dist/lib/axios/middlewares/response-middlewares/handle-success/handleSuccess.js +0 -20
- package/dist/lib/axios/middlewares/response-middlewares/handle-success/handleTokenInvalidToLogin.js +0 -18
- package/dist/lib/axios/middlewares/response-middlewares/logResponse.js +0 -13
- package/dist/lib/ci-dictionary-select/config.js +0 -18
- package/dist/lib/config/env-config/index.js +0 -4
- package/dist/lib/config/system-config/projectSettings.js +0 -7
- package/dist/lib/utils/system/useSystem.js +0 -9
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import o from "./index.vue2.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import t from "../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
-
const
|
|
4
|
+
const i = /* @__PURE__ */ t(o, [["__scopeId", "data-v-1c3a1dc0"]]);
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
i as default
|
|
7
7
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { ElSelect as
|
|
2
|
-
import { defineComponent as
|
|
3
|
-
import
|
|
4
|
-
const
|
|
1
|
+
import { ElSelect as R, ElOption as w } from "element-plus/es";
|
|
2
|
+
import { defineComponent as S, ref as x, watch as B, computed as m, createBlock as g, openBlock as d, mergeProps as C, withCtx as E, createElementBlock as T, Fragment as _, renderList as L } from "vue";
|
|
3
|
+
import P from "axios";
|
|
4
|
+
const D = {
|
|
5
5
|
name: "CiDictionarySelect",
|
|
6
6
|
inheritAttrs: !1
|
|
7
|
-
}, O = /* @__PURE__ */
|
|
8
|
-
...
|
|
7
|
+
}, O = /* @__PURE__ */ S({
|
|
8
|
+
...D,
|
|
9
9
|
props: {
|
|
10
10
|
clearable: { type: Boolean, default: !0 },
|
|
11
11
|
filterable: { type: Boolean, default: !0 },
|
|
@@ -16,31 +16,67 @@ const S = {
|
|
|
16
16
|
multiple: { type: Boolean, default: !0 },
|
|
17
17
|
dictionaryCode: { default: "" },
|
|
18
18
|
showRange: { default: () => [] },
|
|
19
|
-
noShowRange: { default: () => [] }
|
|
19
|
+
noShowRange: { default: () => [] },
|
|
20
|
+
dictionaryUrl: { default: "/iadw/api/dict/v1/getDictListByCde" },
|
|
21
|
+
dictionaryExtraParams: { default: () => ({}) },
|
|
22
|
+
dictionaryParamKey: { default: "cde" },
|
|
23
|
+
dictionaryRequestMethod: { default: "get" },
|
|
24
|
+
dictionaryLabel: { default: "dictValue" },
|
|
25
|
+
dictionaryValue: { default: "dictKey" },
|
|
26
|
+
dictionarySelectWidth: { default: "190px" },
|
|
27
|
+
axiosInstance: { default: void 0 }
|
|
20
28
|
},
|
|
21
|
-
setup(
|
|
22
|
-
const
|
|
23
|
-
width:
|
|
29
|
+
setup(h) {
|
|
30
|
+
const e = h, r = x([]), b = {
|
|
31
|
+
width: e.dictionarySelectWidth
|
|
24
32
|
};
|
|
25
|
-
|
|
26
|
-
() =>
|
|
27
|
-
async (
|
|
28
|
-
var n;
|
|
29
|
-
if (
|
|
30
|
-
const
|
|
31
|
-
{
|
|
32
|
-
const
|
|
33
|
-
url:
|
|
33
|
+
B(
|
|
34
|
+
() => e.dictionaryCode,
|
|
35
|
+
async (a) => {
|
|
36
|
+
var c, n, s, o, p, f;
|
|
37
|
+
if (a) {
|
|
38
|
+
const y = e.axiosInstance || P;
|
|
39
|
+
if (e.dictionaryRequestMethod === "post") {
|
|
40
|
+
const i = await y({
|
|
41
|
+
url: e.dictionaryUrl,
|
|
42
|
+
method: "post",
|
|
43
|
+
data: {
|
|
44
|
+
[e.dictionaryParamKey]: a,
|
|
45
|
+
// 字典项接口附带的额外参数
|
|
46
|
+
...e.dictionaryExtraParams
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
let l;
|
|
50
|
+
e.axiosInstance ? l = (c = i.data) == null ? void 0 : c.map((t) => ({
|
|
51
|
+
...t,
|
|
52
|
+
label: t[e.dictionaryLabel],
|
|
53
|
+
value: t[e.dictionaryValue]
|
|
54
|
+
})) : l = (s = (n = i.data) == null ? void 0 : n.data) == null ? void 0 : s.map((t) => ({
|
|
55
|
+
...t,
|
|
56
|
+
label: t[e.dictionaryLabel],
|
|
57
|
+
value: t[e.dictionaryValue]
|
|
58
|
+
})), r.value = l;
|
|
59
|
+
}
|
|
60
|
+
if (e.dictionaryRequestMethod === "get") {
|
|
61
|
+
const i = await y({
|
|
62
|
+
url: e.dictionaryUrl,
|
|
34
63
|
method: "get",
|
|
35
64
|
params: {
|
|
36
|
-
[
|
|
65
|
+
[e.dictionaryParamKey]: a,
|
|
66
|
+
// 字典项接口附带的额外参数
|
|
67
|
+
...e.dictionaryExtraParams
|
|
37
68
|
}
|
|
38
69
|
});
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
70
|
+
let l;
|
|
71
|
+
e.axiosInstance ? l = (o = i.data) == null ? void 0 : o.map((t) => ({
|
|
72
|
+
...t,
|
|
73
|
+
label: t[e.dictionaryLabel],
|
|
74
|
+
value: t[e.dictionaryValue]
|
|
75
|
+
})) : l = (f = (p = i.data) == null ? void 0 : p.data) == null ? void 0 : f.map((t) => ({
|
|
76
|
+
...t,
|
|
77
|
+
label: t[e.dictionaryLabel],
|
|
78
|
+
value: t[e.dictionaryValue]
|
|
79
|
+
})), r.value = l;
|
|
44
80
|
}
|
|
45
81
|
}
|
|
46
82
|
},
|
|
@@ -48,24 +84,24 @@ const S = {
|
|
|
48
84
|
immediate: !0
|
|
49
85
|
}
|
|
50
86
|
);
|
|
51
|
-
const
|
|
52
|
-
return (
|
|
53
|
-
const
|
|
54
|
-
return
|
|
87
|
+
const u = m(() => e.showRange.length !== 0 ? r.value.filter((a) => e.showRange.includes(a.value)) : r.value), v = m(() => e.noShowRange.length !== 0 ? u.value.filter((a) => !e.noShowRange.includes(a.value)) : u.value);
|
|
88
|
+
return (a, c) => {
|
|
89
|
+
const n = w, s = R;
|
|
90
|
+
return d(), g(s, C({
|
|
55
91
|
class: "CiDictionarySelect",
|
|
56
|
-
clearable:
|
|
57
|
-
filterable:
|
|
58
|
-
"collapse-tags":
|
|
59
|
-
"collapse-tags-tooltip":
|
|
60
|
-
"max-collapse-tags":
|
|
61
|
-
placeholder:
|
|
62
|
-
multiple:
|
|
63
|
-
},
|
|
64
|
-
default:
|
|
65
|
-
(
|
|
66
|
-
key:
|
|
67
|
-
label:
|
|
68
|
-
value:
|
|
92
|
+
clearable: a.clearable,
|
|
93
|
+
filterable: a.filterable,
|
|
94
|
+
"collapse-tags": a.collapseTags,
|
|
95
|
+
"collapse-tags-tooltip": a.collapseTagsTooltip,
|
|
96
|
+
"max-collapse-tags": a.maxCollapseTags,
|
|
97
|
+
placeholder: a.placeholder,
|
|
98
|
+
multiple: a.multiple
|
|
99
|
+
}, a.$attrs, { style: b }), {
|
|
100
|
+
default: E(() => [
|
|
101
|
+
(d(!0), T(_, null, L(v.value, (o) => (d(), g(n, {
|
|
102
|
+
key: o.value,
|
|
103
|
+
label: o.label,
|
|
104
|
+
value: o.value
|
|
69
105
|
}, null, 8, ["label", "value"]))), 128))
|
|
70
106
|
]),
|
|
71
107
|
_: 1
|
|
@@ -1,61 +1,59 @@
|
|
|
1
|
-
import { ref as
|
|
1
|
+
import { ref as a } from "vue";
|
|
2
2
|
import "element-plus";
|
|
3
3
|
import D from "axios";
|
|
4
4
|
import { appendFormData as P } from "../utils/appendFormData.js";
|
|
5
|
-
function
|
|
6
|
-
const
|
|
5
|
+
function I(m) {
|
|
6
|
+
const o = a(!1), r = a(0), c = a(0), e = a("");
|
|
7
7
|
return {
|
|
8
|
-
uploading:
|
|
8
|
+
uploading: o,
|
|
9
9
|
// 是否上传中
|
|
10
|
-
progress:
|
|
10
|
+
progress: r,
|
|
11
11
|
// 上传进度
|
|
12
|
-
currentFileName:
|
|
12
|
+
currentFileName: e,
|
|
13
13
|
// 当前文件名
|
|
14
|
-
customHttpRequest: async (
|
|
15
|
-
const { file:
|
|
16
|
-
|
|
14
|
+
customHttpRequest: async (f) => {
|
|
15
|
+
const { file: p, onSuccess: s, onError: l, onProgress: g, action: h, headers: w, data: x } = f;
|
|
16
|
+
o.value = !0, r.value = 0, e.value = p.name;
|
|
17
17
|
const n = new FormData();
|
|
18
|
-
n.append("file",
|
|
18
|
+
n.append("file", p), P(n, x);
|
|
19
19
|
try {
|
|
20
|
-
const d =
|
|
21
|
-
|
|
22
|
-
const c = await d({
|
|
23
|
-
url: w,
|
|
20
|
+
const d = await (m || D)({
|
|
21
|
+
url: h,
|
|
24
22
|
method: "post",
|
|
25
23
|
data: n,
|
|
26
24
|
timeout: 0,
|
|
27
25
|
// 设置为0表示永不超时(当是网络不确定的情况下,比如下载大文件时,可以设置为0,不然会报错)
|
|
28
26
|
headers: {
|
|
29
27
|
"Content-Type": "multipart/form-data",
|
|
30
|
-
...
|
|
28
|
+
...w
|
|
31
29
|
// 合并其他调用方自定义 header并显式类型化
|
|
32
30
|
},
|
|
33
31
|
// 上传进度事件:实时更新自定义进度条
|
|
34
|
-
onUploadProgress: (
|
|
35
|
-
if (
|
|
36
|
-
const y = Math.round(
|
|
37
|
-
|
|
38
|
-
const
|
|
39
|
-
|
|
32
|
+
onUploadProgress: (t) => {
|
|
33
|
+
if (t.total) {
|
|
34
|
+
const y = Math.round(t.loaded / t.total * 100);
|
|
35
|
+
r.value = y;
|
|
36
|
+
const i = t;
|
|
37
|
+
i.percent = t.total > 0 ? t.loaded / t.total * 100 : 0, g(i);
|
|
40
38
|
}
|
|
41
39
|
},
|
|
42
40
|
// 下载进度事件(已挂载在 axios)
|
|
43
|
-
onDownloadProgress: (
|
|
44
|
-
|
|
41
|
+
onDownloadProgress: (t) => {
|
|
42
|
+
t.total && (c.value = Math.round(t.loaded / t.total * 100));
|
|
45
43
|
}
|
|
46
44
|
});
|
|
47
|
-
s == null || s(
|
|
48
|
-
} catch (
|
|
49
|
-
l == null || l(
|
|
45
|
+
s == null || s(d.headers ? d.data : d);
|
|
46
|
+
} catch (u) {
|
|
47
|
+
l == null || l(u);
|
|
50
48
|
} finally {
|
|
51
|
-
|
|
49
|
+
o.value = !1, e.value = "";
|
|
52
50
|
}
|
|
53
51
|
},
|
|
54
52
|
// 自定义上传逻辑
|
|
55
|
-
downloadProgress:
|
|
53
|
+
downloadProgress: c
|
|
56
54
|
// 下载进度
|
|
57
55
|
};
|
|
58
56
|
}
|
|
59
57
|
export {
|
|
60
|
-
|
|
58
|
+
I as useUpload
|
|
61
59
|
};
|
|
@@ -10,5 +10,15 @@ declare const _default: import('vue').DefineComponent<DictionarySelectProps, {},
|
|
|
10
10
|
dictionaryCode: string;
|
|
11
11
|
showRange: Array<string | number>;
|
|
12
12
|
noShowRange: Array<string | number>;
|
|
13
|
-
|
|
13
|
+
dictionaryUrl: string;
|
|
14
|
+
dictionaryExtraParams: {
|
|
15
|
+
[key: string]: any;
|
|
16
|
+
};
|
|
17
|
+
dictionaryParamKey: string;
|
|
18
|
+
dictionaryRequestMethod: "get" | "post";
|
|
19
|
+
dictionaryLabel: string;
|
|
20
|
+
dictionaryValue: string;
|
|
21
|
+
dictionarySelectWidth: string;
|
|
22
|
+
axiosInstance: any;
|
|
23
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
14
24
|
export default _default;
|
|
@@ -6,9 +6,24 @@ export interface DictionarySelectProps {
|
|
|
6
6
|
collapseTagsTooltip?: boolean;
|
|
7
7
|
maxCollapseTags?: number;
|
|
8
8
|
multiple?: boolean;
|
|
9
|
-
dictionaryCode
|
|
9
|
+
dictionaryCode: string;
|
|
10
10
|
showRange?: Array<string | number>;
|
|
11
11
|
noShowRange?: Array<string | number>;
|
|
12
|
+
dictionaryUrl?: string;
|
|
13
|
+
dictionaryExtraParams?: {
|
|
14
|
+
[key: string]: any;
|
|
15
|
+
};
|
|
16
|
+
dictionaryParamKey?: string;
|
|
17
|
+
dictionaryRequestMethod?: 'get' | 'post';
|
|
18
|
+
dictionaryLabel?: string;
|
|
19
|
+
dictionaryValue?: string;
|
|
20
|
+
dictionarySelectWidth?: string;
|
|
21
|
+
/**
|
|
22
|
+
* 自定义请求对象:可选传入 axios 实例,用于替代默认 axios - 默认值: axios (场景:如需使用本项目配置过的 axios 实例接管字典项的接口请求)
|
|
23
|
+
* 若传入了:将使用该实例发起请求(支持统一拦截器等配置)
|
|
24
|
+
* 若未传入:则默认使用全局的 axios 对象
|
|
25
|
+
*/
|
|
26
|
+
axiosInstance?: any;
|
|
12
27
|
}
|
|
13
28
|
export interface InterFaceOptions {
|
|
14
29
|
label: string;
|
|
@@ -26,9 +26,10 @@ declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<Ci
|
|
|
26
26
|
}>, {
|
|
27
27
|
drag: boolean;
|
|
28
28
|
data: Record<string, any>;
|
|
29
|
-
headers: Headers | Record<string, any>;
|
|
30
29
|
multiple: boolean;
|
|
30
|
+
axiosInstance: any;
|
|
31
31
|
action: string;
|
|
32
|
+
headers: Headers | Record<string, any>;
|
|
32
33
|
accept: string;
|
|
33
34
|
fileList: UploadUserFile[];
|
|
34
35
|
disabled: boolean;
|
|
@@ -45,7 +46,6 @@ declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<Ci
|
|
|
45
46
|
showDeleteBtn: boolean;
|
|
46
47
|
customDownload: boolean;
|
|
47
48
|
readonly: boolean;
|
|
48
|
-
axiosInstance: any;
|
|
49
49
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {
|
|
50
50
|
uploadRef: unknown;
|
|
51
51
|
}, HTMLDivElement>, Partial<Record<number, (_: any) => any>> & {
|
package/package.json
CHANGED
package/dist/lib/axios/index.js
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import n from "axios";
|
|
2
|
-
import { executeAxiosMiddlewares as r } from "./middlewares/middleware-executor.js";
|
|
3
|
-
import { logRequest as a } from "./middlewares/request-middlewares/logRequest.js";
|
|
4
|
-
import { addXRequestedWith as i } from "./middlewares/request-middlewares/addXRequestedWith.js";
|
|
5
|
-
import { disposeGetUrlParams as m } from "./middlewares/request-middlewares/dafeiyiqi-disposeGetUrlParams.js";
|
|
6
|
-
import { logResponse as t } from "./middlewares/response-middlewares/logResponse.js";
|
|
7
|
-
import { handleTokenInvalidToLogin as c } from "./middlewares/response-middlewares/handle-success/handleTokenInvalidToLogin.js";
|
|
8
|
-
import { handleFileStream as p } from "./middlewares/response-middlewares/handle-success/handleFileStream.js";
|
|
9
|
-
import { handleSuccess as d } from "./middlewares/response-middlewares/handle-success/handleSuccess.js";
|
|
10
|
-
import { formatResponseData as l } from "./middlewares/response-middlewares/formatResponseData.js";
|
|
11
|
-
import { handleError as u } from "./middlewares/response-middlewares/handle-error/handleError.js";
|
|
12
|
-
const f = [
|
|
13
|
-
// 1. 记录请求日志
|
|
14
|
-
a,
|
|
15
|
-
// 2. 添加通用 X-Requested-With 到请求头
|
|
16
|
-
i,
|
|
17
|
-
/**
|
|
18
|
-
* 3. GET请求,需要处理参数拼接到Url中(目前打非一期列表等一些接口都是用的GET请求)
|
|
19
|
-
* PS: 打非二期设计人员设计的接口: 像只入参一个字段的设计成了GET请求(如此不需要中间件处理),其他但凡入参超过一个的全部设计成了post请求(如此更不需要中间件处理)
|
|
20
|
-
*/
|
|
21
|
-
m
|
|
22
|
-
], w = [
|
|
23
|
-
// 1. 记录响应日志
|
|
24
|
-
t,
|
|
25
|
-
// 2. 处理打非系统用户长时间不操作页面token失效自动去往登录页面
|
|
26
|
-
c,
|
|
27
|
-
// 3. 处理响应成功-文件流
|
|
28
|
-
p,
|
|
29
|
-
// 4. 处理响应成功
|
|
30
|
-
d,
|
|
31
|
-
// 5. 格式化响应数据
|
|
32
|
-
l
|
|
33
|
-
], x = [
|
|
34
|
-
// 1. 记录响应日志
|
|
35
|
-
t,
|
|
36
|
-
// 2. 处理错误响应
|
|
37
|
-
u
|
|
38
|
-
], s = n.create({
|
|
39
|
-
// 基础路径
|
|
40
|
-
baseURL: "/",
|
|
41
|
-
// 超时时间
|
|
42
|
-
timeout: 6e4
|
|
43
|
-
/**
|
|
44
|
-
* 这句话没用,在node.js环境中有用
|
|
45
|
-
* 浏览器环境: 在浏览器中,HTTP重定向是由浏览器本身处理的,而不是Axios。即使你配置了 maxRedirects: 0,浏览器会自动遵循重定向,Axios只会接收到重定向后的响应。因此,302状态码不会被Axios捕获。
|
|
46
|
-
* 解决方案: 浏览器中无法阻止自动重定向,通常需要后端支持,比如返回非标准的状态码(如299)或其他标志,让前端捕获。
|
|
47
|
-
*/
|
|
48
|
-
// maxRedirects: 0,
|
|
49
|
-
});
|
|
50
|
-
s.interceptors.request.use(
|
|
51
|
-
async (e) => (await r(f, { config: e }), e),
|
|
52
|
-
(e) => {
|
|
53
|
-
Promise.reject(e);
|
|
54
|
-
}
|
|
55
|
-
);
|
|
56
|
-
s.interceptors.response.use(
|
|
57
|
-
async (e) => {
|
|
58
|
-
const o = { response: e };
|
|
59
|
-
return await r(w, o), o.isFileStream ? (console.log("当前我是文件流数据"), o.response) : o.response.data;
|
|
60
|
-
},
|
|
61
|
-
async (e) => {
|
|
62
|
-
throw await r(x, { error: e }), new Error(e);
|
|
63
|
-
}
|
|
64
|
-
);
|
|
65
|
-
export {
|
|
66
|
-
s as default
|
|
67
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import "axios";
|
|
2
|
-
async function o(n, r) {
|
|
3
|
-
let a = -1;
|
|
4
|
-
async function t(e) {
|
|
5
|
-
if (e <= a)
|
|
6
|
-
throw new Error("createdMiddlewareRunner_axios: 中间件不能被重复调用");
|
|
7
|
-
a = e;
|
|
8
|
-
const i = n[e];
|
|
9
|
-
i && await i(r, () => t(e + 1));
|
|
10
|
-
}
|
|
11
|
-
await t(0);
|
|
12
|
-
}
|
|
13
|
-
export {
|
|
14
|
-
o as executeAxiosMiddlewares
|
|
15
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import "axios";
|
|
2
|
-
async function s(e, t) {
|
|
3
|
-
console.log("axios-请求中间件: 添加通用 X-Requested-With 到请求头已执行"), e.config.headers = {
|
|
4
|
-
...e.config.headers,
|
|
5
|
-
// 问题:当用户长时间不操作页面 再次触发接口操作时 需要退出到登录页面 所需要的请求头
|
|
6
|
-
// 胡老师,说接口请求要带这个请求头,才能拦截 1001 的超时状态,前端再根据这个1001做登出
|
|
7
|
-
"X-Requested-With": "XMLHttpRequest"
|
|
8
|
-
}, await t();
|
|
9
|
-
}
|
|
10
|
-
export {
|
|
11
|
-
s as addXRequestedWith
|
|
12
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import "axios";
|
|
2
|
-
async function l(r, e) {
|
|
3
|
-
const { config: o } = r;
|
|
4
|
-
if (o.method === "get" && o.params) {
|
|
5
|
-
console.log("axios-请求中间件: 当前请求是GET请求,需要处理参数拼接到Url中去,中间件已执行");
|
|
6
|
-
let s = o.url;
|
|
7
|
-
s += "?";
|
|
8
|
-
const t = Object.keys(o.params);
|
|
9
|
-
for (const a of t)
|
|
10
|
-
o.params[a] !== void 0 && o.params[a] !== null && (s += `${a}=${encodeURIComponent(o.params[a])}&`);
|
|
11
|
-
s = s.substring(0, s.length - 1), o.params = {}, o.url = s;
|
|
12
|
-
}
|
|
13
|
-
await e();
|
|
14
|
-
}
|
|
15
|
-
export {
|
|
16
|
-
l as disposeGetUrlParams
|
|
17
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
const e = {
|
|
2
|
-
400: "请求参数错误,请检查输入。",
|
|
3
|
-
401: "未授权,请重新登录。",
|
|
4
|
-
403: "禁止访问,您没有权限查看此内容。",
|
|
5
|
-
404: "资源未找到,请检查接口路径。",
|
|
6
|
-
429: "请求过多,请稍后再试。",
|
|
7
|
-
500: "服务器内部错误,请稍后重试。",
|
|
8
|
-
502: "网关错误,请联系管理员。",
|
|
9
|
-
503: "服务不可用,请稍后再试。"
|
|
10
|
-
}, r = "发生未知错误,请稍后再试。";
|
|
11
|
-
export {
|
|
12
|
-
r as defaultErrorMessage,
|
|
13
|
-
e as errorMessages
|
|
14
|
-
};
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { ElNotification as s } from "element-plus";
|
|
2
|
-
import "axios";
|
|
3
|
-
import { errorMessages as l, defaultErrorMessage as n } from "./errorMessages.js";
|
|
4
|
-
const p = async (a, i) => {
|
|
5
|
-
console.log("axios-响应中间件(失败响应): 响应失败错误处理中间件已执行");
|
|
6
|
-
const e = a.error, { response: r } = e;
|
|
7
|
-
if (r) {
|
|
8
|
-
const { status: o } = r, t = l[o] || n;
|
|
9
|
-
console.log(`axios-响应中间件(失败响应)原因: HTTP 错误状态码: ${o}`), console.log(`axios-响应中间件(失败响应)原因: 错误信息: ${t}`), s({
|
|
10
|
-
type: "error",
|
|
11
|
-
title: `失败响应错误码:${o}`,
|
|
12
|
-
message: t,
|
|
13
|
-
duration: 6e3
|
|
14
|
-
// 6s自动关闭
|
|
15
|
-
}), o === 401 && console.log("axios-响应中间件(失败响应)原因: 我是401特定状态码执行自定义逻辑");
|
|
16
|
-
} else e.request ? (console.log(
|
|
17
|
-
`axios-响应中间件(失败响应)原因: 网络错误或服务器无响应,请检查网络连接。 ${e.message}`
|
|
18
|
-
), s({
|
|
19
|
-
type: "error",
|
|
20
|
-
title: "失败响应",
|
|
21
|
-
message: `失败响应原因:网络错误或服务器无响应,请检查网络连接。 ${e.message}`,
|
|
22
|
-
duration: 6e3
|
|
23
|
-
// 6s自动关闭
|
|
24
|
-
})) : (console.log(`axios-响应中间件(失败响应)原因: 请求配置错误: ${e.message}`), s({
|
|
25
|
-
type: "error",
|
|
26
|
-
title: "失败响应",
|
|
27
|
-
message: `失败响应原因:请求配置错误: ${e.message}`,
|
|
28
|
-
duration: 6e3
|
|
29
|
-
// 6s自动关闭
|
|
30
|
-
}));
|
|
31
|
-
await i();
|
|
32
|
-
};
|
|
33
|
-
export {
|
|
34
|
-
p as handleError
|
|
35
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import "axios";
|
|
2
|
-
const r = async (e, o) => {
|
|
3
|
-
if (console.log("axios-响应中间件(成功响应): 文件流处理中间件已执行"), e.response.config.responseType === "blob" || e.response.config.responseType === "arraybuffer") {
|
|
4
|
-
console.log("axios-响应中间件(成功响应): 文件流处理中间件已执行: 目前是文件流数据"), e.isFileStream = !0;
|
|
5
|
-
return;
|
|
6
|
-
}
|
|
7
|
-
console.log("axios-响应中间件(成功响应): 文件流处理中间件已执行: 目前不是文件流数据"), await o();
|
|
8
|
-
};
|
|
9
|
-
export {
|
|
10
|
-
r as handleFileStream
|
|
11
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import "axios";
|
|
2
|
-
import { projectSettings as t } from "../../../../config/system-config/projectSettings.js";
|
|
3
|
-
import { ElNotification as a } from "element-plus";
|
|
4
|
-
const g = async (s, o) => {
|
|
5
|
-
if (console.log("axios-响应中间件(成功响应): 响应成功处理中间件已执行"), s.response.data.code === t.resSuccessCode)
|
|
6
|
-
console.log("axios-响应中间件(成功响应): 后台响应结果是成功编码: 0000"), await o();
|
|
7
|
-
else {
|
|
8
|
-
const e = s.response.data.code, r = s.response.data.message;
|
|
9
|
-
throw a({
|
|
10
|
-
type: "error",
|
|
11
|
-
title: `错误码:${e}`,
|
|
12
|
-
message: r,
|
|
13
|
-
duration: 6e3
|
|
14
|
-
// 6s自动关闭
|
|
15
|
-
}), e === "1001" && console.log("axios-响应中间件(成功响应): 我是1001特定状态码执行自定义逻辑"), new Error(`后台响应结果是异常编码: ${e}`);
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
export {
|
|
19
|
-
g as handleSuccess
|
|
20
|
-
};
|
package/dist/lib/axios/middlewares/response-middlewares/handle-success/handleTokenInvalidToLogin.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import "axios";
|
|
2
|
-
import t from "../../../../utils/system/useSystem.js";
|
|
3
|
-
const l = async (o, s) => {
|
|
4
|
-
if (o.response) {
|
|
5
|
-
console.log("axios-响应中间件(成功响应): 处理token失效中间件已执行");
|
|
6
|
-
const e = ["1001", "1002", "1003", "1009", "1011", "1012"];
|
|
7
|
-
if (o.response.status === 200 && e.includes(o.response.data.code)) {
|
|
8
|
-
const { TuiChuSystem: n } = t();
|
|
9
|
-
n();
|
|
10
|
-
} else
|
|
11
|
-
console.log(
|
|
12
|
-
"axios-响应中间件(成功响应): 处理token失效中间件已执行: token未失效,继续进行调用中间件链条"
|
|
13
|
-
), await s();
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
export {
|
|
17
|
-
l as handleTokenInvalidToLogin
|
|
18
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import "axios";
|
|
2
|
-
const r = async (o, s) => {
|
|
3
|
-
console.log("axios-响应中间件(成功响应 | 失败响应): 日志记录中间件执行"), o.response ? console.log(
|
|
4
|
-
"axios-响应中间件(成功响应 | 失败响应): 日志记录中间件: 成功响应-Response为:",
|
|
5
|
-
o.response
|
|
6
|
-
) : o.error && console.log(
|
|
7
|
-
"axios-响应中间件(成功响应 | 失败响应): 日志记录中间件: 失败响应-Error为:",
|
|
8
|
-
o.error
|
|
9
|
-
), await s();
|
|
10
|
-
};
|
|
11
|
-
export {
|
|
12
|
-
r as logResponse
|
|
13
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import i from "../axios/index.js";
|
|
2
|
-
const e = {
|
|
3
|
-
// 字典项接口地址
|
|
4
|
-
dictionary_url: "/iadw/api/dict/v1/getDictListByCde",
|
|
5
|
-
// 字典项接口请求方式 post get 参数入参key
|
|
6
|
-
dictionary_request_method_param_key: "cde",
|
|
7
|
-
// 字典项接口返回的数据对象 Select组件 label 字段
|
|
8
|
-
dictionary_label: "dictValue",
|
|
9
|
-
// 字典项接口返回的数据对象 Select组件 value 字段
|
|
10
|
-
dictionary_value: "dictKey",
|
|
11
|
-
// select框默认宽度值
|
|
12
|
-
dictionary_selectWidth: "190px",
|
|
13
|
-
// 封装的 Axios 实例(请求接口需要用到)
|
|
14
|
-
dictionary_axios: i
|
|
15
|
-
};
|
|
16
|
-
export {
|
|
17
|
-
e as dictionarySettings
|
|
18
|
-
};
|