@campus-admin/core 2.0.5 → 2.0.6
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 +18 -0
- package/dist/i18n.d.ts +4 -0
- package/dist/index.js +398 -311
- package/dist/router.d.ts +3 -1
- package/dist/stores/layout.d.ts +27 -3
- package/dist/style.css +1 -1
- package/dist/types.d.ts +4 -0
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -17,46 +17,46 @@ import "element-plus/es/components/message-box/style/css";
|
|
|
17
17
|
export * from "@campus-admin/ui";
|
|
18
18
|
// packages/core/src/storage.ts
|
|
19
19
|
var he = "ca:";
|
|
20
|
-
function
|
|
20
|
+
function U(e, t = "local") {
|
|
21
21
|
try {
|
|
22
22
|
return (t === "local" ? localStorage : sessionStorage).getItem(he + e);
|
|
23
23
|
} catch {
|
|
24
24
|
return null;
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
-
function
|
|
27
|
+
function W(e, t, n = "local") {
|
|
28
28
|
try {
|
|
29
29
|
let r = n === "local" ? localStorage : sessionStorage;
|
|
30
30
|
t === null ? r.removeItem(he + e) : r.setItem(he + e, t);
|
|
31
31
|
} catch {}
|
|
32
32
|
}
|
|
33
|
-
function
|
|
34
|
-
let n =
|
|
33
|
+
function ge(e, t = "local") {
|
|
34
|
+
let n = U(e, t);
|
|
35
35
|
if (n) try {
|
|
36
36
|
return JSON.parse(n);
|
|
37
37
|
} catch {
|
|
38
38
|
return;
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
-
function
|
|
42
|
-
|
|
41
|
+
function _e(e, t, n = "local") {
|
|
42
|
+
W(e, JSON.stringify(t), n);
|
|
43
43
|
}
|
|
44
44
|
// packages/core/src/i18n.ts
|
|
45
|
-
var
|
|
46
|
-
function
|
|
45
|
+
var ve = (e) => typeof e == "object" && !!e && !Array.isArray(e);
|
|
46
|
+
function ye(e, t) {
|
|
47
47
|
let n = { ...e };
|
|
48
48
|
for (let [e, r] of Object.entries(t)) {
|
|
49
49
|
let t = n[e];
|
|
50
|
-
n[e] =
|
|
50
|
+
n[e] = ve(t) && ve(r) ? ye(t, r) : r;
|
|
51
51
|
}
|
|
52
52
|
return n;
|
|
53
53
|
}
|
|
54
|
-
var
|
|
55
|
-
function
|
|
54
|
+
var be = "locale";
|
|
55
|
+
function xe(e) {
|
|
56
56
|
return e === "zh-CN" || e === "en-US";
|
|
57
57
|
}
|
|
58
|
-
function
|
|
59
|
-
let t =
|
|
58
|
+
function Se(e) {
|
|
59
|
+
let t = U(be), n = xe(t) ? t : e.defaultLocale ?? "zh-CN", r = Object.fromEntries(["zh-CN", "en-US"].map((t) => [t, ye(te[t], e.messages?.[t] ?? {})])), i = ne({
|
|
60
60
|
legacy: !1,
|
|
61
61
|
locale: n,
|
|
62
62
|
fallbackLocale: "zh-CN",
|
|
@@ -64,16 +64,16 @@ function Ce(e) {
|
|
|
64
64
|
});
|
|
65
65
|
return typeof document < "u" && A(() => i.global.locale.value, (e) => {
|
|
66
66
|
document.documentElement.lang = e;
|
|
67
|
-
}, { immediate: !0 }),
|
|
67
|
+
}, { immediate: !0 }), Ce = i, i;
|
|
68
68
|
}
|
|
69
|
-
var
|
|
70
|
-
function
|
|
71
|
-
return
|
|
69
|
+
var Ce;
|
|
70
|
+
function we(e, t) {
|
|
71
|
+
return Ce ? Ce.global.t(e, t ?? {}) : e;
|
|
72
72
|
}
|
|
73
|
-
function
|
|
74
|
-
|
|
73
|
+
function Te(e) {
|
|
74
|
+
W(be, e);
|
|
75
75
|
}
|
|
76
|
-
function
|
|
76
|
+
function G() {
|
|
77
77
|
let { t: e, te: t, locale: n } = z();
|
|
78
78
|
return {
|
|
79
79
|
t: e,
|
|
@@ -83,10 +83,10 @@ function W() {
|
|
|
83
83
|
};
|
|
84
84
|
}
|
|
85
85
|
// packages/core/src/CampusRoot.vue
|
|
86
|
-
var
|
|
86
|
+
var Ee = /* @__PURE__ */ d({
|
|
87
87
|
__name: "CampusRoot",
|
|
88
88
|
setup(e) {
|
|
89
|
-
let { locale: t } =
|
|
89
|
+
let { locale: t } = G();
|
|
90
90
|
return (e, n) => {
|
|
91
91
|
let r = w("router-view"), a = w("ca-config-provider");
|
|
92
92
|
return y(), i(a, { locale: D(t) }, {
|
|
@@ -97,20 +97,20 @@ var De = /* @__PURE__ */ d({
|
|
|
97
97
|
}
|
|
98
98
|
});
|
|
99
99
|
// packages/core/src/types.ts
|
|
100
|
-
function
|
|
100
|
+
function De(e) {
|
|
101
101
|
return "children" in e;
|
|
102
102
|
}
|
|
103
103
|
// packages/core/src/context.ts
|
|
104
|
-
var
|
|
105
|
-
function
|
|
106
|
-
|
|
104
|
+
var Oe;
|
|
105
|
+
function ke(e) {
|
|
106
|
+
Oe = e;
|
|
107
107
|
}
|
|
108
|
-
function
|
|
109
|
-
if (!
|
|
110
|
-
return
|
|
108
|
+
function K() {
|
|
109
|
+
if (!Oe) throw Error("[campus] 请先调用 createCampusApp()");
|
|
110
|
+
return Oe;
|
|
111
111
|
}
|
|
112
|
-
function
|
|
113
|
-
for (let t of
|
|
112
|
+
function Ae(e) {
|
|
113
|
+
for (let t of K().menus) for (let n of t.children) if (De(n)) {
|
|
114
114
|
let r = n.children.find((t) => t.key === e);
|
|
115
115
|
if (r) return { titles: [
|
|
116
116
|
t.title,
|
|
@@ -119,18 +119,18 @@ function je(e) {
|
|
|
119
119
|
] };
|
|
120
120
|
} else if (n.key === e) return { titles: [t.title, n.title] };
|
|
121
121
|
}
|
|
122
|
-
var
|
|
122
|
+
var je = [
|
|
123
123
|
"none",
|
|
124
124
|
"panel",
|
|
125
125
|
"all"
|
|
126
126
|
];
|
|
127
|
-
function
|
|
127
|
+
function Me(e) {
|
|
128
128
|
let t = [], n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set();
|
|
129
129
|
for (let o of e) {
|
|
130
130
|
if (i.has(o.key)) throw Error(`[campus] 菜单一级场景键重复:${o.key}`);
|
|
131
131
|
i.add(o.key);
|
|
132
132
|
for (let e of o.children) {
|
|
133
|
-
let i =
|
|
133
|
+
let i = De(e) ? e : void 0;
|
|
134
134
|
if (i) {
|
|
135
135
|
if (a.has(i.key)) throw Error(`[campus] 菜单组键重复:${i.key}`);
|
|
136
136
|
a.add(i.key);
|
|
@@ -145,13 +145,19 @@ function Ne(e) {
|
|
|
145
145
|
appKey: o.key,
|
|
146
146
|
groupKey: i?.key
|
|
147
147
|
};
|
|
148
|
-
e.sideCollapse != null && !
|
|
148
|
+
e.sideCollapse != null && !je.includes(e.sideCollapse) && (console.warn(`[campus] 菜单页面 sideCollapse 只能是 none / panel / all,已忽略:${a.key}`), delete e.sideCollapse), e.openMode != null && ![
|
|
149
|
+
"normal",
|
|
150
|
+
"collapsePanel",
|
|
151
|
+
"collapseAll",
|
|
152
|
+
"content",
|
|
153
|
+
"screen"
|
|
154
|
+
].includes(e.openMode) && (console.warn(`[campus] 菜单页面 openMode 无效,已忽略:${a.key}`), delete e.openMode), t.push(e);
|
|
149
155
|
}
|
|
150
156
|
}
|
|
151
157
|
}
|
|
152
158
|
return t;
|
|
153
159
|
}
|
|
154
|
-
function
|
|
160
|
+
function Ne(e) {
|
|
155
161
|
let t = {
|
|
156
162
|
home: "/",
|
|
157
163
|
login: "/login",
|
|
@@ -171,21 +177,21 @@ function Pe(e) {
|
|
|
171
177
|
])).size !== 5) throw Error("[campus] 系统页面路径不能重复");
|
|
172
178
|
return t;
|
|
173
179
|
}
|
|
174
|
-
function
|
|
175
|
-
let n = e.homeEntry === !1 ? void 0 :
|
|
180
|
+
function Pe(e, t) {
|
|
181
|
+
let n = e.homeEntry === !1 ? void 0 : Me(e.menus).find((e) => e.affix && t(e.permission)), r = !e.accountInMenu && !e.onAccountClick, i = (i) => t(i.permission) && i.key !== n?.key && (!r || i.path !== e.accountPath);
|
|
176
182
|
return {
|
|
177
183
|
home: n,
|
|
178
184
|
apps: e.menus.map((e) => ({
|
|
179
185
|
...e,
|
|
180
|
-
children: e.children.map((e) =>
|
|
186
|
+
children: e.children.map((e) => De(e) ? {
|
|
181
187
|
...e,
|
|
182
188
|
children: e.children.filter(i)
|
|
183
|
-
} : e).filter((e) =>
|
|
189
|
+
} : e).filter((e) => De(e) ? e.children.length > 0 : i(e))
|
|
184
190
|
})).filter((e) => e.children.length > 0),
|
|
185
191
|
accountStandalone: r
|
|
186
192
|
};
|
|
187
193
|
}
|
|
188
|
-
function
|
|
194
|
+
function q(e) {
|
|
189
195
|
return {
|
|
190
196
|
login: "login",
|
|
191
197
|
register: "register",
|
|
@@ -196,20 +202,20 @@ function K(e) {
|
|
|
196
202
|
};
|
|
197
203
|
}
|
|
198
204
|
// packages/core/src/stores/theme.ts
|
|
199
|
-
var
|
|
200
|
-
function
|
|
201
|
-
return
|
|
205
|
+
var Fe = "theme-mode", Ie = "box-style", Le = "user-primary";
|
|
206
|
+
function Re() {
|
|
207
|
+
return U(Ie) === "border" ? "border" : "shadow";
|
|
202
208
|
}
|
|
203
|
-
function
|
|
204
|
-
let e =
|
|
209
|
+
function ze() {
|
|
210
|
+
let e = U(Le);
|
|
205
211
|
return ce(e) ? e : void 0;
|
|
206
212
|
}
|
|
207
|
-
function
|
|
208
|
-
let e =
|
|
213
|
+
function Be() {
|
|
214
|
+
let e = U(Fe);
|
|
209
215
|
return e === "light" || e === "dark" || e === "auto" ? e : "auto";
|
|
210
216
|
}
|
|
211
|
-
var
|
|
212
|
-
let e = x({}), t = x(
|
|
217
|
+
var Ve = I("campus-theme", () => {
|
|
218
|
+
let e = x({}), t = x(Be()), r = x(Re()), i = x(ze()), a = typeof matchMedia == "function" ? matchMedia("(prefers-color-scheme: dark)") : void 0, o = x(a?.matches ?? !1);
|
|
213
219
|
a?.addEventListener("change", (e) => o.value = e.matches);
|
|
214
220
|
let s = n(() => ue(e.value)), c = n(() => e.value.tenantDefault?.locks?.includes("primary") ?? !1), l = n(() => {
|
|
215
221
|
let e = s.value.theme, t = i.value;
|
|
@@ -223,16 +229,16 @@ var He = I("campus-theme", () => {
|
|
|
223
229
|
document.documentElement.dataset.caBox = r.value;
|
|
224
230
|
});
|
|
225
231
|
function p(e) {
|
|
226
|
-
(e === void 0 || ce(e)) && (i.value = e,
|
|
232
|
+
(e === void 0 || ce(e)) && (i.value = e, W(Le, e ?? null));
|
|
227
233
|
}
|
|
228
234
|
function h(e) {
|
|
229
|
-
r.value = e,
|
|
235
|
+
r.value = e, W(Ie, e);
|
|
230
236
|
}
|
|
231
237
|
function g() {
|
|
232
|
-
return `theme-layers:${
|
|
238
|
+
return `theme-layers:${K().theme?.cacheKey ?? location.host}`;
|
|
233
239
|
}
|
|
234
240
|
function _(e) {
|
|
235
|
-
t.value = e,
|
|
241
|
+
t.value = e, W(Fe, e);
|
|
236
242
|
}
|
|
237
243
|
function v(e, t) {
|
|
238
244
|
let n = document, r = le(e, o.value) !== d.value, i = typeof matchMedia == "function" && matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
@@ -259,12 +265,12 @@ var He = I("campus-theme", () => {
|
|
|
259
265
|
}).catch(() => {});
|
|
260
266
|
}
|
|
261
267
|
function y(t, n = !0) {
|
|
262
|
-
e.value = t, n &&
|
|
268
|
+
e.value = t, n && _e(g(), t);
|
|
263
269
|
}
|
|
264
270
|
async function b() {
|
|
265
|
-
let t =
|
|
271
|
+
let t = ge(g());
|
|
266
272
|
t && (e.value = t);
|
|
267
|
-
let n =
|
|
273
|
+
let n = K().theme?.load;
|
|
268
274
|
if (n) {
|
|
269
275
|
try {
|
|
270
276
|
y(await n());
|
|
@@ -292,16 +298,16 @@ var He = I("campus-theme", () => {
|
|
|
292
298
|
};
|
|
293
299
|
});
|
|
294
300
|
// packages/core/src/copyright.ts
|
|
295
|
-
function
|
|
301
|
+
function He(e, t = (/* @__PURE__ */ new Date()).getFullYear()) {
|
|
296
302
|
return e.replaceAll("{year}", String(t));
|
|
297
303
|
}
|
|
298
304
|
// packages/core/src/pages/auth/options.ts
|
|
299
|
-
var
|
|
300
|
-
function q() {
|
|
301
|
-
return G().login ?? {};
|
|
302
|
-
}
|
|
305
|
+
var Ue = /^1[3-9]\d{9}$/;
|
|
303
306
|
function J() {
|
|
304
|
-
|
|
307
|
+
return K().login ?? {};
|
|
308
|
+
}
|
|
309
|
+
function Y() {
|
|
310
|
+
let e = K().auth;
|
|
305
311
|
return {
|
|
306
312
|
captcha: typeof e.captcha == "function",
|
|
307
313
|
register: typeof e.register == "function" && typeof e.sendSmsCode == "function",
|
|
@@ -309,37 +315,37 @@ function J() {
|
|
|
309
315
|
forgot: typeof e.resetPassword == "function" && typeof e.sendSmsCode == "function"
|
|
310
316
|
};
|
|
311
317
|
}
|
|
312
|
-
function
|
|
313
|
-
return typeof e == "string" && e.startsWith("/") && !e.startsWith("//") ? e :
|
|
318
|
+
function We(e) {
|
|
319
|
+
return typeof e == "string" && e.startsWith("/") && !e.startsWith("//") ? e : Ne(K()).home;
|
|
314
320
|
}
|
|
315
321
|
// packages/core/src/pages/auth/AuthShell.vue?vue&type=script&setup=true&lang.ts
|
|
316
|
-
var
|
|
322
|
+
var Ge = {
|
|
317
323
|
key: 0,
|
|
318
324
|
class: "ca-auth__title"
|
|
319
|
-
},
|
|
325
|
+
}, Ke = ["src"], qe = { class: "ca-auth__qrcode" }, Je = ["src", "alt"], Ye = {
|
|
320
326
|
key: 0,
|
|
321
327
|
class: "ca-auth__caption"
|
|
322
|
-
},
|
|
328
|
+
}, Xe = { class: "ca-auth__site" }, Ze = {
|
|
323
329
|
key: 0,
|
|
324
330
|
class: "ca-auth__caption"
|
|
325
|
-
},
|
|
331
|
+
}, Qe = { class: "ca-auth__main" }, $e = { class: "ca-auth__brand" }, et = ["src"], tt = {
|
|
326
332
|
class: "ca-auth__tabs",
|
|
327
333
|
role: "tablist"
|
|
328
|
-
},
|
|
334
|
+
}, nt = [
|
|
329
335
|
"aria-selected",
|
|
330
336
|
"tabindex",
|
|
331
337
|
"onClick",
|
|
332
338
|
"onKeydown"
|
|
333
|
-
],
|
|
339
|
+
], rt = {
|
|
334
340
|
class: "ca-auth__body",
|
|
335
341
|
role: "tabpanel"
|
|
336
|
-
},
|
|
342
|
+
}, it = {
|
|
337
343
|
key: 0,
|
|
338
344
|
class: "ca-auth__footer"
|
|
339
|
-
},
|
|
345
|
+
}, at = {
|
|
340
346
|
key: 0,
|
|
341
347
|
class: "ca-auth__version"
|
|
342
|
-
},
|
|
348
|
+
}, ot = /*@__PURE__*/ d({
|
|
343
349
|
__name: "AuthShell",
|
|
344
350
|
props: {
|
|
345
351
|
tabs: {},
|
|
@@ -348,13 +354,13 @@ var Ke = {
|
|
|
348
354
|
},
|
|
349
355
|
emits: ["update:active"],
|
|
350
356
|
setup(t, { emit: r }) {
|
|
351
|
-
let c = t, u = r, { t: d, label: f } =
|
|
357
|
+
let c = t, u = r, { t: d, label: f } = G(), p = K().brand, m = J(), _ = Ve(), v = n(() => f(_.theme.siteName ?? p.name)), b = n(() => _.theme.logo ?? p.logo), x = n(() => m.panel?.logo ?? b.value), w = n(() => m.panel?.qrcode), T = n(() => {
|
|
352
358
|
let e = m.panel?.caption ?? p.subtitle;
|
|
353
359
|
return e ? f(e) : "";
|
|
354
360
|
}), O = n(() => m.panel?.title ? f(m.panel.title) : ""), k = n(() => m.panel?.background), A = (e) => typeof e == "number" && Number.isFinite(e) && e > 0 ? `${e}px` : typeof e == "string" && /^[\d.]+(px|rem|em|%)$/.test(e) ? e : void 0, j = n(() => {
|
|
355
361
|
let e = m.card, t = {}, n = A(e?.width), r = A(e?.minHeight), i = A(e?.panelWidth), a = A(e?.radius);
|
|
356
362
|
return n && (t["--ca-auth-card-width"] = n), r && (t["--ca-auth-card-min-height"] = r), i && (t["--ca-auth-panel-width"] = i), a && (t["--ca-auth-card-radius"] = a), t;
|
|
357
|
-
}), N = n(() => m.background ?? "var(--ca-login-bg)"), P = n(() => m.footer ? m.footer.map((e) =>
|
|
363
|
+
}), N = n(() => m.background ?? "var(--ca-login-bg)"), P = n(() => m.footer ? m.footer.map((e) => He(f(e))) : p.copyright ? He(f(p.copyright)).split("\n").filter(Boolean) : []);
|
|
358
364
|
function F(e, t) {
|
|
359
365
|
if (e.key !== "ArrowRight" && e.key !== "ArrowLeft") return;
|
|
360
366
|
let n = (t + (e.key === "ArrowRight" ? 1 : -1) + c.tabs.length) % c.tabs.length, r = c.tabs[n];
|
|
@@ -370,24 +376,24 @@ var Ke = {
|
|
|
370
376
|
class: "ca-auth__panel",
|
|
371
377
|
style: g(k.value ? { background: k.value } : void 0)
|
|
372
378
|
}, [
|
|
373
|
-
O.value && w.value ? (y(), o("h2",
|
|
379
|
+
O.value && w.value ? (y(), o("h2", Ge, E(O.value), 1)) : a("v-if", !0),
|
|
374
380
|
x.value ? (y(), o("img", {
|
|
375
381
|
key: 1,
|
|
376
382
|
src: x.value,
|
|
377
383
|
alt: "",
|
|
378
384
|
class: "ca-auth__logo"
|
|
379
|
-
}, null, 8,
|
|
380
|
-
w.value ? (y(), o(e, { key: 2 }, [s("div",
|
|
385
|
+
}, null, 8, Ke)) : a("v-if", !0),
|
|
386
|
+
w.value ? (y(), o(e, { key: 2 }, [s("div", qe, [s("img", {
|
|
381
387
|
src: w.value,
|
|
382
388
|
alt: D(d)("campus.auth.qrcodeAlt")
|
|
383
|
-
}, null, 8,
|
|
384
|
-
], 4), s("section",
|
|
385
|
-
s("div",
|
|
389
|
+
}, null, 8, Je)]), T.value ? (y(), o("p", Ye, E(T.value), 1)) : a("v-if", !0)], 64)) : (y(), o(e, { key: 3 }, [s("h2", Xe, E(O.value || v.value), 1), T.value ? (y(), o("p", Ze, E(T.value), 1)) : a("v-if", !0)], 64))
|
|
390
|
+
], 4), s("section", Qe, [
|
|
391
|
+
s("div", $e, [b.value ? (y(), o("img", {
|
|
386
392
|
key: 0,
|
|
387
393
|
src: b.value,
|
|
388
394
|
alt: ""
|
|
389
|
-
}, null, 8,
|
|
390
|
-
s("div",
|
|
395
|
+
}, null, 8, et)) : a("v-if", !0), s("span", null, E(v.value), 1)]),
|
|
396
|
+
s("div", tt, [(y(!0), o(e, null, S(t.tabs, (n, r) => (y(), o(e, { key: n.key }, [n.to && !t.preview ? (y(), i(D(B), {
|
|
391
397
|
key: 0,
|
|
392
398
|
to: n.to,
|
|
393
399
|
role: "tab",
|
|
@@ -406,19 +412,19 @@ var Ke = {
|
|
|
406
412
|
tabindex: n.key === t.active ? 0 : -1,
|
|
407
413
|
onClick: (e) => n.to ? void 0 : u("update:active", n.key),
|
|
408
414
|
onKeydown: (e) => F(e, r)
|
|
409
|
-
}, E(n.label), 43,
|
|
410
|
-
s("div",
|
|
411
|
-
P.value.length ? (y(), o("div",
|
|
412
|
-
])], 4), D(m).version ? (y(), o("span",
|
|
415
|
+
}, E(n.label), 43, nt))], 64))), 128))]),
|
|
416
|
+
s("div", rt, [C(n.$slots, "default", {}, void 0, !0)]),
|
|
417
|
+
P.value.length ? (y(), o("div", it, [(y(!0), o(e, null, S(P.value, (e) => (y(), o("p", { key: e }, E(e), 1))), 128))])) : a("v-if", !0)
|
|
418
|
+
])], 4), D(m).version ? (y(), o("span", at, E(D(m).version), 1)) : a("v-if", !0)], 4)], 2));
|
|
413
419
|
}
|
|
414
|
-
}),
|
|
420
|
+
}), X = (e, t) => {
|
|
415
421
|
let n = e.__vccOpts || e;
|
|
416
422
|
for (let [e, r] of t) n[e] = r;
|
|
417
423
|
return n;
|
|
418
|
-
},
|
|
419
|
-
let e = x(!1), t = x("desktop"), r = x(!1), i = x(!1), a = x(
|
|
424
|
+
}, st = /*#__PURE__*/ X(ot, [["__scopeId", "data-v-df817220"]]), ct = "side-collapsed", Z = I("campus-layout", () => {
|
|
425
|
+
let e = x(!1), t = x("desktop"), r = x(!1), i = x(!1), a = x(U(ct) === "1"), o = x(null), s = n(() => o.value ?? a.value), c = x(!1), l = n(() => c.value && t.value === "desktop");
|
|
420
426
|
function u() {
|
|
421
|
-
o.value === null ? (a.value = !a.value,
|
|
427
|
+
o.value === null ? (a.value = !a.value, W(ct, a.value ? "1" : "0")) : o.value = !o.value;
|
|
422
428
|
}
|
|
423
429
|
function d() {
|
|
424
430
|
c.value = !1, o.value = null;
|
|
@@ -426,32 +432,91 @@ var Ke = {
|
|
|
426
432
|
function f(e = "none") {
|
|
427
433
|
o.value = e === "panel" || null, c.value = e === "all";
|
|
428
434
|
}
|
|
429
|
-
|
|
430
|
-
|
|
435
|
+
let p = "normal", m = null, h = !1, g, _ = !1, v = !1, y = !1, b = x(!1);
|
|
436
|
+
function S() {
|
|
437
|
+
m !== null && (e.value = m);
|
|
438
|
+
}
|
|
439
|
+
function C() {
|
|
440
|
+
h && document.fullscreenElement === document.documentElement && (h = !1, document.exitFullscreen().catch(() => {
|
|
441
|
+
h = document.fullscreenElement === document.documentElement;
|
|
442
|
+
}).finally(() => {
|
|
443
|
+
p === "screen" && !document.fullscreenElement && (v = !0, w());
|
|
444
|
+
}));
|
|
445
|
+
}
|
|
446
|
+
function w() {
|
|
447
|
+
_ || (p === "screen" ? y || (v || !document.fullscreenElement ? (e.value = !0, b.value = !0) : (S(), b.value = !1)) : C());
|
|
448
|
+
}
|
|
449
|
+
function T() {
|
|
450
|
+
if (_ = !0, document.fullscreenElement) v = !1;
|
|
451
|
+
else if (!g) {
|
|
452
|
+
v = !1;
|
|
453
|
+
try {
|
|
454
|
+
g = document.documentElement.requestFullscreen().then(() => {
|
|
455
|
+
v = !1, h = document.fullscreenElement === document.documentElement;
|
|
456
|
+
}, () => {
|
|
457
|
+
v = !0;
|
|
458
|
+
}).finally(() => {
|
|
459
|
+
g = void 0, w();
|
|
460
|
+
});
|
|
461
|
+
} catch {
|
|
462
|
+
v = !0;
|
|
463
|
+
}
|
|
464
|
+
}
|
|
431
465
|
}
|
|
432
|
-
function
|
|
466
|
+
function E() {
|
|
467
|
+
_ = !1, p !== "screen" && C();
|
|
468
|
+
}
|
|
469
|
+
function D(t, n) {
|
|
470
|
+
p = t ?? "normal", y = !1, b.value = !1, f(t == null ? n : t === "collapsePanel" ? "panel" : t === "collapseAll" ? "all" : "none");
|
|
471
|
+
let r = p === "content" || p === "screen";
|
|
472
|
+
r && m === null && (m = e.value), r || (S(), m = null), p === "content" && (e.value = !0), p === "screen" && !_ && T(), _ = !1, p === "screen" ? w() : C();
|
|
473
|
+
}
|
|
474
|
+
function O() {
|
|
475
|
+
y = !0, h = !1, b.value = !1;
|
|
476
|
+
}
|
|
477
|
+
function k() {
|
|
478
|
+
h && document.fullscreenElement !== document.documentElement && (h = !1, y = !0, b.value = !1);
|
|
479
|
+
}
|
|
480
|
+
function A() {
|
|
481
|
+
y = !1, T(), _ = !1, g || w();
|
|
482
|
+
}
|
|
483
|
+
function j() {
|
|
484
|
+
b.value = !1;
|
|
485
|
+
}
|
|
486
|
+
function M() {
|
|
487
|
+
y = !0, b.value = !1, e.value = !e.value;
|
|
488
|
+
}
|
|
489
|
+
function N(e) {
|
|
433
490
|
t.value = e, e !== "phone" && (r.value = !1), e !== "pad" && (i.value = !1);
|
|
434
491
|
}
|
|
435
|
-
function
|
|
492
|
+
function P() {
|
|
436
493
|
r.value = !1;
|
|
437
494
|
}
|
|
438
|
-
function
|
|
495
|
+
function F() {
|
|
439
496
|
r.value = !0;
|
|
440
497
|
}
|
|
441
|
-
function
|
|
498
|
+
function I() {
|
|
442
499
|
i.value = !1;
|
|
443
500
|
}
|
|
444
|
-
function
|
|
501
|
+
function L() {
|
|
445
502
|
i.value = !0;
|
|
446
503
|
}
|
|
447
|
-
function
|
|
504
|
+
function R() {
|
|
448
505
|
r.value = !1, i.value = !1;
|
|
449
506
|
}
|
|
450
|
-
function
|
|
451
|
-
e.value = !1, f("none"),
|
|
507
|
+
function ee() {
|
|
508
|
+
D("normal"), e.value = !1, f("none"), R();
|
|
452
509
|
}
|
|
453
510
|
return {
|
|
454
|
-
reset:
|
|
511
|
+
reset: ee,
|
|
512
|
+
pageScreenPrompt: b,
|
|
513
|
+
preparePageScreen: T,
|
|
514
|
+
cancelPageScreen: E,
|
|
515
|
+
applyPageOpenMode: D,
|
|
516
|
+
pageScreenManual: O,
|
|
517
|
+
syncPageScreen: k,
|
|
518
|
+
retryPageScreen: A,
|
|
519
|
+
dismissPageScreenPrompt: j,
|
|
455
520
|
contentFullscreen: e,
|
|
456
521
|
mode: t,
|
|
457
522
|
mobileMenuOpen: r,
|
|
@@ -464,38 +529,38 @@ var Ke = {
|
|
|
464
529
|
toggleSidePanel: u,
|
|
465
530
|
showSide: d,
|
|
466
531
|
applySideCollapse: f,
|
|
467
|
-
toggleContentFullscreen:
|
|
468
|
-
setMode:
|
|
469
|
-
closeMobileMenu:
|
|
470
|
-
openMobileMenu:
|
|
471
|
-
closePadPanel:
|
|
472
|
-
openPadPanel:
|
|
473
|
-
closeOverlays:
|
|
532
|
+
toggleContentFullscreen: M,
|
|
533
|
+
setMode: N,
|
|
534
|
+
closeMobileMenu: P,
|
|
535
|
+
openMobileMenu: F,
|
|
536
|
+
closePadPanel: I,
|
|
537
|
+
openPadPanel: L,
|
|
538
|
+
closeOverlays: R
|
|
474
539
|
};
|
|
475
540
|
});
|
|
476
541
|
// packages/core/src/tabs-policy.ts
|
|
477
|
-
function
|
|
542
|
+
function lt(e, t, n = Date.now()) {
|
|
478
543
|
return {
|
|
479
544
|
...e,
|
|
480
545
|
[t]: Math.max(n, ...Object.values(e).map((e) => e + 1))
|
|
481
546
|
};
|
|
482
547
|
}
|
|
483
|
-
function
|
|
548
|
+
function ut(e, t, n, r, i) {
|
|
484
549
|
let a = e.filter((e) => !r.includes(e));
|
|
485
550
|
if (!(a.length <= i)) return a.filter((e) => e !== n).reduce((e, n) => e === void 0 || (t[n] ?? 0) < (t[e] ?? 0) ? n : e, void 0);
|
|
486
551
|
}
|
|
487
552
|
// packages/core/src/stores/tabs.ts
|
|
488
|
-
var
|
|
489
|
-
let e =
|
|
553
|
+
var dt = "tabs", ft = I("campus-tabs", () => {
|
|
554
|
+
let e = Me(K().menus), t = new Set(e.map((e) => e.key)), r = e.filter((e) => e.affix).map((e) => e.key), i = ge(dt, "session"), a = !Array.isArray(i) && Array.isArray(i?.affix) ? i.affix : [], o = x(a.filter((e) => t.has(e) && !r.includes(e))), s = n(() => [...r, ...o.value]), c = K().maxTabs, l = typeof c == "number" && Number.isFinite(c) ? Math.max(1, Math.floor(c)) : 20, u = (Array.isArray(i) ? i : Array.isArray(i?.visited) ? i.visited : []).filter((e) => typeof e == "string" && t.has(e)), d = x([.../* @__PURE__ */ new Set([...s.value, ...u])]), f = !Array.isArray(i) && i?.active && typeof i.active == "object" ? i.active : {}, p = x(Object.fromEntries(Object.entries(f).filter(([e, n]) => t.has(e) && typeof n == "number" && Number.isFinite(n))));
|
|
490
555
|
for (let [e, t] of d.value.entries()) Number.isFinite(p.value[t]) || (p.value[t] = e + 1);
|
|
491
556
|
for (;;) {
|
|
492
|
-
let e =
|
|
557
|
+
let e = ut(d.value, p.value, "", s.value, l);
|
|
493
558
|
if (!e) break;
|
|
494
559
|
d.value.splice(d.value.indexOf(e), 1), delete p.value[e];
|
|
495
560
|
}
|
|
496
561
|
let h = x({}), g = x(null), _ = n(() => d.value.filter((e) => e !== g.value));
|
|
497
562
|
function v() {
|
|
498
|
-
p.value = Object.fromEntries(d.value.map((e) => [e, p.value[e] ?? 0])),
|
|
563
|
+
p.value = Object.fromEntries(d.value.map((e) => [e, p.value[e] ?? 0])), _e(dt, {
|
|
499
564
|
visited: d.value,
|
|
500
565
|
active: p.value,
|
|
501
566
|
affix: o.value
|
|
@@ -503,8 +568,8 @@ var ft = "tabs", pt = I("campus-tabs", () => {
|
|
|
503
568
|
}
|
|
504
569
|
function y(e) {
|
|
505
570
|
if (!t.has(e)) return;
|
|
506
|
-
d.value.includes(e) || d.value.push(e), p.value =
|
|
507
|
-
let n =
|
|
571
|
+
d.value.includes(e) || d.value.push(e), p.value = lt(p.value, e);
|
|
572
|
+
let n = ut(d.value, p.value, e, s.value, l);
|
|
508
573
|
n && d.value.splice(d.value.indexOf(n), 1), v();
|
|
509
574
|
}
|
|
510
575
|
function b(e) {
|
|
@@ -552,8 +617,8 @@ var ft = "tabs", pt = I("campus-tabs", () => {
|
|
|
552
617
|
refresh: E,
|
|
553
618
|
setAffix: D
|
|
554
619
|
};
|
|
555
|
-
}),
|
|
556
|
-
let e =
|
|
620
|
+
}), pt = "session", Q = I("campus-session", () => {
|
|
621
|
+
let e = ge(pt, "session"), t = x(e?.token ?? ""), r = x(e?.user), i = n(() => !!(t.value && r.value));
|
|
557
622
|
function a(e) {
|
|
558
623
|
if (!e) return !0;
|
|
559
624
|
let t = r.value?.permissions;
|
|
@@ -563,28 +628,28 @@ var ft = "tabs", pt = I("campus-tabs", () => {
|
|
|
563
628
|
r.value && (r.value = {
|
|
564
629
|
...r.value,
|
|
565
630
|
permissions: e
|
|
566
|
-
},
|
|
631
|
+
}, _e(pt, {
|
|
567
632
|
token: t.value,
|
|
568
633
|
user: r.value
|
|
569
634
|
}, "session"));
|
|
570
635
|
}
|
|
571
636
|
async function s(e) {
|
|
572
|
-
c(await
|
|
637
|
+
c(await K().auth.login(e));
|
|
573
638
|
}
|
|
574
639
|
function c(e) {
|
|
575
|
-
t.value = e.token, r.value = e.user,
|
|
640
|
+
t.value = e.token, r.value = e.user, _e(pt, e, "session");
|
|
576
641
|
}
|
|
577
642
|
async function l() {
|
|
578
643
|
try {
|
|
579
|
-
await
|
|
644
|
+
await K().auth.logout?.();
|
|
580
645
|
} catch (e) {
|
|
581
646
|
console.warn("[campus] 退出时通知服务端失败,已清除本地登录态:", e);
|
|
582
647
|
} finally {
|
|
583
|
-
t.value = "", r.value = void 0,
|
|
648
|
+
t.value = "", r.value = void 0, W(pt, null, "session"), ft().reset(), Z().reset();
|
|
584
649
|
}
|
|
585
650
|
}
|
|
586
651
|
function u() {
|
|
587
|
-
t.value = "", r.value = void 0,
|
|
652
|
+
t.value = "", r.value = void 0, W(pt, null, "session"), ft().reset(), Z().reset();
|
|
588
653
|
}
|
|
589
654
|
return {
|
|
590
655
|
token: t,
|
|
@@ -597,7 +662,7 @@ var ft = "tabs", pt = I("campus-tabs", () => {
|
|
|
597
662
|
logout: l,
|
|
598
663
|
expire: u
|
|
599
664
|
};
|
|
600
|
-
}),
|
|
665
|
+
}), mt = {
|
|
601
666
|
class: "ca-auth-icon",
|
|
602
667
|
viewBox: "0 0 24 24",
|
|
603
668
|
width: "16",
|
|
@@ -608,7 +673,7 @@ var ft = "tabs", pt = I("campus-tabs", () => {
|
|
|
608
673
|
"stroke-linecap": "round",
|
|
609
674
|
"stroke-linejoin": "round",
|
|
610
675
|
"aria-hidden": "true"
|
|
611
|
-
},
|
|
676
|
+
}, ht = ["d"], $ = /* @__PURE__ */ d({
|
|
612
677
|
__name: "AuthIcon",
|
|
613
678
|
props: { name: {} },
|
|
614
679
|
setup(e) {
|
|
@@ -619,13 +684,13 @@ var ft = "tabs", pt = I("campus-tabs", () => {
|
|
|
619
684
|
shield: "M12 3l7 3v5c0 4.5-3 8-7 10-4-2-7-5.500-7-10V6l7-3Zm-3 9 2.500 2.500L15 10",
|
|
620
685
|
message: "M4 5h16v11H9l-4 3.500V16H4z"
|
|
621
686
|
};
|
|
622
|
-
return (n, r) => (y(), o("svg",
|
|
687
|
+
return (n, r) => (y(), o("svg", mt, [s("path", { d: t[e.name] }, null, 8, ht)]));
|
|
623
688
|
}
|
|
624
|
-
}),
|
|
689
|
+
}), gt = { class: "ca-auth-row" }, _t = [
|
|
625
690
|
"title",
|
|
626
691
|
"aria-label",
|
|
627
692
|
"disabled"
|
|
628
|
-
],
|
|
693
|
+
], vt = ["src"], yt = { key: 1 }, bt = /* @__PURE__ */ d({
|
|
629
694
|
__name: "CaptchaField",
|
|
630
695
|
props: /*@__PURE__*/ p({ scene: {} }, {
|
|
631
696
|
code: { default: "" },
|
|
@@ -635,11 +700,11 @@ var ft = "tabs", pt = I("campus-tabs", () => {
|
|
|
635
700
|
}),
|
|
636
701
|
emits: ["update:code", "update:captchaKey"],
|
|
637
702
|
setup(e, { expose: t }) {
|
|
638
|
-
let n = e, r = O(e, "code"), i = O(e, "captchaKey"), { t: c, label: l } =
|
|
703
|
+
let n = e, r = O(e, "code"), i = O(e, "captchaKey"), { t: c, label: l } = G(), d = J().fields?.captcha, f = x(""), p = x(!1), m = x(!1);
|
|
639
704
|
async function h() {
|
|
640
705
|
m.value = !0;
|
|
641
706
|
try {
|
|
642
|
-
let e = await
|
|
707
|
+
let e = await K().auth.captcha(n.scene);
|
|
643
708
|
i.value = e.key, f.value = e.image, p.value = !1;
|
|
644
709
|
} catch {
|
|
645
710
|
f.value = "", p.value = !0;
|
|
@@ -649,7 +714,7 @@ var ft = "tabs", pt = I("campus-tabs", () => {
|
|
|
649
714
|
}
|
|
650
715
|
return v(h), t({ refresh: h }), (e, t) => {
|
|
651
716
|
let n = w("ca-input");
|
|
652
|
-
return y(), o("div",
|
|
717
|
+
return y(), o("div", gt, [u(n, {
|
|
653
718
|
modelValue: r.value,
|
|
654
719
|
"onUpdate:modelValue": t[0] ||= (e) => r.value = e,
|
|
655
720
|
placeholder: D(d)?.placeholder ? D(l)(D(d).placeholder) : D(c)("campus.auth.captchaPlaceholder"),
|
|
@@ -657,7 +722,7 @@ var ft = "tabs", pt = I("campus-tabs", () => {
|
|
|
657
722
|
autocomplete: "off",
|
|
658
723
|
maxlength: D(d)?.maxlength ?? 8
|
|
659
724
|
}, {
|
|
660
|
-
prefix: M(() => [u(
|
|
725
|
+
prefix: M(() => [u($, { name: "shield" })]),
|
|
661
726
|
_: 1
|
|
662
727
|
}, 8, [
|
|
663
728
|
"modelValue",
|
|
@@ -675,17 +740,17 @@ var ft = "tabs", pt = I("campus-tabs", () => {
|
|
|
675
740
|
key: 0,
|
|
676
741
|
src: f.value,
|
|
677
742
|
alt: ""
|
|
678
|
-
}, null, 8,
|
|
743
|
+
}, null, 8, vt)) : p.value ? (y(), o("span", yt, E(D(c)("campus.auth.captchaFailed")), 1)) : a("v-if", !0)], 8, _t)]);
|
|
679
744
|
};
|
|
680
745
|
}
|
|
681
|
-
}),
|
|
746
|
+
}), xt = {
|
|
682
747
|
key: 1,
|
|
683
748
|
class: "ca-auth-links"
|
|
684
|
-
},
|
|
749
|
+
}, St = { class: "ca-auth-help" }, Ct = /* @__PURE__ */ d({
|
|
685
750
|
__name: "LoginForm",
|
|
686
751
|
props: { preview: { type: Boolean } },
|
|
687
752
|
setup(t) {
|
|
688
|
-
let r = t, c = V(), d = H(), f =
|
|
753
|
+
let r = t, c = V(), d = H(), f = Q(), { t: p, label: m } = G(), h = Y(), g = J(), _ = g.fields ?? {}, v = b({
|
|
689
754
|
username: "",
|
|
690
755
|
password: "",
|
|
691
756
|
captcha: ""
|
|
@@ -731,7 +796,7 @@ var ft = "tabs", pt = I("campus-tabs", () => {
|
|
|
731
796
|
key: C.value,
|
|
732
797
|
code: v.captcha
|
|
733
798
|
} : void 0
|
|
734
|
-
}), await d.replace(
|
|
799
|
+
}), await d.replace(We(c.query.redirect));
|
|
735
800
|
} catch (e) {
|
|
736
801
|
A.value = e instanceof Error && e.message ? e.message : p("campus.login.failed"), T.value?.refresh();
|
|
737
802
|
} finally {
|
|
@@ -775,7 +840,7 @@ var ft = "tabs", pt = I("campus-tabs", () => {
|
|
|
775
840
|
"aria-label": D(p)("campus.login.username"),
|
|
776
841
|
autocomplete: "username"
|
|
777
842
|
}, {
|
|
778
|
-
prefix: M(() => [u(
|
|
843
|
+
prefix: M(() => [u($, { name: "user" })]),
|
|
779
844
|
_: 1
|
|
780
845
|
}, 8, [
|
|
781
846
|
"modelValue",
|
|
@@ -797,7 +862,7 @@ var ft = "tabs", pt = I("campus-tabs", () => {
|
|
|
797
862
|
"aria-label": D(p)("campus.login.password"),
|
|
798
863
|
autocomplete: "current-password"
|
|
799
864
|
}, {
|
|
800
|
-
prefix: M(() => [u(
|
|
865
|
+
prefix: M(() => [u($, { name: "lock" })]),
|
|
801
866
|
_: 1
|
|
802
867
|
}, 8, [
|
|
803
868
|
"modelValue",
|
|
@@ -811,7 +876,7 @@ var ft = "tabs", pt = I("campus-tabs", () => {
|
|
|
811
876
|
key: 0,
|
|
812
877
|
prop: "captcha"
|
|
813
878
|
}, {
|
|
814
|
-
default: M(() => [u(
|
|
879
|
+
default: M(() => [u(bt, {
|
|
815
880
|
ref_key: "captchaRef",
|
|
816
881
|
ref: T,
|
|
817
882
|
code: v.captcha,
|
|
@@ -835,24 +900,24 @@ var ft = "tabs", pt = I("campus-tabs", () => {
|
|
|
835
900
|
]),
|
|
836
901
|
_: 1
|
|
837
902
|
}, 8, ["model", "rules"]),
|
|
838
|
-
ee.value ? (y(), o("div",
|
|
903
|
+
ee.value ? (y(), o("div", xt, [D(h).forgot ? (y(), i(D(B), {
|
|
839
904
|
key: 0,
|
|
840
|
-
to: { name: D(
|
|
905
|
+
to: { name: D(q)(D(K)()).forgot },
|
|
841
906
|
onClick: R
|
|
842
907
|
}, {
|
|
843
908
|
default: M(() => [l(E(D(p)("campus.auth.forgotLink")), 1)]),
|
|
844
909
|
_: 1
|
|
845
910
|
}, 8, ["to"])) : a("v-if", !0), D(h).register ? (y(), i(D(B), {
|
|
846
911
|
key: 1,
|
|
847
|
-
to: { name: D(
|
|
912
|
+
to: { name: D(q)(D(K)()).register },
|
|
848
913
|
onClick: R
|
|
849
914
|
}, {
|
|
850
915
|
default: M(() => [l(E(D(p)("campus.auth.registerLink")), 1)]),
|
|
851
916
|
_: 1
|
|
852
917
|
}, 8, ["to"])) : a("v-if", !0)])) : a("v-if", !0),
|
|
853
|
-
s("div",
|
|
918
|
+
s("div", St, [s("h3", null, E(D(p)("campus.auth.helpTitle")), 1), s("ol", null, [(y(!0), o(e, null, S(F.value, (t, n) => (y(), o("li", { key: n }, [(y(!0), o(e, null, S(t, (t, n) => (y(), o(e, { key: n }, [t === null ? D(h).forgot ? (y(), i(D(B), {
|
|
854
919
|
key: 1,
|
|
855
|
-
to: { name: D(
|
|
920
|
+
to: { name: D(q)(D(K)()).forgot },
|
|
856
921
|
onClick: R
|
|
857
922
|
}, {
|
|
858
923
|
default: M(() => [l(E(D(p)("campus.auth.findPassword")), 1)]),
|
|
@@ -863,7 +928,7 @@ var ft = "tabs", pt = I("campus-tabs", () => {
|
|
|
863
928
|
}
|
|
864
929
|
});
|
|
865
930
|
// packages/core/src/pages/auth/wechat-host.ts
|
|
866
|
-
function
|
|
931
|
+
function wt(e, t) {
|
|
867
932
|
let n, r = !1, i = () => {
|
|
868
933
|
if (!r) {
|
|
869
934
|
r = !0;
|
|
@@ -890,75 +955,75 @@ function Tt(e, t) {
|
|
|
890
955
|
};
|
|
891
956
|
}
|
|
892
957
|
// packages/core/src/pages/auth/WechatPane.vue?vue&type=script&setup=true&lang.ts
|
|
893
|
-
var
|
|
958
|
+
var Tt = {
|
|
894
959
|
key: 0,
|
|
895
960
|
class: "ca-auth-wechat"
|
|
896
|
-
},
|
|
961
|
+
}, Et = {
|
|
897
962
|
key: 0,
|
|
898
963
|
class: "ca-auth-wechat__failed",
|
|
899
964
|
role: "alert"
|
|
900
|
-
},
|
|
965
|
+
}, Dt = {
|
|
901
966
|
key: 1,
|
|
902
967
|
class: "ca-auth-wechat"
|
|
903
|
-
},
|
|
968
|
+
}, Ot = { class: "ca-auth-wechat__code" }, kt = ["src", "alt"], At = ["aria-label"], jt = { class: "ca-auth-wechat__hint" }, Mt = {
|
|
904
969
|
key: 0,
|
|
905
970
|
class: "ca-auth-wechat__note"
|
|
906
|
-
},
|
|
971
|
+
}, Nt = /* @__PURE__ */ d({
|
|
907
972
|
__name: "WechatPane",
|
|
908
973
|
props: { preview: { type: Boolean } },
|
|
909
974
|
setup(e) {
|
|
910
|
-
let t = e, { t: r } =
|
|
975
|
+
let t = e, { t: r } = G(), i = n(() => J().panel?.qrcode), d = !t.preview && Y().wechat, f = x(), p = x(!1), h;
|
|
911
976
|
function g() {
|
|
912
977
|
h?.release(), h = void 0;
|
|
913
978
|
}
|
|
914
979
|
async function b() {
|
|
915
|
-
g(), p.value = !1, await m(), f.value && (h =
|
|
980
|
+
g(), p.value = !1, await m(), f.value && (h = wt(K().auth.wechat.mount, f.value), p.value = !h.ok);
|
|
916
981
|
}
|
|
917
982
|
return v(() => {
|
|
918
983
|
d && b();
|
|
919
984
|
}), _(g), (e, t) => {
|
|
920
985
|
let n = w("ca-button");
|
|
921
|
-
return D(d) ? (y(), o("div",
|
|
986
|
+
return D(d) ? (y(), o("div", Tt, [N(s("div", {
|
|
922
987
|
ref_key: "host",
|
|
923
988
|
ref: f,
|
|
924
989
|
class: "ca-auth-wechat__host"
|
|
925
|
-
}, null, 512), [[k, !p.value]]), p.value ? (y(), o("div",
|
|
990
|
+
}, null, 512), [[k, !p.value]]), p.value ? (y(), o("div", Et, [s("p", null, E(D(r)("campus.auth.wechatMountFailed")), 1), u(n, { onClick: b }, {
|
|
926
991
|
default: M(() => [l(E(D(r)("campus.auth.wechatRetry")), 1)]),
|
|
927
992
|
_: 1
|
|
928
|
-
})])) : a("v-if", !0)])) : (y(), o("div",
|
|
929
|
-
s("div",
|
|
993
|
+
})])) : a("v-if", !0)])) : (y(), o("div", Dt, [
|
|
994
|
+
s("div", Ot, [i.value ? (y(), o("img", {
|
|
930
995
|
key: 0,
|
|
931
996
|
src: i.value,
|
|
932
997
|
alt: D(r)("campus.auth.qrcodeAlt")
|
|
933
|
-
}, null, 8,
|
|
998
|
+
}, null, 8, kt)) : (y(), o("svg", {
|
|
934
999
|
key: 1,
|
|
935
1000
|
viewBox: "0 0 100 100",
|
|
936
1001
|
role: "img",
|
|
937
1002
|
"aria-label": D(r)("campus.auth.qrcodeAlt")
|
|
938
|
-
}, [...t[0] ||= [c("<rect x=\"8\" y=\"8\" width=\"26\" height=\"26\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"5\"></rect><rect x=\"66\" y=\"8\" width=\"26\" height=\"26\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"5\"></rect><rect x=\"8\" y=\"66\" width=\"26\" height=\"26\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"5\"></rect><rect x=\"16\" y=\"16\" width=\"10\" height=\"10\" fill=\"currentColor\"></rect><rect x=\"74\" y=\"16\" width=\"10\" height=\"10\" fill=\"currentColor\"></rect><rect x=\"16\" y=\"74\" width=\"10\" height=\"10\" fill=\"currentColor\"></rect><path d=\"M44 10h8v10h-8zM44 28h16v8H44zM10 44h10v8H10zM28 44h16v10H28zM52 46h10v10H52zM70 44h22v8H70zM44 62h8v14h-8zM58 66h14v8H58zM78 62h14v14H78zM56 82h14v10H56z\" fill=\"currentColor\"></path>", 7)]], 8,
|
|
939
|
-
s("p",
|
|
940
|
-
i.value ? a("v-if", !0) : (y(), o("p",
|
|
1003
|
+
}, [...t[0] ||= [c("<rect x=\"8\" y=\"8\" width=\"26\" height=\"26\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"5\"></rect><rect x=\"66\" y=\"8\" width=\"26\" height=\"26\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"5\"></rect><rect x=\"8\" y=\"66\" width=\"26\" height=\"26\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"5\"></rect><rect x=\"16\" y=\"16\" width=\"10\" height=\"10\" fill=\"currentColor\"></rect><rect x=\"74\" y=\"16\" width=\"10\" height=\"10\" fill=\"currentColor\"></rect><rect x=\"16\" y=\"74\" width=\"10\" height=\"10\" fill=\"currentColor\"></rect><path d=\"M44 10h8v10h-8zM44 28h16v8H44zM10 44h10v8H10zM28 44h16v10H28zM52 46h10v10H52zM70 44h22v8H70zM44 62h8v14h-8zM58 66h14v8H58zM78 62h14v14H78zM56 82h14v10H56z\" fill=\"currentColor\"></path>", 7)]], 8, At))]),
|
|
1004
|
+
s("p", jt, E(D(r)("campus.auth.wechatHint")), 1),
|
|
1005
|
+
i.value ? a("v-if", !0) : (y(), o("p", Mt, E(D(r)("campus.auth.wechatNote")), 1))
|
|
941
1006
|
]));
|
|
942
1007
|
};
|
|
943
1008
|
}
|
|
944
|
-
}),
|
|
1009
|
+
}), Pt = /* @__PURE__ */ d({
|
|
945
1010
|
__name: "LoginSplit",
|
|
946
1011
|
props: { preview: { type: Boolean } },
|
|
947
1012
|
setup(e) {
|
|
948
|
-
let { t } =
|
|
1013
|
+
let { t } = G(), r = J().tabs?.length ? J().tabs : ["account", "wechat"], a = x(r[0]), o = n(() => r.map((e) => ({
|
|
949
1014
|
key: e,
|
|
950
1015
|
label: t(e === "account" ? "campus.auth.tabAccount" : "campus.auth.tabWechat")
|
|
951
1016
|
})));
|
|
952
|
-
return (t, n) => (y(), i(
|
|
1017
|
+
return (t, n) => (y(), i(st, {
|
|
953
1018
|
active: a.value,
|
|
954
1019
|
"onUpdate:active": n[0] ||= (e) => a.value = e,
|
|
955
1020
|
tabs: o.value,
|
|
956
1021
|
preview: e.preview
|
|
957
1022
|
}, {
|
|
958
|
-
default: M(() => [a.value === "account" ? (y(), i(
|
|
1023
|
+
default: M(() => [a.value === "account" ? (y(), i(Ct, {
|
|
959
1024
|
key: 0,
|
|
960
1025
|
preview: e.preview
|
|
961
|
-
}, null, 8, ["preview"])) : (y(), i(
|
|
1026
|
+
}, null, 8, ["preview"])) : (y(), i(Nt, { key: 1 }))]),
|
|
962
1027
|
_: 1
|
|
963
1028
|
}, 8, [
|
|
964
1029
|
"active",
|
|
@@ -968,32 +1033,32 @@ var Et = {
|
|
|
968
1033
|
}
|
|
969
1034
|
});
|
|
970
1035
|
// packages/core/src/security.ts
|
|
971
|
-
function
|
|
1036
|
+
function Ft(e) {
|
|
972
1037
|
return e.environment ? e.environment : "production";
|
|
973
1038
|
}
|
|
974
|
-
function
|
|
975
|
-
if (
|
|
1039
|
+
function It(e) {
|
|
1040
|
+
if (Ft(e) === "production" && typeof e.auth.captcha != "function") throw Error("[campus] 生产环境必须在 auth 中提供 captcha()(图形验证码);测试环境可设置 environment: 'test' 跳过");
|
|
976
1041
|
}
|
|
977
|
-
function
|
|
1042
|
+
function Lt(e, t) {
|
|
978
1043
|
return t === "test" || e.length >= 8 && /[A-Za-z]/.test(e) && /\d/.test(e);
|
|
979
1044
|
}
|
|
980
1045
|
// packages/core/src/services/feedback.ts
|
|
981
|
-
var
|
|
1046
|
+
var Rt = (e) => e;
|
|
982
1047
|
function zt(e) {
|
|
983
|
-
|
|
1048
|
+
Rt = e;
|
|
984
1049
|
}
|
|
985
1050
|
async function Bt(e, t = {}) {
|
|
986
|
-
await pe.alert(e, t.title ??
|
|
1051
|
+
await pe.alert(e, t.title ?? Rt("campus.common.tip"), {
|
|
987
1052
|
type: t.type ?? "info",
|
|
988
|
-
confirmButtonText: t.confirmText ??
|
|
1053
|
+
confirmButtonText: t.confirmText ?? Rt("campus.common.ok")
|
|
989
1054
|
});
|
|
990
1055
|
}
|
|
991
1056
|
async function Vt(e, t = {}) {
|
|
992
1057
|
try {
|
|
993
|
-
return await pe.confirm(e, t.title ??
|
|
1058
|
+
return await pe.confirm(e, t.title ?? Rt("campus.common.tip"), {
|
|
994
1059
|
type: t.type ?? "warning",
|
|
995
|
-
confirmButtonText: t.confirmText ??
|
|
996
|
-
cancelButtonText: t.cancelText ??
|
|
1060
|
+
confirmButtonText: t.confirmText ?? Rt("campus.common.confirm"),
|
|
1061
|
+
cancelButtonText: t.cancelText ?? Rt("campus.common.cancel")
|
|
997
1062
|
}), !0;
|
|
998
1063
|
} catch (e) {
|
|
999
1064
|
if (e === "cancel" || e === "close") return !1;
|
|
@@ -1021,7 +1086,7 @@ var Ht = {
|
|
|
1021
1086
|
function Wt(e, t, n = {}) {
|
|
1022
1087
|
let r = me({
|
|
1023
1088
|
...n,
|
|
1024
|
-
title: n.title ??
|
|
1089
|
+
title: n.title ?? Rt(`campus.notify.${e}`),
|
|
1025
1090
|
message: t,
|
|
1026
1091
|
type: e
|
|
1027
1092
|
});
|
|
@@ -1047,7 +1112,7 @@ var Gt = {
|
|
|
1047
1112
|
}),
|
|
1048
1113
|
emits: ["update:modelValue"],
|
|
1049
1114
|
setup(e) {
|
|
1050
|
-
let t = e, n = O(e, "modelValue"), { t: r } =
|
|
1115
|
+
let t = e, n = O(e, "modelValue"), { t: r } = G(), i = x(0), a = x(!1), c;
|
|
1051
1116
|
function l() {
|
|
1052
1117
|
c && clearInterval(c), c = void 0;
|
|
1053
1118
|
}
|
|
@@ -1076,7 +1141,7 @@ var Gt = {
|
|
|
1076
1141
|
autocomplete: "one-time-code",
|
|
1077
1142
|
maxlength: "8"
|
|
1078
1143
|
}, {
|
|
1079
|
-
prefix: M(() => [u(
|
|
1144
|
+
prefix: M(() => [u($, { name: "message" })]),
|
|
1080
1145
|
_: 1
|
|
1081
1146
|
}, 8, [
|
|
1082
1147
|
"modelValue",
|
|
@@ -1097,7 +1162,7 @@ var Gt = {
|
|
|
1097
1162
|
__name: "RegisterForm",
|
|
1098
1163
|
props: { preview: { type: Boolean } },
|
|
1099
1164
|
setup(t) {
|
|
1100
|
-
let r = t, c = H(), { t: d, label: f } =
|
|
1165
|
+
let r = t, c = H(), { t: d, label: f } = G(), p = Y(), m = Ft(K()), g = J(), _ = g.agreements ?? [], v = b({
|
|
1101
1166
|
phone: "",
|
|
1102
1167
|
captcha: "",
|
|
1103
1168
|
code: "",
|
|
@@ -1110,7 +1175,7 @@ var Gt = {
|
|
|
1110
1175
|
message: d("campus.auth.phonePlaceholder"),
|
|
1111
1176
|
trigger: "blur"
|
|
1112
1177
|
}, {
|
|
1113
|
-
pattern:
|
|
1178
|
+
pattern: Ue,
|
|
1114
1179
|
message: d("campus.auth.phoneInvalid"),
|
|
1115
1180
|
trigger: "blur"
|
|
1116
1181
|
}],
|
|
@@ -1129,7 +1194,7 @@ var Gt = {
|
|
|
1129
1194
|
message: d("campus.auth.registerPasswordPlaceholder"),
|
|
1130
1195
|
trigger: "blur"
|
|
1131
1196
|
}, {
|
|
1132
|
-
validator: (e, t, n) => n(
|
|
1197
|
+
validator: (e, t, n) => n(Lt(t, m) ? void 0 : Error(d("campus.auth.passwordPolicy"))),
|
|
1133
1198
|
trigger: "blur"
|
|
1134
1199
|
}],
|
|
1135
1200
|
confirm: [{
|
|
@@ -1157,7 +1222,7 @@ var Gt = {
|
|
|
1157
1222
|
}
|
|
1158
1223
|
if (A.value = "", r.preview) j.value = "info", A.value = d("campus.auth.previewNote");
|
|
1159
1224
|
else try {
|
|
1160
|
-
await
|
|
1225
|
+
await K().auth.sendSmsCode({
|
|
1161
1226
|
phone: v.phone,
|
|
1162
1227
|
scene: "register",
|
|
1163
1228
|
captcha: p.captcha ? {
|
|
@@ -1180,7 +1245,7 @@ var Gt = {
|
|
|
1180
1245
|
else {
|
|
1181
1246
|
k.value = !0, A.value = "";
|
|
1182
1247
|
try {
|
|
1183
|
-
await
|
|
1248
|
+
await K().auth.register({
|
|
1184
1249
|
phone: v.phone,
|
|
1185
1250
|
code: v.code,
|
|
1186
1251
|
password: v.password,
|
|
@@ -1188,7 +1253,7 @@ var Gt = {
|
|
|
1188
1253
|
key: C.value,
|
|
1189
1254
|
code: v.captcha
|
|
1190
1255
|
} : void 0
|
|
1191
|
-
}), Gt.toast.success(d("campus.auth.registerOk")), await c.replace({ name: K(
|
|
1256
|
+
}), Gt.toast.success(d("campus.auth.registerOk")), await c.replace({ name: q(K()).login });
|
|
1192
1257
|
} catch (e) {
|
|
1193
1258
|
I(e, d("campus.login.failed")), T.value?.refresh();
|
|
1194
1259
|
} finally {
|
|
@@ -1225,7 +1290,7 @@ var Gt = {
|
|
|
1225
1290
|
autocomplete: "tel",
|
|
1226
1291
|
maxlength: "11"
|
|
1227
1292
|
}, {
|
|
1228
|
-
prefix: M(() => [u(
|
|
1293
|
+
prefix: M(() => [u($, { name: "phone" })]),
|
|
1229
1294
|
_: 1
|
|
1230
1295
|
}, 8, [
|
|
1231
1296
|
"modelValue",
|
|
@@ -1238,7 +1303,7 @@ var Gt = {
|
|
|
1238
1303
|
key: 0,
|
|
1239
1304
|
prop: "captcha"
|
|
1240
1305
|
}, {
|
|
1241
|
-
default: M(() => [u(
|
|
1306
|
+
default: M(() => [u(bt, {
|
|
1242
1307
|
ref_key: "captchaRef",
|
|
1243
1308
|
ref: T,
|
|
1244
1309
|
code: v.captcha,
|
|
@@ -1267,7 +1332,7 @@ var Gt = {
|
|
|
1267
1332
|
"aria-label": D(d)("campus.auth.registerPassword"),
|
|
1268
1333
|
autocomplete: "new-password"
|
|
1269
1334
|
}, {
|
|
1270
|
-
prefix: M(() => [u(
|
|
1335
|
+
prefix: M(() => [u($, { name: "lock" })]),
|
|
1271
1336
|
_: 1
|
|
1272
1337
|
}, 8, [
|
|
1273
1338
|
"modelValue",
|
|
@@ -1286,7 +1351,7 @@ var Gt = {
|
|
|
1286
1351
|
"aria-label": D(d)("campus.auth.confirmPlaceholder"),
|
|
1287
1352
|
autocomplete: "new-password"
|
|
1288
1353
|
}, {
|
|
1289
|
-
prefix: M(() => [u(
|
|
1354
|
+
prefix: M(() => [u($, { name: "lock" })]),
|
|
1290
1355
|
_: 1
|
|
1291
1356
|
}, 8, [
|
|
1292
1357
|
"modelValue",
|
|
@@ -1341,15 +1406,15 @@ var Gt = {
|
|
|
1341
1406
|
__name: "RegisterPage",
|
|
1342
1407
|
props: { preview: { type: Boolean } },
|
|
1343
1408
|
setup(e) {
|
|
1344
|
-
let { t } =
|
|
1409
|
+
let { t } = G(), r = Y().register, a = n(() => [{
|
|
1345
1410
|
key: "register",
|
|
1346
1411
|
label: t("campus.auth.tabRegister")
|
|
1347
1412
|
}, {
|
|
1348
1413
|
key: "login",
|
|
1349
1414
|
label: t("campus.auth.backLogin"),
|
|
1350
|
-
to:
|
|
1415
|
+
to: Ne(K()).login
|
|
1351
1416
|
}]);
|
|
1352
|
-
return (n, c) => (y(), i(
|
|
1417
|
+
return (n, c) => (y(), i(st, {
|
|
1353
1418
|
active: "register",
|
|
1354
1419
|
tabs: a.value,
|
|
1355
1420
|
preview: e.preview
|
|
@@ -1368,7 +1433,7 @@ var Gt = {
|
|
|
1368
1433
|
__name: "ForgotForm",
|
|
1369
1434
|
props: { preview: { type: Boolean } },
|
|
1370
1435
|
setup(t) {
|
|
1371
|
-
let r = t, s = H(), { t: c, label: d } =
|
|
1436
|
+
let r = t, s = H(), { t: c, label: d } = G(), f = Y(), p = Ft(K()), m = J(), g = b({
|
|
1372
1437
|
account: "",
|
|
1373
1438
|
captcha: "",
|
|
1374
1439
|
code: "",
|
|
@@ -1395,7 +1460,7 @@ var Gt = {
|
|
|
1395
1460
|
message: c("campus.auth.newPasswordPlaceholder"),
|
|
1396
1461
|
trigger: "blur"
|
|
1397
1462
|
}, {
|
|
1398
|
-
validator: (e, t, n) => n(
|
|
1463
|
+
validator: (e, t, n) => n(Lt(t, p) ? void 0 : Error(c("campus.auth.passwordPolicy"))),
|
|
1399
1464
|
trigger: "blur"
|
|
1400
1465
|
}],
|
|
1401
1466
|
confirm: [{
|
|
@@ -1419,8 +1484,8 @@ var Gt = {
|
|
|
1419
1484
|
}
|
|
1420
1485
|
if (T.value = "", r.preview) O.value = "info", T.value = c("campus.auth.previewNote");
|
|
1421
1486
|
else try {
|
|
1422
|
-
await
|
|
1423
|
-
...
|
|
1487
|
+
await K().auth.sendSmsCode({
|
|
1488
|
+
...Ue.test(g.account) ? { phone: g.account } : { username: g.account },
|
|
1424
1489
|
scene: "forgot",
|
|
1425
1490
|
captcha: f.captcha ? {
|
|
1426
1491
|
key: _.value,
|
|
@@ -1442,7 +1507,7 @@ var Gt = {
|
|
|
1442
1507
|
else {
|
|
1443
1508
|
C.value = !0, T.value = "";
|
|
1444
1509
|
try {
|
|
1445
|
-
await
|
|
1510
|
+
await K().auth.resetPassword({
|
|
1446
1511
|
account: g.account,
|
|
1447
1512
|
code: g.code,
|
|
1448
1513
|
password: g.password,
|
|
@@ -1450,7 +1515,7 @@ var Gt = {
|
|
|
1450
1515
|
key: _.value,
|
|
1451
1516
|
code: g.captcha
|
|
1452
1517
|
} : void 0
|
|
1453
|
-
}), Gt.toast.success(c("campus.auth.resetOk")), await s.replace({ name: K(
|
|
1518
|
+
}), Gt.toast.success(c("campus.auth.resetOk")), await s.replace({ name: q(K()).login });
|
|
1454
1519
|
} catch (e) {
|
|
1455
1520
|
j(e, c("campus.login.failed")), v.value?.refresh();
|
|
1456
1521
|
} finally {
|
|
@@ -1486,7 +1551,7 @@ var Gt = {
|
|
|
1486
1551
|
"aria-label": D(c)("campus.auth.account"),
|
|
1487
1552
|
autocomplete: "username"
|
|
1488
1553
|
}, {
|
|
1489
|
-
prefix: M(() => [u(
|
|
1554
|
+
prefix: M(() => [u($, { name: "user" })]),
|
|
1490
1555
|
_: 1
|
|
1491
1556
|
}, 8, [
|
|
1492
1557
|
"modelValue",
|
|
@@ -1499,7 +1564,7 @@ var Gt = {
|
|
|
1499
1564
|
key: 0,
|
|
1500
1565
|
prop: "captcha"
|
|
1501
1566
|
}, {
|
|
1502
|
-
default: M(() => [u(
|
|
1567
|
+
default: M(() => [u(bt, {
|
|
1503
1568
|
ref_key: "captchaRef",
|
|
1504
1569
|
ref: v,
|
|
1505
1570
|
code: g.captcha,
|
|
@@ -1528,7 +1593,7 @@ var Gt = {
|
|
|
1528
1593
|
"aria-label": D(c)("campus.auth.newPasswordPlaceholder"),
|
|
1529
1594
|
autocomplete: "new-password"
|
|
1530
1595
|
}, {
|
|
1531
|
-
prefix: M(() => [u(
|
|
1596
|
+
prefix: M(() => [u($, { name: "lock" })]),
|
|
1532
1597
|
_: 1
|
|
1533
1598
|
}, 8, [
|
|
1534
1599
|
"modelValue",
|
|
@@ -1547,7 +1612,7 @@ var Gt = {
|
|
|
1547
1612
|
"aria-label": D(c)("campus.auth.confirmPlaceholder"),
|
|
1548
1613
|
autocomplete: "new-password"
|
|
1549
1614
|
}, {
|
|
1550
|
-
prefix: M(() => [u(
|
|
1615
|
+
prefix: M(() => [u($, { name: "lock" })]),
|
|
1551
1616
|
_: 1
|
|
1552
1617
|
}, 8, [
|
|
1553
1618
|
"modelValue",
|
|
@@ -1584,15 +1649,15 @@ var Gt = {
|
|
|
1584
1649
|
__name: "ForgotPage",
|
|
1585
1650
|
props: { preview: { type: Boolean } },
|
|
1586
1651
|
setup(e) {
|
|
1587
|
-
let { t } =
|
|
1652
|
+
let { t } = G(), r = Y().forgot, a = n(() => [{
|
|
1588
1653
|
key: "forgot",
|
|
1589
1654
|
label: t("campus.auth.tabForgot")
|
|
1590
1655
|
}, {
|
|
1591
1656
|
key: "login",
|
|
1592
1657
|
label: t("campus.auth.backLogin"),
|
|
1593
|
-
to:
|
|
1658
|
+
to: Ne(K()).login
|
|
1594
1659
|
}]);
|
|
1595
|
-
return (n, c) => (y(), i(
|
|
1660
|
+
return (n, c) => (y(), i(st, {
|
|
1596
1661
|
active: "forgot",
|
|
1597
1662
|
tabs: a.value,
|
|
1598
1663
|
preview: e.preview
|
|
@@ -1608,7 +1673,7 @@ var Gt = {
|
|
|
1608
1673
|
__name: "AuthPreview",
|
|
1609
1674
|
props: { kind: {} },
|
|
1610
1675
|
setup(e) {
|
|
1611
|
-
return (t, n) => e.kind === "login" ? (y(), i(
|
|
1676
|
+
return (t, n) => e.kind === "login" ? (y(), i(Pt, {
|
|
1612
1677
|
key: 0,
|
|
1613
1678
|
preview: ""
|
|
1614
1679
|
})) : e.kind === "register" ? (y(), i(tn, {
|
|
@@ -1619,7 +1684,7 @@ var Gt = {
|
|
|
1619
1684
|
preview: ""
|
|
1620
1685
|
}));
|
|
1621
1686
|
}
|
|
1622
|
-
}), cn = { class: "ca-user-avatar" }, ln = ["src"], un = /*#__PURE__*/
|
|
1687
|
+
}), cn = { class: "ca-user-avatar" }, ln = ["src"], un = /*#__PURE__*/ X(/* @__PURE__ */ d({
|
|
1623
1688
|
__name: "UserAvatar",
|
|
1624
1689
|
props: {
|
|
1625
1690
|
name: {},
|
|
@@ -1655,10 +1720,10 @@ var Gt = {
|
|
|
1655
1720
|
"aria-label",
|
|
1656
1721
|
"aria-checked",
|
|
1657
1722
|
"onClick"
|
|
1658
|
-
], Ln = ["title"], Rn = ["value", "aria-label"], zn = ["disabled"], Bn = { class: "ca-settings__group" }, Vn = { class: "ca-settings__title" }, Hn = ["aria-label"], Un = ["aria-checked", "onClick"], Wn = /*#__PURE__*/
|
|
1723
|
+
], Ln = ["title"], Rn = ["value", "aria-label"], zn = ["disabled"], Bn = { class: "ca-settings__group" }, Vn = { class: "ca-settings__title" }, Hn = ["aria-label"], Un = ["aria-checked", "onClick"], Wn = /*#__PURE__*/ X(/* @__PURE__ */ d({
|
|
1659
1724
|
__name: "HeaderBar",
|
|
1660
1725
|
setup(t) {
|
|
1661
|
-
let r = V(), c = H(), d =
|
|
1726
|
+
let r = V(), c = H(), d = Q(), f = Z(), p = Ve(), { t: m, label: b, locale: C } = G(), T = K(), O = x(!1), k = [{
|
|
1662
1727
|
value: "border",
|
|
1663
1728
|
label: "campus.settings.boxBorder"
|
|
1664
1729
|
}, {
|
|
@@ -1699,21 +1764,24 @@ var Gt = {
|
|
|
1699
1764
|
} : void 0);
|
|
1700
1765
|
}
|
|
1701
1766
|
function te(e) {
|
|
1702
|
-
C.value = e,
|
|
1767
|
+
C.value = e, Te(e);
|
|
1703
1768
|
}
|
|
1704
1769
|
async function ne(e) {
|
|
1705
|
-
e === "account" ? T.onAccountClick ? await T.onAccountClick("header") : T.accountPath && P(T.accountPath) : (await d.logout(), await c.replace({ name: K(
|
|
1770
|
+
e === "account" ? T.onAccountClick ? await T.onAccountClick("header") : T.accountPath && P(T.accountPath) : (await d.logout(), await c.replace({ name: q(K()).login }));
|
|
1706
1771
|
}
|
|
1707
1772
|
let z = x(!1);
|
|
1708
1773
|
function B() {
|
|
1709
1774
|
z.value = !!document.fullscreenElement;
|
|
1710
1775
|
}
|
|
1711
1776
|
async function re() {
|
|
1777
|
+
f.pageScreenManual();
|
|
1712
1778
|
try {
|
|
1713
1779
|
document.fullscreenElement ? await document.exitFullscreen() : await document.documentElement.requestFullscreen();
|
|
1714
1780
|
} catch {}
|
|
1715
1781
|
}
|
|
1716
|
-
v(() =>
|
|
1782
|
+
v(() => {
|
|
1783
|
+
B(), document.addEventListener("fullscreenchange", B);
|
|
1784
|
+
}), _(() => document.removeEventListener("fullscreenchange", B));
|
|
1717
1785
|
function ie(e) {
|
|
1718
1786
|
T.headerTools?.[e]?.();
|
|
1719
1787
|
}
|
|
@@ -1955,14 +2023,14 @@ var Gt = {
|
|
|
1955
2023
|
]);
|
|
1956
2024
|
};
|
|
1957
2025
|
}
|
|
1958
|
-
}), [["__scopeId", "data-v-
|
|
2026
|
+
}), [["__scopeId", "data-v-d0a9b424"]]), Gn = {
|
|
1959
2027
|
key: 0,
|
|
1960
2028
|
class: "ca-page-header"
|
|
1961
|
-
}, Kn = { class: "ca-page-header__top" }, qn = { class: "ca-page-header__crumb" }, Jn = ["title", "aria-label"], Yn = { class: "ca-page-header__date" }, Xn = /*#__PURE__*/
|
|
2029
|
+
}, Kn = { class: "ca-page-header__top" }, qn = { class: "ca-page-header__crumb" }, Jn = ["title", "aria-label"], Yn = { class: "ca-page-header__date" }, Xn = /*#__PURE__*/ X(/* @__PURE__ */ d({
|
|
1962
2030
|
__name: "PageHeader",
|
|
1963
2031
|
setup(t) {
|
|
1964
|
-
let r = V(), { t: c, label: d, locale: f } =
|
|
1965
|
-
let e = h.value ?
|
|
2032
|
+
let r = V(), { t: c, label: d, locale: f } = G(), p = ft(), m = new Map(Me(K().menus).map((e) => [e.key, e])), h = n(() => r.meta.pageKey ? m.get(r.meta.pageKey) : void 0), g = n(() => {
|
|
2033
|
+
let e = h.value ? Ae(h.value.key) : void 0;
|
|
1966
2034
|
if (!e) return [];
|
|
1967
2035
|
let t = e.titles.map((e) => d(e));
|
|
1968
2036
|
return h.value?.affix ? t.filter((e, n) => e !== t[n - 1]) : t;
|
|
@@ -2005,10 +2073,10 @@ var Gt = {
|
|
|
2005
2073
|
}), [["__scopeId", "data-v-e0f9b42f"]]), Zn = {
|
|
2006
2074
|
key: 0,
|
|
2007
2075
|
class: "ca-page-header__titles"
|
|
2008
|
-
}, Qn = { class: "ca-page-header__title" }, $n = ["title"], er = /*#__PURE__*/
|
|
2076
|
+
}, Qn = { class: "ca-page-header__title" }, $n = ["title"], er = /*#__PURE__*/ X(/* @__PURE__ */ d({
|
|
2009
2077
|
__name: "PageTitle",
|
|
2010
2078
|
setup(e) {
|
|
2011
|
-
let t = V(), { label: r } =
|
|
2079
|
+
let t = V(), { label: r } = G(), i = new Map(Me(K().menus).map((e) => [e.key, e])), c = n(() => t.meta.pageKey ? i.get(t.meta.pageKey) : void 0), l = n(() => c.value?.pageHeader ?? K().pageHeader ?? !0), u = n(() => c.value ? r(c.value.title) : ""), d = n(() => c.value?.description ? r(c.value.description) : "");
|
|
2012
2080
|
return (e, t) => c.value ? (y(), o("header", {
|
|
2013
2081
|
key: 0,
|
|
2014
2082
|
class: h(["ca-page-header__main", { "is-title-hidden": !l.value }])
|
|
@@ -2050,17 +2118,17 @@ var Gt = {
|
|
|
2050
2118
|
}, mr = {
|
|
2051
2119
|
key: 1,
|
|
2052
2120
|
class: "ca-side__group-badge"
|
|
2053
|
-
}, hr = /*#__PURE__*/
|
|
2121
|
+
}, hr = /*#__PURE__*/ X(/* @__PURE__ */ d({
|
|
2054
2122
|
__name: "SideMenu",
|
|
2055
2123
|
setup(t) {
|
|
2056
|
-
let r = V(), c = H(), d =
|
|
2124
|
+
let r = V(), c = H(), d = Q(), f = Z(), { t: p, label: m } = G(), g = K(), _ = n(() => f.sidePanelCollapsed), v = () => f.toggleSidePanel(), b = x(U("side-text-hidden") === "1");
|
|
2057
2125
|
function C() {
|
|
2058
|
-
b.value = !b.value,
|
|
2126
|
+
b.value = !b.value, W("side-text-hidden", b.value ? "1" : "0");
|
|
2059
2127
|
}
|
|
2060
2128
|
async function T(e) {
|
|
2061
|
-
e === "account" ? g.onAccountClick ? await g.onAccountClick("side") : g.accountPath && r.path !== g.accountPath && await c.push(g.accountPath) : (await d.logout(), await c.replace({ name: K(
|
|
2129
|
+
e === "account" ? g.onAccountClick ? await g.onAccountClick("side") : g.accountPath && r.path !== g.accountPath && await c.push(g.accountPath) : (await d.logout(), await c.replace({ name: q(K()).login }));
|
|
2062
2130
|
}
|
|
2063
|
-
let O = n(() =>
|
|
2131
|
+
let O = n(() => Pe(g, (e) => d.can(e))), j = n(() => O.value.home), P = n(() => O.value.apps), F = O.value.accountStandalone, I = x(), L = n(() => !!j.value && r.path === j.value.path);
|
|
2064
2132
|
A(() => [r.path, r.meta.appKey], () => {
|
|
2065
2133
|
I.value = L.value || F && r.path === g.accountPath ? void 0 : r.meta.appKey ?? P.value[0]?.key;
|
|
2066
2134
|
}, { immediate: !0 });
|
|
@@ -2072,7 +2140,7 @@ var Gt = {
|
|
|
2072
2140
|
return t > 0 ? t : 0;
|
|
2073
2141
|
}
|
|
2074
2142
|
function B(e) {
|
|
2075
|
-
return e.children.reduce((e, t) => e + (
|
|
2143
|
+
return e.children.reduce((e, t) => e + (De(t) ? z(t) : 0), 0);
|
|
2076
2144
|
}
|
|
2077
2145
|
let re = n(() => r.meta.groupKey ? [r.meta.groupKey] : []);
|
|
2078
2146
|
function ie(e) {
|
|
@@ -2196,7 +2264,7 @@ var Gt = {
|
|
|
2196
2264
|
class: "ca-side__menu",
|
|
2197
2265
|
onSelect: n[1] ||= (e) => D(f).closeOverlays()
|
|
2198
2266
|
}, {
|
|
2199
|
-
default: M(() => [(y(!0), o(e, null, S(ne.value?.children ?? [], (t) => (y(), o(e, { key: t.key }, [a(" 二级是菜单组:可展开,下面是三级页面 "), D(
|
|
2267
|
+
default: M(() => [(y(!0), o(e, null, S(ne.value?.children ?? [], (t) => (y(), o(e, { key: t.key }, [a(" 二级是菜单组:可展开,下面是三级页面 "), D(De)(t) ? (y(), i(I, {
|
|
2200
2268
|
key: 0,
|
|
2201
2269
|
index: t.key
|
|
2202
2270
|
}, {
|
|
@@ -2236,10 +2304,10 @@ var Gt = {
|
|
|
2236
2304
|
}), [["__scopeId", "data-v-00d0b837"]]), gr = {
|
|
2237
2305
|
key: 0,
|
|
2238
2306
|
class: "ca-copyright"
|
|
2239
|
-
}, _r = ["href"], vr = /*#__PURE__*/
|
|
2307
|
+
}, _r = ["href"], vr = /*#__PURE__*/ X(/* @__PURE__ */ d({
|
|
2240
2308
|
__name: "CaCopyright",
|
|
2241
2309
|
setup(t) {
|
|
2242
|
-
let r =
|
|
2310
|
+
let r = K().brand, { label: i } = G(), c = n(() => r.copyright ? He(i(r.copyright)) : ""), l = n(() => r.copyrightLinks ?? []);
|
|
2243
2311
|
return (t, n) => c.value ? (y(), o("footer", gr, [s("span", null, E(c.value), 1), (y(!0), o(e, null, S(l.value, (t) => (y(), o(e, { key: t.href }, [n[0] ||= s("span", {
|
|
2244
2312
|
class: "ca-copyright__dot",
|
|
2245
2313
|
"aria-hidden": "true"
|
|
@@ -2253,10 +2321,10 @@ var Gt = {
|
|
|
2253
2321
|
"title",
|
|
2254
2322
|
"aria-label",
|
|
2255
2323
|
"aria-pressed"
|
|
2256
|
-
], Cr = /*#__PURE__*/
|
|
2324
|
+
], Cr = /*#__PURE__*/ X(/* @__PURE__ */ d({
|
|
2257
2325
|
__name: "TabsBar",
|
|
2258
2326
|
setup(t) {
|
|
2259
|
-
let r = V(), c = H(), d =
|
|
2327
|
+
let r = V(), c = H(), d = ft(), f = Z(), { t: p, label: g } = G(), _ = new Map(Me(K().menus).map((e) => [e.key, e])), b = n(() => d.visited.map((e) => _.get(e)).filter((e) => !!e).map((e) => ({
|
|
2260
2328
|
key: e.key,
|
|
2261
2329
|
path: e.path,
|
|
2262
2330
|
title: g(e.title),
|
|
@@ -2375,44 +2443,48 @@ var Gt = {
|
|
|
2375
2443
|
]);
|
|
2376
2444
|
};
|
|
2377
2445
|
}
|
|
2378
|
-
}), [["__scopeId", "data-v-1d7ba823"]]), wr = 1200, Tr = "(max-width: 768px)", Er = `(min-width: 769px) and (max-width: ${wr}px)`, Dr = ["aria-label"], Or = ["aria-label"], kr = { class: "ca-main" }, Ar = {
|
|
2446
|
+
}), [["__scopeId", "data-v-1d7ba823"]]), wr = 1200, Tr = "(max-width: 768px)", Er = `(min-width: 769px) and (max-width: ${wr}px)`, Dr = ["aria-label"], Or = ["aria-label"], kr = { class: "ca-main" }, Ar = {
|
|
2447
|
+
key: 0,
|
|
2448
|
+
class: "ca-screen-prompt",
|
|
2449
|
+
role: "status"
|
|
2450
|
+
}, jr = { class: "ca-content" }, Mr = { class: "ca-content__page" }, Nr = /*#__PURE__*/ X(/* @__PURE__ */ d({
|
|
2379
2451
|
__name: "CaLayout",
|
|
2380
2452
|
setup(e) {
|
|
2381
|
-
let n = V(), r =
|
|
2382
|
-
function
|
|
2383
|
-
let e =
|
|
2453
|
+
let n = V(), r = ft(), c = Z(), { t: d } = G(), f = window.matchMedia(Tr), p = window.matchMedia(Er), m = "";
|
|
2454
|
+
function g() {
|
|
2455
|
+
let e = f.matches ? "phone" : p.matches ? "pad" : "desktop";
|
|
2384
2456
|
c.setMode(e);
|
|
2385
2457
|
}
|
|
2386
|
-
|
|
2387
|
-
e ? (
|
|
2388
|
-
}), A(() => n.fullPath, () => c.closeOverlays())
|
|
2389
|
-
function
|
|
2458
|
+
g(), A(() => c.mode === "phone" && c.mobileMenuOpen, (e) => {
|
|
2459
|
+
e ? (m = document.body.style.overflow, document.body.style.overflow = "hidden") : document.body.style.overflow = m;
|
|
2460
|
+
}), A(() => n.fullPath, () => c.closeOverlays());
|
|
2461
|
+
function b(e) {
|
|
2390
2462
|
e.key === "Escape" && (c.mobileMenuOpen || c.padPanelOpen ? c.closeOverlays() : c.contentFullscreen && c.toggleContentFullscreen());
|
|
2391
2463
|
}
|
|
2392
2464
|
v(() => {
|
|
2393
|
-
|
|
2465
|
+
g(), f.addEventListener("change", g), p.addEventListener("change", g), window.addEventListener("keydown", b), document.addEventListener("fullscreenchange", c.syncPageScreen);
|
|
2394
2466
|
}), _(() => {
|
|
2395
|
-
|
|
2467
|
+
f.removeEventListener("change", g), p.removeEventListener("change", g), window.removeEventListener("keydown", b), document.removeEventListener("fullscreenchange", c.syncPageScreen), c.applyPageOpenMode("normal"), document.body.style.overflow = m;
|
|
2396
2468
|
});
|
|
2397
|
-
function
|
|
2469
|
+
function x() {
|
|
2398
2470
|
let e = n.meta.pageKey;
|
|
2399
2471
|
return e ? `${e}:${r.versions[e] ?? 0}` : n.fullPath;
|
|
2400
2472
|
}
|
|
2401
2473
|
return (e, n) => {
|
|
2402
|
-
let
|
|
2474
|
+
let f = w("ca-button"), p = w("router-view");
|
|
2403
2475
|
return y(), o("div", { class: h(["ca-shell", { "is-fullscreen": D(c).contentFullscreen }]) }, [N(u(Wn, null, null, 512), [[k, !D(c).contentFullscreen]]), s("div", { class: h(["ca-body", { "is-fullscreen": D(c).contentFullscreen }]) }, [
|
|
2404
2476
|
D(c).mode === "phone" && D(c).mobileMenuOpen ? (y(), o("button", {
|
|
2405
2477
|
key: 0,
|
|
2406
2478
|
type: "button",
|
|
2407
2479
|
class: "ca-mobile-scrim",
|
|
2408
|
-
"aria-label": D(
|
|
2480
|
+
"aria-label": D(d)("campus.side.closeMenu"),
|
|
2409
2481
|
onClick: n[0] ||= (e) => D(c).closeMobileMenu()
|
|
2410
2482
|
}, null, 8, Dr)) : a("v-if", !0),
|
|
2411
2483
|
D(c).mode === "pad" && D(c).padPanelOpen ? (y(), o("button", {
|
|
2412
2484
|
key: 1,
|
|
2413
2485
|
type: "button",
|
|
2414
2486
|
class: "ca-pad-scrim",
|
|
2415
|
-
"aria-label": D(
|
|
2487
|
+
"aria-label": D(d)("campus.side.closeMenu"),
|
|
2416
2488
|
onClick: n[1] ||= (e) => D(c).closePadPanel()
|
|
2417
2489
|
}, null, 8, Or)) : a("v-if", !0),
|
|
2418
2490
|
a(" 手机抽屉关闭时、电脑档两栏都收起时,侧栏不在屏幕上,不可聚焦 "),
|
|
@@ -2423,14 +2495,28 @@ var Gt = {
|
|
|
2423
2495
|
s("main", kr, [
|
|
2424
2496
|
u(Cr),
|
|
2425
2497
|
u(Xn),
|
|
2426
|
-
|
|
2498
|
+
D(c).pageScreenPrompt ? (y(), o("div", Ar, [u(f, {
|
|
2499
|
+
size: "small",
|
|
2500
|
+
onClick: n[2] ||= (e) => D(c).retryPageScreen()
|
|
2501
|
+
}, {
|
|
2502
|
+
default: M(() => [l(E(D(d)("campus.tabs.enterScreen")), 1)]),
|
|
2503
|
+
_: 1
|
|
2504
|
+
}), u(f, {
|
|
2505
|
+
size: "small",
|
|
2506
|
+
"aria-label": D(d)("campus.tabs.dismissScreen"),
|
|
2507
|
+
onClick: n[3] ||= (e) => D(c).dismissPageScreenPrompt()
|
|
2508
|
+
}, {
|
|
2509
|
+
default: M(() => [l(E(D(d)("campus.tabs.dismissScreen")), 1)]),
|
|
2510
|
+
_: 1
|
|
2511
|
+
}, 8, ["aria-label"])])) : a("v-if", !0),
|
|
2512
|
+
s("div", jr, [
|
|
2427
2513
|
u(er),
|
|
2428
2514
|
a(" 页面区撑满剩余高度,版权在其后:内容少时贴窗口底,内容长时滚到最底才出现 "),
|
|
2429
|
-
s("div",
|
|
2515
|
+
s("div", Mr, [u(p, null, {
|
|
2430
2516
|
default: M(({ Component: e }) => [a(" include 与标签名单同步;缓存容量包含固定标签。 "), (y(), i(t, {
|
|
2431
2517
|
include: D(r).cached,
|
|
2432
2518
|
max: D(r).maxTabs + D(r).affixKeys.length
|
|
2433
|
-
}, [e ? (y(), i(T(e), { key:
|
|
2519
|
+
}, [e ? (y(), i(T(e), { key: x() })) : a("v-if", !0)], 1032, ["include", "max"]))]),
|
|
2434
2520
|
_: 1
|
|
2435
2521
|
})]),
|
|
2436
2522
|
u(vr)
|
|
@@ -2439,16 +2525,16 @@ var Gt = {
|
|
|
2439
2525
|
], 2)], 2);
|
|
2440
2526
|
};
|
|
2441
2527
|
}
|
|
2442
|
-
}), [["__scopeId", "data-v-
|
|
2528
|
+
}), [["__scopeId", "data-v-90594751"]]), Pr = { class: "ca-exception" }, Fr = { class: "ca-exception__code" }, Ir = { class: "ca-exception__text" }, Lr = /*#__PURE__*/ X(/* @__PURE__ */ d({
|
|
2443
2529
|
__name: "ExceptionPage",
|
|
2444
2530
|
props: { kind: {} },
|
|
2445
2531
|
setup(e) {
|
|
2446
|
-
let t = e, r = H(), i =
|
|
2532
|
+
let t = e, r = H(), i = Ne(K()).home, { t: a } = G(), c = n(() => t.kind === "forbidden" ? "403" : "404"), d = n(() => a(t.kind === "forbidden" ? "campus.error.forbidden" : "campus.error.notFound"));
|
|
2447
2533
|
return (e, t) => {
|
|
2448
2534
|
let n = w("ca-button");
|
|
2449
|
-
return y(), o("div",
|
|
2450
|
-
s("div",
|
|
2451
|
-
s("p",
|
|
2535
|
+
return y(), o("div", Pr, [
|
|
2536
|
+
s("div", Fr, E(c.value), 1),
|
|
2537
|
+
s("p", Ir, E(d.value), 1),
|
|
2452
2538
|
u(n, {
|
|
2453
2539
|
type: "primary",
|
|
2454
2540
|
onClick: t[0] ||= (e) => D(r).replace(D(i))
|
|
@@ -2459,13 +2545,13 @@ var Gt = {
|
|
|
2459
2545
|
]);
|
|
2460
2546
|
};
|
|
2461
2547
|
}
|
|
2462
|
-
}), [["__scopeId", "data-v-75a54c8a"]]),
|
|
2548
|
+
}), [["__scopeId", "data-v-75a54c8a"]]), Rr = { class: "ca-login" }, zr = { class: "ca-login__main" }, Br = { class: "ca-login__card" }, Vr = { class: "ca-login__brand" }, Hr = ["src"], Ur = { class: "ca-login__name" }, Wr = {
|
|
2463
2549
|
key: 1,
|
|
2464
2550
|
class: "ca-login__subtitle"
|
|
2465
|
-
},
|
|
2551
|
+
}, Gr = /*#__PURE__*/ X(/* @__PURE__ */ d({
|
|
2466
2552
|
__name: "LoginPage",
|
|
2467
2553
|
setup(e) {
|
|
2468
|
-
let t = V(), r = H(), c =
|
|
2554
|
+
let t = V(), r = H(), c = Q(), d = Ve(), { t: f, label: p } = G(), m = K().brand, h = n(() => p(d.theme.siteName ?? m.name)), g = n(() => d.theme.logo ?? m.logo), _ = Y(), v = b({
|
|
2469
2555
|
username: "",
|
|
2470
2556
|
password: "",
|
|
2471
2557
|
captcha: ""
|
|
@@ -2501,7 +2587,7 @@ var Gt = {
|
|
|
2501
2587
|
key: S.value,
|
|
2502
2588
|
code: v.captcha
|
|
2503
2589
|
} : void 0
|
|
2504
|
-
}), await r.replace(
|
|
2590
|
+
}), await r.replace(We(t.query.redirect));
|
|
2505
2591
|
} catch (e) {
|
|
2506
2592
|
k.value = e instanceof Error && e.message ? e.message : f("campus.login.failed"), C.value?.refresh();
|
|
2507
2593
|
} finally {
|
|
@@ -2510,16 +2596,16 @@ var Gt = {
|
|
|
2510
2596
|
}
|
|
2511
2597
|
return (e, t) => {
|
|
2512
2598
|
let n = w("ca-alert"), r = w("ca-input"), c = w("ca-form-item"), d = w("ca-button"), b = w("ca-form");
|
|
2513
|
-
return y(), o("div",
|
|
2514
|
-
s("div",
|
|
2599
|
+
return y(), o("div", Rr, [s("div", zr, [s("div", Br, [
|
|
2600
|
+
s("div", Vr, [
|
|
2515
2601
|
g.value ? (y(), o("img", {
|
|
2516
2602
|
key: 0,
|
|
2517
2603
|
src: g.value,
|
|
2518
2604
|
alt: "",
|
|
2519
2605
|
class: "ca-login__logo"
|
|
2520
|
-
}, null, 8,
|
|
2521
|
-
s("h1",
|
|
2522
|
-
D(m).subtitle ? (y(), o("p",
|
|
2606
|
+
}, null, 8, Hr)) : a("v-if", !0),
|
|
2607
|
+
s("h1", Ur, E(h.value), 1),
|
|
2608
|
+
D(m).subtitle ? (y(), o("p", Wr, E(D(p)(D(m).subtitle)), 1)) : a("v-if", !0)
|
|
2523
2609
|
]),
|
|
2524
2610
|
k.value ? (y(), i(n, {
|
|
2525
2611
|
key: 0,
|
|
@@ -2563,7 +2649,7 @@ var Gt = {
|
|
|
2563
2649
|
key: 0,
|
|
2564
2650
|
prop: "captcha"
|
|
2565
2651
|
}, {
|
|
2566
|
-
default: M(() => [u(
|
|
2652
|
+
default: M(() => [u(bt, {
|
|
2567
2653
|
ref_key: "captchaRef",
|
|
2568
2654
|
ref: C,
|
|
2569
2655
|
code: v.captcha,
|
|
@@ -2591,7 +2677,7 @@ var Gt = {
|
|
|
2591
2677
|
}
|
|
2592
2678
|
}), [["__scopeId", "data-v-ddf636fd"]]);
|
|
2593
2679
|
// packages/core/src/router.ts
|
|
2594
|
-
function
|
|
2680
|
+
function Kr(e) {
|
|
2595
2681
|
return async () => {
|
|
2596
2682
|
let t = await e.component();
|
|
2597
2683
|
return d({
|
|
@@ -2600,17 +2686,17 @@ function Gr(e) {
|
|
|
2600
2686
|
});
|
|
2601
2687
|
};
|
|
2602
2688
|
}
|
|
2603
|
-
var
|
|
2689
|
+
var qr = d({
|
|
2604
2690
|
name: "CaForbidden",
|
|
2605
|
-
setup: () => () => f(
|
|
2606
|
-
}),
|
|
2691
|
+
setup: () => () => f(Lr, { kind: "forbidden" })
|
|
2692
|
+
}), Jr = d({
|
|
2607
2693
|
name: "CaNotFound",
|
|
2608
|
-
setup: () => () => f(
|
|
2694
|
+
setup: () => () => f(Lr, { kind: "notFound" })
|
|
2609
2695
|
});
|
|
2610
|
-
function
|
|
2611
|
-
let n =
|
|
2696
|
+
function Yr(e, t) {
|
|
2697
|
+
let n = Me(e.menus);
|
|
2612
2698
|
if (!n.length) throw Error("[campus] 菜单里至少需要一个页面");
|
|
2613
|
-
let r =
|
|
2699
|
+
let r = Ne(e), i = q(e);
|
|
2614
2700
|
if (new Set(Object.values(i)).size !== 5 || n.some((e) => Object.values(i).includes(e.key))) throw Error("[campus] 系统路由名称重复或与页面键冲突,请配置 routeNames");
|
|
2615
2701
|
for (let e of n) if ([
|
|
2616
2702
|
r.login,
|
|
@@ -2623,7 +2709,7 @@ function Jr(e, t) {
|
|
|
2623
2709
|
{
|
|
2624
2710
|
path: r.login,
|
|
2625
2711
|
name: i.login,
|
|
2626
|
-
component: e.login?.style === "split" ?
|
|
2712
|
+
component: e.login?.style === "split" ? Pt : Gr,
|
|
2627
2713
|
meta: { public: !0 }
|
|
2628
2714
|
},
|
|
2629
2715
|
{
|
|
@@ -2640,33 +2726,34 @@ function Jr(e, t) {
|
|
|
2640
2726
|
},
|
|
2641
2727
|
{
|
|
2642
2728
|
path: "/",
|
|
2643
|
-
component:
|
|
2729
|
+
component: Nr,
|
|
2644
2730
|
redirect: n.some((e) => e.path === "/") ? void 0 : () => {
|
|
2645
|
-
let e =
|
|
2731
|
+
let e = Q(t);
|
|
2646
2732
|
return r.home === "/" ? n.find((t) => e.can(t.permission))?.path ?? r.forbidden : r.home;
|
|
2647
2733
|
},
|
|
2648
2734
|
children: [
|
|
2649
2735
|
...n.map((e) => ({
|
|
2650
2736
|
path: e.path,
|
|
2651
2737
|
name: e.key,
|
|
2652
|
-
component:
|
|
2738
|
+
component: Kr(e),
|
|
2653
2739
|
meta: {
|
|
2654
2740
|
pageKey: e.key,
|
|
2655
2741
|
appKey: e.appKey,
|
|
2656
2742
|
groupKey: e.groupKey,
|
|
2657
2743
|
permission: e.permission,
|
|
2658
|
-
sideCollapse: e.sideCollapse
|
|
2744
|
+
sideCollapse: e.sideCollapse,
|
|
2745
|
+
openMode: e.openMode
|
|
2659
2746
|
}
|
|
2660
2747
|
})),
|
|
2661
2748
|
{
|
|
2662
2749
|
path: r.forbidden,
|
|
2663
2750
|
name: i.forbidden,
|
|
2664
|
-
component:
|
|
2751
|
+
component: qr
|
|
2665
2752
|
},
|
|
2666
2753
|
{
|
|
2667
2754
|
path: r.notFound,
|
|
2668
2755
|
name: i.notFound,
|
|
2669
|
-
component:
|
|
2756
|
+
component: Jr
|
|
2670
2757
|
},
|
|
2671
2758
|
...r.notFound === "/:pathMatch(.*)*" ? [] : [{
|
|
2672
2759
|
path: "/:pathMatch(.*)*",
|
|
@@ -2677,55 +2764,55 @@ function Jr(e, t) {
|
|
|
2677
2764
|
], o = re({
|
|
2678
2765
|
history: e.history === "web" ? ae() : ie(),
|
|
2679
2766
|
routes: a
|
|
2680
|
-
});
|
|
2681
|
-
return o.beforeEach((e) => {
|
|
2682
|
-
let
|
|
2683
|
-
return e.meta.public ?
|
|
2767
|
+
}), s = Z(t);
|
|
2768
|
+
return o.beforeEach((e, n) => {
|
|
2769
|
+
let a = Q(t);
|
|
2770
|
+
return e.meta.public ? a.isLoggedIn && e.name === i.login ? { path: r.home } : !0 : a.isLoggedIn ? a.can(e.meta.permission) ? (e.path === n.path && n.matched.length || e.meta.openMode !== "screen" || s.preparePageScreen(), !0) : { name: i.forbidden } : {
|
|
2684
2771
|
name: i.login,
|
|
2685
2772
|
query: e.fullPath === r.home ? void 0 : { redirect: e.fullPath }
|
|
2686
2773
|
};
|
|
2687
|
-
}), o.afterEach((e) => {
|
|
2688
|
-
e.meta.pageKey &&
|
|
2689
|
-
}), o;
|
|
2774
|
+
}), o.afterEach((e, n, r) => {
|
|
2775
|
+
r ? s.cancelPageScreen() : (e.path === n.path && n.matched.length || s.applyPageOpenMode(e.meta.openMode, e.meta.sideCollapse), e.meta.pageKey && ft(t).open(e.meta.pageKey));
|
|
2776
|
+
}), o.onError(() => s.cancelPageScreen()), o;
|
|
2690
2777
|
}
|
|
2691
2778
|
// packages/core/src/services/login.ts
|
|
2692
|
-
async function
|
|
2693
|
-
e.signIn(n), await t.replace(
|
|
2779
|
+
async function Xr(e, t, n, r) {
|
|
2780
|
+
e.signIn(n), await t.replace(We(r));
|
|
2694
2781
|
}
|
|
2695
2782
|
// packages/core/src/services/auth.ts
|
|
2696
|
-
var
|
|
2697
|
-
function
|
|
2698
|
-
|
|
2783
|
+
var Zr, Qr;
|
|
2784
|
+
function $r(e, t) {
|
|
2785
|
+
Zr = e, Qr = t;
|
|
2699
2786
|
}
|
|
2700
|
-
async function
|
|
2701
|
-
if (
|
|
2702
|
-
let t =
|
|
2787
|
+
async function ei(e) {
|
|
2788
|
+
if (K(), !Zr || !Qr) return;
|
|
2789
|
+
let t = Q(Qr);
|
|
2703
2790
|
if (!t.isLoggedIn) return;
|
|
2704
|
-
t.expire(), Gt.toast.warning(e ||
|
|
2705
|
-
let n =
|
|
2706
|
-
n.name !== "login" && await
|
|
2707
|
-
name: K(
|
|
2708
|
-
query: n.fullPath ===
|
|
2791
|
+
t.expire(), Gt.toast.warning(e || we("campus.auth.sessionExpired"));
|
|
2792
|
+
let n = Zr.currentRoute.value;
|
|
2793
|
+
n.name !== "login" && await Zr.replace({
|
|
2794
|
+
name: q(K()).login,
|
|
2795
|
+
query: n.fullPath === Ne(K()).home ? void 0 : { redirect: n.fullPath }
|
|
2709
2796
|
});
|
|
2710
2797
|
}
|
|
2711
|
-
async function
|
|
2712
|
-
if (
|
|
2713
|
-
await
|
|
2798
|
+
async function ti(e, t) {
|
|
2799
|
+
if (K(), !Zr || !Qr) throw Error("[campus] 应用尚未创建,无法完成登录");
|
|
2800
|
+
await Xr(Q(Qr), Zr, e, t);
|
|
2714
2801
|
}
|
|
2715
2802
|
// packages/core/src/app.ts
|
|
2716
|
-
function
|
|
2717
|
-
|
|
2718
|
-
let t = r(
|
|
2803
|
+
function ni(e) {
|
|
2804
|
+
It(e), ke(e);
|
|
2805
|
+
let t = r(Ee), n = F();
|
|
2719
2806
|
t.use(n);
|
|
2720
|
-
let i =
|
|
2807
|
+
let i = Se(e);
|
|
2721
2808
|
t.use(i);
|
|
2722
2809
|
let a = (e, t) => i.global.t(e, t ?? {});
|
|
2723
2810
|
t.provide(R, a), zt(a), t.config.globalProperties.$ca = Gt, L(t), t.component("CaAuthPreview", sn);
|
|
2724
|
-
let o =
|
|
2725
|
-
return
|
|
2811
|
+
let o = Yr(e, n);
|
|
2812
|
+
return $r(o, n), t.use(o), Ve(n).boot(), t;
|
|
2726
2813
|
}
|
|
2727
2814
|
// packages/core/src/index.ts
|
|
2728
|
-
function
|
|
2815
|
+
function ri(e) {
|
|
2729
2816
|
return e;
|
|
2730
2817
|
}
|
|
2731
|
-
export { Gt as ca,
|
|
2818
|
+
export { Gt as ca, ti as completeLogin, ni as createCampusApp, ri as defineMenus, ei as handleUnauthorized, Ft as resolveEnvironment, we as t, G as useCampusT, Z as useLayoutStore, Q as useSessionStore, ft as useTabsStore, Ve as useThemeStore };
|