color-star-custom-methods 0.0.6 → 0.0.10
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.md +0 -2
- package/es/index.mjs +406 -104
- package/lib/index.js +2 -2
- package/package.json +3 -3
package/README.md
CHANGED
package/es/index.mjs
CHANGED
|
@@ -1,161 +1,463 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { ElMessage as
|
|
6
|
-
import { fetchEventSource as
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import { ref as C, computed as k, onMounted as B, onUnmounted as L, markRaw as y } from "vue";
|
|
2
|
+
import z from "axios";
|
|
3
|
+
import I from "qs";
|
|
4
|
+
import P from "js-yaml";
|
|
5
|
+
import { ElMessage as v, ElMessageBox as D } from "element-plus";
|
|
6
|
+
import { fetchEventSource as j } from "@microsoft/fetch-event-source";
|
|
7
|
+
import { IconClose as H, IconBasicWarn as M, IconBasicError as K, IconBasicSuccess as R } from "color-message-lingyun-vue";
|
|
8
|
+
const g = 1, W = (e = 0.9) => {
|
|
9
|
+
const t = window.innerWidth, c = window.innerHeight, l = t === 1920, p = l ? g : t / 1920, i = l ? g : c / 1080, h = Math.min(p, i), r = Math.max(e, h);
|
|
10
|
+
return r >= g ? g : r;
|
|
11
|
+
}, Q = (e = {}) => {
|
|
12
|
+
const { minScale: n = 0.9, enableZoomPrevention: a = !1 } = e, t = C(g), c = () => {
|
|
13
|
+
t.value = W(n), document.documentElement.style.setProperty(
|
|
13
14
|
"--app-scale",
|
|
14
|
-
|
|
15
|
+
t.value.toString()
|
|
15
16
|
);
|
|
16
|
-
},
|
|
17
|
-
if ((
|
|
18
|
-
|
|
17
|
+
}, l = (o) => {
|
|
18
|
+
if ((o.ctrlKey || o.metaKey) && (o.key === "+" || o.key === "-" || o.key === "=" || o.key === "0")) {
|
|
19
|
+
o.preventDefault();
|
|
19
20
|
return;
|
|
20
21
|
}
|
|
21
|
-
if (
|
|
22
|
-
|
|
22
|
+
if (o.ctrlKey && o.type === "wheel") {
|
|
23
|
+
o.preventDefault();
|
|
23
24
|
return;
|
|
24
25
|
}
|
|
25
|
-
},
|
|
26
|
-
|
|
27
|
-
}, i = (
|
|
28
|
-
|
|
29
|
-
},
|
|
30
|
-
const
|
|
26
|
+
}, p = (o) => {
|
|
27
|
+
o.touches && o.touches.length > 1 && o.preventDefault();
|
|
28
|
+
}, i = (o) => {
|
|
29
|
+
o.preventDefault();
|
|
30
|
+
}, h = k(() => {
|
|
31
|
+
const o = t.value !== g;
|
|
31
32
|
return {
|
|
32
|
-
transform: `scale(${
|
|
33
|
+
transform: `scale(${t.value})`,
|
|
33
34
|
transformOrigin: "top left",
|
|
34
|
-
position:
|
|
35
|
-
width: `calc(100% / ${
|
|
36
|
-
height: `calc(100% / ${
|
|
37
|
-
...
|
|
35
|
+
position: o ? "fixed" : "relative",
|
|
36
|
+
width: `calc(100% / ${t.value})`,
|
|
37
|
+
height: `calc(100% / ${t.value})`,
|
|
38
|
+
...o && {
|
|
38
39
|
top: "0",
|
|
39
40
|
left: "0"
|
|
40
41
|
}
|
|
41
42
|
};
|
|
42
|
-
}),
|
|
43
|
-
"app-container":
|
|
44
|
-
})),
|
|
43
|
+
}), r = k(() => ({
|
|
44
|
+
"app-container": t.value !== g
|
|
45
|
+
})), x = () => {
|
|
45
46
|
if (typeof document > "u") return;
|
|
46
|
-
const
|
|
47
|
-
let
|
|
48
|
-
|
|
47
|
+
const o = "page-zoom-controller-styles";
|
|
48
|
+
let d = document.getElementById(o);
|
|
49
|
+
d || (d = document.createElement("style"), d.id = o, d.textContent = `
|
|
49
50
|
.app-container * {
|
|
50
51
|
/* 优化字体渲染,防止缩放时字体模糊 */
|
|
51
52
|
-webkit-font-smoothing: antialiased !important;
|
|
52
53
|
-moz-osx-font-smoothing: grayscale !important;
|
|
53
54
|
text-rendering: optimizeLegibility !important;
|
|
54
55
|
}
|
|
55
|
-
`, document.head.appendChild(
|
|
56
|
-
},
|
|
56
|
+
`, document.head.appendChild(d));
|
|
57
|
+
}, T = () => {
|
|
57
58
|
if (typeof document > "u") return;
|
|
58
|
-
const
|
|
59
|
-
|
|
59
|
+
const d = document.getElementById("page-zoom-controller-styles");
|
|
60
|
+
d && d.remove();
|
|
60
61
|
};
|
|
61
|
-
return
|
|
62
|
-
|
|
62
|
+
return B(() => {
|
|
63
|
+
c(), x(), window.addEventListener("resize", c), a && (window.addEventListener("wheel", l, { passive: !1 }), window.addEventListener("keydown", l), window.addEventListener("touchstart", p, {
|
|
63
64
|
passive: !1
|
|
64
|
-
}), window.addEventListener("touchmove",
|
|
65
|
+
}), window.addEventListener("touchmove", p, { passive: !1 }), window.addEventListener("gesturestart", i, {
|
|
65
66
|
passive: !1
|
|
66
67
|
}), window.addEventListener("gesturechange", i, {
|
|
67
68
|
passive: !1
|
|
68
69
|
}), window.addEventListener("gestureend", i, {
|
|
69
70
|
passive: !1
|
|
70
71
|
}), document.body.style.touchAction = "none");
|
|
71
|
-
}),
|
|
72
|
-
window.removeEventListener("resize",
|
|
72
|
+
}), L(() => {
|
|
73
|
+
window.removeEventListener("resize", c), T(), a && (window.removeEventListener("wheel", l), window.removeEventListener("keydown", l), window.removeEventListener("touchstart", p), window.removeEventListener("touchmove", p), window.removeEventListener("gesturestart", i), window.removeEventListener("gesturechange", i), window.removeEventListener("gestureend", i), document.body.style.touchAction === "none" && (document.body.style.touchAction = ""));
|
|
73
74
|
}), {
|
|
74
|
-
containerStyles:
|
|
75
|
-
containerClasses:
|
|
75
|
+
containerStyles: h,
|
|
76
|
+
containerClasses: r
|
|
76
77
|
};
|
|
77
|
-
},
|
|
78
|
-
const
|
|
79
|
-
return
|
|
80
|
-
}, {}),
|
|
81
|
-
const
|
|
82
|
-
return
|
|
83
|
-
}, {}),
|
|
84
|
-
logout:
|
|
85
|
-
axiosConfig:
|
|
78
|
+
}, Y = (e) => e.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase(), $ = (e) => e.replace(/-([a-z])/g, (n, a) => a.toUpperCase()), w = (e) => typeof e != "object" || e === null ? e : Array.isArray(e) ? e.map(w) : Object.keys(e).reduce((n, a) => {
|
|
79
|
+
const t = Y(a);
|
|
80
|
+
return a === "dataValue" && (e.dataType === "object" || e.dataType === "arrayObject") ? n[t] = e[a] : n[t] = w(e[a]), n;
|
|
81
|
+
}, {}), E = (e) => typeof e != "object" || e === null ? e : Array.isArray(e) ? e.map(E) : Object.keys(e).reduce((n, a) => {
|
|
82
|
+
const t = $(a);
|
|
83
|
+
return n[t] = E(e[a]), n;
|
|
84
|
+
}, {}), X = ({
|
|
85
|
+
logout: e,
|
|
86
|
+
axiosConfig: n = {}
|
|
86
87
|
} = {}) => {
|
|
87
|
-
const
|
|
88
|
+
const a = z.create({
|
|
88
89
|
baseURL: "",
|
|
89
90
|
headers: {
|
|
90
91
|
"Content-Type": "application/json;"
|
|
91
92
|
},
|
|
92
93
|
withCredentials: !1,
|
|
93
|
-
paramsSerializer: (
|
|
94
|
-
...
|
|
94
|
+
paramsSerializer: (t) => I.stringify(t, { indices: !1 }),
|
|
95
|
+
...n
|
|
95
96
|
});
|
|
96
|
-
return
|
|
97
|
-
(
|
|
98
|
-
(
|
|
99
|
-
Promise.reject(
|
|
97
|
+
return a.interceptors.request.use(
|
|
98
|
+
(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 = P.dump(t.data)), t.cozeToken && (t.headers.Authorization = `Bearer ${t.cozeToken}`), t.skipCamelToKebab || (t.data = w(t.data), t.params = w(t.params)), t),
|
|
99
|
+
(t) => {
|
|
100
|
+
Promise.reject(t);
|
|
100
101
|
}
|
|
101
|
-
),
|
|
102
|
-
(
|
|
103
|
-
if (
|
|
104
|
-
const
|
|
105
|
-
if ([21401, 20401, 21409].includes(
|
|
106
|
-
|
|
102
|
+
), a.interceptors.response.use(
|
|
103
|
+
(t) => {
|
|
104
|
+
if (t.request.responseType !== "arraybuffer" && (t.config.headers.Accept === "json" || t.config.headers.Accept === "application/json, text/plain, */*")) {
|
|
105
|
+
const c = t.config.skipKebabToCamel ? t.data : E(t.data);
|
|
106
|
+
if ([21401, 20401, 21409].includes(c.code)) {
|
|
107
|
+
e && e();
|
|
107
108
|
return;
|
|
108
109
|
} else
|
|
109
|
-
|
|
110
|
-
return
|
|
110
|
+
c.code && c.mesg && v.error(c.mesg);
|
|
111
|
+
return c;
|
|
111
112
|
}
|
|
112
|
-
return
|
|
113
|
+
return t;
|
|
113
114
|
},
|
|
114
|
-
(
|
|
115
|
+
(t) => (t.response && t.response.status ? v.error(t.response.data.mesg || "系统异常,请稍后再试") : navigator.onLine || v.error("网络异常请检查"), t.code === "ECONNABORTED" && t.message.includes("timeout") && v({
|
|
115
116
|
message: "网络请求超时",
|
|
116
117
|
type: "error",
|
|
117
118
|
duration: 3 * 1e3
|
|
118
|
-
}), Promise.reject(
|
|
119
|
-
),
|
|
120
|
-
},
|
|
121
|
-
logout:
|
|
122
|
-
} = {}) => (
|
|
123
|
-
const
|
|
124
|
-
method:
|
|
125
|
-
signal:
|
|
119
|
+
}), Promise.reject(t))
|
|
120
|
+
), a;
|
|
121
|
+
}, N = (e, n) => e && [21401, 20401, 21409].includes(e.code) ? (n && n(), !0) : !1, ee = ({
|
|
122
|
+
logout: e
|
|
123
|
+
} = {}) => (n, { method: a = "post", signal: t, body: c, successCallback: l, errCallback: p, openCallback: i }) => {
|
|
124
|
+
const h = {
|
|
125
|
+
method: a,
|
|
126
|
+
signal: t,
|
|
126
127
|
headers: {
|
|
127
128
|
"Content-Type": "application/json"
|
|
128
129
|
},
|
|
129
|
-
async onopen(
|
|
130
|
-
const
|
|
131
|
-
if (
|
|
132
|
-
const
|
|
133
|
-
|
|
130
|
+
async onopen(r) {
|
|
131
|
+
const x = r.headers.get("content-type");
|
|
132
|
+
if (r.status === 200 && (!x || !x.includes("text/event-stream"))) {
|
|
133
|
+
const T = await r.json();
|
|
134
|
+
N(T, e);
|
|
134
135
|
}
|
|
135
|
-
i && i(
|
|
136
|
+
i && i(r);
|
|
136
137
|
},
|
|
137
|
-
onmessage(
|
|
138
|
-
|
|
138
|
+
onmessage(r) {
|
|
139
|
+
l && l(r);
|
|
139
140
|
},
|
|
140
|
-
onerror(
|
|
141
|
-
throw
|
|
141
|
+
onerror(r) {
|
|
142
|
+
throw p && p(r), new Error("请求出错");
|
|
142
143
|
},
|
|
143
144
|
openWhenHidden: !0
|
|
144
145
|
};
|
|
145
|
-
if (
|
|
146
|
-
const
|
|
147
|
-
|
|
146
|
+
if (a == "post") {
|
|
147
|
+
const r = w(c);
|
|
148
|
+
h.body = JSON.stringify(r);
|
|
148
149
|
}
|
|
149
|
-
|
|
150
|
-
}
|
|
150
|
+
j(n, h);
|
|
151
|
+
}, f = {
|
|
152
|
+
success: "success",
|
|
153
|
+
error: "error",
|
|
154
|
+
warning: "warning"
|
|
155
|
+
}, O = {
|
|
156
|
+
[f.success]: y(R),
|
|
157
|
+
[f.error]: y(K),
|
|
158
|
+
[f.warning]: y(M)
|
|
159
|
+
}, S = (e, n) => {
|
|
160
|
+
v({
|
|
161
|
+
grouping: !0,
|
|
162
|
+
duration: 5e3,
|
|
163
|
+
type: n,
|
|
164
|
+
message: e,
|
|
165
|
+
offset: 66,
|
|
166
|
+
icon: O[n]
|
|
167
|
+
});
|
|
168
|
+
}, te = (e) => {
|
|
169
|
+
S(e, f.success);
|
|
170
|
+
}, ae = (e) => {
|
|
171
|
+
S(e, f.error);
|
|
172
|
+
}, ne = (e) => {
|
|
173
|
+
S(e, f.warning);
|
|
174
|
+
}, oe = (e = {}) => {
|
|
175
|
+
const n = [];
|
|
176
|
+
e?.text && n.push(
|
|
177
|
+
`<div class="text-202434 fz-14 weight-500">${e?.text}</div>`
|
|
178
|
+
), e?.subText && n.push(
|
|
179
|
+
`<div class="text-74798c fz-12">${e?.subText}</div>`
|
|
180
|
+
);
|
|
181
|
+
const a = {
|
|
182
|
+
prompt: "提示",
|
|
183
|
+
confirmButtonText: "删除",
|
|
184
|
+
cancelButtonText: "取消",
|
|
185
|
+
type: "warning",
|
|
186
|
+
icon: y(M),
|
|
187
|
+
closeIcon: y(H),
|
|
188
|
+
confirmButtonClass: "el-button--danger"
|
|
189
|
+
};
|
|
190
|
+
return D.confirm(
|
|
191
|
+
n.join(""),
|
|
192
|
+
e?.prompt || a.prompt,
|
|
193
|
+
{
|
|
194
|
+
confirmButtonText: e?.confirmButtonText || a.confirmButtonText,
|
|
195
|
+
cancelButtonText: e?.cancelButtonText || a.cancelButtonText,
|
|
196
|
+
type: e?.type || a.type,
|
|
197
|
+
icon: e?.icon || a.icon,
|
|
198
|
+
closeIcon: e?.closeIcon || a.closeIcon,
|
|
199
|
+
dangerouslyUseHTMLString: !0,
|
|
200
|
+
confirmButtonClass: e?.confirmButtonClass || a.confirmButtonClass
|
|
201
|
+
}
|
|
202
|
+
).then(() => {
|
|
203
|
+
e?.success?.();
|
|
204
|
+
}).catch(() => {
|
|
205
|
+
e?.error?.();
|
|
206
|
+
});
|
|
207
|
+
}, se = {
|
|
208
|
+
sendMessage: "sendMessage",
|
|
209
|
+
stopChat: "stopChat",
|
|
210
|
+
generationStart: "generationStart",
|
|
211
|
+
generationComplete: "generationComplete",
|
|
212
|
+
delete: "delete",
|
|
213
|
+
change: "change",
|
|
214
|
+
updateModelValue: "update:modelValue",
|
|
215
|
+
paginationChange: "pagination-change",
|
|
216
|
+
operation: "operation",
|
|
217
|
+
menuSelect: "menuSelect",
|
|
218
|
+
updateData: "update-data",
|
|
219
|
+
cancel: "cancel",
|
|
220
|
+
confirm: "confirm",
|
|
221
|
+
open: "open",
|
|
222
|
+
opened: "opened",
|
|
223
|
+
close: "close",
|
|
224
|
+
closed: "closed",
|
|
225
|
+
openAutoFocus: "open-auto-focus",
|
|
226
|
+
closeAutoFocus: "close-auto-focus",
|
|
227
|
+
updatePageSize: "update-page-size",
|
|
228
|
+
updateCurrentPage: "update-current-page",
|
|
229
|
+
sizeChange: "size-change",
|
|
230
|
+
currentChange: "current-change",
|
|
231
|
+
enter: "enter",
|
|
232
|
+
visibleChange: "visible-change",
|
|
233
|
+
click: "click",
|
|
234
|
+
command: "command",
|
|
235
|
+
tabChange: "tab-change",
|
|
236
|
+
uploadSuccess: "upload-success"
|
|
237
|
+
}, re = {
|
|
238
|
+
success: "0000",
|
|
239
|
+
// 成功
|
|
240
|
+
notLogin: 401,
|
|
241
|
+
// 未登录
|
|
242
|
+
canceled: "ERR_CANCELED"
|
|
243
|
+
}, U = {
|
|
244
|
+
pageNum: 1,
|
|
245
|
+
pageSize: 20
|
|
246
|
+
}, ce = {
|
|
247
|
+
text: "text",
|
|
248
|
+
select: "select",
|
|
249
|
+
date: "date",
|
|
250
|
+
inputNumber: "inputNumber",
|
|
251
|
+
switch: "switch",
|
|
252
|
+
radio: "radio",
|
|
253
|
+
checkbox: "checkbox",
|
|
254
|
+
textarea: "textarea",
|
|
255
|
+
upload: "upload"
|
|
256
|
+
}, ie = {
|
|
257
|
+
date: "YYYY-MM-DD",
|
|
258
|
+
dateTime: "YYYY-MM-DD HH:mm:ss"
|
|
259
|
+
}, le = {
|
|
260
|
+
search: "search",
|
|
261
|
+
reset: "reset",
|
|
262
|
+
export: "export",
|
|
263
|
+
import: "import",
|
|
264
|
+
add: "add",
|
|
265
|
+
edit: "edit",
|
|
266
|
+
delete: "delete",
|
|
267
|
+
cancel: "cancel",
|
|
268
|
+
submit: "submit"
|
|
269
|
+
}, b = {
|
|
270
|
+
year: "year",
|
|
271
|
+
month: "month",
|
|
272
|
+
date: "date",
|
|
273
|
+
datetime: "datetime",
|
|
274
|
+
week: "week",
|
|
275
|
+
datetimerange: "datetimerange",
|
|
276
|
+
daterange: "daterange",
|
|
277
|
+
monthrange: "monthrange",
|
|
278
|
+
dates: "dates",
|
|
279
|
+
years: "years",
|
|
280
|
+
months: "months",
|
|
281
|
+
yearrange: "yearrange"
|
|
282
|
+
}, pe = {
|
|
283
|
+
[b.datetimerange]: {
|
|
284
|
+
rangeSeparator: "至",
|
|
285
|
+
startPlaceholder: "开始时间",
|
|
286
|
+
endPlaceholder: "结束时间"
|
|
287
|
+
},
|
|
288
|
+
[b.daterange]: {
|
|
289
|
+
rangeSeparator: "至",
|
|
290
|
+
startPlaceholder: "开始日期",
|
|
291
|
+
endPlaceholder: "结束日期"
|
|
292
|
+
},
|
|
293
|
+
[b.monthrange]: {
|
|
294
|
+
rangeSeparator: "至",
|
|
295
|
+
startPlaceholder: "开始月份",
|
|
296
|
+
endPlaceholder: "结束月份"
|
|
297
|
+
},
|
|
298
|
+
[b.yearrange]: {
|
|
299
|
+
rangeSeparator: "至",
|
|
300
|
+
startPlaceholder: "开始年份",
|
|
301
|
+
endPlaceholder: "结束年份"
|
|
302
|
+
}
|
|
303
|
+
}, de = {
|
|
304
|
+
label: "name",
|
|
305
|
+
value: "id"
|
|
306
|
+
}, ue = {
|
|
307
|
+
satoken: "satoken"
|
|
308
|
+
}, me = {
|
|
309
|
+
pageSizes: [U.pageSize, 50, 100, 200],
|
|
310
|
+
layout: "total, sizes, prev, pager, next, jumper"
|
|
311
|
+
}, s = {
|
|
312
|
+
png: "png",
|
|
313
|
+
jpeg: "jpeg",
|
|
314
|
+
jpg: "jpg",
|
|
315
|
+
gif: "gif",
|
|
316
|
+
bmp: "bmp",
|
|
317
|
+
webp: "webp",
|
|
318
|
+
pdf: "pdf",
|
|
319
|
+
doc: "doc",
|
|
320
|
+
docx: "docx",
|
|
321
|
+
xls: "xls",
|
|
322
|
+
xlsx: "xlsx",
|
|
323
|
+
ppt: "ppt",
|
|
324
|
+
pptx: "pptx",
|
|
325
|
+
txt: "txt",
|
|
326
|
+
md: "md",
|
|
327
|
+
csv: "csv",
|
|
328
|
+
json: "json"
|
|
329
|
+
}, A = "image/jpeg", ge = {
|
|
330
|
+
[s.png]: "image/png",
|
|
331
|
+
[s.jpeg]: A,
|
|
332
|
+
[s.jpg]: A,
|
|
333
|
+
[s.gif]: "image/gif",
|
|
334
|
+
[s.bmp]: "image/bmp",
|
|
335
|
+
[s.webp]: "image/webp",
|
|
336
|
+
[s.pdf]: "application/pdf",
|
|
337
|
+
[s.doc]: "application/msword",
|
|
338
|
+
[s.docx]: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
339
|
+
[s.xls]: "application/vnd.ms-excel",
|
|
340
|
+
[s.xlsx]: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
341
|
+
[s.ppt]: "application/vnd.ms-powerpoint",
|
|
342
|
+
[s.pptx]: "application/vnd.openxmlformats-officedocument.presentationml.presentation",
|
|
343
|
+
[s.txt]: "text/plain",
|
|
344
|
+
[s.md]: "text/markdown",
|
|
345
|
+
[s.csv]: "text/csv",
|
|
346
|
+
[s.json]: "application/json"
|
|
347
|
+
}, he = {
|
|
348
|
+
blob: "blob"
|
|
349
|
+
}, fe = {
|
|
350
|
+
max: 3
|
|
351
|
+
}, ve = {
|
|
352
|
+
keepAliveExclude: "keep-alive-exclude",
|
|
353
|
+
keepAliveInclude: "keep-alive-include"
|
|
354
|
+
}, ye = {
|
|
355
|
+
complete: "complete"
|
|
356
|
+
}, we = {
|
|
357
|
+
eventStream: "text/event-stream"
|
|
358
|
+
}, xe = {
|
|
359
|
+
horizontal: "horizontal",
|
|
360
|
+
vertical: "vertical"
|
|
361
|
+
}, be = {
|
|
362
|
+
left: "left",
|
|
363
|
+
right: "right",
|
|
364
|
+
top: "top"
|
|
365
|
+
}, m = {
|
|
366
|
+
serviceUp: "serviceUp",
|
|
367
|
+
marketing: "marketing",
|
|
368
|
+
demandPre: "demandPre",
|
|
369
|
+
summary: "summary",
|
|
370
|
+
verify: "verify",
|
|
371
|
+
efficiency: "efficiency",
|
|
372
|
+
aiAudit: "aiAudit"
|
|
373
|
+
}, Te = [
|
|
374
|
+
{ label: "服务提升", value: m.serviceUp },
|
|
375
|
+
{ label: "营销转化", value: m.marketing },
|
|
376
|
+
{ label: "诉求预判", value: m.demandPre },
|
|
377
|
+
{ label: "AI稽核", value: m.aiAudit },
|
|
378
|
+
{ label: "归纳总结", value: m.summary },
|
|
379
|
+
{ label: "信息查证", value: m.verify },
|
|
380
|
+
{ label: "效能提升", value: m.efficiency }
|
|
381
|
+
], u = {
|
|
382
|
+
textCreation: "1",
|
|
383
|
+
efficiencyTool: "2",
|
|
384
|
+
mediaEntertainment: "3",
|
|
385
|
+
officePersonnel: "4",
|
|
386
|
+
webSearch: "5",
|
|
387
|
+
newsReading: "6",
|
|
388
|
+
marketingEcommerce: "7",
|
|
389
|
+
other: "8"
|
|
390
|
+
}, Ee = [
|
|
391
|
+
{
|
|
392
|
+
label: "文本创作",
|
|
393
|
+
value: u.textCreation
|
|
394
|
+
},
|
|
395
|
+
{
|
|
396
|
+
label: "效率工具",
|
|
397
|
+
value: u.efficiencyTool
|
|
398
|
+
},
|
|
399
|
+
{
|
|
400
|
+
label: "媒体文娱",
|
|
401
|
+
value: u.mediaEntertainment
|
|
402
|
+
},
|
|
403
|
+
{
|
|
404
|
+
label: "办公人事",
|
|
405
|
+
value: u.officePersonnel
|
|
406
|
+
},
|
|
407
|
+
{
|
|
408
|
+
label: "网页搜索",
|
|
409
|
+
value: u.webSearch
|
|
410
|
+
},
|
|
411
|
+
{
|
|
412
|
+
label: "新闻阅读",
|
|
413
|
+
value: u.newsReading
|
|
414
|
+
},
|
|
415
|
+
{
|
|
416
|
+
label: "营销电商",
|
|
417
|
+
value: u.marketingEcommerce
|
|
418
|
+
},
|
|
419
|
+
{
|
|
420
|
+
label: "其他",
|
|
421
|
+
value: u.other
|
|
422
|
+
}
|
|
423
|
+
], Se = () => window.$wujie;
|
|
151
424
|
export {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
425
|
+
Te as applicationTags,
|
|
426
|
+
m as applicationTagsMap,
|
|
427
|
+
W as calculateScale,
|
|
428
|
+
Y as camelToKebab,
|
|
429
|
+
re as codeMap,
|
|
430
|
+
ce as componentType,
|
|
431
|
+
ue as cookieKeyMap,
|
|
432
|
+
X as createConfiguredAxios,
|
|
433
|
+
ee as createSSERequest,
|
|
434
|
+
ie as dateFormat,
|
|
435
|
+
pe as dateParamsMap,
|
|
436
|
+
b as dateTypeMap,
|
|
437
|
+
se as emitsMap,
|
|
438
|
+
N as handleInvalidToken,
|
|
439
|
+
we as headersAccept,
|
|
440
|
+
Se as isMicroApp,
|
|
441
|
+
$ as kebabToCamel,
|
|
442
|
+
fe as keepAliveMap,
|
|
443
|
+
be as labelPositionMap,
|
|
444
|
+
oe as messageConfirm,
|
|
445
|
+
ae as messageError,
|
|
446
|
+
te as messageSuccess,
|
|
447
|
+
ne as messageWarning,
|
|
448
|
+
le as operationConfigMap,
|
|
449
|
+
U as pageParams,
|
|
450
|
+
me as paginationConfig,
|
|
451
|
+
Ee as pluginTags,
|
|
452
|
+
u as pluginTagsMap,
|
|
453
|
+
ve as postMessageMap,
|
|
454
|
+
de as provinceMapping,
|
|
455
|
+
ye as readyState,
|
|
456
|
+
w as recursiveCamelToKebab,
|
|
457
|
+
E as recursiveKebabToCamel,
|
|
458
|
+
he as responseType,
|
|
459
|
+
xe as textDirection,
|
|
460
|
+
s as uploadFileType,
|
|
461
|
+
ge as uploadFileTypeMap,
|
|
462
|
+
Q as usePageZoomController
|
|
161
463
|
};
|
package/lib/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("vue"),I=require("axios"),z=require("qs"),D=require("js-yaml"),h=require("element-plus"),R=require("@microsoft/fetch-event-source"),x=require("color-message-lingyun-vue"),y=1,C=(e=.9)=>{const t=window.innerWidth,c=window.innerHeight,l=t===1920,d=l?y:t/1920,i=l?y:c/1080,v=Math.min(d,i),r=Math.max(e,v);return r>=y?y:r},K=(e={})=>{const{minScale:n=.9,enableZoomPrevention:a=!1}=e,t=p.ref(y),c=()=>{t.value=C(n),document.documentElement.style.setProperty("--app-scale",t.value.toString())},l=o=>{if((o.ctrlKey||o.metaKey)&&(o.key==="+"||o.key==="-"||o.key==="="||o.key==="0")){o.preventDefault();return}if(o.ctrlKey&&o.type==="wheel"){o.preventDefault();return}},d=o=>{o.touches&&o.touches.length>1&&o.preventDefault()},i=o=>{o.preventDefault()},v=p.computed(()=>{const o=t.value!==y;return{transform:`scale(${t.value})`,transformOrigin:"top left",position:o?"fixed":"relative",width:`calc(100% / ${t.value})`,height:`calc(100% / ${t.value})`,...o&&{top:"0",left:"0"}}}),r=p.computed(()=>({"app-container":t.value!==y})),T=()=>{if(typeof document>"u")return;const o="page-zoom-controller-styles";let m=document.getElementById(o);m||(m=document.createElement("style"),m.id=o,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(
|
|
8
|
+
`,document.head.appendChild(m))},M=()=>{if(typeof document>"u")return;const m=document.getElementById("page-zoom-controller-styles");m&&m.remove()};return p.onMounted(()=>{c(),T(),window.addEventListener("resize",c),a&&(window.addEventListener("wheel",l,{passive:!1}),window.addEventListener("keydown",l),window.addEventListener("touchstart",d,{passive:!1}),window.addEventListener("touchmove",d,{passive:!1}),window.addEventListener("gesturestart",i,{passive:!1}),window.addEventListener("gesturechange",i,{passive:!1}),window.addEventListener("gestureend",i,{passive:!1}),document.body.style.touchAction="none")}),p.onUnmounted(()=>{window.removeEventListener("resize",c),M(),a&&(window.removeEventListener("wheel",l),window.removeEventListener("keydown",l),window.removeEventListener("touchstart",d),window.removeEventListener("touchmove",d),window.removeEventListener("gesturestart",i),window.removeEventListener("gesturechange",i),window.removeEventListener("gestureend",i),document.body.style.touchAction==="none"&&(document.body.style.touchAction=""))}),{containerStyles:v,containerClasses:r}},A=e=>e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),P=e=>e.replace(/-([a-z])/g,(n,a)=>a.toUpperCase()),w=e=>typeof e!="object"||e===null?e:Array.isArray(e)?e.map(w):Object.keys(e).reduce((n,a)=>{const t=A(a);return a==="dataValue"&&(e.dataType==="object"||e.dataType==="arrayObject")?n[t]=e[a]:n[t]=w(e[a]),n},{}),E=e=>typeof e!="object"||e===null?e:Array.isArray(e)?e.map(E):Object.keys(e).reduce((n,a)=>{const t=P(a);return n[t]=E(e[a]),n},{}),j=({logout:e,axiosConfig:n={}}={})=>{const a=I.create({baseURL:"",headers:{"Content-Type":"application/json;"},withCredentials:!1,paramsSerializer:t=>z.stringify(t,{indices:!1}),...n});return a.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=D.dump(t.data)),t.cozeToken&&(t.headers.Authorization=`Bearer ${t.cozeToken}`),t.skipCamelToKebab||(t.data=w(t.data),t.params=w(t.params)),t),t=>{Promise.reject(t)}),a.interceptors.response.use(t=>{if(t.request.responseType!=="arraybuffer"&&(t.config.headers.Accept==="json"||t.config.headers.Accept==="application/json, text/plain, */*")){const c=t.config.skipKebabToCamel?t.data:E(t.data);if([21401,20401,21409].includes(c.code)){e&&e();return}else c.code&&c.mesg&&h.ElMessage.error(c.mesg);return c}return t},t=>(t.response&&t.response.status?h.ElMessage.error(t.response.data.mesg||"系统异常,请稍后再试"):navigator.onLine||h.ElMessage.error("网络异常请检查"),t.code==="ECONNABORTED"&&t.message.includes("timeout")&&h.ElMessage({message:"网络请求超时",type:"error",duration:3*1e3}),Promise.reject(t))),a},B=(e,n)=>e&&[21401,20401,21409].includes(e.code)?(n&&n(),!0):!1,H=({logout:e}={})=>(n,{method:a="post",signal:t,body:c,successCallback:l,errCallback:d,openCallback:i})=>{const v={method:a,signal:t,headers:{"Content-Type":"application/json"},async onopen(r){const T=r.headers.get("content-type");if(r.status===200&&(!T||!T.includes("text/event-stream"))){const M=await r.json();B(M,e)}i&&i(r)},onmessage(r){l&&l(r)},onerror(r){throw d&&d(r),new Error("请求出错")},openWhenHidden:!0};if(a=="post"){const r=w(c);v.body=JSON.stringify(r)}R.fetchEventSource(n,v)},f={success:"success",error:"error",warning:"warning"},q={[f.success]:p.markRaw(x.IconBasicSuccess),[f.error]:p.markRaw(x.IconBasicError),[f.warning]:p.markRaw(x.IconBasicWarn)},S=(e,n)=>{h.ElMessage({grouping:!0,duration:5e3,type:n,message:e,offset:66,icon:q[n]})},W=e=>{S(e,f.success)},Y=e=>{S(e,f.error)},$=e=>{S(e,f.warning)},F=(e={})=>{const n=[];e?.text&&n.push(`<div class="text-202434 fz-14 weight-500">${e?.text}</div>`),e?.subText&&n.push(`<div class="text-74798c fz-12">${e?.subText}</div>`);const a={prompt:"提示",confirmButtonText:"删除",cancelButtonText:"取消",type:"warning",icon:p.markRaw(x.IconBasicWarn),closeIcon:p.markRaw(x.IconClose),confirmButtonClass:"el-button--danger"};return h.ElMessageBox.confirm(n.join(""),e?.prompt||a.prompt,{confirmButtonText:e?.confirmButtonText||a.confirmButtonText,cancelButtonText:e?.cancelButtonText||a.cancelButtonText,type:e?.type||a.type,icon:e?.icon||a.icon,closeIcon:e?.closeIcon||a.closeIcon,dangerouslyUseHTMLString:!0,confirmButtonClass:e?.confirmButtonClass||a.confirmButtonClass}).then(()=>{e?.success?.()}).catch(()=>{e?.error?.()})},O={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",sizeChange:"size-change",currentChange:"current-change",enter:"enter",visibleChange:"visible-change",click:"click",command:"command",tabChange:"tab-change",uploadSuccess:"upload-success"},N={success:"0000",notLogin:401,canceled:"ERR_CANCELED"},L={pageNum:1,pageSize:20},U={text:"text",select:"select",date:"date",inputNumber:"inputNumber",switch:"switch",radio:"radio",checkbox:"checkbox",textarea:"textarea",upload:"upload"},Z={date:"YYYY-MM-DD",dateTime:"YYYY-MM-DD HH:mm:ss"},_={search:"search",reset:"reset",export:"export",import:"import",add:"add",edit:"edit",delete:"delete",cancel:"cancel",submit:"submit"},b={year:"year",month:"month",date:"date",datetime:"datetime",week:"week",datetimerange:"datetimerange",daterange:"daterange",monthrange:"monthrange",dates:"dates",years:"years",months:"months",yearrange:"yearrange"},V={[b.datetimerange]:{rangeSeparator:"至",startPlaceholder:"开始时间",endPlaceholder:"结束时间"},[b.daterange]:{rangeSeparator:"至",startPlaceholder:"开始日期",endPlaceholder:"结束日期"},[b.monthrange]:{rangeSeparator:"至",startPlaceholder:"开始月份",endPlaceholder:"结束月份"},[b.yearrange]:{rangeSeparator:"至",startPlaceholder:"开始年份",endPlaceholder:"结束年份"}},G={label:"name",value:"id"},J={satoken:"satoken"},Q={pageSizes:[L.pageSize,50,100,200],layout:"total, sizes, prev, pager, next, jumper"},s={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"},k="image/jpeg",X={[s.png]:"image/png",[s.jpeg]:k,[s.jpg]:k,[s.gif]:"image/gif",[s.bmp]:"image/bmp",[s.webp]:"image/webp",[s.pdf]:"application/pdf",[s.doc]:"application/msword",[s.docx]:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",[s.xls]:"application/vnd.ms-excel",[s.xlsx]:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",[s.ppt]:"application/vnd.ms-powerpoint",[s.pptx]:"application/vnd.openxmlformats-officedocument.presentationml.presentation",[s.txt]:"text/plain",[s.md]:"text/markdown",[s.csv]:"text/csv",[s.json]:"application/json"},ee={blob:"blob"},te={max:3},ae={keepAliveExclude:"keep-alive-exclude",keepAliveInclude:"keep-alive-include"},ne={complete:"complete"},oe={eventStream:"text/event-stream"},se={horizontal:"horizontal",vertical:"vertical"},re={left:"left",right:"right",top:"top"},g={serviceUp:"serviceUp",marketing:"marketing",demandPre:"demandPre",summary:"summary",verify:"verify",efficiency:"efficiency",aiAudit:"aiAudit"},ce=[{label:"服务提升",value:g.serviceUp},{label:"营销转化",value:g.marketing},{label:"诉求预判",value:g.demandPre},{label:"AI稽核",value:g.aiAudit},{label:"归纳总结",value:g.summary},{label:"信息查证",value:g.verify},{label:"效能提升",value:g.efficiency}],u={textCreation:"1",efficiencyTool:"2",mediaEntertainment:"3",officePersonnel:"4",webSearch:"5",newsReading:"6",marketingEcommerce:"7",other:"8"},ie=[{label:"文本创作",value:u.textCreation},{label:"效率工具",value:u.efficiencyTool},{label:"媒体文娱",value:u.mediaEntertainment},{label:"办公人事",value:u.officePersonnel},{label:"网页搜索",value:u.webSearch},{label:"新闻阅读",value:u.newsReading},{label:"营销电商",value:u.marketingEcommerce},{label:"其他",value:u.other}],le=()=>window.$wujie;exports.applicationTags=ce;exports.applicationTagsMap=g;exports.calculateScale=C;exports.camelToKebab=A;exports.codeMap=N;exports.componentType=U;exports.cookieKeyMap=J;exports.createConfiguredAxios=j;exports.createSSERequest=H;exports.dateFormat=Z;exports.dateParamsMap=V;exports.dateTypeMap=b;exports.emitsMap=O;exports.handleInvalidToken=B;exports.headersAccept=oe;exports.isMicroApp=le;exports.kebabToCamel=P;exports.keepAliveMap=te;exports.labelPositionMap=re;exports.messageConfirm=F;exports.messageError=Y;exports.messageSuccess=W;exports.messageWarning=$;exports.operationConfigMap=_;exports.pageParams=L;exports.paginationConfig=Q;exports.pluginTags=ie;exports.pluginTagsMap=u;exports.postMessageMap=ae;exports.provinceMapping=G;exports.readyState=ne;exports.recursiveCamelToKebab=w;exports.recursiveKebabToCamel=E;exports.responseType=ee;exports.textDirection=se;exports.uploadFileType=s;exports.uploadFileTypeMap=X;exports.usePageZoomController=K;
|
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.10",
|
|
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.
|
|
90
|
+
"element-plus": "^2.12.0",
|
|
91
91
|
"element-tree-line": "^0.2.1",
|
|
92
92
|
"js-cookie": "^3.0.5",
|
|
93
93
|
"lodash.debounce": "^4.0.8",
|
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
"peerDependencies": {
|
|
106
106
|
"axios": "^1.8.2",
|
|
107
107
|
"vue": "^3.5.13",
|
|
108
|
-
"color-message-lingyun-vue": "0.0.
|
|
108
|
+
"color-message-lingyun-vue": "0.0.30"
|
|
109
109
|
},
|
|
110
110
|
"optionalDependencies": {
|
|
111
111
|
"@ast-grep/napi-linux-x64-musl": "^0.39.6",
|