@campus-admin/core 2.0.5 → 2.0.7
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/context.d.ts +1 -12
- package/dist/i18n.d.ts +64 -0
- package/dist/index.js +661 -475
- package/dist/router.d.ts +3 -1
- package/dist/stores/layout.d.ts +45 -3
- package/dist/style.css +1 -1
- package/dist/types.d.ts +10 -5
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -5,58 +5,58 @@ import "@campus-admin/theme/nova.css";
|
|
|
5
5
|
import { Fragment as e, KeepAlive as t, computed as n, createApp as r, createBlock as i, createCommentVNode as a, createElementBlock as o, createElementVNode as s, createStaticVNode as c, createTextVNode as l, createVNode as u, defineComponent as d, h as f, mergeModels as p, nextTick as m, normalizeClass as h, normalizeStyle as g, onBeforeUnmount as _, onMounted as v, openBlock as y, reactive as b, ref as x, renderList as S, renderSlot as C, resolveComponent as w, resolveDynamicComponent as T, toDisplayString as E, unref as D, useModel as O, vShow as k, watch as A, watchEffect as j, withCtx as M, withDirectives as N, withModifiers as P } from "vue";
|
|
6
6
|
import { createPinia as F, defineStore as I } from "pinia";
|
|
7
7
|
import { installUi as L, translateKey as R } from "@campus-admin/ui";
|
|
8
|
-
import { LOCALES as
|
|
9
|
-
import { createI18n as
|
|
10
|
-
import { RouterLink as
|
|
11
|
-
import { applyTheme as
|
|
12
|
-
import { ElLoading as
|
|
8
|
+
import { LOCALES as z, frameworkMessages as ee } from "@campus-admin/locale";
|
|
9
|
+
import { createI18n as te, useI18n as B } from "vue-i18n";
|
|
10
|
+
import { RouterLink as V, createRouter as ne, createWebHashHistory as H, createWebHistory as re, useRoute as U, useRouter as W } from "vue-router";
|
|
11
|
+
import { applyTheme as ie, deriveCssVars as ae, isHexColor as oe, resolveMode as se, resolveTheme as ce } from "@campus-admin/theme";
|
|
12
|
+
import { ElLoading as le, ElMessage as ue, ElMessageBox as de, ElNotification as fe } from "element-plus";
|
|
13
13
|
import "element-plus/es/components/loading/style/css";
|
|
14
14
|
import "element-plus/es/components/notification/style/css";
|
|
15
15
|
import "element-plus/es/components/message/style/css";
|
|
16
16
|
import "element-plus/es/components/message-box/style/css";
|
|
17
17
|
export * from "@campus-admin/ui";
|
|
18
18
|
// packages/core/src/storage.ts
|
|
19
|
-
var
|
|
20
|
-
function
|
|
19
|
+
var pe = "ca:";
|
|
20
|
+
function me(e, t = "local") {
|
|
21
21
|
try {
|
|
22
|
-
return (t === "local" ? localStorage : sessionStorage).getItem(
|
|
22
|
+
return (t === "local" ? localStorage : sessionStorage).getItem(pe + e);
|
|
23
23
|
} catch {
|
|
24
24
|
return null;
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
-
function
|
|
27
|
+
function G(e, t, n = "local") {
|
|
28
28
|
try {
|
|
29
29
|
let r = n === "local" ? localStorage : sessionStorage;
|
|
30
|
-
t === null ? r.removeItem(
|
|
30
|
+
t === null ? r.removeItem(pe + e) : r.setItem(pe + e, t);
|
|
31
31
|
} catch {}
|
|
32
32
|
}
|
|
33
|
-
function
|
|
34
|
-
let n =
|
|
33
|
+
function he(e, t = "local") {
|
|
34
|
+
let n = me(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 ge(e, t, n = "local") {
|
|
42
|
+
G(e, JSON.stringify(t), n);
|
|
43
43
|
}
|
|
44
44
|
// packages/core/src/i18n.ts
|
|
45
|
-
var
|
|
46
|
-
function
|
|
45
|
+
var _e = (e) => typeof e == "object" && !!e && !Array.isArray(e);
|
|
46
|
+
function ve(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] = _e(t) && _e(r) ? ve(t, r) : r;
|
|
51
51
|
}
|
|
52
52
|
return n;
|
|
53
53
|
}
|
|
54
|
-
var
|
|
55
|
-
function
|
|
54
|
+
var ye = "locale";
|
|
55
|
+
function be(e) {
|
|
56
56
|
return e === "zh-CN" || e === "en-US";
|
|
57
57
|
}
|
|
58
|
-
function
|
|
59
|
-
let t =
|
|
58
|
+
function xe(e) {
|
|
59
|
+
let t = me(ye), n = be(t) ? t : e.defaultLocale ?? "zh-CN", r = Object.fromEntries(["zh-CN", "en-US"].map((t) => [t, ve(ee[t], e.messages?.[t] ?? {})])), i = te({
|
|
60
60
|
legacy: !1,
|
|
61
61
|
locale: n,
|
|
62
62
|
fallbackLocale: "zh-CN",
|
|
@@ -64,17 +64,17 @@ 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 }), Se = i, i;
|
|
68
68
|
}
|
|
69
|
-
var
|
|
70
|
-
function
|
|
71
|
-
return
|
|
69
|
+
var Se;
|
|
70
|
+
function Ce(e, t) {
|
|
71
|
+
return Se ? Se.global.t(e, t ?? {}) : e;
|
|
72
72
|
}
|
|
73
|
-
function
|
|
74
|
-
|
|
73
|
+
function we(e) {
|
|
74
|
+
G(ye, e);
|
|
75
75
|
}
|
|
76
|
-
function
|
|
77
|
-
let { t: e, te: t, locale: n } =
|
|
76
|
+
function K() {
|
|
77
|
+
let { t: e, te: t, locale: n } = B();
|
|
78
78
|
return {
|
|
79
79
|
t: e,
|
|
80
80
|
te: t,
|
|
@@ -83,10 +83,10 @@ function W() {
|
|
|
83
83
|
};
|
|
84
84
|
}
|
|
85
85
|
// packages/core/src/CampusRoot.vue
|
|
86
|
-
var
|
|
86
|
+
var Te = /* @__PURE__ */ d({
|
|
87
87
|
__name: "CampusRoot",
|
|
88
88
|
setup(e) {
|
|
89
|
-
let { locale: t } =
|
|
89
|
+
let { locale: t } = K();
|
|
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,61 +97,76 @@ var De = /* @__PURE__ */ d({
|
|
|
97
97
|
}
|
|
98
98
|
});
|
|
99
99
|
// packages/core/src/types.ts
|
|
100
|
-
function
|
|
100
|
+
function Ee(e) {
|
|
101
101
|
return "children" in e;
|
|
102
102
|
}
|
|
103
103
|
// packages/core/src/context.ts
|
|
104
|
-
var
|
|
105
|
-
function
|
|
106
|
-
|
|
104
|
+
var De;
|
|
105
|
+
function Oe(e) {
|
|
106
|
+
De = e;
|
|
107
107
|
}
|
|
108
|
-
function
|
|
109
|
-
if (!
|
|
110
|
-
return
|
|
108
|
+
function q() {
|
|
109
|
+
if (!De) throw Error("[campus] 请先调用 createCampusApp()");
|
|
110
|
+
return De;
|
|
111
111
|
}
|
|
112
|
-
function
|
|
113
|
-
for (let t of
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
t.title,
|
|
117
|
-
n
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
112
|
+
function ke(e) {
|
|
113
|
+
for (let t of q().menus) {
|
|
114
|
+
if (t.key === e && t.path) return { titles: [t.title] };
|
|
115
|
+
for (let n of t.children) {
|
|
116
|
+
if (n.key === e && n.path) return { titles: [t.title, n.title] };
|
|
117
|
+
if (Ee(n)) {
|
|
118
|
+
let r = n.children.find((t) => t.key === e);
|
|
119
|
+
if (r) return { titles: [
|
|
120
|
+
t.title,
|
|
121
|
+
n.title,
|
|
122
|
+
r.title
|
|
123
|
+
] };
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
121
127
|
}
|
|
122
|
-
var
|
|
128
|
+
var Ae = [
|
|
123
129
|
"none",
|
|
124
130
|
"panel",
|
|
125
131
|
"all"
|
|
126
132
|
];
|
|
127
|
-
function
|
|
133
|
+
function je(e) {
|
|
128
134
|
let t = [], n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set();
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
135
|
+
function o(e, s, c, l = 1) {
|
|
136
|
+
let u = l === 1 ? i : l === 2 && Ee(e) ? a : void 0;
|
|
137
|
+
if (u?.has(e.key)) throw Error(`[campus] 菜单${l === 1 ? "一级场景键" : "组键"}重复:${e.key}`);
|
|
138
|
+
u?.add(e.key);
|
|
139
|
+
let d = e.path !== void 0;
|
|
140
|
+
if (d !== (e.component !== void 0)) throw Error(`[campus] 菜单 path 与 component 必须同时出现:${e.key}`);
|
|
141
|
+
if (d) {
|
|
142
|
+
if (n.has(e.key)) throw Error(`[campus] 菜单页面键重复:${e.key}`);
|
|
143
|
+
if (n.add(e.key), typeof e.path != "string" || !e.path.startsWith("/")) throw Error(`[campus] 菜单路径必须以 / 开头:${e.path}`);
|
|
144
|
+
if (typeof e.component != "function") throw Error(`[campus] 菜单 component 必须是懒加载函数:${e.key}`);
|
|
145
|
+
if (r.has(e.path)) throw Error(`[campus] 菜单路径重复:${e.path}`);
|
|
146
|
+
r.add(e.path);
|
|
147
|
+
let { children: i, ...a } = e, o = {
|
|
148
|
+
...a,
|
|
149
|
+
appKey: s,
|
|
150
|
+
groupKey: l === 2 && Ee(e) ? e.key : c
|
|
151
|
+
};
|
|
152
|
+
o.sideCollapse != null && !Ae.includes(o.sideCollapse) && (console.warn(`[campus] 菜单页面 sideCollapse 只能是 none / panel / all,已忽略:${e.key}`), delete o.sideCollapse), o.openMode != null && ![
|
|
153
|
+
"normal",
|
|
154
|
+
"collapsePanel",
|
|
155
|
+
"collapseAll",
|
|
156
|
+
"content",
|
|
157
|
+
"screen"
|
|
158
|
+
].includes(o.openMode) && (console.warn(`[campus] 菜单页面 openMode 无效,已忽略:${e.key}`), delete o.openMode), t.push(o);
|
|
159
|
+
}
|
|
160
|
+
if (l === 3 && ("children" in e || !d)) throw Error(`[campus] 三级菜单必须是页面且不能有子菜单:${e.key}`);
|
|
161
|
+
if ("children" in e) {
|
|
162
|
+
if (!Array.isArray(e.children)) throw Error(`[campus] 菜单 children 必须是数组:${e.key}`);
|
|
163
|
+
for (let t of e.children) o(t, s, l === 2 ? e.key : void 0, l + 1);
|
|
150
164
|
}
|
|
151
165
|
}
|
|
166
|
+
for (let t of e) o(t, t.key);
|
|
152
167
|
return t;
|
|
153
168
|
}
|
|
154
|
-
function
|
|
169
|
+
function Me(e) {
|
|
155
170
|
let t = {
|
|
156
171
|
home: "/",
|
|
157
172
|
login: "/login",
|
|
@@ -171,21 +186,21 @@ function Pe(e) {
|
|
|
171
186
|
])).size !== 5) throw Error("[campus] 系统页面路径不能重复");
|
|
172
187
|
return t;
|
|
173
188
|
}
|
|
174
|
-
function
|
|
175
|
-
let n = e.homeEntry === !1 ? void 0 :
|
|
189
|
+
function Ne(e, t) {
|
|
190
|
+
let n = e.homeEntry === !1 ? void 0 : je(e.menus).find((e) => e.affix && t(e.permission)), r = !e.accountInMenu && !e.onAccountClick, i = (i) => !!i.path && t(i.permission) && i.key !== n?.key && (!r || i.path !== e.accountPath);
|
|
191
|
+
function a(e) {
|
|
192
|
+
let t = "children" in e ? e.children.map((e) => a(e)).filter((e) => e !== void 0) : [], n = i(e);
|
|
193
|
+
if (!n && !t.length) return;
|
|
194
|
+
let r = { ...e };
|
|
195
|
+
return "children" in r && (r.children = t), n || (delete r.path, delete r.component, delete r.permission, delete r.affix), r;
|
|
196
|
+
}
|
|
176
197
|
return {
|
|
177
198
|
home: n,
|
|
178
|
-
apps: e.menus.map((e) => (
|
|
179
|
-
...e,
|
|
180
|
-
children: e.children.map((e) => Oe(e) ? {
|
|
181
|
-
...e,
|
|
182
|
-
children: e.children.filter(i)
|
|
183
|
-
} : e).filter((e) => Oe(e) ? e.children.length > 0 : i(e))
|
|
184
|
-
})).filter((e) => e.children.length > 0),
|
|
199
|
+
apps: e.menus.map((e) => a(e)).filter((e) => e !== void 0),
|
|
185
200
|
accountStandalone: r
|
|
186
201
|
};
|
|
187
202
|
}
|
|
188
|
-
function
|
|
203
|
+
function J(e) {
|
|
189
204
|
return {
|
|
190
205
|
login: "login",
|
|
191
206
|
register: "register",
|
|
@@ -196,51 +211,51 @@ function K(e) {
|
|
|
196
211
|
};
|
|
197
212
|
}
|
|
198
213
|
// packages/core/src/stores/theme.ts
|
|
199
|
-
var
|
|
200
|
-
function
|
|
201
|
-
return
|
|
214
|
+
var Pe = "theme-mode", Fe = "box-style", Ie = "user-primary";
|
|
215
|
+
function Le() {
|
|
216
|
+
return me(Fe) === "border" ? "border" : "shadow";
|
|
202
217
|
}
|
|
203
|
-
function
|
|
204
|
-
let e =
|
|
205
|
-
return
|
|
218
|
+
function Re() {
|
|
219
|
+
let e = me(Ie);
|
|
220
|
+
return oe(e) ? e : void 0;
|
|
206
221
|
}
|
|
207
|
-
function
|
|
208
|
-
let e =
|
|
222
|
+
function ze() {
|
|
223
|
+
let e = me(Pe);
|
|
209
224
|
return e === "light" || e === "dark" || e === "auto" ? e : "auto";
|
|
210
225
|
}
|
|
211
|
-
var
|
|
212
|
-
let e = x({}), t = x(
|
|
226
|
+
var Be = I("campus-theme", () => {
|
|
227
|
+
let e = x({}), t = x(ze()), r = x(Le()), i = x(Re()), a = typeof matchMedia == "function" ? matchMedia("(prefers-color-scheme: dark)") : void 0, o = x(a?.matches ?? !1);
|
|
213
228
|
a?.addEventListener("change", (e) => o.value = e.matches);
|
|
214
|
-
let s = n(() =>
|
|
229
|
+
let s = n(() => ce(e.value)), c = n(() => e.value.tenantDefault?.locks?.includes("primary") ?? !1), l = n(() => {
|
|
215
230
|
let e = s.value.theme, t = i.value;
|
|
216
231
|
return !t || c.value ? e : {
|
|
217
232
|
...e,
|
|
218
233
|
primary: t,
|
|
219
234
|
headerBg: e.headerBg === e.primary ? t : e.headerBg
|
|
220
235
|
};
|
|
221
|
-
}), u = n(() => s.value.issues), d = n(() =>
|
|
222
|
-
j(() =>
|
|
236
|
+
}), u = n(() => s.value.issues), d = n(() => se(t.value, o.value)), f = n(() => ae(l.value, d.value));
|
|
237
|
+
j(() => ie(f.value, d.value, l.value.style)), j(() => {
|
|
223
238
|
document.documentElement.dataset.caBox = r.value;
|
|
224
239
|
});
|
|
225
240
|
function p(e) {
|
|
226
|
-
(e === void 0 ||
|
|
241
|
+
(e === void 0 || oe(e)) && (i.value = e, G(Ie, e ?? null));
|
|
227
242
|
}
|
|
228
243
|
function h(e) {
|
|
229
|
-
r.value = e,
|
|
244
|
+
r.value = e, G(Fe, e);
|
|
230
245
|
}
|
|
231
246
|
function g() {
|
|
232
|
-
return `theme-layers:${
|
|
247
|
+
return `theme-layers:${q().theme?.cacheKey ?? location.host}`;
|
|
233
248
|
}
|
|
234
249
|
function _(e) {
|
|
235
|
-
t.value = e,
|
|
250
|
+
t.value = e, G(Pe, e);
|
|
236
251
|
}
|
|
237
252
|
function v(e, t) {
|
|
238
|
-
let n = document, r =
|
|
253
|
+
let n = document, r = se(e, o.value) !== d.value, i = typeof matchMedia == "function" && matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
239
254
|
if (!t || !r || i || !n.startViewTransition) {
|
|
240
255
|
_(e);
|
|
241
256
|
return;
|
|
242
257
|
}
|
|
243
|
-
let a = Math.hypot(Math.max(t.x, innerWidth - t.x), Math.max(t.y, innerHeight - t.y)), s =
|
|
258
|
+
let a = Math.hypot(Math.max(t.x, innerWidth - t.x), Math.max(t.y, innerHeight - t.y)), s = se(e, o.value) === "dark", c = document.documentElement;
|
|
244
259
|
c.dataset.caThemeTransition = s ? "to-dark" : "to-light";
|
|
245
260
|
let l = !1, u = () => {
|
|
246
261
|
l || (l = !0, _(e));
|
|
@@ -259,12 +274,12 @@ var He = I("campus-theme", () => {
|
|
|
259
274
|
}).catch(() => {});
|
|
260
275
|
}
|
|
261
276
|
function y(t, n = !0) {
|
|
262
|
-
e.value = t, n &&
|
|
277
|
+
e.value = t, n && ge(g(), t);
|
|
263
278
|
}
|
|
264
279
|
async function b() {
|
|
265
|
-
let t =
|
|
280
|
+
let t = he(g());
|
|
266
281
|
t && (e.value = t);
|
|
267
|
-
let n =
|
|
282
|
+
let n = q().theme?.load;
|
|
268
283
|
if (n) {
|
|
269
284
|
try {
|
|
270
285
|
y(await n());
|
|
@@ -292,16 +307,16 @@ var He = I("campus-theme", () => {
|
|
|
292
307
|
};
|
|
293
308
|
});
|
|
294
309
|
// packages/core/src/copyright.ts
|
|
295
|
-
function
|
|
310
|
+
function Ve(e, t = (/* @__PURE__ */ new Date()).getFullYear()) {
|
|
296
311
|
return e.replaceAll("{year}", String(t));
|
|
297
312
|
}
|
|
298
313
|
// packages/core/src/pages/auth/options.ts
|
|
299
|
-
var
|
|
300
|
-
function
|
|
301
|
-
return
|
|
314
|
+
var He = /^1[3-9]\d{9}$/;
|
|
315
|
+
function Y() {
|
|
316
|
+
return q().login ?? {};
|
|
302
317
|
}
|
|
303
|
-
function
|
|
304
|
-
let e =
|
|
318
|
+
function Ue() {
|
|
319
|
+
let e = q().auth;
|
|
305
320
|
return {
|
|
306
321
|
captcha: typeof e.captcha == "function",
|
|
307
322
|
register: typeof e.register == "function" && typeof e.sendSmsCode == "function",
|
|
@@ -309,37 +324,37 @@ function J() {
|
|
|
309
324
|
forgot: typeof e.resetPassword == "function" && typeof e.sendSmsCode == "function"
|
|
310
325
|
};
|
|
311
326
|
}
|
|
312
|
-
function
|
|
313
|
-
return typeof e == "string" && e.startsWith("/") && !e.startsWith("//") ? e :
|
|
327
|
+
function We(e) {
|
|
328
|
+
return typeof e == "string" && e.startsWith("/") && !e.startsWith("//") ? e : Me(q()).home;
|
|
314
329
|
}
|
|
315
330
|
// packages/core/src/pages/auth/AuthShell.vue?vue&type=script&setup=true&lang.ts
|
|
316
|
-
var
|
|
331
|
+
var Ge = {
|
|
317
332
|
key: 0,
|
|
318
333
|
class: "ca-auth__title"
|
|
319
|
-
},
|
|
334
|
+
}, Ke = ["src"], qe = { class: "ca-auth__qrcode" }, Je = ["src", "alt"], Ye = {
|
|
320
335
|
key: 0,
|
|
321
336
|
class: "ca-auth__caption"
|
|
322
|
-
},
|
|
337
|
+
}, Xe = { class: "ca-auth__site" }, Ze = {
|
|
323
338
|
key: 0,
|
|
324
339
|
class: "ca-auth__caption"
|
|
325
|
-
},
|
|
340
|
+
}, Qe = { class: "ca-auth__main" }, $e = { class: "ca-auth__brand" }, et = ["src"], tt = {
|
|
326
341
|
class: "ca-auth__tabs",
|
|
327
342
|
role: "tablist"
|
|
328
|
-
},
|
|
343
|
+
}, nt = [
|
|
329
344
|
"aria-selected",
|
|
330
345
|
"tabindex",
|
|
331
346
|
"onClick",
|
|
332
347
|
"onKeydown"
|
|
333
|
-
],
|
|
348
|
+
], rt = {
|
|
334
349
|
class: "ca-auth__body",
|
|
335
350
|
role: "tabpanel"
|
|
336
|
-
},
|
|
351
|
+
}, it = {
|
|
337
352
|
key: 0,
|
|
338
353
|
class: "ca-auth__footer"
|
|
339
|
-
},
|
|
354
|
+
}, at = {
|
|
340
355
|
key: 0,
|
|
341
356
|
class: "ca-auth__version"
|
|
342
|
-
},
|
|
357
|
+
}, ot = /*@__PURE__*/ d({
|
|
343
358
|
__name: "AuthShell",
|
|
344
359
|
props: {
|
|
345
360
|
tabs: {},
|
|
@@ -348,13 +363,13 @@ var Ke = {
|
|
|
348
363
|
},
|
|
349
364
|
emits: ["update:active"],
|
|
350
365
|
setup(t, { emit: r }) {
|
|
351
|
-
let c = t, u = r, { t: d, label: f } =
|
|
366
|
+
let c = t, u = r, { t: d, label: f } = K(), p = q().brand, m = Y(), _ = Be(), 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
367
|
let e = m.panel?.caption ?? p.subtitle;
|
|
353
368
|
return e ? f(e) : "";
|
|
354
369
|
}), 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
370
|
let e = m.card, t = {}, n = A(e?.width), r = A(e?.minHeight), i = A(e?.panelWidth), a = A(e?.radius);
|
|
356
371
|
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) =>
|
|
372
|
+
}), N = n(() => m.background ?? "var(--ca-login-bg)"), P = n(() => m.footer ? m.footer.map((e) => Ve(f(e))) : p.copyright ? Ve(f(p.copyright)).split("\n").filter(Boolean) : []);
|
|
358
373
|
function F(e, t) {
|
|
359
374
|
if (e.key !== "ArrowRight" && e.key !== "ArrowLeft") return;
|
|
360
375
|
let n = (t + (e.key === "ArrowRight" ? 1 : -1) + c.tabs.length) % c.tabs.length, r = c.tabs[n];
|
|
@@ -370,24 +385,24 @@ var Ke = {
|
|
|
370
385
|
class: "ca-auth__panel",
|
|
371
386
|
style: g(k.value ? { background: k.value } : void 0)
|
|
372
387
|
}, [
|
|
373
|
-
O.value && w.value ? (y(), o("h2",
|
|
388
|
+
O.value && w.value ? (y(), o("h2", Ge, E(O.value), 1)) : a("v-if", !0),
|
|
374
389
|
x.value ? (y(), o("img", {
|
|
375
390
|
key: 1,
|
|
376
391
|
src: x.value,
|
|
377
392
|
alt: "",
|
|
378
393
|
class: "ca-auth__logo"
|
|
379
|
-
}, null, 8,
|
|
380
|
-
w.value ? (y(), o(e, { key: 2 }, [s("div",
|
|
394
|
+
}, null, 8, Ke)) : a("v-if", !0),
|
|
395
|
+
w.value ? (y(), o(e, { key: 2 }, [s("div", qe, [s("img", {
|
|
381
396
|
src: w.value,
|
|
382
397
|
alt: D(d)("campus.auth.qrcodeAlt")
|
|
383
|
-
}, null, 8,
|
|
384
|
-
], 4), s("section",
|
|
385
|
-
s("div",
|
|
398
|
+
}, 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))
|
|
399
|
+
], 4), s("section", Qe, [
|
|
400
|
+
s("div", $e, [b.value ? (y(), o("img", {
|
|
386
401
|
key: 0,
|
|
387
402
|
src: b.value,
|
|
388
403
|
alt: ""
|
|
389
|
-
}, null, 8,
|
|
390
|
-
s("div",
|
|
404
|
+
}, null, 8, et)) : a("v-if", !0), s("span", null, E(v.value), 1)]),
|
|
405
|
+
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(V), {
|
|
391
406
|
key: 0,
|
|
392
407
|
to: n.to,
|
|
393
408
|
role: "tab",
|
|
@@ -406,52 +421,139 @@ var Ke = {
|
|
|
406
421
|
tabindex: n.key === t.active ? 0 : -1,
|
|
407
422
|
onClick: (e) => n.to ? void 0 : u("update:active", n.key),
|
|
408
423
|
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",
|
|
424
|
+
}, E(n.label), 43, nt))], 64))), 128))]),
|
|
425
|
+
s("div", rt, [C(n.$slots, "default", {}, void 0, !0)]),
|
|
426
|
+
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)
|
|
427
|
+
])], 4), D(m).version ? (y(), o("span", at, E(D(m).version), 1)) : a("v-if", !0)], 4)], 2));
|
|
413
428
|
}
|
|
414
|
-
}),
|
|
429
|
+
}), X = (e, t) => {
|
|
415
430
|
let n = e.__vccOpts || e;
|
|
416
431
|
for (let [e, r] of t) n[e] = r;
|
|
417
432
|
return n;
|
|
418
|
-
},
|
|
419
|
-
let e = x(!1), t = x("desktop"), r = x(!1), i = x(!1), a = x(
|
|
420
|
-
function
|
|
421
|
-
|
|
433
|
+
}, st = /*#__PURE__*/ X(ot, [["__scopeId", "data-v-df817220"]]), ct = "side-collapsed", Z = I("campus-layout", () => {
|
|
434
|
+
let e = x(!1), t = x("desktop"), r = x(!1), i = x(!1), a = x(me(ct) === "1"), o = x(null), s = n(() => o.value ?? a.value), c = x(!1), l = n(() => c.value && t.value === "desktop"), u = x({}), d = x({}), f;
|
|
435
|
+
function p(e, t = !1) {
|
|
436
|
+
f = e, e && !t && (o.value = u.value[e] ?? !1);
|
|
437
|
+
}
|
|
438
|
+
function m(e, t) {
|
|
439
|
+
d.value[e] = t;
|
|
440
|
+
}
|
|
441
|
+
function h(e) {
|
|
442
|
+
e in d.value || m(e, !0);
|
|
443
|
+
}
|
|
444
|
+
async function g(e, n, r) {
|
|
445
|
+
e.path && n !== e.path ? (await r(e.path), m(e.key, !0), t.value === "phone" ? V() : t.value === "pad" && H()) : m(e.key, !(d.value[e.key] ?? !1));
|
|
446
|
+
}
|
|
447
|
+
async function _(e, n, r, a) {
|
|
448
|
+
if (e.path) {
|
|
449
|
+
if (e.path !== n) {
|
|
450
|
+
await r(e.path);
|
|
451
|
+
let n = e.openMode == null ? e.sideCollapse === "panel" || e.sideCollapse === "all" : e.openMode !== "normal";
|
|
452
|
+
a && e.children.length && t.value === "desktop" && !n && (o.value = !1, u.value[e.key] = !1);
|
|
453
|
+
} else e.children.length && (t.value === "desktop" ? v() : t.value === "pad" && (i.value = !i.value));
|
|
454
|
+
e.path !== n && e.children.length && t.value === "pad" && H(), e.children.length && t.value === "phone" && V(), e.children.length || re();
|
|
455
|
+
} else t.value === "pad" ? i.value = !(a && i.value) : t.value === "desktop" && s.value && v();
|
|
456
|
+
}
|
|
457
|
+
function v() {
|
|
458
|
+
o.value === null ? (a.value = !a.value, G(ct, a.value ? "1" : "0")) : (o.value = !o.value, f && (u.value[f] = o.value));
|
|
422
459
|
}
|
|
423
|
-
function
|
|
460
|
+
function y() {
|
|
424
461
|
c.value = !1, o.value = null;
|
|
425
462
|
}
|
|
426
|
-
function
|
|
463
|
+
function b(e = "none") {
|
|
427
464
|
o.value = e === "panel" || null, c.value = e === "all";
|
|
428
465
|
}
|
|
429
|
-
|
|
430
|
-
|
|
466
|
+
let S = "normal", C = null, w = !1, T, E = !1, D = !1, O = !1, k = x(!1);
|
|
467
|
+
function A() {
|
|
468
|
+
C !== null && (e.value = C);
|
|
469
|
+
}
|
|
470
|
+
function j() {
|
|
471
|
+
w && document.fullscreenElement === document.documentElement && (w = !1, document.exitFullscreen().catch(() => {
|
|
472
|
+
w = document.fullscreenElement === document.documentElement;
|
|
473
|
+
}).finally(() => {
|
|
474
|
+
S === "screen" && !document.fullscreenElement && (D = !0, M());
|
|
475
|
+
}));
|
|
431
476
|
}
|
|
432
|
-
function
|
|
477
|
+
function M() {
|
|
478
|
+
E || (S === "screen" ? O || (D || !document.fullscreenElement ? (e.value = !0, k.value = !0) : (A(), k.value = !1)) : j());
|
|
479
|
+
}
|
|
480
|
+
function N() {
|
|
481
|
+
if (E = !0, document.fullscreenElement) D = !1;
|
|
482
|
+
else if (!T) {
|
|
483
|
+
D = !1;
|
|
484
|
+
try {
|
|
485
|
+
T = document.documentElement.requestFullscreen().then(() => {
|
|
486
|
+
D = !1, w = document.fullscreenElement === document.documentElement;
|
|
487
|
+
}, () => {
|
|
488
|
+
D = !0;
|
|
489
|
+
}).finally(() => {
|
|
490
|
+
T = void 0, M();
|
|
491
|
+
});
|
|
492
|
+
} catch {
|
|
493
|
+
D = !0;
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
function P() {
|
|
498
|
+
E = !1, S !== "screen" && j();
|
|
499
|
+
}
|
|
500
|
+
function F(t, n) {
|
|
501
|
+
S = t ?? "normal", O = !1, k.value = !1, b(t == null ? n : t === "collapsePanel" ? "panel" : t === "collapseAll" ? "all" : "none");
|
|
502
|
+
let r = S === "content" || S === "screen";
|
|
503
|
+
r && C === null && (C = e.value), r || (A(), C = null), S === "content" && (e.value = !0), S === "screen" && !E && N(), E = !1, S === "screen" ? M() : j();
|
|
504
|
+
}
|
|
505
|
+
function I() {
|
|
506
|
+
O = !0, w = !1, k.value = !1;
|
|
507
|
+
}
|
|
508
|
+
function L() {
|
|
509
|
+
w && document.fullscreenElement !== document.documentElement && (w = !1, O = !0, k.value = !1);
|
|
510
|
+
}
|
|
511
|
+
function R() {
|
|
512
|
+
O = !1, N(), E = !1, T || M();
|
|
513
|
+
}
|
|
514
|
+
function z() {
|
|
515
|
+
k.value = !1;
|
|
516
|
+
}
|
|
517
|
+
function ee() {
|
|
518
|
+
O = !0, k.value = !1, e.value = !e.value;
|
|
519
|
+
}
|
|
520
|
+
function te(e) {
|
|
433
521
|
t.value = e, e !== "phone" && (r.value = !1), e !== "pad" && (i.value = !1);
|
|
434
522
|
}
|
|
435
|
-
function
|
|
523
|
+
function B() {
|
|
436
524
|
r.value = !1;
|
|
437
525
|
}
|
|
438
|
-
function
|
|
526
|
+
function V() {
|
|
439
527
|
r.value = !0;
|
|
440
528
|
}
|
|
441
|
-
function
|
|
529
|
+
function ne() {
|
|
442
530
|
i.value = !1;
|
|
443
531
|
}
|
|
444
|
-
function
|
|
532
|
+
function H() {
|
|
445
533
|
i.value = !0;
|
|
446
534
|
}
|
|
447
|
-
function
|
|
535
|
+
function re() {
|
|
448
536
|
r.value = !1, i.value = !1;
|
|
449
537
|
}
|
|
450
|
-
function
|
|
451
|
-
e.value = !1,
|
|
538
|
+
function U() {
|
|
539
|
+
F("normal"), e.value = !1, b("none"), re(), u.value = {}, d.value = {}, f = void 0;
|
|
452
540
|
}
|
|
453
541
|
return {
|
|
454
|
-
|
|
542
|
+
enterParentPage: p,
|
|
543
|
+
menuGroups: d,
|
|
544
|
+
ensureMenuGroup: h,
|
|
545
|
+
setMenuGroup: m,
|
|
546
|
+
clickMenuApp: _,
|
|
547
|
+
clickMenuGroup: g,
|
|
548
|
+
reset: U,
|
|
549
|
+
pageScreenPrompt: k,
|
|
550
|
+
preparePageScreen: N,
|
|
551
|
+
cancelPageScreen: P,
|
|
552
|
+
applyPageOpenMode: F,
|
|
553
|
+
pageScreenManual: I,
|
|
554
|
+
syncPageScreen: L,
|
|
555
|
+
retryPageScreen: R,
|
|
556
|
+
dismissPageScreenPrompt: z,
|
|
455
557
|
contentFullscreen: e,
|
|
456
558
|
mode: t,
|
|
457
559
|
mobileMenuOpen: r,
|
|
@@ -461,41 +563,41 @@ var Ke = {
|
|
|
461
563
|
sidePanelCollapsed: s,
|
|
462
564
|
sideHidden: c,
|
|
463
565
|
sideHiddenActive: l,
|
|
464
|
-
toggleSidePanel:
|
|
465
|
-
showSide:
|
|
466
|
-
applySideCollapse:
|
|
467
|
-
toggleContentFullscreen:
|
|
468
|
-
setMode:
|
|
469
|
-
closeMobileMenu:
|
|
470
|
-
openMobileMenu:
|
|
471
|
-
closePadPanel:
|
|
472
|
-
openPadPanel:
|
|
473
|
-
closeOverlays:
|
|
566
|
+
toggleSidePanel: v,
|
|
567
|
+
showSide: y,
|
|
568
|
+
applySideCollapse: b,
|
|
569
|
+
toggleContentFullscreen: ee,
|
|
570
|
+
setMode: te,
|
|
571
|
+
closeMobileMenu: B,
|
|
572
|
+
openMobileMenu: V,
|
|
573
|
+
closePadPanel: ne,
|
|
574
|
+
openPadPanel: H,
|
|
575
|
+
closeOverlays: re
|
|
474
576
|
};
|
|
475
577
|
});
|
|
476
578
|
// packages/core/src/tabs-policy.ts
|
|
477
|
-
function
|
|
579
|
+
function lt(e, t, n = Date.now()) {
|
|
478
580
|
return {
|
|
479
581
|
...e,
|
|
480
582
|
[t]: Math.max(n, ...Object.values(e).map((e) => e + 1))
|
|
481
583
|
};
|
|
482
584
|
}
|
|
483
|
-
function
|
|
585
|
+
function ut(e, t, n, r, i) {
|
|
484
586
|
let a = e.filter((e) => !r.includes(e));
|
|
485
587
|
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
588
|
}
|
|
487
589
|
// packages/core/src/stores/tabs.ts
|
|
488
|
-
var
|
|
489
|
-
let e =
|
|
590
|
+
var dt = "tabs", ft = I("campus-tabs", () => {
|
|
591
|
+
let e = je(q().menus), t = new Set(e.map((e) => e.key)), r = e.filter((e) => e.affix).map((e) => e.key), i = he(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 = q().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
592
|
for (let [e, t] of d.value.entries()) Number.isFinite(p.value[t]) || (p.value[t] = e + 1);
|
|
491
593
|
for (;;) {
|
|
492
|
-
let e =
|
|
594
|
+
let e = ut(d.value, p.value, "", s.value, l);
|
|
493
595
|
if (!e) break;
|
|
494
596
|
d.value.splice(d.value.indexOf(e), 1), delete p.value[e];
|
|
495
597
|
}
|
|
496
598
|
let h = x({}), g = x(null), _ = n(() => d.value.filter((e) => e !== g.value));
|
|
497
599
|
function v() {
|
|
498
|
-
p.value = Object.fromEntries(d.value.map((e) => [e, p.value[e] ?? 0])),
|
|
600
|
+
p.value = Object.fromEntries(d.value.map((e) => [e, p.value[e] ?? 0])), ge(dt, {
|
|
499
601
|
visited: d.value,
|
|
500
602
|
active: p.value,
|
|
501
603
|
affix: o.value
|
|
@@ -503,8 +605,8 @@ var ft = "tabs", pt = I("campus-tabs", () => {
|
|
|
503
605
|
}
|
|
504
606
|
function y(e) {
|
|
505
607
|
if (!t.has(e)) return;
|
|
506
|
-
d.value.includes(e) || d.value.push(e), p.value =
|
|
507
|
-
let n =
|
|
608
|
+
d.value.includes(e) || d.value.push(e), p.value = lt(p.value, e);
|
|
609
|
+
let n = ut(d.value, p.value, e, s.value, l);
|
|
508
610
|
n && d.value.splice(d.value.indexOf(n), 1), v();
|
|
509
611
|
}
|
|
510
612
|
function b(e) {
|
|
@@ -552,8 +654,8 @@ var ft = "tabs", pt = I("campus-tabs", () => {
|
|
|
552
654
|
refresh: E,
|
|
553
655
|
setAffix: D
|
|
554
656
|
};
|
|
555
|
-
}),
|
|
556
|
-
let e =
|
|
657
|
+
}), pt = "session", Q = I("campus-session", () => {
|
|
658
|
+
let e = he(pt, "session"), t = x(e?.token ?? ""), r = x(e?.user), i = n(() => !!(t.value && r.value));
|
|
557
659
|
function a(e) {
|
|
558
660
|
if (!e) return !0;
|
|
559
661
|
let t = r.value?.permissions;
|
|
@@ -563,28 +665,28 @@ var ft = "tabs", pt = I("campus-tabs", () => {
|
|
|
563
665
|
r.value && (r.value = {
|
|
564
666
|
...r.value,
|
|
565
667
|
permissions: e
|
|
566
|
-
},
|
|
668
|
+
}, ge(pt, {
|
|
567
669
|
token: t.value,
|
|
568
670
|
user: r.value
|
|
569
671
|
}, "session"));
|
|
570
672
|
}
|
|
571
673
|
async function s(e) {
|
|
572
|
-
c(await
|
|
674
|
+
c(await q().auth.login(e));
|
|
573
675
|
}
|
|
574
676
|
function c(e) {
|
|
575
|
-
t.value = e.token, r.value = e.user,
|
|
677
|
+
t.value = e.token, r.value = e.user, ge(pt, e, "session");
|
|
576
678
|
}
|
|
577
679
|
async function l() {
|
|
578
680
|
try {
|
|
579
|
-
await
|
|
681
|
+
await q().auth.logout?.();
|
|
580
682
|
} catch (e) {
|
|
581
683
|
console.warn("[campus] 退出时通知服务端失败,已清除本地登录态:", e);
|
|
582
684
|
} finally {
|
|
583
|
-
t.value = "", r.value = void 0,
|
|
685
|
+
t.value = "", r.value = void 0, G(pt, null, "session"), ft().reset(), Z().reset();
|
|
584
686
|
}
|
|
585
687
|
}
|
|
586
688
|
function u() {
|
|
587
|
-
t.value = "", r.value = void 0,
|
|
689
|
+
t.value = "", r.value = void 0, G(pt, null, "session"), ft().reset(), Z().reset();
|
|
588
690
|
}
|
|
589
691
|
return {
|
|
590
692
|
token: t,
|
|
@@ -597,7 +699,7 @@ var ft = "tabs", pt = I("campus-tabs", () => {
|
|
|
597
699
|
logout: l,
|
|
598
700
|
expire: u
|
|
599
701
|
};
|
|
600
|
-
}),
|
|
702
|
+
}), mt = {
|
|
601
703
|
class: "ca-auth-icon",
|
|
602
704
|
viewBox: "0 0 24 24",
|
|
603
705
|
width: "16",
|
|
@@ -608,7 +710,7 @@ var ft = "tabs", pt = I("campus-tabs", () => {
|
|
|
608
710
|
"stroke-linecap": "round",
|
|
609
711
|
"stroke-linejoin": "round",
|
|
610
712
|
"aria-hidden": "true"
|
|
611
|
-
},
|
|
713
|
+
}, ht = ["d"], $ = /* @__PURE__ */ d({
|
|
612
714
|
__name: "AuthIcon",
|
|
613
715
|
props: { name: {} },
|
|
614
716
|
setup(e) {
|
|
@@ -619,13 +721,13 @@ var ft = "tabs", pt = I("campus-tabs", () => {
|
|
|
619
721
|
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
722
|
message: "M4 5h16v11H9l-4 3.500V16H4z"
|
|
621
723
|
};
|
|
622
|
-
return (n, r) => (y(), o("svg",
|
|
724
|
+
return (n, r) => (y(), o("svg", mt, [s("path", { d: t[e.name] }, null, 8, ht)]));
|
|
623
725
|
}
|
|
624
|
-
}),
|
|
726
|
+
}), gt = { class: "ca-auth-row" }, _t = [
|
|
625
727
|
"title",
|
|
626
728
|
"aria-label",
|
|
627
729
|
"disabled"
|
|
628
|
-
],
|
|
730
|
+
], vt = ["src"], yt = { key: 1 }, bt = /* @__PURE__ */ d({
|
|
629
731
|
__name: "CaptchaField",
|
|
630
732
|
props: /*@__PURE__*/ p({ scene: {} }, {
|
|
631
733
|
code: { default: "" },
|
|
@@ -635,11 +737,11 @@ var ft = "tabs", pt = I("campus-tabs", () => {
|
|
|
635
737
|
}),
|
|
636
738
|
emits: ["update:code", "update:captchaKey"],
|
|
637
739
|
setup(e, { expose: t }) {
|
|
638
|
-
let n = e, r = O(e, "code"), i = O(e, "captchaKey"), { t: c, label: l } =
|
|
740
|
+
let n = e, r = O(e, "code"), i = O(e, "captchaKey"), { t: c, label: l } = K(), d = Y().fields?.captcha, f = x(""), p = x(!1), m = x(!1);
|
|
639
741
|
async function h() {
|
|
640
742
|
m.value = !0;
|
|
641
743
|
try {
|
|
642
|
-
let e = await
|
|
744
|
+
let e = await q().auth.captcha(n.scene);
|
|
643
745
|
i.value = e.key, f.value = e.image, p.value = !1;
|
|
644
746
|
} catch {
|
|
645
747
|
f.value = "", p.value = !0;
|
|
@@ -649,7 +751,7 @@ var ft = "tabs", pt = I("campus-tabs", () => {
|
|
|
649
751
|
}
|
|
650
752
|
return v(h), t({ refresh: h }), (e, t) => {
|
|
651
753
|
let n = w("ca-input");
|
|
652
|
-
return y(), o("div",
|
|
754
|
+
return y(), o("div", gt, [u(n, {
|
|
653
755
|
modelValue: r.value,
|
|
654
756
|
"onUpdate:modelValue": t[0] ||= (e) => r.value = e,
|
|
655
757
|
placeholder: D(d)?.placeholder ? D(l)(D(d).placeholder) : D(c)("campus.auth.captchaPlaceholder"),
|
|
@@ -657,7 +759,7 @@ var ft = "tabs", pt = I("campus-tabs", () => {
|
|
|
657
759
|
autocomplete: "off",
|
|
658
760
|
maxlength: D(d)?.maxlength ?? 8
|
|
659
761
|
}, {
|
|
660
|
-
prefix: M(() => [u(
|
|
762
|
+
prefix: M(() => [u($, { name: "shield" })]),
|
|
661
763
|
_: 1
|
|
662
764
|
}, 8, [
|
|
663
765
|
"modelValue",
|
|
@@ -675,17 +777,17 @@ var ft = "tabs", pt = I("campus-tabs", () => {
|
|
|
675
777
|
key: 0,
|
|
676
778
|
src: f.value,
|
|
677
779
|
alt: ""
|
|
678
|
-
}, null, 8,
|
|
780
|
+
}, null, 8, vt)) : p.value ? (y(), o("span", yt, E(D(c)("campus.auth.captchaFailed")), 1)) : a("v-if", !0)], 8, _t)]);
|
|
679
781
|
};
|
|
680
782
|
}
|
|
681
|
-
}),
|
|
783
|
+
}), xt = {
|
|
682
784
|
key: 1,
|
|
683
785
|
class: "ca-auth-links"
|
|
684
|
-
},
|
|
786
|
+
}, St = { class: "ca-auth-help" }, Ct = /* @__PURE__ */ d({
|
|
685
787
|
__name: "LoginForm",
|
|
686
788
|
props: { preview: { type: Boolean } },
|
|
687
789
|
setup(t) {
|
|
688
|
-
let r = t, c =
|
|
790
|
+
let r = t, c = U(), d = W(), f = Q(), { t: p, label: m } = K(), h = Ue(), g = Y(), _ = g.fields ?? {}, v = b({
|
|
689
791
|
username: "",
|
|
690
792
|
password: "",
|
|
691
793
|
captcha: ""
|
|
@@ -731,7 +833,7 @@ var ft = "tabs", pt = I("campus-tabs", () => {
|
|
|
731
833
|
key: C.value,
|
|
732
834
|
code: v.captcha
|
|
733
835
|
} : void 0
|
|
734
|
-
}), await d.replace(
|
|
836
|
+
}), await d.replace(We(c.query.redirect));
|
|
735
837
|
} catch (e) {
|
|
736
838
|
A.value = e instanceof Error && e.message ? e.message : p("campus.login.failed"), T.value?.refresh();
|
|
737
839
|
} finally {
|
|
@@ -742,7 +844,7 @@ var ft = "tabs", pt = I("campus-tabs", () => {
|
|
|
742
844
|
function R(e) {
|
|
743
845
|
r.preview && e.preventDefault();
|
|
744
846
|
}
|
|
745
|
-
let
|
|
847
|
+
let z = n(() => h.forgot || h.register);
|
|
746
848
|
return (t, n) => {
|
|
747
849
|
let r = w("ca-alert"), c = w("ca-input"), d = w("ca-form-item"), f = w("ca-button"), g = w("ca-form");
|
|
748
850
|
return y(), o(e, null, [
|
|
@@ -775,7 +877,7 @@ var ft = "tabs", pt = I("campus-tabs", () => {
|
|
|
775
877
|
"aria-label": D(p)("campus.login.username"),
|
|
776
878
|
autocomplete: "username"
|
|
777
879
|
}, {
|
|
778
|
-
prefix: M(() => [u(
|
|
880
|
+
prefix: M(() => [u($, { name: "user" })]),
|
|
779
881
|
_: 1
|
|
780
882
|
}, 8, [
|
|
781
883
|
"modelValue",
|
|
@@ -797,7 +899,7 @@ var ft = "tabs", pt = I("campus-tabs", () => {
|
|
|
797
899
|
"aria-label": D(p)("campus.login.password"),
|
|
798
900
|
autocomplete: "current-password"
|
|
799
901
|
}, {
|
|
800
|
-
prefix: M(() => [u(
|
|
902
|
+
prefix: M(() => [u($, { name: "lock" })]),
|
|
801
903
|
_: 1
|
|
802
904
|
}, 8, [
|
|
803
905
|
"modelValue",
|
|
@@ -811,7 +913,7 @@ var ft = "tabs", pt = I("campus-tabs", () => {
|
|
|
811
913
|
key: 0,
|
|
812
914
|
prop: "captcha"
|
|
813
915
|
}, {
|
|
814
|
-
default: M(() => [u(
|
|
916
|
+
default: M(() => [u(bt, {
|
|
815
917
|
ref_key: "captchaRef",
|
|
816
918
|
ref: T,
|
|
817
919
|
code: v.captcha,
|
|
@@ -835,24 +937,24 @@ var ft = "tabs", pt = I("campus-tabs", () => {
|
|
|
835
937
|
]),
|
|
836
938
|
_: 1
|
|
837
939
|
}, 8, ["model", "rules"]),
|
|
838
|
-
|
|
940
|
+
z.value ? (y(), o("div", xt, [D(h).forgot ? (y(), i(D(V), {
|
|
839
941
|
key: 0,
|
|
840
|
-
to: { name: D(
|
|
942
|
+
to: { name: D(J)(D(q)()).forgot },
|
|
841
943
|
onClick: R
|
|
842
944
|
}, {
|
|
843
945
|
default: M(() => [l(E(D(p)("campus.auth.forgotLink")), 1)]),
|
|
844
946
|
_: 1
|
|
845
|
-
}, 8, ["to"])) : a("v-if", !0), D(h).register ? (y(), i(D(
|
|
947
|
+
}, 8, ["to"])) : a("v-if", !0), D(h).register ? (y(), i(D(V), {
|
|
846
948
|
key: 1,
|
|
847
|
-
to: { name: D(
|
|
949
|
+
to: { name: D(J)(D(q)()).register },
|
|
848
950
|
onClick: R
|
|
849
951
|
}, {
|
|
850
952
|
default: M(() => [l(E(D(p)("campus.auth.registerLink")), 1)]),
|
|
851
953
|
_: 1
|
|
852
954
|
}, 8, ["to"])) : a("v-if", !0)])) : a("v-if", !0),
|
|
853
|
-
s("div",
|
|
955
|
+
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(V), {
|
|
854
956
|
key: 1,
|
|
855
|
-
to: { name: D(
|
|
957
|
+
to: { name: D(J)(D(q)()).forgot },
|
|
856
958
|
onClick: R
|
|
857
959
|
}, {
|
|
858
960
|
default: M(() => [l(E(D(p)("campus.auth.findPassword")), 1)]),
|
|
@@ -863,7 +965,7 @@ var ft = "tabs", pt = I("campus-tabs", () => {
|
|
|
863
965
|
}
|
|
864
966
|
});
|
|
865
967
|
// packages/core/src/pages/auth/wechat-host.ts
|
|
866
|
-
function
|
|
968
|
+
function wt(e, t) {
|
|
867
969
|
let n, r = !1, i = () => {
|
|
868
970
|
if (!r) {
|
|
869
971
|
r = !0;
|
|
@@ -890,75 +992,75 @@ function Tt(e, t) {
|
|
|
890
992
|
};
|
|
891
993
|
}
|
|
892
994
|
// packages/core/src/pages/auth/WechatPane.vue?vue&type=script&setup=true&lang.ts
|
|
893
|
-
var
|
|
995
|
+
var Tt = {
|
|
894
996
|
key: 0,
|
|
895
997
|
class: "ca-auth-wechat"
|
|
896
|
-
},
|
|
998
|
+
}, Et = {
|
|
897
999
|
key: 0,
|
|
898
1000
|
class: "ca-auth-wechat__failed",
|
|
899
1001
|
role: "alert"
|
|
900
|
-
},
|
|
1002
|
+
}, Dt = {
|
|
901
1003
|
key: 1,
|
|
902
1004
|
class: "ca-auth-wechat"
|
|
903
|
-
},
|
|
1005
|
+
}, Ot = { class: "ca-auth-wechat__code" }, kt = ["src", "alt"], At = ["aria-label"], jt = { class: "ca-auth-wechat__hint" }, Mt = {
|
|
904
1006
|
key: 0,
|
|
905
1007
|
class: "ca-auth-wechat__note"
|
|
906
|
-
},
|
|
1008
|
+
}, Nt = /* @__PURE__ */ d({
|
|
907
1009
|
__name: "WechatPane",
|
|
908
1010
|
props: { preview: { type: Boolean } },
|
|
909
1011
|
setup(e) {
|
|
910
|
-
let t = e, { t: r } =
|
|
1012
|
+
let t = e, { t: r } = K(), i = n(() => Y().panel?.qrcode), d = !t.preview && Ue().wechat, f = x(), p = x(!1), h;
|
|
911
1013
|
function g() {
|
|
912
1014
|
h?.release(), h = void 0;
|
|
913
1015
|
}
|
|
914
1016
|
async function b() {
|
|
915
|
-
g(), p.value = !1, await m(), f.value && (h =
|
|
1017
|
+
g(), p.value = !1, await m(), f.value && (h = wt(q().auth.wechat.mount, f.value), p.value = !h.ok);
|
|
916
1018
|
}
|
|
917
1019
|
return v(() => {
|
|
918
1020
|
d && b();
|
|
919
1021
|
}), _(g), (e, t) => {
|
|
920
1022
|
let n = w("ca-button");
|
|
921
|
-
return D(d) ? (y(), o("div",
|
|
1023
|
+
return D(d) ? (y(), o("div", Tt, [N(s("div", {
|
|
922
1024
|
ref_key: "host",
|
|
923
1025
|
ref: f,
|
|
924
1026
|
class: "ca-auth-wechat__host"
|
|
925
|
-
}, null, 512), [[k, !p.value]]), p.value ? (y(), o("div",
|
|
1027
|
+
}, 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
1028
|
default: M(() => [l(E(D(r)("campus.auth.wechatRetry")), 1)]),
|
|
927
1029
|
_: 1
|
|
928
|
-
})])) : a("v-if", !0)])) : (y(), o("div",
|
|
929
|
-
s("div",
|
|
1030
|
+
})])) : a("v-if", !0)])) : (y(), o("div", Dt, [
|
|
1031
|
+
s("div", Ot, [i.value ? (y(), o("img", {
|
|
930
1032
|
key: 0,
|
|
931
1033
|
src: i.value,
|
|
932
1034
|
alt: D(r)("campus.auth.qrcodeAlt")
|
|
933
|
-
}, null, 8,
|
|
1035
|
+
}, null, 8, kt)) : (y(), o("svg", {
|
|
934
1036
|
key: 1,
|
|
935
1037
|
viewBox: "0 0 100 100",
|
|
936
1038
|
role: "img",
|
|
937
1039
|
"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",
|
|
1040
|
+
}, [...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))]),
|
|
1041
|
+
s("p", jt, E(D(r)("campus.auth.wechatHint")), 1),
|
|
1042
|
+
i.value ? a("v-if", !0) : (y(), o("p", Mt, E(D(r)("campus.auth.wechatNote")), 1))
|
|
941
1043
|
]));
|
|
942
1044
|
};
|
|
943
1045
|
}
|
|
944
|
-
}),
|
|
1046
|
+
}), Pt = /* @__PURE__ */ d({
|
|
945
1047
|
__name: "LoginSplit",
|
|
946
1048
|
props: { preview: { type: Boolean } },
|
|
947
1049
|
setup(e) {
|
|
948
|
-
let { t } =
|
|
1050
|
+
let { t } = K(), r = Y().tabs?.length ? Y().tabs : ["account", "wechat"], a = x(r[0]), o = n(() => r.map((e) => ({
|
|
949
1051
|
key: e,
|
|
950
1052
|
label: t(e === "account" ? "campus.auth.tabAccount" : "campus.auth.tabWechat")
|
|
951
1053
|
})));
|
|
952
|
-
return (t, n) => (y(), i(
|
|
1054
|
+
return (t, n) => (y(), i(st, {
|
|
953
1055
|
active: a.value,
|
|
954
1056
|
"onUpdate:active": n[0] ||= (e) => a.value = e,
|
|
955
1057
|
tabs: o.value,
|
|
956
1058
|
preview: e.preview
|
|
957
1059
|
}, {
|
|
958
|
-
default: M(() => [a.value === "account" ? (y(), i(
|
|
1060
|
+
default: M(() => [a.value === "account" ? (y(), i(Ct, {
|
|
959
1061
|
key: 0,
|
|
960
1062
|
preview: e.preview
|
|
961
|
-
}, null, 8, ["preview"])) : (y(), i(
|
|
1063
|
+
}, null, 8, ["preview"])) : (y(), i(Nt, { key: 1 }))]),
|
|
962
1064
|
_: 1
|
|
963
1065
|
}, 8, [
|
|
964
1066
|
"active",
|
|
@@ -968,32 +1070,32 @@ var Et = {
|
|
|
968
1070
|
}
|
|
969
1071
|
});
|
|
970
1072
|
// packages/core/src/security.ts
|
|
971
|
-
function
|
|
1073
|
+
function Ft(e) {
|
|
972
1074
|
return e.environment ? e.environment : "production";
|
|
973
1075
|
}
|
|
974
|
-
function
|
|
975
|
-
if (
|
|
1076
|
+
function It(e) {
|
|
1077
|
+
if (Ft(e) === "production" && typeof e.auth.captcha != "function") throw Error("[campus] 生产环境必须在 auth 中提供 captcha()(图形验证码);测试环境可设置 environment: 'test' 跳过");
|
|
976
1078
|
}
|
|
977
|
-
function
|
|
1079
|
+
function Lt(e, t) {
|
|
978
1080
|
return t === "test" || e.length >= 8 && /[A-Za-z]/.test(e) && /\d/.test(e);
|
|
979
1081
|
}
|
|
980
1082
|
// packages/core/src/services/feedback.ts
|
|
981
|
-
var
|
|
1083
|
+
var Rt = (e) => e;
|
|
982
1084
|
function zt(e) {
|
|
983
|
-
|
|
1085
|
+
Rt = e;
|
|
984
1086
|
}
|
|
985
1087
|
async function Bt(e, t = {}) {
|
|
986
|
-
await
|
|
1088
|
+
await de.alert(e, t.title ?? Rt("campus.common.tip"), {
|
|
987
1089
|
type: t.type ?? "info",
|
|
988
|
-
confirmButtonText: t.confirmText ??
|
|
1090
|
+
confirmButtonText: t.confirmText ?? Rt("campus.common.ok")
|
|
989
1091
|
});
|
|
990
1092
|
}
|
|
991
1093
|
async function Vt(e, t = {}) {
|
|
992
1094
|
try {
|
|
993
|
-
return await
|
|
1095
|
+
return await de.confirm(e, t.title ?? Rt("campus.common.tip"), {
|
|
994
1096
|
type: t.type ?? "warning",
|
|
995
|
-
confirmButtonText: t.confirmText ??
|
|
996
|
-
cancelButtonText: t.cancelText ??
|
|
1097
|
+
confirmButtonText: t.confirmText ?? Rt("campus.common.confirm"),
|
|
1098
|
+
cancelButtonText: t.cancelText ?? Rt("campus.common.cancel")
|
|
997
1099
|
}), !0;
|
|
998
1100
|
} catch (e) {
|
|
999
1101
|
if (e === "cancel" || e === "close") return !1;
|
|
@@ -1001,31 +1103,31 @@ async function Vt(e, t = {}) {
|
|
|
1001
1103
|
}
|
|
1002
1104
|
}
|
|
1003
1105
|
var Ht = {
|
|
1004
|
-
info: (e) => void
|
|
1106
|
+
info: (e) => void ue({
|
|
1005
1107
|
message: e,
|
|
1006
1108
|
type: "info"
|
|
1007
1109
|
}),
|
|
1008
|
-
success: (e) => void
|
|
1110
|
+
success: (e) => void ue({
|
|
1009
1111
|
message: e,
|
|
1010
1112
|
type: "success"
|
|
1011
1113
|
}),
|
|
1012
|
-
warning: (e) => void
|
|
1114
|
+
warning: (e) => void ue({
|
|
1013
1115
|
message: e,
|
|
1014
1116
|
type: "warning"
|
|
1015
1117
|
}),
|
|
1016
|
-
error: (e) => void
|
|
1118
|
+
error: (e) => void ue({
|
|
1017
1119
|
message: e,
|
|
1018
1120
|
type: "error"
|
|
1019
1121
|
})
|
|
1020
|
-
}, Ut =
|
|
1122
|
+
}, Ut = le.service;
|
|
1021
1123
|
function Wt(e, t, n = {}) {
|
|
1022
|
-
let r =
|
|
1124
|
+
let r = fe({
|
|
1023
1125
|
...n,
|
|
1024
|
-
title: n.title ??
|
|
1126
|
+
title: n.title ?? Rt(`campus.notify.${e}`),
|
|
1025
1127
|
message: t,
|
|
1026
1128
|
type: e
|
|
1027
1129
|
});
|
|
1028
|
-
return m(() =>
|
|
1130
|
+
return m(() => fe.updateOffsets(n.position)), r;
|
|
1029
1131
|
}
|
|
1030
1132
|
// packages/core/src/services/ca.ts
|
|
1031
1133
|
var Gt = {
|
|
@@ -1047,7 +1149,7 @@ var Gt = {
|
|
|
1047
1149
|
}),
|
|
1048
1150
|
emits: ["update:modelValue"],
|
|
1049
1151
|
setup(e) {
|
|
1050
|
-
let t = e, n = O(e, "modelValue"), { t: r } =
|
|
1152
|
+
let t = e, n = O(e, "modelValue"), { t: r } = K(), i = x(0), a = x(!1), c;
|
|
1051
1153
|
function l() {
|
|
1052
1154
|
c && clearInterval(c), c = void 0;
|
|
1053
1155
|
}
|
|
@@ -1076,7 +1178,7 @@ var Gt = {
|
|
|
1076
1178
|
autocomplete: "one-time-code",
|
|
1077
1179
|
maxlength: "8"
|
|
1078
1180
|
}, {
|
|
1079
|
-
prefix: M(() => [u(
|
|
1181
|
+
prefix: M(() => [u($, { name: "message" })]),
|
|
1080
1182
|
_: 1
|
|
1081
1183
|
}, 8, [
|
|
1082
1184
|
"modelValue",
|
|
@@ -1097,7 +1199,7 @@ var Gt = {
|
|
|
1097
1199
|
__name: "RegisterForm",
|
|
1098
1200
|
props: { preview: { type: Boolean } },
|
|
1099
1201
|
setup(t) {
|
|
1100
|
-
let r = t, c =
|
|
1202
|
+
let r = t, c = W(), { t: d, label: f } = K(), p = Ue(), m = Ft(q()), g = Y(), _ = g.agreements ?? [], v = b({
|
|
1101
1203
|
phone: "",
|
|
1102
1204
|
captcha: "",
|
|
1103
1205
|
code: "",
|
|
@@ -1110,7 +1212,7 @@ var Gt = {
|
|
|
1110
1212
|
message: d("campus.auth.phonePlaceholder"),
|
|
1111
1213
|
trigger: "blur"
|
|
1112
1214
|
}, {
|
|
1113
|
-
pattern:
|
|
1215
|
+
pattern: He,
|
|
1114
1216
|
message: d("campus.auth.phoneInvalid"),
|
|
1115
1217
|
trigger: "blur"
|
|
1116
1218
|
}],
|
|
@@ -1129,7 +1231,7 @@ var Gt = {
|
|
|
1129
1231
|
message: d("campus.auth.registerPasswordPlaceholder"),
|
|
1130
1232
|
trigger: "blur"
|
|
1131
1233
|
}, {
|
|
1132
|
-
validator: (e, t, n) => n(
|
|
1234
|
+
validator: (e, t, n) => n(Lt(t, m) ? void 0 : Error(d("campus.auth.passwordPolicy"))),
|
|
1133
1235
|
trigger: "blur"
|
|
1134
1236
|
}],
|
|
1135
1237
|
confirm: [{
|
|
@@ -1157,7 +1259,7 @@ var Gt = {
|
|
|
1157
1259
|
}
|
|
1158
1260
|
if (A.value = "", r.preview) j.value = "info", A.value = d("campus.auth.previewNote");
|
|
1159
1261
|
else try {
|
|
1160
|
-
await
|
|
1262
|
+
await q().auth.sendSmsCode({
|
|
1161
1263
|
phone: v.phone,
|
|
1162
1264
|
scene: "register",
|
|
1163
1265
|
captcha: p.captcha ? {
|
|
@@ -1180,7 +1282,7 @@ var Gt = {
|
|
|
1180
1282
|
else {
|
|
1181
1283
|
k.value = !0, A.value = "";
|
|
1182
1284
|
try {
|
|
1183
|
-
await
|
|
1285
|
+
await q().auth.register({
|
|
1184
1286
|
phone: v.phone,
|
|
1185
1287
|
code: v.code,
|
|
1186
1288
|
password: v.password,
|
|
@@ -1188,7 +1290,7 @@ var Gt = {
|
|
|
1188
1290
|
key: C.value,
|
|
1189
1291
|
code: v.captcha
|
|
1190
1292
|
} : void 0
|
|
1191
|
-
}), Gt.toast.success(d("campus.auth.registerOk")), await c.replace({ name:
|
|
1293
|
+
}), Gt.toast.success(d("campus.auth.registerOk")), await c.replace({ name: J(q()).login });
|
|
1192
1294
|
} catch (e) {
|
|
1193
1295
|
I(e, d("campus.login.failed")), T.value?.refresh();
|
|
1194
1296
|
} finally {
|
|
@@ -1225,7 +1327,7 @@ var Gt = {
|
|
|
1225
1327
|
autocomplete: "tel",
|
|
1226
1328
|
maxlength: "11"
|
|
1227
1329
|
}, {
|
|
1228
|
-
prefix: M(() => [u(
|
|
1330
|
+
prefix: M(() => [u($, { name: "phone" })]),
|
|
1229
1331
|
_: 1
|
|
1230
1332
|
}, 8, [
|
|
1231
1333
|
"modelValue",
|
|
@@ -1238,7 +1340,7 @@ var Gt = {
|
|
|
1238
1340
|
key: 0,
|
|
1239
1341
|
prop: "captcha"
|
|
1240
1342
|
}, {
|
|
1241
|
-
default: M(() => [u(
|
|
1343
|
+
default: M(() => [u(bt, {
|
|
1242
1344
|
ref_key: "captchaRef",
|
|
1243
1345
|
ref: T,
|
|
1244
1346
|
code: v.captcha,
|
|
@@ -1267,7 +1369,7 @@ var Gt = {
|
|
|
1267
1369
|
"aria-label": D(d)("campus.auth.registerPassword"),
|
|
1268
1370
|
autocomplete: "new-password"
|
|
1269
1371
|
}, {
|
|
1270
|
-
prefix: M(() => [u(
|
|
1372
|
+
prefix: M(() => [u($, { name: "lock" })]),
|
|
1271
1373
|
_: 1
|
|
1272
1374
|
}, 8, [
|
|
1273
1375
|
"modelValue",
|
|
@@ -1286,7 +1388,7 @@ var Gt = {
|
|
|
1286
1388
|
"aria-label": D(d)("campus.auth.confirmPlaceholder"),
|
|
1287
1389
|
autocomplete: "new-password"
|
|
1288
1390
|
}, {
|
|
1289
|
-
prefix: M(() => [u(
|
|
1391
|
+
prefix: M(() => [u($, { name: "lock" })]),
|
|
1290
1392
|
_: 1
|
|
1291
1393
|
}, 8, [
|
|
1292
1394
|
"modelValue",
|
|
@@ -1341,15 +1443,15 @@ var Gt = {
|
|
|
1341
1443
|
__name: "RegisterPage",
|
|
1342
1444
|
props: { preview: { type: Boolean } },
|
|
1343
1445
|
setup(e) {
|
|
1344
|
-
let { t } =
|
|
1446
|
+
let { t } = K(), r = Ue().register, a = n(() => [{
|
|
1345
1447
|
key: "register",
|
|
1346
1448
|
label: t("campus.auth.tabRegister")
|
|
1347
1449
|
}, {
|
|
1348
1450
|
key: "login",
|
|
1349
1451
|
label: t("campus.auth.backLogin"),
|
|
1350
|
-
to:
|
|
1452
|
+
to: Me(q()).login
|
|
1351
1453
|
}]);
|
|
1352
|
-
return (n, c) => (y(), i(
|
|
1454
|
+
return (n, c) => (y(), i(st, {
|
|
1353
1455
|
active: "register",
|
|
1354
1456
|
tabs: a.value,
|
|
1355
1457
|
preview: e.preview
|
|
@@ -1368,7 +1470,7 @@ var Gt = {
|
|
|
1368
1470
|
__name: "ForgotForm",
|
|
1369
1471
|
props: { preview: { type: Boolean } },
|
|
1370
1472
|
setup(t) {
|
|
1371
|
-
let r = t, s =
|
|
1473
|
+
let r = t, s = W(), { t: c, label: d } = K(), f = Ue(), p = Ft(q()), m = Y(), g = b({
|
|
1372
1474
|
account: "",
|
|
1373
1475
|
captcha: "",
|
|
1374
1476
|
code: "",
|
|
@@ -1395,7 +1497,7 @@ var Gt = {
|
|
|
1395
1497
|
message: c("campus.auth.newPasswordPlaceholder"),
|
|
1396
1498
|
trigger: "blur"
|
|
1397
1499
|
}, {
|
|
1398
|
-
validator: (e, t, n) => n(
|
|
1500
|
+
validator: (e, t, n) => n(Lt(t, p) ? void 0 : Error(c("campus.auth.passwordPolicy"))),
|
|
1399
1501
|
trigger: "blur"
|
|
1400
1502
|
}],
|
|
1401
1503
|
confirm: [{
|
|
@@ -1419,8 +1521,8 @@ var Gt = {
|
|
|
1419
1521
|
}
|
|
1420
1522
|
if (T.value = "", r.preview) O.value = "info", T.value = c("campus.auth.previewNote");
|
|
1421
1523
|
else try {
|
|
1422
|
-
await
|
|
1423
|
-
...
|
|
1524
|
+
await q().auth.sendSmsCode({
|
|
1525
|
+
...He.test(g.account) ? { phone: g.account } : { username: g.account },
|
|
1424
1526
|
scene: "forgot",
|
|
1425
1527
|
captcha: f.captcha ? {
|
|
1426
1528
|
key: _.value,
|
|
@@ -1442,7 +1544,7 @@ var Gt = {
|
|
|
1442
1544
|
else {
|
|
1443
1545
|
C.value = !0, T.value = "";
|
|
1444
1546
|
try {
|
|
1445
|
-
await
|
|
1547
|
+
await q().auth.resetPassword({
|
|
1446
1548
|
account: g.account,
|
|
1447
1549
|
code: g.code,
|
|
1448
1550
|
password: g.password,
|
|
@@ -1450,7 +1552,7 @@ var Gt = {
|
|
|
1450
1552
|
key: _.value,
|
|
1451
1553
|
code: g.captcha
|
|
1452
1554
|
} : void 0
|
|
1453
|
-
}), Gt.toast.success(c("campus.auth.resetOk")), await s.replace({ name:
|
|
1555
|
+
}), Gt.toast.success(c("campus.auth.resetOk")), await s.replace({ name: J(q()).login });
|
|
1454
1556
|
} catch (e) {
|
|
1455
1557
|
j(e, c("campus.login.failed")), v.value?.refresh();
|
|
1456
1558
|
} finally {
|
|
@@ -1486,7 +1588,7 @@ var Gt = {
|
|
|
1486
1588
|
"aria-label": D(c)("campus.auth.account"),
|
|
1487
1589
|
autocomplete: "username"
|
|
1488
1590
|
}, {
|
|
1489
|
-
prefix: M(() => [u(
|
|
1591
|
+
prefix: M(() => [u($, { name: "user" })]),
|
|
1490
1592
|
_: 1
|
|
1491
1593
|
}, 8, [
|
|
1492
1594
|
"modelValue",
|
|
@@ -1499,7 +1601,7 @@ var Gt = {
|
|
|
1499
1601
|
key: 0,
|
|
1500
1602
|
prop: "captcha"
|
|
1501
1603
|
}, {
|
|
1502
|
-
default: M(() => [u(
|
|
1604
|
+
default: M(() => [u(bt, {
|
|
1503
1605
|
ref_key: "captchaRef",
|
|
1504
1606
|
ref: v,
|
|
1505
1607
|
code: g.captcha,
|
|
@@ -1528,7 +1630,7 @@ var Gt = {
|
|
|
1528
1630
|
"aria-label": D(c)("campus.auth.newPasswordPlaceholder"),
|
|
1529
1631
|
autocomplete: "new-password"
|
|
1530
1632
|
}, {
|
|
1531
|
-
prefix: M(() => [u(
|
|
1633
|
+
prefix: M(() => [u($, { name: "lock" })]),
|
|
1532
1634
|
_: 1
|
|
1533
1635
|
}, 8, [
|
|
1534
1636
|
"modelValue",
|
|
@@ -1547,7 +1649,7 @@ var Gt = {
|
|
|
1547
1649
|
"aria-label": D(c)("campus.auth.confirmPlaceholder"),
|
|
1548
1650
|
autocomplete: "new-password"
|
|
1549
1651
|
}, {
|
|
1550
|
-
prefix: M(() => [u(
|
|
1652
|
+
prefix: M(() => [u($, { name: "lock" })]),
|
|
1551
1653
|
_: 1
|
|
1552
1654
|
}, 8, [
|
|
1553
1655
|
"modelValue",
|
|
@@ -1584,15 +1686,15 @@ var Gt = {
|
|
|
1584
1686
|
__name: "ForgotPage",
|
|
1585
1687
|
props: { preview: { type: Boolean } },
|
|
1586
1688
|
setup(e) {
|
|
1587
|
-
let { t } =
|
|
1689
|
+
let { t } = K(), r = Ue().forgot, a = n(() => [{
|
|
1588
1690
|
key: "forgot",
|
|
1589
1691
|
label: t("campus.auth.tabForgot")
|
|
1590
1692
|
}, {
|
|
1591
1693
|
key: "login",
|
|
1592
1694
|
label: t("campus.auth.backLogin"),
|
|
1593
|
-
to:
|
|
1695
|
+
to: Me(q()).login
|
|
1594
1696
|
}]);
|
|
1595
|
-
return (n, c) => (y(), i(
|
|
1697
|
+
return (n, c) => (y(), i(st, {
|
|
1596
1698
|
active: "forgot",
|
|
1597
1699
|
tabs: a.value,
|
|
1598
1700
|
preview: e.preview
|
|
@@ -1608,7 +1710,7 @@ var Gt = {
|
|
|
1608
1710
|
__name: "AuthPreview",
|
|
1609
1711
|
props: { kind: {} },
|
|
1610
1712
|
setup(e) {
|
|
1611
|
-
return (t, n) => e.kind === "login" ? (y(), i(
|
|
1713
|
+
return (t, n) => e.kind === "login" ? (y(), i(Pt, {
|
|
1612
1714
|
key: 0,
|
|
1613
1715
|
preview: ""
|
|
1614
1716
|
})) : e.kind === "register" ? (y(), i(tn, {
|
|
@@ -1619,7 +1721,7 @@ var Gt = {
|
|
|
1619
1721
|
preview: ""
|
|
1620
1722
|
}));
|
|
1621
1723
|
}
|
|
1622
|
-
}), cn = { class: "ca-user-avatar" }, ln = ["src"], un = /*#__PURE__*/
|
|
1724
|
+
}), cn = { class: "ca-user-avatar" }, ln = ["src"], un = /*#__PURE__*/ X(/* @__PURE__ */ d({
|
|
1623
1725
|
__name: "UserAvatar",
|
|
1624
1726
|
props: {
|
|
1625
1727
|
name: {},
|
|
@@ -1655,10 +1757,10 @@ var Gt = {
|
|
|
1655
1757
|
"aria-label",
|
|
1656
1758
|
"aria-checked",
|
|
1657
1759
|
"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__*/
|
|
1760
|
+
], 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
1761
|
__name: "HeaderBar",
|
|
1660
1762
|
setup(t) {
|
|
1661
|
-
let r =
|
|
1763
|
+
let r = U(), c = W(), d = Q(), f = Z(), p = Be(), { t: m, label: b, locale: C } = K(), T = q(), O = x(!1), k = [{
|
|
1662
1764
|
value: "border",
|
|
1663
1765
|
label: "campus.settings.boxBorder"
|
|
1664
1766
|
}, {
|
|
@@ -1698,27 +1800,30 @@ var Gt = {
|
|
|
1698
1800
|
y: n.top + n.height / 2
|
|
1699
1801
|
} : void 0);
|
|
1700
1802
|
}
|
|
1701
|
-
function
|
|
1702
|
-
C.value = e,
|
|
1803
|
+
function ee(e) {
|
|
1804
|
+
C.value = e, we(e);
|
|
1703
1805
|
}
|
|
1704
|
-
async function
|
|
1705
|
-
e === "account" ? T.onAccountClick ? await T.onAccountClick("header") : T.accountPath && P(T.accountPath) : (await d.logout(), await c.replace({ name:
|
|
1806
|
+
async function te(e) {
|
|
1807
|
+
e === "account" ? T.onAccountClick ? await T.onAccountClick("header") : T.accountPath && P(T.accountPath) : (await d.logout(), await c.replace({ name: J(q()).login }));
|
|
1706
1808
|
}
|
|
1707
|
-
let
|
|
1708
|
-
function
|
|
1709
|
-
|
|
1809
|
+
let B = x(!1);
|
|
1810
|
+
function V() {
|
|
1811
|
+
B.value = !!document.fullscreenElement;
|
|
1710
1812
|
}
|
|
1711
|
-
async function
|
|
1813
|
+
async function ne() {
|
|
1814
|
+
f.pageScreenManual();
|
|
1712
1815
|
try {
|
|
1713
1816
|
document.fullscreenElement ? await document.exitFullscreen() : await document.documentElement.requestFullscreen();
|
|
1714
1817
|
} catch {}
|
|
1715
1818
|
}
|
|
1716
|
-
v(() =>
|
|
1717
|
-
|
|
1819
|
+
v(() => {
|
|
1820
|
+
V(), document.addEventListener("fullscreenchange", V);
|
|
1821
|
+
}), _(() => document.removeEventListener("fullscreenchange", V));
|
|
1822
|
+
function H(e) {
|
|
1718
1823
|
T.headerTools?.[e]?.();
|
|
1719
1824
|
}
|
|
1720
1825
|
return (t, n) => {
|
|
1721
|
-
let c = w("ca-icon"), _ = w("ca-dropdown-item"), v = w("ca-dropdown-menu"), x = w("ca-dropdown"),
|
|
1826
|
+
let c = w("ca-icon"), _ = w("ca-dropdown-item"), v = w("ca-dropdown-menu"), x = w("ca-dropdown"), V = w("ca-drawer");
|
|
1722
1827
|
return y(), o("header", dn, [
|
|
1723
1828
|
a(" 菜单按钮:手机打开抽屉;电脑档两栏都收起时也显示,点击重新显示侧栏 "),
|
|
1724
1829
|
s("button", {
|
|
@@ -1770,7 +1875,7 @@ var Gt = {
|
|
|
1770
1875
|
s("button", {
|
|
1771
1876
|
type: "button",
|
|
1772
1877
|
class: "ca-header__search",
|
|
1773
|
-
onClick: n[1] ||= (e) =>
|
|
1878
|
+
onClick: n[1] ||= (e) => H("search")
|
|
1774
1879
|
}, [
|
|
1775
1880
|
u(c, { name: "search" }),
|
|
1776
1881
|
s("span", xn, E(D(m)("campus.header.search")), 1),
|
|
@@ -1779,20 +1884,20 @@ var Gt = {
|
|
|
1779
1884
|
s("button", {
|
|
1780
1885
|
type: "button",
|
|
1781
1886
|
class: "ca-header__icon ca-header__desktop-tool",
|
|
1782
|
-
title:
|
|
1783
|
-
"aria-label":
|
|
1784
|
-
"aria-pressed":
|
|
1785
|
-
onClick:
|
|
1887
|
+
title: B.value ? D(m)("campus.header.exitFullscreen") : D(m)("campus.header.fullscreen"),
|
|
1888
|
+
"aria-label": B.value ? D(m)("campus.header.exitFullscreen") : D(m)("campus.header.fullscreen"),
|
|
1889
|
+
"aria-pressed": B.value,
|
|
1890
|
+
onClick: ne
|
|
1786
1891
|
}, [u(c, {
|
|
1787
|
-
name:
|
|
1892
|
+
name: B.value ? "exitFullscreen" : "fullscreen",
|
|
1788
1893
|
size: 18
|
|
1789
1894
|
}, null, 8, ["name"])], 8, Sn),
|
|
1790
1895
|
u(x, {
|
|
1791
1896
|
trigger: "click",
|
|
1792
|
-
onCommand:
|
|
1897
|
+
onCommand: ee
|
|
1793
1898
|
}, {
|
|
1794
1899
|
dropdown: M(() => [u(v, null, {
|
|
1795
|
-
default: M(() => [(y(!0), o(e, null, S(D(
|
|
1900
|
+
default: M(() => [(y(!0), o(e, null, S(D(z), (e) => (y(), i(_, {
|
|
1796
1901
|
key: e.code,
|
|
1797
1902
|
command: e.code,
|
|
1798
1903
|
class: h({ "is-current": D(C) === e.code })
|
|
@@ -1807,7 +1912,7 @@ var Gt = {
|
|
|
1807
1912
|
class: "ca-header__icon",
|
|
1808
1913
|
title: D(m)("campus.header.language"),
|
|
1809
1914
|
"aria-label": D(m)("campus.header.language")
|
|
1810
|
-
}, [s("span", wn, E(D(
|
|
1915
|
+
}, [s("span", wn, E(D(z).find((e) => e.code === D(C))?.label), 1)], 8, Cn)]),
|
|
1811
1916
|
_: 1
|
|
1812
1917
|
}),
|
|
1813
1918
|
s("button", {
|
|
@@ -1815,7 +1920,7 @@ var Gt = {
|
|
|
1815
1920
|
class: "ca-header__icon ca-header__desktop-tool",
|
|
1816
1921
|
title: D(m)("campus.header.notifications"),
|
|
1817
1922
|
"aria-label": D(m)("campus.header.notifications"),
|
|
1818
|
-
onClick: n[2] ||= (e) =>
|
|
1923
|
+
onClick: n[2] ||= (e) => H("notifications")
|
|
1819
1924
|
}, [u(c, {
|
|
1820
1925
|
name: "bell",
|
|
1821
1926
|
size: 18
|
|
@@ -1828,7 +1933,7 @@ var Gt = {
|
|
|
1828
1933
|
class: "ca-header__icon ca-header__desktop-tool",
|
|
1829
1934
|
title: D(m)("campus.header.assistant"),
|
|
1830
1935
|
"aria-label": D(m)("campus.header.assistant"),
|
|
1831
|
-
onClick: n[3] ||= (e) =>
|
|
1936
|
+
onClick: n[3] ||= (e) => H("assistant")
|
|
1832
1937
|
}, [u(c, {
|
|
1833
1938
|
name: "chat",
|
|
1834
1939
|
size: 18
|
|
@@ -1848,7 +1953,7 @@ var Gt = {
|
|
|
1848
1953
|
})], 8, Dn),
|
|
1849
1954
|
u(x, {
|
|
1850
1955
|
trigger: "click",
|
|
1851
|
-
onCommand:
|
|
1956
|
+
onCommand: te
|
|
1852
1957
|
}, {
|
|
1853
1958
|
dropdown: M(() => [u(v, null, {
|
|
1854
1959
|
default: M(() => [D(T).accountEntry?.header !== !1 && (D(T).accountPath || D(T).onAccountClick) ? (y(), i(_, {
|
|
@@ -1882,7 +1987,7 @@ var Gt = {
|
|
|
1882
1987
|
_: 1
|
|
1883
1988
|
})
|
|
1884
1989
|
]),
|
|
1885
|
-
u(
|
|
1990
|
+
u(V, {
|
|
1886
1991
|
modelValue: O.value,
|
|
1887
1992
|
"onUpdate:modelValue": n[7] ||= (e) => O.value = e,
|
|
1888
1993
|
title: D(m)("campus.settings.title"),
|
|
@@ -1955,14 +2060,14 @@ var Gt = {
|
|
|
1955
2060
|
]);
|
|
1956
2061
|
};
|
|
1957
2062
|
}
|
|
1958
|
-
}), [["__scopeId", "data-v-
|
|
2063
|
+
}), [["__scopeId", "data-v-d0a9b424"]]), Gn = {
|
|
1959
2064
|
key: 0,
|
|
1960
2065
|
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__*/
|
|
2066
|
+
}, 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
2067
|
__name: "PageHeader",
|
|
1963
2068
|
setup(t) {
|
|
1964
|
-
let r =
|
|
1965
|
-
let e = h.value ?
|
|
2069
|
+
let r = U(), { t: c, label: d, locale: f } = K(), p = ft(), m = new Map(je(q().menus).map((e) => [e.key, e])), h = n(() => r.meta.pageKey ? m.get(r.meta.pageKey) : void 0), g = n(() => {
|
|
2070
|
+
let e = h.value ? ke(h.value.key) : void 0;
|
|
1966
2071
|
if (!e) return [];
|
|
1967
2072
|
let t = e.titles.map((e) => d(e));
|
|
1968
2073
|
return h.value?.affix ? t.filter((e, n) => e !== t[n - 1]) : t;
|
|
@@ -2005,10 +2110,10 @@ var Gt = {
|
|
|
2005
2110
|
}), [["__scopeId", "data-v-e0f9b42f"]]), Zn = {
|
|
2006
2111
|
key: 0,
|
|
2007
2112
|
class: "ca-page-header__titles"
|
|
2008
|
-
}, Qn = { class: "ca-page-header__title" }, $n = ["title"], er = /*#__PURE__*/
|
|
2113
|
+
}, Qn = { class: "ca-page-header__title" }, $n = ["title"], er = /*#__PURE__*/ X(/* @__PURE__ */ d({
|
|
2009
2114
|
__name: "PageTitle",
|
|
2010
2115
|
setup(e) {
|
|
2011
|
-
let t =
|
|
2116
|
+
let t = U(), { label: r } = K(), i = new Map(je(q().menus).map((e) => [e.key, e])), c = n(() => t.meta.pageKey ? i.get(t.meta.pageKey) : void 0), l = n(() => c.value?.pageHeader ?? q().pageHeader ?? !0), u = n(() => c.value ? r(c.value.title) : ""), d = n(() => c.value?.description ? r(c.value.description) : "");
|
|
2012
2117
|
return (e, t) => c.value ? (y(), o("header", {
|
|
2013
2118
|
key: 0,
|
|
2014
2119
|
class: h(["ca-page-header__main", { "is-title-hidden": !l.value }])
|
|
@@ -2031,6 +2136,7 @@ var Gt = {
|
|
|
2031
2136
|
}
|
|
2032
2137
|
}), [["__scopeId", "data-v-98ee1b64"]]), tr = ["aria-label"], nr = ["onClick"], rr = { class: "ca-side__rail-list" }, ir = ["aria-current", "title"], ar = [
|
|
2033
2138
|
"aria-current",
|
|
2139
|
+
"aria-expanded",
|
|
2034
2140
|
"title",
|
|
2035
2141
|
"onClick"
|
|
2036
2142
|
], or = {
|
|
@@ -2047,118 +2153,147 @@ var Gt = {
|
|
|
2047
2153
|
], ur = ["title", "aria-label"], dr = ["inert"], fr = { class: "ca-side__panel-inner" }, pr = {
|
|
2048
2154
|
key: 0,
|
|
2049
2155
|
class: "ca-side__title"
|
|
2050
|
-
}, mr = {
|
|
2156
|
+
}, mr = { class: "ca-side__group-label" }, hr = {
|
|
2051
2157
|
key: 1,
|
|
2052
2158
|
class: "ca-side__group-badge"
|
|
2053
|
-
},
|
|
2159
|
+
}, gr = /*#__PURE__*/ X(/* @__PURE__ */ d({
|
|
2054
2160
|
__name: "SideMenu",
|
|
2055
2161
|
setup(t) {
|
|
2056
|
-
let r =
|
|
2057
|
-
function
|
|
2058
|
-
|
|
2162
|
+
let r = U(), c = W(), d = Q(), f = Z(), { t: p, label: g } = K(), _ = q(), v = n(() => f.sidePanelCollapsed), b = () => f.toggleSidePanel(), C = x(me("side-text-hidden") === "1");
|
|
2163
|
+
function T() {
|
|
2164
|
+
C.value = !C.value, G("side-text-hidden", C.value ? "1" : "0");
|
|
2059
2165
|
}
|
|
2060
|
-
async function
|
|
2061
|
-
e === "account" ?
|
|
2166
|
+
async function O(e) {
|
|
2167
|
+
e === "account" ? _.onAccountClick ? await _.onAccountClick("side") : _.accountPath && r.path !== _.accountPath && await c.push(_.accountPath) : (await d.logout(), await c.replace({ name: J(q()).login }));
|
|
2062
2168
|
}
|
|
2063
|
-
let
|
|
2169
|
+
let j = n(() => Ne(_, (e) => d.can(e))), P = n(() => j.value.home), F = n(() => j.value.apps), I = j.value.accountStandalone, L = x(), R = n(() => !!P.value && r.path === P.value.path);
|
|
2064
2170
|
A(() => [r.path, r.meta.appKey], () => {
|
|
2065
|
-
|
|
2171
|
+
L.value = R.value || I && r.path === _.accountPath ? void 0 : r.meta.appKey ?? F.value[0]?.key;
|
|
2066
2172
|
}, { immediate: !0 });
|
|
2067
|
-
let
|
|
2068
|
-
A(
|
|
2069
|
-
let
|
|
2070
|
-
function
|
|
2173
|
+
let z = n(() => F.value.find((e) => e.key === L.value)), ee = n(() => (f.mode === "phone" ? !f.mobileMenuOpen : f.mode === "pad" ? !f.padPanelOpen : v.value || f.sideHiddenActive) || !z.value?.children.length), te = x();
|
|
2174
|
+
A(z, (e) => e?.children.length && (te.value = e), { immediate: !0 });
|
|
2175
|
+
let B = n(() => z.value?.children.length ? z.value : te.value);
|
|
2176
|
+
function V(e) {
|
|
2071
2177
|
let t = typeof e.badge == "function" ? e.badge() : e.badge ?? 0;
|
|
2072
2178
|
return t > 0 ? t : 0;
|
|
2073
2179
|
}
|
|
2074
|
-
function
|
|
2075
|
-
return e.children.reduce((e, t) => e + (
|
|
2180
|
+
function ne(e) {
|
|
2181
|
+
return e.children.reduce((e, t) => e + (Ee(t) ? V(t) : 0), 0);
|
|
2076
2182
|
}
|
|
2077
|
-
let
|
|
2078
|
-
function ie(e) {
|
|
2079
|
-
|
|
2183
|
+
let H = x(), re = !0;
|
|
2184
|
+
function ie(e, t) {
|
|
2185
|
+
re || f.setMenuGroup(e, t);
|
|
2080
2186
|
}
|
|
2081
|
-
let ae = n(() => (
|
|
2082
|
-
|
|
2187
|
+
let ae = n(() => Object.keys(f.menuGroups).filter((e) => f.menuGroups[e]));
|
|
2188
|
+
A(() => r.meta.groupKey, (e) => {
|
|
2189
|
+
e && f.ensureMenuGroup(e);
|
|
2190
|
+
}, { immediate: !0 }), A([
|
|
2191
|
+
() => f.menuGroups,
|
|
2192
|
+
B,
|
|
2193
|
+
() => r.path
|
|
2194
|
+
], async () => {
|
|
2195
|
+
re = !0, await m();
|
|
2196
|
+
for (let e of B.value?.children ?? []) Ee(e) && e.children.length && (f.menuGroups[e.key] ? H.value?.open(e.key) : H.value?.close(e.key));
|
|
2197
|
+
re = !1;
|
|
2198
|
+
}, {
|
|
2199
|
+
deep: !0,
|
|
2200
|
+
immediate: !0
|
|
2201
|
+
});
|
|
2202
|
+
async function oe(e) {
|
|
2203
|
+
let t = F.value.find((t) => t.key === e);
|
|
2204
|
+
if (!t) return;
|
|
2205
|
+
let n = L.value === e;
|
|
2206
|
+
L.value = e, await f.clickMenuApp(t, r.path, (e) => c.push(e), n);
|
|
2207
|
+
}
|
|
2208
|
+
function se(e, t) {
|
|
2209
|
+
let n = e.currentTarget, i = e.type === "keydown";
|
|
2210
|
+
(n.firstElementChild?.contains(e.target) || i && e.target === n) && (!i || ["Enter", " "].includes(e.key)) && (e.preventDefault(), e.stopPropagation(), f.clickMenuGroup(t, r.path, (e) => c.push(e)));
|
|
2211
|
+
}
|
|
2212
|
+
let ce = n(() => (_.shortcuts ?? []).filter((e) => d.can(e.permission)));
|
|
2213
|
+
function le(e) {
|
|
2083
2214
|
f.closeOverlays(), r.path !== e && c.push(e);
|
|
2084
2215
|
}
|
|
2085
2216
|
return (t, n) => {
|
|
2086
|
-
let c = w("ca-icon"),
|
|
2217
|
+
let c = w("ca-icon"), m = w("ca-dropdown-item"), x = w("ca-dropdown-menu"), A = w("ca-dropdown"), j = w("ca-menu-item"), I = w("ca-sub-menu"), L = w("ca-menu");
|
|
2087
2218
|
return y(), o(e, null, [a(" 两栏都收起(只在电脑档):整个侧栏向左滑出,第二栏同时收起;不可聚焦由 CaLayout 的 inert 负责 "), s("aside", { class: h(["ca-side", {
|
|
2088
2219
|
"is-pad-open": D(f).mode === "pad" && D(f).padPanelOpen,
|
|
2089
2220
|
"is-hidden": D(f).sideHiddenActive,
|
|
2090
|
-
"is-text-hidden":
|
|
2221
|
+
"is-text-hidden": C.value
|
|
2091
2222
|
}]) }, [
|
|
2092
|
-
|
|
2223
|
+
ce.value.length ? (y(), o("nav", {
|
|
2093
2224
|
key: 0,
|
|
2094
2225
|
class: "ca-side__shortcuts",
|
|
2095
2226
|
"aria-label": D(p)("campus.header.shortcuts")
|
|
2096
|
-
}, [(y(!0), o(e, null, S(
|
|
2227
|
+
}, [(y(!0), o(e, null, S(ce.value, (e) => (y(), o("button", {
|
|
2097
2228
|
key: e.key,
|
|
2098
2229
|
type: "button",
|
|
2099
2230
|
class: h({ "is-active": D(r).path === e.path }),
|
|
2100
|
-
onClick: (t) =>
|
|
2101
|
-
}, E(D(
|
|
2102
|
-
s("nav", { class: h(["ca-side__rail", { "is-compact":
|
|
2231
|
+
onClick: (t) => le(e.path)
|
|
2232
|
+
}, E(D(g)(e.title)), 11, nr))), 128))], 8, tr)) : a("v-if", !0),
|
|
2233
|
+
s("nav", { class: h(["ca-side__rail", { "is-compact": C.value }]) }, [
|
|
2103
2234
|
a(" 入口列表单独滚动;底部工具按钮固定在外面,窗口再矮也不会被挤出屏幕 "),
|
|
2104
|
-
s("div", rr, [
|
|
2235
|
+
s("div", rr, [P.value ? (y(), o("button", {
|
|
2105
2236
|
key: 0,
|
|
2106
2237
|
type: "button",
|
|
2107
|
-
class: h(["ca-side__rail-item", { "is-active":
|
|
2108
|
-
"aria-current":
|
|
2109
|
-
title:
|
|
2110
|
-
onClick: n[0] ||= (e) =>
|
|
2111
|
-
}, [u(c, { name: "home" }), N(s("span", { class: "ca-side__rail-text" }, E(D(p)("campus.side.home")), 513), [[k, !
|
|
2238
|
+
class: h(["ca-side__rail-item", { "is-active": R.value }]),
|
|
2239
|
+
"aria-current": R.value ? "page" : void 0,
|
|
2240
|
+
title: C.value ? D(p)("campus.side.home") : void 0,
|
|
2241
|
+
onClick: n[0] ||= (e) => le(P.value.path)
|
|
2242
|
+
}, [u(c, { name: "home" }), N(s("span", { class: "ca-side__rail-text" }, E(D(p)("campus.side.home")), 513), [[k, !C.value || D(f).mobileMenuOpen]])], 10, ir)) : a("v-if", !0), (y(!0), o(e, null, S(F.value, (e) => (y(), o("button", {
|
|
2112
2243
|
key: e.key,
|
|
2113
2244
|
type: "button",
|
|
2114
|
-
class: h(["ca-side__rail-item", {
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2245
|
+
class: h(["ca-side__rail-item", {
|
|
2246
|
+
"is-active": e.path === D(r).path,
|
|
2247
|
+
"is-ancestor": e.key === z.value?.key && e.path !== D(r).path
|
|
2248
|
+
}]),
|
|
2249
|
+
"aria-current": e.path === D(r).path ? "page" : void 0,
|
|
2250
|
+
"aria-expanded": e.children.length ? e.key === z.value?.key && !ee.value : void 0,
|
|
2251
|
+
title: C.value ? D(g)(e.title) : void 0,
|
|
2252
|
+
onClick: (t) => oe(e.key)
|
|
2118
2253
|
}, [
|
|
2119
2254
|
u(c, {
|
|
2120
2255
|
name: e.icon,
|
|
2121
2256
|
fallback: "grid"
|
|
2122
2257
|
}, null, 8, ["name"]),
|
|
2123
|
-
N(s("span", { class: "ca-side__rail-text" }, E(D(
|
|
2124
|
-
|
|
2258
|
+
N(s("span", { class: "ca-side__rail-text" }, E(D(g)(e.title)), 513), [[k, !C.value || D(f).mobileMenuOpen]]),
|
|
2259
|
+
ne(e) ? (y(), o("span", or, E(ne(e)), 1)) : a("v-if", !0)
|
|
2125
2260
|
], 10, ar))), 128))]),
|
|
2126
2261
|
s("div", sr, [
|
|
2127
2262
|
s("button", {
|
|
2128
2263
|
type: "button",
|
|
2129
2264
|
class: "ca-side__tool",
|
|
2130
|
-
title:
|
|
2131
|
-
"aria-label":
|
|
2132
|
-
"aria-pressed":
|
|
2133
|
-
onClick:
|
|
2265
|
+
title: C.value ? D(p)("campus.side.showText") : D(p)("campus.side.hideText"),
|
|
2266
|
+
"aria-label": C.value ? D(p)("campus.side.showText") : D(p)("campus.side.hideText"),
|
|
2267
|
+
"aria-pressed": C.value,
|
|
2268
|
+
onClick: T
|
|
2134
2269
|
}, [u(c, {
|
|
2135
|
-
name:
|
|
2270
|
+
name: C.value ? "view" : "hide",
|
|
2136
2271
|
size: 18
|
|
2137
2272
|
}, null, 8, ["name"])], 8, cr),
|
|
2138
2273
|
s("button", {
|
|
2139
2274
|
type: "button",
|
|
2140
2275
|
class: "ca-side__tool ca-side__tool--collapse",
|
|
2141
|
-
title:
|
|
2142
|
-
"aria-label":
|
|
2143
|
-
"aria-expanded": !
|
|
2144
|
-
onClick:
|
|
2276
|
+
title: v.value ? D(p)("campus.side.expand") : D(p)("campus.side.collapse"),
|
|
2277
|
+
"aria-label": v.value ? D(p)("campus.side.expand") : D(p)("campus.side.collapse"),
|
|
2278
|
+
"aria-expanded": !v.value,
|
|
2279
|
+
onClick: b
|
|
2145
2280
|
}, [u(c, {
|
|
2146
|
-
name:
|
|
2281
|
+
name: v.value ? "expand" : "fold",
|
|
2147
2282
|
size: 18
|
|
2148
2283
|
}, null, 8, ["name"])], 8, lr),
|
|
2149
2284
|
u(A, {
|
|
2150
2285
|
trigger: "click",
|
|
2151
2286
|
placement: "right-end",
|
|
2152
|
-
onCommand:
|
|
2287
|
+
onCommand: O
|
|
2153
2288
|
}, {
|
|
2154
|
-
dropdown: M(() => [u(
|
|
2155
|
-
default: M(() => [D(
|
|
2289
|
+
dropdown: M(() => [u(x, null, {
|
|
2290
|
+
default: M(() => [D(_).accountEntry?.side !== !1 && (D(_).accountPath || D(_).onAccountClick) ? (y(), i(m, {
|
|
2156
2291
|
key: 0,
|
|
2157
2292
|
command: "account"
|
|
2158
2293
|
}, {
|
|
2159
2294
|
default: M(() => [l(E(D(p)("campus.header.myAccount")), 1)]),
|
|
2160
2295
|
_: 1
|
|
2161
|
-
})) : a("v-if", !0), u(
|
|
2296
|
+
})) : a("v-if", !0), u(m, {
|
|
2162
2297
|
command: "logout",
|
|
2163
2298
|
divided: ""
|
|
2164
2299
|
}, {
|
|
@@ -2183,80 +2318,105 @@ var Gt = {
|
|
|
2183
2318
|
], 2),
|
|
2184
2319
|
a(" 第二栏:隐藏时宽度渐变到 0(而不是直接消失),首页与其他页之间切换时内容区不会突然跳动 "),
|
|
2185
2320
|
s("div", {
|
|
2186
|
-
class: h(["ca-side__panel", {
|
|
2321
|
+
class: h(["ca-side__panel", {
|
|
2322
|
+
"is-hidden": ee.value,
|
|
2323
|
+
"is-empty": !z.value?.children.length
|
|
2324
|
+
}]),
|
|
2187
2325
|
inert: ee.value && !D(f).mobileMenuOpen
|
|
2188
2326
|
}, [s("div", fr, [
|
|
2189
|
-
|
|
2327
|
+
B.value ? (y(), o("div", pr, E(D(g)(B.value.title)), 1)) : a("v-if", !0),
|
|
2190
2328
|
a(" key 绑定场景:切换场景时重建菜单,展开状态不会串到别的场景 "),
|
|
2191
|
-
(y(), i(
|
|
2192
|
-
|
|
2329
|
+
(y(), i(L, {
|
|
2330
|
+
ref_key: "menuRef",
|
|
2331
|
+
ref: H,
|
|
2332
|
+
key: B.value?.key,
|
|
2193
2333
|
"default-active": D(r).path,
|
|
2194
|
-
"default-openeds":
|
|
2334
|
+
"default-openeds": ae.value,
|
|
2195
2335
|
router: "",
|
|
2196
2336
|
class: "ca-side__menu",
|
|
2197
|
-
onSelect: n[1] ||= (e) => D(f).closeOverlays()
|
|
2337
|
+
onSelect: n[1] ||= (e) => D(f).closeOverlays(),
|
|
2338
|
+
onOpen: n[2] ||= (e) => ie(e, !0),
|
|
2339
|
+
onClose: n[3] ||= (e) => ie(e, !1)
|
|
2198
2340
|
}, {
|
|
2199
|
-
default: M(() => [(y(!0), o(e, null, S(
|
|
2341
|
+
default: M(() => [(y(!0), o(e, null, S(B.value?.children ?? [], (t) => (y(), o(e, { key: t.key }, [a(" 二级是菜单组:可展开,下面是三级页面 "), D(Ee)(t) && t.children.length ? (y(), i(I, {
|
|
2200
2342
|
key: 0,
|
|
2201
|
-
index: t.key
|
|
2343
|
+
index: t.key,
|
|
2344
|
+
tabindex: "0",
|
|
2345
|
+
class: h({
|
|
2346
|
+
"is-current-page": t.path === D(r).path,
|
|
2347
|
+
"is-ancestor": D(r).meta.groupKey === t.key && t.path !== D(r).path
|
|
2348
|
+
}),
|
|
2349
|
+
"aria-current": t.path === D(r).path ? "page" : void 0,
|
|
2350
|
+
onClickCapture: (e) => se(e, t),
|
|
2351
|
+
onKeydownCapture: (e) => se(e, t)
|
|
2202
2352
|
}, {
|
|
2203
|
-
title: M(() => [
|
|
2353
|
+
title: M(() => [s("span", mr, [
|
|
2204
2354
|
t.icon ? (y(), i(c, {
|
|
2205
2355
|
key: 0,
|
|
2206
2356
|
name: t.icon
|
|
2207
2357
|
}, null, 8, ["name"])) : a("v-if", !0),
|
|
2208
|
-
s("span", null, E(D(
|
|
2209
|
-
|
|
2210
|
-
]),
|
|
2211
|
-
default: M(() => [(y(!0), o(e, null, S(t.children, (e) => (y(), i(
|
|
2358
|
+
s("span", null, E(D(g)(t.title)), 1),
|
|
2359
|
+
V(t) ? (y(), o("span", hr, E(V(t)), 1)) : a("v-if", !0)
|
|
2360
|
+
])]),
|
|
2361
|
+
default: M(() => [(y(!0), o(e, null, S(t.children, (e) => (y(), i(j, {
|
|
2212
2362
|
class: "ca-side__submenu-item",
|
|
2213
2363
|
key: e.key,
|
|
2214
|
-
index: e.path
|
|
2364
|
+
index: e.path,
|
|
2365
|
+
"aria-current": e.path === D(r).path ? "page" : void 0
|
|
2215
2366
|
}, {
|
|
2216
2367
|
default: M(() => [e.icon ? (y(), i(c, {
|
|
2217
2368
|
key: 0,
|
|
2218
2369
|
name: e.icon
|
|
2219
|
-
}, null, 8, ["name"])) : a("v-if", !0), s("span", null, E(D(
|
|
2370
|
+
}, null, 8, ["name"])) : a("v-if", !0), s("span", null, E(D(g)(e.title)), 1)]),
|
|
2220
2371
|
_: 2
|
|
2221
|
-
}, 1032, ["index"]))), 128))]),
|
|
2372
|
+
}, 1032, ["index", "aria-current"]))), 128))]),
|
|
2222
2373
|
_: 2
|
|
2223
|
-
}, 1032, [
|
|
2374
|
+
}, 1032, [
|
|
2375
|
+
"index",
|
|
2376
|
+
"class",
|
|
2377
|
+
"aria-current",
|
|
2378
|
+
"onClickCapture",
|
|
2379
|
+
"onKeydownCapture"
|
|
2380
|
+
])) : (y(), o(e, { key: 1 }, [a(" 二级直接是页面 "), u(j, {
|
|
2381
|
+
index: t.path,
|
|
2382
|
+
"aria-current": t.path === D(r).path ? "page" : void 0
|
|
2383
|
+
}, {
|
|
2224
2384
|
default: M(() => [t.icon ? (y(), i(c, {
|
|
2225
2385
|
key: 0,
|
|
2226
2386
|
name: t.icon
|
|
2227
|
-
}, null, 8, ["name"])) : a("v-if", !0), s("span", null, E(D(
|
|
2387
|
+
}, null, 8, ["name"])) : a("v-if", !0), s("span", null, E(D(g)(t.title)), 1)]),
|
|
2228
2388
|
_: 2
|
|
2229
|
-
}, 1032, ["index"])], 2112))], 64))), 128))]),
|
|
2389
|
+
}, 1032, ["index", "aria-current"])], 2112))], 64))), 128))]),
|
|
2230
2390
|
_: 1
|
|
2231
2391
|
}, 8, ["default-active", "default-openeds"]))
|
|
2232
2392
|
])], 10, dr)
|
|
2233
2393
|
], 2)], 2112);
|
|
2234
2394
|
};
|
|
2235
2395
|
}
|
|
2236
|
-
}), [["__scopeId", "data-v-
|
|
2396
|
+
}), [["__scopeId", "data-v-efa0bb9f"]]), _r = {
|
|
2237
2397
|
key: 0,
|
|
2238
2398
|
class: "ca-copyright"
|
|
2239
|
-
},
|
|
2399
|
+
}, vr = ["href"], yr = /*#__PURE__*/ X(/* @__PURE__ */ d({
|
|
2240
2400
|
__name: "CaCopyright",
|
|
2241
2401
|
setup(t) {
|
|
2242
|
-
let r =
|
|
2243
|
-
return (t, n) => c.value ? (y(), o("footer",
|
|
2402
|
+
let r = q().brand, { label: i } = K(), c = n(() => r.copyright ? Ve(i(r.copyright)) : ""), l = n(() => r.copyrightLinks ?? []);
|
|
2403
|
+
return (t, n) => c.value ? (y(), o("footer", _r, [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
2404
|
class: "ca-copyright__dot",
|
|
2245
2405
|
"aria-hidden": "true"
|
|
2246
2406
|
}, "·", -1), s("a", {
|
|
2247
2407
|
href: t.href,
|
|
2248
2408
|
target: "_blank",
|
|
2249
2409
|
rel: "noopener noreferrer"
|
|
2250
|
-
}, E(t.text), 9,
|
|
2410
|
+
}, E(t.text), 9, vr)], 64))), 128))])) : a("v-if", !0);
|
|
2251
2411
|
}
|
|
2252
|
-
}), [["__scopeId", "data-v-c51879e8"]]),
|
|
2412
|
+
}), [["__scopeId", "data-v-c51879e8"]]), br = { class: "ca-tabs" }, xr = ["onClick"], Sr = { class: "ca-tabs__more" }, Cr = [
|
|
2253
2413
|
"title",
|
|
2254
2414
|
"aria-label",
|
|
2255
2415
|
"aria-pressed"
|
|
2256
|
-
],
|
|
2416
|
+
], wr = /*#__PURE__*/ X(/* @__PURE__ */ d({
|
|
2257
2417
|
__name: "TabsBar",
|
|
2258
2418
|
setup(t) {
|
|
2259
|
-
let r =
|
|
2419
|
+
let r = U(), c = W(), d = ft(), f = Z(), { t: p, label: g } = K(), _ = new Map(je(q().menus).map((e) => [e.key, e])), b = n(() => d.visited.map((e) => _.get(e)).filter((e) => !!e).map((e) => ({
|
|
2260
2420
|
key: e.key,
|
|
2261
2421
|
path: e.path,
|
|
2262
2422
|
title: g(e.title),
|
|
@@ -2300,7 +2460,7 @@ var Gt = {
|
|
|
2300
2460
|
}
|
|
2301
2461
|
return (t, n) => {
|
|
2302
2462
|
let r = w("ca-icon"), d = w("ca-dropdown-item"), m = w("ca-dropdown-menu"), g = w("ca-dropdown");
|
|
2303
|
-
return y(), o("div",
|
|
2463
|
+
return y(), o("div", br, [
|
|
2304
2464
|
(y(!0), o(e, null, S(T.value, (t) => (y(), o("div", {
|
|
2305
2465
|
key: t.name,
|
|
2306
2466
|
ref_for: !0,
|
|
@@ -2324,7 +2484,7 @@ var Gt = {
|
|
|
2324
2484
|
class: "ca-tabs__close",
|
|
2325
2485
|
onClick: P((t) => j(e.key), ["stop"])
|
|
2326
2486
|
}, null, 8, ["onClick"])) : a("v-if", !0)
|
|
2327
|
-
], 10,
|
|
2487
|
+
], 10, xr))), 128))], 2))), 128)),
|
|
2328
2488
|
u(g, {
|
|
2329
2489
|
trigger: "click",
|
|
2330
2490
|
onCommand: I
|
|
@@ -2360,7 +2520,7 @@ var Gt = {
|
|
|
2360
2520
|
]),
|
|
2361
2521
|
_: 1
|
|
2362
2522
|
})]),
|
|
2363
|
-
default: M(() => [s("span",
|
|
2523
|
+
default: M(() => [s("span", Sr, [u(r, { name: "arrowDown" })])]),
|
|
2364
2524
|
_: 1
|
|
2365
2525
|
}),
|
|
2366
2526
|
a(" 内容全屏:隐藏头部和侧栏,再点一次恢复 "),
|
|
@@ -2371,84 +2531,102 @@ var Gt = {
|
|
|
2371
2531
|
"aria-label": D(f).contentFullscreen ? D(p)("campus.tabs.exitFullscreen") : D(p)("campus.tabs.fullscreen"),
|
|
2372
2532
|
"aria-pressed": D(f).contentFullscreen,
|
|
2373
2533
|
onClick: n[0] ||= (e) => D(f).toggleContentFullscreen()
|
|
2374
|
-
}, [u(r, { name: D(f).contentFullscreen ? "exitFullscreen" : "fullscreen" }, null, 8, ["name"])], 8,
|
|
2534
|
+
}, [u(r, { name: D(f).contentFullscreen ? "exitFullscreen" : "fullscreen" }, null, 8, ["name"])], 8, Cr)
|
|
2375
2535
|
]);
|
|
2376
2536
|
};
|
|
2377
2537
|
}
|
|
2378
|
-
}), [["__scopeId", "data-v-1d7ba823"]]),
|
|
2538
|
+
}), [["__scopeId", "data-v-1d7ba823"]]), Tr = 1200, Er = "(max-width: 768px)", Dr = `(min-width: 769px) and (max-width: ${Tr}px)`, Or = ["aria-label"], kr = ["aria-label"], Ar = { class: "ca-main" }, jr = {
|
|
2539
|
+
key: 0,
|
|
2540
|
+
class: "ca-screen-prompt",
|
|
2541
|
+
role: "status"
|
|
2542
|
+
}, Mr = { class: "ca-content" }, Nr = { class: "ca-content__page" }, Pr = /*#__PURE__*/ X(/* @__PURE__ */ d({
|
|
2379
2543
|
__name: "CaLayout",
|
|
2380
2544
|
setup(e) {
|
|
2381
|
-
let n =
|
|
2382
|
-
function
|
|
2383
|
-
let e =
|
|
2545
|
+
let n = U(), r = ft(), c = Z(), { t: d } = K(), f = window.matchMedia(Er), p = window.matchMedia(Dr), m = "";
|
|
2546
|
+
function g() {
|
|
2547
|
+
let e = f.matches ? "phone" : p.matches ? "pad" : "desktop";
|
|
2384
2548
|
c.setMode(e);
|
|
2385
2549
|
}
|
|
2386
|
-
|
|
2387
|
-
e ? (
|
|
2388
|
-
}), A(() => n.fullPath, () => c.closeOverlays())
|
|
2389
|
-
function
|
|
2550
|
+
g(), A(() => c.mode === "phone" && c.mobileMenuOpen, (e) => {
|
|
2551
|
+
e ? (m = document.body.style.overflow, document.body.style.overflow = "hidden") : document.body.style.overflow = m;
|
|
2552
|
+
}), A(() => n.fullPath, () => c.closeOverlays());
|
|
2553
|
+
function b(e) {
|
|
2390
2554
|
e.key === "Escape" && (c.mobileMenuOpen || c.padPanelOpen ? c.closeOverlays() : c.contentFullscreen && c.toggleContentFullscreen());
|
|
2391
2555
|
}
|
|
2392
2556
|
v(() => {
|
|
2393
|
-
|
|
2557
|
+
g(), f.addEventListener("change", g), p.addEventListener("change", g), window.addEventListener("keydown", b), document.addEventListener("fullscreenchange", c.syncPageScreen);
|
|
2394
2558
|
}), _(() => {
|
|
2395
|
-
|
|
2559
|
+
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
2560
|
});
|
|
2397
|
-
function
|
|
2561
|
+
function x() {
|
|
2398
2562
|
let e = n.meta.pageKey;
|
|
2399
2563
|
return e ? `${e}:${r.versions[e] ?? 0}` : n.fullPath;
|
|
2400
2564
|
}
|
|
2401
2565
|
return (e, n) => {
|
|
2402
|
-
let
|
|
2566
|
+
let f = w("ca-button"), p = w("router-view");
|
|
2403
2567
|
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
2568
|
D(c).mode === "phone" && D(c).mobileMenuOpen ? (y(), o("button", {
|
|
2405
2569
|
key: 0,
|
|
2406
2570
|
type: "button",
|
|
2407
2571
|
class: "ca-mobile-scrim",
|
|
2408
|
-
"aria-label": D(
|
|
2572
|
+
"aria-label": D(d)("campus.side.closeMenu"),
|
|
2409
2573
|
onClick: n[0] ||= (e) => D(c).closeMobileMenu()
|
|
2410
|
-
}, null, 8,
|
|
2574
|
+
}, null, 8, Or)) : a("v-if", !0),
|
|
2411
2575
|
D(c).mode === "pad" && D(c).padPanelOpen ? (y(), o("button", {
|
|
2412
2576
|
key: 1,
|
|
2413
2577
|
type: "button",
|
|
2414
2578
|
class: "ca-pad-scrim",
|
|
2415
|
-
"aria-label": D(
|
|
2579
|
+
"aria-label": D(d)("campus.side.closeMenu"),
|
|
2416
2580
|
onClick: n[1] ||= (e) => D(c).closePadPanel()
|
|
2417
|
-
}, null, 8,
|
|
2581
|
+
}, null, 8, kr)) : a("v-if", !0),
|
|
2418
2582
|
a(" 手机抽屉关闭时、电脑档两栏都收起时,侧栏不在屏幕上,不可聚焦 "),
|
|
2419
|
-
N(u(
|
|
2583
|
+
N(u(gr, {
|
|
2420
2584
|
class: h({ "is-mobile-open": D(c).mobileMenuOpen }),
|
|
2421
2585
|
inert: D(c).mode === "phone" && !D(c).mobileMenuOpen || D(c).sideHiddenActive
|
|
2422
2586
|
}, null, 8, ["class", "inert"]), [[k, !D(c).contentFullscreen]]),
|
|
2423
|
-
s("main",
|
|
2424
|
-
u(
|
|
2587
|
+
s("main", Ar, [
|
|
2588
|
+
u(wr),
|
|
2425
2589
|
u(Xn),
|
|
2426
|
-
|
|
2590
|
+
D(c).pageScreenPrompt ? (y(), o("div", jr, [u(f, {
|
|
2591
|
+
size: "small",
|
|
2592
|
+
onClick: n[2] ||= (e) => D(c).retryPageScreen()
|
|
2593
|
+
}, {
|
|
2594
|
+
default: M(() => [l(E(D(d)("campus.tabs.enterScreen")), 1)]),
|
|
2595
|
+
_: 1
|
|
2596
|
+
}), u(f, {
|
|
2597
|
+
size: "small",
|
|
2598
|
+
"aria-label": D(d)("campus.tabs.dismissScreen"),
|
|
2599
|
+
onClick: n[3] ||= (e) => D(c).dismissPageScreenPrompt()
|
|
2600
|
+
}, {
|
|
2601
|
+
default: M(() => [l(E(D(d)("campus.tabs.dismissScreen")), 1)]),
|
|
2602
|
+
_: 1
|
|
2603
|
+
}, 8, ["aria-label"])])) : a("v-if", !0),
|
|
2604
|
+
s("div", Mr, [
|
|
2427
2605
|
u(er),
|
|
2428
2606
|
a(" 页面区撑满剩余高度,版权在其后:内容少时贴窗口底,内容长时滚到最底才出现 "),
|
|
2429
|
-
s("div",
|
|
2607
|
+
s("div", Nr, [u(p, null, {
|
|
2430
2608
|
default: M(({ Component: e }) => [a(" include 与标签名单同步;缓存容量包含固定标签。 "), (y(), i(t, {
|
|
2431
2609
|
include: D(r).cached,
|
|
2432
2610
|
max: D(r).maxTabs + D(r).affixKeys.length
|
|
2433
|
-
}, [e ? (y(), i(T(e), { key:
|
|
2611
|
+
}, [e ? (y(), i(T(e), { key: x() })) : a("v-if", !0)], 1032, ["include", "max"]))]),
|
|
2434
2612
|
_: 1
|
|
2435
2613
|
})]),
|
|
2436
|
-
u(
|
|
2614
|
+
u(yr)
|
|
2437
2615
|
])
|
|
2438
2616
|
])
|
|
2439
2617
|
], 2)], 2);
|
|
2440
2618
|
};
|
|
2441
2619
|
}
|
|
2442
|
-
}), [["__scopeId", "data-v-
|
|
2620
|
+
}), [["__scopeId", "data-v-90594751"]]), Fr = { class: "ca-exception" }, Ir = { class: "ca-exception__code" }, Lr = { class: "ca-exception__text" }, Rr = /*#__PURE__*/ X(/* @__PURE__ */ d({
|
|
2443
2621
|
__name: "ExceptionPage",
|
|
2444
2622
|
props: { kind: {} },
|
|
2445
2623
|
setup(e) {
|
|
2446
|
-
let t = e, r =
|
|
2624
|
+
let t = e, r = W(), i = Me(q()).home, { t: a } = K(), c = n(() => t.kind === "forbidden" ? "403" : "404"), d = n(() => a(t.kind === "forbidden" ? "campus.error.forbidden" : "campus.error.notFound"));
|
|
2447
2625
|
return (e, t) => {
|
|
2448
2626
|
let n = w("ca-button");
|
|
2449
|
-
return y(), o("div",
|
|
2450
|
-
s("div",
|
|
2451
|
-
s("p",
|
|
2627
|
+
return y(), o("div", Fr, [
|
|
2628
|
+
s("div", Ir, E(c.value), 1),
|
|
2629
|
+
s("p", Lr, E(d.value), 1),
|
|
2452
2630
|
u(n, {
|
|
2453
2631
|
type: "primary",
|
|
2454
2632
|
onClick: t[0] ||= (e) => D(r).replace(D(i))
|
|
@@ -2459,13 +2637,13 @@ var Gt = {
|
|
|
2459
2637
|
]);
|
|
2460
2638
|
};
|
|
2461
2639
|
}
|
|
2462
|
-
}), [["__scopeId", "data-v-75a54c8a"]]),
|
|
2640
|
+
}), [["__scopeId", "data-v-75a54c8a"]]), zr = { class: "ca-login" }, Br = { class: "ca-login__main" }, Vr = { class: "ca-login__card" }, Hr = { class: "ca-login__brand" }, Ur = ["src"], Wr = { class: "ca-login__name" }, Gr = {
|
|
2463
2641
|
key: 1,
|
|
2464
2642
|
class: "ca-login__subtitle"
|
|
2465
|
-
},
|
|
2643
|
+
}, Kr = /*#__PURE__*/ X(/* @__PURE__ */ d({
|
|
2466
2644
|
__name: "LoginPage",
|
|
2467
2645
|
setup(e) {
|
|
2468
|
-
let t =
|
|
2646
|
+
let t = U(), r = W(), c = Q(), d = Be(), { t: f, label: p } = K(), m = q().brand, h = n(() => p(d.theme.siteName ?? m.name)), g = n(() => d.theme.logo ?? m.logo), _ = Ue(), v = b({
|
|
2469
2647
|
username: "",
|
|
2470
2648
|
password: "",
|
|
2471
2649
|
captcha: ""
|
|
@@ -2501,7 +2679,7 @@ var Gt = {
|
|
|
2501
2679
|
key: S.value,
|
|
2502
2680
|
code: v.captcha
|
|
2503
2681
|
} : void 0
|
|
2504
|
-
}), await r.replace(
|
|
2682
|
+
}), await r.replace(We(t.query.redirect));
|
|
2505
2683
|
} catch (e) {
|
|
2506
2684
|
k.value = e instanceof Error && e.message ? e.message : f("campus.login.failed"), C.value?.refresh();
|
|
2507
2685
|
} finally {
|
|
@@ -2510,16 +2688,16 @@ var Gt = {
|
|
|
2510
2688
|
}
|
|
2511
2689
|
return (e, t) => {
|
|
2512
2690
|
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",
|
|
2691
|
+
return y(), o("div", zr, [s("div", Br, [s("div", Vr, [
|
|
2692
|
+
s("div", Hr, [
|
|
2515
2693
|
g.value ? (y(), o("img", {
|
|
2516
2694
|
key: 0,
|
|
2517
2695
|
src: g.value,
|
|
2518
2696
|
alt: "",
|
|
2519
2697
|
class: "ca-login__logo"
|
|
2520
|
-
}, null, 8,
|
|
2521
|
-
s("h1",
|
|
2522
|
-
D(m).subtitle ? (y(), o("p",
|
|
2698
|
+
}, null, 8, Ur)) : a("v-if", !0),
|
|
2699
|
+
s("h1", Wr, E(h.value), 1),
|
|
2700
|
+
D(m).subtitle ? (y(), o("p", Gr, E(D(p)(D(m).subtitle)), 1)) : a("v-if", !0)
|
|
2523
2701
|
]),
|
|
2524
2702
|
k.value ? (y(), i(n, {
|
|
2525
2703
|
key: 0,
|
|
@@ -2563,7 +2741,7 @@ var Gt = {
|
|
|
2563
2741
|
key: 0,
|
|
2564
2742
|
prop: "captcha"
|
|
2565
2743
|
}, {
|
|
2566
|
-
default: M(() => [u(
|
|
2744
|
+
default: M(() => [u(bt, {
|
|
2567
2745
|
ref_key: "captchaRef",
|
|
2568
2746
|
ref: C,
|
|
2569
2747
|
code: v.captcha,
|
|
@@ -2586,12 +2764,12 @@ var Gt = {
|
|
|
2586
2764
|
]),
|
|
2587
2765
|
_: 1
|
|
2588
2766
|
}, 8, ["model", "rules"])
|
|
2589
|
-
])]), u(
|
|
2767
|
+
])]), u(yr, { class: "ca-login__copyright" })]);
|
|
2590
2768
|
};
|
|
2591
2769
|
}
|
|
2592
2770
|
}), [["__scopeId", "data-v-ddf636fd"]]);
|
|
2593
2771
|
// packages/core/src/router.ts
|
|
2594
|
-
function
|
|
2772
|
+
function qr(e) {
|
|
2595
2773
|
return async () => {
|
|
2596
2774
|
let t = await e.component();
|
|
2597
2775
|
return d({
|
|
@@ -2600,17 +2778,17 @@ function Gr(e) {
|
|
|
2600
2778
|
});
|
|
2601
2779
|
};
|
|
2602
2780
|
}
|
|
2603
|
-
var
|
|
2781
|
+
var Jr = d({
|
|
2604
2782
|
name: "CaForbidden",
|
|
2605
|
-
setup: () => () => f(
|
|
2606
|
-
}),
|
|
2783
|
+
setup: () => () => f(Rr, { kind: "forbidden" })
|
|
2784
|
+
}), Yr = d({
|
|
2607
2785
|
name: "CaNotFound",
|
|
2608
|
-
setup: () => () => f(
|
|
2786
|
+
setup: () => () => f(Rr, { kind: "notFound" })
|
|
2609
2787
|
});
|
|
2610
|
-
function
|
|
2611
|
-
let n =
|
|
2788
|
+
function Xr(e, t) {
|
|
2789
|
+
let n = je(e.menus);
|
|
2612
2790
|
if (!n.length) throw Error("[campus] 菜单里至少需要一个页面");
|
|
2613
|
-
let r =
|
|
2791
|
+
let r = Me(e), i = J(e);
|
|
2614
2792
|
if (new Set(Object.values(i)).size !== 5 || n.some((e) => Object.values(i).includes(e.key))) throw Error("[campus] 系统路由名称重复或与页面键冲突,请配置 routeNames");
|
|
2615
2793
|
for (let e of n) if ([
|
|
2616
2794
|
r.login,
|
|
@@ -2623,7 +2801,7 @@ function Jr(e, t) {
|
|
|
2623
2801
|
{
|
|
2624
2802
|
path: r.login,
|
|
2625
2803
|
name: i.login,
|
|
2626
|
-
component: e.login?.style === "split" ?
|
|
2804
|
+
component: e.login?.style === "split" ? Pt : Kr,
|
|
2627
2805
|
meta: { public: !0 }
|
|
2628
2806
|
},
|
|
2629
2807
|
{
|
|
@@ -2640,33 +2818,34 @@ function Jr(e, t) {
|
|
|
2640
2818
|
},
|
|
2641
2819
|
{
|
|
2642
2820
|
path: "/",
|
|
2643
|
-
component:
|
|
2821
|
+
component: Pr,
|
|
2644
2822
|
redirect: n.some((e) => e.path === "/") ? void 0 : () => {
|
|
2645
|
-
let e =
|
|
2823
|
+
let e = Q(t);
|
|
2646
2824
|
return r.home === "/" ? n.find((t) => e.can(t.permission))?.path ?? r.forbidden : r.home;
|
|
2647
2825
|
},
|
|
2648
2826
|
children: [
|
|
2649
2827
|
...n.map((e) => ({
|
|
2650
2828
|
path: e.path,
|
|
2651
2829
|
name: e.key,
|
|
2652
|
-
component:
|
|
2830
|
+
component: qr(e),
|
|
2653
2831
|
meta: {
|
|
2654
2832
|
pageKey: e.key,
|
|
2655
2833
|
appKey: e.appKey,
|
|
2656
2834
|
groupKey: e.groupKey,
|
|
2657
2835
|
permission: e.permission,
|
|
2658
|
-
sideCollapse: e.sideCollapse
|
|
2836
|
+
sideCollapse: e.sideCollapse,
|
|
2837
|
+
openMode: e.openMode
|
|
2659
2838
|
}
|
|
2660
2839
|
})),
|
|
2661
2840
|
{
|
|
2662
2841
|
path: r.forbidden,
|
|
2663
2842
|
name: i.forbidden,
|
|
2664
|
-
component:
|
|
2843
|
+
component: Jr
|
|
2665
2844
|
},
|
|
2666
2845
|
{
|
|
2667
2846
|
path: r.notFound,
|
|
2668
2847
|
name: i.notFound,
|
|
2669
|
-
component:
|
|
2848
|
+
component: Yr
|
|
2670
2849
|
},
|
|
2671
2850
|
...r.notFound === "/:pathMatch(.*)*" ? [] : [{
|
|
2672
2851
|
path: "/:pathMatch(.*)*",
|
|
@@ -2674,58 +2853,65 @@ function Jr(e, t) {
|
|
|
2674
2853
|
}]
|
|
2675
2854
|
]
|
|
2676
2855
|
}
|
|
2677
|
-
], o =
|
|
2678
|
-
history: e.history === "web" ?
|
|
2856
|
+
], o = ne({
|
|
2857
|
+
history: e.history === "web" ? re() : H(),
|
|
2679
2858
|
routes: a
|
|
2680
|
-
});
|
|
2681
|
-
return o.beforeEach((e) => {
|
|
2682
|
-
let
|
|
2683
|
-
return e.meta.public ?
|
|
2859
|
+
}), s = Z(t);
|
|
2860
|
+
return o.beforeEach((e, n) => {
|
|
2861
|
+
let a = Q(t);
|
|
2862
|
+
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
2863
|
name: i.login,
|
|
2685
2864
|
query: e.fullPath === r.home ? void 0 : { redirect: e.fullPath }
|
|
2686
2865
|
};
|
|
2687
|
-
}), o.afterEach((
|
|
2688
|
-
|
|
2689
|
-
|
|
2866
|
+
}), o.afterEach((n, r, i) => {
|
|
2867
|
+
if (i) s.cancelPageScreen();
|
|
2868
|
+
else {
|
|
2869
|
+
if (n.path === r.path && r.matched.length || s.applyPageOpenMode(n.meta.openMode, n.meta.sideCollapse), n.path !== r.path || !r.matched.length) {
|
|
2870
|
+
let r = Ne(e, (e) => Q(t).can(e)).apps.find((e) => e.key === n.meta.appKey);
|
|
2871
|
+
s.enterParentPage(r?.path === n.path && r.children.length ? r.key : void 0, n.meta.openMode == null ? n.meta.sideCollapse === "panel" || n.meta.sideCollapse === "all" : n.meta.openMode !== "normal"), n.meta.groupKey && s.ensureMenuGroup(n.meta.groupKey);
|
|
2872
|
+
}
|
|
2873
|
+
n.meta.pageKey && ft(t).open(n.meta.pageKey);
|
|
2874
|
+
}
|
|
2875
|
+
}), o.onError(() => s.cancelPageScreen()), o;
|
|
2690
2876
|
}
|
|
2691
2877
|
// packages/core/src/services/login.ts
|
|
2692
|
-
async function
|
|
2693
|
-
e.signIn(n), await t.replace(
|
|
2878
|
+
async function Zr(e, t, n, r) {
|
|
2879
|
+
e.signIn(n), await t.replace(We(r));
|
|
2694
2880
|
}
|
|
2695
2881
|
// packages/core/src/services/auth.ts
|
|
2696
|
-
var
|
|
2697
|
-
function
|
|
2698
|
-
|
|
2882
|
+
var Qr, $r;
|
|
2883
|
+
function ei(e, t) {
|
|
2884
|
+
Qr = e, $r = t;
|
|
2699
2885
|
}
|
|
2700
|
-
async function
|
|
2701
|
-
if (
|
|
2702
|
-
let t =
|
|
2886
|
+
async function ti(e) {
|
|
2887
|
+
if (q(), !Qr || !$r) return;
|
|
2888
|
+
let t = Q($r);
|
|
2703
2889
|
if (!t.isLoggedIn) return;
|
|
2704
|
-
t.expire(), Gt.toast.warning(e ||
|
|
2705
|
-
let n =
|
|
2706
|
-
n.name !== "login" && await
|
|
2707
|
-
name:
|
|
2708
|
-
query: n.fullPath ===
|
|
2890
|
+
t.expire(), Gt.toast.warning(e || Ce("campus.auth.sessionExpired"));
|
|
2891
|
+
let n = Qr.currentRoute.value;
|
|
2892
|
+
n.name !== "login" && await Qr.replace({
|
|
2893
|
+
name: J(q()).login,
|
|
2894
|
+
query: n.fullPath === Me(q()).home ? void 0 : { redirect: n.fullPath }
|
|
2709
2895
|
});
|
|
2710
2896
|
}
|
|
2711
|
-
async function
|
|
2712
|
-
if (
|
|
2713
|
-
await
|
|
2897
|
+
async function ni(e, t) {
|
|
2898
|
+
if (q(), !Qr || !$r) throw Error("[campus] 应用尚未创建,无法完成登录");
|
|
2899
|
+
await Zr(Q($r), Qr, e, t);
|
|
2714
2900
|
}
|
|
2715
2901
|
// packages/core/src/app.ts
|
|
2716
|
-
function
|
|
2717
|
-
|
|
2718
|
-
let t = r(
|
|
2902
|
+
function ri(e) {
|
|
2903
|
+
It(e), Oe(e);
|
|
2904
|
+
let t = r(Te), n = F();
|
|
2719
2905
|
t.use(n);
|
|
2720
|
-
let i =
|
|
2906
|
+
let i = xe(e);
|
|
2721
2907
|
t.use(i);
|
|
2722
2908
|
let a = (e, t) => i.global.t(e, t ?? {});
|
|
2723
2909
|
t.provide(R, a), zt(a), t.config.globalProperties.$ca = Gt, L(t), t.component("CaAuthPreview", sn);
|
|
2724
|
-
let o =
|
|
2725
|
-
return
|
|
2910
|
+
let o = Xr(e, n);
|
|
2911
|
+
return ei(o, n), t.use(o), Be(n).boot(), t;
|
|
2726
2912
|
}
|
|
2727
2913
|
// packages/core/src/index.ts
|
|
2728
|
-
function
|
|
2914
|
+
function ii(e) {
|
|
2729
2915
|
return e;
|
|
2730
2916
|
}
|
|
2731
|
-
export { Gt as ca,
|
|
2917
|
+
export { Gt as ca, ni as completeLogin, ri as createCampusApp, ii as defineMenus, ti as handleUnauthorized, Ft as resolveEnvironment, Ce as t, K as useCampusT, Z as useLayoutStore, Q as useSessionStore, ft as useTabsStore, Be as useThemeStore };
|