color-star-custom-methods 0.0.27 → 0.0.29
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/es/index.mjs +285 -271
- package/lib/index.js +2 -2
- package/package.json +3 -3
package/es/index.mjs
CHANGED
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
import
|
|
1
|
+
import { ref as R, computed as B, onMounted as O, onUnmounted as D, markRaw as S } from "vue";
|
|
2
|
+
import U from "axios";
|
|
3
3
|
import j from "qs";
|
|
4
|
-
import
|
|
5
|
-
import { ElMessage as
|
|
6
|
-
import { fetchEventSource as
|
|
7
|
-
import { IconClose as
|
|
8
|
-
const
|
|
9
|
-
const a = window.innerWidth,
|
|
10
|
-
return Math.max(e,
|
|
11
|
-
},
|
|
12
|
-
const { minScale:
|
|
13
|
-
a.value = Y(
|
|
4
|
+
import $ from "js-yaml";
|
|
5
|
+
import { ElMessage as y, ElMessageBox as k } from "element-plus";
|
|
6
|
+
import { fetchEventSource as H } from "@microsoft/fetch-event-source";
|
|
7
|
+
import { IconClose as N, IconBasicWarn as z, IconBasicError as K, IconBasicSuccess as W } from "color-message-lingyun-vue";
|
|
8
|
+
const x = 1, Y = (e = 0.9) => {
|
|
9
|
+
const a = window.innerWidth, s = window.innerHeight, l = a === 1920, r = l ? x : a / 1920, t = l ? x : s / 1080, i = Math.min(r, t);
|
|
10
|
+
return Math.max(e, i);
|
|
11
|
+
}, se = (e = {}) => {
|
|
12
|
+
const { minScale: o = 0.9, enableZoomPrevention: n = !1 } = e, a = R(x), s = () => {
|
|
13
|
+
a.value = Y(o), document.documentElement.style.setProperty(
|
|
14
14
|
"--app-scale",
|
|
15
15
|
a.value.toString()
|
|
16
16
|
);
|
|
17
|
-
},
|
|
18
|
-
if ((
|
|
19
|
-
|
|
17
|
+
}, l = (c) => {
|
|
18
|
+
if ((c.ctrlKey || c.metaKey) && (c.key === "+" || c.key === "-" || c.key === "=" || c.key === "0")) {
|
|
19
|
+
c.preventDefault();
|
|
20
20
|
return;
|
|
21
21
|
}
|
|
22
|
-
if (
|
|
23
|
-
|
|
22
|
+
if (c.ctrlKey && c.type === "wheel") {
|
|
23
|
+
c.preventDefault();
|
|
24
24
|
return;
|
|
25
25
|
}
|
|
26
|
-
}, r = (
|
|
27
|
-
|
|
28
|
-
},
|
|
29
|
-
|
|
30
|
-
},
|
|
31
|
-
const
|
|
26
|
+
}, r = (c) => {
|
|
27
|
+
c.touches && c.touches.length > 1 && c.preventDefault();
|
|
28
|
+
}, t = (c) => {
|
|
29
|
+
c.preventDefault();
|
|
30
|
+
}, i = B(() => {
|
|
31
|
+
const c = a.value !== x;
|
|
32
32
|
return {
|
|
33
33
|
transform: `scale(${a.value})`,
|
|
34
34
|
transformOrigin: "top left",
|
|
35
|
-
position:
|
|
35
|
+
position: c ? "fixed" : "relative",
|
|
36
36
|
width: `calc(100% / ${a.value})`,
|
|
37
37
|
height: `calc(100% / ${a.value})`,
|
|
38
|
-
...
|
|
38
|
+
...c && {
|
|
39
39
|
top: "0",
|
|
40
40
|
left: "0"
|
|
41
41
|
}
|
|
42
42
|
};
|
|
43
|
-
}),
|
|
44
|
-
"app-container": a.value !==
|
|
45
|
-
})),
|
|
43
|
+
}), d = B(() => ({
|
|
44
|
+
"app-container": a.value !== x
|
|
45
|
+
})), p = () => {
|
|
46
46
|
if (typeof document > "u") return;
|
|
47
|
-
const
|
|
48
|
-
let m = document.getElementById(
|
|
49
|
-
m || (m = document.createElement("style"), m.id =
|
|
47
|
+
const c = "page-zoom-controller-styles";
|
|
48
|
+
let m = document.getElementById(c);
|
|
49
|
+
m || (m = document.createElement("style"), m.id = c, m.textContent = `
|
|
50
50
|
.app-container * {
|
|
51
51
|
/* 优化字体渲染,防止缩放时字体模糊 */
|
|
52
52
|
-webkit-font-smoothing: antialiased !important;
|
|
@@ -59,156 +59,162 @@ const S = 1, Y = (e = 0.9) => {
|
|
|
59
59
|
const m = document.getElementById("page-zoom-controller-styles");
|
|
60
60
|
m && m.remove();
|
|
61
61
|
};
|
|
62
|
-
return
|
|
63
|
-
|
|
62
|
+
return O(() => {
|
|
63
|
+
s(), p(), window.addEventListener("resize", s), n && (window.addEventListener("wheel", l, { passive: !1 }), window.addEventListener("keydown", l), window.addEventListener("touchstart", r, {
|
|
64
64
|
passive: !1
|
|
65
|
-
}), window.addEventListener("touchmove", r, { passive: !1 }), window.addEventListener("gesturestart",
|
|
65
|
+
}), window.addEventListener("touchmove", r, { passive: !1 }), window.addEventListener("gesturestart", t, {
|
|
66
66
|
passive: !1
|
|
67
|
-
}), window.addEventListener("gesturechange",
|
|
67
|
+
}), window.addEventListener("gesturechange", t, {
|
|
68
68
|
passive: !1
|
|
69
|
-
}), window.addEventListener("gestureend",
|
|
69
|
+
}), window.addEventListener("gestureend", t, {
|
|
70
70
|
passive: !1
|
|
71
71
|
}), document.body.style.touchAction = "none");
|
|
72
|
-
}),
|
|
73
|
-
window.removeEventListener("resize",
|
|
72
|
+
}), D(() => {
|
|
73
|
+
window.removeEventListener("resize", s), g(), n && (window.removeEventListener("wheel", l), window.removeEventListener("keydown", l), window.removeEventListener("touchstart", r), window.removeEventListener("touchmove", r), window.removeEventListener("gesturestart", t), window.removeEventListener("gesturechange", t), window.removeEventListener("gestureend", t), document.body.style.touchAction === "none" && (document.body.style.touchAction = ""));
|
|
74
74
|
}), {
|
|
75
|
-
containerStyles:
|
|
76
|
-
containerClasses:
|
|
75
|
+
containerStyles: i,
|
|
76
|
+
containerClasses: d,
|
|
77
77
|
scaleValue: a
|
|
78
78
|
};
|
|
79
|
-
},
|
|
80
|
-
const a =
|
|
81
|
-
return
|
|
82
|
-
}, {}),
|
|
83
|
-
const a = V(
|
|
84
|
-
return
|
|
85
|
-
}, {}),
|
|
86
|
-
const { language:
|
|
79
|
+
}, _ = (e) => e.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase(), V = (e) => e.replace(/-([a-z])/g, (o, n) => n.toUpperCase()), T = (e) => typeof e != "object" || e === null ? e : Array.isArray(e) ? e.map(T) : Object.keys(e).reduce((o, n) => {
|
|
80
|
+
const a = _(n);
|
|
81
|
+
return n === "dataValue" && (e.dataType === "object" || e.dataType === "arrayObject") ? o[a] = e[n] : o[a] = T(e[n]), o;
|
|
82
|
+
}, {}), A = (e) => typeof e != "object" || e === null ? e : Array.isArray(e) ? e.map(A) : Object.keys(e).reduce((o, n) => {
|
|
83
|
+
const a = V(n);
|
|
84
|
+
return o[a] = A(e[n]), o;
|
|
85
|
+
}, {}), ie = ({ logout: e, axiosConfig: o = {}, t: n } = {}) => {
|
|
86
|
+
const { language: a } = o, s = n || o?.t, l = (t, i, d) => {
|
|
87
|
+
if (typeof s == "function") {
|
|
88
|
+
const p = s(t, d);
|
|
89
|
+
return p === t ? i : p;
|
|
90
|
+
}
|
|
91
|
+
return i;
|
|
92
|
+
}, r = U.create({
|
|
87
93
|
baseURL: "",
|
|
88
94
|
headers: {
|
|
89
95
|
"Content-Type": "application/json;",
|
|
90
|
-
"Accept-Language":
|
|
96
|
+
"Accept-Language": a
|
|
91
97
|
},
|
|
92
98
|
withCredentials: !1,
|
|
93
99
|
paramsSerializer: (t) => j.stringify(t, { indices: !1 }),
|
|
94
|
-
...
|
|
100
|
+
...o
|
|
95
101
|
});
|
|
96
|
-
return
|
|
97
|
-
(t) => (t.dataType === "formData" && (t.headers["Content-Type"] = "multipart/form-data"), t.dataType === "yaml" && (t.headers["Content-Type"] = "application/yaml", t.headers.Accept = "yaml", t.data =
|
|
102
|
+
return r.interceptors.request.use(
|
|
103
|
+
(t) => (t.dataType === "formData" && (t.headers["Content-Type"] = "multipart/form-data"), t.dataType === "yaml" && (t.headers["Content-Type"] = "application/yaml", t.headers.Accept = "yaml", t.data = $.dump(t.data)), t.cozeToken && (t.headers.Authorization = `Bearer ${t.cozeToken}`), t.skipCamelToKebab || (t.data = T(t.data), t.params = T(t.params)), t),
|
|
98
104
|
(t) => {
|
|
99
105
|
Promise.reject(t);
|
|
100
106
|
}
|
|
101
|
-
),
|
|
107
|
+
), r.interceptors.response.use(
|
|
102
108
|
(t) => {
|
|
103
109
|
if (t.request.responseType !== "arraybuffer" && (t.config.headers.Accept === "json" || t.config.headers.Accept === "application/json, text/plain, */*")) {
|
|
104
|
-
const
|
|
105
|
-
if ([21401, 20401, 21409].includes(
|
|
110
|
+
const i = t.config.skipKebabToCamel ? t.data : A(t.data);
|
|
111
|
+
if ([21401, 20401, 21409].includes(i.code)) {
|
|
106
112
|
e?.();
|
|
107
113
|
return;
|
|
108
114
|
} else
|
|
109
|
-
|
|
110
|
-
return
|
|
115
|
+
i.code && i.mesg && y.error(i.mesg);
|
|
116
|
+
return i;
|
|
111
117
|
}
|
|
112
118
|
return t;
|
|
113
119
|
},
|
|
114
|
-
(t) => (t.response && t.response.status ?
|
|
115
|
-
message: "网络请求超时",
|
|
120
|
+
(t) => (t.response && t.response.status ? y.error(t.response.data.mesg) : navigator.onLine || y.error(l("REQUEST.NETWORK_ERROR", "网络异常请检查")), t.code === "ECONNABORTED" && t.message.includes("timeout") && y({
|
|
121
|
+
message: l("REQUEST.TIMEOUT", "网络请求超时"),
|
|
116
122
|
type: "error",
|
|
117
123
|
duration: 3 * 1e3
|
|
118
124
|
}), Promise.reject(t))
|
|
119
|
-
),
|
|
120
|
-
},
|
|
121
|
-
method:
|
|
125
|
+
), r;
|
|
126
|
+
}, F = (e, o) => e && [21401, 20401, 21409].includes(e.code) ? (o?.(), !0) : !1, ce = ({ logout: e } = {}) => (o, {
|
|
127
|
+
method: n = "post",
|
|
122
128
|
signal: a,
|
|
123
|
-
body:
|
|
124
|
-
successCallback:
|
|
129
|
+
body: s,
|
|
130
|
+
successCallback: l,
|
|
125
131
|
errCallback: r,
|
|
126
|
-
openCallback:
|
|
132
|
+
openCallback: t
|
|
127
133
|
}) => {
|
|
128
|
-
const
|
|
129
|
-
method:
|
|
134
|
+
const i = {
|
|
135
|
+
method: n,
|
|
130
136
|
signal: a,
|
|
131
137
|
headers: {
|
|
132
138
|
"Content-Type": "application/json"
|
|
133
139
|
},
|
|
134
|
-
async onopen(
|
|
135
|
-
const
|
|
136
|
-
if (
|
|
137
|
-
const g = await
|
|
138
|
-
|
|
140
|
+
async onopen(d) {
|
|
141
|
+
const p = d.headers.get("content-type");
|
|
142
|
+
if (d.status === 200 && (!p || !p.includes("text/event-stream"))) {
|
|
143
|
+
const g = await d.json();
|
|
144
|
+
F(g, e);
|
|
139
145
|
}
|
|
140
|
-
|
|
146
|
+
t?.(d);
|
|
141
147
|
},
|
|
142
|
-
onmessage(
|
|
143
|
-
|
|
148
|
+
onmessage(d) {
|
|
149
|
+
l?.(d);
|
|
144
150
|
},
|
|
145
|
-
onerror(
|
|
146
|
-
throw r?.(
|
|
151
|
+
onerror(d) {
|
|
152
|
+
throw r?.(d), new Error("请求出错");
|
|
147
153
|
},
|
|
148
154
|
openWhenHidden: !0
|
|
149
155
|
};
|
|
150
|
-
if (
|
|
151
|
-
const
|
|
152
|
-
|
|
156
|
+
if (n == "post") {
|
|
157
|
+
const d = T(s);
|
|
158
|
+
i.body = JSON.stringify(d);
|
|
153
159
|
}
|
|
154
|
-
|
|
155
|
-
},
|
|
160
|
+
H(o, i);
|
|
161
|
+
}, w = {
|
|
156
162
|
success: "success",
|
|
157
163
|
error: "error",
|
|
158
164
|
warning: "warning"
|
|
159
|
-
},
|
|
160
|
-
[
|
|
161
|
-
[
|
|
162
|
-
[
|
|
163
|
-
},
|
|
164
|
-
|
|
165
|
+
}, J = {
|
|
166
|
+
[w.success]: S(W),
|
|
167
|
+
[w.error]: S(K),
|
|
168
|
+
[w.warning]: S(z)
|
|
169
|
+
}, P = (e, o) => {
|
|
170
|
+
y({
|
|
165
171
|
grouping: !0,
|
|
166
172
|
duration: 5e3,
|
|
167
|
-
type:
|
|
173
|
+
type: o,
|
|
168
174
|
message: e,
|
|
169
175
|
offset: 66,
|
|
170
|
-
icon:
|
|
176
|
+
icon: J[o]
|
|
171
177
|
});
|
|
172
|
-
}, ce = (e) => {
|
|
173
|
-
A(e, v.success);
|
|
174
178
|
}, le = (e) => {
|
|
175
|
-
|
|
179
|
+
P(e, w.success);
|
|
176
180
|
}, de = (e) => {
|
|
177
|
-
|
|
181
|
+
P(e, w.error);
|
|
182
|
+
}, ue = (e) => {
|
|
183
|
+
P(e, w.warning);
|
|
178
184
|
}, pe = (e = {}) => {
|
|
179
|
-
const
|
|
180
|
-
e?.text &&
|
|
185
|
+
const o = [];
|
|
186
|
+
e?.text && o.push(
|
|
181
187
|
`<div class="text-202434 fz-14 weight-500">${e?.text}</div>`
|
|
182
|
-
), e?.subText &&
|
|
188
|
+
), e?.subText && o.push(
|
|
183
189
|
`<div class="text-74798c fz-12">${e?.subText}</div>`
|
|
184
190
|
);
|
|
185
|
-
const
|
|
191
|
+
const n = {
|
|
186
192
|
prompt: "提示",
|
|
187
193
|
confirmButtonText: "删除",
|
|
188
194
|
cancelButtonText: "取消",
|
|
189
195
|
type: "warning",
|
|
190
|
-
icon:
|
|
191
|
-
closeIcon:
|
|
196
|
+
icon: S(z),
|
|
197
|
+
closeIcon: S(N),
|
|
192
198
|
confirmButtonClass: "el-button--danger"
|
|
193
199
|
};
|
|
194
|
-
return
|
|
195
|
-
|
|
196
|
-
e?.prompt ||
|
|
200
|
+
return k.confirm(
|
|
201
|
+
o.join(""),
|
|
202
|
+
e?.prompt || n.prompt,
|
|
197
203
|
{
|
|
198
|
-
confirmButtonText: e?.confirmButtonText ||
|
|
199
|
-
cancelButtonText: e?.cancelButtonText ||
|
|
200
|
-
type: e?.type ||
|
|
201
|
-
icon: e?.icon ||
|
|
202
|
-
closeIcon: e?.closeIcon ||
|
|
204
|
+
confirmButtonText: e?.confirmButtonText || n.confirmButtonText,
|
|
205
|
+
cancelButtonText: e?.cancelButtonText || n.cancelButtonText,
|
|
206
|
+
type: e?.type || n.type,
|
|
207
|
+
icon: e?.icon || n.icon,
|
|
208
|
+
closeIcon: e?.closeIcon || n.closeIcon,
|
|
203
209
|
dangerouslyUseHTMLString: !0,
|
|
204
|
-
confirmButtonClass: e?.confirmButtonClass ||
|
|
210
|
+
confirmButtonClass: e?.confirmButtonClass || n.confirmButtonClass
|
|
205
211
|
}
|
|
206
212
|
).then(() => {
|
|
207
213
|
e?.success?.();
|
|
208
214
|
}).catch(() => {
|
|
209
215
|
e?.error?.();
|
|
210
216
|
});
|
|
211
|
-
},
|
|
217
|
+
}, me = {
|
|
212
218
|
sendMessage: "sendMessage",
|
|
213
219
|
stopChat: "stopChat",
|
|
214
220
|
generationStart: "generationStart",
|
|
@@ -250,16 +256,16 @@ const S = 1, Y = (e = 0.9) => {
|
|
|
250
256
|
edit: "edit",
|
|
251
257
|
blur: "blur",
|
|
252
258
|
focus: "focus"
|
|
253
|
-
},
|
|
259
|
+
}, ge = {
|
|
254
260
|
success: "0000",
|
|
255
261
|
// 成功
|
|
256
262
|
notLogin: 401,
|
|
257
263
|
// 未登录
|
|
258
264
|
canceled: "ERR_CANCELED"
|
|
259
|
-
},
|
|
265
|
+
}, Z = {
|
|
260
266
|
pageNum: 1,
|
|
261
267
|
pageSize: 20
|
|
262
|
-
},
|
|
268
|
+
}, fe = {
|
|
263
269
|
text: "text",
|
|
264
270
|
select: "select",
|
|
265
271
|
date: "date",
|
|
@@ -269,10 +275,10 @@ const S = 1, Y = (e = 0.9) => {
|
|
|
269
275
|
checkbox: "checkbox",
|
|
270
276
|
textarea: "textarea",
|
|
271
277
|
upload: "upload"
|
|
272
|
-
},
|
|
278
|
+
}, he = {
|
|
273
279
|
date: "YYYY-MM-DD",
|
|
274
280
|
dateTime: "YYYY-MM-DD HH:mm:ss"
|
|
275
|
-
},
|
|
281
|
+
}, ve = {
|
|
276
282
|
search: "search",
|
|
277
283
|
reset: "reset",
|
|
278
284
|
export: "export",
|
|
@@ -295,7 +301,7 @@ const S = 1, Y = (e = 0.9) => {
|
|
|
295
301
|
years: "years",
|
|
296
302
|
months: "months",
|
|
297
303
|
yearrange: "yearrange"
|
|
298
|
-
},
|
|
304
|
+
}, we = {
|
|
299
305
|
[b.datetimerange]: {
|
|
300
306
|
rangeSeparator: "至",
|
|
301
307
|
startPlaceholder: "开始时间",
|
|
@@ -316,15 +322,15 @@ const S = 1, Y = (e = 0.9) => {
|
|
|
316
322
|
startPlaceholder: "开始年份",
|
|
317
323
|
endPlaceholder: "结束年份"
|
|
318
324
|
}
|
|
319
|
-
},
|
|
325
|
+
}, ye = {
|
|
320
326
|
label: "name",
|
|
321
327
|
value: "id"
|
|
322
|
-
}, ye = {
|
|
323
|
-
satoken: "satoken"
|
|
324
328
|
}, Se = {
|
|
325
|
-
|
|
329
|
+
satoken: "satoken"
|
|
330
|
+
}, xe = {
|
|
331
|
+
pageSizes: [Z.pageSize, 50, 100, 200],
|
|
326
332
|
layout: "total, sizes, prev, pager, next, jumper"
|
|
327
|
-
},
|
|
333
|
+
}, u = {
|
|
328
334
|
png: "png",
|
|
329
335
|
jpeg: "jpeg",
|
|
330
336
|
jpg: "jpg",
|
|
@@ -342,39 +348,39 @@ const S = 1, Y = (e = 0.9) => {
|
|
|
342
348
|
md: "md",
|
|
343
349
|
csv: "csv",
|
|
344
350
|
json: "json"
|
|
345
|
-
},
|
|
346
|
-
[
|
|
347
|
-
[
|
|
348
|
-
[
|
|
349
|
-
[
|
|
350
|
-
[
|
|
351
|
-
[
|
|
352
|
-
[
|
|
353
|
-
[
|
|
354
|
-
[
|
|
355
|
-
[
|
|
356
|
-
[
|
|
357
|
-
[
|
|
358
|
-
[
|
|
359
|
-
[
|
|
360
|
-
[
|
|
361
|
-
[
|
|
362
|
-
[
|
|
351
|
+
}, M = "image/jpeg", Te = {
|
|
352
|
+
[u.png]: "image/png",
|
|
353
|
+
[u.jpeg]: M,
|
|
354
|
+
[u.jpg]: M,
|
|
355
|
+
[u.gif]: "image/gif",
|
|
356
|
+
[u.bmp]: "image/bmp",
|
|
357
|
+
[u.webp]: "image/webp",
|
|
358
|
+
[u.pdf]: "application/pdf",
|
|
359
|
+
[u.doc]: "application/msword",
|
|
360
|
+
[u.docx]: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
361
|
+
[u.xls]: "application/vnd.ms-excel",
|
|
362
|
+
[u.xlsx]: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
363
|
+
[u.ppt]: "application/vnd.ms-powerpoint",
|
|
364
|
+
[u.pptx]: "application/vnd.openxmlformats-officedocument.presentationml.presentation",
|
|
365
|
+
[u.txt]: "text/plain",
|
|
366
|
+
[u.md]: "text/markdown",
|
|
367
|
+
[u.csv]: "text/csv",
|
|
368
|
+
[u.json]: "application/json"
|
|
363
369
|
}, be = {
|
|
364
370
|
blob: "blob"
|
|
365
|
-
}, Te = {
|
|
366
|
-
max: 3
|
|
367
371
|
}, Ee = {
|
|
372
|
+
max: 3
|
|
373
|
+
}, Ce = {
|
|
368
374
|
keepAliveExclude: "keep-alive-exclude",
|
|
369
375
|
keepAliveInclude: "keep-alive-include"
|
|
370
|
-
}, Ce = {
|
|
371
|
-
complete: "complete"
|
|
372
376
|
}, ke = {
|
|
373
|
-
|
|
377
|
+
complete: "complete"
|
|
374
378
|
}, Ae = {
|
|
379
|
+
eventStream: "text/event-stream"
|
|
380
|
+
}, Le = {
|
|
375
381
|
horizontal: "horizontal",
|
|
376
382
|
vertical: "vertical"
|
|
377
|
-
},
|
|
383
|
+
}, Ie = {
|
|
378
384
|
left: "left",
|
|
379
385
|
right: "right",
|
|
380
386
|
top: "top"
|
|
@@ -386,7 +392,7 @@ const S = 1, Y = (e = 0.9) => {
|
|
|
386
392
|
verify: "verify",
|
|
387
393
|
efficiency: "efficiency",
|
|
388
394
|
aiAudit: "aiAudit"
|
|
389
|
-
},
|
|
395
|
+
}, Pe = [
|
|
390
396
|
{ label: "服务提升", value: h.serviceUp },
|
|
391
397
|
{ label: "营销转化", value: h.marketing },
|
|
392
398
|
{ label: "诉求预判", value: h.demandPre },
|
|
@@ -403,7 +409,7 @@ const S = 1, Y = (e = 0.9) => {
|
|
|
403
409
|
newsReading: "6",
|
|
404
410
|
marketingEcommerce: "7",
|
|
405
411
|
other: "8"
|
|
406
|
-
},
|
|
412
|
+
}, Be = [
|
|
407
413
|
{
|
|
408
414
|
label: "文本创作",
|
|
409
415
|
value: f.textCreation
|
|
@@ -436,19 +442,19 @@ const S = 1, Y = (e = 0.9) => {
|
|
|
436
442
|
label: "其他",
|
|
437
443
|
value: f.other
|
|
438
444
|
}
|
|
439
|
-
],
|
|
445
|
+
], Me = () => window.$wujie, L = {
|
|
440
446
|
ACCOUNT: "aibox_account",
|
|
441
447
|
logoutTag: "logout"
|
|
442
448
|
};
|
|
443
|
-
function
|
|
444
|
-
for (var
|
|
445
|
-
var
|
|
446
|
-
for (var a in
|
|
447
|
-
e[a] =
|
|
449
|
+
function E(e) {
|
|
450
|
+
for (var o = 1; o < arguments.length; o++) {
|
|
451
|
+
var n = arguments[o];
|
|
452
|
+
for (var a in n)
|
|
453
|
+
e[a] = n[a];
|
|
448
454
|
}
|
|
449
455
|
return e;
|
|
450
456
|
}
|
|
451
|
-
var
|
|
457
|
+
var q = {
|
|
452
458
|
read: function(e) {
|
|
453
459
|
return e[0] === '"' && (e = e.slice(1, -1)), e.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent);
|
|
454
460
|
},
|
|
@@ -459,78 +465,80 @@ var Z = {
|
|
|
459
465
|
);
|
|
460
466
|
}
|
|
461
467
|
};
|
|
462
|
-
function
|
|
463
|
-
function
|
|
468
|
+
function I(e, o) {
|
|
469
|
+
function n(s, l, r) {
|
|
464
470
|
if (!(typeof document > "u")) {
|
|
465
|
-
r =
|
|
466
|
-
var
|
|
467
|
-
for (var
|
|
468
|
-
r[
|
|
469
|
-
return document.cookie =
|
|
471
|
+
r = E({}, o, r), typeof r.expires == "number" && (r.expires = new Date(Date.now() + r.expires * 864e5)), r.expires && (r.expires = r.expires.toUTCString()), s = encodeURIComponent(s).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape);
|
|
472
|
+
var t = "";
|
|
473
|
+
for (var i in r)
|
|
474
|
+
r[i] && (t += "; " + i, r[i] !== !0 && (t += "=" + r[i].split(";")[0]));
|
|
475
|
+
return document.cookie = s + "=" + e.write(l, s) + t;
|
|
470
476
|
}
|
|
471
477
|
}
|
|
472
|
-
function a(
|
|
473
|
-
if (!(typeof document > "u" || arguments.length && !
|
|
474
|
-
for (var
|
|
475
|
-
var
|
|
478
|
+
function a(s) {
|
|
479
|
+
if (!(typeof document > "u" || arguments.length && !s)) {
|
|
480
|
+
for (var l = document.cookie ? document.cookie.split("; ") : [], r = {}, t = 0; t < l.length; t++) {
|
|
481
|
+
var i = l[t].split("="), d = i.slice(1).join("=");
|
|
476
482
|
try {
|
|
477
|
-
var
|
|
478
|
-
if (r[
|
|
483
|
+
var p = decodeURIComponent(i[0]);
|
|
484
|
+
if (r[p] = e.read(d, p), s === p)
|
|
479
485
|
break;
|
|
480
486
|
} catch {
|
|
481
487
|
}
|
|
482
488
|
}
|
|
483
|
-
return
|
|
489
|
+
return s ? r[s] : r;
|
|
484
490
|
}
|
|
485
491
|
}
|
|
486
492
|
return Object.create(
|
|
487
493
|
{
|
|
488
|
-
set:
|
|
494
|
+
set: n,
|
|
489
495
|
get: a,
|
|
490
|
-
remove: function(
|
|
491
|
-
|
|
492
|
-
|
|
496
|
+
remove: function(s, l) {
|
|
497
|
+
n(
|
|
498
|
+
s,
|
|
493
499
|
"",
|
|
494
|
-
|
|
500
|
+
E({}, l, {
|
|
495
501
|
expires: -1
|
|
496
502
|
})
|
|
497
503
|
);
|
|
498
504
|
},
|
|
499
|
-
withAttributes: function(
|
|
500
|
-
return
|
|
505
|
+
withAttributes: function(s) {
|
|
506
|
+
return I(this.converter, E({}, this.attributes, s));
|
|
501
507
|
},
|
|
502
|
-
withConverter: function(
|
|
503
|
-
return
|
|
508
|
+
withConverter: function(s) {
|
|
509
|
+
return I(E({}, this.converter, s), this.attributes);
|
|
504
510
|
}
|
|
505
511
|
},
|
|
506
512
|
{
|
|
507
|
-
attributes: { value: Object.freeze(
|
|
513
|
+
attributes: { value: Object.freeze(o) },
|
|
508
514
|
converter: { value: Object.freeze(e) }
|
|
509
515
|
}
|
|
510
516
|
);
|
|
511
517
|
}
|
|
512
|
-
var
|
|
513
|
-
const
|
|
518
|
+
var C = I(q, { path: "/" });
|
|
519
|
+
const ze = (e = L.logoutTag) => {
|
|
520
|
+
e && window.localStorage.setItem(e, (/* @__PURE__ */ new Date()).getTime());
|
|
521
|
+
}, G = ({ tokenKey: e = "ai-token" } = {}) => ({
|
|
514
522
|
// ========== Token 相关 ==========
|
|
515
523
|
/**
|
|
516
524
|
* 获取 Token
|
|
517
525
|
* @returns {string} Token 值
|
|
518
526
|
*/
|
|
519
527
|
getToken() {
|
|
520
|
-
return
|
|
528
|
+
return C.get(e);
|
|
521
529
|
},
|
|
522
530
|
/**
|
|
523
531
|
* 设置 Token
|
|
524
532
|
* @param {string} value - Token 值
|
|
525
533
|
*/
|
|
526
|
-
setToken(
|
|
527
|
-
|
|
534
|
+
setToken(o) {
|
|
535
|
+
C.set(e, o);
|
|
528
536
|
},
|
|
529
537
|
/**
|
|
530
538
|
* 清除 Token
|
|
531
539
|
*/
|
|
532
540
|
removeToken() {
|
|
533
|
-
return
|
|
541
|
+
return C.remove(e);
|
|
534
542
|
},
|
|
535
543
|
// ========== SessionStorage 相关 ==========
|
|
536
544
|
/**
|
|
@@ -538,29 +546,29 @@ const q = ({ tokenKey: e = "ai-token" } = {}) => ({
|
|
|
538
546
|
* @param {string} key - 键名
|
|
539
547
|
* @param {any} data - 数据
|
|
540
548
|
*/
|
|
541
|
-
setSessionStorage(
|
|
542
|
-
return window.sessionStorage.setItem(
|
|
549
|
+
setSessionStorage(o, n) {
|
|
550
|
+
return window.sessionStorage.setItem(o, JSON.stringify(n));
|
|
543
551
|
},
|
|
544
552
|
/**
|
|
545
553
|
* 获取 SessionStorage
|
|
546
554
|
* @param {string} key - 键名
|
|
547
555
|
* @returns {any} 解析后的数据
|
|
548
556
|
*/
|
|
549
|
-
getSessionStorage(
|
|
550
|
-
const
|
|
551
|
-
if (!
|
|
557
|
+
getSessionStorage(o) {
|
|
558
|
+
const n = window.sessionStorage.getItem(o);
|
|
559
|
+
if (!n) return null;
|
|
552
560
|
try {
|
|
553
|
-
return JSON.parse(
|
|
561
|
+
return JSON.parse(n);
|
|
554
562
|
} catch {
|
|
555
|
-
return
|
|
563
|
+
return n;
|
|
556
564
|
}
|
|
557
565
|
},
|
|
558
566
|
/**
|
|
559
567
|
* 移除指定的 SessionStorage
|
|
560
568
|
* @param {string} key - 键名
|
|
561
569
|
*/
|
|
562
|
-
removeSessionStorageById(
|
|
563
|
-
return window.sessionStorage.removeItem(
|
|
570
|
+
removeSessionStorageById(o) {
|
|
571
|
+
return window.sessionStorage.removeItem(o);
|
|
564
572
|
},
|
|
565
573
|
/**
|
|
566
574
|
* 清除所有 SessionStorage
|
|
@@ -574,29 +582,29 @@ const q = ({ tokenKey: e = "ai-token" } = {}) => ({
|
|
|
574
582
|
* @param {string} key - 键名
|
|
575
583
|
* @param {any} data - 数据
|
|
576
584
|
*/
|
|
577
|
-
setLocalStorage(
|
|
578
|
-
return window.localStorage.setItem(
|
|
585
|
+
setLocalStorage(o, n) {
|
|
586
|
+
return window.localStorage.setItem(o, JSON.stringify(n));
|
|
579
587
|
},
|
|
580
588
|
/**
|
|
581
589
|
* 获取 LocalStorage
|
|
582
590
|
* @param {string} key - 键名
|
|
583
591
|
* @returns {any} 解析后的数据
|
|
584
592
|
*/
|
|
585
|
-
getLocalStorage(
|
|
586
|
-
const
|
|
587
|
-
if (!
|
|
593
|
+
getLocalStorage(o) {
|
|
594
|
+
const n = window.localStorage.getItem(o);
|
|
595
|
+
if (!n) return null;
|
|
588
596
|
try {
|
|
589
|
-
return JSON.parse(
|
|
597
|
+
return JSON.parse(n);
|
|
590
598
|
} catch {
|
|
591
|
-
return
|
|
599
|
+
return n;
|
|
592
600
|
}
|
|
593
601
|
},
|
|
594
602
|
/**
|
|
595
603
|
* 移除指定的 LocalStorage
|
|
596
604
|
* @param {string} key - 键名
|
|
597
605
|
*/
|
|
598
|
-
removeLocalStorageById(
|
|
599
|
-
return window.localStorage.removeItem(
|
|
606
|
+
removeLocalStorageById(o) {
|
|
607
|
+
return window.localStorage.removeItem(o);
|
|
600
608
|
},
|
|
601
609
|
/**
|
|
602
610
|
* 清除所有 LocalStorage
|
|
@@ -605,99 +613,105 @@ const q = ({ tokenKey: e = "ai-token" } = {}) => ({
|
|
|
605
613
|
return window.localStorage.clear();
|
|
606
614
|
},
|
|
607
615
|
//清除token、和sessionStorage、localStorage、除了记住密码
|
|
608
|
-
clearAllStoreStates(
|
|
609
|
-
const a = this.getLocalStorage(
|
|
610
|
-
console.log("清除所有 LocalStorage 保留记住密码", a), this.removeToken(), this.removeSessionStorage(), this.removeLocalStorage(), a && this.setLocalStorage(
|
|
616
|
+
clearAllStoreStates(o = L.logoutTag, n = L.ACCOUNT) {
|
|
617
|
+
const a = this.getLocalStorage(n);
|
|
618
|
+
console.log("清除所有 LocalStorage 保留记住密码", a), this.removeToken(), this.removeSessionStorage(), this.removeLocalStorage(), a && this.setLocalStorage(n, a);
|
|
611
619
|
}
|
|
612
|
-
}),
|
|
620
|
+
}), Re = ({
|
|
613
621
|
getUserInfo: e,
|
|
614
|
-
baseUrl:
|
|
615
|
-
tokenKey:
|
|
622
|
+
baseUrl: o,
|
|
623
|
+
tokenKey: n = "ai-token",
|
|
616
624
|
logoutTag: a,
|
|
617
|
-
accountKey:
|
|
625
|
+
accountKey: s
|
|
618
626
|
} = {}) => {
|
|
619
|
-
let
|
|
620
|
-
const r =
|
|
621
|
-
return (
|
|
622
|
-
if (
|
|
623
|
-
|
|
624
|
-
const
|
|
625
|
-
let
|
|
626
|
-
const m =
|
|
627
|
-
m === "/" ?
|
|
627
|
+
let l = !1;
|
|
628
|
+
const r = G({ tokenKey: n });
|
|
629
|
+
return (t) => {
|
|
630
|
+
if (l || (window.location.pathname || "").includes("login")) return;
|
|
631
|
+
l = !0, r.clearAllStoreStates(a, s);
|
|
632
|
+
const d = e ? e() : null, p = window.location.pathname + window.location.search, g = d?.name || "";
|
|
633
|
+
let c = "";
|
|
634
|
+
const m = o || "/";
|
|
635
|
+
m === "/" ? t ? c = "/login" : c = g ? `/login?fromPath=${p}&userName=${g}` : `/login?fromPath=${p}` : t ? c = `${m}/login` : c = g ? `${m}/login?fromPath=${p}&userName=${encodeURIComponent(g)}` : `${m}/login?fromPath=${p}`, window.location.href = c;
|
|
628
636
|
};
|
|
629
|
-
}
|
|
637
|
+
};
|
|
638
|
+
let v = null;
|
|
639
|
+
const Q = (e = {}) => {
|
|
630
640
|
const {
|
|
631
|
-
message:
|
|
632
|
-
title:
|
|
641
|
+
message: o = "您已退出当前账号,将为您刷新数据!",
|
|
642
|
+
title: n = "提醒",
|
|
633
643
|
confirmButtonText: a = "确定",
|
|
634
|
-
onConfirm:
|
|
635
|
-
showClose:
|
|
644
|
+
onConfirm: s = () => window.location.reload(),
|
|
645
|
+
showClose: l = !1,
|
|
636
646
|
closeOnClickModal: r = !1,
|
|
637
|
-
messageBoxOptions:
|
|
647
|
+
messageBoxOptions: t = {}
|
|
638
648
|
} = e;
|
|
639
|
-
return
|
|
649
|
+
return v && (k.close(), v = null), v = k.alert(o, n, {
|
|
640
650
|
confirmButtonText: a,
|
|
641
|
-
showClose:
|
|
651
|
+
showClose: l,
|
|
642
652
|
closeOnClickModal: r,
|
|
643
|
-
...
|
|
644
|
-
}).then(() => {
|
|
645
|
-
|
|
653
|
+
...t
|
|
654
|
+
}), v.then(() => {
|
|
655
|
+
v = null, s();
|
|
656
|
+
}).catch((i) => {
|
|
657
|
+
if (v = null, !(i === "close" || i === "cancel"))
|
|
658
|
+
return Promise.reject(i);
|
|
646
659
|
});
|
|
647
|
-
},
|
|
660
|
+
}, Oe = (e = {}) => {
|
|
648
661
|
const {
|
|
649
|
-
excludePaths:
|
|
650
|
-
logoutKey:
|
|
662
|
+
excludePaths: o = ["/login"],
|
|
663
|
+
logoutKey: n = "logout",
|
|
651
664
|
notificationOptions: a = {}
|
|
652
|
-
} = e,
|
|
665
|
+
} = e, s = (l) => {
|
|
653
666
|
const r = window.location.pathname;
|
|
654
|
-
|
|
667
|
+
o.some((i) => r.includes(i)) || l.key === n && l.newValue !== null && Q(a);
|
|
655
668
|
};
|
|
656
|
-
return window.addEventListener("storage",
|
|
657
|
-
window.removeEventListener("storage",
|
|
669
|
+
return window.addEventListener("storage", s), () => {
|
|
670
|
+
window.removeEventListener("storage", s);
|
|
658
671
|
};
|
|
659
672
|
};
|
|
660
673
|
export {
|
|
661
|
-
|
|
662
|
-
|
|
674
|
+
L as STORAGE_KEYS,
|
|
675
|
+
Pe as applicationTags,
|
|
663
676
|
h as applicationTagsMap,
|
|
677
|
+
ze as broadcastLogout,
|
|
664
678
|
Y as calculateScale,
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
679
|
+
_ as camelToKebab,
|
|
680
|
+
ge as codeMap,
|
|
681
|
+
fe as componentType,
|
|
682
|
+
Se as cookieKeyMap,
|
|
683
|
+
ie as createConfiguredAxios,
|
|
684
|
+
Re as createLogout,
|
|
685
|
+
ce as createSSERequest,
|
|
686
|
+
G as createStorageUtils,
|
|
687
|
+
he as dateFormat,
|
|
688
|
+
we as dateParamsMap,
|
|
675
689
|
b as dateTypeMap,
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
690
|
+
me as emitsMap,
|
|
691
|
+
Ae as headersAccept,
|
|
692
|
+
Me as isMicroApp,
|
|
679
693
|
V as kebabToCamel,
|
|
680
|
-
|
|
681
|
-
|
|
694
|
+
Ee as keepAliveMap,
|
|
695
|
+
Ie as labelPositionMap,
|
|
682
696
|
pe as messageConfirm,
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
697
|
+
de as messageError,
|
|
698
|
+
le as messageSuccess,
|
|
699
|
+
ue as messageWarning,
|
|
700
|
+
Q as notifyAccountSwitchAndReload,
|
|
701
|
+
ve as operationConfigMap,
|
|
702
|
+
Z as pageParams,
|
|
703
|
+
xe as paginationConfig,
|
|
704
|
+
Be as pluginTags,
|
|
691
705
|
f as pluginTagsMap,
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
706
|
+
Ce as postMessageMap,
|
|
707
|
+
ye as provinceMapping,
|
|
708
|
+
ke as readyState,
|
|
709
|
+
T as recursiveCamelToKebab,
|
|
710
|
+
A as recursiveKebabToCamel,
|
|
697
711
|
be as responseType,
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
712
|
+
Oe as setupCrossTabLogoutListener,
|
|
713
|
+
Le as textDirection,
|
|
714
|
+
u as uploadFileType,
|
|
715
|
+
Te as uploadFileTypeMap,
|
|
716
|
+
se as usePageZoomController
|
|
703
717
|
};
|
package/lib/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("vue"),j=require("axios")
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("vue"),j=require("axios"),$=require("qs"),K=require("js-yaml"),w=require("element-plus"),H=require("@microsoft/fetch-event-source"),b=require("color-message-lingyun-vue"),E=1,B=(e=.9)=>{const o=window.innerWidth,s=window.innerHeight,l=o===1920,r=l?E:o/1920,t=l?E:s/1080,i=Math.min(r,t);return Math.max(e,i)},N=(e={})=>{const{minScale:a=.9,enableZoomPrevention:n=!1}=e,o=g.ref(E),s=()=>{o.value=B(a),document.documentElement.style.setProperty("--app-scale",o.value.toString())},l=c=>{if((c.ctrlKey||c.metaKey)&&(c.key==="+"||c.key==="-"||c.key==="="||c.key==="0")){c.preventDefault();return}if(c.ctrlKey&&c.type==="wheel"){c.preventDefault();return}},r=c=>{c.touches&&c.touches.length>1&&c.preventDefault()},t=c=>{c.preventDefault()},i=g.computed(()=>{const c=o.value!==E;return{transform:`scale(${o.value})`,transformOrigin:"top left",position:c?"fixed":"relative",width:`calc(100% / ${o.value})`,height:`calc(100% / ${o.value})`,...c&&{top:"0",left:"0"}}}),u=g.computed(()=>({"app-container":o.value!==E})),d=()=>{if(typeof document>"u")return;const c="page-zoom-controller-styles";let m=document.getElementById(c);m||(m=document.createElement("style"),m.id=c,m.textContent=`
|
|
2
2
|
.app-container * {
|
|
3
3
|
/* 优化字体渲染,防止缩放时字体模糊 */
|
|
4
4
|
-webkit-font-smoothing: antialiased !important;
|
|
5
5
|
-moz-osx-font-smoothing: grayscale !important;
|
|
6
6
|
text-rendering: optimizeLegibility !important;
|
|
7
7
|
}
|
|
8
|
-
`,document.head.appendChild(m))},f=()=>{if(typeof document>"u")return;const m=document.getElementById("page-zoom-controller-styles");m&&m.remove()};return g.onMounted(()=>{t(),u(),window.addEventListener("resize",t),n&&(window.addEventListener("wheel",s,{passive:!1}),window.addEventListener("keydown",s),window.addEventListener("touchstart",r,{passive:!1}),window.addEventListener("touchmove",r,{passive:!1}),window.addEventListener("gesturestart",c,{passive:!1}),window.addEventListener("gesturechange",c,{passive:!1}),window.addEventListener("gestureend",c,{passive:!1}),document.body.style.touchAction="none")}),g.onUnmounted(()=>{window.removeEventListener("resize",t),f(),n&&(window.removeEventListener("wheel",s),window.removeEventListener("keydown",s),window.removeEventListener("touchstart",r),window.removeEventListener("touchmove",r),window.removeEventListener("gesturestart",c),window.removeEventListener("gesturechange",c),window.removeEventListener("gestureend",c),document.body.style.touchAction==="none"&&(document.body.style.touchAction=""))}),{containerStyles:p,containerClasses:d,scaleValue:o}},B=e=>e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),R=e=>e.replace(/-([a-z])/g,(a,n)=>n.toUpperCase()),S=e=>typeof e!="object"||e===null?e:Array.isArray(e)?e.map(S):Object.keys(e).reduce((a,n)=>{const o=B(n);return n==="dataValue"&&(e.dataType==="object"||e.dataType==="arrayObject")?a[o]=e[n]:a[o]=S(e[n]),a},{}),C=e=>typeof e!="object"||e===null?e:Array.isArray(e)?e.map(C):Object.keys(e).reduce((a,n)=>{const o=R(n);return a[o]=C(e[n]),a},{}),N=({logout:e,axiosConfig:a={}}={})=>{const{language:n}=a,o=j.create({baseURL:"",headers:{"Content-Type":"application/json;","Accept-Language":n},withCredentials:!1,paramsSerializer:t=>U.stringify(t,{indices:!1}),...a});return o.interceptors.request.use(t=>(t.dataType==="formData"&&(t.headers["Content-Type"]="multipart/form-data"),t.dataType==="yaml"&&(t.headers["Content-Type"]="application/yaml",t.headers.Accept="yaml",t.data=$.dump(t.data)),t.cozeToken&&(t.headers.Authorization=`Bearer ${t.cozeToken}`),t.skipCamelToKebab||(t.data=S(t.data),t.params=S(t.params)),t),t=>{Promise.reject(t)}),o.interceptors.response.use(t=>{if(t.request.responseType!=="arraybuffer"&&(t.config.headers.Accept==="json"||t.config.headers.Accept==="application/json, text/plain, */*")){const s=t.config.skipKebabToCamel?t.data:C(t.data);if([21401,20401,21409].includes(s.code)){e?.();return}else s.code&&s.mesg&&w.ElMessage.error(s.mesg);return s}return t},t=>(t.response&&t.response.status?w.ElMessage.error(t.response.data.mesg):navigator.onLine||w.ElMessage.error("网络异常请检查"),t.code==="ECONNABORTED"&&t.message.includes("timeout")&&w.ElMessage({message:"网络请求超时",type:"error",duration:3*1e3}),Promise.reject(t))),o},q=(e,a)=>e&&[21401,20401,21409].includes(e.code)?(a?.(),!0):!1,W=({logout:e}={})=>(a,{method:n="post",signal:o,body:t,successCallback:s,errCallback:r,openCallback:c})=>{const p={method:n,signal:o,headers:{"Content-Type":"application/json"},async onopen(d){const u=d.headers.get("content-type");if(d.status===200&&(!u||!u.includes("text/event-stream"))){const f=await d.json();q(f,e)}c?.(d)},onmessage(d){s?.(d)},onerror(d){throw r?.(d),new Error("请求出错")},openWhenHidden:!0};if(n=="post"){const d=S(t);p.body=JSON.stringify(d)}K.fetchEventSource(a,p)},y={success:"success",error:"error",warning:"warning"},Y={[y.success]:g.markRaw(T.IconBasicSuccess),[y.error]:g.markRaw(T.IconBasicError),[y.warning]:g.markRaw(T.IconBasicWarn)},L=(e,a)=>{w.ElMessage({grouping:!0,duration:5e3,type:a,message:e,offset:66,icon:Y[a]})},F=e=>{L(e,y.success)},V=e=>{L(e,y.error)},_=e=>{L(e,y.warning)},Z=(e={})=>{const a=[];e?.text&&a.push(`<div class="text-202434 fz-14 weight-500">${e?.text}</div>`),e?.subText&&a.push(`<div class="text-74798c fz-12">${e?.subText}</div>`);const n={prompt:"提示",confirmButtonText:"删除",cancelButtonText:"取消",type:"warning",icon:g.markRaw(T.IconBasicWarn),closeIcon:g.markRaw(T.IconClose),confirmButtonClass:"el-button--danger"};return w.ElMessageBox.confirm(a.join(""),e?.prompt||n.prompt,{confirmButtonText:e?.confirmButtonText||n.confirmButtonText,cancelButtonText:e?.cancelButtonText||n.cancelButtonText,type:e?.type||n.type,icon:e?.icon||n.icon,closeIcon:e?.closeIcon||n.closeIcon,dangerouslyUseHTMLString:!0,confirmButtonClass:e?.confirmButtonClass||n.confirmButtonClass}).then(()=>{e?.success?.()}).catch(()=>{e?.error?.()})},J={sendMessage:"sendMessage",stopChat:"stopChat",generationStart:"generationStart",generationComplete:"generationComplete",delete:"delete",change:"change",updateModelValue:"update:modelValue",paginationChange:"pagination-change",operation:"operation",menuSelect:"menuSelect",updateData:"update-data",cancel:"cancel",confirm:"confirm",open:"open",opened:"opened",close:"close",closed:"closed",openAutoFocus:"open-auto-focus",closeAutoFocus:"close-auto-focus",updatePageSize:"update-page-size",updateCurrentPage:"update-current-page",currentChange:"current-change",enter:"enter",visibleChange:"visible-change",click:"click",command:"command",tabChange:"tab-change",uploadSuccess:"upload-success",search:"search",reset:"reset",actionClick:"action-click",sizeChange:"size-change",dataLoaded:"data-loaded",dataError:"data-error",save:"save",updateType:"update:type",updateVisible:"update:visible",updateAllVisible:"update:allVisible",edit:"edit",blur:"blur",focus:"focus"},G={success:"0000",notLogin:401,canceled:"ERR_CANCELED"},z={pageNum:1,pageSize:20},Q={text:"text",select:"select",date:"date",inputNumber:"inputNumber",switch:"switch",radio:"radio",checkbox:"checkbox",textarea:"textarea",upload:"upload"},X={date:"YYYY-MM-DD",dateTime:"YYYY-MM-DD HH:mm:ss"},ee={search:"search",reset:"reset",export:"export",import:"import",add:"add",edit:"edit",delete:"delete",cancel:"cancel",submit:"submit"},x={year:"year",month:"month",date:"date",datetime:"datetime",week:"week",datetimerange:"datetimerange",daterange:"daterange",monthrange:"monthrange",dates:"dates",years:"years",months:"months",yearrange:"yearrange"},te={[x.datetimerange]:{rangeSeparator:"至",startPlaceholder:"开始时间",endPlaceholder:"结束时间"},[x.daterange]:{rangeSeparator:"至",startPlaceholder:"开始日期",endPlaceholder:"结束日期"},[x.monthrange]:{rangeSeparator:"至",startPlaceholder:"开始月份",endPlaceholder:"结束月份"},[x.yearrange]:{rangeSeparator:"至",startPlaceholder:"开始年份",endPlaceholder:"结束年份"}},ae={label:"name",value:"id"},ne={satoken:"satoken"},oe={pageSizes:[z.pageSize,50,100,200],layout:"total, sizes, prev, pager, next, jumper"},l={png:"png",jpeg:"jpeg",jpg:"jpg",gif:"gif",bmp:"bmp",webp:"webp",pdf:"pdf",doc:"doc",docx:"docx",xls:"xls",xlsx:"xlsx",ppt:"ppt",pptx:"pptx",txt:"txt",md:"md",csv:"csv",json:"json"},I="image/jpeg",re={[l.png]:"image/png",[l.jpeg]:I,[l.jpg]:I,[l.gif]:"image/gif",[l.bmp]:"image/bmp",[l.webp]:"image/webp",[l.pdf]:"application/pdf",[l.doc]:"application/msword",[l.docx]:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",[l.xls]:"application/vnd.ms-excel",[l.xlsx]:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",[l.ppt]:"application/vnd.ms-powerpoint",[l.pptx]:"application/vnd.openxmlformats-officedocument.presentationml.presentation",[l.txt]:"text/plain",[l.md]:"text/markdown",[l.csv]:"text/csv",[l.json]:"application/json"},se={blob:"blob"},ie={max:3},ce={keepAliveExclude:"keep-alive-exclude",keepAliveInclude:"keep-alive-include"},le={complete:"complete"},pe={eventStream:"text/event-stream"},de={horizontal:"horizontal",vertical:"vertical"},ue={left:"left",right:"right",top:"top"},v={serviceUp:"serviceUp",marketing:"marketing",demandPre:"demandPre",summary:"summary",verify:"verify",efficiency:"efficiency",aiAudit:"aiAudit"},me=[{label:"服务提升",value:v.serviceUp},{label:"营销转化",value:v.marketing},{label:"诉求预判",value:v.demandPre},{label:"AI稽核",value:v.aiAudit},{label:"归纳总结",value:v.summary},{label:"信息查证",value:v.verify},{label:"效能提升",value:v.efficiency}],h={textCreation:"1",efficiencyTool:"2",mediaEntertainment:"3",officePersonnel:"4",webSearch:"5",newsReading:"6",marketingEcommerce:"7",other:"8"},ge=[{label:"文本创作",value:h.textCreation},{label:"效率工具",value:h.efficiencyTool},{label:"媒体文娱",value:h.mediaEntertainment},{label:"办公人事",value:h.officePersonnel},{label:"网页搜索",value:h.webSearch},{label:"新闻阅读",value:h.newsReading},{label:"营销电商",value:h.marketingEcommerce},{label:"其他",value:h.other}],fe=()=>window.$wujie,M={ACCOUNT:"aibox_account",logoutTag:"logout"};function E(e){for(var a=1;a<arguments.length;a++){var n=arguments[a];for(var o in n)e[o]=n[o]}return e}var he={read:function(e){return e[0]==='"'&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function A(e,a){function n(t,s,r){if(!(typeof document>"u")){r=E({},a,r),typeof r.expires=="number"&&(r.expires=new Date(Date.now()+r.expires*864e5)),r.expires&&(r.expires=r.expires.toUTCString()),t=encodeURIComponent(t).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var c="";for(var p in r)r[p]&&(c+="; "+p,r[p]!==!0&&(c+="="+r[p].split(";")[0]));return document.cookie=t+"="+e.write(s,t)+c}}function o(t){if(!(typeof document>"u"||arguments.length&&!t)){for(var s=document.cookie?document.cookie.split("; "):[],r={},c=0;c<s.length;c++){var p=s[c].split("="),d=p.slice(1).join("=");try{var u=decodeURIComponent(p[0]);if(r[u]=e.read(d,u),t===u)break}catch{}}return t?r[t]:r}}return Object.create({set:n,get:o,remove:function(t,s){n(t,"",E({},s,{expires:-1}))},withAttributes:function(t){return A(this.converter,E({},this.attributes,t))},withConverter:function(t){return A(E({},this.converter,t),this.attributes)}},{attributes:{value:Object.freeze(a)},converter:{value:Object.freeze(e)}})}var k=A(he,{path:"/"});const O=({tokenKey:e="ai-token"}={})=>({getToken(){return k.get(e)},setToken(a){k.set(e,a)},removeToken(){return k.remove(e)},setSessionStorage(a,n){return window.sessionStorage.setItem(a,JSON.stringify(n))},getSessionStorage(a){const n=window.sessionStorage.getItem(a);if(!n)return null;try{return JSON.parse(n)}catch{return n}},removeSessionStorageById(a){return window.sessionStorage.removeItem(a)},removeSessionStorage(){return window.sessionStorage.clear()},setLocalStorage(a,n){return window.localStorage.setItem(a,JSON.stringify(n))},getLocalStorage(a){const n=window.localStorage.getItem(a);if(!n)return null;try{return JSON.parse(n)}catch{return n}},removeLocalStorageById(a){return window.localStorage.removeItem(a)},removeLocalStorage(){return window.localStorage.clear()},clearAllStoreStates(a=M.logoutTag,n=M.ACCOUNT){const o=this.getLocalStorage(n);console.log("清除所有 LocalStorage 保留记住密码",o),this.removeToken(),this.removeSessionStorage(),this.removeLocalStorage(),o&&this.setLocalStorage(n,o),a&&localStorage.setItem(a,new Date().getTime())}}),ve=({getUserInfo:e,baseUrl:a,tokenKey:n="ai-token",logoutTag:o,accountKey:t}={})=>{let s=!1;const r=O({tokenKey:n});return c=>{if(s||(window.location.pathname||"").includes("login"))return;s=!0,r.clearAllStoreStates(o,t);const d=e?e():null,u=window.location.pathname+window.location.search,f=d?.name||"";let i="";const m=a||"/";m==="/"?c?i="/login":i=f?`/login?fromPath=${u}&userName=${f}`:`/login?fromPath=${u}`:c?i=`${m}/login`:i=f?`${m}/login?fromPath=${u}&userName=${encodeURIComponent(f)}`:`${m}/login?fromPath=${u}`,window.location.href=i}},D=(e={})=>{const{message:a="您已退出当前账号,将为您刷新数据!",title:n="提醒",confirmButtonText:o="确定",onConfirm:t=()=>window.location.reload(),showClose:s=!1,closeOnClickModal:r=!1,messageBoxOptions:c={}}=e;return w.ElMessageBox.alert(a,n,{confirmButtonText:o,showClose:s,closeOnClickModal:r,...c}).then(()=>{t()})},we=(e={})=>{const{excludePaths:a=["/login"],logoutKey:n="logout",notificationOptions:o={}}=e,t=s=>{const r=window.location.pathname;a.some(p=>r.includes(p))||s.key===n&&s.newValue!==null&&D(o)};return window.addEventListener("storage",t),()=>{window.removeEventListener("storage",t)}};exports.STORAGE_KEYS=M;exports.applicationTags=me;exports.applicationTagsMap=v;exports.calculateScale=P;exports.camelToKebab=B;exports.codeMap=G;exports.componentType=Q;exports.cookieKeyMap=ne;exports.createConfiguredAxios=N;exports.createLogout=ve;exports.createSSERequest=W;exports.createStorageUtils=O;exports.dateFormat=X;exports.dateParamsMap=te;exports.dateTypeMap=x;exports.emitsMap=J;exports.headersAccept=pe;exports.isMicroApp=fe;exports.kebabToCamel=R;exports.keepAliveMap=ie;exports.labelPositionMap=ue;exports.messageConfirm=Z;exports.messageError=V;exports.messageSuccess=F;exports.messageWarning=_;exports.notifyAccountSwitchAndReload=D;exports.operationConfigMap=ee;exports.pageParams=z;exports.paginationConfig=oe;exports.pluginTags=ge;exports.pluginTagsMap=h;exports.postMessageMap=ce;exports.provinceMapping=ae;exports.readyState=le;exports.recursiveCamelToKebab=S;exports.recursiveKebabToCamel=C;exports.responseType=se;exports.setupCrossTabLogoutListener=we;exports.textDirection=de;exports.uploadFileType=l;exports.uploadFileTypeMap=re;exports.usePageZoomController=H;
|
|
8
|
+
`,document.head.appendChild(m))},f=()=>{if(typeof document>"u")return;const m=document.getElementById("page-zoom-controller-styles");m&&m.remove()};return g.onMounted(()=>{s(),d(),window.addEventListener("resize",s),n&&(window.addEventListener("wheel",l,{passive:!1}),window.addEventListener("keydown",l),window.addEventListener("touchstart",r,{passive:!1}),window.addEventListener("touchmove",r,{passive:!1}),window.addEventListener("gesturestart",t,{passive:!1}),window.addEventListener("gesturechange",t,{passive:!1}),window.addEventListener("gestureend",t,{passive:!1}),document.body.style.touchAction="none")}),g.onUnmounted(()=>{window.removeEventListener("resize",s),f(),n&&(window.removeEventListener("wheel",l),window.removeEventListener("keydown",l),window.removeEventListener("touchstart",r),window.removeEventListener("touchmove",r),window.removeEventListener("gesturestart",t),window.removeEventListener("gesturechange",t),window.removeEventListener("gestureend",t),document.body.style.touchAction==="none"&&(document.body.style.touchAction=""))}),{containerStyles:i,containerClasses:u,scaleValue:o}},R=e=>e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),z=e=>e.replace(/-([a-z])/g,(a,n)=>n.toUpperCase()),T=e=>typeof e!="object"||e===null?e:Array.isArray(e)?e.map(T):Object.keys(e).reduce((a,n)=>{const o=R(n);return n==="dataValue"&&(e.dataType==="object"||e.dataType==="arrayObject")?a[o]=e[n]:a[o]=T(e[n]),a},{}),M=e=>typeof e!="object"||e===null?e:Array.isArray(e)?e.map(M):Object.keys(e).reduce((a,n)=>{const o=z(n);return a[o]=M(e[n]),a},{}),q=({logout:e,axiosConfig:a={},t:n}={})=>{const{language:o}=a,s=n||a?.t,l=(t,i,u)=>{if(typeof s=="function"){const d=s(t,u);return d===t?i:d}return i},r=j.create({baseURL:"",headers:{"Content-Type":"application/json;","Accept-Language":o},withCredentials:!1,paramsSerializer:t=>$.stringify(t,{indices:!1}),...a});return r.interceptors.request.use(t=>(t.dataType==="formData"&&(t.headers["Content-Type"]="multipart/form-data"),t.dataType==="yaml"&&(t.headers["Content-Type"]="application/yaml",t.headers.Accept="yaml",t.data=K.dump(t.data)),t.cozeToken&&(t.headers.Authorization=`Bearer ${t.cozeToken}`),t.skipCamelToKebab||(t.data=T(t.data),t.params=T(t.params)),t),t=>{Promise.reject(t)}),r.interceptors.response.use(t=>{if(t.request.responseType!=="arraybuffer"&&(t.config.headers.Accept==="json"||t.config.headers.Accept==="application/json, text/plain, */*")){const i=t.config.skipKebabToCamel?t.data:M(t.data);if([21401,20401,21409].includes(i.code)){e?.();return}else i.code&&i.mesg&&w.ElMessage.error(i.mesg);return i}return t},t=>(t.response&&t.response.status?w.ElMessage.error(t.response.data.mesg):navigator.onLine||w.ElMessage.error(l("REQUEST.NETWORK_ERROR","网络异常请检查")),t.code==="ECONNABORTED"&&t.message.includes("timeout")&&w.ElMessage({message:l("REQUEST.TIMEOUT","网络请求超时"),type:"error",duration:3*1e3}),Promise.reject(t))),r},W=(e,a)=>e&&[21401,20401,21409].includes(e.code)?(a?.(),!0):!1,Y=({logout:e}={})=>(a,{method:n="post",signal:o,body:s,successCallback:l,errCallback:r,openCallback:t})=>{const i={method:n,signal:o,headers:{"Content-Type":"application/json"},async onopen(u){const d=u.headers.get("content-type");if(u.status===200&&(!d||!d.includes("text/event-stream"))){const f=await u.json();W(f,e)}t?.(u)},onmessage(u){l?.(u)},onerror(u){throw r?.(u),new Error("请求出错")},openWhenHidden:!0};if(n=="post"){const u=T(s);i.body=JSON.stringify(u)}H.fetchEventSource(a,i)},S={success:"success",error:"error",warning:"warning"},F={[S.success]:g.markRaw(b.IconBasicSuccess),[S.error]:g.markRaw(b.IconBasicError),[S.warning]:g.markRaw(b.IconBasicWarn)},P=(e,a)=>{w.ElMessage({grouping:!0,duration:5e3,type:a,message:e,offset:66,icon:F[a]})},_=e=>{P(e,S.success)},V=e=>{P(e,S.error)},Z=e=>{P(e,S.warning)},J=(e={})=>{const a=[];e?.text&&a.push(`<div class="text-202434 fz-14 weight-500">${e?.text}</div>`),e?.subText&&a.push(`<div class="text-74798c fz-12">${e?.subText}</div>`);const n={prompt:"提示",confirmButtonText:"删除",cancelButtonText:"取消",type:"warning",icon:g.markRaw(b.IconBasicWarn),closeIcon:g.markRaw(b.IconClose),confirmButtonClass:"el-button--danger"};return w.ElMessageBox.confirm(a.join(""),e?.prompt||n.prompt,{confirmButtonText:e?.confirmButtonText||n.confirmButtonText,cancelButtonText:e?.cancelButtonText||n.cancelButtonText,type:e?.type||n.type,icon:e?.icon||n.icon,closeIcon:e?.closeIcon||n.closeIcon,dangerouslyUseHTMLString:!0,confirmButtonClass:e?.confirmButtonClass||n.confirmButtonClass}).then(()=>{e?.success?.()}).catch(()=>{e?.error?.()})},G={sendMessage:"sendMessage",stopChat:"stopChat",generationStart:"generationStart",generationComplete:"generationComplete",delete:"delete",change:"change",updateModelValue:"update:modelValue",paginationChange:"pagination-change",operation:"operation",menuSelect:"menuSelect",updateData:"update-data",cancel:"cancel",confirm:"confirm",open:"open",opened:"opened",close:"close",closed:"closed",openAutoFocus:"open-auto-focus",closeAutoFocus:"close-auto-focus",updatePageSize:"update-page-size",updateCurrentPage:"update-current-page",currentChange:"current-change",enter:"enter",visibleChange:"visible-change",click:"click",command:"command",tabChange:"tab-change",uploadSuccess:"upload-success",search:"search",reset:"reset",actionClick:"action-click",sizeChange:"size-change",dataLoaded:"data-loaded",dataError:"data-error",save:"save",updateType:"update:type",updateVisible:"update:visible",updateAllVisible:"update:allVisible",edit:"edit",blur:"blur",focus:"focus"},Q={success:"0000",notLogin:401,canceled:"ERR_CANCELED"},O={pageNum:1,pageSize:20},X={text:"text",select:"select",date:"date",inputNumber:"inputNumber",switch:"switch",radio:"radio",checkbox:"checkbox",textarea:"textarea",upload:"upload"},ee={date:"YYYY-MM-DD",dateTime:"YYYY-MM-DD HH:mm:ss"},te={search:"search",reset:"reset",export:"export",import:"import",add:"add",edit:"edit",delete:"delete",cancel:"cancel",submit:"submit"},x={year:"year",month:"month",date:"date",datetime:"datetime",week:"week",datetimerange:"datetimerange",daterange:"daterange",monthrange:"monthrange",dates:"dates",years:"years",months:"months",yearrange:"yearrange"},ne={[x.datetimerange]:{rangeSeparator:"至",startPlaceholder:"开始时间",endPlaceholder:"结束时间"},[x.daterange]:{rangeSeparator:"至",startPlaceholder:"开始日期",endPlaceholder:"结束日期"},[x.monthrange]:{rangeSeparator:"至",startPlaceholder:"开始月份",endPlaceholder:"结束月份"},[x.yearrange]:{rangeSeparator:"至",startPlaceholder:"开始年份",endPlaceholder:"结束年份"}},ae={label:"name",value:"id"},oe={satoken:"satoken"},re={pageSizes:[O.pageSize,50,100,200],layout:"total, sizes, prev, pager, next, jumper"},p={png:"png",jpeg:"jpeg",jpg:"jpg",gif:"gif",bmp:"bmp",webp:"webp",pdf:"pdf",doc:"doc",docx:"docx",xls:"xls",xlsx:"xlsx",ppt:"ppt",pptx:"pptx",txt:"txt",md:"md",csv:"csv",json:"json"},I="image/jpeg",se={[p.png]:"image/png",[p.jpeg]:I,[p.jpg]:I,[p.gif]:"image/gif",[p.bmp]:"image/bmp",[p.webp]:"image/webp",[p.pdf]:"application/pdf",[p.doc]:"application/msword",[p.docx]:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",[p.xls]:"application/vnd.ms-excel",[p.xlsx]:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",[p.ppt]:"application/vnd.ms-powerpoint",[p.pptx]:"application/vnd.openxmlformats-officedocument.presentationml.presentation",[p.txt]:"text/plain",[p.md]:"text/markdown",[p.csv]:"text/csv",[p.json]:"application/json"},ie={blob:"blob"},ce={max:3},le={keepAliveExclude:"keep-alive-exclude",keepAliveInclude:"keep-alive-include"},ue={complete:"complete"},pe={eventStream:"text/event-stream"},de={horizontal:"horizontal",vertical:"vertical"},me={left:"left",right:"right",top:"top"},v={serviceUp:"serviceUp",marketing:"marketing",demandPre:"demandPre",summary:"summary",verify:"verify",efficiency:"efficiency",aiAudit:"aiAudit"},ge=[{label:"服务提升",value:v.serviceUp},{label:"营销转化",value:v.marketing},{label:"诉求预判",value:v.demandPre},{label:"AI稽核",value:v.aiAudit},{label:"归纳总结",value:v.summary},{label:"信息查证",value:v.verify},{label:"效能提升",value:v.efficiency}],h={textCreation:"1",efficiencyTool:"2",mediaEntertainment:"3",officePersonnel:"4",webSearch:"5",newsReading:"6",marketingEcommerce:"7",other:"8"},fe=[{label:"文本创作",value:h.textCreation},{label:"效率工具",value:h.efficiencyTool},{label:"媒体文娱",value:h.mediaEntertainment},{label:"办公人事",value:h.officePersonnel},{label:"网页搜索",value:h.webSearch},{label:"新闻阅读",value:h.newsReading},{label:"营销电商",value:h.marketingEcommerce},{label:"其他",value:h.other}],he=()=>window.$wujie,k={ACCOUNT:"aibox_account",logoutTag:"logout"};function C(e){for(var a=1;a<arguments.length;a++){var n=arguments[a];for(var o in n)e[o]=n[o]}return e}var ve={read:function(e){return e[0]==='"'&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function L(e,a){function n(s,l,r){if(!(typeof document>"u")){r=C({},a,r),typeof r.expires=="number"&&(r.expires=new Date(Date.now()+r.expires*864e5)),r.expires&&(r.expires=r.expires.toUTCString()),s=encodeURIComponent(s).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var t="";for(var i in r)r[i]&&(t+="; "+i,r[i]!==!0&&(t+="="+r[i].split(";")[0]));return document.cookie=s+"="+e.write(l,s)+t}}function o(s){if(!(typeof document>"u"||arguments.length&&!s)){for(var l=document.cookie?document.cookie.split("; "):[],r={},t=0;t<l.length;t++){var i=l[t].split("="),u=i.slice(1).join("=");try{var d=decodeURIComponent(i[0]);if(r[d]=e.read(u,d),s===d)break}catch{}}return s?r[s]:r}}return Object.create({set:n,get:o,remove:function(s,l){n(s,"",C({},l,{expires:-1}))},withAttributes:function(s){return L(this.converter,C({},this.attributes,s))},withConverter:function(s){return L(C({},this.converter,s),this.attributes)}},{attributes:{value:Object.freeze(a)},converter:{value:Object.freeze(e)}})}var A=L(ve,{path:"/"});const we=(e=k.logoutTag)=>{e&&window.localStorage.setItem(e,new Date().getTime())},D=({tokenKey:e="ai-token"}={})=>({getToken(){return A.get(e)},setToken(a){A.set(e,a)},removeToken(){return A.remove(e)},setSessionStorage(a,n){return window.sessionStorage.setItem(a,JSON.stringify(n))},getSessionStorage(a){const n=window.sessionStorage.getItem(a);if(!n)return null;try{return JSON.parse(n)}catch{return n}},removeSessionStorageById(a){return window.sessionStorage.removeItem(a)},removeSessionStorage(){return window.sessionStorage.clear()},setLocalStorage(a,n){return window.localStorage.setItem(a,JSON.stringify(n))},getLocalStorage(a){const n=window.localStorage.getItem(a);if(!n)return null;try{return JSON.parse(n)}catch{return n}},removeLocalStorageById(a){return window.localStorage.removeItem(a)},removeLocalStorage(){return window.localStorage.clear()},clearAllStoreStates(a=k.logoutTag,n=k.ACCOUNT){const o=this.getLocalStorage(n);console.log("清除所有 LocalStorage 保留记住密码",o),this.removeToken(),this.removeSessionStorage(),this.removeLocalStorage(),o&&this.setLocalStorage(n,o)}}),ye=({getUserInfo:e,baseUrl:a,tokenKey:n="ai-token",logoutTag:o,accountKey:s}={})=>{let l=!1;const r=D({tokenKey:n});return t=>{if(l||(window.location.pathname||"").includes("login"))return;l=!0,r.clearAllStoreStates(o,s);const u=e?e():null,d=window.location.pathname+window.location.search,f=u?.name||"";let c="";const m=a||"/";m==="/"?t?c="/login":c=f?`/login?fromPath=${d}&userName=${f}`:`/login?fromPath=${d}`:t?c=`${m}/login`:c=f?`${m}/login?fromPath=${d}&userName=${encodeURIComponent(f)}`:`${m}/login?fromPath=${d}`,window.location.href=c}};let y=null;const U=(e={})=>{const{message:a="您已退出当前账号,将为您刷新数据!",title:n="提醒",confirmButtonText:o="确定",onConfirm:s=()=>window.location.reload(),showClose:l=!1,closeOnClickModal:r=!1,messageBoxOptions:t={}}=e;return y&&(w.ElMessageBox.close(),y=null),y=w.ElMessageBox.alert(a,n,{confirmButtonText:o,showClose:l,closeOnClickModal:r,...t}),y.then(()=>{y=null,s()}).catch(i=>{if(y=null,!(i==="close"||i==="cancel"))return Promise.reject(i)})},Se=(e={})=>{const{excludePaths:a=["/login"],logoutKey:n="logout",notificationOptions:o={}}=e,s=l=>{const r=window.location.pathname;a.some(i=>r.includes(i))||l.key===n&&l.newValue!==null&&U(o)};return window.addEventListener("storage",s),()=>{window.removeEventListener("storage",s)}};exports.STORAGE_KEYS=k;exports.applicationTags=ge;exports.applicationTagsMap=v;exports.broadcastLogout=we;exports.calculateScale=B;exports.camelToKebab=R;exports.codeMap=Q;exports.componentType=X;exports.cookieKeyMap=oe;exports.createConfiguredAxios=q;exports.createLogout=ye;exports.createSSERequest=Y;exports.createStorageUtils=D;exports.dateFormat=ee;exports.dateParamsMap=ne;exports.dateTypeMap=x;exports.emitsMap=G;exports.headersAccept=pe;exports.isMicroApp=he;exports.kebabToCamel=z;exports.keepAliveMap=ce;exports.labelPositionMap=me;exports.messageConfirm=J;exports.messageError=V;exports.messageSuccess=_;exports.messageWarning=Z;exports.notifyAccountSwitchAndReload=U;exports.operationConfigMap=te;exports.pageParams=O;exports.paginationConfig=re;exports.pluginTags=fe;exports.pluginTagsMap=h;exports.postMessageMap=le;exports.provinceMapping=ae;exports.readyState=ue;exports.recursiveCamelToKebab=T;exports.recursiveKebabToCamel=M;exports.responseType=ie;exports.setupCrossTabLogoutListener=Se;exports.textDirection=de;exports.uploadFileType=p;exports.uploadFileTypeMap=se;exports.usePageZoomController=N;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "color-star-custom-methods",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.29",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"methods",
|
|
6
6
|
"utils",
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
"@vueuse/core": "^14.0.0",
|
|
88
88
|
"crypto-js": "^4.2.0",
|
|
89
89
|
"dayjs": "^1.11.18",
|
|
90
|
-
"element-plus": "^2.13.
|
|
90
|
+
"element-plus": "^2.13.5",
|
|
91
91
|
"element-tree-line": "^0.2.1",
|
|
92
92
|
"js-cookie": "^3.0.5",
|
|
93
93
|
"lodash.debounce": "^4.0.8",
|
|
@@ -104,7 +104,7 @@
|
|
|
104
104
|
},
|
|
105
105
|
"peerDependencies": {
|
|
106
106
|
"axios": "^1.8.2",
|
|
107
|
-
"vue": "^3.5.
|
|
107
|
+
"vue": "^3.5.27",
|
|
108
108
|
"color-message-lingyun-vue": "0.0.30"
|
|
109
109
|
},
|
|
110
110
|
"optionalDependencies": {
|