@campus-admin/core 1.0.0 → 2.0.2
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 +26 -157
- package/dist/app.d.ts +2 -0
- package/dist/context.d.ts +29 -15
- package/dist/copyright.d.ts +2 -0
- package/dist/i18n.d.ts +356 -0
- package/dist/index.d.ts +23 -32
- package/dist/index.js +2572 -424
- package/dist/layout/CaCopyright.vue.d.ts +3 -0
- package/dist/layout/CaLayout.vue.d.ts +3 -0
- package/dist/layout/HeaderBar.vue.d.ts +3 -0
- package/dist/layout/PageHeader.vue.d.ts +3 -0
- package/dist/layout/PageTitle.vue.d.ts +3 -0
- package/dist/layout/SideMenu.vue.d.ts +3 -0
- package/dist/layout/TabsBar.vue.d.ts +3 -0
- package/dist/layout/breakpoints.d.ts +21 -0
- package/dist/{components/overlay/ca-loading-overlay.vue.d.ts → pages/AuthPreview.vue.d.ts} +2 -6
- package/dist/{components/overlay/ca-toast-list.vue.d.ts → pages/ExceptionPage.vue.d.ts} +2 -5
- package/dist/{components/overlay/ca-overlay-list.vue.d.ts → pages/ForgotPage.vue.d.ts} +2 -5
- package/dist/pages/LoginPage.vue.d.ts +3 -0
- package/dist/pages/LoginSplit.vue.d.ts +6 -0
- package/dist/pages/RegisterPage.vue.d.ts +6 -0
- package/dist/pages/auth/AuthIcon.vue.d.ts +10 -0
- package/dist/pages/auth/AuthShell.vue.d.ts +29 -0
- package/dist/pages/auth/CaptchaField.vue.d.ts +20 -0
- package/dist/pages/auth/ForgotForm.vue.d.ts +6 -0
- package/dist/pages/auth/LoginForm.vue.d.ts +6 -0
- package/dist/pages/auth/RegisterForm.vue.d.ts +6 -0
- package/dist/pages/auth/SmsField.vue.d.ts +14 -0
- package/dist/pages/auth/WechatPane.vue.d.ts +6 -0
- package/dist/pages/auth/options.d.ts +16 -0
- package/dist/pages/auth/wechat-host.d.ts +10 -0
- package/dist/router.d.ts +15 -0
- package/dist/security.d.ts +15 -0
- package/dist/services/auth.d.ts +21 -0
- package/dist/services/ca.d.ts +48 -0
- package/dist/services/feedback.d.ts +54 -0
- package/dist/services/login.d.ts +8 -0
- package/dist/storage.d.ts +12 -0
- package/dist/stores/layout.d.ts +41 -0
- package/dist/stores/session.d.ts +65 -0
- package/dist/stores/tabs.d.ts +49 -0
- package/dist/stores/theme.d.ts +280 -0
- package/dist/style.css +2 -0
- package/dist/tabs-policy.d.ts +4 -0
- package/dist/types.d.ts +259 -0
- package/package.json +23 -61
- package/dist/application.d.ts +0 -51
- package/dist/campus.d.ts +0 -9
- package/dist/components/overlay/index.d.ts +0 -6
- package/dist/components/overlay/style/index.d.ts +0 -10
- package/dist/container.d.ts +0 -21
- package/dist/contracts/config.d.ts +0 -13
- package/dist/contracts/provider.d.ts +0 -24
- package/dist/core.css +0 -2
- package/dist/facade.d.ts +0 -15
- package/dist/index.umd.cjs +0 -1
- package/dist/plugin.d.ts +0 -49
- package/dist/services/index.d.ts +0 -7
- package/dist/services/loading.d.ts +0 -21
- package/dist/services/modal.d.ts +0 -47
- package/dist/services/store.d.ts +0 -20
- package/dist/services/toast.d.ts +0 -19
- package/dist/services/use-store.d.ts +0 -9
- package/dist/vue-application.d.ts +0 -21
- package/dist/vue.d.ts +0 -8
- package/types/ca.d.ts +0 -22
- /package/dist/{components/overlay/ca-overlay-host.vue.d.ts → CampusRoot.vue.d.ts} +0 -0
package/dist/index.js
CHANGED
|
@@ -1,474 +1,2622 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
1
|
+
import './style.css'
|
|
2
|
+
import "element-plus/es/components/base/style/css";
|
|
3
|
+
import "element-plus/theme-chalk/dark/css-vars.css";
|
|
4
|
+
import "@campus-admin/theme/nova.css";
|
|
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
|
+
import { createPinia as F, defineStore as I } from "pinia";
|
|
7
|
+
import { installUi as L, translateKey as R } from "@campus-admin/ui";
|
|
8
|
+
import { LOCALES as ee, frameworkMessages as te } from "@campus-admin/locale";
|
|
9
|
+
import { createI18n as ne, useI18n as z } from "vue-i18n";
|
|
10
|
+
import { RouterLink as B, createRouter as re, createWebHashHistory as ie, createWebHistory as ae, useRoute as V, useRouter as H } from "vue-router";
|
|
11
|
+
import { applyTheme as oe, deriveCssVars as se, isHexColor as ce, resolveMode as le, resolveTheme as ue } from "@campus-admin/theme";
|
|
12
|
+
import { ElLoading as de, ElMessage as fe, ElMessageBox as pe, ElNotification as me } from "element-plus";
|
|
13
|
+
import "element-plus/es/components/loading/style/css";
|
|
14
|
+
import "element-plus/es/components/notification/style/css";
|
|
15
|
+
import "element-plus/es/components/message/style/css";
|
|
16
|
+
import "element-plus/es/components/message-box/style/css";
|
|
5
17
|
export * from "@campus-admin/ui";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
18
|
+
// packages/core/src/storage.ts
|
|
19
|
+
var he = "ca:";
|
|
20
|
+
function ge(e, t = "local") {
|
|
21
|
+
try {
|
|
22
|
+
return (t === "local" ? localStorage : sessionStorage).getItem(he + e);
|
|
23
|
+
} catch {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
function U(e, t, n = "local") {
|
|
28
|
+
try {
|
|
29
|
+
let r = n === "local" ? localStorage : sessionStorage;
|
|
30
|
+
t === null ? r.removeItem(he + e) : r.setItem(he + e, t);
|
|
31
|
+
} catch {}
|
|
32
|
+
}
|
|
33
|
+
function _e(e, t = "local") {
|
|
34
|
+
let n = ge(e, t);
|
|
35
|
+
if (n) try {
|
|
36
|
+
return JSON.parse(n);
|
|
37
|
+
} catch {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
function ve(e, t, n = "local") {
|
|
42
|
+
U(e, JSON.stringify(t), n);
|
|
43
|
+
}
|
|
44
|
+
// packages/core/src/i18n.ts
|
|
45
|
+
var ye = (e) => typeof e == "object" && !!e && !Array.isArray(e);
|
|
46
|
+
function be(e, t) {
|
|
47
|
+
let n = { ...e };
|
|
48
|
+
for (let [e, r] of Object.entries(t)) {
|
|
49
|
+
let t = n[e];
|
|
50
|
+
n[e] = ye(t) && ye(r) ? be(t, r) : r;
|
|
51
|
+
}
|
|
52
|
+
return n;
|
|
53
|
+
}
|
|
54
|
+
var xe = "locale";
|
|
55
|
+
function Se(e) {
|
|
56
|
+
return e === "zh-CN" || e === "en-US";
|
|
57
|
+
}
|
|
58
|
+
function Ce(e) {
|
|
59
|
+
let t = ge(xe), n = Se(t) ? t : e.defaultLocale ?? "zh-CN", r = Object.fromEntries(["zh-CN", "en-US"].map((t) => [t, be(te[t], e.messages?.[t] ?? {})])), i = ne({
|
|
60
|
+
legacy: !1,
|
|
61
|
+
locale: n,
|
|
62
|
+
fallbackLocale: "zh-CN",
|
|
63
|
+
messages: r
|
|
64
|
+
});
|
|
65
|
+
return typeof document < "u" && A(() => i.global.locale.value, (e) => {
|
|
66
|
+
document.documentElement.lang = e;
|
|
67
|
+
}, { immediate: !0 }), we = i, i;
|
|
68
|
+
}
|
|
69
|
+
var we;
|
|
70
|
+
function Te(e, t) {
|
|
71
|
+
return we ? we.global.t(e, t ?? {}) : e;
|
|
72
|
+
}
|
|
73
|
+
function Ee(e) {
|
|
74
|
+
U(xe, e);
|
|
75
|
+
}
|
|
76
|
+
function W() {
|
|
77
|
+
let { t: e, te: t, locale: n } = z();
|
|
78
|
+
return {
|
|
79
|
+
t: e,
|
|
80
|
+
te: t,
|
|
81
|
+
label: (n) => t(n) ? e(n) : n,
|
|
82
|
+
locale: n
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
// packages/core/src/CampusRoot.vue
|
|
86
|
+
var De = /* @__PURE__ */ d({
|
|
87
|
+
__name: "CampusRoot",
|
|
88
|
+
setup(e) {
|
|
89
|
+
let { locale: t } = W();
|
|
90
|
+
return (e, n) => {
|
|
91
|
+
let r = w("router-view"), a = w("ca-config-provider");
|
|
92
|
+
return y(), i(a, { locale: D(t) }, {
|
|
93
|
+
default: M(() => [u(r)]),
|
|
94
|
+
_: 1
|
|
95
|
+
}, 8, ["locale"]);
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
// packages/core/src/types.ts
|
|
100
|
+
function G(e) {
|
|
101
|
+
return "children" in e;
|
|
102
|
+
}
|
|
103
|
+
// packages/core/src/context.ts
|
|
104
|
+
var Oe;
|
|
105
|
+
function ke(e) {
|
|
106
|
+
Oe = e;
|
|
107
|
+
}
|
|
108
|
+
function K() {
|
|
109
|
+
if (!Oe) throw Error("[campus] 请先调用 createCampusApp()");
|
|
110
|
+
return Oe;
|
|
111
|
+
}
|
|
112
|
+
function Ae(e) {
|
|
113
|
+
for (let t of K().menus) for (let n of t.children) if (G(n)) {
|
|
114
|
+
let r = n.children.find((t) => t.key === e);
|
|
115
|
+
if (r) return { titles: [
|
|
116
|
+
t.title,
|
|
117
|
+
n.title,
|
|
118
|
+
r.title
|
|
119
|
+
] };
|
|
120
|
+
} else if (n.key === e) return { titles: [t.title, n.title] };
|
|
121
|
+
}
|
|
122
|
+
function je(e) {
|
|
123
|
+
let t = [], n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set();
|
|
124
|
+
for (let o of e) {
|
|
125
|
+
if (i.has(o.key)) throw Error(`[campus] 菜单一级场景键重复:${o.key}`);
|
|
126
|
+
i.add(o.key);
|
|
127
|
+
for (let e of o.children) {
|
|
128
|
+
let i = G(e) ? e : void 0;
|
|
129
|
+
if (i) {
|
|
130
|
+
if (a.has(i.key)) throw Error(`[campus] 菜单组键重复:${i.key}`);
|
|
131
|
+
a.add(i.key);
|
|
132
|
+
}
|
|
133
|
+
for (let a of i ? i.children : [e]) {
|
|
134
|
+
if (n.has(a.key)) throw Error(`[campus] 菜单页面键重复:${a.key}`);
|
|
135
|
+
if (r.has(a.path)) throw Error(`[campus] 菜单路径重复:${a.path}`);
|
|
136
|
+
if (!a.path.startsWith("/")) throw Error(`[campus] 菜单路径必须以 / 开头:${a.path}`);
|
|
137
|
+
n.add(a.key), r.add(a.path), t.push({
|
|
138
|
+
...a,
|
|
139
|
+
appKey: o.key,
|
|
140
|
+
groupKey: i?.key
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
return t;
|
|
146
|
+
}
|
|
147
|
+
function Me(e, t) {
|
|
148
|
+
if (e !== void 0 && !t.some((t) => t.path === e)) throw Error(`[campus] 账户页路径不在菜单页面里:${e}`);
|
|
149
|
+
}
|
|
150
|
+
// packages/core/src/stores/theme.ts
|
|
151
|
+
var Ne = "theme-mode", Pe = "box-style", Fe = "user-primary";
|
|
152
|
+
function Ie() {
|
|
153
|
+
return ge(Pe) === "border" ? "border" : "shadow";
|
|
154
|
+
}
|
|
155
|
+
function Le() {
|
|
156
|
+
let e = ge(Fe);
|
|
157
|
+
return ce(e) ? e : void 0;
|
|
158
|
+
}
|
|
159
|
+
function Re() {
|
|
160
|
+
let e = ge(Ne);
|
|
161
|
+
return e === "light" || e === "dark" || e === "auto" ? e : "auto";
|
|
162
|
+
}
|
|
163
|
+
var ze = I("campus-theme", () => {
|
|
164
|
+
let e = x({}), t = x(Re()), r = x(Ie()), i = x(Le()), a = typeof matchMedia == "function" ? matchMedia("(prefers-color-scheme: dark)") : void 0, o = x(a?.matches ?? !1);
|
|
165
|
+
a?.addEventListener("change", (e) => o.value = e.matches);
|
|
166
|
+
let s = n(() => ue(e.value)), c = n(() => e.value.tenantDefault?.locks?.includes("primary") ?? !1), l = n(() => {
|
|
167
|
+
let e = s.value.theme, t = i.value;
|
|
168
|
+
return !t || c.value ? e : {
|
|
169
|
+
...e,
|
|
170
|
+
primary: t,
|
|
171
|
+
headerBg: e.headerBg === e.primary ? t : e.headerBg
|
|
172
|
+
};
|
|
173
|
+
}), u = n(() => s.value.issues), d = n(() => le(t.value, o.value)), f = n(() => se(l.value, d.value));
|
|
174
|
+
j(() => oe(f.value, d.value, l.value.style)), j(() => {
|
|
175
|
+
document.documentElement.dataset.caBox = r.value;
|
|
176
|
+
});
|
|
177
|
+
function p(e) {
|
|
178
|
+
(e === void 0 || ce(e)) && (i.value = e, U(Fe, e ?? null));
|
|
179
|
+
}
|
|
180
|
+
function h(e) {
|
|
181
|
+
r.value = e, U(Pe, e);
|
|
182
|
+
}
|
|
183
|
+
function g() {
|
|
184
|
+
return `theme-layers:${K().theme?.cacheKey ?? location.host}`;
|
|
185
|
+
}
|
|
186
|
+
function _(e) {
|
|
187
|
+
t.value = e, U(Ne, e);
|
|
188
|
+
}
|
|
189
|
+
function v(e, t) {
|
|
190
|
+
let n = document, r = le(e, o.value) !== d.value, i = typeof matchMedia == "function" && matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
191
|
+
if (!t || !r || i || !n.startViewTransition) {
|
|
192
|
+
_(e);
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
let a = Math.hypot(Math.max(t.x, innerWidth - t.x), Math.max(t.y, innerHeight - t.y)), s = le(e, o.value) === "dark", c = document.documentElement;
|
|
196
|
+
c.dataset.caThemeTransition = s ? "to-dark" : "to-light";
|
|
197
|
+
let l = !1, u = () => {
|
|
198
|
+
l || (l = !0, _(e));
|
|
199
|
+
}, f = n.startViewTransition(async () => {
|
|
200
|
+
u(), await m();
|
|
201
|
+
});
|
|
202
|
+
setTimeout(u, 300);
|
|
203
|
+
let p = () => delete c.dataset.caThemeTransition;
|
|
204
|
+
setTimeout(p, 2e3), f.finished?.then(p, p), f.ready.then(() => {
|
|
205
|
+
let e = `circle(${a}px at ${t.x}px ${t.y}px)`, n = `circle(0px at ${t.x}px ${t.y}px)`;
|
|
206
|
+
c.animate({ clipPath: s ? [e, n] : [n, e] }, {
|
|
207
|
+
duration: 450,
|
|
208
|
+
easing: "ease-in-out",
|
|
209
|
+
pseudoElement: s ? "::view-transition-old(root)" : "::view-transition-new(root)"
|
|
210
|
+
});
|
|
211
|
+
}).catch(() => {});
|
|
212
|
+
}
|
|
213
|
+
function y(t, n = !0) {
|
|
214
|
+
e.value = t, n && ve(g(), t);
|
|
215
|
+
}
|
|
216
|
+
async function b() {
|
|
217
|
+
let t = _e(g());
|
|
218
|
+
t && (e.value = t);
|
|
219
|
+
let n = K().theme?.load;
|
|
220
|
+
if (n) {
|
|
221
|
+
try {
|
|
222
|
+
y(await n());
|
|
223
|
+
} catch (e) {
|
|
224
|
+
console.warn("[campus] 加载站点主题失败,继续使用缓存或默认主题:", e);
|
|
225
|
+
}
|
|
226
|
+
u.value.length && console.warn("[campus] 主题配置有被忽略的字段:", u.value);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
return {
|
|
230
|
+
layers: e,
|
|
231
|
+
mode: t,
|
|
232
|
+
boxStyle: r,
|
|
233
|
+
setBoxStyle: h,
|
|
234
|
+
userPrimary: i,
|
|
235
|
+
primaryLocked: c,
|
|
236
|
+
setPrimary: p,
|
|
237
|
+
theme: l,
|
|
238
|
+
issues: u,
|
|
239
|
+
effectiveMode: d,
|
|
240
|
+
cssVars: f,
|
|
241
|
+
setMode: v,
|
|
242
|
+
setLayers: y,
|
|
243
|
+
boot: b
|
|
244
|
+
};
|
|
245
|
+
});
|
|
246
|
+
// packages/core/src/copyright.ts
|
|
247
|
+
function Be(e, t = (/* @__PURE__ */ new Date()).getFullYear()) {
|
|
248
|
+
return e.replaceAll("{year}", String(t));
|
|
249
|
+
}
|
|
250
|
+
// packages/core/src/pages/auth/options.ts
|
|
251
|
+
var Ve = /^1[3-9]\d{9}$/;
|
|
252
|
+
function q() {
|
|
253
|
+
return K().login ?? {};
|
|
254
|
+
}
|
|
255
|
+
function J() {
|
|
256
|
+
let e = K().auth;
|
|
257
|
+
return {
|
|
258
|
+
captcha: typeof e.captcha == "function",
|
|
259
|
+
register: typeof e.register == "function" && typeof e.sendSmsCode == "function",
|
|
260
|
+
wechat: typeof e.wechat?.mount == "function",
|
|
261
|
+
forgot: typeof e.resetPassword == "function" && typeof e.sendSmsCode == "function"
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
function He(e) {
|
|
265
|
+
return typeof e == "string" && e.startsWith("/") && !e.startsWith("//") ? e : "/";
|
|
266
|
+
}
|
|
267
|
+
// packages/core/src/pages/auth/AuthShell.vue?vue&type=script&setup=true&lang.ts
|
|
268
|
+
var Ue = {
|
|
269
|
+
key: 0,
|
|
270
|
+
class: "ca-auth__title"
|
|
271
|
+
}, We = ["src"], Ge = { class: "ca-auth__qrcode" }, Ke = ["src", "alt"], qe = {
|
|
272
|
+
key: 0,
|
|
273
|
+
class: "ca-auth__caption"
|
|
274
|
+
}, Je = { class: "ca-auth__site" }, Ye = {
|
|
275
|
+
key: 0,
|
|
276
|
+
class: "ca-auth__caption"
|
|
277
|
+
}, Xe = { class: "ca-auth__main" }, Ze = { class: "ca-auth__brand" }, Qe = ["src"], $e = {
|
|
278
|
+
class: "ca-auth__tabs",
|
|
279
|
+
role: "tablist"
|
|
280
|
+
}, et = [
|
|
281
|
+
"aria-selected",
|
|
282
|
+
"tabindex",
|
|
283
|
+
"onClick",
|
|
284
|
+
"onKeydown"
|
|
285
|
+
], tt = {
|
|
286
|
+
class: "ca-auth__body",
|
|
287
|
+
role: "tabpanel"
|
|
288
|
+
}, nt = {
|
|
9
289
|
key: 0,
|
|
10
|
-
class: "ca-
|
|
11
|
-
|
|
12
|
-
"aria-live": "polite"
|
|
13
|
-
}, Ee = { class: "ca-loading__box" }, De = {
|
|
290
|
+
class: "ca-auth__footer"
|
|
291
|
+
}, rt = {
|
|
14
292
|
key: 0,
|
|
15
|
-
class: "ca-
|
|
16
|
-
},
|
|
17
|
-
|
|
18
|
-
__name: "ca-loading-overlay",
|
|
293
|
+
class: "ca-auth__version"
|
|
294
|
+
}, it = /*@__PURE__*/ d({
|
|
295
|
+
__name: "AuthShell",
|
|
19
296
|
props: {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
},
|
|
24
|
-
text: { default: "" }
|
|
297
|
+
tabs: {},
|
|
298
|
+
active: {},
|
|
299
|
+
preview: { type: Boolean }
|
|
25
300
|
},
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
301
|
+
emits: ["update:active"],
|
|
302
|
+
setup(t, { emit: r }) {
|
|
303
|
+
let c = t, u = r, { t: d, label: f } = W(), p = K().brand, m = q(), _ = ze(), 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(() => {
|
|
304
|
+
let e = m.panel?.caption ?? p.subtitle;
|
|
305
|
+
return e ? f(e) : "";
|
|
306
|
+
}), 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(() => {
|
|
307
|
+
let e = m.card, t = {}, n = A(e?.width), r = A(e?.minHeight), i = A(e?.panelWidth), a = A(e?.radius);
|
|
308
|
+
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;
|
|
309
|
+
}), N = n(() => m.background ?? "var(--ca-login-bg)"), P = n(() => m.footer ? m.footer.map((e) => Be(f(e))) : p.copyright ? Be(f(p.copyright)).split("\n").filter(Boolean) : []);
|
|
310
|
+
function F(e, t) {
|
|
311
|
+
if (e.key !== "ArrowRight" && e.key !== "ArrowLeft") return;
|
|
312
|
+
let n = (t + (e.key === "ArrowRight" ? 1 : -1) + c.tabs.length) % c.tabs.length, r = c.tabs[n];
|
|
313
|
+
r.to || u("update:active", r.key), e.currentTarget.parentElement?.querySelectorAll("[role=tab]")[n]?.focus(), e.preventDefault();
|
|
314
|
+
}
|
|
315
|
+
return (n, r) => (y(), o("div", { class: h(["ca-auth", { "ca-auth--preview": t.preview }]) }, [s("div", {
|
|
316
|
+
class: "ca-auth__stage",
|
|
317
|
+
style: g({ background: N.value })
|
|
318
|
+
}, [s("div", {
|
|
319
|
+
class: "ca-auth__card",
|
|
320
|
+
style: g(j.value)
|
|
321
|
+
}, [s("aside", {
|
|
322
|
+
class: "ca-auth__panel",
|
|
323
|
+
style: g(k.value ? { background: k.value } : void 0)
|
|
324
|
+
}, [
|
|
325
|
+
O.value && w.value ? (y(), o("h2", Ue, E(O.value), 1)) : a("v-if", !0),
|
|
326
|
+
x.value ? (y(), o("img", {
|
|
327
|
+
key: 1,
|
|
328
|
+
src: x.value,
|
|
329
|
+
alt: "",
|
|
330
|
+
class: "ca-auth__logo"
|
|
331
|
+
}, null, 8, We)) : a("v-if", !0),
|
|
332
|
+
w.value ? (y(), o(e, { key: 2 }, [s("div", Ge, [s("img", {
|
|
333
|
+
src: w.value,
|
|
334
|
+
alt: D(d)("campus.auth.qrcodeAlt")
|
|
335
|
+
}, null, 8, Ke)]), T.value ? (y(), o("p", qe, E(T.value), 1)) : a("v-if", !0)], 64)) : (y(), o(e, { key: 3 }, [s("h2", Je, E(O.value || v.value), 1), T.value ? (y(), o("p", Ye, E(T.value), 1)) : a("v-if", !0)], 64))
|
|
336
|
+
], 4), s("section", Xe, [
|
|
337
|
+
s("div", Ze, [b.value ? (y(), o("img", {
|
|
338
|
+
key: 0,
|
|
339
|
+
src: b.value,
|
|
340
|
+
alt: ""
|
|
341
|
+
}, null, 8, Qe)) : a("v-if", !0), s("span", null, E(v.value), 1)]),
|
|
342
|
+
s("div", $e, [(y(!0), o(e, null, S(t.tabs, (n, r) => (y(), o(e, { key: n.key }, [n.to && !t.preview ? (y(), i(D(B), {
|
|
343
|
+
key: 0,
|
|
344
|
+
to: n.to,
|
|
345
|
+
role: "tab",
|
|
346
|
+
"aria-selected": "false",
|
|
347
|
+
class: "ca-auth__tab",
|
|
348
|
+
onKeydown: (e) => F(e, r)
|
|
349
|
+
}, {
|
|
350
|
+
default: M(() => [l(E(n.label), 1)]),
|
|
351
|
+
_: 2
|
|
352
|
+
}, 1032, ["to", "onKeydown"])) : (y(), o("button", {
|
|
353
|
+
key: 1,
|
|
354
|
+
type: "button",
|
|
355
|
+
role: "tab",
|
|
356
|
+
class: h(["ca-auth__tab", { "ca-auth__tab--active": n.key === t.active }]),
|
|
357
|
+
"aria-selected": n.key === t.active,
|
|
358
|
+
tabindex: n.key === t.active ? 0 : -1,
|
|
359
|
+
onClick: (e) => n.to ? void 0 : u("update:active", n.key),
|
|
360
|
+
onKeydown: (e) => F(e, r)
|
|
361
|
+
}, E(n.label), 43, et))], 64))), 128))]),
|
|
362
|
+
s("div", tt, [C(n.$slots, "default", {}, void 0, !0)]),
|
|
363
|
+
P.value.length ? (y(), o("div", nt, [(y(!0), o(e, null, S(P.value, (e) => (y(), o("p", { key: e }, E(e), 1))), 128))])) : a("v-if", !0)
|
|
364
|
+
])], 4), D(m).version ? (y(), o("span", rt, E(D(m).version), 1)) : a("v-if", !0)], 4)], 2));
|
|
34
365
|
}
|
|
35
|
-
}),
|
|
366
|
+
}), Y = (e, t) => {
|
|
36
367
|
let n = e.__vccOpts || e;
|
|
37
368
|
for (let [e, r] of t) n[e] = r;
|
|
38
369
|
return n;
|
|
39
|
-
},
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
|
|
370
|
+
}, at = /*#__PURE__*/ Y(it, [["__scopeId", "data-v-df817220"]]), X = I("campus-layout", () => {
|
|
371
|
+
let e = x(!1), t = x("desktop"), n = x(!1), r = x(!1);
|
|
372
|
+
function i() {
|
|
373
|
+
e.value = !e.value;
|
|
374
|
+
}
|
|
375
|
+
function a(e) {
|
|
376
|
+
t.value = e, e !== "phone" && (n.value = !1), e !== "pad" && (r.value = !1);
|
|
377
|
+
}
|
|
378
|
+
function o() {
|
|
379
|
+
n.value = !1;
|
|
380
|
+
}
|
|
381
|
+
function s() {
|
|
382
|
+
n.value = !0;
|
|
383
|
+
}
|
|
384
|
+
function c() {
|
|
385
|
+
r.value = !1;
|
|
386
|
+
}
|
|
387
|
+
function l() {
|
|
388
|
+
r.value = !0;
|
|
389
|
+
}
|
|
390
|
+
function u() {
|
|
391
|
+
n.value = !1, r.value = !1;
|
|
392
|
+
}
|
|
393
|
+
function d() {
|
|
394
|
+
e.value = !1, u();
|
|
395
|
+
}
|
|
396
|
+
return {
|
|
397
|
+
reset: d,
|
|
398
|
+
contentFullscreen: e,
|
|
399
|
+
mode: t,
|
|
400
|
+
mobileMenuOpen: n,
|
|
401
|
+
padPanelOpen: r,
|
|
402
|
+
toggleContentFullscreen: i,
|
|
403
|
+
setMode: a,
|
|
404
|
+
closeMobileMenu: o,
|
|
405
|
+
openMobileMenu: s,
|
|
406
|
+
closePadPanel: c,
|
|
407
|
+
openPadPanel: l,
|
|
408
|
+
closeOverlays: u
|
|
409
|
+
};
|
|
410
|
+
});
|
|
411
|
+
// packages/core/src/tabs-policy.ts
|
|
412
|
+
function ot(e, t, n = Date.now()) {
|
|
413
|
+
return {
|
|
414
|
+
...e,
|
|
415
|
+
[t]: Math.max(n, ...Object.values(e).map((e) => e + 1))
|
|
416
|
+
};
|
|
417
|
+
}
|
|
418
|
+
function st(e, t, n, r, i) {
|
|
419
|
+
let a = e.filter((e) => !r.includes(e));
|
|
420
|
+
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);
|
|
421
|
+
}
|
|
422
|
+
// packages/core/src/stores/tabs.ts
|
|
423
|
+
var ct = "tabs", Z = I("campus-tabs", () => {
|
|
424
|
+
let e = je(K().menus), t = new Set(e.map((e) => e.key)), r = e.filter((e) => e.affix).map((e) => e.key), i = _e(ct, "session"), a = !Array.isArray(i) && Array.isArray(i?.affix) ? i.affix : [], o = x(a.filter((e) => t.has(e) && !r.includes(e))), s = n(() => [...r, ...o.value]), c = K().maxTabs, l = typeof c == "number" && Number.isFinite(c) ? Math.max(1, Math.floor(c)) : 20, u = (Array.isArray(i) ? i : Array.isArray(i?.visited) ? i.visited : []).filter((e) => typeof e == "string" && t.has(e)), d = x([.../* @__PURE__ */ new Set([...s.value, ...u])]), f = !Array.isArray(i) && i?.active && typeof i.active == "object" ? i.active : {}, p = x(Object.fromEntries(Object.entries(f).filter(([e, n]) => t.has(e) && typeof n == "number" && Number.isFinite(n))));
|
|
425
|
+
for (let [e, t] of d.value.entries()) Number.isFinite(p.value[t]) || (p.value[t] = e + 1);
|
|
426
|
+
for (;;) {
|
|
427
|
+
let e = st(d.value, p.value, "", s.value, l);
|
|
428
|
+
if (!e) break;
|
|
429
|
+
d.value.splice(d.value.indexOf(e), 1), delete p.value[e];
|
|
430
|
+
}
|
|
431
|
+
let h = x({}), g = x(null), _ = n(() => d.value.filter((e) => e !== g.value));
|
|
432
|
+
function v() {
|
|
433
|
+
p.value = Object.fromEntries(d.value.map((e) => [e, p.value[e] ?? 0])), ve(ct, {
|
|
434
|
+
visited: d.value,
|
|
435
|
+
active: p.value,
|
|
436
|
+
affix: o.value
|
|
437
|
+
}, "session");
|
|
438
|
+
}
|
|
439
|
+
function y(e) {
|
|
440
|
+
if (!t.has(e)) return;
|
|
441
|
+
d.value.includes(e) || d.value.push(e), p.value = ot(p.value, e);
|
|
442
|
+
let n = st(d.value, p.value, e, s.value, l);
|
|
443
|
+
n && d.value.splice(d.value.indexOf(n), 1), v();
|
|
444
|
+
}
|
|
445
|
+
function b(e) {
|
|
446
|
+
if (s.value.includes(e)) return;
|
|
447
|
+
let t = d.value.indexOf(e);
|
|
448
|
+
if (t !== -1) return d.value.splice(t, 1), v(), d.value[t] ?? d.value[t - 1];
|
|
449
|
+
}
|
|
450
|
+
function S(e) {
|
|
451
|
+
d.value = d.value.filter((t) => t === e || s.value.includes(t)), v();
|
|
452
|
+
}
|
|
453
|
+
function C(e) {
|
|
454
|
+
let t = d.value.indexOf(e);
|
|
455
|
+
t !== -1 && (d.value = d.value.filter((e, n) => n >= t || s.value.includes(e)), v());
|
|
456
|
+
}
|
|
457
|
+
function w(e) {
|
|
458
|
+
let t = d.value.indexOf(e);
|
|
459
|
+
t !== -1 && (d.value = d.value.filter((e, n) => n <= t || s.value.includes(e)), v());
|
|
460
|
+
}
|
|
461
|
+
function T() {
|
|
462
|
+
d.value = [...s.value], v();
|
|
463
|
+
}
|
|
464
|
+
async function E(e) {
|
|
465
|
+
g.value = e, await m(), h.value[e] = (h.value[e] ?? 0) + 1, g.value = null;
|
|
466
|
+
}
|
|
467
|
+
function D(e, n) {
|
|
468
|
+
return !t.has(e) || r.includes(e) || n && !d.value.includes(e) ? !1 : (n && !o.value.includes(e) && o.value.push(e), n || (o.value = o.value.filter((t) => t !== e)), v(), !0);
|
|
469
|
+
}
|
|
470
|
+
function O() {
|
|
471
|
+
o.value = [], d.value = [...r], p.value = {}, h.value = {}, g.value = null, v();
|
|
472
|
+
}
|
|
473
|
+
return {
|
|
474
|
+
reset: O,
|
|
475
|
+
visited: d,
|
|
476
|
+
versions: h,
|
|
477
|
+
cached: _,
|
|
478
|
+
affixKeys: s,
|
|
479
|
+
activeAt: p,
|
|
480
|
+
maxTabs: l,
|
|
481
|
+
open: y,
|
|
482
|
+
close: b,
|
|
483
|
+
closeLeft: C,
|
|
484
|
+
closeRight: w,
|
|
485
|
+
closeOthers: S,
|
|
486
|
+
closeAll: T,
|
|
487
|
+
refresh: E,
|
|
488
|
+
setAffix: D
|
|
489
|
+
};
|
|
490
|
+
}), lt = "session", Q = I("campus-session", () => {
|
|
491
|
+
let e = _e(lt, "session"), t = x(e?.token ?? ""), r = x(e?.user), i = n(() => !!(t.value && r.value));
|
|
492
|
+
function a(e) {
|
|
493
|
+
if (!e) return !0;
|
|
494
|
+
let t = r.value?.permissions;
|
|
495
|
+
return t === "*" || !!t?.includes(e);
|
|
496
|
+
}
|
|
497
|
+
function o(e) {
|
|
498
|
+
r.value && (r.value = {
|
|
499
|
+
...r.value,
|
|
500
|
+
permissions: e
|
|
501
|
+
}, ve(lt, {
|
|
502
|
+
token: t.value,
|
|
503
|
+
user: r.value
|
|
504
|
+
}, "session"));
|
|
505
|
+
}
|
|
506
|
+
async function s(e) {
|
|
507
|
+
c(await K().auth.login(e));
|
|
508
|
+
}
|
|
509
|
+
function c(e) {
|
|
510
|
+
t.value = e.token, r.value = e.user, ve(lt, e, "session");
|
|
511
|
+
}
|
|
512
|
+
async function l() {
|
|
513
|
+
try {
|
|
514
|
+
await K().auth.logout?.();
|
|
515
|
+
} catch (e) {
|
|
516
|
+
console.warn("[campus] 退出时通知服务端失败,已清除本地登录态:", e);
|
|
517
|
+
} finally {
|
|
518
|
+
t.value = "", r.value = void 0, U(lt, null, "session"), Z().reset(), X().reset();
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
function u() {
|
|
522
|
+
t.value = "", r.value = void 0, U(lt, null, "session"), Z().reset(), X().reset();
|
|
523
|
+
}
|
|
524
|
+
return {
|
|
525
|
+
token: t,
|
|
526
|
+
user: r,
|
|
527
|
+
isLoggedIn: i,
|
|
528
|
+
can: a,
|
|
529
|
+
setPermissions: o,
|
|
530
|
+
login: s,
|
|
531
|
+
signIn: c,
|
|
532
|
+
logout: l,
|
|
533
|
+
expire: u
|
|
534
|
+
};
|
|
535
|
+
}), ut = {
|
|
536
|
+
class: "ca-auth-icon",
|
|
537
|
+
viewBox: "0 0 24 24",
|
|
538
|
+
width: "16",
|
|
539
|
+
height: "16",
|
|
540
|
+
fill: "none",
|
|
541
|
+
stroke: "currentColor",
|
|
542
|
+
"stroke-width": "1.8",
|
|
543
|
+
"stroke-linecap": "round",
|
|
544
|
+
"stroke-linejoin": "round",
|
|
45
545
|
"aria-hidden": "true"
|
|
46
|
-
},
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
546
|
+
}, dt = ["d"], $ = /* @__PURE__ */ d({
|
|
547
|
+
__name: "AuthIcon",
|
|
548
|
+
props: { name: {} },
|
|
549
|
+
setup(e) {
|
|
550
|
+
let t = {
|
|
551
|
+
user: "M12 12a4 4 0 1 0 0-8 4 4 0 0 0 0 8Zm-7 8c0-3.3 3.1-6 7-6s7 2.7 7 6",
|
|
552
|
+
lock: "M6 11h12v9H6zM8.5 11V8a3.5 3.5 0 0 1 7 0v3",
|
|
553
|
+
phone: "M8 3h8a1 1 0 0 1 1 1v16a1 1 0 0 1-1 1H8a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1Zm3 15h2",
|
|
554
|
+
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",
|
|
555
|
+
message: "M4 5h16v11H9l-4 3.500V16H4z"
|
|
556
|
+
};
|
|
557
|
+
return (n, r) => (y(), o("svg", ut, [s("path", { d: t[e.name] }, null, 8, dt)]));
|
|
558
|
+
}
|
|
559
|
+
}), ft = { class: "ca-auth-row" }, pt = [
|
|
560
|
+
"title",
|
|
561
|
+
"aria-label",
|
|
562
|
+
"disabled"
|
|
563
|
+
], mt = ["src"], ht = { key: 1 }, gt = /* @__PURE__ */ d({
|
|
564
|
+
__name: "CaptchaField",
|
|
565
|
+
props: /*@__PURE__*/ p({ scene: {} }, {
|
|
566
|
+
code: { default: "" },
|
|
567
|
+
codeModifiers: {},
|
|
568
|
+
captchaKey: { default: "" },
|
|
569
|
+
captchaKeyModifiers: {}
|
|
570
|
+
}),
|
|
571
|
+
emits: ["update:code", "update:captchaKey"],
|
|
572
|
+
setup(e, { expose: t }) {
|
|
573
|
+
let n = e, r = O(e, "code"), i = O(e, "captchaKey"), { t: c, label: l } = W(), d = q().fields?.captcha, f = x(""), p = x(!1), m = x(!1);
|
|
574
|
+
async function h() {
|
|
575
|
+
m.value = !0;
|
|
576
|
+
try {
|
|
577
|
+
let e = await K().auth.captcha(n.scene);
|
|
578
|
+
i.value = e.key, f.value = e.image, p.value = !1;
|
|
579
|
+
} catch {
|
|
580
|
+
f.value = "", p.value = !0;
|
|
581
|
+
} finally {
|
|
582
|
+
r.value = "", m.value = !1;
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
return v(h), t({ refresh: h }), (e, t) => {
|
|
586
|
+
let n = w("ca-input");
|
|
587
|
+
return y(), o("div", ft, [u(n, {
|
|
588
|
+
modelValue: r.value,
|
|
589
|
+
"onUpdate:modelValue": t[0] ||= (e) => r.value = e,
|
|
590
|
+
placeholder: D(d)?.placeholder ? D(l)(D(d).placeholder) : D(c)("campus.auth.captchaPlaceholder"),
|
|
591
|
+
"aria-label": D(c)("campus.auth.captcha"),
|
|
592
|
+
autocomplete: "off",
|
|
593
|
+
maxlength: D(d)?.maxlength ?? 8
|
|
594
|
+
}, {
|
|
595
|
+
prefix: M(() => [u($, { name: "shield" })]),
|
|
596
|
+
_: 1
|
|
597
|
+
}, 8, [
|
|
598
|
+
"modelValue",
|
|
599
|
+
"placeholder",
|
|
600
|
+
"aria-label",
|
|
601
|
+
"maxlength"
|
|
602
|
+
]), s("button", {
|
|
603
|
+
type: "button",
|
|
604
|
+
class: "ca-auth-captcha",
|
|
605
|
+
title: D(c)("campus.auth.captchaRefresh"),
|
|
606
|
+
"aria-label": D(c)("campus.auth.captchaRefresh"),
|
|
607
|
+
disabled: m.value,
|
|
608
|
+
onClick: h
|
|
609
|
+
}, [f.value ? (y(), o("img", {
|
|
57
610
|
key: 0,
|
|
58
|
-
|
|
59
|
-
"
|
|
60
|
-
})) :
|
|
61
|
-
key: 1,
|
|
62
|
-
size: 15,
|
|
63
|
-
"stroke-width": 3
|
|
64
|
-
})) : e.tone === "warning" ? (g(), o(x(pe), {
|
|
65
|
-
key: 2,
|
|
66
|
-
size: 15,
|
|
67
|
-
"stroke-width": 3
|
|
68
|
-
})) : (g(), o(x(he), {
|
|
69
|
-
key: 3,
|
|
70
|
-
size: 15,
|
|
71
|
-
"stroke-width": 3
|
|
72
|
-
}))]), l("span", je, [u(b(e.text) + " ", 1), e.description ? (g(), c("small", Me, b(e.description), 1)) : s("", !0)])], 2))), 128))]),
|
|
73
|
-
_: 1
|
|
74
|
-
})]));
|
|
75
|
-
}
|
|
76
|
-
}), [["__scopeId", "data-v-a58555ed"]]), D = class {
|
|
77
|
-
state;
|
|
78
|
-
listeners = /* @__PURE__ */ new Set();
|
|
79
|
-
constructor(e) {
|
|
80
|
-
this.state = e;
|
|
81
|
-
}
|
|
82
|
-
get() {
|
|
83
|
-
return this.state;
|
|
84
|
-
}
|
|
85
|
-
set(e) {
|
|
86
|
-
let t = typeof e == "function" ? e(this.state) : e;
|
|
87
|
-
this.state = {
|
|
88
|
-
...this.state,
|
|
89
|
-
...t
|
|
90
|
-
}, this.listeners.forEach((e) => e(this.state));
|
|
91
|
-
}
|
|
92
|
-
subscribe(e) {
|
|
93
|
-
return this.listeners.add(e), () => {
|
|
94
|
-
this.listeners.delete(e);
|
|
611
|
+
src: f.value,
|
|
612
|
+
alt: ""
|
|
613
|
+
}, null, 8, mt)) : p.value ? (y(), o("span", ht, E(D(c)("campus.auth.captchaFailed")), 1)) : a("v-if", !0)], 8, pt)]);
|
|
95
614
|
};
|
|
96
615
|
}
|
|
97
|
-
},
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
616
|
+
}), _t = {
|
|
617
|
+
key: 1,
|
|
618
|
+
class: "ca-auth-links"
|
|
619
|
+
}, vt = { class: "ca-auth-help" }, yt = /* @__PURE__ */ d({
|
|
620
|
+
__name: "LoginForm",
|
|
621
|
+
props: { preview: { type: Boolean } },
|
|
622
|
+
setup(t) {
|
|
623
|
+
let r = t, c = V(), d = H(), f = Q(), { t: p, label: m } = W(), h = J(), g = q(), _ = g.fields ?? {}, v = b({
|
|
624
|
+
username: "",
|
|
625
|
+
password: "",
|
|
626
|
+
captcha: ""
|
|
627
|
+
}), C = x(""), T = x(), O = x(), k = x(!1), A = x(""), j = x("error"), N = n(() => ({
|
|
628
|
+
username: [{
|
|
629
|
+
required: !0,
|
|
630
|
+
message: p("campus.login.required", { label: p("campus.login.username") }),
|
|
631
|
+
trigger: "blur"
|
|
632
|
+
}],
|
|
633
|
+
password: [{
|
|
634
|
+
required: !0,
|
|
635
|
+
message: p("campus.login.required", { label: p("campus.login.password") }),
|
|
636
|
+
trigger: "blur"
|
|
637
|
+
}],
|
|
638
|
+
captcha: h.captcha ? [{
|
|
639
|
+
required: !0,
|
|
640
|
+
message: p("campus.auth.captchaRequired"),
|
|
641
|
+
trigger: "blur"
|
|
642
|
+
}] : []
|
|
643
|
+
})), F = n(() => (g.helps ?? [
|
|
644
|
+
1,
|
|
645
|
+
2,
|
|
646
|
+
3,
|
|
647
|
+
4
|
|
648
|
+
].map((e) => `campus.auth.help${e}`)).map((e) => m(e).split("{forgot}").flatMap((e, t, n) => t < n.length - 1 ? [e, null] : [e])));
|
|
649
|
+
function I(e) {
|
|
650
|
+
_.username?.digitsOnly && /\D/.test(e) && (v.username = e.replace(/\D/g, ""));
|
|
651
|
+
}
|
|
652
|
+
async function L() {
|
|
653
|
+
try {
|
|
654
|
+
await O.value?.validate();
|
|
655
|
+
} catch {
|
|
656
|
+
return;
|
|
657
|
+
}
|
|
658
|
+
if (r.preview) j.value = "info", A.value = p("campus.auth.previewNote");
|
|
659
|
+
else {
|
|
660
|
+
k.value = !0, A.value = "", j.value = "error";
|
|
661
|
+
try {
|
|
662
|
+
await f.login({
|
|
663
|
+
username: v.username,
|
|
664
|
+
password: v.password,
|
|
665
|
+
captcha: h.captcha ? {
|
|
666
|
+
key: C.value,
|
|
667
|
+
code: v.captcha
|
|
668
|
+
} : void 0
|
|
669
|
+
}), await d.replace(He(c.query.redirect));
|
|
670
|
+
} catch (e) {
|
|
671
|
+
A.value = e instanceof Error && e.message ? e.message : p("campus.login.failed"), T.value?.refresh();
|
|
672
|
+
} finally {
|
|
673
|
+
k.value = !1;
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
function R(e) {
|
|
678
|
+
r.preview && e.preventDefault();
|
|
679
|
+
}
|
|
680
|
+
let ee = n(() => h.forgot || h.register);
|
|
681
|
+
return (t, n) => {
|
|
682
|
+
let r = w("ca-alert"), c = w("ca-input"), d = w("ca-form-item"), f = w("ca-button"), g = w("ca-form");
|
|
683
|
+
return y(), o(e, null, [
|
|
684
|
+
A.value ? (y(), i(r, {
|
|
685
|
+
key: 0,
|
|
686
|
+
title: A.value,
|
|
687
|
+
type: j.value,
|
|
688
|
+
"show-icon": "",
|
|
689
|
+
closable: !1,
|
|
690
|
+
class: "ca-auth-alert"
|
|
691
|
+
}, null, 8, ["title", "type"])) : a("v-if", !0),
|
|
692
|
+
u(g, {
|
|
693
|
+
ref_key: "formRef",
|
|
694
|
+
ref: O,
|
|
695
|
+
model: v,
|
|
696
|
+
rules: N.value,
|
|
697
|
+
size: "large",
|
|
698
|
+
class: "ca-auth-form",
|
|
699
|
+
onSubmit: P(L, ["prevent"])
|
|
700
|
+
}, {
|
|
701
|
+
default: M(() => [
|
|
702
|
+
u(d, { prop: "username" }, {
|
|
703
|
+
default: M(() => [u(c, {
|
|
704
|
+
modelValue: v.username,
|
|
705
|
+
"onUpdate:modelValue": n[0] ||= (e) => v.username = e,
|
|
706
|
+
placeholder: D(_).username?.placeholder ? D(m)(D(_).username.placeholder) : D(p)("campus.auth.accountPlaceholder"),
|
|
707
|
+
maxlength: D(_).username?.maxlength,
|
|
708
|
+
inputmode: D(_).username?.digitsOnly ? "numeric" : void 0,
|
|
709
|
+
onInput: I,
|
|
710
|
+
"aria-label": D(p)("campus.login.username"),
|
|
711
|
+
autocomplete: "username"
|
|
712
|
+
}, {
|
|
713
|
+
prefix: M(() => [u($, { name: "user" })]),
|
|
714
|
+
_: 1
|
|
715
|
+
}, 8, [
|
|
716
|
+
"modelValue",
|
|
717
|
+
"placeholder",
|
|
718
|
+
"maxlength",
|
|
719
|
+
"inputmode",
|
|
720
|
+
"aria-label"
|
|
721
|
+
])]),
|
|
722
|
+
_: 1
|
|
723
|
+
}),
|
|
724
|
+
u(d, { prop: "password" }, {
|
|
725
|
+
default: M(() => [u(c, {
|
|
726
|
+
modelValue: v.password,
|
|
727
|
+
"onUpdate:modelValue": n[1] ||= (e) => v.password = e,
|
|
728
|
+
type: "password",
|
|
729
|
+
"show-password": "",
|
|
730
|
+
maxlength: D(_).password?.maxlength,
|
|
731
|
+
placeholder: D(p)("campus.auth.passwordPlaceholder"),
|
|
732
|
+
"aria-label": D(p)("campus.login.password"),
|
|
733
|
+
autocomplete: "current-password"
|
|
734
|
+
}, {
|
|
735
|
+
prefix: M(() => [u($, { name: "lock" })]),
|
|
736
|
+
_: 1
|
|
737
|
+
}, 8, [
|
|
738
|
+
"modelValue",
|
|
739
|
+
"maxlength",
|
|
740
|
+
"placeholder",
|
|
741
|
+
"aria-label"
|
|
742
|
+
])]),
|
|
743
|
+
_: 1
|
|
744
|
+
}),
|
|
745
|
+
D(h).captcha ? (y(), i(d, {
|
|
746
|
+
key: 0,
|
|
747
|
+
prop: "captcha"
|
|
748
|
+
}, {
|
|
749
|
+
default: M(() => [u(gt, {
|
|
750
|
+
ref_key: "captchaRef",
|
|
751
|
+
ref: T,
|
|
752
|
+
code: v.captcha,
|
|
753
|
+
"onUpdate:code": n[2] ||= (e) => v.captcha = e,
|
|
754
|
+
"captcha-key": C.value,
|
|
755
|
+
"onUpdate:captchaKey": n[3] ||= (e) => C.value = e,
|
|
756
|
+
scene: "login"
|
|
757
|
+
}, null, 8, ["code", "captcha-key"])]),
|
|
758
|
+
_: 1
|
|
759
|
+
})) : a("v-if", !0),
|
|
760
|
+
u(f, {
|
|
761
|
+
type: "primary",
|
|
762
|
+
"native-type": "submit",
|
|
763
|
+
size: "large",
|
|
764
|
+
loading: k.value,
|
|
765
|
+
class: "ca-auth-submit"
|
|
766
|
+
}, {
|
|
767
|
+
default: M(() => [l(E(D(p)("campus.login.submit")), 1)]),
|
|
768
|
+
_: 1
|
|
769
|
+
}, 8, ["loading"])
|
|
770
|
+
]),
|
|
771
|
+
_: 1
|
|
772
|
+
}, 8, ["model", "rules"]),
|
|
773
|
+
ee.value ? (y(), o("div", _t, [D(h).forgot ? (y(), i(D(B), {
|
|
774
|
+
key: 0,
|
|
775
|
+
to: "/forgot",
|
|
776
|
+
onClick: R
|
|
777
|
+
}, {
|
|
778
|
+
default: M(() => [l(E(D(p)("campus.auth.forgotLink")), 1)]),
|
|
779
|
+
_: 1
|
|
780
|
+
})) : a("v-if", !0), D(h).register ? (y(), i(D(B), {
|
|
781
|
+
key: 1,
|
|
782
|
+
to: "/register",
|
|
783
|
+
onClick: R
|
|
784
|
+
}, {
|
|
785
|
+
default: M(() => [l(E(D(p)("campus.auth.registerLink")), 1)]),
|
|
786
|
+
_: 1
|
|
787
|
+
})) : a("v-if", !0)])) : a("v-if", !0),
|
|
788
|
+
s("div", vt, [s("h3", null, E(D(p)("campus.auth.helpTitle")), 1), s("ol", null, [(y(!0), o(e, null, S(F.value, (t, n) => (y(), o("li", { key: n }, [(y(!0), o(e, null, S(t, (t, n) => (y(), o(e, { key: n }, [t === null ? D(h).forgot ? (y(), i(D(B), {
|
|
789
|
+
key: 1,
|
|
790
|
+
to: "/forgot",
|
|
791
|
+
onClick: R
|
|
792
|
+
}, {
|
|
793
|
+
default: M(() => [l(E(D(p)("campus.auth.findPassword")), 1)]),
|
|
794
|
+
_: 1
|
|
795
|
+
})) : (y(), o(e, { key: 2 }, [l(E(D(p)("campus.auth.findPassword")), 1)], 64)) : (y(), o(e, { key: 0 }, [l(E(t), 1)], 64))], 64))), 128))]))), 128))])])
|
|
796
|
+
], 64);
|
|
797
|
+
};
|
|
798
|
+
}
|
|
799
|
+
});
|
|
800
|
+
// packages/core/src/pages/auth/wechat-host.ts
|
|
801
|
+
function bt(e, t) {
|
|
802
|
+
let n, r = !1, i = () => {
|
|
803
|
+
if (!r) {
|
|
804
|
+
r = !0;
|
|
805
|
+
try {
|
|
806
|
+
n?.();
|
|
807
|
+
} catch (e) {
|
|
808
|
+
console.warn("[campus] 微信登录容器清理失败:", e);
|
|
809
|
+
}
|
|
810
|
+
n = void 0, t.replaceChildren();
|
|
811
|
+
}
|
|
812
|
+
};
|
|
813
|
+
try {
|
|
814
|
+
let r = e(t);
|
|
815
|
+
n = typeof r == "function" ? r : void 0;
|
|
816
|
+
} catch (e) {
|
|
817
|
+
return console.warn("[campus] 微信登录容器加载失败:", e), i(), {
|
|
818
|
+
ok: !1,
|
|
819
|
+
release: i
|
|
820
|
+
};
|
|
821
|
+
}
|
|
822
|
+
return {
|
|
823
|
+
ok: !0,
|
|
824
|
+
release: i
|
|
120
825
|
};
|
|
121
826
|
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
827
|
+
// packages/core/src/pages/auth/WechatPane.vue?vue&type=script&setup=true&lang.ts
|
|
828
|
+
var xt = {
|
|
829
|
+
key: 0,
|
|
830
|
+
class: "ca-auth-wechat"
|
|
831
|
+
}, St = {
|
|
832
|
+
key: 0,
|
|
833
|
+
class: "ca-auth-wechat__failed",
|
|
834
|
+
role: "alert"
|
|
835
|
+
}, Ct = {
|
|
836
|
+
key: 1,
|
|
837
|
+
class: "ca-auth-wechat"
|
|
838
|
+
}, wt = { class: "ca-auth-wechat__code" }, Tt = ["src", "alt"], Et = ["aria-label"], Dt = { class: "ca-auth-wechat__hint" }, Ot = {
|
|
839
|
+
key: 0,
|
|
840
|
+
class: "ca-auth-wechat__note"
|
|
841
|
+
}, kt = /* @__PURE__ */ d({
|
|
842
|
+
__name: "WechatPane",
|
|
843
|
+
props: { preview: { type: Boolean } },
|
|
844
|
+
setup(e) {
|
|
845
|
+
let t = e, { t: r } = W(), i = n(() => q().panel?.qrcode), d = !t.preview && J().wechat, f = x(), p = x(!1), h;
|
|
846
|
+
function g() {
|
|
847
|
+
h?.release(), h = void 0;
|
|
848
|
+
}
|
|
849
|
+
async function b() {
|
|
850
|
+
g(), p.value = !1, await m(), f.value && (h = bt(K().auth.wechat.mount, f.value), p.value = !h.ok);
|
|
851
|
+
}
|
|
852
|
+
return v(() => {
|
|
853
|
+
d && b();
|
|
854
|
+
}), _(g), (e, t) => {
|
|
855
|
+
let n = w("ca-button");
|
|
856
|
+
return D(d) ? (y(), o("div", xt, [N(s("div", {
|
|
857
|
+
ref_key: "host",
|
|
858
|
+
ref: f,
|
|
859
|
+
class: "ca-auth-wechat__host"
|
|
860
|
+
}, null, 512), [[k, !p.value]]), p.value ? (y(), o("div", St, [s("p", null, E(D(r)("campus.auth.wechatMountFailed")), 1), u(n, { onClick: b }, {
|
|
861
|
+
default: M(() => [l(E(D(r)("campus.auth.wechatRetry")), 1)]),
|
|
862
|
+
_: 1
|
|
863
|
+
})])) : a("v-if", !0)])) : (y(), o("div", Ct, [
|
|
864
|
+
s("div", wt, [i.value ? (y(), o("img", {
|
|
865
|
+
key: 0,
|
|
866
|
+
src: i.value,
|
|
867
|
+
alt: D(r)("campus.auth.qrcodeAlt")
|
|
868
|
+
}, null, 8, Tt)) : (y(), o("svg", {
|
|
869
|
+
key: 1,
|
|
870
|
+
viewBox: "0 0 100 100",
|
|
871
|
+
role: "img",
|
|
872
|
+
"aria-label": D(r)("campus.auth.qrcodeAlt")
|
|
873
|
+
}, [...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, Et))]),
|
|
874
|
+
s("p", Dt, E(D(r)("campus.auth.wechatHint")), 1),
|
|
875
|
+
i.value ? a("v-if", !0) : (y(), o("p", Ot, E(D(r)("campus.auth.wechatNote")), 1))
|
|
876
|
+
]));
|
|
877
|
+
};
|
|
878
|
+
}
|
|
879
|
+
}), At = /* @__PURE__ */ d({
|
|
880
|
+
__name: "LoginSplit",
|
|
881
|
+
props: { preview: { type: Boolean } },
|
|
882
|
+
setup(e) {
|
|
883
|
+
let { t } = W(), r = q().tabs?.length ? q().tabs : ["account", "wechat"], a = x(r[0]), o = n(() => r.map((e) => ({
|
|
884
|
+
key: e,
|
|
885
|
+
label: t(e === "account" ? "campus.auth.tabAccount" : "campus.auth.tabWechat")
|
|
886
|
+
})));
|
|
887
|
+
return (t, n) => (y(), i(at, {
|
|
888
|
+
active: a.value,
|
|
889
|
+
"onUpdate:active": n[0] ||= (e) => a.value = e,
|
|
890
|
+
tabs: o.value,
|
|
891
|
+
preview: e.preview
|
|
892
|
+
}, {
|
|
893
|
+
default: M(() => [a.value === "account" ? (y(), i(yt, {
|
|
894
|
+
key: 0,
|
|
895
|
+
preview: e.preview
|
|
896
|
+
}, null, 8, ["preview"])) : (y(), i(kt, { key: 1 }))]),
|
|
897
|
+
_: 1
|
|
898
|
+
}, 8, [
|
|
899
|
+
"active",
|
|
900
|
+
"tabs",
|
|
901
|
+
"preview"
|
|
902
|
+
]));
|
|
903
|
+
}
|
|
904
|
+
});
|
|
905
|
+
// packages/core/src/security.ts
|
|
906
|
+
function jt(e) {
|
|
907
|
+
return e.environment ? e.environment : "production";
|
|
908
|
+
}
|
|
909
|
+
function Mt(e) {
|
|
910
|
+
if (jt(e) === "production" && typeof e.auth.captcha != "function") throw Error("[campus] 生产环境必须在 auth 中提供 captcha()(图形验证码);测试环境可设置 environment: 'test' 跳过");
|
|
911
|
+
}
|
|
912
|
+
function Nt(e, t) {
|
|
913
|
+
return t === "test" || e.length >= 8 && /[A-Za-z]/.test(e) && /\d/.test(e);
|
|
914
|
+
}
|
|
915
|
+
// packages/core/src/services/feedback.ts
|
|
916
|
+
var Pt = (e) => e;
|
|
917
|
+
function Ft(e) {
|
|
918
|
+
Pt = e;
|
|
919
|
+
}
|
|
920
|
+
async function It(e, t = {}) {
|
|
921
|
+
await pe.alert(e, t.title ?? Pt("campus.common.tip"), {
|
|
922
|
+
type: t.type ?? "info",
|
|
923
|
+
confirmButtonText: t.confirmText ?? Pt("campus.common.ok")
|
|
130
924
|
});
|
|
131
925
|
}
|
|
132
|
-
function
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
926
|
+
async function Lt(e, t = {}) {
|
|
927
|
+
try {
|
|
928
|
+
return await pe.confirm(e, t.title ?? Pt("campus.common.tip"), {
|
|
929
|
+
type: t.type ?? "warning",
|
|
930
|
+
confirmButtonText: t.confirmText ?? Pt("campus.common.confirm"),
|
|
931
|
+
cancelButtonText: t.cancelText ?? Pt("campus.common.cancel")
|
|
932
|
+
}), !0;
|
|
933
|
+
} catch (e) {
|
|
934
|
+
if (e === "cancel" || e === "close") return !1;
|
|
935
|
+
throw e;
|
|
936
|
+
}
|
|
937
|
+
}
|
|
938
|
+
var Rt = {
|
|
939
|
+
info: (e) => void fe({
|
|
940
|
+
message: e,
|
|
941
|
+
type: "info"
|
|
942
|
+
}),
|
|
943
|
+
success: (e) => void fe({
|
|
944
|
+
message: e,
|
|
945
|
+
type: "success"
|
|
946
|
+
}),
|
|
947
|
+
warning: (e) => void fe({
|
|
948
|
+
message: e,
|
|
949
|
+
type: "warning"
|
|
950
|
+
}),
|
|
951
|
+
error: (e) => void fe({
|
|
952
|
+
message: e,
|
|
953
|
+
type: "error"
|
|
954
|
+
})
|
|
955
|
+
}, zt = de.service;
|
|
956
|
+
function Bt(e, t, n = {}) {
|
|
957
|
+
let r = me({
|
|
958
|
+
...n,
|
|
959
|
+
title: n.title ?? Pt(`campus.notify.${e}`),
|
|
960
|
+
message: t,
|
|
961
|
+
type: e
|
|
144
962
|
});
|
|
963
|
+
return m(() => me.updateOffsets(n.position)), r;
|
|
145
964
|
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
965
|
+
// packages/core/src/services/ca.ts
|
|
966
|
+
var Vt = {
|
|
967
|
+
alert: It,
|
|
968
|
+
confirm: Lt,
|
|
969
|
+
toast: Rt,
|
|
970
|
+
loading: zt,
|
|
971
|
+
notify: {
|
|
972
|
+
success: (e, t) => Bt("success", e, t),
|
|
973
|
+
info: (e, t) => Bt("info", e, t),
|
|
974
|
+
warning: (e, t) => Bt("warning", e, t),
|
|
975
|
+
error: (e, t) => Bt("error", e, t)
|
|
976
|
+
}
|
|
977
|
+
}, Ht = { class: "ca-auth-row" }, Ut = ["disabled"], Wt = 60, Gt = /* @__PURE__ */ d({
|
|
978
|
+
__name: "SmsField",
|
|
979
|
+
props: /*@__PURE__*/ p({ send: { type: Function } }, {
|
|
980
|
+
modelValue: { default: "" },
|
|
981
|
+
modelModifiers: {}
|
|
982
|
+
}),
|
|
983
|
+
emits: ["update:modelValue"],
|
|
984
|
+
setup(e) {
|
|
985
|
+
let t = e, n = O(e, "modelValue"), { t: r } = W(), i = x(0), a = x(!1), c;
|
|
986
|
+
function l() {
|
|
987
|
+
c && clearInterval(c), c = void 0;
|
|
988
|
+
}
|
|
989
|
+
async function d() {
|
|
990
|
+
if (!(i.value > 0 || a.value)) {
|
|
991
|
+
a.value = !0;
|
|
992
|
+
try {
|
|
993
|
+
await t.send();
|
|
994
|
+
} catch {
|
|
995
|
+
return;
|
|
996
|
+
} finally {
|
|
997
|
+
a.value = !1;
|
|
998
|
+
}
|
|
999
|
+
i.value = Wt, l(), c = setInterval(() => {
|
|
1000
|
+
--i.value, i.value <= 0 && l();
|
|
1001
|
+
}, 1e3);
|
|
1002
|
+
}
|
|
1003
|
+
}
|
|
1004
|
+
return _(l), (e, t) => {
|
|
1005
|
+
let c = w("ca-input");
|
|
1006
|
+
return y(), o("div", Ht, [u(c, {
|
|
1007
|
+
modelValue: n.value,
|
|
1008
|
+
"onUpdate:modelValue": t[0] ||= (e) => n.value = e,
|
|
1009
|
+
placeholder: D(r)("campus.auth.smsPlaceholder"),
|
|
1010
|
+
"aria-label": D(r)("campus.auth.smsCode"),
|
|
1011
|
+
autocomplete: "one-time-code",
|
|
1012
|
+
maxlength: "8"
|
|
1013
|
+
}, {
|
|
1014
|
+
prefix: M(() => [u($, { name: "message" })]),
|
|
1015
|
+
_: 1
|
|
1016
|
+
}, 8, [
|
|
1017
|
+
"modelValue",
|
|
1018
|
+
"placeholder",
|
|
1019
|
+
"aria-label"
|
|
1020
|
+
]), s("button", {
|
|
1021
|
+
type: "button",
|
|
1022
|
+
class: "ca-auth-sms",
|
|
1023
|
+
disabled: i.value > 0 || a.value,
|
|
1024
|
+
onClick: d
|
|
1025
|
+
}, E(i.value > 0 ? D(r)("campus.auth.resend", { n: i.value }) : D(r)("campus.auth.getCode")), 9, Ut)]);
|
|
1026
|
+
};
|
|
1027
|
+
}
|
|
1028
|
+
}), Kt = {
|
|
149
1029
|
key: 0,
|
|
150
|
-
class: "ca-
|
|
151
|
-
},
|
|
1030
|
+
class: "ca-auth-hint"
|
|
1031
|
+
}, qt = { class: "ca-auth-agreements" }, Jt = ["href"], Yt = /* @__PURE__ */ d({
|
|
1032
|
+
__name: "RegisterForm",
|
|
1033
|
+
props: { preview: { type: Boolean } },
|
|
1034
|
+
setup(t) {
|
|
1035
|
+
let r = t, c = H(), { t: d, label: f } = W(), p = J(), m = jt(K()), g = q(), _ = g.agreements ?? [], v = b({
|
|
1036
|
+
phone: "",
|
|
1037
|
+
captcha: "",
|
|
1038
|
+
code: "",
|
|
1039
|
+
password: "",
|
|
1040
|
+
confirm: "",
|
|
1041
|
+
agree: !1
|
|
1042
|
+
}), C = x(""), T = x(), O = x(), k = x(!1), A = x(""), j = x("error"), N = n(() => ({
|
|
1043
|
+
phone: [{
|
|
1044
|
+
required: !0,
|
|
1045
|
+
message: d("campus.auth.phonePlaceholder"),
|
|
1046
|
+
trigger: "blur"
|
|
1047
|
+
}, {
|
|
1048
|
+
pattern: Ve,
|
|
1049
|
+
message: d("campus.auth.phoneInvalid"),
|
|
1050
|
+
trigger: "blur"
|
|
1051
|
+
}],
|
|
1052
|
+
captcha: p.captcha ? [{
|
|
1053
|
+
required: !0,
|
|
1054
|
+
message: d("campus.auth.captchaRequired"),
|
|
1055
|
+
trigger: "blur"
|
|
1056
|
+
}] : [],
|
|
1057
|
+
code: [{
|
|
1058
|
+
required: !0,
|
|
1059
|
+
message: d("campus.login.required", { label: d("campus.auth.smsCode") }),
|
|
1060
|
+
trigger: "blur"
|
|
1061
|
+
}],
|
|
1062
|
+
password: [{
|
|
1063
|
+
required: !0,
|
|
1064
|
+
message: d("campus.auth.registerPasswordPlaceholder"),
|
|
1065
|
+
trigger: "blur"
|
|
1066
|
+
}, {
|
|
1067
|
+
validator: (e, t, n) => n(Nt(t, m) ? void 0 : Error(d("campus.auth.passwordPolicy"))),
|
|
1068
|
+
trigger: "blur"
|
|
1069
|
+
}],
|
|
1070
|
+
confirm: [{
|
|
1071
|
+
required: !0,
|
|
1072
|
+
message: d("campus.auth.confirmPlaceholder"),
|
|
1073
|
+
trigger: "blur"
|
|
1074
|
+
}, {
|
|
1075
|
+
validator: (e, t, n) => n(t === v.password ? void 0 : Error(d("campus.auth.passwordMismatch"))),
|
|
1076
|
+
trigger: "blur"
|
|
1077
|
+
}],
|
|
1078
|
+
agree: _.length ? [{
|
|
1079
|
+
validator: (e, t, n) => n(t ? void 0 : Error(d("campus.auth.agreeRequired"))),
|
|
1080
|
+
trigger: "change"
|
|
1081
|
+
}] : []
|
|
1082
|
+
})), F = n(() => !!(v.phone && v.code && v.password && v.confirm) && (!p.captcha || !!v.captcha) && (!_.length || v.agree));
|
|
1083
|
+
function I(e, t) {
|
|
1084
|
+
j.value = "error", A.value = e instanceof Error && e.message ? e.message : t;
|
|
1085
|
+
}
|
|
1086
|
+
async function L() {
|
|
1087
|
+
let e = p.captcha ? ["phone", "captcha"] : ["phone"];
|
|
1088
|
+
try {
|
|
1089
|
+
await O.value?.validateField(e);
|
|
1090
|
+
} catch {
|
|
1091
|
+
throw Error("invalid");
|
|
1092
|
+
}
|
|
1093
|
+
if (A.value = "", r.preview) j.value = "info", A.value = d("campus.auth.previewNote");
|
|
1094
|
+
else try {
|
|
1095
|
+
await K().auth.sendSmsCode({
|
|
1096
|
+
phone: v.phone,
|
|
1097
|
+
scene: "register",
|
|
1098
|
+
captcha: p.captcha ? {
|
|
1099
|
+
key: C.value,
|
|
1100
|
+
code: v.captcha
|
|
1101
|
+
} : void 0
|
|
1102
|
+
}), Vt.toast.success(d("campus.auth.smsSent"));
|
|
1103
|
+
} catch (e) {
|
|
1104
|
+
throw I(e, d("campus.login.failed")), T.value?.refresh(), e;
|
|
1105
|
+
}
|
|
1106
|
+
}
|
|
1107
|
+
async function R() {
|
|
1108
|
+
if (F.value) {
|
|
1109
|
+
try {
|
|
1110
|
+
await O.value?.validate();
|
|
1111
|
+
} catch {
|
|
1112
|
+
return;
|
|
1113
|
+
}
|
|
1114
|
+
if (r.preview) j.value = "info", A.value = d("campus.auth.previewNote");
|
|
1115
|
+
else {
|
|
1116
|
+
k.value = !0, A.value = "";
|
|
1117
|
+
try {
|
|
1118
|
+
await K().auth.register({
|
|
1119
|
+
phone: v.phone,
|
|
1120
|
+
code: v.code,
|
|
1121
|
+
password: v.password,
|
|
1122
|
+
captcha: p.captcha ? {
|
|
1123
|
+
key: C.value,
|
|
1124
|
+
code: v.captcha
|
|
1125
|
+
} : void 0
|
|
1126
|
+
}), Vt.toast.success(d("campus.auth.registerOk")), await c.replace("/login");
|
|
1127
|
+
} catch (e) {
|
|
1128
|
+
I(e, d("campus.login.failed")), T.value?.refresh();
|
|
1129
|
+
} finally {
|
|
1130
|
+
k.value = !1;
|
|
1131
|
+
}
|
|
1132
|
+
}
|
|
1133
|
+
}
|
|
1134
|
+
}
|
|
1135
|
+
return (t, n) => {
|
|
1136
|
+
let r = w("ca-alert"), c = w("ca-input"), m = w("ca-form-item"), b = w("ca-checkbox"), x = w("ca-button"), I = w("ca-form");
|
|
1137
|
+
return y(), o(e, null, [A.value ? (y(), i(r, {
|
|
1138
|
+
key: 0,
|
|
1139
|
+
title: A.value,
|
|
1140
|
+
type: j.value,
|
|
1141
|
+
"show-icon": "",
|
|
1142
|
+
closable: !1,
|
|
1143
|
+
class: "ca-auth-alert"
|
|
1144
|
+
}, null, 8, ["title", "type"])) : a("v-if", !0), u(I, {
|
|
1145
|
+
ref_key: "formRef",
|
|
1146
|
+
ref: O,
|
|
1147
|
+
model: v,
|
|
1148
|
+
rules: N.value,
|
|
1149
|
+
size: "large",
|
|
1150
|
+
class: "ca-auth-form",
|
|
1151
|
+
onSubmit: P(R, ["prevent"])
|
|
1152
|
+
}, {
|
|
1153
|
+
default: M(() => [
|
|
1154
|
+
u(m, { prop: "phone" }, {
|
|
1155
|
+
default: M(() => [u(c, {
|
|
1156
|
+
modelValue: v.phone,
|
|
1157
|
+
"onUpdate:modelValue": n[0] ||= (e) => v.phone = e,
|
|
1158
|
+
placeholder: D(d)("campus.auth.phonePlaceholder"),
|
|
1159
|
+
"aria-label": D(d)("campus.auth.phone"),
|
|
1160
|
+
autocomplete: "tel",
|
|
1161
|
+
maxlength: "11"
|
|
1162
|
+
}, {
|
|
1163
|
+
prefix: M(() => [u($, { name: "phone" })]),
|
|
1164
|
+
_: 1
|
|
1165
|
+
}, 8, [
|
|
1166
|
+
"modelValue",
|
|
1167
|
+
"placeholder",
|
|
1168
|
+
"aria-label"
|
|
1169
|
+
])]),
|
|
1170
|
+
_: 1
|
|
1171
|
+
}),
|
|
1172
|
+
D(p).captcha ? (y(), i(m, {
|
|
1173
|
+
key: 0,
|
|
1174
|
+
prop: "captcha"
|
|
1175
|
+
}, {
|
|
1176
|
+
default: M(() => [u(gt, {
|
|
1177
|
+
ref_key: "captchaRef",
|
|
1178
|
+
ref: T,
|
|
1179
|
+
code: v.captcha,
|
|
1180
|
+
"onUpdate:code": n[1] ||= (e) => v.captcha = e,
|
|
1181
|
+
"captcha-key": C.value,
|
|
1182
|
+
"onUpdate:captchaKey": n[2] ||= (e) => C.value = e,
|
|
1183
|
+
scene: "register"
|
|
1184
|
+
}, null, 8, ["code", "captcha-key"])]),
|
|
1185
|
+
_: 1
|
|
1186
|
+
})) : a("v-if", !0),
|
|
1187
|
+
u(m, { prop: "code" }, {
|
|
1188
|
+
default: M(() => [u(Gt, {
|
|
1189
|
+
modelValue: v.code,
|
|
1190
|
+
"onUpdate:modelValue": n[3] ||= (e) => v.code = e,
|
|
1191
|
+
send: L
|
|
1192
|
+
}, null, 8, ["modelValue"]), D(g).smsHint ? (y(), o("p", Kt, E(D(f)(D(g).smsHint)), 1)) : a("v-if", !0)]),
|
|
1193
|
+
_: 1
|
|
1194
|
+
}),
|
|
1195
|
+
u(m, { prop: "password" }, {
|
|
1196
|
+
default: M(() => [u(c, {
|
|
1197
|
+
modelValue: v.password,
|
|
1198
|
+
"onUpdate:modelValue": n[4] ||= (e) => v.password = e,
|
|
1199
|
+
type: "password",
|
|
1200
|
+
"show-password": "",
|
|
1201
|
+
placeholder: D(d)("campus.auth.registerPasswordPlaceholder"),
|
|
1202
|
+
"aria-label": D(d)("campus.auth.registerPassword"),
|
|
1203
|
+
autocomplete: "new-password"
|
|
1204
|
+
}, {
|
|
1205
|
+
prefix: M(() => [u($, { name: "lock" })]),
|
|
1206
|
+
_: 1
|
|
1207
|
+
}, 8, [
|
|
1208
|
+
"modelValue",
|
|
1209
|
+
"placeholder",
|
|
1210
|
+
"aria-label"
|
|
1211
|
+
])]),
|
|
1212
|
+
_: 1
|
|
1213
|
+
}),
|
|
1214
|
+
u(m, { prop: "confirm" }, {
|
|
1215
|
+
default: M(() => [u(c, {
|
|
1216
|
+
modelValue: v.confirm,
|
|
1217
|
+
"onUpdate:modelValue": n[5] ||= (e) => v.confirm = e,
|
|
1218
|
+
type: "password",
|
|
1219
|
+
"show-password": "",
|
|
1220
|
+
placeholder: D(d)("campus.auth.confirmPlaceholder"),
|
|
1221
|
+
"aria-label": D(d)("campus.auth.confirmPlaceholder"),
|
|
1222
|
+
autocomplete: "new-password"
|
|
1223
|
+
}, {
|
|
1224
|
+
prefix: M(() => [u($, { name: "lock" })]),
|
|
1225
|
+
_: 1
|
|
1226
|
+
}, 8, [
|
|
1227
|
+
"modelValue",
|
|
1228
|
+
"placeholder",
|
|
1229
|
+
"aria-label"
|
|
1230
|
+
])]),
|
|
1231
|
+
_: 1
|
|
1232
|
+
}),
|
|
1233
|
+
D(_).length ? (y(), i(m, {
|
|
1234
|
+
key: 1,
|
|
1235
|
+
prop: "agree"
|
|
1236
|
+
}, {
|
|
1237
|
+
default: M(() => [u(b, {
|
|
1238
|
+
modelValue: v.agree,
|
|
1239
|
+
"onUpdate:modelValue": n[6] ||= (e) => v.agree = e
|
|
1240
|
+
}, {
|
|
1241
|
+
default: M(() => [l(E(D(d)("campus.auth.agreePrefix")), 1)]),
|
|
1242
|
+
_: 1
|
|
1243
|
+
}, 8, ["modelValue"]), s("span", qt, [(y(!0), o(e, null, S(D(_), (e) => (y(), o("a", {
|
|
1244
|
+
key: e.href,
|
|
1245
|
+
href: e.href,
|
|
1246
|
+
target: "_blank",
|
|
1247
|
+
rel: "noopener noreferrer"
|
|
1248
|
+
}, E(D(f)(e.text)), 9, Jt))), 128))])]),
|
|
1249
|
+
_: 1
|
|
1250
|
+
})) : a("v-if", !0),
|
|
1251
|
+
u(x, {
|
|
1252
|
+
type: "primary",
|
|
1253
|
+
"native-type": "submit",
|
|
1254
|
+
size: "large",
|
|
1255
|
+
loading: k.value,
|
|
1256
|
+
disabled: !F.value,
|
|
1257
|
+
class: h(["ca-auth-submit", { "ca-auth-submit--off": !F.value }])
|
|
1258
|
+
}, {
|
|
1259
|
+
default: M(() => [l(E(D(d)("campus.common.ok")), 1)]),
|
|
1260
|
+
_: 1
|
|
1261
|
+
}, 8, [
|
|
1262
|
+
"loading",
|
|
1263
|
+
"disabled",
|
|
1264
|
+
"class"
|
|
1265
|
+
])
|
|
1266
|
+
]),
|
|
1267
|
+
_: 1
|
|
1268
|
+
}, 8, ["model", "rules"])], 64);
|
|
1269
|
+
};
|
|
1270
|
+
}
|
|
1271
|
+
}), Xt = {
|
|
152
1272
|
key: 1,
|
|
153
|
-
class: "ca-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
__name: "
|
|
157
|
-
props: {
|
|
1273
|
+
class: "ca-auth-off",
|
|
1274
|
+
role: "status"
|
|
1275
|
+
}, Zt = /* @__PURE__ */ d({
|
|
1276
|
+
__name: "RegisterPage",
|
|
1277
|
+
props: { preview: { type: Boolean } },
|
|
1278
|
+
setup(e) {
|
|
1279
|
+
let { t } = W(), r = J().register, a = n(() => [{
|
|
1280
|
+
key: "register",
|
|
1281
|
+
label: t("campus.auth.tabRegister")
|
|
1282
|
+
}, {
|
|
1283
|
+
key: "login",
|
|
1284
|
+
label: t("campus.auth.backLogin"),
|
|
1285
|
+
to: "/login"
|
|
1286
|
+
}]);
|
|
1287
|
+
return (n, c) => (y(), i(at, {
|
|
1288
|
+
active: "register",
|
|
1289
|
+
tabs: a.value,
|
|
1290
|
+
preview: e.preview
|
|
1291
|
+
}, {
|
|
1292
|
+
default: M(() => [D(r) ? (y(), i(Yt, {
|
|
1293
|
+
key: 0,
|
|
1294
|
+
preview: e.preview
|
|
1295
|
+
}, null, 8, ["preview"])) : (y(), o("div", Xt, [s("h3", null, E(D(t)("campus.auth.unavailableTitle")), 1), s("p", null, E(D(t)("campus.auth.unavailableDesc")), 1)]))]),
|
|
1296
|
+
_: 1
|
|
1297
|
+
}, 8, ["tabs", "preview"]));
|
|
1298
|
+
}
|
|
1299
|
+
}), Qt = {
|
|
1300
|
+
key: 0,
|
|
1301
|
+
class: "ca-auth-hint"
|
|
1302
|
+
}, $t = /* @__PURE__ */ d({
|
|
1303
|
+
__name: "ForgotForm",
|
|
1304
|
+
props: { preview: { type: Boolean } },
|
|
158
1305
|
setup(t) {
|
|
159
|
-
let
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
1306
|
+
let r = t, s = H(), { t: c, label: d } = W(), f = J(), p = jt(K()), m = q(), g = b({
|
|
1307
|
+
account: "",
|
|
1308
|
+
captcha: "",
|
|
1309
|
+
code: "",
|
|
1310
|
+
password: "",
|
|
1311
|
+
confirm: ""
|
|
1312
|
+
}), _ = x(""), v = x(), S = x(), C = x(!1), T = x(""), O = x("error"), k = n(() => ({
|
|
1313
|
+
account: [{
|
|
1314
|
+
required: !0,
|
|
1315
|
+
message: c("campus.auth.accountRequired"),
|
|
1316
|
+
trigger: "blur"
|
|
1317
|
+
}],
|
|
1318
|
+
captcha: f.captcha ? [{
|
|
1319
|
+
required: !0,
|
|
1320
|
+
message: c("campus.auth.captchaRequired"),
|
|
1321
|
+
trigger: "blur"
|
|
1322
|
+
}] : [],
|
|
1323
|
+
code: [{
|
|
1324
|
+
required: !0,
|
|
1325
|
+
message: c("campus.login.required", { label: c("campus.auth.smsCode") }),
|
|
1326
|
+
trigger: "blur"
|
|
1327
|
+
}],
|
|
1328
|
+
password: [{
|
|
1329
|
+
required: !0,
|
|
1330
|
+
message: c("campus.auth.newPasswordPlaceholder"),
|
|
1331
|
+
trigger: "blur"
|
|
1332
|
+
}, {
|
|
1333
|
+
validator: (e, t, n) => n(Nt(t, p) ? void 0 : Error(c("campus.auth.passwordPolicy"))),
|
|
1334
|
+
trigger: "blur"
|
|
1335
|
+
}],
|
|
1336
|
+
confirm: [{
|
|
1337
|
+
required: !0,
|
|
1338
|
+
message: c("campus.auth.confirmPlaceholder"),
|
|
1339
|
+
trigger: "blur"
|
|
1340
|
+
}, {
|
|
1341
|
+
validator: (e, t, n) => n(t === g.password ? void 0 : Error(c("campus.auth.passwordMismatch"))),
|
|
1342
|
+
trigger: "blur"
|
|
1343
|
+
}]
|
|
1344
|
+
})), A = n(() => !!(g.account && g.code && g.password && g.confirm) && (!f.captcha || !!g.captcha));
|
|
1345
|
+
function j(e, t) {
|
|
1346
|
+
O.value = "error", T.value = e instanceof Error && e.message ? e.message : t;
|
|
1347
|
+
}
|
|
1348
|
+
async function N() {
|
|
1349
|
+
let e = f.captcha ? ["account", "captcha"] : ["account"];
|
|
1350
|
+
try {
|
|
1351
|
+
await S.value?.validateField(e);
|
|
1352
|
+
} catch {
|
|
1353
|
+
throw Error("invalid");
|
|
1354
|
+
}
|
|
1355
|
+
if (T.value = "", r.preview) O.value = "info", T.value = c("campus.auth.previewNote");
|
|
1356
|
+
else try {
|
|
1357
|
+
await K().auth.sendSmsCode({
|
|
1358
|
+
...Ve.test(g.account) ? { phone: g.account } : { username: g.account },
|
|
1359
|
+
scene: "forgot",
|
|
1360
|
+
captcha: f.captcha ? {
|
|
1361
|
+
key: _.value,
|
|
1362
|
+
code: g.captcha
|
|
1363
|
+
} : void 0
|
|
1364
|
+
}), Vt.toast.success(c("campus.auth.smsSent"));
|
|
1365
|
+
} catch (e) {
|
|
1366
|
+
throw j(e, c("campus.login.failed")), v.value?.refresh(), e;
|
|
1367
|
+
}
|
|
1368
|
+
}
|
|
1369
|
+
async function F() {
|
|
1370
|
+
if (A.value) {
|
|
164
1371
|
try {
|
|
165
|
-
await
|
|
166
|
-
}
|
|
167
|
-
|
|
1372
|
+
await S.value?.validate();
|
|
1373
|
+
} catch {
|
|
1374
|
+
return;
|
|
1375
|
+
}
|
|
1376
|
+
if (r.preview) O.value = "info", T.value = c("campus.auth.previewNote");
|
|
1377
|
+
else {
|
|
1378
|
+
C.value = !0, T.value = "";
|
|
1379
|
+
try {
|
|
1380
|
+
await K().auth.resetPassword({
|
|
1381
|
+
account: g.account,
|
|
1382
|
+
code: g.code,
|
|
1383
|
+
password: g.password,
|
|
1384
|
+
captcha: f.captcha ? {
|
|
1385
|
+
key: _.value,
|
|
1386
|
+
code: g.captcha
|
|
1387
|
+
} : void 0
|
|
1388
|
+
}), Vt.toast.success(c("campus.auth.resetOk")), await s.replace("/login");
|
|
1389
|
+
} catch (e) {
|
|
1390
|
+
j(e, c("campus.login.failed")), v.value?.refresh();
|
|
1391
|
+
} finally {
|
|
1392
|
+
C.value = !1;
|
|
1393
|
+
}
|
|
168
1394
|
}
|
|
169
1395
|
}
|
|
170
1396
|
}
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
function o() {
|
|
175
|
-
r ||= document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
176
|
-
}
|
|
177
|
-
return (r, u) => (g(), c("div", Fe, [(g(!0), c(e, null, v(t.items, (e) => (g(), c("div", {
|
|
178
|
-
key: e.id,
|
|
179
|
-
class: "ca-overlay",
|
|
180
|
-
onClick: fe((t) => e.variant === "confirm" && a(e), ["self"]),
|
|
181
|
-
onVnodeMounted: o
|
|
182
|
-
}, [l("section", {
|
|
183
|
-
class: "ca-overlay__panel",
|
|
184
|
-
role: "dialog",
|
|
185
|
-
"aria-modal": "true",
|
|
186
|
-
"aria-label": e.title ?? e.content
|
|
187
|
-
}, [
|
|
188
|
-
e.title ? (g(), c("header", Re, [l("h2", ze, b(e.title), 1)])) : s("", !0),
|
|
189
|
-
e.content ? (g(), c("div", Be, b(e.content), 1)) : s("", !0),
|
|
190
|
-
l("footer", P, [e.variant === "confirm" ? (g(), c("button", {
|
|
1397
|
+
return (t, n) => {
|
|
1398
|
+
let r = w("ca-alert"), s = w("ca-input"), p = w("ca-form-item"), b = w("ca-button"), x = w("ca-form");
|
|
1399
|
+
return y(), o(e, null, [T.value ? (y(), i(r, {
|
|
191
1400
|
key: 0,
|
|
192
|
-
|
|
193
|
-
type:
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
},
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
1401
|
+
title: T.value,
|
|
1402
|
+
type: O.value,
|
|
1403
|
+
"show-icon": "",
|
|
1404
|
+
closable: !1,
|
|
1405
|
+
class: "ca-auth-alert"
|
|
1406
|
+
}, null, 8, ["title", "type"])) : a("v-if", !0), u(x, {
|
|
1407
|
+
ref_key: "formRef",
|
|
1408
|
+
ref: S,
|
|
1409
|
+
model: g,
|
|
1410
|
+
rules: k.value,
|
|
1411
|
+
size: "large",
|
|
1412
|
+
class: "ca-auth-form",
|
|
1413
|
+
onSubmit: P(F, ["prevent"])
|
|
1414
|
+
}, {
|
|
1415
|
+
default: M(() => [
|
|
1416
|
+
u(p, { prop: "account" }, {
|
|
1417
|
+
default: M(() => [u(s, {
|
|
1418
|
+
modelValue: g.account,
|
|
1419
|
+
"onUpdate:modelValue": n[0] ||= (e) => g.account = e,
|
|
1420
|
+
placeholder: D(c)("campus.auth.accountPlaceholder"),
|
|
1421
|
+
"aria-label": D(c)("campus.auth.account"),
|
|
1422
|
+
autocomplete: "username"
|
|
1423
|
+
}, {
|
|
1424
|
+
prefix: M(() => [u($, { name: "user" })]),
|
|
1425
|
+
_: 1
|
|
1426
|
+
}, 8, [
|
|
1427
|
+
"modelValue",
|
|
1428
|
+
"placeholder",
|
|
1429
|
+
"aria-label"
|
|
1430
|
+
])]),
|
|
1431
|
+
_: 1
|
|
1432
|
+
}),
|
|
1433
|
+
D(f).captcha ? (y(), i(p, {
|
|
1434
|
+
key: 0,
|
|
1435
|
+
prop: "captcha"
|
|
1436
|
+
}, {
|
|
1437
|
+
default: M(() => [u(gt, {
|
|
1438
|
+
ref_key: "captchaRef",
|
|
1439
|
+
ref: v,
|
|
1440
|
+
code: g.captcha,
|
|
1441
|
+
"onUpdate:code": n[1] ||= (e) => g.captcha = e,
|
|
1442
|
+
"captcha-key": _.value,
|
|
1443
|
+
"onUpdate:captchaKey": n[2] ||= (e) => _.value = e,
|
|
1444
|
+
scene: "forgot"
|
|
1445
|
+
}, null, 8, ["code", "captcha-key"])]),
|
|
1446
|
+
_: 1
|
|
1447
|
+
})) : a("v-if", !0),
|
|
1448
|
+
u(p, { prop: "code" }, {
|
|
1449
|
+
default: M(() => [u(Gt, {
|
|
1450
|
+
modelValue: g.code,
|
|
1451
|
+
"onUpdate:modelValue": n[3] ||= (e) => g.code = e,
|
|
1452
|
+
send: N
|
|
1453
|
+
}, null, 8, ["modelValue"]), D(m).smsHint ? (y(), o("p", Qt, E(D(d)(D(m).smsHint)), 1)) : a("v-if", !0)]),
|
|
1454
|
+
_: 1
|
|
1455
|
+
}),
|
|
1456
|
+
u(p, { prop: "password" }, {
|
|
1457
|
+
default: M(() => [u(s, {
|
|
1458
|
+
modelValue: g.password,
|
|
1459
|
+
"onUpdate:modelValue": n[4] ||= (e) => g.password = e,
|
|
1460
|
+
type: "password",
|
|
1461
|
+
"show-password": "",
|
|
1462
|
+
placeholder: D(c)("campus.auth.newPasswordPlaceholder"),
|
|
1463
|
+
"aria-label": D(c)("campus.auth.newPasswordPlaceholder"),
|
|
1464
|
+
autocomplete: "new-password"
|
|
1465
|
+
}, {
|
|
1466
|
+
prefix: M(() => [u($, { name: "lock" })]),
|
|
1467
|
+
_: 1
|
|
1468
|
+
}, 8, [
|
|
1469
|
+
"modelValue",
|
|
1470
|
+
"placeholder",
|
|
1471
|
+
"aria-label"
|
|
1472
|
+
])]),
|
|
1473
|
+
_: 1
|
|
1474
|
+
}),
|
|
1475
|
+
u(p, { prop: "confirm" }, {
|
|
1476
|
+
default: M(() => [u(s, {
|
|
1477
|
+
modelValue: g.confirm,
|
|
1478
|
+
"onUpdate:modelValue": n[5] ||= (e) => g.confirm = e,
|
|
1479
|
+
type: "password",
|
|
1480
|
+
"show-password": "",
|
|
1481
|
+
placeholder: D(c)("campus.auth.confirmPlaceholder"),
|
|
1482
|
+
"aria-label": D(c)("campus.auth.confirmPlaceholder"),
|
|
1483
|
+
autocomplete: "new-password"
|
|
1484
|
+
}, {
|
|
1485
|
+
prefix: M(() => [u($, { name: "lock" })]),
|
|
1486
|
+
_: 1
|
|
1487
|
+
}, 8, [
|
|
1488
|
+
"modelValue",
|
|
1489
|
+
"placeholder",
|
|
1490
|
+
"aria-label"
|
|
1491
|
+
])]),
|
|
1492
|
+
_: 1
|
|
1493
|
+
}),
|
|
1494
|
+
u(b, {
|
|
1495
|
+
type: "primary",
|
|
1496
|
+
"native-type": "submit",
|
|
1497
|
+
size: "large",
|
|
1498
|
+
loading: C.value,
|
|
1499
|
+
disabled: !A.value,
|
|
1500
|
+
class: h(["ca-auth-submit", { "ca-auth-submit--off": !A.value }])
|
|
1501
|
+
}, {
|
|
1502
|
+
default: M(() => [l(E(D(c)("campus.common.ok")), 1)]),
|
|
1503
|
+
_: 1
|
|
1504
|
+
}, 8, [
|
|
1505
|
+
"loading",
|
|
1506
|
+
"disabled",
|
|
1507
|
+
"class"
|
|
1508
|
+
])
|
|
1509
|
+
]),
|
|
1510
|
+
_: 1
|
|
1511
|
+
}, 8, ["model", "rules"])], 64);
|
|
1512
|
+
};
|
|
1513
|
+
}
|
|
1514
|
+
}), en = {
|
|
1515
|
+
key: 1,
|
|
1516
|
+
class: "ca-auth-off",
|
|
1517
|
+
role: "status"
|
|
1518
|
+
}, tn = /* @__PURE__ */ d({
|
|
1519
|
+
__name: "ForgotPage",
|
|
1520
|
+
props: { preview: { type: Boolean } },
|
|
1521
|
+
setup(e) {
|
|
1522
|
+
let { t } = W(), r = J().forgot, a = n(() => [{
|
|
1523
|
+
key: "forgot",
|
|
1524
|
+
label: t("campus.auth.tabForgot")
|
|
1525
|
+
}, {
|
|
1526
|
+
key: "login",
|
|
1527
|
+
label: t("campus.auth.backLogin"),
|
|
1528
|
+
to: "/login"
|
|
1529
|
+
}]);
|
|
1530
|
+
return (n, c) => (y(), i(at, {
|
|
1531
|
+
active: "forgot",
|
|
1532
|
+
tabs: a.value,
|
|
1533
|
+
preview: e.preview
|
|
1534
|
+
}, {
|
|
1535
|
+
default: M(() => [D(r) ? (y(), i($t, {
|
|
1536
|
+
key: 0,
|
|
1537
|
+
preview: e.preview
|
|
1538
|
+
}, null, 8, ["preview"])) : (y(), o("div", en, [s("h3", null, E(D(t)("campus.auth.unavailableTitle")), 1), s("p", null, E(D(t)("campus.auth.unavailableDesc")), 1)]))]),
|
|
1539
|
+
_: 1
|
|
1540
|
+
}, 8, ["tabs", "preview"]));
|
|
1541
|
+
}
|
|
1542
|
+
}), nn = /* @__PURE__ */ d({
|
|
1543
|
+
__name: "AuthPreview",
|
|
1544
|
+
props: { kind: {} },
|
|
1545
|
+
setup(e) {
|
|
1546
|
+
return (t, n) => e.kind === "login" ? (y(), i(At, {
|
|
1547
|
+
key: 0,
|
|
1548
|
+
preview: ""
|
|
1549
|
+
})) : e.kind === "register" ? (y(), i(Zt, {
|
|
1550
|
+
key: 1,
|
|
1551
|
+
preview: ""
|
|
1552
|
+
})) : (y(), i(tn, {
|
|
1553
|
+
key: 2,
|
|
1554
|
+
preview: ""
|
|
1555
|
+
}));
|
|
1556
|
+
}
|
|
1557
|
+
}), rn = { class: "ca-header" }, an = ["aria-label", "aria-expanded"], on = { class: "ca-header__brand" }, sn = ["src"], cn = { class: "ca-header__titles" }, ln = { class: "ca-header__name" }, un = {
|
|
1558
|
+
key: 0,
|
|
1559
|
+
class: "ca-header__subtitle"
|
|
1560
|
+
}, dn = ["aria-label"], fn = ["onClick"], pn = { class: "ca-header__tools" }, mn = { class: "ca-header__search-text" }, hn = [
|
|
1561
|
+
"title",
|
|
1562
|
+
"aria-label",
|
|
1563
|
+
"aria-pressed"
|
|
1564
|
+
], gn = ["title", "aria-label"], _n = { class: "ca-header__icon-text" }, vn = ["title", "aria-label"], yn = ["title", "aria-label"], bn = ["title", "aria-label"], xn = ["title", "aria-label"], Sn = { class: "ca-header__avatar" }, Cn = { class: "ca-settings__group" }, wn = { class: "ca-settings__title" }, Tn = ["aria-label"], En = ["aria-checked", "onClick"], Dn = {
|
|
1565
|
+
key: 0,
|
|
1566
|
+
class: "ca-settings__group"
|
|
1567
|
+
}, On = { class: "ca-settings__title" }, kn = ["aria-label"], An = [
|
|
1568
|
+
"aria-label",
|
|
1569
|
+
"aria-checked",
|
|
1570
|
+
"onClick"
|
|
1571
|
+
], jn = ["title"], Mn = ["value", "aria-label"], Nn = ["disabled"], Pn = { class: "ca-settings__group" }, Fn = { class: "ca-settings__title" }, In = ["aria-label"], Ln = ["aria-checked", "onClick"], Rn = /*#__PURE__*/ Y(/* @__PURE__ */ d({
|
|
1572
|
+
__name: "HeaderBar",
|
|
1573
|
+
setup(t) {
|
|
1574
|
+
let r = V(), c = H(), d = Q(), f = X(), p = ze(), { t: m, label: b, locale: C } = W(), T = K(), O = x(!1), k = [{
|
|
1575
|
+
value: "border",
|
|
1576
|
+
label: "campus.settings.boxBorder"
|
|
1577
|
+
}, {
|
|
1578
|
+
value: "shadow",
|
|
1579
|
+
label: "campus.settings.boxShadow"
|
|
1580
|
+
}], A = n(() => b(p.theme.siteName ?? T.brand.name)), j = n(() => p.theme.logo ?? T.brand.logo), N = n(() => (T.shortcuts ?? []).filter((e) => d.can(e.permission)));
|
|
1581
|
+
function P(e) {
|
|
1582
|
+
r.path !== e && c.push(e);
|
|
1583
|
+
}
|
|
1584
|
+
let F = [
|
|
1585
|
+
{
|
|
1586
|
+
value: "light",
|
|
1587
|
+
icon: "sunny"
|
|
1588
|
+
},
|
|
1589
|
+
{
|
|
1590
|
+
value: "dark",
|
|
1591
|
+
icon: "moon"
|
|
1592
|
+
},
|
|
1593
|
+
{
|
|
1594
|
+
value: "auto",
|
|
1595
|
+
icon: "monitor"
|
|
1596
|
+
}
|
|
1597
|
+
], I = [
|
|
1598
|
+
"#1677ff",
|
|
1599
|
+
"#364fc7",
|
|
1600
|
+
"#6b1d7a",
|
|
1601
|
+
"#d6336c",
|
|
1602
|
+
"#e8590c",
|
|
1603
|
+
"#f59f00",
|
|
1604
|
+
"#0f9d58",
|
|
1605
|
+
"#0ca678"
|
|
1606
|
+
], L = n(() => p.theme.primary);
|
|
1607
|
+
function R(e, t) {
|
|
1608
|
+
let n = t.currentTarget?.getBoundingClientRect();
|
|
1609
|
+
p.setMode(e, n ? {
|
|
1610
|
+
x: n.left + n.width / 2,
|
|
1611
|
+
y: n.top + n.height / 2
|
|
1612
|
+
} : void 0);
|
|
1613
|
+
}
|
|
1614
|
+
function te(e) {
|
|
1615
|
+
C.value = e, Ee(e);
|
|
1616
|
+
}
|
|
1617
|
+
async function ne(e) {
|
|
1618
|
+
e === "account" ? T.accountPath && P(T.accountPath) : (await d.logout(), await c.replace({ name: "login" }));
|
|
1619
|
+
}
|
|
1620
|
+
let z = x(!1);
|
|
1621
|
+
function B() {
|
|
1622
|
+
z.value = !!document.fullscreenElement;
|
|
1623
|
+
}
|
|
1624
|
+
async function re() {
|
|
1625
|
+
try {
|
|
1626
|
+
document.fullscreenElement ? await document.exitFullscreen() : await document.documentElement.requestFullscreen();
|
|
1627
|
+
} catch {}
|
|
1628
|
+
}
|
|
1629
|
+
v(() => document.addEventListener("fullscreenchange", B)), _(() => document.removeEventListener("fullscreenchange", B));
|
|
1630
|
+
function ie(e) {
|
|
1631
|
+
T.headerTools?.[e]?.();
|
|
1632
|
+
}
|
|
1633
|
+
return (t, n) => {
|
|
1634
|
+
let c = w("ca-icon"), _ = w("ca-dropdown-item"), v = w("ca-dropdown-menu"), x = w("ca-dropdown"), B = w("ca-drawer");
|
|
1635
|
+
return y(), o("header", rn, [
|
|
1636
|
+
s("button", {
|
|
1637
|
+
type: "button",
|
|
1638
|
+
class: "ca-header__hamburger ca-header__icon",
|
|
1639
|
+
"aria-label": D(m)("campus.side.openMenu"),
|
|
1640
|
+
"aria-expanded": D(f).mobileMenuOpen,
|
|
1641
|
+
onClick: n[0] ||= (e) => D(f).openMobileMenu()
|
|
1642
|
+
}, [...n[8] ||= [s("svg", {
|
|
1643
|
+
width: "20",
|
|
1644
|
+
height: "20",
|
|
1645
|
+
viewBox: "0 0 24 24",
|
|
1646
|
+
fill: "none",
|
|
1647
|
+
stroke: "currentColor",
|
|
1648
|
+
"stroke-width": "2",
|
|
1649
|
+
"stroke-linecap": "round",
|
|
1650
|
+
"aria-hidden": "true"
|
|
1651
|
+
}, [s("path", { d: "M4 6h16M4 12h16M4 18h16" })], -1)]], 8, an),
|
|
1652
|
+
s("div", on, [j.value ? (y(), o("img", {
|
|
1653
|
+
key: 0,
|
|
1654
|
+
src: j.value,
|
|
1655
|
+
alt: "",
|
|
1656
|
+
class: "ca-header__logo"
|
|
1657
|
+
}, null, 8, sn)) : (y(), o(e, { key: 1 }, [a(" 没有配置 logo 时用框架默认标志(学士帽),颜色跟随头部前景色 "), n[9] ||= s("svg", {
|
|
1658
|
+
class: "ca-header__logo",
|
|
1659
|
+
viewBox: "0 0 32 32",
|
|
1660
|
+
fill: "none",
|
|
1661
|
+
stroke: "currentColor",
|
|
1662
|
+
"stroke-width": "2",
|
|
1663
|
+
"stroke-linecap": "round",
|
|
1664
|
+
"stroke-linejoin": "round",
|
|
1665
|
+
"aria-hidden": "true"
|
|
1666
|
+
}, [
|
|
1667
|
+
s("path", { d: "M16 6 3 12.5 16 19l13-6.5L16 6Z" }),
|
|
1668
|
+
s("path", { d: "M9 16.5v5.2c0 1.6 3.1 3.3 7 3.3s7-1.7 7-3.3v-5.2" }),
|
|
1669
|
+
s("path", { d: "M29 12.5V20" })
|
|
1670
|
+
], -1)], 2112)), s("div", cn, [s("strong", ln, E(A.value), 1), D(T).brand.subtitle ? (y(), o("span", un, E(D(b)(D(T).brand.subtitle)), 1)) : a("v-if", !0)])]),
|
|
1671
|
+
s("nav", {
|
|
1672
|
+
class: "ca-header__nav",
|
|
1673
|
+
"aria-label": D(m)("campus.header.shortcuts")
|
|
1674
|
+
}, [(y(!0), o(e, null, S(N.value, (e) => (y(), o("button", {
|
|
1675
|
+
key: e.key,
|
|
1676
|
+
class: h(["ca-header__nav-item", { "is-active": D(r).path === e.path }]),
|
|
1677
|
+
type: "button",
|
|
1678
|
+
onClick: (t) => P(e.path)
|
|
1679
|
+
}, E(D(b)(e.title)), 11, fn))), 128))], 8, dn),
|
|
1680
|
+
s("div", pn, [
|
|
1681
|
+
s("button", {
|
|
1682
|
+
type: "button",
|
|
1683
|
+
class: "ca-header__search",
|
|
1684
|
+
onClick: n[1] ||= (e) => ie("search")
|
|
1685
|
+
}, [
|
|
1686
|
+
u(c, { name: "search" }),
|
|
1687
|
+
s("span", mn, E(D(m)("campus.header.search")), 1),
|
|
1688
|
+
n[10] ||= s("kbd", { class: "ca-header__kbd" }, "⌘ K", -1)
|
|
1689
|
+
]),
|
|
1690
|
+
s("button", {
|
|
1691
|
+
type: "button",
|
|
1692
|
+
class: "ca-header__icon ca-header__desktop-tool",
|
|
1693
|
+
title: z.value ? D(m)("campus.header.exitFullscreen") : D(m)("campus.header.fullscreen"),
|
|
1694
|
+
"aria-label": z.value ? D(m)("campus.header.exitFullscreen") : D(m)("campus.header.fullscreen"),
|
|
1695
|
+
"aria-pressed": z.value,
|
|
1696
|
+
onClick: re
|
|
1697
|
+
}, [u(c, {
|
|
1698
|
+
name: z.value ? "exitFullscreen" : "fullscreen",
|
|
1699
|
+
size: 18
|
|
1700
|
+
}, null, 8, ["name"])], 8, hn),
|
|
1701
|
+
u(x, {
|
|
1702
|
+
trigger: "click",
|
|
1703
|
+
onCommand: te
|
|
1704
|
+
}, {
|
|
1705
|
+
dropdown: M(() => [u(v, null, {
|
|
1706
|
+
default: M(() => [(y(!0), o(e, null, S(D(ee), (e) => (y(), i(_, {
|
|
1707
|
+
key: e.code,
|
|
1708
|
+
command: e.code,
|
|
1709
|
+
class: h({ "is-current": D(C) === e.code })
|
|
1710
|
+
}, {
|
|
1711
|
+
default: M(() => [l(E(e.code === "zh-CN" ? "简体中文" : "English"), 1)]),
|
|
1712
|
+
_: 2
|
|
1713
|
+
}, 1032, ["command", "class"]))), 128))]),
|
|
1714
|
+
_: 1
|
|
1715
|
+
})]),
|
|
1716
|
+
default: M(() => [s("button", {
|
|
1717
|
+
type: "button",
|
|
1718
|
+
class: "ca-header__icon",
|
|
1719
|
+
title: D(m)("campus.header.language"),
|
|
1720
|
+
"aria-label": D(m)("campus.header.language")
|
|
1721
|
+
}, [s("span", _n, E(D(ee).find((e) => e.code === D(C))?.label), 1)], 8, gn)]),
|
|
1722
|
+
_: 1
|
|
1723
|
+
}),
|
|
1724
|
+
s("button", {
|
|
1725
|
+
type: "button",
|
|
1726
|
+
class: "ca-header__icon ca-header__desktop-tool",
|
|
1727
|
+
title: D(m)("campus.header.notifications"),
|
|
1728
|
+
"aria-label": D(m)("campus.header.notifications"),
|
|
1729
|
+
onClick: n[2] ||= (e) => ie("notifications")
|
|
1730
|
+
}, [u(c, {
|
|
1731
|
+
name: "bell",
|
|
1732
|
+
size: 18
|
|
1733
|
+
}), n[11] ||= s("i", {
|
|
1734
|
+
class: "ca-header__dot is-danger",
|
|
1735
|
+
"aria-hidden": "true"
|
|
1736
|
+
}, null, -1)], 8, vn),
|
|
1737
|
+
s("button", {
|
|
1738
|
+
type: "button",
|
|
1739
|
+
class: "ca-header__icon ca-header__desktop-tool",
|
|
1740
|
+
title: D(m)("campus.header.assistant"),
|
|
1741
|
+
"aria-label": D(m)("campus.header.assistant"),
|
|
1742
|
+
onClick: n[3] ||= (e) => ie("assistant")
|
|
1743
|
+
}, [u(c, {
|
|
1744
|
+
name: "chat",
|
|
1745
|
+
size: 18
|
|
1746
|
+
}), n[12] ||= s("i", {
|
|
1747
|
+
class: "ca-header__dot is-success",
|
|
1748
|
+
"aria-hidden": "true"
|
|
1749
|
+
}, null, -1)], 8, yn),
|
|
1750
|
+
s("button", {
|
|
1751
|
+
type: "button",
|
|
1752
|
+
class: "ca-header__icon",
|
|
1753
|
+
title: D(m)("campus.header.settings"),
|
|
1754
|
+
"aria-label": D(m)("campus.header.settings"),
|
|
1755
|
+
onClick: n[4] ||= (e) => O.value = !0
|
|
1756
|
+
}, [u(c, {
|
|
1757
|
+
name: "setting",
|
|
1758
|
+
size: 18
|
|
1759
|
+
})], 8, bn),
|
|
1760
|
+
u(x, {
|
|
1761
|
+
trigger: "click",
|
|
1762
|
+
onCommand: ne
|
|
1763
|
+
}, {
|
|
1764
|
+
dropdown: M(() => [u(v, null, {
|
|
1765
|
+
default: M(() => [D(T).accountPath ? (y(), i(_, {
|
|
1766
|
+
key: 0,
|
|
1767
|
+
command: "account"
|
|
1768
|
+
}, {
|
|
1769
|
+
default: M(() => [l(E(D(m)("campus.header.myAccount")), 1)]),
|
|
1770
|
+
_: 1
|
|
1771
|
+
})) : a("v-if", !0), u(_, {
|
|
1772
|
+
command: "logout",
|
|
1773
|
+
divided: ""
|
|
1774
|
+
}, {
|
|
1775
|
+
default: M(() => [l(E(D(m)("campus.header.logout")), 1)]),
|
|
1776
|
+
_: 1
|
|
1777
|
+
})]),
|
|
1778
|
+
_: 1
|
|
1779
|
+
})]),
|
|
1780
|
+
default: M(() => [s("button", {
|
|
1781
|
+
type: "button",
|
|
1782
|
+
class: "ca-header__user",
|
|
1783
|
+
title: D(m)("campus.header.account"),
|
|
1784
|
+
"aria-label": D(d).user?.name
|
|
1785
|
+
}, [s("span", Sn, E(D(d).user?.name.slice(0, 1)), 1), u(c, {
|
|
1786
|
+
name: "arrowDown",
|
|
1787
|
+
size: 12
|
|
1788
|
+
})], 8, xn)]),
|
|
1789
|
+
_: 1
|
|
1790
|
+
})
|
|
1791
|
+
]),
|
|
1792
|
+
u(B, {
|
|
1793
|
+
modelValue: O.value,
|
|
1794
|
+
"onUpdate:modelValue": n[7] ||= (e) => O.value = e,
|
|
1795
|
+
title: D(m)("campus.settings.title"),
|
|
1796
|
+
size: "320px",
|
|
1797
|
+
"append-to-body": "",
|
|
1798
|
+
class: "ca-settings"
|
|
1799
|
+
}, {
|
|
1800
|
+
default: M(() => [
|
|
1801
|
+
s("section", Cn, [s("h3", wn, [s("span", null, E(D(m)("campus.settings.themeMode")), 1)]), s("div", {
|
|
1802
|
+
class: "ca-settings__segment is-three",
|
|
1803
|
+
role: "radiogroup",
|
|
1804
|
+
"aria-label": D(m)("campus.settings.themeMode")
|
|
1805
|
+
}, [(y(), o(e, null, S(F, (e) => s("button", {
|
|
1806
|
+
key: e.value,
|
|
1807
|
+
type: "button",
|
|
1808
|
+
role: "radio",
|
|
1809
|
+
"aria-checked": D(p).mode === e.value,
|
|
1810
|
+
class: h({ "is-active": D(p).mode === e.value }),
|
|
1811
|
+
onClick: (t) => R(e.value, t)
|
|
1812
|
+
}, [u(c, {
|
|
1813
|
+
name: e.icon,
|
|
1814
|
+
size: 16
|
|
1815
|
+
}, null, 8, ["name"]), l(E(D(m)(`campus.mode.${e.value}`)), 1)], 10, En)), 64))], 8, Tn)]),
|
|
1816
|
+
D(p).primaryLocked ? a("v-if", !0) : (y(), o("section", Dn, [
|
|
1817
|
+
s("h3", On, [s("span", null, E(D(m)("campus.settings.themeColor")), 1)]),
|
|
1818
|
+
s("div", {
|
|
1819
|
+
class: "ca-settings__swatches",
|
|
1820
|
+
role: "radiogroup",
|
|
1821
|
+
"aria-label": D(m)("campus.settings.themeColor")
|
|
1822
|
+
}, [(y(), o(e, null, S(I, (e) => s("button", {
|
|
1823
|
+
key: e,
|
|
1824
|
+
type: "button",
|
|
1825
|
+
role: "radio",
|
|
1826
|
+
class: h(["ca-settings__swatch", { "is-active": D(p).userPrimary?.toLowerCase() === e }]),
|
|
1827
|
+
style: g({ background: e }),
|
|
1828
|
+
"aria-label": e,
|
|
1829
|
+
"aria-checked": D(p).userPrimary?.toLowerCase() === e,
|
|
1830
|
+
onClick: (t) => D(p).setPrimary(e)
|
|
1831
|
+
}, null, 14, An)), 64)), s("label", {
|
|
1832
|
+
class: "ca-settings__swatch is-custom",
|
|
1833
|
+
title: D(m)("campus.settings.themeColorCustom")
|
|
1834
|
+
}, [s("input", {
|
|
1835
|
+
type: "color",
|
|
1836
|
+
value: L.value,
|
|
1837
|
+
"aria-label": D(m)("campus.settings.themeColorCustom"),
|
|
1838
|
+
onInput: n[5] ||= (e) => D(p).setPrimary(e.target.value)
|
|
1839
|
+
}, null, 40, Mn)], 8, jn)], 8, kn),
|
|
1840
|
+
s("button", {
|
|
1841
|
+
type: "button",
|
|
1842
|
+
class: "ca-settings__reset",
|
|
1843
|
+
disabled: !D(p).userPrimary,
|
|
1844
|
+
onClick: n[6] ||= (e) => D(p).setPrimary(void 0)
|
|
1845
|
+
}, E(D(m)("campus.settings.themeColorReset")), 9, Nn)
|
|
1846
|
+
])),
|
|
1847
|
+
s("section", Pn, [s("h3", Fn, [s("span", null, E(D(m)("campus.settings.boxStyle")), 1)]), s("div", {
|
|
1848
|
+
class: "ca-settings__segment",
|
|
1849
|
+
role: "radiogroup",
|
|
1850
|
+
"aria-label": D(m)("campus.settings.boxStyle")
|
|
1851
|
+
}, [(y(), o(e, null, S(k, (e) => s("button", {
|
|
1852
|
+
key: e.value,
|
|
1853
|
+
type: "button",
|
|
1854
|
+
role: "radio",
|
|
1855
|
+
"aria-checked": D(p).boxStyle === e.value,
|
|
1856
|
+
class: h({ "is-active": D(p).boxStyle === e.value }),
|
|
1857
|
+
onClick: (t) => D(p).setBoxStyle(e.value)
|
|
1858
|
+
}, E(D(m)(e.label)), 11, Ln)), 64))], 8, In)])
|
|
1859
|
+
]),
|
|
1860
|
+
_: 1
|
|
1861
|
+
}, 8, ["modelValue", "title"])
|
|
1862
|
+
]);
|
|
277
1863
|
};
|
|
278
|
-
e.config?.name && (t.name = String(e.config.name)), e.config?.version && (t.version = String(e.config.version)), this.context = new R(t, this.container), e.providers?.forEach((e) => this.register(e)), e.plugins?.forEach((e) => this.use(e));
|
|
279
1864
|
}
|
|
280
|
-
|
|
281
|
-
|
|
1865
|
+
}), [["__scopeId", "data-v-534bb61b"]]), zn = {
|
|
1866
|
+
key: 0,
|
|
1867
|
+
class: "ca-page-header"
|
|
1868
|
+
}, Bn = { class: "ca-page-header__top" }, Vn = { class: "ca-page-header__crumb" }, Hn = ["title", "aria-label"], Un = { class: "ca-page-header__date" }, Wn = /*#__PURE__*/ Y(/* @__PURE__ */ d({
|
|
1869
|
+
__name: "PageHeader",
|
|
1870
|
+
setup(t) {
|
|
1871
|
+
let r = V(), { t: c, label: d, locale: f } = W(), p = Z(), m = new Map(je(K().menus).map((e) => [e.key, e])), h = n(() => r.meta.pageKey ? m.get(r.meta.pageKey) : void 0), g = n(() => {
|
|
1872
|
+
let e = h.value ? Ae(h.value.key) : void 0;
|
|
1873
|
+
if (!e) return [];
|
|
1874
|
+
let t = e.titles.map((e) => d(e));
|
|
1875
|
+
return h.value?.affix ? t.filter((e, n) => e !== t[n - 1]) : t;
|
|
1876
|
+
}), v = x(/* @__PURE__ */ new Date()), b = setInterval(() => v.value = /* @__PURE__ */ new Date(), 6e4);
|
|
1877
|
+
_(() => clearInterval(b));
|
|
1878
|
+
let C = n(() => {
|
|
1879
|
+
let e = v.value;
|
|
1880
|
+
if (f.value === "zh-CN") {
|
|
1881
|
+
let t = new Intl.DateTimeFormat("zh-CN", { weekday: "long" }).format(e);
|
|
1882
|
+
return `${e.getFullYear()} 年 ${e.getMonth() + 1} 月 ${e.getDate()} 日 · ${t}`;
|
|
1883
|
+
}
|
|
1884
|
+
return new Intl.DateTimeFormat(f.value, { dateStyle: "full" }).format(e);
|
|
1885
|
+
});
|
|
1886
|
+
return (t, n) => {
|
|
1887
|
+
let r = w("ca-icon"), d = w("ca-breadcrumb-item"), f = w("ca-breadcrumb");
|
|
1888
|
+
return h.value ? (y(), o("header", zn, [s("div", Bn, [s("div", Vn, [
|
|
1889
|
+
u(r, {
|
|
1890
|
+
name: "location",
|
|
1891
|
+
class: "ca-page-header__icon"
|
|
1892
|
+
}),
|
|
1893
|
+
s("span", null, E(D(c)("campus.breadcrumb.current")), 1),
|
|
1894
|
+
u(f, { separator: ">" }, {
|
|
1895
|
+
default: M(() => [(y(!0), o(e, null, S(g.value, (e, t) => (y(), i(d, { key: t }, {
|
|
1896
|
+
default: M(() => [l(E(e), 1)]),
|
|
1897
|
+
_: 2
|
|
1898
|
+
}, 1024))), 128))]),
|
|
1899
|
+
_: 1
|
|
1900
|
+
}),
|
|
1901
|
+
a(" 刷新当前页面:重新创建页面组件,等于重新进入 "),
|
|
1902
|
+
s("button", {
|
|
1903
|
+
type: "button",
|
|
1904
|
+
class: "ca-page-header__refresh",
|
|
1905
|
+
title: D(c)("campus.tabs.refresh"),
|
|
1906
|
+
"aria-label": D(c)("campus.tabs.refresh"),
|
|
1907
|
+
onClick: n[0] ||= (e) => h.value && D(p).refresh(h.value.key)
|
|
1908
|
+
}, [u(r, { name: "refresh" })], 8, Hn)
|
|
1909
|
+
]), s("time", Un, E(C.value), 1)])])) : a("v-if", !0);
|
|
1910
|
+
};
|
|
282
1911
|
}
|
|
283
|
-
|
|
284
|
-
|
|
1912
|
+
}), [["__scopeId", "data-v-e0f9b42f"]]), Gn = {
|
|
1913
|
+
key: 0,
|
|
1914
|
+
class: "ca-page-header__main"
|
|
1915
|
+
}, Kn = { class: "ca-page-header__titles" }, qn = { class: "ca-page-header__title" }, Jn = ["title"], Yn = /*#__PURE__*/ Y(/* @__PURE__ */ d({
|
|
1916
|
+
__name: "PageTitle",
|
|
1917
|
+
setup(e) {
|
|
1918
|
+
let t = V(), { label: r } = W(), i = new Map(je(K().menus).map((e) => [e.key, e])), c = n(() => t.meta.pageKey ? i.get(t.meta.pageKey) : void 0), l = n(() => c.value ? r(c.value.title) : ""), u = n(() => c.value?.description ? r(c.value.description) : "");
|
|
1919
|
+
return (e, t) => c.value ? (y(), o("header", Gn, [
|
|
1920
|
+
s("div", Kn, [
|
|
1921
|
+
s("h2", qn, E(l.value), 1),
|
|
1922
|
+
a(" 说明和标题同一行,放不下时省略;窗口较矮时直接隐藏,把高度留给内容 "),
|
|
1923
|
+
u.value ? (y(), o("p", {
|
|
1924
|
+
key: 0,
|
|
1925
|
+
class: "ca-page-header__desc",
|
|
1926
|
+
title: u.value
|
|
1927
|
+
}, E(u.value), 9, Jn)) : a("v-if", !0)
|
|
1928
|
+
]),
|
|
1929
|
+
a(" 页面通过 <ca-page-actions> 把按钮放到这里 "),
|
|
1930
|
+
t[0] ||= s("div", {
|
|
1931
|
+
id: "ca-page-actions",
|
|
1932
|
+
class: "ca-page-header__actions"
|
|
1933
|
+
}, null, -1)
|
|
1934
|
+
])) : a("v-if", !0);
|
|
285
1935
|
}
|
|
286
|
-
|
|
287
|
-
|
|
1936
|
+
}), [["__scopeId", "data-v-e63e651d"]]), Xn = ["aria-label"], Zn = ["onClick"], Qn = { class: "ca-side__rail-list" }, $n = ["aria-current", "title"], er = [
|
|
1937
|
+
"aria-current",
|
|
1938
|
+
"title",
|
|
1939
|
+
"onClick"
|
|
1940
|
+
], tr = {
|
|
1941
|
+
key: 0,
|
|
1942
|
+
class: "ca-side__badge"
|
|
1943
|
+
}, nr = { class: "ca-side__tools" }, rr = [
|
|
1944
|
+
"title",
|
|
1945
|
+
"aria-label",
|
|
1946
|
+
"aria-pressed"
|
|
1947
|
+
], ir = [
|
|
1948
|
+
"title",
|
|
1949
|
+
"aria-label",
|
|
1950
|
+
"aria-expanded"
|
|
1951
|
+
], ar = ["title", "aria-label"], or = { class: "ca-side__avatar" }, sr = ["inert"], cr = { class: "ca-side__panel-inner" }, lr = {
|
|
1952
|
+
key: 0,
|
|
1953
|
+
class: "ca-side__title"
|
|
1954
|
+
}, ur = {
|
|
1955
|
+
key: 1,
|
|
1956
|
+
class: "ca-side__group-badge"
|
|
1957
|
+
}, dr = /*#__PURE__*/ Y(/* @__PURE__ */ d({
|
|
1958
|
+
__name: "SideMenu",
|
|
1959
|
+
setup(t) {
|
|
1960
|
+
let r = V(), c = H(), d = Q(), f = X(), { t: p, label: m } = W(), g = K(), _ = x(ge("side-collapsed") === "1");
|
|
1961
|
+
function v() {
|
|
1962
|
+
_.value = !_.value, U("side-collapsed", _.value ? "1" : "0");
|
|
1963
|
+
}
|
|
1964
|
+
let b = x(ge("side-text-hidden") === "1");
|
|
1965
|
+
function C() {
|
|
1966
|
+
b.value = !b.value, U("side-text-hidden", b.value ? "1" : "0");
|
|
1967
|
+
}
|
|
1968
|
+
async function T(e) {
|
|
1969
|
+
e === "account" ? g.accountPath && r.path !== g.accountPath && await c.push(g.accountPath) : (await d.logout(), await c.replace({ name: "login" }));
|
|
1970
|
+
}
|
|
1971
|
+
let O = n(() => g.menus.flatMap((e) => e.children.flatMap((e) => G(e) ? e.children : [e])).find((e) => e.affix && d.can(e.permission))), j = (e) => d.can(e.permission) && e.key !== O.value?.key, P = n(() => g.menus.map((e) => ({
|
|
1972
|
+
...e,
|
|
1973
|
+
children: e.children.map((e) => G(e) ? {
|
|
1974
|
+
...e,
|
|
1975
|
+
children: e.children.filter(j)
|
|
1976
|
+
} : e).filter((e) => G(e) ? e.children.length > 0 : j(e))
|
|
1977
|
+
})).filter((e) => e.children.length > 0)), F = x(), I = n(() => !!O.value && r.path === O.value.path);
|
|
1978
|
+
A(() => [r.path, r.meta.appKey], () => {
|
|
1979
|
+
F.value = I.value ? void 0 : r.meta.appKey ?? P.value[0]?.key;
|
|
1980
|
+
}, { immediate: !0 });
|
|
1981
|
+
let L = n(() => P.value.find((e) => e.key === F.value)), R = n(() => (f.mode === "pad" ? !f.padPanelOpen : _.value) || !L.value), ee = x();
|
|
1982
|
+
A(L, (e) => e && (ee.value = e), { immediate: !0 });
|
|
1983
|
+
let te = n(() => L.value ?? ee.value);
|
|
1984
|
+
function ne(e) {
|
|
1985
|
+
let t = typeof e.badge == "function" ? e.badge() : e.badge ?? 0;
|
|
1986
|
+
return t > 0 ? t : 0;
|
|
1987
|
+
}
|
|
1988
|
+
function z(e) {
|
|
1989
|
+
return e.children.reduce((e, t) => e + (G(t) ? ne(t) : 0), 0);
|
|
1990
|
+
}
|
|
1991
|
+
let B = n(() => r.meta.groupKey ? [r.meta.groupKey] : []);
|
|
1992
|
+
function re(e) {
|
|
1993
|
+
f.mode === "pad" ? f.padPanelOpen && F.value === e ? f.closePadPanel() : (F.value = e, f.openPadPanel()) : F.value = e;
|
|
1994
|
+
}
|
|
1995
|
+
let ie = n(() => (g.shortcuts ?? []).filter((e) => d.can(e.permission)));
|
|
1996
|
+
function ae(e) {
|
|
1997
|
+
f.closeOverlays(), r.path !== e && c.push(e);
|
|
1998
|
+
}
|
|
1999
|
+
return (t, n) => {
|
|
2000
|
+
let c = w("ca-icon"), x = w("ca-dropdown-item"), A = w("ca-dropdown-menu"), j = w("ca-dropdown"), F = w("ca-menu-item"), ee = w("ca-sub-menu"), V = w("ca-menu");
|
|
2001
|
+
return y(), o("aside", { class: h(["ca-side", { "is-pad-open": D(f).mode === "pad" && D(f).padPanelOpen }]) }, [
|
|
2002
|
+
ie.value.length ? (y(), o("nav", {
|
|
2003
|
+
key: 0,
|
|
2004
|
+
class: "ca-side__shortcuts",
|
|
2005
|
+
"aria-label": D(p)("campus.header.shortcuts")
|
|
2006
|
+
}, [(y(!0), o(e, null, S(ie.value, (e) => (y(), o("button", {
|
|
2007
|
+
key: e.key,
|
|
2008
|
+
type: "button",
|
|
2009
|
+
class: h({ "is-active": D(r).path === e.path }),
|
|
2010
|
+
onClick: (t) => ae(e.path)
|
|
2011
|
+
}, E(D(m)(e.title)), 11, Zn))), 128))], 8, Xn)) : a("v-if", !0),
|
|
2012
|
+
s("nav", { class: h(["ca-side__rail", { "is-compact": b.value }]) }, [
|
|
2013
|
+
a(" 入口列表单独滚动;底部工具按钮固定在外面,窗口再矮也不会被挤出屏幕 "),
|
|
2014
|
+
s("div", Qn, [O.value ? (y(), o("button", {
|
|
2015
|
+
key: 0,
|
|
2016
|
+
type: "button",
|
|
2017
|
+
class: h(["ca-side__rail-item", { "is-active": I.value }]),
|
|
2018
|
+
"aria-current": I.value ? "page" : void 0,
|
|
2019
|
+
title: b.value ? D(p)("campus.side.home") : void 0,
|
|
2020
|
+
onClick: n[0] ||= (e) => ae(O.value.path)
|
|
2021
|
+
}, [u(c, {
|
|
2022
|
+
name: "home",
|
|
2023
|
+
size: 20
|
|
2024
|
+
}), N(s("span", { class: "ca-side__rail-text" }, E(D(p)("campus.side.home")), 513), [[k, !b.value || D(f).mobileMenuOpen]])], 10, $n)) : a("v-if", !0), (y(!0), o(e, null, S(P.value, (e) => (y(), o("button", {
|
|
2025
|
+
key: e.key,
|
|
2026
|
+
type: "button",
|
|
2027
|
+
class: h(["ca-side__rail-item", { "is-active": e.key === L.value?.key }]),
|
|
2028
|
+
"aria-current": e.key === L.value?.key ? "true" : void 0,
|
|
2029
|
+
title: b.value ? D(m)(e.title) : void 0,
|
|
2030
|
+
onClick: (t) => re(e.key)
|
|
2031
|
+
}, [
|
|
2032
|
+
u(c, {
|
|
2033
|
+
name: e.icon ?? "grid",
|
|
2034
|
+
size: 20
|
|
2035
|
+
}, null, 8, ["name"]),
|
|
2036
|
+
N(s("span", { class: "ca-side__rail-text" }, E(D(m)(e.title)), 513), [[k, !b.value || D(f).mobileMenuOpen]]),
|
|
2037
|
+
z(e) ? (y(), o("span", tr, E(z(e)), 1)) : a("v-if", !0)
|
|
2038
|
+
], 10, er))), 128))]),
|
|
2039
|
+
s("div", nr, [
|
|
2040
|
+
s("button", {
|
|
2041
|
+
type: "button",
|
|
2042
|
+
class: "ca-side__tool",
|
|
2043
|
+
title: b.value ? D(p)("campus.side.showText") : D(p)("campus.side.hideText"),
|
|
2044
|
+
"aria-label": b.value ? D(p)("campus.side.showText") : D(p)("campus.side.hideText"),
|
|
2045
|
+
"aria-pressed": b.value,
|
|
2046
|
+
onClick: C
|
|
2047
|
+
}, [u(c, {
|
|
2048
|
+
name: b.value ? "view" : "hide",
|
|
2049
|
+
size: 18
|
|
2050
|
+
}, null, 8, ["name"])], 8, rr),
|
|
2051
|
+
s("button", {
|
|
2052
|
+
type: "button",
|
|
2053
|
+
class: "ca-side__tool ca-side__tool--collapse",
|
|
2054
|
+
title: _.value ? D(p)("campus.side.expand") : D(p)("campus.side.collapse"),
|
|
2055
|
+
"aria-label": _.value ? D(p)("campus.side.expand") : D(p)("campus.side.collapse"),
|
|
2056
|
+
"aria-expanded": !_.value,
|
|
2057
|
+
onClick: v
|
|
2058
|
+
}, [u(c, {
|
|
2059
|
+
name: _.value ? "expand" : "fold",
|
|
2060
|
+
size: 18
|
|
2061
|
+
}, null, 8, ["name"])], 8, ir),
|
|
2062
|
+
u(j, {
|
|
2063
|
+
trigger: "click",
|
|
2064
|
+
placement: "right-end",
|
|
2065
|
+
onCommand: T
|
|
2066
|
+
}, {
|
|
2067
|
+
dropdown: M(() => [u(A, null, {
|
|
2068
|
+
default: M(() => [D(g).accountPath ? (y(), i(x, {
|
|
2069
|
+
key: 0,
|
|
2070
|
+
command: "account"
|
|
2071
|
+
}, {
|
|
2072
|
+
default: M(() => [l(E(D(p)("campus.header.myAccount")), 1)]),
|
|
2073
|
+
_: 1
|
|
2074
|
+
})) : a("v-if", !0), u(x, {
|
|
2075
|
+
command: "logout",
|
|
2076
|
+
divided: ""
|
|
2077
|
+
}, {
|
|
2078
|
+
default: M(() => [l(E(D(p)("campus.header.logout")), 1)]),
|
|
2079
|
+
_: 1
|
|
2080
|
+
})]),
|
|
2081
|
+
_: 1
|
|
2082
|
+
})]),
|
|
2083
|
+
default: M(() => [s("button", {
|
|
2084
|
+
type: "button",
|
|
2085
|
+
class: "ca-side__tool",
|
|
2086
|
+
title: D(d).user?.name,
|
|
2087
|
+
"aria-label": D(d).user?.name
|
|
2088
|
+
}, [s("span", or, E(D(d).user?.name.slice(0, 1)), 1)], 8, ar)]),
|
|
2089
|
+
_: 1
|
|
2090
|
+
})
|
|
2091
|
+
])
|
|
2092
|
+
], 2),
|
|
2093
|
+
a(" 第二栏:隐藏时宽度渐变到 0(而不是直接消失),首页与其他页之间切换时内容区不会突然跳动 "),
|
|
2094
|
+
s("div", {
|
|
2095
|
+
class: h(["ca-side__panel", { "is-hidden": R.value }]),
|
|
2096
|
+
inert: R.value && !D(f).mobileMenuOpen
|
|
2097
|
+
}, [s("div", cr, [
|
|
2098
|
+
te.value ? (y(), o("div", lr, E(D(m)(te.value.title)), 1)) : a("v-if", !0),
|
|
2099
|
+
a(" key 绑定场景:切换场景时重建菜单,展开状态不会串到别的场景 "),
|
|
2100
|
+
(y(), i(V, {
|
|
2101
|
+
key: te.value?.key,
|
|
2102
|
+
"default-active": D(r).path,
|
|
2103
|
+
"default-openeds": B.value,
|
|
2104
|
+
router: "",
|
|
2105
|
+
class: "ca-side__menu",
|
|
2106
|
+
onSelect: n[1] ||= (e) => D(f).closeOverlays()
|
|
2107
|
+
}, {
|
|
2108
|
+
default: M(() => [(y(!0), o(e, null, S(te.value?.children ?? [], (t) => (y(), o(e, { key: t.key }, [a(" 二级是菜单组:可展开,下面是三级页面 "), D(G)(t) ? (y(), i(ee, {
|
|
2109
|
+
key: 0,
|
|
2110
|
+
index: t.key
|
|
2111
|
+
}, {
|
|
2112
|
+
title: M(() => [
|
|
2113
|
+
t.icon ? (y(), i(c, {
|
|
2114
|
+
key: 0,
|
|
2115
|
+
name: t.icon
|
|
2116
|
+
}, null, 8, ["name"])) : a("v-if", !0),
|
|
2117
|
+
s("span", null, E(D(m)(t.title)), 1),
|
|
2118
|
+
ne(t) ? (y(), o("span", ur, E(ne(t)), 1)) : a("v-if", !0)
|
|
2119
|
+
]),
|
|
2120
|
+
default: M(() => [(y(!0), o(e, null, S(t.children, (e) => (y(), i(F, {
|
|
2121
|
+
key: e.key,
|
|
2122
|
+
index: e.path
|
|
2123
|
+
}, {
|
|
2124
|
+
default: M(() => [s("span", null, E(D(m)(e.title)), 1)]),
|
|
2125
|
+
_: 2
|
|
2126
|
+
}, 1032, ["index"]))), 128))]),
|
|
2127
|
+
_: 2
|
|
2128
|
+
}, 1032, ["index"])) : (y(), o(e, { key: 1 }, [a(" 二级直接是页面 "), u(F, { index: t.path }, {
|
|
2129
|
+
default: M(() => [t.icon ? (y(), i(c, {
|
|
2130
|
+
key: 0,
|
|
2131
|
+
name: t.icon
|
|
2132
|
+
}, null, 8, ["name"])) : a("v-if", !0), s("span", null, E(D(m)(t.title)), 1)]),
|
|
2133
|
+
_: 2
|
|
2134
|
+
}, 1032, ["index"])], 2112))], 64))), 128))]),
|
|
2135
|
+
_: 1
|
|
2136
|
+
}, 8, ["default-active", "default-openeds"]))
|
|
2137
|
+
])], 10, sr)
|
|
2138
|
+
], 2);
|
|
2139
|
+
};
|
|
288
2140
|
}
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
2141
|
+
}), [["__scopeId", "data-v-4ddc6313"]]), fr = {
|
|
2142
|
+
key: 0,
|
|
2143
|
+
class: "ca-copyright"
|
|
2144
|
+
}, pr = ["href"], mr = /*#__PURE__*/ Y(/* @__PURE__ */ d({
|
|
2145
|
+
__name: "CaCopyright",
|
|
2146
|
+
setup(t) {
|
|
2147
|
+
let r = K().brand, { label: i } = W(), c = n(() => r.copyright ? Be(i(r.copyright)) : ""), l = n(() => r.copyrightLinks ?? []);
|
|
2148
|
+
return (t, n) => c.value ? (y(), o("footer", fr, [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", {
|
|
2149
|
+
class: "ca-copyright__dot",
|
|
2150
|
+
"aria-hidden": "true"
|
|
2151
|
+
}, "·", -1), s("a", {
|
|
2152
|
+
href: t.href,
|
|
2153
|
+
target: "_blank",
|
|
2154
|
+
rel: "noopener noreferrer"
|
|
2155
|
+
}, E(t.text), 9, pr)], 64))), 128))])) : a("v-if", !0);
|
|
294
2156
|
}
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
2157
|
+
}), [["__scopeId", "data-v-c51879e8"]]), hr = { class: "ca-tabs" }, gr = ["onClick"], _r = { class: "ca-tabs__more" }, vr = [
|
|
2158
|
+
"title",
|
|
2159
|
+
"aria-label",
|
|
2160
|
+
"aria-pressed"
|
|
2161
|
+
], yr = /*#__PURE__*/ Y(/* @__PURE__ */ d({
|
|
2162
|
+
__name: "TabsBar",
|
|
2163
|
+
setup(t) {
|
|
2164
|
+
let r = V(), c = H(), d = Z(), f = X(), { t: p, label: g } = W(), _ = new Map(je(K().menus).map((e) => [e.key, e])), b = n(() => d.visited.map((e) => _.get(e)).filter((e) => !!e).map((e) => ({
|
|
2165
|
+
key: e.key,
|
|
2166
|
+
path: e.path,
|
|
2167
|
+
title: g(e.title),
|
|
2168
|
+
closable: !e.affix,
|
|
2169
|
+
icon: e.affix ? e.icon : void 0
|
|
2170
|
+
}))), C = n(() => r.meta.pageKey), T = n(() => [{
|
|
2171
|
+
name: "fixed",
|
|
2172
|
+
scroll: !1,
|
|
2173
|
+
items: b.value.filter((e) => !e.closable)
|
|
2174
|
+
}, {
|
|
2175
|
+
name: "list",
|
|
2176
|
+
scroll: !0,
|
|
2177
|
+
items: b.value.filter((e) => e.closable)
|
|
2178
|
+
}]), O = x();
|
|
2179
|
+
function k() {
|
|
2180
|
+
m(() => {
|
|
2181
|
+
O.value?.querySelector(".is-active")?.scrollIntoView({
|
|
2182
|
+
inline: "nearest",
|
|
2183
|
+
block: "nearest",
|
|
2184
|
+
behavior: "smooth"
|
|
2185
|
+
});
|
|
2186
|
+
});
|
|
2187
|
+
}
|
|
2188
|
+
A([C, () => b.value.length], k), v(k);
|
|
2189
|
+
function j(e) {
|
|
2190
|
+
let t = d.close(e);
|
|
2191
|
+
if (e !== C.value) return;
|
|
2192
|
+
let n = t ? _.get(t)?.path : void 0;
|
|
2193
|
+
c.push(n ?? "/");
|
|
2194
|
+
}
|
|
2195
|
+
let N = n(() => {
|
|
2196
|
+
let e = d.visited.indexOf(C.value ?? "");
|
|
2197
|
+
return d.visited.some((t, n) => n < e && !d.affixKeys.includes(t));
|
|
2198
|
+
}), F = n(() => {
|
|
2199
|
+
let e = d.visited.indexOf(C.value ?? "");
|
|
2200
|
+
return e !== -1 && d.visited.some((t, n) => n > e && !d.affixKeys.includes(t));
|
|
2201
|
+
});
|
|
2202
|
+
function I(e) {
|
|
2203
|
+
let t = C.value;
|
|
2204
|
+
e === "closeAll" ? (d.closeAll(), c.push(_.get(d.affixKeys[0] ?? "")?.path ?? "/")) : t && (e === "close" ? j(t) : e === "closeLeft" ? d.closeLeft(t) : e === "closeRight" ? d.closeRight(t) : d.closeOthers(t));
|
|
2205
|
+
}
|
|
2206
|
+
return (t, n) => {
|
|
2207
|
+
let r = w("ca-icon"), d = w("ca-dropdown-item"), m = w("ca-dropdown-menu"), g = w("ca-dropdown");
|
|
2208
|
+
return y(), o("div", hr, [
|
|
2209
|
+
(y(!0), o(e, null, S(T.value, (t) => (y(), o("div", {
|
|
2210
|
+
key: t.name,
|
|
2211
|
+
ref_for: !0,
|
|
2212
|
+
ref: (e) => {
|
|
2213
|
+
t.scroll && (O.value = e);
|
|
2214
|
+
},
|
|
2215
|
+
class: h(t.scroll ? "ca-tabs__list" : "ca-tabs__fixed")
|
|
2216
|
+
}, [(y(!0), o(e, null, S(t.items, (e) => (y(), o("div", {
|
|
2217
|
+
key: e.key,
|
|
2218
|
+
class: h(["ca-tabs__item", { "is-active": e.key === C.value }]),
|
|
2219
|
+
onClick: (t) => D(c).push(e.path)
|
|
2220
|
+
}, [
|
|
2221
|
+
e.icon ? (y(), i(r, {
|
|
2222
|
+
key: 0,
|
|
2223
|
+
name: e.icon
|
|
2224
|
+
}, null, 8, ["name"])) : a("v-if", !0),
|
|
2225
|
+
s("span", null, E(e.title), 1),
|
|
2226
|
+
e.closable ? (y(), i(r, {
|
|
2227
|
+
key: 1,
|
|
2228
|
+
name: "close",
|
|
2229
|
+
class: "ca-tabs__close",
|
|
2230
|
+
onClick: P((t) => j(e.key), ["stop"])
|
|
2231
|
+
}, null, 8, ["onClick"])) : a("v-if", !0)
|
|
2232
|
+
], 10, gr))), 128))], 2))), 128)),
|
|
2233
|
+
u(g, {
|
|
2234
|
+
trigger: "click",
|
|
2235
|
+
onCommand: I
|
|
2236
|
+
}, {
|
|
2237
|
+
dropdown: M(() => [u(m, null, {
|
|
2238
|
+
default: M(() => [
|
|
2239
|
+
u(d, { command: "close" }, {
|
|
2240
|
+
default: M(() => [l(E(D(p)("campus.tabs.close")), 1)]),
|
|
2241
|
+
_: 1
|
|
2242
|
+
}),
|
|
2243
|
+
N.value ? (y(), i(d, {
|
|
2244
|
+
key: 0,
|
|
2245
|
+
command: "closeLeft"
|
|
2246
|
+
}, {
|
|
2247
|
+
default: M(() => [l(E(D(p)("campus.tabs.closeLeft")), 1)]),
|
|
2248
|
+
_: 1
|
|
2249
|
+
})) : a("v-if", !0),
|
|
2250
|
+
F.value ? (y(), i(d, {
|
|
2251
|
+
key: 1,
|
|
2252
|
+
command: "closeRight"
|
|
2253
|
+
}, {
|
|
2254
|
+
default: M(() => [l(E(D(p)("campus.tabs.closeRight")), 1)]),
|
|
2255
|
+
_: 1
|
|
2256
|
+
})) : a("v-if", !0),
|
|
2257
|
+
u(d, { command: "closeOthers" }, {
|
|
2258
|
+
default: M(() => [l(E(D(p)("campus.tabs.closeOthers")), 1)]),
|
|
2259
|
+
_: 1
|
|
2260
|
+
}),
|
|
2261
|
+
u(d, { command: "closeAll" }, {
|
|
2262
|
+
default: M(() => [l(E(D(p)("campus.tabs.closeAll")), 1)]),
|
|
2263
|
+
_: 1
|
|
2264
|
+
})
|
|
2265
|
+
]),
|
|
2266
|
+
_: 1
|
|
2267
|
+
})]),
|
|
2268
|
+
default: M(() => [s("span", _r, [u(r, { name: "arrowDown" })])]),
|
|
2269
|
+
_: 1
|
|
2270
|
+
}),
|
|
2271
|
+
a(" 内容全屏:隐藏头部和侧栏,再点一次恢复 "),
|
|
2272
|
+
s("button", {
|
|
2273
|
+
type: "button",
|
|
2274
|
+
class: "ca-tabs__more ca-tabs__fullscreen",
|
|
2275
|
+
title: D(f).contentFullscreen ? D(p)("campus.tabs.exitFullscreen") : D(p)("campus.tabs.fullscreen"),
|
|
2276
|
+
"aria-label": D(f).contentFullscreen ? D(p)("campus.tabs.exitFullscreen") : D(p)("campus.tabs.fullscreen"),
|
|
2277
|
+
"aria-pressed": D(f).contentFullscreen,
|
|
2278
|
+
onClick: n[0] ||= (e) => D(f).toggleContentFullscreen()
|
|
2279
|
+
}, [u(r, { name: D(f).contentFullscreen ? "exitFullscreen" : "fullscreen" }, null, 8, ["name"])], 8, vr)
|
|
2280
|
+
]);
|
|
2281
|
+
};
|
|
299
2282
|
}
|
|
300
|
-
|
|
301
|
-
|
|
2283
|
+
}), [["__scopeId", "data-v-1d7ba823"]]), br = 1200, xr = "(max-width: 768px)", Sr = `(min-width: 769px) and (max-width: ${br}px)`, Cr = ["aria-label"], wr = ["aria-label"], Tr = { class: "ca-main" }, Er = { class: "ca-content" }, Dr = { class: "ca-content__page" }, Or = /*#__PURE__*/ Y(/* @__PURE__ */ d({
|
|
2284
|
+
__name: "CaLayout",
|
|
2285
|
+
setup(e) {
|
|
2286
|
+
let n = V(), r = Z(), c = X(), { t: l } = W(), d = window.matchMedia(xr), f = window.matchMedia(Sr), p = "";
|
|
2287
|
+
function m() {
|
|
2288
|
+
let e = d.matches ? "phone" : f.matches ? "pad" : "desktop";
|
|
2289
|
+
c.setMode(e);
|
|
2290
|
+
}
|
|
2291
|
+
m(), A(() => c.mode === "phone" && c.mobileMenuOpen, (e) => {
|
|
2292
|
+
e ? (p = document.body.style.overflow, document.body.style.overflow = "hidden") : document.body.style.overflow = p;
|
|
2293
|
+
}), A(() => n.fullPath, () => c.closeOverlays());
|
|
2294
|
+
function g(e) {
|
|
2295
|
+
e.key === "Escape" && (c.mobileMenuOpen || c.padPanelOpen ? c.closeOverlays() : c.contentFullscreen && c.toggleContentFullscreen());
|
|
2296
|
+
}
|
|
2297
|
+
v(() => {
|
|
2298
|
+
m(), d.addEventListener("change", m), f.addEventListener("change", m), window.addEventListener("keydown", g);
|
|
2299
|
+
}), _(() => {
|
|
2300
|
+
d.removeEventListener("change", m), f.removeEventListener("change", m), window.removeEventListener("keydown", g), document.body.style.overflow = p;
|
|
2301
|
+
});
|
|
2302
|
+
function b() {
|
|
2303
|
+
let e = n.meta.pageKey;
|
|
2304
|
+
return e ? `${e}:${r.versions[e] ?? 0}` : n.fullPath;
|
|
2305
|
+
}
|
|
2306
|
+
return (e, n) => {
|
|
2307
|
+
let d = w("router-view");
|
|
2308
|
+
return y(), o("div", { class: h(["ca-shell", { "is-fullscreen": D(c).contentFullscreen }]) }, [N(u(Rn, null, null, 512), [[k, !D(c).contentFullscreen]]), s("div", { class: h(["ca-body", { "is-fullscreen": D(c).contentFullscreen }]) }, [
|
|
2309
|
+
D(c).mode === "phone" && D(c).mobileMenuOpen ? (y(), o("button", {
|
|
2310
|
+
key: 0,
|
|
2311
|
+
type: "button",
|
|
2312
|
+
class: "ca-mobile-scrim",
|
|
2313
|
+
"aria-label": D(l)("campus.side.closeMenu"),
|
|
2314
|
+
onClick: n[0] ||= (e) => D(c).closeMobileMenu()
|
|
2315
|
+
}, null, 8, Cr)) : a("v-if", !0),
|
|
2316
|
+
D(c).mode === "pad" && D(c).padPanelOpen ? (y(), o("button", {
|
|
2317
|
+
key: 1,
|
|
2318
|
+
type: "button",
|
|
2319
|
+
class: "ca-pad-scrim",
|
|
2320
|
+
"aria-label": D(l)("campus.side.closeMenu"),
|
|
2321
|
+
onClick: n[1] ||= (e) => D(c).closePadPanel()
|
|
2322
|
+
}, null, 8, wr)) : a("v-if", !0),
|
|
2323
|
+
N(u(dr, {
|
|
2324
|
+
class: h({ "is-mobile-open": D(c).mobileMenuOpen }),
|
|
2325
|
+
inert: D(c).mode === "phone" && !D(c).mobileMenuOpen
|
|
2326
|
+
}, null, 8, ["class", "inert"]), [[k, !D(c).contentFullscreen]]),
|
|
2327
|
+
s("main", Tr, [
|
|
2328
|
+
u(yr),
|
|
2329
|
+
u(Wn),
|
|
2330
|
+
s("div", Er, [
|
|
2331
|
+
u(Yn),
|
|
2332
|
+
a(" 页面区撑满剩余高度,版权在其后:内容少时贴窗口底,内容长时滚到最底才出现 "),
|
|
2333
|
+
s("div", Dr, [u(d, null, {
|
|
2334
|
+
default: M(({ Component: e }) => [a(" include 与标签名单同步;缓存容量包含固定标签。 "), (y(), i(t, {
|
|
2335
|
+
include: D(r).cached,
|
|
2336
|
+
max: D(r).maxTabs + D(r).affixKeys.length
|
|
2337
|
+
}, [e ? (y(), i(T(e), { key: b() })) : a("v-if", !0)], 1032, ["include", "max"]))]),
|
|
2338
|
+
_: 1
|
|
2339
|
+
})]),
|
|
2340
|
+
u(mr)
|
|
2341
|
+
])
|
|
2342
|
+
])
|
|
2343
|
+
], 2)], 2);
|
|
2344
|
+
};
|
|
302
2345
|
}
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
2346
|
+
}), [["__scopeId", "data-v-3a849ce7"]]), kr = { class: "ca-exception" }, Ar = { class: "ca-exception__code" }, jr = { class: "ca-exception__text" }, Mr = /*#__PURE__*/ Y(/* @__PURE__ */ d({
|
|
2347
|
+
__name: "ExceptionPage",
|
|
2348
|
+
props: { kind: {} },
|
|
2349
|
+
setup(e) {
|
|
2350
|
+
let t = e, r = H(), { t: i } = W(), a = n(() => t.kind === "forbidden" ? "403" : "404"), c = n(() => i(t.kind === "forbidden" ? "campus.error.forbidden" : "campus.error.notFound"));
|
|
2351
|
+
return (e, t) => {
|
|
2352
|
+
let n = w("ca-button");
|
|
2353
|
+
return y(), o("div", kr, [
|
|
2354
|
+
s("div", Ar, E(a.value), 1),
|
|
2355
|
+
s("p", jr, E(c.value), 1),
|
|
2356
|
+
u(n, {
|
|
2357
|
+
type: "primary",
|
|
2358
|
+
onClick: t[0] ||= (e) => D(r).replace("/")
|
|
2359
|
+
}, {
|
|
2360
|
+
default: M(() => [l(E(D(i)("campus.error.backHome")), 1)]),
|
|
2361
|
+
_: 1
|
|
2362
|
+
})
|
|
2363
|
+
]);
|
|
2364
|
+
};
|
|
306
2365
|
}
|
|
307
|
-
|
|
308
|
-
|
|
2366
|
+
}), [["__scopeId", "data-v-ffcb23b0"]]), Nr = { class: "ca-login" }, Pr = { class: "ca-login__main" }, Fr = { class: "ca-login__card" }, Ir = { class: "ca-login__brand" }, Lr = ["src"], Rr = { class: "ca-login__name" }, zr = {
|
|
2367
|
+
key: 1,
|
|
2368
|
+
class: "ca-login__subtitle"
|
|
2369
|
+
}, Br = /*#__PURE__*/ Y(/* @__PURE__ */ d({
|
|
2370
|
+
__name: "LoginPage",
|
|
2371
|
+
setup(e) {
|
|
2372
|
+
let t = V(), r = H(), c = Q(), d = ze(), { t: f, label: p } = W(), m = K().brand, h = n(() => p(d.theme.siteName ?? m.name)), g = n(() => d.theme.logo ?? m.logo), _ = J(), v = b({
|
|
2373
|
+
username: "",
|
|
2374
|
+
password: "",
|
|
2375
|
+
captcha: ""
|
|
2376
|
+
}), S = x(""), C = x(), T = x(), O = x(!1), k = x(""), A = n(() => ({
|
|
2377
|
+
username: [{
|
|
2378
|
+
required: !0,
|
|
2379
|
+
message: f("campus.login.required", { label: f("campus.login.username") }),
|
|
2380
|
+
trigger: "blur"
|
|
2381
|
+
}],
|
|
2382
|
+
password: [{
|
|
2383
|
+
required: !0,
|
|
2384
|
+
message: f("campus.login.required", { label: f("campus.login.password") }),
|
|
2385
|
+
trigger: "blur"
|
|
2386
|
+
}],
|
|
2387
|
+
captcha: _.captcha ? [{
|
|
2388
|
+
required: !0,
|
|
2389
|
+
message: f("campus.auth.captchaRequired"),
|
|
2390
|
+
trigger: "blur"
|
|
2391
|
+
}] : []
|
|
2392
|
+
}));
|
|
2393
|
+
async function j() {
|
|
2394
|
+
try {
|
|
2395
|
+
await T.value?.validate();
|
|
2396
|
+
} catch {
|
|
2397
|
+
return;
|
|
2398
|
+
}
|
|
2399
|
+
O.value = !0, k.value = "";
|
|
2400
|
+
try {
|
|
2401
|
+
await c.login({
|
|
2402
|
+
username: v.username,
|
|
2403
|
+
password: v.password,
|
|
2404
|
+
captcha: _.captcha ? {
|
|
2405
|
+
key: S.value,
|
|
2406
|
+
code: v.captcha
|
|
2407
|
+
} : void 0
|
|
2408
|
+
}), await r.replace(He(t.query.redirect));
|
|
2409
|
+
} catch (e) {
|
|
2410
|
+
k.value = e instanceof Error && e.message ? e.message : f("campus.login.failed"), C.value?.refresh();
|
|
2411
|
+
} finally {
|
|
2412
|
+
O.value = !1;
|
|
2413
|
+
}
|
|
2414
|
+
}
|
|
2415
|
+
return (e, t) => {
|
|
2416
|
+
let n = w("ca-alert"), r = w("ca-input"), c = w("ca-form-item"), d = w("ca-button"), b = w("ca-form");
|
|
2417
|
+
return y(), o("div", Nr, [s("div", Pr, [s("div", Fr, [
|
|
2418
|
+
s("div", Ir, [
|
|
2419
|
+
g.value ? (y(), o("img", {
|
|
2420
|
+
key: 0,
|
|
2421
|
+
src: g.value,
|
|
2422
|
+
alt: "",
|
|
2423
|
+
class: "ca-login__logo"
|
|
2424
|
+
}, null, 8, Lr)) : a("v-if", !0),
|
|
2425
|
+
s("h1", Rr, E(h.value), 1),
|
|
2426
|
+
D(m).subtitle ? (y(), o("p", zr, E(D(p)(D(m).subtitle)), 1)) : a("v-if", !0)
|
|
2427
|
+
]),
|
|
2428
|
+
k.value ? (y(), i(n, {
|
|
2429
|
+
key: 0,
|
|
2430
|
+
title: k.value,
|
|
2431
|
+
type: "error",
|
|
2432
|
+
"show-icon": "",
|
|
2433
|
+
closable: !1,
|
|
2434
|
+
class: "ca-login__error"
|
|
2435
|
+
}, null, 8, ["title"])) : a("v-if", !0),
|
|
2436
|
+
u(b, {
|
|
2437
|
+
ref_key: "formRef",
|
|
2438
|
+
ref: T,
|
|
2439
|
+
model: v,
|
|
2440
|
+
rules: A.value,
|
|
2441
|
+
size: "large",
|
|
2442
|
+
class: "ca-auth-form",
|
|
2443
|
+
onSubmit: P(j, ["prevent"])
|
|
2444
|
+
}, {
|
|
2445
|
+
default: M(() => [
|
|
2446
|
+
u(c, { prop: "username" }, {
|
|
2447
|
+
default: M(() => [u(r, {
|
|
2448
|
+
modelValue: v.username,
|
|
2449
|
+
"onUpdate:modelValue": t[0] ||= (e) => v.username = e,
|
|
2450
|
+
placeholder: D(f)("campus.login.username"),
|
|
2451
|
+
autocomplete: "username"
|
|
2452
|
+
}, null, 8, ["modelValue", "placeholder"])]),
|
|
2453
|
+
_: 1
|
|
2454
|
+
}),
|
|
2455
|
+
u(c, { prop: "password" }, {
|
|
2456
|
+
default: M(() => [u(r, {
|
|
2457
|
+
modelValue: v.password,
|
|
2458
|
+
"onUpdate:modelValue": t[1] ||= (e) => v.password = e,
|
|
2459
|
+
type: "password",
|
|
2460
|
+
"show-password": "",
|
|
2461
|
+
placeholder: D(f)("campus.login.password"),
|
|
2462
|
+
autocomplete: "current-password"
|
|
2463
|
+
}, null, 8, ["modelValue", "placeholder"])]),
|
|
2464
|
+
_: 1
|
|
2465
|
+
}),
|
|
2466
|
+
D(_).captcha ? (y(), i(c, {
|
|
2467
|
+
key: 0,
|
|
2468
|
+
prop: "captcha"
|
|
2469
|
+
}, {
|
|
2470
|
+
default: M(() => [u(gt, {
|
|
2471
|
+
ref_key: "captchaRef",
|
|
2472
|
+
ref: C,
|
|
2473
|
+
code: v.captcha,
|
|
2474
|
+
"onUpdate:code": t[2] ||= (e) => v.captcha = e,
|
|
2475
|
+
"captcha-key": S.value,
|
|
2476
|
+
"onUpdate:captchaKey": t[3] ||= (e) => S.value = e,
|
|
2477
|
+
scene: "login"
|
|
2478
|
+
}, null, 8, ["code", "captcha-key"])]),
|
|
2479
|
+
_: 1
|
|
2480
|
+
})) : a("v-if", !0),
|
|
2481
|
+
u(d, {
|
|
2482
|
+
type: "primary",
|
|
2483
|
+
"native-type": "submit",
|
|
2484
|
+
loading: O.value,
|
|
2485
|
+
class: "ca-login__submit"
|
|
2486
|
+
}, {
|
|
2487
|
+
default: M(() => [l(E(D(f)("campus.login.submit")), 1)]),
|
|
2488
|
+
_: 1
|
|
2489
|
+
}, 8, ["loading"])
|
|
2490
|
+
]),
|
|
2491
|
+
_: 1
|
|
2492
|
+
}, 8, ["model", "rules"])
|
|
2493
|
+
])]), u(mr, { class: "ca-login__copyright" })]);
|
|
2494
|
+
};
|
|
309
2495
|
}
|
|
310
|
-
};
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
2496
|
+
}), [["__scopeId", "data-v-ddf636fd"]]);
|
|
2497
|
+
// packages/core/src/router.ts
|
|
2498
|
+
function Vr(e) {
|
|
2499
|
+
return async () => {
|
|
2500
|
+
let t = await e.component();
|
|
2501
|
+
return d({
|
|
2502
|
+
name: e.key,
|
|
2503
|
+
setup: () => () => f(t.default)
|
|
2504
|
+
});
|
|
2505
|
+
};
|
|
319
2506
|
}
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
campus: e,
|
|
338
|
-
get vue() {
|
|
339
|
-
return n;
|
|
340
|
-
},
|
|
341
|
-
component(e, i) {
|
|
342
|
-
return t.set(e, i), n && n.component(e, i), r;
|
|
343
|
-
},
|
|
344
|
-
register(t) {
|
|
345
|
-
return e.register(t), r;
|
|
2507
|
+
var Hr = d({
|
|
2508
|
+
name: "CaForbidden",
|
|
2509
|
+
setup: () => () => f(Mr, { kind: "forbidden" })
|
|
2510
|
+
}), Ur = d({
|
|
2511
|
+
name: "CaNotFound",
|
|
2512
|
+
setup: () => () => f(Mr, { kind: "notFound" })
|
|
2513
|
+
});
|
|
2514
|
+
function Wr(e, t) {
|
|
2515
|
+
let n = je(e.menus);
|
|
2516
|
+
if (!n.length) throw Error("[campus] 菜单里至少需要一个页面");
|
|
2517
|
+
Me(e.accountPath, n);
|
|
2518
|
+
let r = [
|
|
2519
|
+
{
|
|
2520
|
+
path: "/login",
|
|
2521
|
+
name: "login",
|
|
2522
|
+
component: e.login?.style === "split" ? At : Br,
|
|
2523
|
+
meta: { public: !0 }
|
|
346
2524
|
},
|
|
347
|
-
|
|
348
|
-
|
|
2525
|
+
{
|
|
2526
|
+
path: "/register",
|
|
2527
|
+
name: "register",
|
|
2528
|
+
component: Zt,
|
|
2529
|
+
meta: { public: !0 }
|
|
349
2530
|
},
|
|
350
|
-
|
|
351
|
-
|
|
2531
|
+
{
|
|
2532
|
+
path: "/forgot",
|
|
2533
|
+
name: "forgot",
|
|
2534
|
+
component: tn,
|
|
2535
|
+
meta: { public: !0 }
|
|
352
2536
|
},
|
|
353
|
-
|
|
354
|
-
|
|
2537
|
+
{
|
|
2538
|
+
path: "/",
|
|
2539
|
+
component: Or,
|
|
2540
|
+
redirect: n.some((e) => e.path === "/") ? void 0 : () => {
|
|
2541
|
+
let e = Q(t);
|
|
2542
|
+
return n.find((t) => e.can(t.permission))?.path ?? "/403";
|
|
2543
|
+
},
|
|
2544
|
+
children: [
|
|
2545
|
+
...n.map((e) => ({
|
|
2546
|
+
path: e.path,
|
|
2547
|
+
name: e.key,
|
|
2548
|
+
component: Vr(e),
|
|
2549
|
+
meta: {
|
|
2550
|
+
pageKey: e.key,
|
|
2551
|
+
appKey: e.appKey,
|
|
2552
|
+
groupKey: e.groupKey,
|
|
2553
|
+
permission: e.permission
|
|
2554
|
+
}
|
|
2555
|
+
})),
|
|
2556
|
+
{
|
|
2557
|
+
path: "/403",
|
|
2558
|
+
name: "forbidden",
|
|
2559
|
+
component: Hr
|
|
2560
|
+
},
|
|
2561
|
+
{
|
|
2562
|
+
path: "/:pathMatch(.*)*",
|
|
2563
|
+
name: "not-found",
|
|
2564
|
+
component: Ur
|
|
2565
|
+
}
|
|
2566
|
+
]
|
|
355
2567
|
}
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
//#endregion
|
|
360
|
-
//#region src/campus.ts
|
|
361
|
-
var W = Symbol("campus");
|
|
362
|
-
function qe() {
|
|
363
|
-
return m(W, void 0) ?? H();
|
|
364
|
-
}
|
|
365
|
-
//#endregion
|
|
366
|
-
//#region src/services/loading.ts
|
|
367
|
-
var G = new D({
|
|
368
|
-
visible: !1,
|
|
369
|
-
text: ""
|
|
370
|
-
});
|
|
371
|
-
function K(e = "") {
|
|
372
|
-
return G.set({
|
|
373
|
-
visible: !0,
|
|
374
|
-
text: e
|
|
375
|
-
}), { hide: () => q() };
|
|
376
|
-
}
|
|
377
|
-
function q() {
|
|
378
|
-
G.set({
|
|
379
|
-
visible: !1,
|
|
380
|
-
text: ""
|
|
2568
|
+
], i = re({
|
|
2569
|
+
history: e.history === "web" ? ae() : ie(),
|
|
2570
|
+
routes: r
|
|
381
2571
|
});
|
|
2572
|
+
return i.beforeEach((e) => {
|
|
2573
|
+
let n = Q(t);
|
|
2574
|
+
return e.meta.public ? n.isLoggedIn && e.name === "login" ? { path: "/" } : !0 : n.isLoggedIn ? n.can(e.meta.permission) ? !0 : { name: "forbidden" } : {
|
|
2575
|
+
name: "login",
|
|
2576
|
+
query: e.fullPath === "/" ? void 0 : { redirect: e.fullPath }
|
|
2577
|
+
};
|
|
2578
|
+
}), i.afterEach((e) => {
|
|
2579
|
+
e.meta.pageKey && Z(t).open(e.meta.pageKey);
|
|
2580
|
+
}), i;
|
|
382
2581
|
}
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
function
|
|
390
|
-
|
|
391
|
-
title: e,
|
|
392
|
-
tone: t ? "success" : "danger",
|
|
393
|
-
duration: n,
|
|
394
|
-
description: r
|
|
395
|
-
});
|
|
2582
|
+
// packages/core/src/services/login.ts
|
|
2583
|
+
async function Gr(e, t, n, r) {
|
|
2584
|
+
e.signIn(n), await t.replace(He(r));
|
|
2585
|
+
}
|
|
2586
|
+
// packages/core/src/services/auth.ts
|
|
2587
|
+
var Kr, qr;
|
|
2588
|
+
function Jr(e, t) {
|
|
2589
|
+
Kr = e, qr = t;
|
|
396
2590
|
}
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
2591
|
+
async function Yr(e) {
|
|
2592
|
+
if (K(), !Kr || !qr) return;
|
|
2593
|
+
let t = Q(qr);
|
|
2594
|
+
if (!t.isLoggedIn) return;
|
|
2595
|
+
t.expire(), Vt.toast.warning(e || Te("campus.auth.sessionExpired"));
|
|
2596
|
+
let n = Kr.currentRoute.value;
|
|
2597
|
+
n.name !== "login" && await Kr.replace({
|
|
2598
|
+
name: "login",
|
|
2599
|
+
query: n.fullPath === "/" ? void 0 : { redirect: n.fullPath }
|
|
402
2600
|
});
|
|
403
|
-
return h(n), t;
|
|
404
2601
|
}
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
name: "CaOverlayHost",
|
|
409
|
-
__name: "ca-overlay-host",
|
|
410
|
-
setup(t) {
|
|
411
|
-
let n = X(G), i = X(J), a = X(O), o = r(() => n.value.visible), s = r(() => n.value.text);
|
|
412
|
-
return (t, n) => (g(), c(e, null, [
|
|
413
|
-
d(T, {
|
|
414
|
-
visible: x(o),
|
|
415
|
-
text: x(s)
|
|
416
|
-
}, null, 8, ["visible", "text"]),
|
|
417
|
-
d(E, { items: x(i).list }, null, 8, ["items"]),
|
|
418
|
-
d(F, { items: x(a).list }, null, 8, ["items"])
|
|
419
|
-
], 64));
|
|
420
|
-
}
|
|
421
|
-
}), Q = {
|
|
422
|
-
loading: (e) => K(e),
|
|
423
|
-
toast: (e, t = !0) => Y(e, t),
|
|
424
|
-
alert: (e, t, n) => M(e, t, n),
|
|
425
|
-
confirm: (e, t) => N(e, t),
|
|
426
|
-
modal: (e) => {
|
|
427
|
-
O.set((t) => ({ list: [...t.list, {
|
|
428
|
-
id: Date.now(),
|
|
429
|
-
variant: "alert",
|
|
430
|
-
title: e.title,
|
|
431
|
-
content: e.content,
|
|
432
|
-
confirmText: "确定",
|
|
433
|
-
onConfirm: e.onConfirm
|
|
434
|
-
}] }));
|
|
435
|
-
},
|
|
436
|
-
hideLoading: q
|
|
437
|
-
}, Je = { CaOverlayHost: Z };
|
|
438
|
-
function Ye() {
|
|
439
|
-
if (typeof document > "u") return () => {};
|
|
440
|
-
let e = document.createElement("div");
|
|
441
|
-
e.setAttribute("data-ca-overlay", ""), document.body.appendChild(e);
|
|
442
|
-
let t = a(Z);
|
|
443
|
-
return t.mount(e), () => {
|
|
444
|
-
t.unmount(), e.remove();
|
|
445
|
-
};
|
|
2602
|
+
async function Xr(e, t) {
|
|
2603
|
+
if (K(), !Kr || !qr) throw Error("[campus] 应用尚未创建,无法完成登录");
|
|
2604
|
+
await Gr(Q(qr), Kr, e, t);
|
|
446
2605
|
}
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
2606
|
+
// packages/core/src/app.ts
|
|
2607
|
+
function Zr(e) {
|
|
2608
|
+
Mt(e), ke(e);
|
|
2609
|
+
let t = r(De), n = F();
|
|
2610
|
+
t.use(n);
|
|
2611
|
+
let i = Ce(e);
|
|
2612
|
+
t.use(i);
|
|
2613
|
+
let a = (e, t) => i.global.t(e, t ?? {});
|
|
2614
|
+
t.provide(R, a), Ft(a), t.config.globalProperties.$ca = Vt, L(t), t.component("CaAuthPreview", nn);
|
|
2615
|
+
let o = Wr(e, n);
|
|
2616
|
+
return Jr(o, n), t.use(o), ze(n).boot(), t;
|
|
451
2617
|
}
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
let i = null;
|
|
456
|
-
return {
|
|
457
|
-
...n,
|
|
458
|
-
name: "campus-admin",
|
|
459
|
-
locale: r,
|
|
460
|
-
install(e) {
|
|
461
|
-
n.start(), e.provide(W, t), we(e, r), n.install(e), i = Ye(), Xe();
|
|
462
|
-
},
|
|
463
|
-
unmount() {
|
|
464
|
-
i?.(), i = null;
|
|
465
|
-
}
|
|
466
|
-
};
|
|
2618
|
+
// packages/core/src/index.ts
|
|
2619
|
+
function Qr(e) {
|
|
2620
|
+
return e;
|
|
467
2621
|
}
|
|
468
|
-
|
|
469
|
-
//#region src/index.ts
|
|
470
|
-
var Ze = { install(e) {
|
|
471
|
-
$().install(e);
|
|
472
|
-
} };
|
|
473
|
-
//#endregion
|
|
474
|
-
export { W as CAMPUS_KEY, T as CaLoadingOverlay, Z as CaOverlayHost, F as CaOverlayList, E as CaToastList, z as CampusApplication, I as CampusContainer, R as CampusContext, D as CampusStore, M as alert, Q as ca, Ke as campus, Pe as clearOverlays, ve as clearToasts, A as closeOverlay, ye as closeToast, r as computed, N as confirm, i as createApp, Ue as createCampus, $ as createCampusAdmin, U as createVueApplication, Ze as default, f as defineAsyncComponent, ee as defineComponent, Ge as definePlugin, We as defineProvider, H as getCurrentCampus, q as hideLoading, m as inject, L as isCampusProvider, G as loadingStore, te as nextTick, re as onBeforeUnmount, ie as onMounted, h as onScopeDispose, ae as onUnmounted, O as overlayStore, oe as provide, se as readonly, _ as ref, V as setCurrentCampus, y as shallowRef, K as showLoading, Y as showToast, ce as toRef, le as toRefs, be as toast, J as toastStore, qe as useCampus, S as watch, de as watchEffect };
|
|
2622
|
+
export { Vt as ca, Xr as completeLogin, Zr as createCampusApp, Qr as defineMenus, Yr as handleUnauthorized, jt as resolveEnvironment, Te as t, W as useCampusT, X as useLayoutStore, Q as useSessionStore, Z as useTabsStore, ze as useThemeStore };
|