mgacn-commonsdk 1.3.7 → 1.4.0
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/dist/{FilePreview-Dx4GAw4K.js → FilePreview-DOmgqdvV.js} +400 -392
- package/dist/mgacn-admin.js +2 -2
- package/dist/mgacn-commonsdk.js +147 -147
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Ue from "axios";
|
|
2
2
|
import { ElMessage as B } from "element-plus";
|
|
3
|
-
import * as
|
|
4
|
-
import { ref as
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
const
|
|
10
|
-
function
|
|
11
|
-
globalThis[
|
|
3
|
+
import * as te from "ali-oss";
|
|
4
|
+
import { ref as ne, computed as j, watch as Ie, onBeforeUnmount as Ce, resolveComponent as re, resolveDirective as je, openBlock as N, createElementBlock as v, normalizeStyle as Re, normalizeClass as Fe, createElementVNode as E, toDisplayString as Ye, createCommentVNode as L, createVNode as R, withCtx as ie, createTextVNode as Be, withDirectives as Le, unref as G, createBlock as Ge, nextTick as He } from "vue";
|
|
5
|
+
import ze from "vue-pdf-embed";
|
|
6
|
+
import Ve from "video.js";
|
|
7
|
+
import qe from "@vue-office/docx";
|
|
8
|
+
import Xe from "@vue-office/excel";
|
|
9
|
+
const le = "__MGACN_COMMONSDK_SYSTEM_ID__", ue = "__MGACN_COMMONSDK_USER_ID__";
|
|
10
|
+
function We(e) {
|
|
11
|
+
globalThis[le] = e == null ? "" : String(e);
|
|
12
12
|
}
|
|
13
13
|
function z() {
|
|
14
|
-
return globalThis[
|
|
14
|
+
return globalThis[le] || "";
|
|
15
15
|
}
|
|
16
|
-
function
|
|
17
|
-
globalThis[
|
|
16
|
+
function Qe(e) {
|
|
17
|
+
globalThis[ue] = e == null ? "" : String(e);
|
|
18
18
|
}
|
|
19
|
-
function
|
|
20
|
-
return globalThis[
|
|
19
|
+
function Je() {
|
|
20
|
+
return globalThis[ue] || "";
|
|
21
21
|
}
|
|
22
|
-
function
|
|
22
|
+
function Ze(e = {}) {
|
|
23
23
|
const {
|
|
24
24
|
baseURL: t = "",
|
|
25
25
|
timeout: n = 6e4,
|
|
@@ -28,8 +28,8 @@ function tt(e = {}) {
|
|
|
28
28
|
userId: s,
|
|
29
29
|
loginUrl: o = "/login"
|
|
30
30
|
} = e;
|
|
31
|
-
i != null && i !== "" &&
|
|
32
|
-
const c =
|
|
31
|
+
i != null && i !== "" && We(i), s != null && s !== "" && Qe(s);
|
|
32
|
+
const c = Ue.create({ baseURL: t, timeout: n });
|
|
33
33
|
let a = !1;
|
|
34
34
|
function f() {
|
|
35
35
|
typeof localStorage < "u" && localStorage.clear(), !a && (a = !0, setTimeout(() => {
|
|
@@ -37,40 +37,40 @@ function tt(e = {}) {
|
|
|
37
37
|
}, 1500));
|
|
38
38
|
}
|
|
39
39
|
return c.interceptors.request.use(
|
|
40
|
-
(
|
|
41
|
-
if (
|
|
40
|
+
(l) => {
|
|
41
|
+
if (l.headers["Content-Type"] = "application/json;charset=UTF-8", typeof localStorage < "u" && r) {
|
|
42
42
|
const g = localStorage.getItem(r);
|
|
43
|
-
g && (
|
|
43
|
+
g && (l.headers.Authorization = g);
|
|
44
44
|
}
|
|
45
|
-
const
|
|
46
|
-
return
|
|
45
|
+
const u = z();
|
|
46
|
+
return u && (l.headers.systemId = u), l;
|
|
47
47
|
},
|
|
48
|
-
(
|
|
48
|
+
(l) => Promise.reject(l)
|
|
49
49
|
), c.interceptors.response.use(
|
|
50
|
-
(
|
|
51
|
-
if (
|
|
52
|
-
return Promise.reject(new Error(`请求发生错误,状态码 ${
|
|
53
|
-
const { data:
|
|
50
|
+
(l) => {
|
|
51
|
+
if (l.status !== 200)
|
|
52
|
+
return Promise.reject(new Error(`请求发生错误,状态码 ${l.status}`));
|
|
53
|
+
const { data: u, config: g } = l;
|
|
54
54
|
if (g.responseType === "arraybuffer" || g.responseType === "blob")
|
|
55
|
-
return
|
|
56
|
-
if (
|
|
57
|
-
const d = Number(
|
|
55
|
+
return u;
|
|
56
|
+
if (u && u.code === 0) return u.data;
|
|
57
|
+
const d = Number(u == null ? void 0 : u.code);
|
|
58
58
|
if (d === 401 || d === 403)
|
|
59
59
|
return f(), Promise.reject(new Error("登录失效,请重新登录"));
|
|
60
|
-
const
|
|
61
|
-
return S.code = d, S.data =
|
|
60
|
+
const b = se(u) || "请求失败", S = new Error(b);
|
|
61
|
+
return S.code = d, S.data = u == null ? void 0 : u.data, S.biz = u, Promise.reject(S);
|
|
62
62
|
},
|
|
63
|
-
(
|
|
64
|
-
var
|
|
65
|
-
const
|
|
66
|
-
if (
|
|
63
|
+
(l) => {
|
|
64
|
+
var b, S;
|
|
65
|
+
const u = (b = l == null ? void 0 : l.response) == null ? void 0 : b.status;
|
|
66
|
+
if (u === 401 || u === 403)
|
|
67
67
|
return f(), Promise.reject(new Error("登录失效,请重新登录"));
|
|
68
|
-
const g = (S =
|
|
68
|
+
const g = (S = l == null ? void 0 : l.response) == null ? void 0 : S.data, d = se(g) || (l == null ? void 0 : l.message) || "请求失败";
|
|
69
69
|
return Promise.reject(new Error(String(d)));
|
|
70
70
|
}
|
|
71
71
|
), c;
|
|
72
72
|
}
|
|
73
|
-
function
|
|
73
|
+
function se(e) {
|
|
74
74
|
if (e == null) return "";
|
|
75
75
|
if (typeof e == "string") {
|
|
76
76
|
const n = e.trim();
|
|
@@ -85,8 +85,8 @@ function ce(e) {
|
|
|
85
85
|
}
|
|
86
86
|
return "";
|
|
87
87
|
}
|
|
88
|
-
function
|
|
89
|
-
const t =
|
|
88
|
+
function un(e = {}) {
|
|
89
|
+
const t = Ze(e);
|
|
90
90
|
return {
|
|
91
91
|
GET(n, r = {}) {
|
|
92
92
|
return t({ method: "get", url: n, ...r });
|
|
@@ -99,28 +99,28 @@ function an(e = {}) {
|
|
|
99
99
|
}
|
|
100
100
|
};
|
|
101
101
|
}
|
|
102
|
-
const
|
|
103
|
-
function
|
|
104
|
-
globalThis[
|
|
102
|
+
const ae = "__MGACN_COMMONSDK_REQUEST__";
|
|
103
|
+
function an(e) {
|
|
104
|
+
globalThis[ae] = e;
|
|
105
105
|
}
|
|
106
|
-
function
|
|
107
|
-
const e = globalThis[
|
|
106
|
+
function et() {
|
|
107
|
+
const e = globalThis[ae];
|
|
108
108
|
if (!e)
|
|
109
109
|
throw new Error("[mgacn-commonsdk] 请先 app.use(MgacnCommonSdk, { tokenKey, baseURL })");
|
|
110
110
|
return e;
|
|
111
111
|
}
|
|
112
|
-
function
|
|
112
|
+
function fe(e, t, n = "application/vnd.ms-excel") {
|
|
113
113
|
if (e == null || typeof window > "u") return;
|
|
114
114
|
const r = e instanceof Blob ? e : new Blob([e], { type: n }), i = window.URL.createObjectURL(r), s = document.createElement("a");
|
|
115
115
|
s.href = i, s.download = t || "download", s.style.display = "none", document.body.appendChild(s), s.click(), document.body.removeChild(s), window.URL.revokeObjectURL(i);
|
|
116
116
|
}
|
|
117
|
-
function
|
|
117
|
+
function P(e) {
|
|
118
118
|
return String(e).padStart(2, "0");
|
|
119
119
|
}
|
|
120
|
-
function
|
|
121
|
-
return `${e.getFullYear()}${
|
|
120
|
+
function tt(e = /* @__PURE__ */ new Date()) {
|
|
121
|
+
return `${e.getFullYear()}${P(e.getMonth() + 1)}${P(e.getDate())}${P(e.getHours())}${P(e.getMinutes())}${P(e.getSeconds())}`;
|
|
122
122
|
}
|
|
123
|
-
async function
|
|
123
|
+
async function nt(e) {
|
|
124
124
|
if (!(e instanceof Blob) || !e.type || !/json/i.test(e.type)) return;
|
|
125
125
|
const t = await e.text();
|
|
126
126
|
let n = "导出失败";
|
|
@@ -131,7 +131,7 @@ async function it(e) {
|
|
|
131
131
|
}
|
|
132
132
|
throw new Error(n);
|
|
133
133
|
}
|
|
134
|
-
async function
|
|
134
|
+
async function rt(e = {}) {
|
|
135
135
|
const {
|
|
136
136
|
url: t,
|
|
137
137
|
data: n,
|
|
@@ -142,57 +142,57 @@ async function st(e = {}) {
|
|
|
142
142
|
} = e;
|
|
143
143
|
if (!t) throw new Error("导出地址不能为空");
|
|
144
144
|
if (!s) throw new Error("导出文件名不能为空");
|
|
145
|
-
const c =
|
|
145
|
+
const c = et(), a = String(i).toUpperCase();
|
|
146
146
|
let f;
|
|
147
|
-
a === "GET" ? f = await c.GET(t, { params: r, responseType: "blob" }) : f = await c.POST(t, n, { responseType: "blob" }), await
|
|
148
|
-
const
|
|
149
|
-
return
|
|
147
|
+
a === "GET" ? f = await c.GET(t, { params: r, responseType: "blob" }) : f = await c.POST(t, n, { responseType: "blob" }), await nt(f);
|
|
148
|
+
const u = /\.[a-z0-9]+$/i.test(s) ? s : `${s}_${tt()}.${o}`;
|
|
149
|
+
return fe(f, u), u;
|
|
150
150
|
}
|
|
151
151
|
let O = null, D = null;
|
|
152
|
-
function
|
|
152
|
+
function it(e, t) {
|
|
153
153
|
if (!e || t == null || t === "") return !1;
|
|
154
154
|
if (typeof t == "object")
|
|
155
155
|
return t.id != null && t.id !== "" && String(e.id) === String(t.id) || t.platformName != null && t.platformName !== "" && String(e.platformName || "") === String(t.platformName).trim();
|
|
156
156
|
const n = String(t).trim();
|
|
157
157
|
return e.id != null && String(e.id) === n || String(e.platformName || "") === n;
|
|
158
158
|
}
|
|
159
|
-
function
|
|
159
|
+
function de(e) {
|
|
160
160
|
O = Array.isArray(e) ? e : [];
|
|
161
161
|
}
|
|
162
|
-
function
|
|
162
|
+
function st() {
|
|
163
163
|
O = null, D = null;
|
|
164
164
|
}
|
|
165
|
-
function
|
|
165
|
+
function ot(e) {
|
|
166
166
|
if (!Array.isArray(O) || !O.length) return "";
|
|
167
|
-
const t = O.find((n) =>
|
|
167
|
+
const t = O.find((n) => it(n, e));
|
|
168
168
|
return (t == null ? void 0 : t.platformLogo) || "";
|
|
169
169
|
}
|
|
170
|
-
async function
|
|
170
|
+
async function ct() {
|
|
171
171
|
return O ?? (D || (D = (async () => {
|
|
172
172
|
try {
|
|
173
173
|
const e = await Y().listPlatformInfoAll();
|
|
174
|
-
return
|
|
174
|
+
return de(e), O;
|
|
175
175
|
} finally {
|
|
176
176
|
D = null;
|
|
177
177
|
}
|
|
178
178
|
})(), D));
|
|
179
179
|
}
|
|
180
|
-
const
|
|
181
|
-
function
|
|
180
|
+
const lt = ["jpg", "jpeg", "png", "gif", "webp", "bmp", "svg", "ico"], ut = ["mp4", "webm", "ogg", "mov", "m4v"], at = ["pdf"], ft = ["docx"], dt = ["xlsx", "xls", "csv"];
|
|
181
|
+
function x(e = "") {
|
|
182
182
|
const t = String(e || "").trim();
|
|
183
183
|
if (!t) return "";
|
|
184
184
|
const n = t.split("?")[0].split("#")[0], r = n.includes("/") ? n.slice(n.lastIndexOf("/") + 1) : n, i = r.lastIndexOf(".");
|
|
185
185
|
return i < 0 || i === r.length - 1 ? "" : r.slice(i + 1).toLowerCase();
|
|
186
186
|
}
|
|
187
|
-
function
|
|
187
|
+
function me(e = {}) {
|
|
188
188
|
const t = String(e.fileType || "").trim().toLowerCase();
|
|
189
189
|
if (t === "image" || t === "video" || t === "pdf" || t === "word" || t === "excel" || t === "unsupported")
|
|
190
190
|
return t;
|
|
191
|
-
const n =
|
|
192
|
-
return
|
|
191
|
+
const n = x(e.name) || x(e.src);
|
|
192
|
+
return lt.includes(n) ? "image" : ut.includes(n) ? "video" : at.includes(n) ? "pdf" : ft.includes(n) ? "word" : dt.includes(n) ? "excel" : "unsupported";
|
|
193
193
|
}
|
|
194
|
-
function
|
|
195
|
-
const n =
|
|
194
|
+
function pe(e = "", t = "") {
|
|
195
|
+
const n = x(t) || x(e);
|
|
196
196
|
return {
|
|
197
197
|
mp4: "video/mp4",
|
|
198
198
|
m4v: "video/mp4",
|
|
@@ -202,58 +202,58 @@ function ye(e = "", t = "") {
|
|
|
202
202
|
// 多数 .mov 为 H.264,按 mp4 更易被 Chrome 等播放
|
|
203
203
|
}[n] || "video/mp4";
|
|
204
204
|
}
|
|
205
|
-
function
|
|
205
|
+
function ge(e = "", t = "") {
|
|
206
206
|
const n = String(e || "").trim();
|
|
207
|
-
return n ? (
|
|
207
|
+
return n ? (x(t) || x(e)) === "mov" ? [
|
|
208
208
|
{ src: n, type: "video/mp4" },
|
|
209
209
|
{ src: n, type: "video/quicktime" }
|
|
210
|
-
] : [{ src: n, type:
|
|
210
|
+
] : [{ src: n, type: pe(e, t) }] : [];
|
|
211
211
|
}
|
|
212
|
-
const
|
|
213
|
-
function
|
|
212
|
+
const ye = "/hide/mg-file-preview";
|
|
213
|
+
function Se(e = {}) {
|
|
214
214
|
const t = String(e.src || "").trim();
|
|
215
215
|
if (!t) return "";
|
|
216
216
|
const n = new URLSearchParams();
|
|
217
217
|
n.set("src", t);
|
|
218
218
|
const r = String(e.name || "").trim(), i = String(e.fileType || "").trim(), s = String(e.title || "").trim();
|
|
219
219
|
r && n.set("name", r), i && n.set("fileType", i), s && n.set("title", s);
|
|
220
|
-
const o = `#${
|
|
220
|
+
const o = `#${ye}?${n.toString()}`;
|
|
221
221
|
if (typeof window > "u") return o;
|
|
222
222
|
const { origin: c, pathname: a, search: f } = window.location;
|
|
223
223
|
return `${c}${a}${f}${o}`;
|
|
224
224
|
}
|
|
225
|
-
function
|
|
226
|
-
const n =
|
|
225
|
+
function he(e = {}, t = "_blank") {
|
|
226
|
+
const n = Se(e);
|
|
227
227
|
return !n || typeof window > "u" ? null : window.open(n, t);
|
|
228
228
|
}
|
|
229
|
-
const
|
|
230
|
-
function
|
|
231
|
-
globalThis[
|
|
229
|
+
const mt = te.default ?? te, be = "__MGACN_COMMONSDK_OSS_URL__";
|
|
230
|
+
function fn(e = "") {
|
|
231
|
+
globalThis[be] = String(e || "").replace(/\/$/, "");
|
|
232
232
|
}
|
|
233
|
-
function
|
|
234
|
-
return globalThis[
|
|
233
|
+
function we() {
|
|
234
|
+
return globalThis[be] || "";
|
|
235
235
|
}
|
|
236
|
-
function
|
|
236
|
+
function oe(e) {
|
|
237
237
|
return String(e).padStart(2, "0");
|
|
238
238
|
}
|
|
239
|
-
function
|
|
239
|
+
function pt() {
|
|
240
240
|
const e = /* @__PURE__ */ new Date();
|
|
241
|
-
return `${e.getFullYear()}${
|
|
241
|
+
return `${e.getFullYear()}${oe(e.getMonth() + 1)}${oe(e.getDate())}`;
|
|
242
242
|
}
|
|
243
|
-
function
|
|
243
|
+
function _e(e = 10) {
|
|
244
244
|
const t = "0123456789abcdefghijklmnopqrstuvwxyz";
|
|
245
245
|
let n = "";
|
|
246
246
|
for (let r = 0; r < e; r++)
|
|
247
247
|
n += t[Math.floor(Math.random() * t.length)];
|
|
248
248
|
return n;
|
|
249
249
|
}
|
|
250
|
-
function
|
|
251
|
-
return `${e}/${
|
|
250
|
+
function W(e = "portal_cms") {
|
|
251
|
+
return `${e}/${pt()}/`;
|
|
252
252
|
}
|
|
253
253
|
function T(e = "") {
|
|
254
254
|
return /^https?:\/\//i.test(String(e || "").trim());
|
|
255
255
|
}
|
|
256
|
-
function
|
|
256
|
+
function gt(e = "") {
|
|
257
257
|
const t = String(e || "");
|
|
258
258
|
return T(t) ? /[?&](Expires|Signature|OSSAccessKeyId|x-oss-signature)=/i.test(t) : !1;
|
|
259
259
|
}
|
|
@@ -287,7 +287,7 @@ function w(e = "", t = "") {
|
|
|
287
287
|
return "";
|
|
288
288
|
}
|
|
289
289
|
}
|
|
290
|
-
function
|
|
290
|
+
function Q(e = {}) {
|
|
291
291
|
if (!e) return null;
|
|
292
292
|
if (typeof e == "string") {
|
|
293
293
|
const i = e.trim();
|
|
@@ -312,7 +312,7 @@ function J(e = {}) {
|
|
|
312
312
|
bucketKind: e.bucketKind
|
|
313
313
|
};
|
|
314
314
|
}
|
|
315
|
-
const
|
|
315
|
+
const yt = /* @__PURE__ */ new Set([
|
|
316
316
|
"previewSrc",
|
|
317
317
|
"previewUrl",
|
|
318
318
|
"url",
|
|
@@ -328,35 +328,43 @@ const St = /* @__PURE__ */ new Set([
|
|
|
328
328
|
"fileName",
|
|
329
329
|
"id"
|
|
330
330
|
]);
|
|
331
|
-
function
|
|
331
|
+
function Ne(e, t = {}) {
|
|
332
332
|
const n = String(e || "").trim();
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
333
|
+
if (!n) return "";
|
|
334
|
+
if (!T(n))
|
|
335
|
+
return n.replace(/^\//, "").split("?")[0];
|
|
336
|
+
try {
|
|
337
|
+
const r = new URL(n);
|
|
338
|
+
return `${r.origin}${r.pathname}`;
|
|
339
|
+
} catch {
|
|
340
|
+
return n.split("?")[0];
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
function Ae(e, t) {
|
|
344
|
+
const n = Q(e);
|
|
345
|
+
if (!n) return null(t && t.bucketKind) || e && typeof e == "object" && e.bucketKind || "private";
|
|
346
|
+
const r = Ne(n.fileUrl || n.fileKey || "", {});
|
|
347
|
+
if (!r) return null;
|
|
348
|
+
const i = w(n.fileKey || n.fileUrl || r) || (T(r) ? "" : r), s = {
|
|
341
349
|
...n.id != null && n.id !== "" ? { id: n.id } : {},
|
|
342
|
-
fileName: n.fileName ||
|
|
343
|
-
fileUrl:
|
|
344
|
-
fileKey:
|
|
350
|
+
fileName: n.fileName || r.split("?")[0].split("/").filter(Boolean).pop() || "file",
|
|
351
|
+
fileUrl: r,
|
|
352
|
+
fileKey: i || w(r) || r
|
|
345
353
|
};
|
|
346
354
|
return e && typeof e == "object" && Object.keys(e).forEach((o) => {
|
|
347
|
-
|
|
355
|
+
yt.has(o) || e[o] !== void 0 && (s[o] = e[o]);
|
|
348
356
|
}), t && typeof t == "object" && Object.keys(t).forEach((o) => {
|
|
349
357
|
t[o] !== void 0 && (s[o] = t[o]);
|
|
350
358
|
}), s;
|
|
351
359
|
}
|
|
352
|
-
function
|
|
353
|
-
return Array.isArray(e) ? e.map((n) =>
|
|
360
|
+
function St(e, t) {
|
|
361
|
+
return Array.isArray(e) ? e.map((n) => Ae(n, t)).filter(Boolean) : [];
|
|
354
362
|
}
|
|
355
363
|
function ht(e = {}) {
|
|
356
364
|
const t = e.accessKeyId || e.AccessKeyId || e.accessKeyID || "", n = e.accessKeySecret || e.AccessKeySecret || "", r = e.securityToken || e.SecurityToken || e.stsToken || e.token || "", i = e.bucketName || e.bucket || e.BucketName || "", s = e.bucketKind === "public" ? "public" : "private";
|
|
357
365
|
let o = String(e.endPoint || e.endpoint || e.EndPoint || "").replace(/^https?:\/\//i, "").replace(/\/$/, "");
|
|
358
366
|
i && o.startsWith(`${i}.`) && (o = o.slice(i.length + 1));
|
|
359
|
-
const c = e.region || (o.startsWith("oss-") ? o.replace(/\.aliyuncs\.com.*$/i, "") : ""), a = String(e.host || e.ossUrl || e.domain || e.cdnDomain || "").trim().replace(/\/$/, ""), f = i && o ? `https://${i}.${o}` :
|
|
367
|
+
const c = e.region || (o.startsWith("oss-") ? o.replace(/\.aliyuncs\.com.*$/i, "") : ""), a = String(e.host || e.ossUrl || e.domain || e.cdnDomain || "").trim().replace(/\/$/, ""), f = i && o ? `https://${i}.${o}` : we(), l = a || f;
|
|
360
368
|
return {
|
|
361
369
|
accessKeyId: t,
|
|
362
370
|
accessKeySecret: n,
|
|
@@ -364,40 +372,40 @@ function ht(e = {}) {
|
|
|
364
372
|
bucketName: i,
|
|
365
373
|
endPoint: o,
|
|
366
374
|
region: c,
|
|
367
|
-
ossUrl:
|
|
368
|
-
host:
|
|
375
|
+
ossUrl: l,
|
|
376
|
+
host: l,
|
|
369
377
|
bucketKind: s,
|
|
370
378
|
expiration: e.expiration
|
|
371
379
|
};
|
|
372
380
|
}
|
|
373
|
-
function
|
|
381
|
+
function J(e) {
|
|
374
382
|
return Y().getOssSts(e);
|
|
375
383
|
}
|
|
376
|
-
function
|
|
384
|
+
function bt(e) {
|
|
377
385
|
return Y().getUploadSign(e);
|
|
378
386
|
}
|
|
379
|
-
const
|
|
380
|
-
function
|
|
387
|
+
const wt = 120, _t = 300, ce = 50, K = /* @__PURE__ */ new Map(), H = /* @__PURE__ */ new Map();
|
|
388
|
+
function Te(e = []) {
|
|
381
389
|
return [
|
|
382
390
|
...new Set(
|
|
383
391
|
(e || []).map((t) => w(t) || String(t || "").trim()).filter(Boolean)
|
|
384
392
|
)
|
|
385
393
|
];
|
|
386
394
|
}
|
|
387
|
-
function
|
|
395
|
+
function ve(e) {
|
|
388
396
|
return e == null ? "" : String(e);
|
|
389
397
|
}
|
|
390
|
-
async function
|
|
391
|
-
const n =
|
|
398
|
+
async function Nt(e, t) {
|
|
399
|
+
const n = Te(e).sort();
|
|
392
400
|
if (!n.length) return { items: [], expireAt: void 0 };
|
|
393
401
|
const r = [];
|
|
394
402
|
let i;
|
|
395
|
-
for (let s = 0; s < n.length; s +=
|
|
396
|
-
const o = n.slice(s, s +
|
|
403
|
+
for (let s = 0; s < n.length; s += ce) {
|
|
404
|
+
const o = n.slice(s, s + ce), c = `${o.join("\0")}::${ve(t)}`;
|
|
397
405
|
let a = H.get(c);
|
|
398
406
|
if (!a) {
|
|
399
|
-
const
|
|
400
|
-
t != null && (
|
|
407
|
+
const l = { keys: o };
|
|
408
|
+
t != null && (l.ttlSeconds = t), a = Y().batchSign(l).finally(() => {
|
|
401
409
|
H.delete(c);
|
|
402
410
|
}), H.set(c, a);
|
|
403
411
|
}
|
|
@@ -406,12 +414,12 @@ async function At(e, t) {
|
|
|
406
414
|
}
|
|
407
415
|
return { items: r, expireAt: i };
|
|
408
416
|
}
|
|
409
|
-
function
|
|
410
|
-
const t =
|
|
417
|
+
function At(e) {
|
|
418
|
+
const t = K.get(e);
|
|
411
419
|
if (!t) return;
|
|
412
|
-
|
|
420
|
+
K.delete(e), t.timer && (clearTimeout(t.timer), t.timer = null);
|
|
413
421
|
const n = [...t.keySet], r = t.ttlSeconds;
|
|
414
|
-
|
|
422
|
+
Nt(n, r).then(
|
|
415
423
|
(i) => {
|
|
416
424
|
t.waiters.forEach((s) => s.resolve(i));
|
|
417
425
|
},
|
|
@@ -420,36 +428,36 @@ function Tt(e) {
|
|
|
420
428
|
}
|
|
421
429
|
);
|
|
422
430
|
}
|
|
423
|
-
function
|
|
424
|
-
const t =
|
|
431
|
+
function Tt(e) {
|
|
432
|
+
const t = K.get(e);
|
|
425
433
|
if (!t) return;
|
|
426
434
|
t.timer && (clearTimeout(t.timer), t.timer = null);
|
|
427
|
-
const n = Date.now() - t.firstAt, r =
|
|
435
|
+
const n = Date.now() - t.firstAt, r = _t - n, i = r <= 0 ? 0 : Math.min(wt, r);
|
|
428
436
|
t.timer = setTimeout(() => {
|
|
429
|
-
|
|
437
|
+
At(e);
|
|
430
438
|
}, i);
|
|
431
439
|
}
|
|
432
|
-
function
|
|
433
|
-
const t =
|
|
440
|
+
function U(e = {}) {
|
|
441
|
+
const t = Te(e.keys);
|
|
434
442
|
if (!t.length)
|
|
435
443
|
return Promise.resolve({ items: [], expireAt: void 0 });
|
|
436
|
-
const n = e.ttlSeconds, r =
|
|
444
|
+
const n = e.ttlSeconds, r = ve(n);
|
|
437
445
|
return new Promise((i, s) => {
|
|
438
|
-
let o =
|
|
446
|
+
let o = K.get(r);
|
|
439
447
|
o || (o = {
|
|
440
448
|
keySet: /* @__PURE__ */ new Set(),
|
|
441
449
|
waiters: [],
|
|
442
450
|
timer: null,
|
|
443
451
|
firstAt: Date.now(),
|
|
444
452
|
ttlSeconds: n
|
|
445
|
-
},
|
|
453
|
+
}, K.set(r, o)), t.forEach((c) => o.keySet.add(c)), o.waiters.push({ resolve: i, reject: s }), Tt(r);
|
|
446
454
|
});
|
|
447
455
|
}
|
|
448
|
-
function
|
|
449
|
-
return
|
|
456
|
+
function vt(e) {
|
|
457
|
+
return U(e);
|
|
450
458
|
}
|
|
451
|
-
async function
|
|
452
|
-
const { dir: t, foldName: n, getOss: r, ossinfo: i, bucketKind: s } = e, o = t ||
|
|
459
|
+
async function Ee(e = {}) {
|
|
460
|
+
const { dir: t, foldName: n, getOss: r, ossinfo: i, bucketKind: s } = e, o = t || W(n || "portal_cms"), c = i || (typeof r == "function" ? await r(o) : await J({ dir: o, bucketKind: s })), a = ht(c || {});
|
|
453
461
|
if (!a.accessKeyId || !a.accessKeySecret || !a.bucketName)
|
|
454
462
|
throw new Error("[mgacn-commonsdk] 获取 OSS STS 失败:凭证字段不完整");
|
|
455
463
|
if (!a.securityToken)
|
|
@@ -463,10 +471,10 @@ async function xe(e = {}) {
|
|
|
463
471
|
success_action_status: "200"
|
|
464
472
|
};
|
|
465
473
|
a.region && (f.region = a.region), a.endPoint && (f.endpoint = a.endPoint);
|
|
466
|
-
const
|
|
467
|
-
return
|
|
474
|
+
const l = new mt(f);
|
|
475
|
+
return l.options.ossUrl = a.host || we(), l.options.uploadDir = o, l.options.bucketKind = a.bucketKind, l;
|
|
468
476
|
}
|
|
469
|
-
async function
|
|
477
|
+
async function xe({ key: e, bucketKind: t = "private", host: n = "" } = {}) {
|
|
470
478
|
const r = w(e) || String(e || "").trim();
|
|
471
479
|
if (!r) return { url: "", expireAt: void 0 };
|
|
472
480
|
if (t === "public") {
|
|
@@ -474,89 +482,89 @@ async function Oe({ key: e, bucketKind: t = "private", host: n = "" } = {}) {
|
|
|
474
482
|
return { url: i ? `${i}/${r}` : "", expireAt: void 0 };
|
|
475
483
|
}
|
|
476
484
|
try {
|
|
477
|
-
const i = await
|
|
485
|
+
const i = await U({ keys: [r] }), o = (Array.isArray(i == null ? void 0 : i.items) ? i.items : []).find((f) => (f == null ? void 0 : f.key) === r), c = (o == null ? void 0 : o.url) || "", a = (o == null ? void 0 : o.expireAt) != null ? Number(o.expireAt) : (i == null ? void 0 : i.expireAt) != null ? Number(i.expireAt) : $(c);
|
|
478
486
|
return { url: c, expireAt: a };
|
|
479
487
|
} catch {
|
|
480
488
|
return { url: "", expireAt: void 0 };
|
|
481
489
|
}
|
|
482
490
|
}
|
|
483
|
-
async function
|
|
484
|
-
var
|
|
491
|
+
async function Et(e = {}) {
|
|
492
|
+
var I, C;
|
|
485
493
|
const { client: t, file: n, dir: r, foldName: i, fileName: s, onProgress: o, bucketKind: c } = e;
|
|
486
494
|
if (!n)
|
|
487
495
|
throw new Error("[mgacn-commonsdk] uploadToOss 缺少 file");
|
|
488
|
-
const a = t || await
|
|
496
|
+
const a = t || await Ee({
|
|
489
497
|
dir: r,
|
|
490
498
|
foldName: i,
|
|
491
499
|
bucketKind: c
|
|
492
|
-
}), f = r || a.options.uploadDir ||
|
|
493
|
-
let
|
|
494
|
-
if (!
|
|
495
|
-
const
|
|
496
|
-
|
|
500
|
+
}), f = r || a.options.uploadDir || W(i), l = c || a.options.bucketKind || "private";
|
|
501
|
+
let u = s;
|
|
502
|
+
if (!u) {
|
|
503
|
+
const k = n.name || "file", _ = k.lastIndexOf("."), Ke = _ > -1 ? k.slice(_) : "";
|
|
504
|
+
u = `${f}${_e(10)}${Ke}`;
|
|
497
505
|
}
|
|
498
|
-
const g = (
|
|
506
|
+
const g = (k) => {
|
|
499
507
|
if (typeof o != "function") return;
|
|
500
|
-
const _ = Number(
|
|
508
|
+
const _ = Number(k);
|
|
501
509
|
Number.isFinite(_) && o(Math.min(100, Math.max(0, Math.round(_ * 100))));
|
|
502
|
-
},
|
|
510
|
+
}, b = {
|
|
503
511
|
partSize: Math.min(
|
|
504
512
|
2 * 1024 * 1024,
|
|
505
513
|
Math.max(256 * 1024, Math.ceil(n.size / 20) || 256 * 1024)
|
|
506
514
|
),
|
|
507
515
|
parallel: 3,
|
|
508
|
-
progress: async (
|
|
509
|
-
const _ = Math.min(0.9, Number(
|
|
516
|
+
progress: async (k) => {
|
|
517
|
+
const _ = Math.min(0.9, Number(k) || 0);
|
|
510
518
|
g(_ > 0 && _ < 0.01 ? 0.01 : _);
|
|
511
519
|
}
|
|
512
|
-
}, S = async (
|
|
513
|
-
const _ =
|
|
514
|
-
return a.multipartUpload(
|
|
515
|
-
...
|
|
520
|
+
}, S = async (k) => {
|
|
521
|
+
const _ = k && l === "public" ? { "x-oss-object-acl": "public-read" } : void 0;
|
|
522
|
+
return a.multipartUpload(u, n, {
|
|
523
|
+
...b,
|
|
516
524
|
..._ ? { headers: _ } : {}
|
|
517
525
|
});
|
|
518
526
|
};
|
|
519
527
|
let p;
|
|
520
528
|
try {
|
|
521
|
-
g(0.02), p = await S(
|
|
529
|
+
g(0.02), p = await S(l === "public");
|
|
522
530
|
} catch {
|
|
523
531
|
g(0.02), p = await S(!1);
|
|
524
532
|
}
|
|
525
|
-
const
|
|
526
|
-
if (
|
|
533
|
+
const h = ((I = p == null ? void 0 : p.res) == null ? void 0 : I.statusCode) ?? ((C = p == null ? void 0 : p.res) == null ? void 0 : C.status);
|
|
534
|
+
if (h && h !== 200)
|
|
527
535
|
throw new Error("[mgacn-commonsdk] 上传失败");
|
|
528
536
|
g(0.92);
|
|
529
|
-
const m = String(a.options.ossUrl || "").replace(/\/$/, ""), y = m ? `${m}/${
|
|
530
|
-
key:
|
|
531
|
-
bucketKind:
|
|
537
|
+
const m = String(a.options.ossUrl || "").replace(/\/$/, ""), y = m ? `${m}/${u}` : u, M = await xe({
|
|
538
|
+
key: u,
|
|
539
|
+
bucketKind: l,
|
|
532
540
|
host: m
|
|
533
541
|
});
|
|
534
542
|
return g(1), {
|
|
535
|
-
key:
|
|
536
|
-
name:
|
|
537
|
-
url:
|
|
538
|
-
previewUrl:
|
|
539
|
-
expireAt:
|
|
543
|
+
key: u,
|
|
544
|
+
name: u,
|
|
545
|
+
url: y,
|
|
546
|
+
previewUrl: M.url || "",
|
|
547
|
+
expireAt: M.expireAt,
|
|
540
548
|
host: m,
|
|
541
|
-
bucketKind:
|
|
549
|
+
bucketKind: l,
|
|
542
550
|
raw: p,
|
|
543
551
|
client: a
|
|
544
552
|
};
|
|
545
553
|
}
|
|
546
|
-
const
|
|
554
|
+
const dn = {
|
|
547
555
|
methods: {
|
|
548
556
|
getDir() {
|
|
549
|
-
return
|
|
557
|
+
return W(this.foldName || "portal_cms");
|
|
550
558
|
},
|
|
551
|
-
randomString:
|
|
559
|
+
randomString: _e,
|
|
552
560
|
getOss() {
|
|
553
|
-
return
|
|
561
|
+
return J({
|
|
554
562
|
dir: this.getDir(),
|
|
555
563
|
bucketKind: this.bucketKind || "private"
|
|
556
564
|
});
|
|
557
565
|
},
|
|
558
566
|
async createOssClient() {
|
|
559
|
-
return
|
|
567
|
+
return Ee({
|
|
560
568
|
dir: this.getDir(),
|
|
561
569
|
bucketKind: this.bucketKind || "private",
|
|
562
570
|
getOss: () => this.getOss()
|
|
@@ -566,16 +574,16 @@ const mn = {
|
|
|
566
574
|
};
|
|
567
575
|
async function xt(e, t = {}) {
|
|
568
576
|
var g;
|
|
569
|
-
const n =
|
|
577
|
+
const n = Q(e);
|
|
570
578
|
if (!n)
|
|
571
579
|
return B.warning("无可预览文件"), null;
|
|
572
|
-
const { forceResign: r = !1, ttlSeconds: i, leadMs: s = 12e4 } = t, o = typeof t.resign == "function" ? t.resign : (d) =>
|
|
580
|
+
const { forceResign: r = !1, ttlSeconds: i, leadMs: s = 12e4 } = t, o = typeof t.resign == "function" ? t.resign : (d) => U({ keys: d, ttlSeconds: i });
|
|
573
581
|
let c = n.fileUrl || "";
|
|
574
582
|
const a = n.fileKey || w(c), f = n.expireAt != null ? Number(n.expireAt) : $(c);
|
|
575
583
|
if ((r || !c || !T(c) || F(f, s)) && a)
|
|
576
584
|
try {
|
|
577
585
|
const d = await o([a]);
|
|
578
|
-
d && Array.isArray(d.items) ? c = ((g = d.items.find((
|
|
586
|
+
d && Array.isArray(d.items) ? c = ((g = d.items.find((b) => b.key === a)) == null ? void 0 : g.url) || c : d && typeof d == "object" && d[a] && (c = d[a]);
|
|
579
587
|
} catch (d) {
|
|
580
588
|
return B.error((d == null ? void 0 : d.message) || "获取预览地址失败"), null;
|
|
581
589
|
}
|
|
@@ -586,58 +594,58 @@ async function xt(e, t = {}) {
|
|
|
586
594
|
const d = $(c);
|
|
587
595
|
d != null && (e.expireAt = d);
|
|
588
596
|
}
|
|
589
|
-
return { window:
|
|
597
|
+
return { window: he({
|
|
590
598
|
src: c,
|
|
591
599
|
name: n.fileName || ""
|
|
592
600
|
}), src: c, fileName: n.fileName || "" };
|
|
593
601
|
}
|
|
594
|
-
function
|
|
595
|
-
const t = /* @__PURE__ */ Object.create(null), n = /* @__PURE__ */ Object.create(null), r = typeof e == "function" ? e : (
|
|
596
|
-
function i(
|
|
597
|
-
const
|
|
598
|
-
!
|
|
602
|
+
function kt(e) {
|
|
603
|
+
const t = /* @__PURE__ */ Object.create(null), n = /* @__PURE__ */ Object.create(null), r = typeof e == "function" ? e : (l) => U(l);
|
|
604
|
+
function i(l) {
|
|
605
|
+
const u = w(l) || l;
|
|
606
|
+
!u || !n[u] || (clearTimeout(n[u]), delete n[u]);
|
|
599
607
|
}
|
|
600
608
|
function s() {
|
|
601
|
-
Object.keys(n).forEach((
|
|
609
|
+
Object.keys(n).forEach((l) => i(l));
|
|
602
610
|
}
|
|
603
|
-
async function o(
|
|
604
|
-
const g = [...new Set(
|
|
611
|
+
async function o(l = [], u) {
|
|
612
|
+
const g = [...new Set(l.map((p) => w(p)).filter(Boolean))];
|
|
605
613
|
if (!g.length) return { items: [] };
|
|
606
614
|
const d = await r({
|
|
607
615
|
keys: g.slice(0, 50),
|
|
608
|
-
...
|
|
609
|
-
}),
|
|
616
|
+
...u != null ? { ttlSeconds: u } : {}
|
|
617
|
+
}), b = d == null ? void 0 : d.expireAt, S = Array.isArray(d == null ? void 0 : d.items) ? d.items : [];
|
|
610
618
|
return S.forEach((p) => {
|
|
611
619
|
if (p != null && p.key && (p != null && p.url)) {
|
|
612
|
-
const
|
|
613
|
-
t[p.key] = { url: p.url, expireAt:
|
|
620
|
+
const h = p.expireAt ?? b;
|
|
621
|
+
t[p.key] = { url: p.url, expireAt: h }, c([p.key], h);
|
|
614
622
|
}
|
|
615
623
|
}), d || { items: S };
|
|
616
624
|
}
|
|
617
|
-
function c(
|
|
618
|
-
if (
|
|
619
|
-
const d = [...new Set((
|
|
625
|
+
function c(l, u, g = 12e4) {
|
|
626
|
+
if (u == null || Number.isNaN(Number(u))) return null;
|
|
627
|
+
const d = [...new Set((l || []).map((h) => w(h)).filter(Boolean))];
|
|
620
628
|
if (!d.length) return null;
|
|
621
|
-
const S = Number(
|
|
629
|
+
const S = Number(u) * 1e3 - Date.now();
|
|
622
630
|
let p;
|
|
623
|
-
return S <= 0 ? p = 0 : S <= g ? p = Math.max(S / 2, 1e3) : p = S - g, d.forEach((
|
|
624
|
-
i(
|
|
625
|
-
delete n[
|
|
631
|
+
return S <= 0 ? p = 0 : S <= g ? p = Math.max(S / 2, 1e3) : p = S - g, d.forEach((h) => {
|
|
632
|
+
i(h), n[h] = setTimeout(() => {
|
|
633
|
+
delete n[h], o([h]);
|
|
626
634
|
}, p);
|
|
627
635
|
}), n[d[0]];
|
|
628
636
|
}
|
|
629
|
-
function a(
|
|
630
|
-
const d = w(
|
|
637
|
+
function a(l, u, g) {
|
|
638
|
+
const d = w(l) || l;
|
|
631
639
|
if (!d) return;
|
|
632
|
-
const
|
|
633
|
-
t[d] = { url:
|
|
640
|
+
const b = g != null ? Number(g) : $(u);
|
|
641
|
+
t[d] = { url: u, expireAt: b }, b && c([d], b);
|
|
634
642
|
}
|
|
635
|
-
async function f(
|
|
643
|
+
async function f(l, u = {}) {
|
|
636
644
|
var y;
|
|
637
|
-
const g = w(
|
|
645
|
+
const g = w(l) || l;
|
|
638
646
|
if (!g) return "";
|
|
639
|
-
const { force: d = !1, leadMs:
|
|
640
|
-
return !d &&
|
|
647
|
+
const { force: d = !1, leadMs: b = 12e4, ttlSeconds: S } = u, p = t[g], h = u.url || (p == null ? void 0 : p.url) || "", m = u.expireAt != null ? Number(u.expireAt) : (p == null ? void 0 : p.expireAt) ?? $(h);
|
|
648
|
+
return !d && h && T(h) && !F(m, b) ? h : (await o([g], S), ((y = t[g]) == null ? void 0 : y.url) || h || "");
|
|
641
649
|
}
|
|
642
650
|
return {
|
|
643
651
|
cache: t,
|
|
@@ -650,11 +658,11 @@ function Ot(e) {
|
|
|
650
658
|
isExpiringSoon: F
|
|
651
659
|
};
|
|
652
660
|
}
|
|
653
|
-
function
|
|
661
|
+
function ke(e) {
|
|
654
662
|
const t = String(e || "").trim().toUpperCase();
|
|
655
663
|
if (/^\d{15}$/.test(t)) {
|
|
656
|
-
const f = +`19${t.slice(6, 8)}`,
|
|
657
|
-
return g.getFullYear() === f && g.getMonth() + 1 ===
|
|
664
|
+
const f = +`19${t.slice(6, 8)}`, l = Number(t.slice(8, 10)), u = Number(t.slice(10, 12)), g = new Date(f, l - 1, u);
|
|
665
|
+
return g.getFullYear() === f && g.getMonth() + 1 === l && g.getDate() === u;
|
|
658
666
|
}
|
|
659
667
|
if (!/^\d{17}[\dX]$/.test(t)) return !1;
|
|
660
668
|
const n = Number(t.slice(6, 10)), r = Number(t.slice(10, 12)), i = Number(t.slice(12, 14)), s = new Date(n, r - 1, i);
|
|
@@ -664,60 +672,60 @@ function Me(e) {
|
|
|
664
672
|
for (let f = 0; f < 17; f++) a += Number(t[f]) * o[f];
|
|
665
673
|
return c[a % 11] === t[17];
|
|
666
674
|
}
|
|
667
|
-
function
|
|
675
|
+
function Oe(e) {
|
|
668
676
|
const t = String(e || "").trim().replace(/\s+/g, "");
|
|
669
677
|
return t ? /^1\d{10}$/.test(t) || /^\+[1-9]\d{6,14}$/.test(t) : !1;
|
|
670
678
|
}
|
|
671
|
-
function
|
|
679
|
+
function Me(e) {
|
|
672
680
|
const t = String(e || "").trim();
|
|
673
681
|
return t ? /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t) : !1;
|
|
674
682
|
}
|
|
675
|
-
function
|
|
683
|
+
function Z(e) {
|
|
676
684
|
return e == null || e === "";
|
|
677
685
|
}
|
|
678
|
-
function
|
|
679
|
-
if (
|
|
686
|
+
function Ot(e, t, n) {
|
|
687
|
+
if (Z(t)) {
|
|
680
688
|
n();
|
|
681
689
|
return;
|
|
682
690
|
}
|
|
683
|
-
if (!
|
|
691
|
+
if (!ke(t)) {
|
|
684
692
|
n(new Error("请输入正确的身份证号(15/18位)"));
|
|
685
693
|
return;
|
|
686
694
|
}
|
|
687
695
|
n();
|
|
688
696
|
}
|
|
689
|
-
function
|
|
690
|
-
if (
|
|
697
|
+
function Mt(e, t, n) {
|
|
698
|
+
if (Z(t)) {
|
|
691
699
|
n();
|
|
692
700
|
return;
|
|
693
701
|
}
|
|
694
|
-
if (!
|
|
702
|
+
if (!Oe(t)) {
|
|
695
703
|
n(new Error("请输入正确的国内或海外手机号"));
|
|
696
704
|
return;
|
|
697
705
|
}
|
|
698
706
|
n();
|
|
699
707
|
}
|
|
700
|
-
function
|
|
701
|
-
if (
|
|
708
|
+
function Dt(e, t, n) {
|
|
709
|
+
if (Z(t)) {
|
|
702
710
|
n();
|
|
703
711
|
return;
|
|
704
712
|
}
|
|
705
|
-
if (
|
|
713
|
+
if (!Me(t)) {
|
|
706
714
|
n(new Error("请输入正确的邮箱"));
|
|
707
715
|
return;
|
|
708
716
|
}
|
|
709
717
|
n();
|
|
710
718
|
}
|
|
711
|
-
function
|
|
719
|
+
function $t(e) {
|
|
712
720
|
return !!(e == null || typeof e == "string" && e.trim() === "" || Array.isArray(e) && e.length === 0 || typeof e == "object" && !Array.isArray(e) && Object.keys(e).length === 0);
|
|
713
721
|
}
|
|
714
|
-
function
|
|
722
|
+
function V(e) {
|
|
715
723
|
if (e === null || typeof e != "object") return e;
|
|
716
724
|
if (e instanceof Date) return new Date(e.getTime());
|
|
717
|
-
if (Array.isArray(e)) return e.map((n) =>
|
|
725
|
+
if (Array.isArray(e)) return e.map((n) => V(n));
|
|
718
726
|
const t = {};
|
|
719
727
|
return Object.keys(e).forEach((n) => {
|
|
720
|
-
t[n] =
|
|
728
|
+
t[n] = V(e[n]);
|
|
721
729
|
}), t;
|
|
722
730
|
}
|
|
723
731
|
function Pt(e, t = 300) {
|
|
@@ -728,14 +736,14 @@ function Pt(e, t = 300) {
|
|
|
728
736
|
}, t);
|
|
729
737
|
};
|
|
730
738
|
}
|
|
731
|
-
function
|
|
739
|
+
function Kt(e, t = 300) {
|
|
732
740
|
let n = 0;
|
|
733
741
|
return function(...i) {
|
|
734
742
|
const s = Date.now();
|
|
735
743
|
s - n >= t && (n = s, e.apply(this, i));
|
|
736
744
|
};
|
|
737
745
|
}
|
|
738
|
-
function
|
|
746
|
+
function De(e) {
|
|
739
747
|
if (e == null || e === "") return null;
|
|
740
748
|
if (e instanceof Date)
|
|
741
749
|
return Number.isNaN(e.getTime()) ? null : e;
|
|
@@ -757,22 +765,22 @@ function Ke(e) {
|
|
|
757
765
|
/^(\d{4})[-/.年](\d{1,2})[-/.月](\d{1,2})日?(?:[\sT]+(\d{1,2}):(\d{1,2})(?::(\d{1,2}))?(?:\.(\d{1,3}))?)?/
|
|
758
766
|
);
|
|
759
767
|
if (n) {
|
|
760
|
-
const [, i, s, o, c = "0", a = "0", f = "0",
|
|
768
|
+
const [, i, s, o, c = "0", a = "0", f = "0", l = "0"] = n, u = new Date(
|
|
761
769
|
Number(i),
|
|
762
770
|
Number(s) - 1,
|
|
763
771
|
Number(o),
|
|
764
772
|
Number(c),
|
|
765
773
|
Number(a),
|
|
766
774
|
Number(f),
|
|
767
|
-
Number(String(
|
|
775
|
+
Number(String(l).padEnd(3, "0"))
|
|
768
776
|
);
|
|
769
|
-
return Number.isNaN(
|
|
777
|
+
return Number.isNaN(u.getTime()) ? null : u;
|
|
770
778
|
}
|
|
771
779
|
const r = new Date(t);
|
|
772
780
|
return Number.isNaN(r.getTime()) ? null : r;
|
|
773
781
|
}
|
|
774
|
-
function
|
|
775
|
-
const n =
|
|
782
|
+
function q(e, t = "YYYY-MM-DD HH:mm:ss") {
|
|
783
|
+
const n = De(e);
|
|
776
784
|
if (!n) return "";
|
|
777
785
|
const r = n.getFullYear(), i = n.getMonth() + 1, s = n.getDate(), o = n.getHours(), c = n.getMinutes(), a = n.getSeconds(), f = {
|
|
778
786
|
YYYY: String(r),
|
|
@@ -787,15 +795,15 @@ function X(e, t = "YYYY-MM-DD HH:mm:ss") {
|
|
|
787
795
|
m: String(c),
|
|
788
796
|
s: String(a)
|
|
789
797
|
};
|
|
790
|
-
return t.replace(/YYYY|MM|DD|HH|mm|ss|M|D|H|m|s/g, (
|
|
798
|
+
return t.replace(/YYYY|MM|DD|HH|mm|ss|M|D|H|m|s/g, (l) => f[l]);
|
|
791
799
|
}
|
|
792
800
|
function Ut() {
|
|
793
801
|
const e = /* @__PURE__ */ new Date();
|
|
794
802
|
e.setHours(23, 59, 59, 0);
|
|
795
803
|
const t = /* @__PURE__ */ new Date();
|
|
796
804
|
return t.setDate(t.getDate() - 30), t.setHours(0, 0, 0, 0), {
|
|
797
|
-
start:
|
|
798
|
-
end:
|
|
805
|
+
start: q(t, "YYYY-MM-DD HH:mm:ss"),
|
|
806
|
+
end: q(e, "YYYY-MM-DD HH:mm:ss")
|
|
799
807
|
};
|
|
800
808
|
}
|
|
801
809
|
function A(e) {
|
|
@@ -805,29 +813,29 @@ function A(e) {
|
|
|
805
813
|
r == null || r === "" || Array.isArray(r) && r.length === 0 || (t[n] = r);
|
|
806
814
|
}), t;
|
|
807
815
|
}
|
|
808
|
-
function
|
|
816
|
+
function It(e) {
|
|
809
817
|
return e == null || e === "" ? "-" : e;
|
|
810
818
|
}
|
|
811
|
-
function
|
|
819
|
+
function ee(e, t = 2) {
|
|
812
820
|
if (!Number.isFinite(e)) return e;
|
|
813
821
|
const n = Math.max(0, Math.floor(Number(t) || 0));
|
|
814
822
|
return +(Math.round(+`${e}e${n}`) + `e-${n}`);
|
|
815
823
|
}
|
|
816
|
-
function
|
|
824
|
+
function X(e, t = 2) {
|
|
817
825
|
if (e == null || e === "") return "-";
|
|
818
826
|
const n = Number(e);
|
|
819
827
|
if (Number.isNaN(n)) return e;
|
|
820
|
-
const r =
|
|
828
|
+
const r = ee(n, t).toFixed(t), [i, s] = r.split("."), o = i.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
821
829
|
if (s == null) return o;
|
|
822
830
|
const c = s.replace(/0+$/, "");
|
|
823
831
|
return c ? `${o}.${c}` : o;
|
|
824
832
|
}
|
|
825
|
-
function
|
|
833
|
+
function Ct(e) {
|
|
826
834
|
if (e == null || e === "") return "-";
|
|
827
835
|
const t = Number(e);
|
|
828
|
-
return Number.isNaN(t) ? "-" : Math.abs(t) > 1e4 ? `${
|
|
836
|
+
return Number.isNaN(t) ? "-" : Math.abs(t) > 1e4 ? `${X(t / 1e4, 2)}w` : String(X(t, 0));
|
|
829
837
|
}
|
|
830
|
-
function
|
|
838
|
+
function jt(e, t = 4, n = "toDecimal") {
|
|
831
839
|
if (n === "toPercent" || n === "toPercentText") {
|
|
832
840
|
if (e == null || e === "") return n === "toPercentText" ? "-" : e;
|
|
833
841
|
const i = Number(e);
|
|
@@ -841,78 +849,78 @@ function Rt(e, t = 4, n = "toDecimal") {
|
|
|
841
849
|
if (Number.isFinite(r))
|
|
842
850
|
return Number((r / 100).toFixed(t));
|
|
843
851
|
}
|
|
844
|
-
function
|
|
852
|
+
function Rt(e) {
|
|
845
853
|
if (e === "" || e == null) return "";
|
|
846
854
|
const t = Number(e);
|
|
847
855
|
return Number.isFinite(t) ? t : "";
|
|
848
856
|
}
|
|
849
|
-
function
|
|
857
|
+
function Ft(e, t = 2, n = 9999999999999) {
|
|
850
858
|
if (e === 0 || e === "0") return 0;
|
|
851
859
|
if (e == null || e === "") return "";
|
|
852
860
|
let r = Number(e);
|
|
853
861
|
if (!Number.isFinite(r)) return "";
|
|
854
862
|
const i = Number(n), s = Number.isFinite(i) ? Math.abs(i) : 9999999999999;
|
|
855
|
-
return Math.abs(r) >= s && (r = r < 0 ? -s : s), Number.isInteger(r) ? r :
|
|
863
|
+
return Math.abs(r) >= s && (r = r < 0 ? -s : s), Number.isInteger(r) ? r : ee(r, t);
|
|
856
864
|
}
|
|
857
|
-
function
|
|
865
|
+
function Yt(e = "id") {
|
|
858
866
|
return `${e}_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`;
|
|
859
867
|
}
|
|
860
|
-
const
|
|
868
|
+
const mn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
861
869
|
__proto__: null,
|
|
862
|
-
FILE_PREVIEW_ROUTE_PATH:
|
|
863
|
-
batchSign:
|
|
864
|
-
batchSignOss:
|
|
865
|
-
buildFilePreviewHref:
|
|
866
|
-
cleanNumber:
|
|
870
|
+
FILE_PREVIEW_ROUTE_PATH: ye,
|
|
871
|
+
batchSign: U,
|
|
872
|
+
batchSignOss: vt,
|
|
873
|
+
buildFilePreviewHref: Se,
|
|
874
|
+
cleanNumber: Ft,
|
|
867
875
|
cleanParams: A,
|
|
868
|
-
clearPlatformCache:
|
|
869
|
-
createOssResign:
|
|
876
|
+
clearPlatformCache: st,
|
|
877
|
+
createOssResign: kt,
|
|
870
878
|
debounce: Pt,
|
|
871
|
-
deepClone:
|
|
872
|
-
downloadBlob:
|
|
873
|
-
exportFile:
|
|
879
|
+
deepClone: V,
|
|
880
|
+
downloadBlob: fe,
|
|
881
|
+
exportFile: rt,
|
|
874
882
|
extractObjectKey: w,
|
|
875
|
-
findPlatformLogo:
|
|
876
|
-
formatDate:
|
|
877
|
-
formatEmpty:
|
|
878
|
-
formatFansCount:
|
|
879
|
-
formatNum:
|
|
880
|
-
getFileExtension:
|
|
881
|
-
getOssSts:
|
|
883
|
+
findPlatformLogo: ot,
|
|
884
|
+
formatDate: q,
|
|
885
|
+
formatEmpty: It,
|
|
886
|
+
formatFansCount: Ct,
|
|
887
|
+
formatNum: X,
|
|
888
|
+
getFileExtension: x,
|
|
889
|
+
getOssSts: J,
|
|
882
890
|
getRecentMonthRange: Ut,
|
|
883
|
-
getUploadSign:
|
|
884
|
-
isEmail:
|
|
885
|
-
isEmpty:
|
|
891
|
+
getUploadSign: bt,
|
|
892
|
+
isEmail: Me,
|
|
893
|
+
isEmpty: $t,
|
|
886
894
|
isExpiringSoon: F,
|
|
887
895
|
isHttpUrl: T,
|
|
888
|
-
isMainlandIdCard:
|
|
889
|
-
isMobile:
|
|
890
|
-
isSignedUrl:
|
|
891
|
-
normalizeAttachFile:
|
|
892
|
-
openFilePreview:
|
|
896
|
+
isMainlandIdCard: ke,
|
|
897
|
+
isMobile: Oe,
|
|
898
|
+
isSignedUrl: gt,
|
|
899
|
+
normalizeAttachFile: Q,
|
|
900
|
+
openFilePreview: he,
|
|
893
901
|
openOssFile: xt,
|
|
894
|
-
parseDate:
|
|
902
|
+
parseDate: De,
|
|
895
903
|
parseExpireAtFromUrl: $,
|
|
896
|
-
preloadPlatformList:
|
|
897
|
-
resolveFilePreviewType:
|
|
898
|
-
resolveUploadPreviewUrl:
|
|
899
|
-
resolveVideoMimeType:
|
|
900
|
-
resolveVideoSources:
|
|
901
|
-
roundHalfUp:
|
|
902
|
-
setPlatformCache:
|
|
903
|
-
throttle:
|
|
904
|
-
toNumberOrEmpty:
|
|
905
|
-
toOssSaveFile:
|
|
906
|
-
toOssSaveFiles:
|
|
907
|
-
toOssSaveUrl:
|
|
908
|
-
toRebateRatio:
|
|
909
|
-
uniqueId:
|
|
910
|
-
uploadToOss:
|
|
911
|
-
validateEmail:
|
|
912
|
-
validateIdCardNo:
|
|
913
|
-
validateMobile:
|
|
904
|
+
preloadPlatformList: ct,
|
|
905
|
+
resolveFilePreviewType: me,
|
|
906
|
+
resolveUploadPreviewUrl: xe,
|
|
907
|
+
resolveVideoMimeType: pe,
|
|
908
|
+
resolveVideoSources: ge,
|
|
909
|
+
roundHalfUp: ee,
|
|
910
|
+
setPlatformCache: de,
|
|
911
|
+
throttle: Kt,
|
|
912
|
+
toNumberOrEmpty: Rt,
|
|
913
|
+
toOssSaveFile: Ae,
|
|
914
|
+
toOssSaveFiles: St,
|
|
915
|
+
toOssSaveUrl: Ne,
|
|
916
|
+
toRebateRatio: jt,
|
|
917
|
+
uniqueId: Yt,
|
|
918
|
+
uploadToOss: Et,
|
|
919
|
+
validateEmail: Dt,
|
|
920
|
+
validateIdCardNo: Ot,
|
|
921
|
+
validateMobile: Mt
|
|
914
922
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
915
|
-
function
|
|
923
|
+
function pn(e) {
|
|
916
924
|
if (!e)
|
|
917
925
|
throw new Error("[mgacn-commonsdk] createApi 需要传入 request 实例");
|
|
918
926
|
return {
|
|
@@ -1039,7 +1047,7 @@ function gn(e) {
|
|
|
1039
1047
|
"/yhAdmin/trace/addTraceData",
|
|
1040
1048
|
A({
|
|
1041
1049
|
...s,
|
|
1042
|
-
userId:
|
|
1050
|
+
userId: Je(),
|
|
1043
1051
|
projectId: z(),
|
|
1044
1052
|
clientType: 1
|
|
1045
1053
|
})
|
|
@@ -1092,63 +1100,63 @@ function gn(e) {
|
|
|
1092
1100
|
}
|
|
1093
1101
|
};
|
|
1094
1102
|
}
|
|
1095
|
-
const
|
|
1096
|
-
function
|
|
1097
|
-
globalThis[
|
|
1103
|
+
const $e = "__MGACN_COMMONSDK_API__";
|
|
1104
|
+
function gn(e) {
|
|
1105
|
+
globalThis[$e] = e;
|
|
1098
1106
|
}
|
|
1099
1107
|
function Y() {
|
|
1100
|
-
const e = globalThis[
|
|
1108
|
+
const e = globalThis[$e];
|
|
1101
1109
|
if (!e)
|
|
1102
1110
|
throw new Error("[mgacn-commonsdk] 请先 app.use(MgacnCommonSdk, { tokenKey, baseURL })");
|
|
1103
1111
|
return e;
|
|
1104
1112
|
}
|
|
1105
|
-
const
|
|
1106
|
-
function
|
|
1107
|
-
globalThis[
|
|
1113
|
+
const Pe = "__MGACN_COMMONSDK_PERMISSION_GETTER__";
|
|
1114
|
+
function yn(e) {
|
|
1115
|
+
globalThis[Pe] = typeof e == "function" ? e : null;
|
|
1108
1116
|
}
|
|
1109
|
-
function
|
|
1110
|
-
return globalThis[
|
|
1117
|
+
function Bt() {
|
|
1118
|
+
return globalThis[Pe] || null;
|
|
1111
1119
|
}
|
|
1112
|
-
function
|
|
1120
|
+
function Lt(e, t, n = "and") {
|
|
1113
1121
|
const r = (Array.isArray(t) ? t : [t]).map((s) => String(s ?? "").trim()).filter(Boolean);
|
|
1114
1122
|
if (!r.length) return !0;
|
|
1115
1123
|
const i = new Set((e || []).map(String));
|
|
1116
1124
|
return n === "or" ? r.some((s) => i.has(s)) : r.every((s) => i.has(s));
|
|
1117
1125
|
}
|
|
1118
|
-
function
|
|
1119
|
-
const n =
|
|
1120
|
-
return typeof n != "function" ? !0 :
|
|
1126
|
+
function Sn(e, t = "and") {
|
|
1127
|
+
const n = Bt();
|
|
1128
|
+
return typeof n != "function" ? !0 : Lt(n(), e, t);
|
|
1121
1129
|
}
|
|
1122
|
-
const
|
|
1130
|
+
const Gt = (e, t) => {
|
|
1123
1131
|
const n = e.__vccOpts || e;
|
|
1124
1132
|
for (const [r, i] of t)
|
|
1125
1133
|
n[r] = i;
|
|
1126
1134
|
return n;
|
|
1127
|
-
},
|
|
1135
|
+
}, Ht = {
|
|
1128
1136
|
key: 0,
|
|
1129
1137
|
class: "mg-file-preview__empty"
|
|
1130
|
-
},
|
|
1138
|
+
}, zt = {
|
|
1131
1139
|
key: 1,
|
|
1132
1140
|
class: "mg-file-preview__fallback"
|
|
1133
|
-
},
|
|
1141
|
+
}, Vt = {
|
|
1134
1142
|
key: 0,
|
|
1135
1143
|
class: "mg-file-preview__fallback-name"
|
|
1136
|
-
},
|
|
1144
|
+
}, qt = {
|
|
1137
1145
|
key: 2,
|
|
1138
1146
|
class: "mg-file-preview__image"
|
|
1139
|
-
},
|
|
1147
|
+
}, Xt = {
|
|
1140
1148
|
key: 3,
|
|
1141
1149
|
class: "mg-file-preview__video-wrap"
|
|
1142
|
-
},
|
|
1150
|
+
}, Wt = {
|
|
1143
1151
|
key: 0,
|
|
1144
1152
|
class: "mg-file-preview__tip"
|
|
1145
|
-
},
|
|
1153
|
+
}, Qt = { class: "mg-file-preview__video" }, Jt = {
|
|
1146
1154
|
key: 4,
|
|
1147
1155
|
class: "mg-file-preview__pdf"
|
|
1148
|
-
},
|
|
1156
|
+
}, Zt = {
|
|
1149
1157
|
key: 5,
|
|
1150
1158
|
class: "mg-file-preview__word"
|
|
1151
|
-
},
|
|
1159
|
+
}, en = /* @__PURE__ */ Object.assign({ name: "MgFilePreview" }, {
|
|
1152
1160
|
__name: "FilePreview",
|
|
1153
1161
|
props: {
|
|
1154
1162
|
/** 文件地址(URL / Blob URL) */
|
|
@@ -1177,10 +1185,10 @@ const Ht = (e, t) => {
|
|
|
1177
1185
|
},
|
|
1178
1186
|
emits: ["ready", "error", "download"],
|
|
1179
1187
|
setup(e, { emit: t }) {
|
|
1180
|
-
const n = e, r = t, i =
|
|
1188
|
+
const n = e, r = t, i = ne(null), s = ne(!1);
|
|
1181
1189
|
let o = null;
|
|
1182
1190
|
const c = j(
|
|
1183
|
-
() =>
|
|
1191
|
+
() => me({
|
|
1184
1192
|
src: n.src,
|
|
1185
1193
|
name: n.name,
|
|
1186
1194
|
fileType: n.fileType
|
|
@@ -1192,11 +1200,11 @@ const Ht = (e, t) => {
|
|
|
1192
1200
|
if (!y) return "";
|
|
1193
1201
|
const M = y.split("?")[0].split("#")[0];
|
|
1194
1202
|
return M.slice(M.lastIndexOf("/") + 1) || y;
|
|
1195
|
-
}), f = j(() => c.value !== "video" ? !1 : (
|
|
1203
|
+
}), f = j(() => c.value !== "video" ? !1 : (x(n.name) || x(n.src)) === "mov"), l = j(() => {
|
|
1196
1204
|
const m = n.height;
|
|
1197
1205
|
return m == null || m === "" ? {} : { height: typeof m == "number" ? `${m}px` : String(m) };
|
|
1198
1206
|
});
|
|
1199
|
-
function
|
|
1207
|
+
function u() {
|
|
1200
1208
|
if (o) {
|
|
1201
1209
|
try {
|
|
1202
1210
|
o.dispose();
|
|
@@ -1206,18 +1214,18 @@ const Ht = (e, t) => {
|
|
|
1206
1214
|
}
|
|
1207
1215
|
}
|
|
1208
1216
|
async function g() {
|
|
1209
|
-
|
|
1217
|
+
u(), !(c.value !== "video" || !n.src) && (await He(), i.value && (o = Ve(i.value, {
|
|
1210
1218
|
controls: !0,
|
|
1211
1219
|
fill: !0,
|
|
1212
1220
|
fluid: !1,
|
|
1213
1221
|
preload: "metadata",
|
|
1214
|
-
sources:
|
|
1222
|
+
sources: ge(n.src, n.name)
|
|
1215
1223
|
}), o.ready(() => r("ready", { type: "video" })), o.on("error", () => r("error", { type: "video", message: "视频加载失败" }))));
|
|
1216
1224
|
}
|
|
1217
1225
|
function d() {
|
|
1218
1226
|
s.value = !1, r("ready", { type: "pdf" });
|
|
1219
1227
|
}
|
|
1220
|
-
function
|
|
1228
|
+
function b(m) {
|
|
1221
1229
|
s.value = !1, r("error", { type: "pdf", message: (m == null ? void 0 : m.message) || "PDF 加载失败", error: m });
|
|
1222
1230
|
}
|
|
1223
1231
|
function S() {
|
|
@@ -1230,61 +1238,61 @@ const Ht = (e, t) => {
|
|
|
1230
1238
|
error: m
|
|
1231
1239
|
});
|
|
1232
1240
|
}
|
|
1233
|
-
function
|
|
1241
|
+
function h() {
|
|
1234
1242
|
if (r("download", { src: n.src, name: a.value }), !n.src || typeof window > "u") return;
|
|
1235
1243
|
const m = document.createElement("a");
|
|
1236
|
-
m.href = n.src, m.download = a.value || `file.${
|
|
1244
|
+
m.href = n.src, m.download = a.value || `file.${x(n.name || n.src) || "bin"}`, m.target = "_blank", m.rel = "noopener noreferrer", document.body.appendChild(m), m.click(), document.body.removeChild(m);
|
|
1237
1245
|
}
|
|
1238
|
-
return
|
|
1246
|
+
return Ie(
|
|
1239
1247
|
() => [n.src, c.value],
|
|
1240
1248
|
([m, y]) => {
|
|
1241
|
-
y === "pdf" && m ? s.value = !0 : s.value = !1, y === "video" && m ? g() :
|
|
1249
|
+
y === "pdf" && m ? s.value = !0 : s.value = !1, y === "video" && m ? g() : u(), y === "image" && m && r("ready", { type: "image" });
|
|
1242
1250
|
},
|
|
1243
1251
|
{ immediate: !0 }
|
|
1244
|
-
),
|
|
1245
|
-
|
|
1252
|
+
), Ce(() => {
|
|
1253
|
+
u();
|
|
1246
1254
|
}), (m, y) => {
|
|
1247
|
-
const M =
|
|
1255
|
+
const M = re("el-button"), I = re("el-image"), C = je("loading");
|
|
1248
1256
|
return N(), v("div", {
|
|
1249
|
-
class:
|
|
1250
|
-
style:
|
|
1257
|
+
class: Fe(["mg-file-preview", [`is-${c.value}`]]),
|
|
1258
|
+
style: Re(l.value)
|
|
1251
1259
|
}, [
|
|
1252
|
-
e.src ? c.value === "unsupported" ? (N(), v("div",
|
|
1260
|
+
e.src ? c.value === "unsupported" ? (N(), v("div", zt, [
|
|
1253
1261
|
y[1] || (y[1] = E("p", { class: "mg-file-preview__fallback-title" }, "暂不支持在线预览该格式", -1)),
|
|
1254
|
-
a.value ? (N(), v("p",
|
|
1262
|
+
a.value ? (N(), v("p", Vt, Ye(a.value), 1)) : L("", !0),
|
|
1255
1263
|
R(M, {
|
|
1256
1264
|
type: "primary",
|
|
1257
|
-
onClick:
|
|
1265
|
+
onClick: h
|
|
1258
1266
|
}, {
|
|
1259
|
-
default:
|
|
1260
|
-
|
|
1267
|
+
default: ie(() => [...y[0] || (y[0] = [
|
|
1268
|
+
Be("下载文件", -1)
|
|
1261
1269
|
])]),
|
|
1262
1270
|
_: 1
|
|
1263
1271
|
})
|
|
1264
|
-
])) : c.value === "image" ? (N(), v("div",
|
|
1265
|
-
R(
|
|
1272
|
+
])) : c.value === "image" ? (N(), v("div", qt, [
|
|
1273
|
+
R(I, {
|
|
1266
1274
|
src: e.src,
|
|
1267
1275
|
fit: "contain",
|
|
1268
1276
|
"preview-src-list": [e.src],
|
|
1269
1277
|
"preview-teleported": "",
|
|
1270
1278
|
"hide-on-click-modal": ""
|
|
1271
1279
|
}, {
|
|
1272
|
-
error:
|
|
1280
|
+
error: ie(() => [...y[2] || (y[2] = [
|
|
1273
1281
|
E("div", { class: "mg-file-preview__empty" }, "图片加载失败", -1)
|
|
1274
1282
|
])]),
|
|
1275
1283
|
_: 1
|
|
1276
1284
|
}, 8, ["src", "preview-src-list"])
|
|
1277
|
-
])) : c.value === "video" ? (N(), v("div",
|
|
1278
|
-
f.value ? (N(), v("div",
|
|
1285
|
+
])) : c.value === "video" ? (N(), v("div", Xt, [
|
|
1286
|
+
f.value ? (N(), v("div", Wt, [
|
|
1279
1287
|
y[3] || (y[3] = E("span", null, " .mov 受浏览器解码能力限制(如 HEVC),若无法播放请 ", -1)),
|
|
1280
1288
|
E("button", {
|
|
1281
1289
|
type: "button",
|
|
1282
1290
|
class: "mg-file-preview__tip-link",
|
|
1283
|
-
onClick:
|
|
1291
|
+
onClick: h
|
|
1284
1292
|
}, "下载原文件"),
|
|
1285
1293
|
y[4] || (y[4] = E("span", null, "查看。", -1))
|
|
1286
1294
|
])) : L("", !0),
|
|
1287
|
-
E("div",
|
|
1295
|
+
E("div", Qt, [
|
|
1288
1296
|
(N(), v("video", {
|
|
1289
1297
|
key: e.src,
|
|
1290
1298
|
ref_key: "videoEl",
|
|
@@ -1293,89 +1301,89 @@ const Ht = (e, t) => {
|
|
|
1293
1301
|
playsinline: ""
|
|
1294
1302
|
}))
|
|
1295
1303
|
])
|
|
1296
|
-
])) : c.value === "pdf" ?
|
|
1297
|
-
R(G(
|
|
1304
|
+
])) : c.value === "pdf" ? Le((N(), v("div", Jt, [
|
|
1305
|
+
R(G(ze), {
|
|
1298
1306
|
source: e.src,
|
|
1299
1307
|
class: "mg-file-preview__pdf-embed",
|
|
1300
1308
|
onLoaded: d,
|
|
1301
|
-
onLoadingFailed:
|
|
1309
|
+
onLoadingFailed: b
|
|
1302
1310
|
}, null, 8, ["source"])
|
|
1303
1311
|
])), [
|
|
1304
1312
|
[C, s.value]
|
|
1305
|
-
]) : c.value === "word" ? (N(), v("div",
|
|
1313
|
+
]) : c.value === "word" ? (N(), v("div", Zt, [
|
|
1306
1314
|
E("div", { class: "mg-file-preview__tip" }, [
|
|
1307
1315
|
y[5] || (y[5] = E("span", null, " Word 在线预览对复杂排版(文本框、形状、绝对定位等)支持有限,可能出现内容缺失;如预览不完整请 ", -1)),
|
|
1308
1316
|
E("button", {
|
|
1309
1317
|
type: "button",
|
|
1310
1318
|
class: "mg-file-preview__tip-link",
|
|
1311
|
-
onClick:
|
|
1319
|
+
onClick: h
|
|
1312
1320
|
}, "下载原文件"),
|
|
1313
1321
|
y[6] || (y[6] = E("span", null, "查看。", -1))
|
|
1314
1322
|
]),
|
|
1315
|
-
R(G(
|
|
1323
|
+
R(G(qe), {
|
|
1316
1324
|
src: e.src,
|
|
1317
1325
|
class: "mg-file-preview__office",
|
|
1318
1326
|
onRendered: S,
|
|
1319
1327
|
onError: p
|
|
1320
1328
|
}, null, 8, ["src"])
|
|
1321
|
-
])) : c.value === "excel" ? (N(),
|
|
1329
|
+
])) : c.value === "excel" ? (N(), Ge(G(Xe), {
|
|
1322
1330
|
key: 6,
|
|
1323
1331
|
src: e.src,
|
|
1324
1332
|
class: "mg-file-preview__office",
|
|
1325
1333
|
onRendered: S,
|
|
1326
1334
|
onError: p
|
|
1327
|
-
}, null, 8, ["src"])) : L("", !0) : (N(), v("div",
|
|
1335
|
+
}, null, 8, ["src"])) : L("", !0) : (N(), v("div", Ht, "暂无预览文件"))
|
|
1328
1336
|
], 6);
|
|
1329
1337
|
};
|
|
1330
1338
|
}
|
|
1331
|
-
}), hn = /* @__PURE__ */
|
|
1339
|
+
}), hn = /* @__PURE__ */ Gt(en, [["__scopeId", "data-v-2dc0862c"]]);
|
|
1332
1340
|
export {
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1341
|
+
It as A,
|
|
1342
|
+
Sn as B,
|
|
1343
|
+
fn as C,
|
|
1344
|
+
yn as D,
|
|
1345
|
+
un as E,
|
|
1338
1346
|
hn as F,
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1347
|
+
pn as G,
|
|
1348
|
+
an as H,
|
|
1349
|
+
gn as I,
|
|
1350
|
+
vt as J,
|
|
1351
|
+
Ee as K,
|
|
1352
|
+
kt as L,
|
|
1353
|
+
Ze as M,
|
|
1354
|
+
J as N,
|
|
1355
|
+
Bt as O,
|
|
1348
1356
|
z as P,
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1357
|
+
bt as Q,
|
|
1358
|
+
Je as R,
|
|
1359
|
+
Q as S,
|
|
1360
|
+
xe as T,
|
|
1361
|
+
mn as U,
|
|
1362
|
+
Gt as _,
|
|
1363
|
+
We as a,
|
|
1364
|
+
et as b,
|
|
1365
|
+
Lt as c,
|
|
1366
|
+
x as d,
|
|
1367
|
+
V as e,
|
|
1360
1368
|
A as f,
|
|
1361
1369
|
Y as g,
|
|
1362
1370
|
Pt as h,
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1371
|
+
ye as i,
|
|
1372
|
+
Se as j,
|
|
1373
|
+
dn as k,
|
|
1366
1374
|
T as l,
|
|
1367
1375
|
w as m,
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1376
|
+
U as n,
|
|
1377
|
+
he as o,
|
|
1378
|
+
gt as p,
|
|
1371
1379
|
xt as q,
|
|
1372
1380
|
$ as r,
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1381
|
+
Qe as s,
|
|
1382
|
+
Ne as t,
|
|
1383
|
+
Et as u,
|
|
1384
|
+
Ae as v,
|
|
1385
|
+
St as w,
|
|
1378
1386
|
F as x,
|
|
1379
|
-
|
|
1380
|
-
|
|
1387
|
+
X as y,
|
|
1388
|
+
jt as z
|
|
1381
1389
|
};
|