@campus-admin/core 2.0.1 → 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 +4 -0
- package/dist/i18n.d.ts +4 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +561 -464
- package/dist/pages/auth/WechatPane.vue.d.ts +4 -1
- package/dist/pages/auth/options.d.ts +1 -0
- package/dist/pages/auth/wechat-host.d.ts +10 -0
- package/dist/services/auth.d.ts +10 -0
- package/dist/services/login.d.ts +8 -0
- package/dist/stores/session.d.ts +13 -1
- package/dist/style.css +1 -1
- package/dist/types.d.ts +36 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -4,22 +4,22 @@ import "element-plus/theme-chalk/dark/css-vars.css";
|
|
|
4
4
|
import "@campus-admin/theme/nova.css";
|
|
5
5
|
import { Fragment as e, KeepAlive as t, computed as n, createApp as r, createBlock as i, createCommentVNode as a, createElementBlock as o, createElementVNode as s, createStaticVNode as c, createTextVNode as l, createVNode as u, defineComponent as d, h as f, mergeModels as p, nextTick as m, normalizeClass as h, normalizeStyle as g, onBeforeUnmount as _, onMounted as v, openBlock as y, reactive as b, ref as x, renderList as S, renderSlot as C, resolveComponent as w, resolveDynamicComponent as T, toDisplayString as E, unref as D, useModel as O, vShow as k, watch as A, watchEffect as j, withCtx as M, withDirectives as N, withModifiers as P } from "vue";
|
|
6
6
|
import { createPinia as F, defineStore as I } from "pinia";
|
|
7
|
-
import { installUi as L, translateKey as
|
|
8
|
-
import { LOCALES as
|
|
9
|
-
import { createI18n as
|
|
10
|
-
import { RouterLink as
|
|
11
|
-
import { applyTheme as
|
|
12
|
-
import { ElLoading as
|
|
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
13
|
import "element-plus/es/components/loading/style/css";
|
|
14
14
|
import "element-plus/es/components/notification/style/css";
|
|
15
15
|
import "element-plus/es/components/message/style/css";
|
|
16
16
|
import "element-plus/es/components/message-box/style/css";
|
|
17
17
|
export * from "@campus-admin/ui";
|
|
18
18
|
// packages/core/src/storage.ts
|
|
19
|
-
var
|
|
20
|
-
function
|
|
19
|
+
var he = "ca:";
|
|
20
|
+
function ge(e, t = "local") {
|
|
21
21
|
try {
|
|
22
|
-
return (t === "local" ? localStorage : sessionStorage).getItem(
|
|
22
|
+
return (t === "local" ? localStorage : sessionStorage).getItem(he + e);
|
|
23
23
|
} catch {
|
|
24
24
|
return null;
|
|
25
25
|
}
|
|
@@ -27,11 +27,11 @@ function H(e, t = "local") {
|
|
|
27
27
|
function U(e, t, n = "local") {
|
|
28
28
|
try {
|
|
29
29
|
let r = n === "local" ? localStorage : sessionStorage;
|
|
30
|
-
t === null ? r.removeItem(
|
|
30
|
+
t === null ? r.removeItem(he + e) : r.setItem(he + e, t);
|
|
31
31
|
} catch {}
|
|
32
32
|
}
|
|
33
33
|
function _e(e, t = "local") {
|
|
34
|
-
let n =
|
|
34
|
+
let n = ge(e, t);
|
|
35
35
|
if (n) try {
|
|
36
36
|
return JSON.parse(n);
|
|
37
37
|
} catch {
|
|
@@ -56,7 +56,7 @@ function Se(e) {
|
|
|
56
56
|
return e === "zh-CN" || e === "en-US";
|
|
57
57
|
}
|
|
58
58
|
function Ce(e) {
|
|
59
|
-
let t =
|
|
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
60
|
legacy: !1,
|
|
61
61
|
locale: n,
|
|
62
62
|
fallbackLocale: "zh-CN",
|
|
@@ -74,7 +74,7 @@ function Ee(e) {
|
|
|
74
74
|
U(xe, e);
|
|
75
75
|
}
|
|
76
76
|
function W() {
|
|
77
|
-
let { t: e, te: t, locale: n } =
|
|
77
|
+
let { t: e, te: t, locale: n } = z();
|
|
78
78
|
return {
|
|
79
79
|
t: e,
|
|
80
80
|
te: t,
|
|
@@ -97,20 +97,20 @@ var De = /* @__PURE__ */ d({
|
|
|
97
97
|
}
|
|
98
98
|
});
|
|
99
99
|
// packages/core/src/types.ts
|
|
100
|
-
function
|
|
100
|
+
function G(e) {
|
|
101
101
|
return "children" in e;
|
|
102
102
|
}
|
|
103
103
|
// packages/core/src/context.ts
|
|
104
|
-
var
|
|
105
|
-
function
|
|
106
|
-
|
|
104
|
+
var Oe;
|
|
105
|
+
function ke(e) {
|
|
106
|
+
Oe = e;
|
|
107
107
|
}
|
|
108
|
-
function
|
|
109
|
-
if (!
|
|
110
|
-
return
|
|
108
|
+
function K() {
|
|
109
|
+
if (!Oe) throw Error("[campus] 请先调用 createCampusApp()");
|
|
110
|
+
return Oe;
|
|
111
111
|
}
|
|
112
|
-
function
|
|
113
|
-
for (let t of
|
|
112
|
+
function Ae(e) {
|
|
113
|
+
for (let t of K().menus) for (let n of t.children) if (G(n)) {
|
|
114
114
|
let r = n.children.find((t) => t.key === e);
|
|
115
115
|
if (r) return { titles: [
|
|
116
116
|
t.title,
|
|
@@ -119,13 +119,13 @@ function je(e) {
|
|
|
119
119
|
] };
|
|
120
120
|
} else if (n.key === e) return { titles: [t.title, n.title] };
|
|
121
121
|
}
|
|
122
|
-
function
|
|
122
|
+
function je(e) {
|
|
123
123
|
let t = [], n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set();
|
|
124
124
|
for (let o of e) {
|
|
125
125
|
if (i.has(o.key)) throw Error(`[campus] 菜单一级场景键重复:${o.key}`);
|
|
126
126
|
i.add(o.key);
|
|
127
127
|
for (let e of o.children) {
|
|
128
|
-
let i =
|
|
128
|
+
let i = G(e) ? e : void 0;
|
|
129
129
|
if (i) {
|
|
130
130
|
if (a.has(i.key)) throw Error(`[campus] 菜单组键重复:${i.key}`);
|
|
131
131
|
a.add(i.key);
|
|
@@ -144,55 +144,55 @@ function Me(e) {
|
|
|
144
144
|
}
|
|
145
145
|
return t;
|
|
146
146
|
}
|
|
147
|
-
function
|
|
147
|
+
function Me(e, t) {
|
|
148
148
|
if (e !== void 0 && !t.some((t) => t.path === e)) throw Error(`[campus] 账户页路径不在菜单页面里:${e}`);
|
|
149
149
|
}
|
|
150
150
|
// packages/core/src/stores/theme.ts
|
|
151
|
-
var
|
|
151
|
+
var Ne = "theme-mode", Pe = "box-style", Fe = "user-primary";
|
|
152
|
+
function Ie() {
|
|
153
|
+
return ge(Pe) === "border" ? "border" : "shadow";
|
|
154
|
+
}
|
|
152
155
|
function Le() {
|
|
153
|
-
|
|
156
|
+
let e = ge(Fe);
|
|
157
|
+
return ce(e) ? e : void 0;
|
|
154
158
|
}
|
|
155
159
|
function Re() {
|
|
156
|
-
let e =
|
|
157
|
-
return le(e) ? e : void 0;
|
|
158
|
-
}
|
|
159
|
-
function ze() {
|
|
160
|
-
let e = H(Pe);
|
|
160
|
+
let e = ge(Ne);
|
|
161
161
|
return e === "light" || e === "dark" || e === "auto" ? e : "auto";
|
|
162
162
|
}
|
|
163
|
-
var
|
|
164
|
-
let e = x({}), t = x(
|
|
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
165
|
a?.addEventListener("change", (e) => o.value = e.matches);
|
|
166
|
-
let s = n(() =>
|
|
166
|
+
let s = n(() => ue(e.value)), c = n(() => e.value.tenantDefault?.locks?.includes("primary") ?? !1), l = n(() => {
|
|
167
167
|
let e = s.value.theme, t = i.value;
|
|
168
168
|
return !t || c.value ? e : {
|
|
169
169
|
...e,
|
|
170
170
|
primary: t,
|
|
171
171
|
headerBg: e.headerBg === e.primary ? t : e.headerBg
|
|
172
172
|
};
|
|
173
|
-
}), u = n(() => s.value.issues), d = n(() =>
|
|
174
|
-
j(() =>
|
|
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
175
|
document.documentElement.dataset.caBox = r.value;
|
|
176
176
|
});
|
|
177
177
|
function p(e) {
|
|
178
|
-
(e === void 0 ||
|
|
178
|
+
(e === void 0 || ce(e)) && (i.value = e, U(Fe, e ?? null));
|
|
179
179
|
}
|
|
180
180
|
function h(e) {
|
|
181
|
-
r.value = e, U(
|
|
181
|
+
r.value = e, U(Pe, e);
|
|
182
182
|
}
|
|
183
183
|
function g() {
|
|
184
|
-
return `theme-layers:${
|
|
184
|
+
return `theme-layers:${K().theme?.cacheKey ?? location.host}`;
|
|
185
185
|
}
|
|
186
186
|
function _(e) {
|
|
187
|
-
t.value = e, U(
|
|
187
|
+
t.value = e, U(Ne, e);
|
|
188
188
|
}
|
|
189
189
|
function v(e, t) {
|
|
190
|
-
let n = document, r =
|
|
190
|
+
let n = document, r = le(e, o.value) !== d.value, i = typeof matchMedia == "function" && matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
191
191
|
if (!t || !r || i || !n.startViewTransition) {
|
|
192
192
|
_(e);
|
|
193
193
|
return;
|
|
194
194
|
}
|
|
195
|
-
let a = Math.hypot(Math.max(t.x, innerWidth - t.x), Math.max(t.y, innerHeight - t.y)), s =
|
|
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
196
|
c.dataset.caThemeTransition = s ? "to-dark" : "to-light";
|
|
197
197
|
let l = !1, u = () => {
|
|
198
198
|
l || (l = !0, _(e));
|
|
@@ -216,7 +216,7 @@ var Be = I("campus-theme", () => {
|
|
|
216
216
|
async function b() {
|
|
217
217
|
let t = _e(g());
|
|
218
218
|
t && (e.value = t);
|
|
219
|
-
let n =
|
|
219
|
+
let n = K().theme?.load;
|
|
220
220
|
if (n) {
|
|
221
221
|
try {
|
|
222
222
|
y(await n());
|
|
@@ -244,50 +244,54 @@ var Be = I("campus-theme", () => {
|
|
|
244
244
|
};
|
|
245
245
|
});
|
|
246
246
|
// packages/core/src/copyright.ts
|
|
247
|
-
function
|
|
247
|
+
function Be(e, t = (/* @__PURE__ */ new Date()).getFullYear()) {
|
|
248
248
|
return e.replaceAll("{year}", String(t));
|
|
249
249
|
}
|
|
250
250
|
// packages/core/src/pages/auth/options.ts
|
|
251
|
-
var
|
|
252
|
-
function
|
|
253
|
-
return
|
|
251
|
+
var Ve = /^1[3-9]\d{9}$/;
|
|
252
|
+
function q() {
|
|
253
|
+
return K().login ?? {};
|
|
254
254
|
}
|
|
255
|
-
function
|
|
256
|
-
let e =
|
|
255
|
+
function J() {
|
|
256
|
+
let e = K().auth;
|
|
257
257
|
return {
|
|
258
258
|
captcha: typeof e.captcha == "function",
|
|
259
259
|
register: typeof e.register == "function" && typeof e.sendSmsCode == "function",
|
|
260
|
+
wechat: typeof e.wechat?.mount == "function",
|
|
260
261
|
forgot: typeof e.resetPassword == "function" && typeof e.sendSmsCode == "function"
|
|
261
262
|
};
|
|
262
263
|
}
|
|
263
|
-
function
|
|
264
|
+
function He(e) {
|
|
264
265
|
return typeof e == "string" && e.startsWith("/") && !e.startsWith("//") ? e : "/";
|
|
265
266
|
}
|
|
266
267
|
// packages/core/src/pages/auth/AuthShell.vue?vue&type=script&setup=true&lang.ts
|
|
267
|
-
var
|
|
268
|
+
var Ue = {
|
|
269
|
+
key: 0,
|
|
270
|
+
class: "ca-auth__title"
|
|
271
|
+
}, We = ["src"], Ge = { class: "ca-auth__qrcode" }, Ke = ["src", "alt"], qe = {
|
|
268
272
|
key: 0,
|
|
269
273
|
class: "ca-auth__caption"
|
|
270
|
-
},
|
|
274
|
+
}, Je = { class: "ca-auth__site" }, Ye = {
|
|
271
275
|
key: 0,
|
|
272
276
|
class: "ca-auth__caption"
|
|
273
|
-
},
|
|
277
|
+
}, Xe = { class: "ca-auth__main" }, Ze = { class: "ca-auth__brand" }, Qe = ["src"], $e = {
|
|
274
278
|
class: "ca-auth__tabs",
|
|
275
279
|
role: "tablist"
|
|
276
|
-
},
|
|
280
|
+
}, et = [
|
|
277
281
|
"aria-selected",
|
|
278
282
|
"tabindex",
|
|
279
283
|
"onClick",
|
|
280
284
|
"onKeydown"
|
|
281
|
-
],
|
|
285
|
+
], tt = {
|
|
282
286
|
class: "ca-auth__body",
|
|
283
287
|
role: "tabpanel"
|
|
284
|
-
},
|
|
288
|
+
}, nt = {
|
|
285
289
|
key: 0,
|
|
286
290
|
class: "ca-auth__footer"
|
|
287
|
-
},
|
|
291
|
+
}, rt = {
|
|
288
292
|
key: 0,
|
|
289
293
|
class: "ca-auth__version"
|
|
290
|
-
},
|
|
294
|
+
}, it = /*@__PURE__*/ d({
|
|
291
295
|
__name: "AuthShell",
|
|
292
296
|
props: {
|
|
293
297
|
tabs: {},
|
|
@@ -296,39 +300,52 @@ var Ge = { class: "ca-auth__card" }, Ke = { class: "ca-auth__panel" }, qe = ["sr
|
|
|
296
300
|
},
|
|
297
301
|
emits: ["update:active"],
|
|
298
302
|
setup(t, { emit: r }) {
|
|
299
|
-
let c = t, u = r, { t: d, label: f } = W(), p =
|
|
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(() => {
|
|
300
304
|
let e = m.panel?.caption ?? p.subtitle;
|
|
301
305
|
return e ? f(e) : "";
|
|
302
|
-
}), O = n(() => m.
|
|
303
|
-
|
|
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) {
|
|
304
311
|
if (e.key !== "ArrowRight" && e.key !== "ArrowLeft") return;
|
|
305
312
|
let n = (t + (e.key === "ArrowRight" ? 1 : -1) + c.tabs.length) % c.tabs.length, r = c.tabs[n];
|
|
306
313
|
r.to || u("update:active", r.key), e.currentTarget.parentElement?.querySelectorAll("[role=tab]")[n]?.focus(), e.preventDefault();
|
|
307
314
|
}
|
|
308
315
|
return (n, r) => (y(), o("div", { class: h(["ca-auth", { "ca-auth--preview": t.preview }]) }, [s("div", {
|
|
309
316
|
class: "ca-auth__stage",
|
|
310
|
-
style: g({ background:
|
|
311
|
-
}, [s("div",
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
class: "ca-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
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", {
|
|
321
338
|
key: 0,
|
|
322
339
|
src: b.value,
|
|
323
340
|
alt: ""
|
|
324
|
-
}, null, 8,
|
|
325
|
-
s("div",
|
|
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), {
|
|
326
343
|
key: 0,
|
|
327
344
|
to: n.to,
|
|
328
345
|
role: "tab",
|
|
329
346
|
"aria-selected": "false",
|
|
330
347
|
class: "ca-auth__tab",
|
|
331
|
-
onKeydown: (e) =>
|
|
348
|
+
onKeydown: (e) => F(e, r)
|
|
332
349
|
}, {
|
|
333
350
|
default: M(() => [l(E(n.label), 1)]),
|
|
334
351
|
_: 2
|
|
@@ -340,17 +357,17 @@ var Ge = { class: "ca-auth__card" }, Ke = { class: "ca-auth__panel" }, qe = ["sr
|
|
|
340
357
|
"aria-selected": n.key === t.active,
|
|
341
358
|
tabindex: n.key === t.active ? 0 : -1,
|
|
342
359
|
onClick: (e) => n.to ? void 0 : u("update:active", n.key),
|
|
343
|
-
onKeydown: (e) =>
|
|
344
|
-
}, E(n.label), 43,
|
|
345
|
-
s("div",
|
|
346
|
-
|
|
347
|
-
])]), D(m).version ? (y(), o("span",
|
|
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));
|
|
348
365
|
}
|
|
349
|
-
}),
|
|
366
|
+
}), Y = (e, t) => {
|
|
350
367
|
let n = e.__vccOpts || e;
|
|
351
368
|
for (let [e, r] of t) n[e] = r;
|
|
352
369
|
return n;
|
|
353
|
-
},
|
|
370
|
+
}, at = /*#__PURE__*/ Y(it, [["__scopeId", "data-v-df817220"]]), X = I("campus-layout", () => {
|
|
354
371
|
let e = x(!1), t = x("desktop"), n = x(!1), r = x(!1);
|
|
355
372
|
function i() {
|
|
356
373
|
e.value = !e.value;
|
|
@@ -392,28 +409,28 @@ var Ge = { class: "ca-auth__card" }, Ke = { class: "ca-auth__panel" }, qe = ["sr
|
|
|
392
409
|
};
|
|
393
410
|
});
|
|
394
411
|
// packages/core/src/tabs-policy.ts
|
|
395
|
-
function
|
|
412
|
+
function ot(e, t, n = Date.now()) {
|
|
396
413
|
return {
|
|
397
414
|
...e,
|
|
398
415
|
[t]: Math.max(n, ...Object.values(e).map((e) => e + 1))
|
|
399
416
|
};
|
|
400
417
|
}
|
|
401
|
-
function
|
|
418
|
+
function st(e, t, n, r, i) {
|
|
402
419
|
let a = e.filter((e) => !r.includes(e));
|
|
403
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);
|
|
404
421
|
}
|
|
405
422
|
// packages/core/src/stores/tabs.ts
|
|
406
|
-
var
|
|
407
|
-
let e =
|
|
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))));
|
|
408
425
|
for (let [e, t] of d.value.entries()) Number.isFinite(p.value[t]) || (p.value[t] = e + 1);
|
|
409
426
|
for (;;) {
|
|
410
|
-
let e =
|
|
427
|
+
let e = st(d.value, p.value, "", s.value, l);
|
|
411
428
|
if (!e) break;
|
|
412
429
|
d.value.splice(d.value.indexOf(e), 1), delete p.value[e];
|
|
413
430
|
}
|
|
414
431
|
let h = x({}), g = x(null), _ = n(() => d.value.filter((e) => e !== g.value));
|
|
415
432
|
function v() {
|
|
416
|
-
p.value = Object.fromEntries(d.value.map((e) => [e, p.value[e] ?? 0])), ve(
|
|
433
|
+
p.value = Object.fromEntries(d.value.map((e) => [e, p.value[e] ?? 0])), ve(ct, {
|
|
417
434
|
visited: d.value,
|
|
418
435
|
active: p.value,
|
|
419
436
|
affix: o.value
|
|
@@ -421,8 +438,8 @@ var dt = "tabs", Y = I("campus-tabs", () => {
|
|
|
421
438
|
}
|
|
422
439
|
function y(e) {
|
|
423
440
|
if (!t.has(e)) return;
|
|
424
|
-
d.value.includes(e) || d.value.push(e), p.value =
|
|
425
|
-
let n =
|
|
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);
|
|
426
443
|
n && d.value.splice(d.value.indexOf(n), 1), v();
|
|
427
444
|
}
|
|
428
445
|
function b(e) {
|
|
@@ -470,8 +487,8 @@ var dt = "tabs", Y = I("campus-tabs", () => {
|
|
|
470
487
|
refresh: E,
|
|
471
488
|
setAffix: D
|
|
472
489
|
};
|
|
473
|
-
}),
|
|
474
|
-
let e = _e(
|
|
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));
|
|
475
492
|
function a(e) {
|
|
476
493
|
if (!e) return !0;
|
|
477
494
|
let t = r.value?.permissions;
|
|
@@ -481,26 +498,28 @@ var dt = "tabs", Y = I("campus-tabs", () => {
|
|
|
481
498
|
r.value && (r.value = {
|
|
482
499
|
...r.value,
|
|
483
500
|
permissions: e
|
|
484
|
-
}, ve(
|
|
501
|
+
}, ve(lt, {
|
|
485
502
|
token: t.value,
|
|
486
503
|
user: r.value
|
|
487
504
|
}, "session"));
|
|
488
505
|
}
|
|
489
506
|
async function s(e) {
|
|
490
|
-
|
|
491
|
-
t.value = n.token, r.value = n.user, ve(ft, n, "session");
|
|
507
|
+
c(await K().auth.login(e));
|
|
492
508
|
}
|
|
493
|
-
|
|
509
|
+
function c(e) {
|
|
510
|
+
t.value = e.token, r.value = e.user, ve(lt, e, "session");
|
|
511
|
+
}
|
|
512
|
+
async function l() {
|
|
494
513
|
try {
|
|
495
|
-
await
|
|
514
|
+
await K().auth.logout?.();
|
|
496
515
|
} catch (e) {
|
|
497
516
|
console.warn("[campus] 退出时通知服务端失败,已清除本地登录态:", e);
|
|
498
517
|
} finally {
|
|
499
|
-
t.value = "", r.value = void 0, U(
|
|
518
|
+
t.value = "", r.value = void 0, U(lt, null, "session"), Z().reset(), X().reset();
|
|
500
519
|
}
|
|
501
520
|
}
|
|
502
|
-
function
|
|
503
|
-
t.value = "", r.value = void 0, U(
|
|
521
|
+
function u() {
|
|
522
|
+
t.value = "", r.value = void 0, U(lt, null, "session"), Z().reset(), X().reset();
|
|
504
523
|
}
|
|
505
524
|
return {
|
|
506
525
|
token: t,
|
|
@@ -509,10 +528,11 @@ var dt = "tabs", Y = I("campus-tabs", () => {
|
|
|
509
528
|
can: a,
|
|
510
529
|
setPermissions: o,
|
|
511
530
|
login: s,
|
|
512
|
-
|
|
513
|
-
|
|
531
|
+
signIn: c,
|
|
532
|
+
logout: l,
|
|
533
|
+
expire: u
|
|
514
534
|
};
|
|
515
|
-
}),
|
|
535
|
+
}), ut = {
|
|
516
536
|
class: "ca-auth-icon",
|
|
517
537
|
viewBox: "0 0 24 24",
|
|
518
538
|
width: "16",
|
|
@@ -523,7 +543,7 @@ var dt = "tabs", Y = I("campus-tabs", () => {
|
|
|
523
543
|
"stroke-linecap": "round",
|
|
524
544
|
"stroke-linejoin": "round",
|
|
525
545
|
"aria-hidden": "true"
|
|
526
|
-
},
|
|
546
|
+
}, dt = ["d"], $ = /* @__PURE__ */ d({
|
|
527
547
|
__name: "AuthIcon",
|
|
528
548
|
props: { name: {} },
|
|
529
549
|
setup(e) {
|
|
@@ -534,13 +554,13 @@ var dt = "tabs", Y = I("campus-tabs", () => {
|
|
|
534
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",
|
|
535
555
|
message: "M4 5h16v11H9l-4 3.500V16H4z"
|
|
536
556
|
};
|
|
537
|
-
return (n, r) => (y(), o("svg",
|
|
557
|
+
return (n, r) => (y(), o("svg", ut, [s("path", { d: t[e.name] }, null, 8, dt)]));
|
|
538
558
|
}
|
|
539
|
-
}),
|
|
559
|
+
}), ft = { class: "ca-auth-row" }, pt = [
|
|
540
560
|
"title",
|
|
541
561
|
"aria-label",
|
|
542
562
|
"disabled"
|
|
543
|
-
],
|
|
563
|
+
], mt = ["src"], ht = { key: 1 }, gt = /* @__PURE__ */ d({
|
|
544
564
|
__name: "CaptchaField",
|
|
545
565
|
props: /*@__PURE__*/ p({ scene: {} }, {
|
|
546
566
|
code: { default: "" },
|
|
@@ -550,60 +570,61 @@ var dt = "tabs", Y = I("campus-tabs", () => {
|
|
|
550
570
|
}),
|
|
551
571
|
emits: ["update:code", "update:captchaKey"],
|
|
552
572
|
setup(e, { expose: t }) {
|
|
553
|
-
let n = e, r = O(e, "code"), i = O(e, "captchaKey"), { t: c } = W(),
|
|
554
|
-
async function
|
|
555
|
-
|
|
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;
|
|
556
576
|
try {
|
|
557
|
-
let e = await
|
|
558
|
-
i.value = e.key,
|
|
577
|
+
let e = await K().auth.captcha(n.scene);
|
|
578
|
+
i.value = e.key, f.value = e.image, p.value = !1;
|
|
559
579
|
} catch {
|
|
560
|
-
|
|
580
|
+
f.value = "", p.value = !0;
|
|
561
581
|
} finally {
|
|
562
|
-
r.value = "",
|
|
582
|
+
r.value = "", m.value = !1;
|
|
563
583
|
}
|
|
564
584
|
}
|
|
565
|
-
return v(
|
|
585
|
+
return v(h), t({ refresh: h }), (e, t) => {
|
|
566
586
|
let n = w("ca-input");
|
|
567
|
-
return y(), o("div",
|
|
587
|
+
return y(), o("div", ft, [u(n, {
|
|
568
588
|
modelValue: r.value,
|
|
569
589
|
"onUpdate:modelValue": t[0] ||= (e) => r.value = e,
|
|
570
|
-
placeholder: D(c)("campus.auth.captchaPlaceholder"),
|
|
590
|
+
placeholder: D(d)?.placeholder ? D(l)(D(d).placeholder) : D(c)("campus.auth.captchaPlaceholder"),
|
|
571
591
|
"aria-label": D(c)("campus.auth.captcha"),
|
|
572
592
|
autocomplete: "off",
|
|
573
|
-
maxlength:
|
|
593
|
+
maxlength: D(d)?.maxlength ?? 8
|
|
574
594
|
}, {
|
|
575
|
-
prefix: M(() => [u(
|
|
595
|
+
prefix: M(() => [u($, { name: "shield" })]),
|
|
576
596
|
_: 1
|
|
577
597
|
}, 8, [
|
|
578
598
|
"modelValue",
|
|
579
599
|
"placeholder",
|
|
580
|
-
"aria-label"
|
|
600
|
+
"aria-label",
|
|
601
|
+
"maxlength"
|
|
581
602
|
]), s("button", {
|
|
582
603
|
type: "button",
|
|
583
604
|
class: "ca-auth-captcha",
|
|
584
605
|
title: D(c)("campus.auth.captchaRefresh"),
|
|
585
606
|
"aria-label": D(c)("campus.auth.captchaRefresh"),
|
|
586
|
-
disabled:
|
|
587
|
-
onClick:
|
|
588
|
-
}, [
|
|
607
|
+
disabled: m.value,
|
|
608
|
+
onClick: h
|
|
609
|
+
}, [f.value ? (y(), o("img", {
|
|
589
610
|
key: 0,
|
|
590
|
-
src:
|
|
611
|
+
src: f.value,
|
|
591
612
|
alt: ""
|
|
592
|
-
}, null, 8,
|
|
613
|
+
}, null, 8, mt)) : p.value ? (y(), o("span", ht, E(D(c)("campus.auth.captchaFailed")), 1)) : a("v-if", !0)], 8, pt)]);
|
|
593
614
|
};
|
|
594
615
|
}
|
|
595
|
-
}),
|
|
616
|
+
}), _t = {
|
|
596
617
|
key: 1,
|
|
597
618
|
class: "ca-auth-links"
|
|
598
|
-
},
|
|
619
|
+
}, vt = { class: "ca-auth-help" }, yt = /* @__PURE__ */ d({
|
|
599
620
|
__name: "LoginForm",
|
|
600
621
|
props: { preview: { type: Boolean } },
|
|
601
622
|
setup(t) {
|
|
602
|
-
let r = t, c =
|
|
623
|
+
let r = t, c = V(), d = H(), f = Q(), { t: p, label: m } = W(), h = J(), g = q(), _ = g.fields ?? {}, v = b({
|
|
603
624
|
username: "",
|
|
604
625
|
password: "",
|
|
605
626
|
captcha: ""
|
|
606
|
-
}),
|
|
627
|
+
}), C = x(""), T = x(), O = x(), k = x(!1), A = x(""), j = x("error"), N = n(() => ({
|
|
607
628
|
username: [{
|
|
608
629
|
required: !0,
|
|
609
630
|
message: p("campus.login.required", { label: p("campus.login.username") }),
|
|
@@ -619,93 +640,103 @@ var dt = "tabs", Y = I("campus-tabs", () => {
|
|
|
619
640
|
message: p("campus.auth.captchaRequired"),
|
|
620
641
|
trigger: "blur"
|
|
621
642
|
}] : []
|
|
622
|
-
})),
|
|
643
|
+
})), F = n(() => (g.helps ?? [
|
|
623
644
|
1,
|
|
624
645
|
2,
|
|
625
646
|
3,
|
|
626
647
|
4
|
|
627
648
|
].map((e) => `campus.auth.help${e}`)).map((e) => m(e).split("{forgot}").flatMap((e, t, n) => t < n.length - 1 ? [e, null] : [e])));
|
|
628
|
-
|
|
649
|
+
function I(e) {
|
|
650
|
+
_.username?.digitsOnly && /\D/.test(e) && (v.username = e.replace(/\D/g, ""));
|
|
651
|
+
}
|
|
652
|
+
async function L() {
|
|
629
653
|
try {
|
|
630
|
-
await
|
|
654
|
+
await O.value?.validate();
|
|
631
655
|
} catch {
|
|
632
656
|
return;
|
|
633
657
|
}
|
|
634
|
-
if (r.preview)
|
|
658
|
+
if (r.preview) j.value = "info", A.value = p("campus.auth.previewNote");
|
|
635
659
|
else {
|
|
636
|
-
|
|
660
|
+
k.value = !0, A.value = "", j.value = "error";
|
|
637
661
|
try {
|
|
638
662
|
await f.login({
|
|
639
|
-
username:
|
|
640
|
-
password:
|
|
663
|
+
username: v.username,
|
|
664
|
+
password: v.password,
|
|
641
665
|
captcha: h.captcha ? {
|
|
642
|
-
key:
|
|
643
|
-
code:
|
|
666
|
+
key: C.value,
|
|
667
|
+
code: v.captcha
|
|
644
668
|
} : void 0
|
|
645
|
-
}), await d.replace(
|
|
669
|
+
}), await d.replace(He(c.query.redirect));
|
|
646
670
|
} catch (e) {
|
|
647
|
-
|
|
671
|
+
A.value = e instanceof Error && e.message ? e.message : p("campus.login.failed"), T.value?.refresh();
|
|
648
672
|
} finally {
|
|
649
|
-
|
|
673
|
+
k.value = !1;
|
|
650
674
|
}
|
|
651
675
|
}
|
|
652
676
|
}
|
|
653
|
-
function
|
|
677
|
+
function R(e) {
|
|
654
678
|
r.preview && e.preventDefault();
|
|
655
679
|
}
|
|
656
|
-
let
|
|
680
|
+
let ee = n(() => h.forgot || h.register);
|
|
657
681
|
return (t, n) => {
|
|
658
|
-
let r = w("ca-alert"), c = w("ca-input"), d = w("ca-form-item"), f = w("ca-button"),
|
|
682
|
+
let r = w("ca-alert"), c = w("ca-input"), d = w("ca-form-item"), f = w("ca-button"), g = w("ca-form");
|
|
659
683
|
return y(), o(e, null, [
|
|
660
|
-
|
|
684
|
+
A.value ? (y(), i(r, {
|
|
661
685
|
key: 0,
|
|
662
|
-
title:
|
|
663
|
-
type:
|
|
686
|
+
title: A.value,
|
|
687
|
+
type: j.value,
|
|
664
688
|
"show-icon": "",
|
|
665
689
|
closable: !1,
|
|
666
690
|
class: "ca-auth-alert"
|
|
667
691
|
}, null, 8, ["title", "type"])) : a("v-if", !0),
|
|
668
|
-
u(
|
|
692
|
+
u(g, {
|
|
669
693
|
ref_key: "formRef",
|
|
670
|
-
ref:
|
|
671
|
-
model:
|
|
672
|
-
rules:
|
|
694
|
+
ref: O,
|
|
695
|
+
model: v,
|
|
696
|
+
rules: N.value,
|
|
673
697
|
size: "large",
|
|
674
698
|
class: "ca-auth-form",
|
|
675
|
-
onSubmit: P(
|
|
699
|
+
onSubmit: P(L, ["prevent"])
|
|
676
700
|
}, {
|
|
677
701
|
default: M(() => [
|
|
678
702
|
u(d, { prop: "username" }, {
|
|
679
703
|
default: M(() => [u(c, {
|
|
680
|
-
modelValue:
|
|
681
|
-
"onUpdate:modelValue": n[0] ||= (e) =>
|
|
682
|
-
placeholder: D(p)("campus.auth.accountPlaceholder"),
|
|
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,
|
|
683
710
|
"aria-label": D(p)("campus.login.username"),
|
|
684
711
|
autocomplete: "username"
|
|
685
712
|
}, {
|
|
686
|
-
prefix: M(() => [u(
|
|
713
|
+
prefix: M(() => [u($, { name: "user" })]),
|
|
687
714
|
_: 1
|
|
688
715
|
}, 8, [
|
|
689
716
|
"modelValue",
|
|
690
717
|
"placeholder",
|
|
718
|
+
"maxlength",
|
|
719
|
+
"inputmode",
|
|
691
720
|
"aria-label"
|
|
692
721
|
])]),
|
|
693
722
|
_: 1
|
|
694
723
|
}),
|
|
695
724
|
u(d, { prop: "password" }, {
|
|
696
725
|
default: M(() => [u(c, {
|
|
697
|
-
modelValue:
|
|
698
|
-
"onUpdate:modelValue": n[1] ||= (e) =>
|
|
726
|
+
modelValue: v.password,
|
|
727
|
+
"onUpdate:modelValue": n[1] ||= (e) => v.password = e,
|
|
699
728
|
type: "password",
|
|
700
729
|
"show-password": "",
|
|
730
|
+
maxlength: D(_).password?.maxlength,
|
|
701
731
|
placeholder: D(p)("campus.auth.passwordPlaceholder"),
|
|
702
732
|
"aria-label": D(p)("campus.login.password"),
|
|
703
733
|
autocomplete: "current-password"
|
|
704
734
|
}, {
|
|
705
|
-
prefix: M(() => [u(
|
|
735
|
+
prefix: M(() => [u($, { name: "lock" })]),
|
|
706
736
|
_: 1
|
|
707
737
|
}, 8, [
|
|
708
738
|
"modelValue",
|
|
739
|
+
"maxlength",
|
|
709
740
|
"placeholder",
|
|
710
741
|
"aria-label"
|
|
711
742
|
])]),
|
|
@@ -715,13 +746,13 @@ var dt = "tabs", Y = I("campus-tabs", () => {
|
|
|
715
746
|
key: 0,
|
|
716
747
|
prop: "captcha"
|
|
717
748
|
}, {
|
|
718
|
-
default: M(() => [u(
|
|
749
|
+
default: M(() => [u(gt, {
|
|
719
750
|
ref_key: "captchaRef",
|
|
720
|
-
ref:
|
|
721
|
-
code:
|
|
722
|
-
"onUpdate:code": n[2] ||= (e) =>
|
|
723
|
-
"captcha-key":
|
|
724
|
-
"onUpdate:captchaKey": n[3] ||= (e) =>
|
|
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,
|
|
725
756
|
scene: "login"
|
|
726
757
|
}, null, 8, ["code", "captcha-key"])]),
|
|
727
758
|
_: 1
|
|
@@ -730,7 +761,7 @@ var dt = "tabs", Y = I("campus-tabs", () => {
|
|
|
730
761
|
type: "primary",
|
|
731
762
|
"native-type": "submit",
|
|
732
763
|
size: "large",
|
|
733
|
-
loading:
|
|
764
|
+
loading: k.value,
|
|
734
765
|
class: "ca-auth-submit"
|
|
735
766
|
}, {
|
|
736
767
|
default: M(() => [l(E(D(p)("campus.login.submit")), 1)]),
|
|
@@ -739,25 +770,25 @@ var dt = "tabs", Y = I("campus-tabs", () => {
|
|
|
739
770
|
]),
|
|
740
771
|
_: 1
|
|
741
772
|
}, 8, ["model", "rules"]),
|
|
742
|
-
|
|
773
|
+
ee.value ? (y(), o("div", _t, [D(h).forgot ? (y(), i(D(B), {
|
|
743
774
|
key: 0,
|
|
744
775
|
to: "/forgot",
|
|
745
|
-
onClick:
|
|
776
|
+
onClick: R
|
|
746
777
|
}, {
|
|
747
778
|
default: M(() => [l(E(D(p)("campus.auth.forgotLink")), 1)]),
|
|
748
779
|
_: 1
|
|
749
|
-
})) : a("v-if", !0), D(h).register ? (y(), i(D(
|
|
780
|
+
})) : a("v-if", !0), D(h).register ? (y(), i(D(B), {
|
|
750
781
|
key: 1,
|
|
751
782
|
to: "/register",
|
|
752
|
-
onClick:
|
|
783
|
+
onClick: R
|
|
753
784
|
}, {
|
|
754
785
|
default: M(() => [l(E(D(p)("campus.auth.registerLink")), 1)]),
|
|
755
786
|
_: 1
|
|
756
787
|
})) : a("v-if", !0)])) : a("v-if", !0),
|
|
757
|
-
s("div",
|
|
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), {
|
|
758
789
|
key: 1,
|
|
759
790
|
to: "/forgot",
|
|
760
|
-
onClick:
|
|
791
|
+
onClick: R
|
|
761
792
|
}, {
|
|
762
793
|
default: M(() => [l(E(D(p)("campus.auth.findPassword")), 1)]),
|
|
763
794
|
_: 1
|
|
@@ -765,43 +796,101 @@ var dt = "tabs", Y = I("campus-tabs", () => {
|
|
|
765
796
|
], 64);
|
|
766
797
|
};
|
|
767
798
|
}
|
|
768
|
-
})
|
|
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
|
|
825
|
+
};
|
|
826
|
+
}
|
|
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 = {
|
|
769
839
|
key: 0,
|
|
770
840
|
class: "ca-auth-wechat__note"
|
|
771
841
|
}, kt = /* @__PURE__ */ d({
|
|
772
842
|
__name: "WechatPane",
|
|
843
|
+
props: { preview: { type: Boolean } },
|
|
773
844
|
setup(e) {
|
|
774
|
-
let { t } = W(),
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
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
|
+
};
|
|
789
878
|
}
|
|
790
879
|
}), At = /* @__PURE__ */ d({
|
|
791
880
|
__name: "LoginSplit",
|
|
792
881
|
props: { preview: { type: Boolean } },
|
|
793
882
|
setup(e) {
|
|
794
|
-
let { t } = W(), r =
|
|
883
|
+
let { t } = W(), r = q().tabs?.length ? q().tabs : ["account", "wechat"], a = x(r[0]), o = n(() => r.map((e) => ({
|
|
795
884
|
key: e,
|
|
796
885
|
label: t(e === "account" ? "campus.auth.tabAccount" : "campus.auth.tabWechat")
|
|
797
886
|
})));
|
|
798
|
-
return (t, n) => (y(), i(
|
|
887
|
+
return (t, n) => (y(), i(at, {
|
|
799
888
|
active: a.value,
|
|
800
889
|
"onUpdate:active": n[0] ||= (e) => a.value = e,
|
|
801
890
|
tabs: o.value,
|
|
802
891
|
preview: e.preview
|
|
803
892
|
}, {
|
|
804
|
-
default: M(() => [a.value === "account" ? (y(), i(
|
|
893
|
+
default: M(() => [a.value === "account" ? (y(), i(yt, {
|
|
805
894
|
key: 0,
|
|
806
895
|
preview: e.preview
|
|
807
896
|
}, null, 8, ["preview"])) : (y(), i(kt, { key: 1 }))]),
|
|
@@ -824,68 +913,68 @@ function Nt(e, t) {
|
|
|
824
913
|
return t === "test" || e.length >= 8 && /[A-Za-z]/.test(e) && /\d/.test(e);
|
|
825
914
|
}
|
|
826
915
|
// packages/core/src/services/feedback.ts
|
|
827
|
-
var
|
|
828
|
-
function
|
|
829
|
-
|
|
916
|
+
var Pt = (e) => e;
|
|
917
|
+
function Ft(e) {
|
|
918
|
+
Pt = e;
|
|
830
919
|
}
|
|
831
|
-
async function
|
|
832
|
-
await
|
|
920
|
+
async function It(e, t = {}) {
|
|
921
|
+
await pe.alert(e, t.title ?? Pt("campus.common.tip"), {
|
|
833
922
|
type: t.type ?? "info",
|
|
834
|
-
confirmButtonText: t.confirmText ??
|
|
923
|
+
confirmButtonText: t.confirmText ?? Pt("campus.common.ok")
|
|
835
924
|
});
|
|
836
925
|
}
|
|
837
|
-
async function
|
|
926
|
+
async function Lt(e, t = {}) {
|
|
838
927
|
try {
|
|
839
|
-
return await
|
|
928
|
+
return await pe.confirm(e, t.title ?? Pt("campus.common.tip"), {
|
|
840
929
|
type: t.type ?? "warning",
|
|
841
|
-
confirmButtonText: t.confirmText ??
|
|
842
|
-
cancelButtonText: t.cancelText ??
|
|
930
|
+
confirmButtonText: t.confirmText ?? Pt("campus.common.confirm"),
|
|
931
|
+
cancelButtonText: t.cancelText ?? Pt("campus.common.cancel")
|
|
843
932
|
}), !0;
|
|
844
933
|
} catch (e) {
|
|
845
934
|
if (e === "cancel" || e === "close") return !1;
|
|
846
935
|
throw e;
|
|
847
936
|
}
|
|
848
937
|
}
|
|
849
|
-
var
|
|
850
|
-
info: (e) => void
|
|
938
|
+
var Rt = {
|
|
939
|
+
info: (e) => void fe({
|
|
851
940
|
message: e,
|
|
852
941
|
type: "info"
|
|
853
942
|
}),
|
|
854
|
-
success: (e) => void
|
|
943
|
+
success: (e) => void fe({
|
|
855
944
|
message: e,
|
|
856
945
|
type: "success"
|
|
857
946
|
}),
|
|
858
|
-
warning: (e) => void
|
|
947
|
+
warning: (e) => void fe({
|
|
859
948
|
message: e,
|
|
860
949
|
type: "warning"
|
|
861
950
|
}),
|
|
862
|
-
error: (e) => void
|
|
951
|
+
error: (e) => void fe({
|
|
863
952
|
message: e,
|
|
864
953
|
type: "error"
|
|
865
954
|
})
|
|
866
|
-
},
|
|
867
|
-
function
|
|
868
|
-
let r =
|
|
955
|
+
}, zt = de.service;
|
|
956
|
+
function Bt(e, t, n = {}) {
|
|
957
|
+
let r = me({
|
|
869
958
|
...n,
|
|
870
|
-
title: n.title ??
|
|
959
|
+
title: n.title ?? Pt(`campus.notify.${e}`),
|
|
871
960
|
message: t,
|
|
872
961
|
type: e
|
|
873
962
|
});
|
|
874
|
-
return m(() =>
|
|
963
|
+
return m(() => me.updateOffsets(n.position)), r;
|
|
875
964
|
}
|
|
876
965
|
// packages/core/src/services/ca.ts
|
|
877
|
-
var
|
|
878
|
-
alert:
|
|
879
|
-
confirm:
|
|
880
|
-
toast:
|
|
881
|
-
loading:
|
|
966
|
+
var Vt = {
|
|
967
|
+
alert: It,
|
|
968
|
+
confirm: Lt,
|
|
969
|
+
toast: Rt,
|
|
970
|
+
loading: zt,
|
|
882
971
|
notify: {
|
|
883
|
-
success: (e, t) =>
|
|
884
|
-
info: (e, t) =>
|
|
885
|
-
warning: (e, t) =>
|
|
886
|
-
error: (e, t) =>
|
|
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)
|
|
887
976
|
}
|
|
888
|
-
},
|
|
977
|
+
}, Ht = { class: "ca-auth-row" }, Ut = ["disabled"], Wt = 60, Gt = /* @__PURE__ */ d({
|
|
889
978
|
__name: "SmsField",
|
|
890
979
|
props: /*@__PURE__*/ p({ send: { type: Function } }, {
|
|
891
980
|
modelValue: { default: "" },
|
|
@@ -907,14 +996,14 @@ var $ = {
|
|
|
907
996
|
} finally {
|
|
908
997
|
a.value = !1;
|
|
909
998
|
}
|
|
910
|
-
i.value =
|
|
999
|
+
i.value = Wt, l(), c = setInterval(() => {
|
|
911
1000
|
--i.value, i.value <= 0 && l();
|
|
912
1001
|
}, 1e3);
|
|
913
1002
|
}
|
|
914
1003
|
}
|
|
915
1004
|
return _(l), (e, t) => {
|
|
916
1005
|
let c = w("ca-input");
|
|
917
|
-
return y(), o("div",
|
|
1006
|
+
return y(), o("div", Ht, [u(c, {
|
|
918
1007
|
modelValue: n.value,
|
|
919
1008
|
"onUpdate:modelValue": t[0] ||= (e) => n.value = e,
|
|
920
1009
|
placeholder: D(r)("campus.auth.smsPlaceholder"),
|
|
@@ -922,7 +1011,7 @@ var $ = {
|
|
|
922
1011
|
autocomplete: "one-time-code",
|
|
923
1012
|
maxlength: "8"
|
|
924
1013
|
}, {
|
|
925
|
-
prefix: M(() => [u(
|
|
1014
|
+
prefix: M(() => [u($, { name: "message" })]),
|
|
926
1015
|
_: 1
|
|
927
1016
|
}, 8, [
|
|
928
1017
|
"modelValue",
|
|
@@ -933,17 +1022,17 @@ var $ = {
|
|
|
933
1022
|
class: "ca-auth-sms",
|
|
934
1023
|
disabled: i.value > 0 || a.value,
|
|
935
1024
|
onClick: d
|
|
936
|
-
}, E(i.value > 0 ? D(r)("campus.auth.resend", { n: i.value }) : D(r)("campus.auth.getCode")), 9,
|
|
1025
|
+
}, E(i.value > 0 ? D(r)("campus.auth.resend", { n: i.value }) : D(r)("campus.auth.getCode")), 9, Ut)]);
|
|
937
1026
|
};
|
|
938
1027
|
}
|
|
939
|
-
}),
|
|
1028
|
+
}), Kt = {
|
|
940
1029
|
key: 0,
|
|
941
1030
|
class: "ca-auth-hint"
|
|
942
|
-
},
|
|
1031
|
+
}, qt = { class: "ca-auth-agreements" }, Jt = ["href"], Yt = /* @__PURE__ */ d({
|
|
943
1032
|
__name: "RegisterForm",
|
|
944
1033
|
props: { preview: { type: Boolean } },
|
|
945
1034
|
setup(t) {
|
|
946
|
-
let r = t, c =
|
|
1035
|
+
let r = t, c = H(), { t: d, label: f } = W(), p = J(), m = jt(K()), g = q(), _ = g.agreements ?? [], v = b({
|
|
947
1036
|
phone: "",
|
|
948
1037
|
captcha: "",
|
|
949
1038
|
code: "",
|
|
@@ -956,7 +1045,7 @@ var $ = {
|
|
|
956
1045
|
message: d("campus.auth.phonePlaceholder"),
|
|
957
1046
|
trigger: "blur"
|
|
958
1047
|
}, {
|
|
959
|
-
pattern:
|
|
1048
|
+
pattern: Ve,
|
|
960
1049
|
message: d("campus.auth.phoneInvalid"),
|
|
961
1050
|
trigger: "blur"
|
|
962
1051
|
}],
|
|
@@ -1003,19 +1092,19 @@ var $ = {
|
|
|
1003
1092
|
}
|
|
1004
1093
|
if (A.value = "", r.preview) j.value = "info", A.value = d("campus.auth.previewNote");
|
|
1005
1094
|
else try {
|
|
1006
|
-
await
|
|
1095
|
+
await K().auth.sendSmsCode({
|
|
1007
1096
|
phone: v.phone,
|
|
1008
1097
|
scene: "register",
|
|
1009
1098
|
captcha: p.captcha ? {
|
|
1010
1099
|
key: C.value,
|
|
1011
1100
|
code: v.captcha
|
|
1012
1101
|
} : void 0
|
|
1013
|
-
}),
|
|
1102
|
+
}), Vt.toast.success(d("campus.auth.smsSent"));
|
|
1014
1103
|
} catch (e) {
|
|
1015
1104
|
throw I(e, d("campus.login.failed")), T.value?.refresh(), e;
|
|
1016
1105
|
}
|
|
1017
1106
|
}
|
|
1018
|
-
async function
|
|
1107
|
+
async function R() {
|
|
1019
1108
|
if (F.value) {
|
|
1020
1109
|
try {
|
|
1021
1110
|
await O.value?.validate();
|
|
@@ -1026,7 +1115,7 @@ var $ = {
|
|
|
1026
1115
|
else {
|
|
1027
1116
|
k.value = !0, A.value = "";
|
|
1028
1117
|
try {
|
|
1029
|
-
await
|
|
1118
|
+
await K().auth.register({
|
|
1030
1119
|
phone: v.phone,
|
|
1031
1120
|
code: v.code,
|
|
1032
1121
|
password: v.password,
|
|
@@ -1034,7 +1123,7 @@ var $ = {
|
|
|
1034
1123
|
key: C.value,
|
|
1035
1124
|
code: v.captcha
|
|
1036
1125
|
} : void 0
|
|
1037
|
-
}),
|
|
1126
|
+
}), Vt.toast.success(d("campus.auth.registerOk")), await c.replace("/login");
|
|
1038
1127
|
} catch (e) {
|
|
1039
1128
|
I(e, d("campus.login.failed")), T.value?.refresh();
|
|
1040
1129
|
} finally {
|
|
@@ -1059,7 +1148,7 @@ var $ = {
|
|
|
1059
1148
|
rules: N.value,
|
|
1060
1149
|
size: "large",
|
|
1061
1150
|
class: "ca-auth-form",
|
|
1062
|
-
onSubmit: P(
|
|
1151
|
+
onSubmit: P(R, ["prevent"])
|
|
1063
1152
|
}, {
|
|
1064
1153
|
default: M(() => [
|
|
1065
1154
|
u(m, { prop: "phone" }, {
|
|
@@ -1071,7 +1160,7 @@ var $ = {
|
|
|
1071
1160
|
autocomplete: "tel",
|
|
1072
1161
|
maxlength: "11"
|
|
1073
1162
|
}, {
|
|
1074
|
-
prefix: M(() => [u(
|
|
1163
|
+
prefix: M(() => [u($, { name: "phone" })]),
|
|
1075
1164
|
_: 1
|
|
1076
1165
|
}, 8, [
|
|
1077
1166
|
"modelValue",
|
|
@@ -1084,7 +1173,7 @@ var $ = {
|
|
|
1084
1173
|
key: 0,
|
|
1085
1174
|
prop: "captcha"
|
|
1086
1175
|
}, {
|
|
1087
|
-
default: M(() => [u(
|
|
1176
|
+
default: M(() => [u(gt, {
|
|
1088
1177
|
ref_key: "captchaRef",
|
|
1089
1178
|
ref: T,
|
|
1090
1179
|
code: v.captcha,
|
|
@@ -1096,11 +1185,11 @@ var $ = {
|
|
|
1096
1185
|
_: 1
|
|
1097
1186
|
})) : a("v-if", !0),
|
|
1098
1187
|
u(m, { prop: "code" }, {
|
|
1099
|
-
default: M(() => [u(
|
|
1188
|
+
default: M(() => [u(Gt, {
|
|
1100
1189
|
modelValue: v.code,
|
|
1101
1190
|
"onUpdate:modelValue": n[3] ||= (e) => v.code = e,
|
|
1102
1191
|
send: L
|
|
1103
|
-
}, null, 8, ["modelValue"]), D(g).smsHint ? (y(), o("p",
|
|
1192
|
+
}, null, 8, ["modelValue"]), D(g).smsHint ? (y(), o("p", Kt, E(D(f)(D(g).smsHint)), 1)) : a("v-if", !0)]),
|
|
1104
1193
|
_: 1
|
|
1105
1194
|
}),
|
|
1106
1195
|
u(m, { prop: "password" }, {
|
|
@@ -1113,7 +1202,7 @@ var $ = {
|
|
|
1113
1202
|
"aria-label": D(d)("campus.auth.registerPassword"),
|
|
1114
1203
|
autocomplete: "new-password"
|
|
1115
1204
|
}, {
|
|
1116
|
-
prefix: M(() => [u(
|
|
1205
|
+
prefix: M(() => [u($, { name: "lock" })]),
|
|
1117
1206
|
_: 1
|
|
1118
1207
|
}, 8, [
|
|
1119
1208
|
"modelValue",
|
|
@@ -1132,7 +1221,7 @@ var $ = {
|
|
|
1132
1221
|
"aria-label": D(d)("campus.auth.confirmPlaceholder"),
|
|
1133
1222
|
autocomplete: "new-password"
|
|
1134
1223
|
}, {
|
|
1135
|
-
prefix: M(() => [u(
|
|
1224
|
+
prefix: M(() => [u($, { name: "lock" })]),
|
|
1136
1225
|
_: 1
|
|
1137
1226
|
}, 8, [
|
|
1138
1227
|
"modelValue",
|
|
@@ -1151,12 +1240,12 @@ var $ = {
|
|
|
1151
1240
|
}, {
|
|
1152
1241
|
default: M(() => [l(E(D(d)("campus.auth.agreePrefix")), 1)]),
|
|
1153
1242
|
_: 1
|
|
1154
|
-
}, 8, ["modelValue"]), s("span",
|
|
1243
|
+
}, 8, ["modelValue"]), s("span", qt, [(y(!0), o(e, null, S(D(_), (e) => (y(), o("a", {
|
|
1155
1244
|
key: e.href,
|
|
1156
1245
|
href: e.href,
|
|
1157
1246
|
target: "_blank",
|
|
1158
1247
|
rel: "noopener noreferrer"
|
|
1159
|
-
}, E(D(f)(e.text)), 9,
|
|
1248
|
+
}, E(D(f)(e.text)), 9, Jt))), 128))])]),
|
|
1160
1249
|
_: 1
|
|
1161
1250
|
})) : a("v-if", !0),
|
|
1162
1251
|
u(x, {
|
|
@@ -1179,15 +1268,15 @@ var $ = {
|
|
|
1179
1268
|
}, 8, ["model", "rules"])], 64);
|
|
1180
1269
|
};
|
|
1181
1270
|
}
|
|
1182
|
-
}),
|
|
1271
|
+
}), Xt = {
|
|
1183
1272
|
key: 1,
|
|
1184
1273
|
class: "ca-auth-off",
|
|
1185
1274
|
role: "status"
|
|
1186
|
-
},
|
|
1275
|
+
}, Zt = /* @__PURE__ */ d({
|
|
1187
1276
|
__name: "RegisterPage",
|
|
1188
1277
|
props: { preview: { type: Boolean } },
|
|
1189
1278
|
setup(e) {
|
|
1190
|
-
let { t } = W(), r =
|
|
1279
|
+
let { t } = W(), r = J().register, a = n(() => [{
|
|
1191
1280
|
key: "register",
|
|
1192
1281
|
label: t("campus.auth.tabRegister")
|
|
1193
1282
|
}, {
|
|
@@ -1195,26 +1284,26 @@ var $ = {
|
|
|
1195
1284
|
label: t("campus.auth.backLogin"),
|
|
1196
1285
|
to: "/login"
|
|
1197
1286
|
}]);
|
|
1198
|
-
return (n, c) => (y(), i(
|
|
1287
|
+
return (n, c) => (y(), i(at, {
|
|
1199
1288
|
active: "register",
|
|
1200
1289
|
tabs: a.value,
|
|
1201
1290
|
preview: e.preview
|
|
1202
1291
|
}, {
|
|
1203
|
-
default: M(() => [D(r) ? (y(), i(
|
|
1292
|
+
default: M(() => [D(r) ? (y(), i(Yt, {
|
|
1204
1293
|
key: 0,
|
|
1205
1294
|
preview: e.preview
|
|
1206
|
-
}, null, 8, ["preview"])) : (y(), o("div",
|
|
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)]))]),
|
|
1207
1296
|
_: 1
|
|
1208
1297
|
}, 8, ["tabs", "preview"]));
|
|
1209
1298
|
}
|
|
1210
|
-
}),
|
|
1299
|
+
}), Qt = {
|
|
1211
1300
|
key: 0,
|
|
1212
1301
|
class: "ca-auth-hint"
|
|
1213
|
-
},
|
|
1302
|
+
}, $t = /* @__PURE__ */ d({
|
|
1214
1303
|
__name: "ForgotForm",
|
|
1215
1304
|
props: { preview: { type: Boolean } },
|
|
1216
1305
|
setup(t) {
|
|
1217
|
-
let r = t, s =
|
|
1306
|
+
let r = t, s = H(), { t: c, label: d } = W(), f = J(), p = jt(K()), m = q(), g = b({
|
|
1218
1307
|
account: "",
|
|
1219
1308
|
captcha: "",
|
|
1220
1309
|
code: "",
|
|
@@ -1265,14 +1354,14 @@ var $ = {
|
|
|
1265
1354
|
}
|
|
1266
1355
|
if (T.value = "", r.preview) O.value = "info", T.value = c("campus.auth.previewNote");
|
|
1267
1356
|
else try {
|
|
1268
|
-
await
|
|
1269
|
-
...
|
|
1357
|
+
await K().auth.sendSmsCode({
|
|
1358
|
+
...Ve.test(g.account) ? { phone: g.account } : { username: g.account },
|
|
1270
1359
|
scene: "forgot",
|
|
1271
1360
|
captcha: f.captcha ? {
|
|
1272
1361
|
key: _.value,
|
|
1273
1362
|
code: g.captcha
|
|
1274
1363
|
} : void 0
|
|
1275
|
-
}),
|
|
1364
|
+
}), Vt.toast.success(c("campus.auth.smsSent"));
|
|
1276
1365
|
} catch (e) {
|
|
1277
1366
|
throw j(e, c("campus.login.failed")), v.value?.refresh(), e;
|
|
1278
1367
|
}
|
|
@@ -1288,7 +1377,7 @@ var $ = {
|
|
|
1288
1377
|
else {
|
|
1289
1378
|
C.value = !0, T.value = "";
|
|
1290
1379
|
try {
|
|
1291
|
-
await
|
|
1380
|
+
await K().auth.resetPassword({
|
|
1292
1381
|
account: g.account,
|
|
1293
1382
|
code: g.code,
|
|
1294
1383
|
password: g.password,
|
|
@@ -1296,7 +1385,7 @@ var $ = {
|
|
|
1296
1385
|
key: _.value,
|
|
1297
1386
|
code: g.captcha
|
|
1298
1387
|
} : void 0
|
|
1299
|
-
}),
|
|
1388
|
+
}), Vt.toast.success(c("campus.auth.resetOk")), await s.replace("/login");
|
|
1300
1389
|
} catch (e) {
|
|
1301
1390
|
j(e, c("campus.login.failed")), v.value?.refresh();
|
|
1302
1391
|
} finally {
|
|
@@ -1332,7 +1421,7 @@ var $ = {
|
|
|
1332
1421
|
"aria-label": D(c)("campus.auth.account"),
|
|
1333
1422
|
autocomplete: "username"
|
|
1334
1423
|
}, {
|
|
1335
|
-
prefix: M(() => [u(
|
|
1424
|
+
prefix: M(() => [u($, { name: "user" })]),
|
|
1336
1425
|
_: 1
|
|
1337
1426
|
}, 8, [
|
|
1338
1427
|
"modelValue",
|
|
@@ -1345,7 +1434,7 @@ var $ = {
|
|
|
1345
1434
|
key: 0,
|
|
1346
1435
|
prop: "captcha"
|
|
1347
1436
|
}, {
|
|
1348
|
-
default: M(() => [u(
|
|
1437
|
+
default: M(() => [u(gt, {
|
|
1349
1438
|
ref_key: "captchaRef",
|
|
1350
1439
|
ref: v,
|
|
1351
1440
|
code: g.captcha,
|
|
@@ -1357,11 +1446,11 @@ var $ = {
|
|
|
1357
1446
|
_: 1
|
|
1358
1447
|
})) : a("v-if", !0),
|
|
1359
1448
|
u(p, { prop: "code" }, {
|
|
1360
|
-
default: M(() => [u(
|
|
1449
|
+
default: M(() => [u(Gt, {
|
|
1361
1450
|
modelValue: g.code,
|
|
1362
1451
|
"onUpdate:modelValue": n[3] ||= (e) => g.code = e,
|
|
1363
1452
|
send: N
|
|
1364
|
-
}, null, 8, ["modelValue"]), D(m).smsHint ? (y(), o("p",
|
|
1453
|
+
}, null, 8, ["modelValue"]), D(m).smsHint ? (y(), o("p", Qt, E(D(d)(D(m).smsHint)), 1)) : a("v-if", !0)]),
|
|
1365
1454
|
_: 1
|
|
1366
1455
|
}),
|
|
1367
1456
|
u(p, { prop: "password" }, {
|
|
@@ -1374,7 +1463,7 @@ var $ = {
|
|
|
1374
1463
|
"aria-label": D(c)("campus.auth.newPasswordPlaceholder"),
|
|
1375
1464
|
autocomplete: "new-password"
|
|
1376
1465
|
}, {
|
|
1377
|
-
prefix: M(() => [u(
|
|
1466
|
+
prefix: M(() => [u($, { name: "lock" })]),
|
|
1378
1467
|
_: 1
|
|
1379
1468
|
}, 8, [
|
|
1380
1469
|
"modelValue",
|
|
@@ -1393,7 +1482,7 @@ var $ = {
|
|
|
1393
1482
|
"aria-label": D(c)("campus.auth.confirmPlaceholder"),
|
|
1394
1483
|
autocomplete: "new-password"
|
|
1395
1484
|
}, {
|
|
1396
|
-
prefix: M(() => [u(
|
|
1485
|
+
prefix: M(() => [u($, { name: "lock" })]),
|
|
1397
1486
|
_: 1
|
|
1398
1487
|
}, 8, [
|
|
1399
1488
|
"modelValue",
|
|
@@ -1422,15 +1511,15 @@ var $ = {
|
|
|
1422
1511
|
}, 8, ["model", "rules"])], 64);
|
|
1423
1512
|
};
|
|
1424
1513
|
}
|
|
1425
|
-
}),
|
|
1514
|
+
}), en = {
|
|
1426
1515
|
key: 1,
|
|
1427
1516
|
class: "ca-auth-off",
|
|
1428
1517
|
role: "status"
|
|
1429
|
-
},
|
|
1518
|
+
}, tn = /* @__PURE__ */ d({
|
|
1430
1519
|
__name: "ForgotPage",
|
|
1431
1520
|
props: { preview: { type: Boolean } },
|
|
1432
1521
|
setup(e) {
|
|
1433
|
-
let { t } = W(), r =
|
|
1522
|
+
let { t } = W(), r = J().forgot, a = n(() => [{
|
|
1434
1523
|
key: "forgot",
|
|
1435
1524
|
label: t("campus.auth.tabForgot")
|
|
1436
1525
|
}, {
|
|
@@ -1438,51 +1527,51 @@ var $ = {
|
|
|
1438
1527
|
label: t("campus.auth.backLogin"),
|
|
1439
1528
|
to: "/login"
|
|
1440
1529
|
}]);
|
|
1441
|
-
return (n, c) => (y(), i(
|
|
1530
|
+
return (n, c) => (y(), i(at, {
|
|
1442
1531
|
active: "forgot",
|
|
1443
1532
|
tabs: a.value,
|
|
1444
1533
|
preview: e.preview
|
|
1445
1534
|
}, {
|
|
1446
|
-
default: M(() => [D(r) ? (y(), i(
|
|
1535
|
+
default: M(() => [D(r) ? (y(), i($t, {
|
|
1447
1536
|
key: 0,
|
|
1448
1537
|
preview: e.preview
|
|
1449
|
-
}, null, 8, ["preview"])) : (y(), o("div",
|
|
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)]))]),
|
|
1450
1539
|
_: 1
|
|
1451
1540
|
}, 8, ["tabs", "preview"]));
|
|
1452
1541
|
}
|
|
1453
|
-
}),
|
|
1542
|
+
}), nn = /* @__PURE__ */ d({
|
|
1454
1543
|
__name: "AuthPreview",
|
|
1455
1544
|
props: { kind: {} },
|
|
1456
1545
|
setup(e) {
|
|
1457
1546
|
return (t, n) => e.kind === "login" ? (y(), i(At, {
|
|
1458
1547
|
key: 0,
|
|
1459
1548
|
preview: ""
|
|
1460
|
-
})) : e.kind === "register" ? (y(), i(
|
|
1549
|
+
})) : e.kind === "register" ? (y(), i(Zt, {
|
|
1461
1550
|
key: 1,
|
|
1462
1551
|
preview: ""
|
|
1463
|
-
})) : (y(), i(
|
|
1552
|
+
})) : (y(), i(tn, {
|
|
1464
1553
|
key: 2,
|
|
1465
1554
|
preview: ""
|
|
1466
1555
|
}));
|
|
1467
1556
|
}
|
|
1468
|
-
}),
|
|
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 = {
|
|
1469
1558
|
key: 0,
|
|
1470
1559
|
class: "ca-header__subtitle"
|
|
1471
|
-
},
|
|
1560
|
+
}, dn = ["aria-label"], fn = ["onClick"], pn = { class: "ca-header__tools" }, mn = { class: "ca-header__search-text" }, hn = [
|
|
1472
1561
|
"title",
|
|
1473
1562
|
"aria-label",
|
|
1474
1563
|
"aria-pressed"
|
|
1475
|
-
],
|
|
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 = {
|
|
1476
1565
|
key: 0,
|
|
1477
1566
|
class: "ca-settings__group"
|
|
1478
|
-
},
|
|
1567
|
+
}, On = { class: "ca-settings__title" }, kn = ["aria-label"], An = [
|
|
1479
1568
|
"aria-label",
|
|
1480
1569
|
"aria-checked",
|
|
1481
1570
|
"onClick"
|
|
1482
|
-
],
|
|
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({
|
|
1483
1572
|
__name: "HeaderBar",
|
|
1484
1573
|
setup(t) {
|
|
1485
|
-
let r =
|
|
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 = [{
|
|
1486
1575
|
value: "border",
|
|
1487
1576
|
label: "campus.settings.boxBorder"
|
|
1488
1577
|
}, {
|
|
@@ -1515,35 +1604,35 @@ var $ = {
|
|
|
1515
1604
|
"#0f9d58",
|
|
1516
1605
|
"#0ca678"
|
|
1517
1606
|
], L = n(() => p.theme.primary);
|
|
1518
|
-
function
|
|
1607
|
+
function R(e, t) {
|
|
1519
1608
|
let n = t.currentTarget?.getBoundingClientRect();
|
|
1520
1609
|
p.setMode(e, n ? {
|
|
1521
1610
|
x: n.left + n.width / 2,
|
|
1522
1611
|
y: n.top + n.height / 2
|
|
1523
1612
|
} : void 0);
|
|
1524
1613
|
}
|
|
1525
|
-
function
|
|
1614
|
+
function te(e) {
|
|
1526
1615
|
C.value = e, Ee(e);
|
|
1527
1616
|
}
|
|
1528
|
-
async function
|
|
1617
|
+
async function ne(e) {
|
|
1529
1618
|
e === "account" ? T.accountPath && P(T.accountPath) : (await d.logout(), await c.replace({ name: "login" }));
|
|
1530
1619
|
}
|
|
1531
|
-
let
|
|
1532
|
-
function
|
|
1533
|
-
|
|
1620
|
+
let z = x(!1);
|
|
1621
|
+
function B() {
|
|
1622
|
+
z.value = !!document.fullscreenElement;
|
|
1534
1623
|
}
|
|
1535
|
-
async function
|
|
1624
|
+
async function re() {
|
|
1536
1625
|
try {
|
|
1537
1626
|
document.fullscreenElement ? await document.exitFullscreen() : await document.documentElement.requestFullscreen();
|
|
1538
1627
|
} catch {}
|
|
1539
1628
|
}
|
|
1540
|
-
v(() => document.addEventListener("fullscreenchange",
|
|
1541
|
-
function
|
|
1629
|
+
v(() => document.addEventListener("fullscreenchange", B)), _(() => document.removeEventListener("fullscreenchange", B));
|
|
1630
|
+
function ie(e) {
|
|
1542
1631
|
T.headerTools?.[e]?.();
|
|
1543
1632
|
}
|
|
1544
1633
|
return (t, n) => {
|
|
1545
|
-
let c = w("ca-icon"), _ = w("ca-dropdown-item"), v = w("ca-dropdown-menu"), x = w("ca-dropdown"),
|
|
1546
|
-
return y(), o("header",
|
|
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, [
|
|
1547
1636
|
s("button", {
|
|
1548
1637
|
type: "button",
|
|
1549
1638
|
class: "ca-header__hamburger ca-header__icon",
|
|
@@ -1559,13 +1648,13 @@ var $ = {
|
|
|
1559
1648
|
"stroke-width": "2",
|
|
1560
1649
|
"stroke-linecap": "round",
|
|
1561
1650
|
"aria-hidden": "true"
|
|
1562
|
-
}, [s("path", { d: "M4 6h16M4 12h16M4 18h16" })], -1)]], 8,
|
|
1563
|
-
s("div",
|
|
1651
|
+
}, [s("path", { d: "M4 6h16M4 12h16M4 18h16" })], -1)]], 8, an),
|
|
1652
|
+
s("div", on, [j.value ? (y(), o("img", {
|
|
1564
1653
|
key: 0,
|
|
1565
1654
|
src: j.value,
|
|
1566
1655
|
alt: "",
|
|
1567
1656
|
class: "ca-header__logo"
|
|
1568
|
-
}, null, 8,
|
|
1657
|
+
}, null, 8, sn)) : (y(), o(e, { key: 1 }, [a(" 没有配置 logo 时用框架默认标志(学士帽),颜色跟随头部前景色 "), n[9] ||= s("svg", {
|
|
1569
1658
|
class: "ca-header__logo",
|
|
1570
1659
|
viewBox: "0 0 32 32",
|
|
1571
1660
|
fill: "none",
|
|
@@ -1578,7 +1667,7 @@ var $ = {
|
|
|
1578
1667
|
s("path", { d: "M16 6 3 12.5 16 19l13-6.5L16 6Z" }),
|
|
1579
1668
|
s("path", { d: "M9 16.5v5.2c0 1.6 3.1 3.3 7 3.3s7-1.7 7-3.3v-5.2" }),
|
|
1580
1669
|
s("path", { d: "M29 12.5V20" })
|
|
1581
|
-
], -1)], 2112)), s("div",
|
|
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)])]),
|
|
1582
1671
|
s("nav", {
|
|
1583
1672
|
class: "ca-header__nav",
|
|
1584
1673
|
"aria-label": D(m)("campus.header.shortcuts")
|
|
@@ -1587,34 +1676,34 @@ var $ = {
|
|
|
1587
1676
|
class: h(["ca-header__nav-item", { "is-active": D(r).path === e.path }]),
|
|
1588
1677
|
type: "button",
|
|
1589
1678
|
onClick: (t) => P(e.path)
|
|
1590
|
-
}, E(D(b)(e.title)), 11,
|
|
1591
|
-
s("div",
|
|
1679
|
+
}, E(D(b)(e.title)), 11, fn))), 128))], 8, dn),
|
|
1680
|
+
s("div", pn, [
|
|
1592
1681
|
s("button", {
|
|
1593
1682
|
type: "button",
|
|
1594
1683
|
class: "ca-header__search",
|
|
1595
|
-
onClick: n[1] ||= (e) =>
|
|
1684
|
+
onClick: n[1] ||= (e) => ie("search")
|
|
1596
1685
|
}, [
|
|
1597
1686
|
u(c, { name: "search" }),
|
|
1598
|
-
s("span",
|
|
1687
|
+
s("span", mn, E(D(m)("campus.header.search")), 1),
|
|
1599
1688
|
n[10] ||= s("kbd", { class: "ca-header__kbd" }, "⌘ K", -1)
|
|
1600
1689
|
]),
|
|
1601
1690
|
s("button", {
|
|
1602
1691
|
type: "button",
|
|
1603
1692
|
class: "ca-header__icon ca-header__desktop-tool",
|
|
1604
|
-
title:
|
|
1605
|
-
"aria-label":
|
|
1606
|
-
"aria-pressed":
|
|
1607
|
-
onClick:
|
|
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
|
|
1608
1697
|
}, [u(c, {
|
|
1609
|
-
name:
|
|
1698
|
+
name: z.value ? "exitFullscreen" : "fullscreen",
|
|
1610
1699
|
size: 18
|
|
1611
|
-
}, null, 8, ["name"])], 8,
|
|
1700
|
+
}, null, 8, ["name"])], 8, hn),
|
|
1612
1701
|
u(x, {
|
|
1613
1702
|
trigger: "click",
|
|
1614
|
-
onCommand:
|
|
1703
|
+
onCommand: te
|
|
1615
1704
|
}, {
|
|
1616
1705
|
dropdown: M(() => [u(v, null, {
|
|
1617
|
-
default: M(() => [(y(!0), o(e, null, S(D(
|
|
1706
|
+
default: M(() => [(y(!0), o(e, null, S(D(ee), (e) => (y(), i(_, {
|
|
1618
1707
|
key: e.code,
|
|
1619
1708
|
command: e.code,
|
|
1620
1709
|
class: h({ "is-current": D(C) === e.code })
|
|
@@ -1629,7 +1718,7 @@ var $ = {
|
|
|
1629
1718
|
class: "ca-header__icon",
|
|
1630
1719
|
title: D(m)("campus.header.language"),
|
|
1631
1720
|
"aria-label": D(m)("campus.header.language")
|
|
1632
|
-
}, [s("span",
|
|
1721
|
+
}, [s("span", _n, E(D(ee).find((e) => e.code === D(C))?.label), 1)], 8, gn)]),
|
|
1633
1722
|
_: 1
|
|
1634
1723
|
}),
|
|
1635
1724
|
s("button", {
|
|
@@ -1637,27 +1726,27 @@ var $ = {
|
|
|
1637
1726
|
class: "ca-header__icon ca-header__desktop-tool",
|
|
1638
1727
|
title: D(m)("campus.header.notifications"),
|
|
1639
1728
|
"aria-label": D(m)("campus.header.notifications"),
|
|
1640
|
-
onClick: n[2] ||= (e) =>
|
|
1729
|
+
onClick: n[2] ||= (e) => ie("notifications")
|
|
1641
1730
|
}, [u(c, {
|
|
1642
1731
|
name: "bell",
|
|
1643
1732
|
size: 18
|
|
1644
1733
|
}), n[11] ||= s("i", {
|
|
1645
1734
|
class: "ca-header__dot is-danger",
|
|
1646
1735
|
"aria-hidden": "true"
|
|
1647
|
-
}, null, -1)], 8,
|
|
1736
|
+
}, null, -1)], 8, vn),
|
|
1648
1737
|
s("button", {
|
|
1649
1738
|
type: "button",
|
|
1650
1739
|
class: "ca-header__icon ca-header__desktop-tool",
|
|
1651
1740
|
title: D(m)("campus.header.assistant"),
|
|
1652
1741
|
"aria-label": D(m)("campus.header.assistant"),
|
|
1653
|
-
onClick: n[3] ||= (e) =>
|
|
1742
|
+
onClick: n[3] ||= (e) => ie("assistant")
|
|
1654
1743
|
}, [u(c, {
|
|
1655
1744
|
name: "chat",
|
|
1656
1745
|
size: 18
|
|
1657
1746
|
}), n[12] ||= s("i", {
|
|
1658
1747
|
class: "ca-header__dot is-success",
|
|
1659
1748
|
"aria-hidden": "true"
|
|
1660
|
-
}, null, -1)], 8,
|
|
1749
|
+
}, null, -1)], 8, yn),
|
|
1661
1750
|
s("button", {
|
|
1662
1751
|
type: "button",
|
|
1663
1752
|
class: "ca-header__icon",
|
|
@@ -1667,10 +1756,10 @@ var $ = {
|
|
|
1667
1756
|
}, [u(c, {
|
|
1668
1757
|
name: "setting",
|
|
1669
1758
|
size: 18
|
|
1670
|
-
})], 8,
|
|
1759
|
+
})], 8, bn),
|
|
1671
1760
|
u(x, {
|
|
1672
1761
|
trigger: "click",
|
|
1673
|
-
onCommand:
|
|
1762
|
+
onCommand: ne
|
|
1674
1763
|
}, {
|
|
1675
1764
|
dropdown: M(() => [u(v, null, {
|
|
1676
1765
|
default: M(() => [D(T).accountPath ? (y(), i(_, {
|
|
@@ -1693,14 +1782,14 @@ var $ = {
|
|
|
1693
1782
|
class: "ca-header__user",
|
|
1694
1783
|
title: D(m)("campus.header.account"),
|
|
1695
1784
|
"aria-label": D(d).user?.name
|
|
1696
|
-
}, [s("span",
|
|
1785
|
+
}, [s("span", Sn, E(D(d).user?.name.slice(0, 1)), 1), u(c, {
|
|
1697
1786
|
name: "arrowDown",
|
|
1698
1787
|
size: 12
|
|
1699
|
-
})], 8,
|
|
1788
|
+
})], 8, xn)]),
|
|
1700
1789
|
_: 1
|
|
1701
1790
|
})
|
|
1702
1791
|
]),
|
|
1703
|
-
u(
|
|
1792
|
+
u(B, {
|
|
1704
1793
|
modelValue: O.value,
|
|
1705
1794
|
"onUpdate:modelValue": n[7] ||= (e) => O.value = e,
|
|
1706
1795
|
title: D(m)("campus.settings.title"),
|
|
@@ -1709,7 +1798,7 @@ var $ = {
|
|
|
1709
1798
|
class: "ca-settings"
|
|
1710
1799
|
}, {
|
|
1711
1800
|
default: M(() => [
|
|
1712
|
-
s("section",
|
|
1801
|
+
s("section", Cn, [s("h3", wn, [s("span", null, E(D(m)("campus.settings.themeMode")), 1)]), s("div", {
|
|
1713
1802
|
class: "ca-settings__segment is-three",
|
|
1714
1803
|
role: "radiogroup",
|
|
1715
1804
|
"aria-label": D(m)("campus.settings.themeMode")
|
|
@@ -1719,13 +1808,13 @@ var $ = {
|
|
|
1719
1808
|
role: "radio",
|
|
1720
1809
|
"aria-checked": D(p).mode === e.value,
|
|
1721
1810
|
class: h({ "is-active": D(p).mode === e.value }),
|
|
1722
|
-
onClick: (t) =>
|
|
1811
|
+
onClick: (t) => R(e.value, t)
|
|
1723
1812
|
}, [u(c, {
|
|
1724
1813
|
name: e.icon,
|
|
1725
1814
|
size: 16
|
|
1726
|
-
}, null, 8, ["name"]), l(E(D(m)(`campus.mode.${e.value}`)), 1)], 10,
|
|
1727
|
-
D(p).primaryLocked ? a("v-if", !0) : (y(), o("section",
|
|
1728
|
-
s("h3",
|
|
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)]),
|
|
1729
1818
|
s("div", {
|
|
1730
1819
|
class: "ca-settings__swatches",
|
|
1731
1820
|
role: "radiogroup",
|
|
@@ -1739,7 +1828,7 @@ var $ = {
|
|
|
1739
1828
|
"aria-label": e,
|
|
1740
1829
|
"aria-checked": D(p).userPrimary?.toLowerCase() === e,
|
|
1741
1830
|
onClick: (t) => D(p).setPrimary(e)
|
|
1742
|
-
}, null, 14,
|
|
1831
|
+
}, null, 14, An)), 64)), s("label", {
|
|
1743
1832
|
class: "ca-settings__swatch is-custom",
|
|
1744
1833
|
title: D(m)("campus.settings.themeColorCustom")
|
|
1745
1834
|
}, [s("input", {
|
|
@@ -1747,15 +1836,15 @@ var $ = {
|
|
|
1747
1836
|
value: L.value,
|
|
1748
1837
|
"aria-label": D(m)("campus.settings.themeColorCustom"),
|
|
1749
1838
|
onInput: n[5] ||= (e) => D(p).setPrimary(e.target.value)
|
|
1750
|
-
}, null, 40,
|
|
1839
|
+
}, null, 40, Mn)], 8, jn)], 8, kn),
|
|
1751
1840
|
s("button", {
|
|
1752
1841
|
type: "button",
|
|
1753
1842
|
class: "ca-settings__reset",
|
|
1754
1843
|
disabled: !D(p).userPrimary,
|
|
1755
1844
|
onClick: n[6] ||= (e) => D(p).setPrimary(void 0)
|
|
1756
|
-
}, E(D(m)("campus.settings.themeColorReset")), 9,
|
|
1845
|
+
}, E(D(m)("campus.settings.themeColorReset")), 9, Nn)
|
|
1757
1846
|
])),
|
|
1758
|
-
s("section",
|
|
1847
|
+
s("section", Pn, [s("h3", Fn, [s("span", null, E(D(m)("campus.settings.boxStyle")), 1)]), s("div", {
|
|
1759
1848
|
class: "ca-settings__segment",
|
|
1760
1849
|
role: "radiogroup",
|
|
1761
1850
|
"aria-label": D(m)("campus.settings.boxStyle")
|
|
@@ -1766,21 +1855,21 @@ var $ = {
|
|
|
1766
1855
|
"aria-checked": D(p).boxStyle === e.value,
|
|
1767
1856
|
class: h({ "is-active": D(p).boxStyle === e.value }),
|
|
1768
1857
|
onClick: (t) => D(p).setBoxStyle(e.value)
|
|
1769
|
-
}, E(D(m)(e.label)), 11,
|
|
1858
|
+
}, E(D(m)(e.label)), 11, Ln)), 64))], 8, In)])
|
|
1770
1859
|
]),
|
|
1771
1860
|
_: 1
|
|
1772
1861
|
}, 8, ["modelValue", "title"])
|
|
1773
1862
|
]);
|
|
1774
1863
|
};
|
|
1775
1864
|
}
|
|
1776
|
-
}), [["__scopeId", "data-v-534bb61b"]]),
|
|
1865
|
+
}), [["__scopeId", "data-v-534bb61b"]]), zn = {
|
|
1777
1866
|
key: 0,
|
|
1778
1867
|
class: "ca-page-header"
|
|
1779
|
-
},
|
|
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({
|
|
1780
1869
|
__name: "PageHeader",
|
|
1781
1870
|
setup(t) {
|
|
1782
|
-
let r =
|
|
1783
|
-
let e = h.value ?
|
|
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;
|
|
1784
1873
|
if (!e) return [];
|
|
1785
1874
|
let t = e.titles.map((e) => d(e));
|
|
1786
1875
|
return h.value?.affix ? t.filter((e, n) => e !== t[n - 1]) : t;
|
|
@@ -1796,7 +1885,7 @@ var $ = {
|
|
|
1796
1885
|
});
|
|
1797
1886
|
return (t, n) => {
|
|
1798
1887
|
let r = w("ca-icon"), d = w("ca-breadcrumb-item"), f = w("ca-breadcrumb");
|
|
1799
|
-
return h.value ? (y(), o("header",
|
|
1888
|
+
return h.value ? (y(), o("header", zn, [s("div", Bn, [s("div", Vn, [
|
|
1800
1889
|
u(r, {
|
|
1801
1890
|
name: "location",
|
|
1802
1891
|
class: "ca-page-header__icon"
|
|
@@ -1816,26 +1905,26 @@ var $ = {
|
|
|
1816
1905
|
title: D(c)("campus.tabs.refresh"),
|
|
1817
1906
|
"aria-label": D(c)("campus.tabs.refresh"),
|
|
1818
1907
|
onClick: n[0] ||= (e) => h.value && D(p).refresh(h.value.key)
|
|
1819
|
-
}, [u(r, { name: "refresh" })], 8,
|
|
1820
|
-
]), s("time",
|
|
1908
|
+
}, [u(r, { name: "refresh" })], 8, Hn)
|
|
1909
|
+
]), s("time", Un, E(C.value), 1)])])) : a("v-if", !0);
|
|
1821
1910
|
};
|
|
1822
1911
|
}
|
|
1823
|
-
}), [["__scopeId", "data-v-e0f9b42f"]]),
|
|
1912
|
+
}), [["__scopeId", "data-v-e0f9b42f"]]), Gn = {
|
|
1824
1913
|
key: 0,
|
|
1825
1914
|
class: "ca-page-header__main"
|
|
1826
|
-
},
|
|
1915
|
+
}, Kn = { class: "ca-page-header__titles" }, qn = { class: "ca-page-header__title" }, Jn = ["title"], Yn = /*#__PURE__*/ Y(/* @__PURE__ */ d({
|
|
1827
1916
|
__name: "PageTitle",
|
|
1828
1917
|
setup(e) {
|
|
1829
|
-
let t =
|
|
1830
|
-
return (e, t) => c.value ? (y(), o("header",
|
|
1831
|
-
s("div",
|
|
1832
|
-
s("h2",
|
|
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),
|
|
1833
1922
|
a(" 说明和标题同一行,放不下时省略;窗口较矮时直接隐藏,把高度留给内容 "),
|
|
1834
1923
|
u.value ? (y(), o("p", {
|
|
1835
1924
|
key: 0,
|
|
1836
1925
|
class: "ca-page-header__desc",
|
|
1837
1926
|
title: u.value
|
|
1838
|
-
}, E(u.value), 9,
|
|
1927
|
+
}, E(u.value), 9, Jn)) : a("v-if", !0)
|
|
1839
1928
|
]),
|
|
1840
1929
|
a(" 页面通过 <ca-page-actions> 把按钮放到这里 "),
|
|
1841
1930
|
t[0] ||= s("div", {
|
|
@@ -1844,110 +1933,110 @@ var $ = {
|
|
|
1844
1933
|
}, null, -1)
|
|
1845
1934
|
])) : a("v-if", !0);
|
|
1846
1935
|
}
|
|
1847
|
-
}), [["__scopeId", "data-v-e63e651d"]]),
|
|
1936
|
+
}), [["__scopeId", "data-v-e63e651d"]]), Xn = ["aria-label"], Zn = ["onClick"], Qn = { class: "ca-side__rail-list" }, $n = ["aria-current", "title"], er = [
|
|
1848
1937
|
"aria-current",
|
|
1849
1938
|
"title",
|
|
1850
1939
|
"onClick"
|
|
1851
|
-
],
|
|
1940
|
+
], tr = {
|
|
1852
1941
|
key: 0,
|
|
1853
1942
|
class: "ca-side__badge"
|
|
1854
|
-
},
|
|
1943
|
+
}, nr = { class: "ca-side__tools" }, rr = [
|
|
1855
1944
|
"title",
|
|
1856
1945
|
"aria-label",
|
|
1857
1946
|
"aria-pressed"
|
|
1858
|
-
],
|
|
1947
|
+
], ir = [
|
|
1859
1948
|
"title",
|
|
1860
1949
|
"aria-label",
|
|
1861
1950
|
"aria-expanded"
|
|
1862
|
-
],
|
|
1951
|
+
], ar = ["title", "aria-label"], or = { class: "ca-side__avatar" }, sr = ["inert"], cr = { class: "ca-side__panel-inner" }, lr = {
|
|
1863
1952
|
key: 0,
|
|
1864
1953
|
class: "ca-side__title"
|
|
1865
|
-
},
|
|
1954
|
+
}, ur = {
|
|
1866
1955
|
key: 1,
|
|
1867
1956
|
class: "ca-side__group-badge"
|
|
1868
|
-
},
|
|
1957
|
+
}, dr = /*#__PURE__*/ Y(/* @__PURE__ */ d({
|
|
1869
1958
|
__name: "SideMenu",
|
|
1870
1959
|
setup(t) {
|
|
1871
|
-
let r =
|
|
1960
|
+
let r = V(), c = H(), d = Q(), f = X(), { t: p, label: m } = W(), g = K(), _ = x(ge("side-collapsed") === "1");
|
|
1872
1961
|
function v() {
|
|
1873
1962
|
_.value = !_.value, U("side-collapsed", _.value ? "1" : "0");
|
|
1874
1963
|
}
|
|
1875
|
-
let b = x(
|
|
1964
|
+
let b = x(ge("side-text-hidden") === "1");
|
|
1876
1965
|
function C() {
|
|
1877
1966
|
b.value = !b.value, U("side-text-hidden", b.value ? "1" : "0");
|
|
1878
1967
|
}
|
|
1879
1968
|
async function T(e) {
|
|
1880
1969
|
e === "account" ? g.accountPath && r.path !== g.accountPath && await c.push(g.accountPath) : (await d.logout(), await c.replace({ name: "login" }));
|
|
1881
1970
|
}
|
|
1882
|
-
let O = n(() => g.menus.flatMap((e) => e.children.flatMap((e) =>
|
|
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) => ({
|
|
1883
1972
|
...e,
|
|
1884
|
-
children: e.children.map((e) =>
|
|
1973
|
+
children: e.children.map((e) => G(e) ? {
|
|
1885
1974
|
...e,
|
|
1886
1975
|
children: e.children.filter(j)
|
|
1887
|
-
} : e).filter((e) =>
|
|
1976
|
+
} : e).filter((e) => G(e) ? e.children.length > 0 : j(e))
|
|
1888
1977
|
})).filter((e) => e.children.length > 0)), F = x(), I = n(() => !!O.value && r.path === O.value.path);
|
|
1889
1978
|
A(() => [r.path, r.meta.appKey], () => {
|
|
1890
1979
|
F.value = I.value ? void 0 : r.meta.appKey ?? P.value[0]?.key;
|
|
1891
1980
|
}, { immediate: !0 });
|
|
1892
|
-
let L = n(() => P.value.find((e) => e.key === F.value)),
|
|
1893
|
-
A(L, (e) => e && (
|
|
1894
|
-
let
|
|
1895
|
-
function
|
|
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) {
|
|
1896
1985
|
let t = typeof e.badge == "function" ? e.badge() : e.badge ?? 0;
|
|
1897
1986
|
return t > 0 ? t : 0;
|
|
1898
1987
|
}
|
|
1899
|
-
function
|
|
1900
|
-
return e.children.reduce((e, t) => e + (
|
|
1988
|
+
function z(e) {
|
|
1989
|
+
return e.children.reduce((e, t) => e + (G(t) ? ne(t) : 0), 0);
|
|
1901
1990
|
}
|
|
1902
|
-
let
|
|
1903
|
-
function
|
|
1991
|
+
let B = n(() => r.meta.groupKey ? [r.meta.groupKey] : []);
|
|
1992
|
+
function re(e) {
|
|
1904
1993
|
f.mode === "pad" ? f.padPanelOpen && F.value === e ? f.closePadPanel() : (F.value = e, f.openPadPanel()) : F.value = e;
|
|
1905
1994
|
}
|
|
1906
|
-
let
|
|
1907
|
-
function
|
|
1995
|
+
let ie = n(() => (g.shortcuts ?? []).filter((e) => d.can(e.permission)));
|
|
1996
|
+
function ae(e) {
|
|
1908
1997
|
f.closeOverlays(), r.path !== e && c.push(e);
|
|
1909
1998
|
}
|
|
1910
1999
|
return (t, n) => {
|
|
1911
|
-
let c = w("ca-icon"), x = w("ca-dropdown-item"), A = w("ca-dropdown-menu"), j = w("ca-dropdown"), F = w("ca-menu-item"),
|
|
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");
|
|
1912
2001
|
return y(), o("aside", { class: h(["ca-side", { "is-pad-open": D(f).mode === "pad" && D(f).padPanelOpen }]) }, [
|
|
1913
|
-
|
|
2002
|
+
ie.value.length ? (y(), o("nav", {
|
|
1914
2003
|
key: 0,
|
|
1915
2004
|
class: "ca-side__shortcuts",
|
|
1916
2005
|
"aria-label": D(p)("campus.header.shortcuts")
|
|
1917
|
-
}, [(y(!0), o(e, null, S(
|
|
2006
|
+
}, [(y(!0), o(e, null, S(ie.value, (e) => (y(), o("button", {
|
|
1918
2007
|
key: e.key,
|
|
1919
2008
|
type: "button",
|
|
1920
2009
|
class: h({ "is-active": D(r).path === e.path }),
|
|
1921
|
-
onClick: (t) =>
|
|
1922
|
-
}, E(D(m)(e.title)), 11,
|
|
2010
|
+
onClick: (t) => ae(e.path)
|
|
2011
|
+
}, E(D(m)(e.title)), 11, Zn))), 128))], 8, Xn)) : a("v-if", !0),
|
|
1923
2012
|
s("nav", { class: h(["ca-side__rail", { "is-compact": b.value }]) }, [
|
|
1924
2013
|
a(" 入口列表单独滚动;底部工具按钮固定在外面,窗口再矮也不会被挤出屏幕 "),
|
|
1925
|
-
s("div",
|
|
2014
|
+
s("div", Qn, [O.value ? (y(), o("button", {
|
|
1926
2015
|
key: 0,
|
|
1927
2016
|
type: "button",
|
|
1928
2017
|
class: h(["ca-side__rail-item", { "is-active": I.value }]),
|
|
1929
2018
|
"aria-current": I.value ? "page" : void 0,
|
|
1930
2019
|
title: b.value ? D(p)("campus.side.home") : void 0,
|
|
1931
|
-
onClick: n[0] ||= (e) =>
|
|
2020
|
+
onClick: n[0] ||= (e) => ae(O.value.path)
|
|
1932
2021
|
}, [u(c, {
|
|
1933
2022
|
name: "home",
|
|
1934
2023
|
size: 20
|
|
1935
|
-
}), N(s("span", { class: "ca-side__rail-text" }, E(D(p)("campus.side.home")), 513), [[k, !b.value || D(f).mobileMenuOpen]])], 10,
|
|
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", {
|
|
1936
2025
|
key: e.key,
|
|
1937
2026
|
type: "button",
|
|
1938
2027
|
class: h(["ca-side__rail-item", { "is-active": e.key === L.value?.key }]),
|
|
1939
2028
|
"aria-current": e.key === L.value?.key ? "true" : void 0,
|
|
1940
2029
|
title: b.value ? D(m)(e.title) : void 0,
|
|
1941
|
-
onClick: (t) =>
|
|
2030
|
+
onClick: (t) => re(e.key)
|
|
1942
2031
|
}, [
|
|
1943
2032
|
u(c, {
|
|
1944
2033
|
name: e.icon ?? "grid",
|
|
1945
2034
|
size: 20
|
|
1946
2035
|
}, null, 8, ["name"]),
|
|
1947
2036
|
N(s("span", { class: "ca-side__rail-text" }, E(D(m)(e.title)), 513), [[k, !b.value || D(f).mobileMenuOpen]]),
|
|
1948
|
-
|
|
1949
|
-
], 10,
|
|
1950
|
-
s("div",
|
|
2037
|
+
z(e) ? (y(), o("span", tr, E(z(e)), 1)) : a("v-if", !0)
|
|
2038
|
+
], 10, er))), 128))]),
|
|
2039
|
+
s("div", nr, [
|
|
1951
2040
|
s("button", {
|
|
1952
2041
|
type: "button",
|
|
1953
2042
|
class: "ca-side__tool",
|
|
@@ -1958,7 +2047,7 @@ var $ = {
|
|
|
1958
2047
|
}, [u(c, {
|
|
1959
2048
|
name: b.value ? "view" : "hide",
|
|
1960
2049
|
size: 18
|
|
1961
|
-
}, null, 8, ["name"])], 8,
|
|
2050
|
+
}, null, 8, ["name"])], 8, rr),
|
|
1962
2051
|
s("button", {
|
|
1963
2052
|
type: "button",
|
|
1964
2053
|
class: "ca-side__tool ca-side__tool--collapse",
|
|
@@ -1969,7 +2058,7 @@ var $ = {
|
|
|
1969
2058
|
}, [u(c, {
|
|
1970
2059
|
name: _.value ? "expand" : "fold",
|
|
1971
2060
|
size: 18
|
|
1972
|
-
}, null, 8, ["name"])], 8,
|
|
2061
|
+
}, null, 8, ["name"])], 8, ir),
|
|
1973
2062
|
u(j, {
|
|
1974
2063
|
trigger: "click",
|
|
1975
2064
|
placement: "right-end",
|
|
@@ -1996,27 +2085,27 @@ var $ = {
|
|
|
1996
2085
|
class: "ca-side__tool",
|
|
1997
2086
|
title: D(d).user?.name,
|
|
1998
2087
|
"aria-label": D(d).user?.name
|
|
1999
|
-
}, [s("span",
|
|
2088
|
+
}, [s("span", or, E(D(d).user?.name.slice(0, 1)), 1)], 8, ar)]),
|
|
2000
2089
|
_: 1
|
|
2001
2090
|
})
|
|
2002
2091
|
])
|
|
2003
2092
|
], 2),
|
|
2004
2093
|
a(" 第二栏:隐藏时宽度渐变到 0(而不是直接消失),首页与其他页之间切换时内容区不会突然跳动 "),
|
|
2005
2094
|
s("div", {
|
|
2006
|
-
class: h(["ca-side__panel", { "is-hidden":
|
|
2007
|
-
inert:
|
|
2008
|
-
}, [s("div",
|
|
2009
|
-
|
|
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),
|
|
2010
2099
|
a(" key 绑定场景:切换场景时重建菜单,展开状态不会串到别的场景 "),
|
|
2011
|
-
(y(), i(
|
|
2012
|
-
key:
|
|
2100
|
+
(y(), i(V, {
|
|
2101
|
+
key: te.value?.key,
|
|
2013
2102
|
"default-active": D(r).path,
|
|
2014
|
-
"default-openeds":
|
|
2103
|
+
"default-openeds": B.value,
|
|
2015
2104
|
router: "",
|
|
2016
2105
|
class: "ca-side__menu",
|
|
2017
2106
|
onSelect: n[1] ||= (e) => D(f).closeOverlays()
|
|
2018
2107
|
}, {
|
|
2019
|
-
default: M(() => [(y(!0), o(e, null, S(
|
|
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, {
|
|
2020
2109
|
key: 0,
|
|
2021
2110
|
index: t.key
|
|
2022
2111
|
}, {
|
|
@@ -2026,7 +2115,7 @@ var $ = {
|
|
|
2026
2115
|
name: t.icon
|
|
2027
2116
|
}, null, 8, ["name"])) : a("v-if", !0),
|
|
2028
2117
|
s("span", null, E(D(m)(t.title)), 1),
|
|
2029
|
-
|
|
2118
|
+
ne(t) ? (y(), o("span", ur, E(ne(t)), 1)) : a("v-if", !0)
|
|
2030
2119
|
]),
|
|
2031
2120
|
default: M(() => [(y(!0), o(e, null, S(t.children, (e) => (y(), i(F, {
|
|
2032
2121
|
key: e.key,
|
|
@@ -2045,34 +2134,34 @@ var $ = {
|
|
|
2045
2134
|
}, 1032, ["index"])], 2112))], 64))), 128))]),
|
|
2046
2135
|
_: 1
|
|
2047
2136
|
}, 8, ["default-active", "default-openeds"]))
|
|
2048
|
-
])], 10,
|
|
2137
|
+
])], 10, sr)
|
|
2049
2138
|
], 2);
|
|
2050
2139
|
};
|
|
2051
2140
|
}
|
|
2052
|
-
}), [["__scopeId", "data-v-4ddc6313"]]),
|
|
2141
|
+
}), [["__scopeId", "data-v-4ddc6313"]]), fr = {
|
|
2053
2142
|
key: 0,
|
|
2054
2143
|
class: "ca-copyright"
|
|
2055
|
-
},
|
|
2144
|
+
}, pr = ["href"], mr = /*#__PURE__*/ Y(/* @__PURE__ */ d({
|
|
2056
2145
|
__name: "CaCopyright",
|
|
2057
2146
|
setup(t) {
|
|
2058
|
-
let r =
|
|
2059
|
-
return (t, n) => c.value ? (y(), o("footer",
|
|
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", {
|
|
2060
2149
|
class: "ca-copyright__dot",
|
|
2061
2150
|
"aria-hidden": "true"
|
|
2062
2151
|
}, "·", -1), s("a", {
|
|
2063
2152
|
href: t.href,
|
|
2064
2153
|
target: "_blank",
|
|
2065
2154
|
rel: "noopener noreferrer"
|
|
2066
|
-
}, E(t.text), 9,
|
|
2155
|
+
}, E(t.text), 9, pr)], 64))), 128))])) : a("v-if", !0);
|
|
2067
2156
|
}
|
|
2068
|
-
}), [["__scopeId", "data-v-c51879e8"]]),
|
|
2157
|
+
}), [["__scopeId", "data-v-c51879e8"]]), hr = { class: "ca-tabs" }, gr = ["onClick"], _r = { class: "ca-tabs__more" }, vr = [
|
|
2069
2158
|
"title",
|
|
2070
2159
|
"aria-label",
|
|
2071
2160
|
"aria-pressed"
|
|
2072
|
-
],
|
|
2161
|
+
], yr = /*#__PURE__*/ Y(/* @__PURE__ */ d({
|
|
2073
2162
|
__name: "TabsBar",
|
|
2074
2163
|
setup(t) {
|
|
2075
|
-
let r =
|
|
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) => ({
|
|
2076
2165
|
key: e.key,
|
|
2077
2166
|
path: e.path,
|
|
2078
2167
|
title: g(e.title),
|
|
@@ -2116,7 +2205,7 @@ var $ = {
|
|
|
2116
2205
|
}
|
|
2117
2206
|
return (t, n) => {
|
|
2118
2207
|
let r = w("ca-icon"), d = w("ca-dropdown-item"), m = w("ca-dropdown-menu"), g = w("ca-dropdown");
|
|
2119
|
-
return y(), o("div",
|
|
2208
|
+
return y(), o("div", hr, [
|
|
2120
2209
|
(y(!0), o(e, null, S(T.value, (t) => (y(), o("div", {
|
|
2121
2210
|
key: t.name,
|
|
2122
2211
|
ref_for: !0,
|
|
@@ -2140,7 +2229,7 @@ var $ = {
|
|
|
2140
2229
|
class: "ca-tabs__close",
|
|
2141
2230
|
onClick: P((t) => j(e.key), ["stop"])
|
|
2142
2231
|
}, null, 8, ["onClick"])) : a("v-if", !0)
|
|
2143
|
-
], 10,
|
|
2232
|
+
], 10, gr))), 128))], 2))), 128)),
|
|
2144
2233
|
u(g, {
|
|
2145
2234
|
trigger: "click",
|
|
2146
2235
|
onCommand: I
|
|
@@ -2176,7 +2265,7 @@ var $ = {
|
|
|
2176
2265
|
]),
|
|
2177
2266
|
_: 1
|
|
2178
2267
|
})]),
|
|
2179
|
-
default: M(() => [s("span",
|
|
2268
|
+
default: M(() => [s("span", _r, [u(r, { name: "arrowDown" })])]),
|
|
2180
2269
|
_: 1
|
|
2181
2270
|
}),
|
|
2182
2271
|
a(" 内容全屏:隐藏头部和侧栏,再点一次恢复 "),
|
|
@@ -2187,14 +2276,14 @@ var $ = {
|
|
|
2187
2276
|
"aria-label": D(f).contentFullscreen ? D(p)("campus.tabs.exitFullscreen") : D(p)("campus.tabs.fullscreen"),
|
|
2188
2277
|
"aria-pressed": D(f).contentFullscreen,
|
|
2189
2278
|
onClick: n[0] ||= (e) => D(f).toggleContentFullscreen()
|
|
2190
|
-
}, [u(r, { name: D(f).contentFullscreen ? "exitFullscreen" : "fullscreen" }, null, 8, ["name"])], 8,
|
|
2279
|
+
}, [u(r, { name: D(f).contentFullscreen ? "exitFullscreen" : "fullscreen" }, null, 8, ["name"])], 8, vr)
|
|
2191
2280
|
]);
|
|
2192
2281
|
};
|
|
2193
2282
|
}
|
|
2194
|
-
}), [["__scopeId", "data-v-1d7ba823"]]),
|
|
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({
|
|
2195
2284
|
__name: "CaLayout",
|
|
2196
2285
|
setup(e) {
|
|
2197
|
-
let n =
|
|
2286
|
+
let n = V(), r = Z(), c = X(), { t: l } = W(), d = window.matchMedia(xr), f = window.matchMedia(Sr), p = "";
|
|
2198
2287
|
function m() {
|
|
2199
2288
|
let e = d.matches ? "phone" : f.matches ? "pad" : "desktop";
|
|
2200
2289
|
c.setMode(e);
|
|
@@ -2216,54 +2305,54 @@ var $ = {
|
|
|
2216
2305
|
}
|
|
2217
2306
|
return (e, n) => {
|
|
2218
2307
|
let d = w("router-view");
|
|
2219
|
-
return y(), o("div", { class: h(["ca-shell", { "is-fullscreen": D(c).contentFullscreen }]) }, [N(u(
|
|
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 }]) }, [
|
|
2220
2309
|
D(c).mode === "phone" && D(c).mobileMenuOpen ? (y(), o("button", {
|
|
2221
2310
|
key: 0,
|
|
2222
2311
|
type: "button",
|
|
2223
2312
|
class: "ca-mobile-scrim",
|
|
2224
2313
|
"aria-label": D(l)("campus.side.closeMenu"),
|
|
2225
2314
|
onClick: n[0] ||= (e) => D(c).closeMobileMenu()
|
|
2226
|
-
}, null, 8,
|
|
2315
|
+
}, null, 8, Cr)) : a("v-if", !0),
|
|
2227
2316
|
D(c).mode === "pad" && D(c).padPanelOpen ? (y(), o("button", {
|
|
2228
2317
|
key: 1,
|
|
2229
2318
|
type: "button",
|
|
2230
2319
|
class: "ca-pad-scrim",
|
|
2231
2320
|
"aria-label": D(l)("campus.side.closeMenu"),
|
|
2232
2321
|
onClick: n[1] ||= (e) => D(c).closePadPanel()
|
|
2233
|
-
}, null, 8,
|
|
2234
|
-
N(u(
|
|
2322
|
+
}, null, 8, wr)) : a("v-if", !0),
|
|
2323
|
+
N(u(dr, {
|
|
2235
2324
|
class: h({ "is-mobile-open": D(c).mobileMenuOpen }),
|
|
2236
2325
|
inert: D(c).mode === "phone" && !D(c).mobileMenuOpen
|
|
2237
2326
|
}, null, 8, ["class", "inert"]), [[k, !D(c).contentFullscreen]]),
|
|
2238
|
-
s("main",
|
|
2239
|
-
u(
|
|
2240
|
-
u(
|
|
2241
|
-
s("div",
|
|
2242
|
-
u(
|
|
2327
|
+
s("main", Tr, [
|
|
2328
|
+
u(yr),
|
|
2329
|
+
u(Wn),
|
|
2330
|
+
s("div", Er, [
|
|
2331
|
+
u(Yn),
|
|
2243
2332
|
a(" 页面区撑满剩余高度,版权在其后:内容少时贴窗口底,内容长时滚到最底才出现 "),
|
|
2244
|
-
s("div",
|
|
2333
|
+
s("div", Dr, [u(d, null, {
|
|
2245
2334
|
default: M(({ Component: e }) => [a(" include 与标签名单同步;缓存容量包含固定标签。 "), (y(), i(t, {
|
|
2246
2335
|
include: D(r).cached,
|
|
2247
2336
|
max: D(r).maxTabs + D(r).affixKeys.length
|
|
2248
2337
|
}, [e ? (y(), i(T(e), { key: b() })) : a("v-if", !0)], 1032, ["include", "max"]))]),
|
|
2249
2338
|
_: 1
|
|
2250
2339
|
})]),
|
|
2251
|
-
u(
|
|
2340
|
+
u(mr)
|
|
2252
2341
|
])
|
|
2253
2342
|
])
|
|
2254
2343
|
], 2)], 2);
|
|
2255
2344
|
};
|
|
2256
2345
|
}
|
|
2257
|
-
}), [["__scopeId", "data-v-3a849ce7"]]),
|
|
2346
|
+
}), [["__scopeId", "data-v-3a849ce7"]]), kr = { class: "ca-exception" }, Ar = { class: "ca-exception__code" }, jr = { class: "ca-exception__text" }, Mr = /*#__PURE__*/ Y(/* @__PURE__ */ d({
|
|
2258
2347
|
__name: "ExceptionPage",
|
|
2259
2348
|
props: { kind: {} },
|
|
2260
2349
|
setup(e) {
|
|
2261
|
-
let t = e, r =
|
|
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"));
|
|
2262
2351
|
return (e, t) => {
|
|
2263
2352
|
let n = w("ca-button");
|
|
2264
|
-
return y(), o("div",
|
|
2265
|
-
s("div",
|
|
2266
|
-
s("p",
|
|
2353
|
+
return y(), o("div", kr, [
|
|
2354
|
+
s("div", Ar, E(a.value), 1),
|
|
2355
|
+
s("p", jr, E(c.value), 1),
|
|
2267
2356
|
u(n, {
|
|
2268
2357
|
type: "primary",
|
|
2269
2358
|
onClick: t[0] ||= (e) => D(r).replace("/")
|
|
@@ -2274,13 +2363,13 @@ var $ = {
|
|
|
2274
2363
|
]);
|
|
2275
2364
|
};
|
|
2276
2365
|
}
|
|
2277
|
-
}), [["__scopeId", "data-v-ffcb23b0"]]),
|
|
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 = {
|
|
2278
2367
|
key: 1,
|
|
2279
2368
|
class: "ca-login__subtitle"
|
|
2280
|
-
},
|
|
2369
|
+
}, Br = /*#__PURE__*/ Y(/* @__PURE__ */ d({
|
|
2281
2370
|
__name: "LoginPage",
|
|
2282
2371
|
setup(e) {
|
|
2283
|
-
let t =
|
|
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({
|
|
2284
2373
|
username: "",
|
|
2285
2374
|
password: "",
|
|
2286
2375
|
captcha: ""
|
|
@@ -2316,7 +2405,7 @@ var $ = {
|
|
|
2316
2405
|
key: S.value,
|
|
2317
2406
|
code: v.captcha
|
|
2318
2407
|
} : void 0
|
|
2319
|
-
}), await r.replace(
|
|
2408
|
+
}), await r.replace(He(t.query.redirect));
|
|
2320
2409
|
} catch (e) {
|
|
2321
2410
|
k.value = e instanceof Error && e.message ? e.message : f("campus.login.failed"), C.value?.refresh();
|
|
2322
2411
|
} finally {
|
|
@@ -2325,16 +2414,16 @@ var $ = {
|
|
|
2325
2414
|
}
|
|
2326
2415
|
return (e, t) => {
|
|
2327
2416
|
let n = w("ca-alert"), r = w("ca-input"), c = w("ca-form-item"), d = w("ca-button"), b = w("ca-form");
|
|
2328
|
-
return y(), o("div",
|
|
2329
|
-
s("div",
|
|
2417
|
+
return y(), o("div", Nr, [s("div", Pr, [s("div", Fr, [
|
|
2418
|
+
s("div", Ir, [
|
|
2330
2419
|
g.value ? (y(), o("img", {
|
|
2331
2420
|
key: 0,
|
|
2332
2421
|
src: g.value,
|
|
2333
2422
|
alt: "",
|
|
2334
2423
|
class: "ca-login__logo"
|
|
2335
|
-
}, null, 8,
|
|
2336
|
-
s("h1",
|
|
2337
|
-
D(m).subtitle ? (y(), o("p",
|
|
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)
|
|
2338
2427
|
]),
|
|
2339
2428
|
k.value ? (y(), i(n, {
|
|
2340
2429
|
key: 0,
|
|
@@ -2378,7 +2467,7 @@ var $ = {
|
|
|
2378
2467
|
key: 0,
|
|
2379
2468
|
prop: "captcha"
|
|
2380
2469
|
}, {
|
|
2381
|
-
default: M(() => [u(
|
|
2470
|
+
default: M(() => [u(gt, {
|
|
2382
2471
|
ref_key: "captchaRef",
|
|
2383
2472
|
ref: C,
|
|
2384
2473
|
code: v.captcha,
|
|
@@ -2401,12 +2490,12 @@ var $ = {
|
|
|
2401
2490
|
]),
|
|
2402
2491
|
_: 1
|
|
2403
2492
|
}, 8, ["model", "rules"])
|
|
2404
|
-
])]), u(
|
|
2493
|
+
])]), u(mr, { class: "ca-login__copyright" })]);
|
|
2405
2494
|
};
|
|
2406
2495
|
}
|
|
2407
2496
|
}), [["__scopeId", "data-v-ddf636fd"]]);
|
|
2408
2497
|
// packages/core/src/router.ts
|
|
2409
|
-
function
|
|
2498
|
+
function Vr(e) {
|
|
2410
2499
|
return async () => {
|
|
2411
2500
|
let t = await e.component();
|
|
2412
2501
|
return d({
|
|
@@ -2415,48 +2504,48 @@ function zr(e) {
|
|
|
2415
2504
|
});
|
|
2416
2505
|
};
|
|
2417
2506
|
}
|
|
2418
|
-
var
|
|
2507
|
+
var Hr = d({
|
|
2419
2508
|
name: "CaForbidden",
|
|
2420
|
-
setup: () => () => f(
|
|
2421
|
-
}),
|
|
2509
|
+
setup: () => () => f(Mr, { kind: "forbidden" })
|
|
2510
|
+
}), Ur = d({
|
|
2422
2511
|
name: "CaNotFound",
|
|
2423
|
-
setup: () => () => f(
|
|
2512
|
+
setup: () => () => f(Mr, { kind: "notFound" })
|
|
2424
2513
|
});
|
|
2425
|
-
function
|
|
2426
|
-
let n =
|
|
2514
|
+
function Wr(e, t) {
|
|
2515
|
+
let n = je(e.menus);
|
|
2427
2516
|
if (!n.length) throw Error("[campus] 菜单里至少需要一个页面");
|
|
2428
|
-
|
|
2517
|
+
Me(e.accountPath, n);
|
|
2429
2518
|
let r = [
|
|
2430
2519
|
{
|
|
2431
2520
|
path: "/login",
|
|
2432
2521
|
name: "login",
|
|
2433
|
-
component: e.login?.style === "split" ? At :
|
|
2522
|
+
component: e.login?.style === "split" ? At : Br,
|
|
2434
2523
|
meta: { public: !0 }
|
|
2435
2524
|
},
|
|
2436
2525
|
{
|
|
2437
2526
|
path: "/register",
|
|
2438
2527
|
name: "register",
|
|
2439
|
-
component:
|
|
2528
|
+
component: Zt,
|
|
2440
2529
|
meta: { public: !0 }
|
|
2441
2530
|
},
|
|
2442
2531
|
{
|
|
2443
2532
|
path: "/forgot",
|
|
2444
2533
|
name: "forgot",
|
|
2445
|
-
component:
|
|
2534
|
+
component: tn,
|
|
2446
2535
|
meta: { public: !0 }
|
|
2447
2536
|
},
|
|
2448
2537
|
{
|
|
2449
2538
|
path: "/",
|
|
2450
|
-
component:
|
|
2539
|
+
component: Or,
|
|
2451
2540
|
redirect: n.some((e) => e.path === "/") ? void 0 : () => {
|
|
2452
|
-
let e =
|
|
2541
|
+
let e = Q(t);
|
|
2453
2542
|
return n.find((t) => e.can(t.permission))?.path ?? "/403";
|
|
2454
2543
|
},
|
|
2455
2544
|
children: [
|
|
2456
2545
|
...n.map((e) => ({
|
|
2457
2546
|
path: e.path,
|
|
2458
2547
|
name: e.key,
|
|
2459
|
-
component:
|
|
2548
|
+
component: Vr(e),
|
|
2460
2549
|
meta: {
|
|
2461
2550
|
pageKey: e.key,
|
|
2462
2551
|
appKey: e.appKey,
|
|
@@ -2467,59 +2556,67 @@ function Hr(e, t) {
|
|
|
2467
2556
|
{
|
|
2468
2557
|
path: "/403",
|
|
2469
2558
|
name: "forbidden",
|
|
2470
|
-
component:
|
|
2559
|
+
component: Hr
|
|
2471
2560
|
},
|
|
2472
2561
|
{
|
|
2473
2562
|
path: "/:pathMatch(.*)*",
|
|
2474
2563
|
name: "not-found",
|
|
2475
|
-
component:
|
|
2564
|
+
component: Ur
|
|
2476
2565
|
}
|
|
2477
2566
|
]
|
|
2478
2567
|
}
|
|
2479
|
-
], i =
|
|
2480
|
-
history: e.history === "web" ?
|
|
2568
|
+
], i = re({
|
|
2569
|
+
history: e.history === "web" ? ae() : ie(),
|
|
2481
2570
|
routes: r
|
|
2482
2571
|
});
|
|
2483
2572
|
return i.beforeEach((e) => {
|
|
2484
|
-
let n =
|
|
2573
|
+
let n = Q(t);
|
|
2485
2574
|
return e.meta.public ? n.isLoggedIn && e.name === "login" ? { path: "/" } : !0 : n.isLoggedIn ? n.can(e.meta.permission) ? !0 : { name: "forbidden" } : {
|
|
2486
2575
|
name: "login",
|
|
2487
2576
|
query: e.fullPath === "/" ? void 0 : { redirect: e.fullPath }
|
|
2488
2577
|
};
|
|
2489
2578
|
}), i.afterEach((e) => {
|
|
2490
|
-
e.meta.pageKey &&
|
|
2579
|
+
e.meta.pageKey && Z(t).open(e.meta.pageKey);
|
|
2491
2580
|
}), i;
|
|
2492
2581
|
}
|
|
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
|
+
}
|
|
2493
2586
|
// packages/core/src/services/auth.ts
|
|
2494
|
-
var
|
|
2495
|
-
function
|
|
2496
|
-
|
|
2587
|
+
var Kr, qr;
|
|
2588
|
+
function Jr(e, t) {
|
|
2589
|
+
Kr = e, qr = t;
|
|
2497
2590
|
}
|
|
2498
|
-
async function
|
|
2499
|
-
if (
|
|
2500
|
-
let t =
|
|
2591
|
+
async function Yr(e) {
|
|
2592
|
+
if (K(), !Kr || !qr) return;
|
|
2593
|
+
let t = Q(qr);
|
|
2501
2594
|
if (!t.isLoggedIn) return;
|
|
2502
|
-
t.expire(),
|
|
2503
|
-
let n =
|
|
2504
|
-
n.name !== "login" && await
|
|
2595
|
+
t.expire(), Vt.toast.warning(e || Te("campus.auth.sessionExpired"));
|
|
2596
|
+
let n = Kr.currentRoute.value;
|
|
2597
|
+
n.name !== "login" && await Kr.replace({
|
|
2505
2598
|
name: "login",
|
|
2506
2599
|
query: n.fullPath === "/" ? void 0 : { redirect: n.fullPath }
|
|
2507
2600
|
});
|
|
2508
2601
|
}
|
|
2602
|
+
async function Xr(e, t) {
|
|
2603
|
+
if (K(), !Kr || !qr) throw Error("[campus] 应用尚未创建,无法完成登录");
|
|
2604
|
+
await Gr(Q(qr), Kr, e, t);
|
|
2605
|
+
}
|
|
2509
2606
|
// packages/core/src/app.ts
|
|
2510
|
-
function
|
|
2511
|
-
Mt(e),
|
|
2607
|
+
function Zr(e) {
|
|
2608
|
+
Mt(e), ke(e);
|
|
2512
2609
|
let t = r(De), n = F();
|
|
2513
2610
|
t.use(n);
|
|
2514
2611
|
let i = Ce(e);
|
|
2515
2612
|
t.use(i);
|
|
2516
2613
|
let a = (e, t) => i.global.t(e, t ?? {});
|
|
2517
|
-
t.provide(
|
|
2518
|
-
let o =
|
|
2519
|
-
return
|
|
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;
|
|
2520
2617
|
}
|
|
2521
2618
|
// packages/core/src/index.ts
|
|
2522
|
-
function
|
|
2619
|
+
function Qr(e) {
|
|
2523
2620
|
return e;
|
|
2524
2621
|
}
|
|
2525
|
-
export {
|
|
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 };
|