@campus-admin/core 2.0.6 → 2.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/context.d.ts +1 -12
- package/dist/i18n.d.ts +82 -0
- package/dist/index.js +1199 -809
- package/dist/layout/MenuSearch.vue.d.ts +10 -0
- package/dist/layout/menu-search.d.ts +13 -0
- package/dist/pages/auth/CaptchaField.vue.d.ts +2 -0
- package/dist/stores/layout.d.ts +21 -3
- package/dist/style.css +1 -1
- package/dist/types.d.ts +8 -7
- package/package.json +5 -4
package/dist/index.js
CHANGED
|
@@ -2,79 +2,80 @@ import './style.css'
|
|
|
2
2
|
import "element-plus/es/components/base/style/css";
|
|
3
3
|
import "element-plus/theme-chalk/dark/css-vars.css";
|
|
4
4
|
import "@campus-admin/theme/nova.css";
|
|
5
|
-
import { Fragment as e, KeepAlive as t, computed as n, createApp as r, createBlock as i, createCommentVNode as a, createElementBlock as o, createElementVNode as s, createStaticVNode as c, createTextVNode as l, createVNode as u, defineComponent as d, h as f, mergeModels as p, nextTick as m, normalizeClass as h, normalizeStyle as g, onBeforeUnmount as _, onMounted as v, openBlock as y, reactive as b, ref as x, renderList as S, renderSlot as C, resolveComponent as w, resolveDynamicComponent as T, toDisplayString as E, unref as D,
|
|
6
|
-
import { createPinia as
|
|
7
|
-
import { installUi as
|
|
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, useId as O, useModel as k, vShow as A, watch as j, watchEffect as M, withCtx as N, withDirectives as P, withModifiers as F } from "vue";
|
|
6
|
+
import { createPinia as I, defineStore as L } from "pinia";
|
|
7
|
+
import { installUi as R, translateKey as z } from "@campus-admin/ui";
|
|
8
8
|
import { LOCALES as ee, frameworkMessages as te } from "@campus-admin/locale";
|
|
9
|
-
import { createI18n as
|
|
10
|
-
import { RouterLink as
|
|
11
|
-
import { applyTheme as
|
|
9
|
+
import { createI18n as B, useI18n as V } from "vue-i18n";
|
|
10
|
+
import { RouterLink as ne, createRouter as re, createWebHashHistory as H, createWebHistory as U, useRoute as W, useRouter as G } from "vue-router";
|
|
11
|
+
import { applyTheme as ie, deriveCssVars as ae, isHexColor as oe, parseColor as se, resolveMode as ce, resolveTheme as le, toHex as ue } from "@campus-admin/theme";
|
|
12
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
|
+
import { pinyin as he } from "pinyin-pro";
|
|
17
18
|
export * from "@campus-admin/ui";
|
|
18
19
|
// packages/core/src/storage.ts
|
|
19
|
-
var
|
|
20
|
-
function
|
|
20
|
+
var ge = "ca:";
|
|
21
|
+
function _e(e, t = "local") {
|
|
21
22
|
try {
|
|
22
|
-
return (t === "local" ? localStorage : sessionStorage).getItem(
|
|
23
|
+
return (t === "local" ? localStorage : sessionStorage).getItem(ge + e);
|
|
23
24
|
} catch {
|
|
24
25
|
return null;
|
|
25
26
|
}
|
|
26
27
|
}
|
|
27
|
-
function
|
|
28
|
+
function K(e, t, n = "local") {
|
|
28
29
|
try {
|
|
29
30
|
let r = n === "local" ? localStorage : sessionStorage;
|
|
30
|
-
t === null ? r.removeItem(
|
|
31
|
+
t === null ? r.removeItem(ge + e) : r.setItem(ge + e, t);
|
|
31
32
|
} catch {}
|
|
32
33
|
}
|
|
33
|
-
function
|
|
34
|
-
let n =
|
|
34
|
+
function ve(e, t = "local") {
|
|
35
|
+
let n = _e(e, t);
|
|
35
36
|
if (n) try {
|
|
36
37
|
return JSON.parse(n);
|
|
37
38
|
} catch {
|
|
38
39
|
return;
|
|
39
40
|
}
|
|
40
41
|
}
|
|
41
|
-
function
|
|
42
|
-
|
|
42
|
+
function ye(e, t, n = "local") {
|
|
43
|
+
K(e, JSON.stringify(t), n);
|
|
43
44
|
}
|
|
44
45
|
// packages/core/src/i18n.ts
|
|
45
|
-
var
|
|
46
|
-
function
|
|
46
|
+
var be = (e) => typeof e == "object" && !!e && !Array.isArray(e);
|
|
47
|
+
function xe(e, t) {
|
|
47
48
|
let n = { ...e };
|
|
48
49
|
for (let [e, r] of Object.entries(t)) {
|
|
49
50
|
let t = n[e];
|
|
50
|
-
n[e] =
|
|
51
|
+
n[e] = be(t) && be(r) ? xe(t, r) : r;
|
|
51
52
|
}
|
|
52
53
|
return n;
|
|
53
54
|
}
|
|
54
|
-
var
|
|
55
|
-
function
|
|
55
|
+
var Se = "locale";
|
|
56
|
+
function Ce(e) {
|
|
56
57
|
return e === "zh-CN" || e === "en-US";
|
|
57
58
|
}
|
|
58
|
-
function
|
|
59
|
-
let t =
|
|
59
|
+
function we(e) {
|
|
60
|
+
let t = _e(Se), n = Ce(t) ? t : e.defaultLocale ?? "zh-CN", r = Object.fromEntries(["zh-CN", "en-US"].map((t) => [t, xe(te[t], e.messages?.[t] ?? {})])), i = B({
|
|
60
61
|
legacy: !1,
|
|
61
62
|
locale: n,
|
|
62
63
|
fallbackLocale: "zh-CN",
|
|
63
64
|
messages: r
|
|
64
65
|
});
|
|
65
|
-
return typeof document < "u" &&
|
|
66
|
+
return typeof document < "u" && j(() => i.global.locale.value, (e) => {
|
|
66
67
|
document.documentElement.lang = e;
|
|
67
|
-
}, { immediate: !0 }),
|
|
68
|
+
}, { immediate: !0 }), Te = i, i;
|
|
68
69
|
}
|
|
69
|
-
var
|
|
70
|
-
function
|
|
71
|
-
return
|
|
70
|
+
var Te;
|
|
71
|
+
function Ee(e, t) {
|
|
72
|
+
return Te ? Te.global.t(e, t ?? {}) : e;
|
|
72
73
|
}
|
|
73
|
-
function
|
|
74
|
-
|
|
74
|
+
function De(e) {
|
|
75
|
+
K(Se, e);
|
|
75
76
|
}
|
|
76
|
-
function
|
|
77
|
-
let { t: e, te: t, locale: n } =
|
|
77
|
+
function q() {
|
|
78
|
+
let { t: e, te: t, locale: n } = V();
|
|
78
79
|
return {
|
|
79
80
|
t: e,
|
|
80
81
|
te: t,
|
|
@@ -83,81 +84,90 @@ function G() {
|
|
|
83
84
|
};
|
|
84
85
|
}
|
|
85
86
|
// packages/core/src/CampusRoot.vue
|
|
86
|
-
var
|
|
87
|
+
var Oe = /* @__PURE__ */ d({
|
|
87
88
|
__name: "CampusRoot",
|
|
88
89
|
setup(e) {
|
|
89
|
-
let { locale: t } =
|
|
90
|
+
let { locale: t } = q();
|
|
90
91
|
return (e, n) => {
|
|
91
92
|
let r = w("router-view"), a = w("ca-config-provider");
|
|
92
93
|
return y(), i(a, { locale: D(t) }, {
|
|
93
|
-
default:
|
|
94
|
+
default: N(() => [u(r)]),
|
|
94
95
|
_: 1
|
|
95
96
|
}, 8, ["locale"]);
|
|
96
97
|
};
|
|
97
98
|
}
|
|
98
99
|
});
|
|
99
100
|
// packages/core/src/types.ts
|
|
100
|
-
function
|
|
101
|
+
function ke(e) {
|
|
101
102
|
return "children" in e;
|
|
102
103
|
}
|
|
103
104
|
// packages/core/src/context.ts
|
|
104
|
-
var
|
|
105
|
-
function
|
|
106
|
-
|
|
105
|
+
var Ae;
|
|
106
|
+
function je(e) {
|
|
107
|
+
Ae = e;
|
|
107
108
|
}
|
|
108
|
-
function
|
|
109
|
-
if (!
|
|
110
|
-
return
|
|
109
|
+
function J() {
|
|
110
|
+
if (!Ae) throw Error("[campus] 请先调用 createCampusApp()");
|
|
111
|
+
return Ae;
|
|
111
112
|
}
|
|
112
|
-
function
|
|
113
|
-
for (let t of
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
t.title,
|
|
117
|
-
n
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
113
|
+
function Me(e) {
|
|
114
|
+
for (let t of J().menus) {
|
|
115
|
+
if (t.key === e && t.path) return { titles: [t.title] };
|
|
116
|
+
for (let n of t.children) {
|
|
117
|
+
if (n.key === e && n.path) return { titles: [t.title, n.title] };
|
|
118
|
+
if (ke(n)) {
|
|
119
|
+
let r = n.children.find((t) => t.key === e);
|
|
120
|
+
if (r) return { titles: [
|
|
121
|
+
t.title,
|
|
122
|
+
n.title,
|
|
123
|
+
r.title
|
|
124
|
+
] };
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
121
128
|
}
|
|
122
|
-
var
|
|
129
|
+
var Ne = [
|
|
123
130
|
"none",
|
|
124
131
|
"panel",
|
|
125
132
|
"all"
|
|
126
133
|
];
|
|
127
|
-
function
|
|
134
|
+
function Pe(e) {
|
|
128
135
|
let t = [], n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set();
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
136
|
+
function o(e, s, c, l = 1) {
|
|
137
|
+
let u = l === 1 ? i : l === 2 && ke(e) ? a : void 0;
|
|
138
|
+
if (u?.has(e.key)) throw Error(`[campus] 菜单${l === 1 ? "一级场景键" : "组键"}重复:${e.key}`);
|
|
139
|
+
u?.add(e.key);
|
|
140
|
+
let d = e.path !== void 0;
|
|
141
|
+
if (d !== (e.component !== void 0)) throw Error(`[campus] 菜单 path 与 component 必须同时出现:${e.key}`);
|
|
142
|
+
if (d) {
|
|
143
|
+
if (n.has(e.key)) throw Error(`[campus] 菜单页面键重复:${e.key}`);
|
|
144
|
+
if (n.add(e.key), typeof e.path != "string" || !e.path.startsWith("/")) throw Error(`[campus] 菜单路径必须以 / 开头:${e.path}`);
|
|
145
|
+
if (typeof e.component != "function") throw Error(`[campus] 菜单 component 必须是懒加载函数:${e.key}`);
|
|
146
|
+
if (r.has(e.path)) throw Error(`[campus] 菜单路径重复:${e.path}`);
|
|
147
|
+
r.add(e.path);
|
|
148
|
+
let { children: i, ...a } = e, o = {
|
|
149
|
+
...a,
|
|
150
|
+
appKey: s,
|
|
151
|
+
groupKey: l === 2 && ke(e) ? e.key : c
|
|
152
|
+
};
|
|
153
|
+
o.sideCollapse != null && !Ne.includes(o.sideCollapse) && (console.warn(`[campus] 菜单页面 sideCollapse 只能是 none / panel / all,已忽略:${e.key}`), delete o.sideCollapse), o.openMode != null && ![
|
|
154
|
+
"normal",
|
|
155
|
+
"collapsePanel",
|
|
156
|
+
"collapseAll",
|
|
157
|
+
"content",
|
|
158
|
+
"screen"
|
|
159
|
+
].includes(o.openMode) && (console.warn(`[campus] 菜单页面 openMode 无效,已忽略:${e.key}`), delete o.openMode), t.push(o);
|
|
160
|
+
}
|
|
161
|
+
if (l === 3 && ("children" in e || !d)) throw Error(`[campus] 三级菜单必须是页面且不能有子菜单:${e.key}`);
|
|
162
|
+
if ("children" in e) {
|
|
163
|
+
if (!Array.isArray(e.children)) throw Error(`[campus] 菜单 children 必须是数组:${e.key}`);
|
|
164
|
+
for (let t of e.children) o(t, s, l === 2 ? e.key : void 0, l + 1);
|
|
156
165
|
}
|
|
157
166
|
}
|
|
167
|
+
for (let t of e) o(t, t.key);
|
|
158
168
|
return t;
|
|
159
169
|
}
|
|
160
|
-
function
|
|
170
|
+
function Fe(e) {
|
|
161
171
|
let t = {
|
|
162
172
|
home: "/",
|
|
163
173
|
login: "/login",
|
|
@@ -177,21 +187,21 @@ function Ne(e) {
|
|
|
177
187
|
])).size !== 5) throw Error("[campus] 系统页面路径不能重复");
|
|
178
188
|
return t;
|
|
179
189
|
}
|
|
180
|
-
function
|
|
181
|
-
let n = e.homeEntry === !1 ? void 0 :
|
|
190
|
+
function Ie(e, t) {
|
|
191
|
+
let n = e.homeEntry === !1 ? void 0 : Pe(e.menus).find((e) => e.affix && t(e.permission)), r = !e.accountInMenu && !e.onAccountClick, i = (i) => !!i.path && t(i.permission) && i.key !== n?.key && (!r || i.path !== e.accountPath);
|
|
192
|
+
function a(e) {
|
|
193
|
+
let t = "children" in e ? e.children.map((e) => a(e)).filter((e) => e !== void 0) : [], n = i(e);
|
|
194
|
+
if (!n && !t.length) return;
|
|
195
|
+
let r = { ...e };
|
|
196
|
+
return "children" in r && (r.children = t), n || (delete r.path, delete r.component, delete r.permission, delete r.affix), r;
|
|
197
|
+
}
|
|
182
198
|
return {
|
|
183
199
|
home: n,
|
|
184
|
-
apps: e.menus.map((e) => (
|
|
185
|
-
...e,
|
|
186
|
-
children: e.children.map((e) => De(e) ? {
|
|
187
|
-
...e,
|
|
188
|
-
children: e.children.filter(i)
|
|
189
|
-
} : e).filter((e) => De(e) ? e.children.length > 0 : i(e))
|
|
190
|
-
})).filter((e) => e.children.length > 0),
|
|
200
|
+
apps: e.menus.map((e) => a(e)).filter((e) => e !== void 0),
|
|
191
201
|
accountStandalone: r
|
|
192
202
|
};
|
|
193
203
|
}
|
|
194
|
-
function
|
|
204
|
+
function Y(e) {
|
|
195
205
|
return {
|
|
196
206
|
login: "login",
|
|
197
207
|
register: "register",
|
|
@@ -202,51 +212,51 @@ function q(e) {
|
|
|
202
212
|
};
|
|
203
213
|
}
|
|
204
214
|
// packages/core/src/stores/theme.ts
|
|
205
|
-
var
|
|
206
|
-
function
|
|
207
|
-
return
|
|
215
|
+
var Le = "theme-mode", Re = "box-style", ze = "user-primary";
|
|
216
|
+
function Be() {
|
|
217
|
+
return _e(Re) === "border" ? "border" : "shadow";
|
|
208
218
|
}
|
|
209
|
-
function
|
|
210
|
-
let e =
|
|
211
|
-
return
|
|
219
|
+
function Ve() {
|
|
220
|
+
let e = _e(ze);
|
|
221
|
+
return oe(e) ? e : void 0;
|
|
212
222
|
}
|
|
213
|
-
function
|
|
214
|
-
let e =
|
|
223
|
+
function He() {
|
|
224
|
+
let e = _e(Le);
|
|
215
225
|
return e === "light" || e === "dark" || e === "auto" ? e : "auto";
|
|
216
226
|
}
|
|
217
|
-
var
|
|
218
|
-
let e = x({}), t = x(
|
|
227
|
+
var Ue = L("campus-theme", () => {
|
|
228
|
+
let e = x({}), t = x(He()), r = x(Be()), i = x(Ve()), a = typeof matchMedia == "function" ? matchMedia("(prefers-color-scheme: dark)") : void 0, o = x(a?.matches ?? !1);
|
|
219
229
|
a?.addEventListener("change", (e) => o.value = e.matches);
|
|
220
|
-
let s = n(() =>
|
|
230
|
+
let s = n(() => le(e.value)), c = n(() => e.value.tenantDefault?.locks?.includes("primary") ?? !1), l = n(() => {
|
|
221
231
|
let e = s.value.theme, t = i.value;
|
|
222
232
|
return !t || c.value ? e : {
|
|
223
233
|
...e,
|
|
224
234
|
primary: t,
|
|
225
235
|
headerBg: e.headerBg === e.primary ? t : e.headerBg
|
|
226
236
|
};
|
|
227
|
-
}), u = n(() => s.value.issues), d = n(() =>
|
|
228
|
-
|
|
237
|
+
}), u = n(() => s.value.issues), d = n(() => ce(t.value, o.value)), f = n(() => ae(l.value, d.value));
|
|
238
|
+
M(() => ie(f.value, d.value, l.value.style)), M(() => {
|
|
229
239
|
document.documentElement.dataset.caBox = r.value;
|
|
230
240
|
});
|
|
231
241
|
function p(e) {
|
|
232
|
-
(e === void 0 ||
|
|
242
|
+
(e === void 0 || oe(e)) && (i.value = e, K(ze, e ?? null));
|
|
233
243
|
}
|
|
234
244
|
function h(e) {
|
|
235
|
-
r.value = e,
|
|
245
|
+
r.value = e, K(Re, e);
|
|
236
246
|
}
|
|
237
247
|
function g() {
|
|
238
|
-
return `theme-layers:${
|
|
248
|
+
return `theme-layers:${J().theme?.cacheKey ?? location.host}`;
|
|
239
249
|
}
|
|
240
250
|
function _(e) {
|
|
241
|
-
t.value = e,
|
|
251
|
+
t.value = e, K(Le, e);
|
|
242
252
|
}
|
|
243
253
|
function v(e, t) {
|
|
244
|
-
let n = document, r =
|
|
254
|
+
let n = document, r = ce(e, o.value) !== d.value, i = typeof matchMedia == "function" && matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
245
255
|
if (!t || !r || i || !n.startViewTransition) {
|
|
246
256
|
_(e);
|
|
247
257
|
return;
|
|
248
258
|
}
|
|
249
|
-
let a = Math.hypot(Math.max(t.x, innerWidth - t.x), Math.max(t.y, innerHeight - t.y)), s =
|
|
259
|
+
let a = Math.hypot(Math.max(t.x, innerWidth - t.x), Math.max(t.y, innerHeight - t.y)), s = ce(e, o.value) === "dark", c = document.documentElement;
|
|
250
260
|
c.dataset.caThemeTransition = s ? "to-dark" : "to-light";
|
|
251
261
|
let l = !1, u = () => {
|
|
252
262
|
l || (l = !0, _(e));
|
|
@@ -265,12 +275,12 @@ var Ve = I("campus-theme", () => {
|
|
|
265
275
|
}).catch(() => {});
|
|
266
276
|
}
|
|
267
277
|
function y(t, n = !0) {
|
|
268
|
-
e.value = t, n &&
|
|
278
|
+
e.value = t, n && ye(g(), t);
|
|
269
279
|
}
|
|
270
280
|
async function b() {
|
|
271
|
-
let t =
|
|
281
|
+
let t = ve(g());
|
|
272
282
|
t && (e.value = t);
|
|
273
|
-
let n =
|
|
283
|
+
let n = J().theme?.load;
|
|
274
284
|
if (n) {
|
|
275
285
|
try {
|
|
276
286
|
y(await n());
|
|
@@ -298,16 +308,16 @@ var Ve = I("campus-theme", () => {
|
|
|
298
308
|
};
|
|
299
309
|
});
|
|
300
310
|
// packages/core/src/copyright.ts
|
|
301
|
-
function
|
|
311
|
+
function We(e, t = (/* @__PURE__ */ new Date()).getFullYear()) {
|
|
302
312
|
return e.replaceAll("{year}", String(t));
|
|
303
313
|
}
|
|
304
314
|
// packages/core/src/pages/auth/options.ts
|
|
305
|
-
var
|
|
306
|
-
function
|
|
307
|
-
return
|
|
315
|
+
var Ge = /^1[3-9]\d{9}$/;
|
|
316
|
+
function X() {
|
|
317
|
+
return J().login ?? {};
|
|
308
318
|
}
|
|
309
|
-
function
|
|
310
|
-
let e =
|
|
319
|
+
function Ke() {
|
|
320
|
+
let e = J().auth;
|
|
311
321
|
return {
|
|
312
322
|
captcha: typeof e.captcha == "function",
|
|
313
323
|
register: typeof e.register == "function" && typeof e.sendSmsCode == "function",
|
|
@@ -315,37 +325,37 @@ function Y() {
|
|
|
315
325
|
forgot: typeof e.resetPassword == "function" && typeof e.sendSmsCode == "function"
|
|
316
326
|
};
|
|
317
327
|
}
|
|
318
|
-
function
|
|
319
|
-
return typeof e == "string" && e.startsWith("/") && !e.startsWith("//") ? e :
|
|
328
|
+
function qe(e) {
|
|
329
|
+
return typeof e == "string" && e.startsWith("/") && !e.startsWith("//") ? e : Fe(J()).home;
|
|
320
330
|
}
|
|
321
331
|
// packages/core/src/pages/auth/AuthShell.vue?vue&type=script&setup=true&lang.ts
|
|
322
|
-
var
|
|
332
|
+
var Je = {
|
|
323
333
|
key: 0,
|
|
324
334
|
class: "ca-auth__title"
|
|
325
|
-
},
|
|
335
|
+
}, Ye = ["src"], Xe = { class: "ca-auth__qrcode" }, Ze = ["src", "alt"], Qe = {
|
|
326
336
|
key: 0,
|
|
327
337
|
class: "ca-auth__caption"
|
|
328
|
-
},
|
|
338
|
+
}, $e = { class: "ca-auth__site" }, et = {
|
|
329
339
|
key: 0,
|
|
330
340
|
class: "ca-auth__caption"
|
|
331
|
-
},
|
|
341
|
+
}, tt = { class: "ca-auth__main" }, nt = { class: "ca-auth__brand" }, rt = ["src"], it = {
|
|
332
342
|
class: "ca-auth__tabs",
|
|
333
343
|
role: "tablist"
|
|
334
|
-
},
|
|
344
|
+
}, at = [
|
|
335
345
|
"aria-selected",
|
|
336
346
|
"tabindex",
|
|
337
347
|
"onClick",
|
|
338
348
|
"onKeydown"
|
|
339
|
-
],
|
|
349
|
+
], ot = {
|
|
340
350
|
class: "ca-auth__body",
|
|
341
351
|
role: "tabpanel"
|
|
342
|
-
},
|
|
352
|
+
}, st = {
|
|
343
353
|
key: 0,
|
|
344
354
|
class: "ca-auth__footer"
|
|
345
|
-
},
|
|
355
|
+
}, ct = {
|
|
346
356
|
key: 0,
|
|
347
357
|
class: "ca-auth__version"
|
|
348
|
-
},
|
|
358
|
+
}, lt = /*@__PURE__*/ d({
|
|
349
359
|
__name: "AuthShell",
|
|
350
360
|
props: {
|
|
351
361
|
tabs: {},
|
|
@@ -354,13 +364,13 @@ var Ge = {
|
|
|
354
364
|
},
|
|
355
365
|
emits: ["update:active"],
|
|
356
366
|
setup(t, { emit: r }) {
|
|
357
|
-
let c = t, u = r, { t: d, label: f } =
|
|
367
|
+
let c = t, u = r, { t: d, label: f } = q(), p = J().brand, m = X(), _ = Ue(), 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(() => {
|
|
358
368
|
let e = m.panel?.caption ?? p.subtitle;
|
|
359
369
|
return e ? f(e) : "";
|
|
360
370
|
}), 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(() => {
|
|
361
371
|
let e = m.card, t = {}, n = A(e?.width), r = A(e?.minHeight), i = A(e?.panelWidth), a = A(e?.radius);
|
|
362
372
|
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;
|
|
363
|
-
}),
|
|
373
|
+
}), M = n(() => m.background ?? "var(--ca-login-bg)"), P = n(() => m.footer ? m.footer.map((e) => We(f(e))) : p.copyright ? We(f(p.copyright)).split("\n").filter(Boolean) : []);
|
|
364
374
|
function F(e, t) {
|
|
365
375
|
if (e.key !== "ArrowRight" && e.key !== "ArrowLeft") return;
|
|
366
376
|
let n = (t + (e.key === "ArrowRight" ? 1 : -1) + c.tabs.length) % c.tabs.length, r = c.tabs[n];
|
|
@@ -368,7 +378,7 @@ var Ge = {
|
|
|
368
378
|
}
|
|
369
379
|
return (n, r) => (y(), o("div", { class: h(["ca-auth", { "ca-auth--preview": t.preview }]) }, [s("div", {
|
|
370
380
|
class: "ca-auth__stage",
|
|
371
|
-
style: g({ background:
|
|
381
|
+
style: g({ background: M.value })
|
|
372
382
|
}, [s("div", {
|
|
373
383
|
class: "ca-auth__card",
|
|
374
384
|
style: g(j.value)
|
|
@@ -376,24 +386,24 @@ var Ge = {
|
|
|
376
386
|
class: "ca-auth__panel",
|
|
377
387
|
style: g(k.value ? { background: k.value } : void 0)
|
|
378
388
|
}, [
|
|
379
|
-
O.value && w.value ? (y(), o("h2",
|
|
389
|
+
O.value && w.value ? (y(), o("h2", Je, E(O.value), 1)) : a("v-if", !0),
|
|
380
390
|
x.value ? (y(), o("img", {
|
|
381
391
|
key: 1,
|
|
382
392
|
src: x.value,
|
|
383
393
|
alt: "",
|
|
384
394
|
class: "ca-auth__logo"
|
|
385
|
-
}, null, 8,
|
|
386
|
-
w.value ? (y(), o(e, { key: 2 }, [s("div",
|
|
395
|
+
}, null, 8, Ye)) : a("v-if", !0),
|
|
396
|
+
w.value ? (y(), o(e, { key: 2 }, [s("div", Xe, [s("img", {
|
|
387
397
|
src: w.value,
|
|
388
398
|
alt: D(d)("campus.auth.qrcodeAlt")
|
|
389
|
-
}, null, 8,
|
|
390
|
-
], 4), s("section",
|
|
391
|
-
s("div",
|
|
399
|
+
}, null, 8, Ze)]), T.value ? (y(), o("p", Qe, E(T.value), 1)) : a("v-if", !0)], 64)) : (y(), o(e, { key: 3 }, [s("h2", $e, E(O.value || v.value), 1), T.value ? (y(), o("p", et, E(T.value), 1)) : a("v-if", !0)], 64))
|
|
400
|
+
], 4), s("section", tt, [
|
|
401
|
+
s("div", nt, [b.value ? (y(), o("img", {
|
|
392
402
|
key: 0,
|
|
393
403
|
src: b.value,
|
|
394
404
|
alt: ""
|
|
395
|
-
}, null, 8,
|
|
396
|
-
s("div",
|
|
405
|
+
}, null, 8, rt)) : a("v-if", !0), s("span", null, E(v.value), 1)]),
|
|
406
|
+
s("div", it, [(y(!0), o(e, null, S(t.tabs, (n, r) => (y(), o(e, { key: n.key }, [n.to && !t.preview ? (y(), i(D(ne), {
|
|
397
407
|
key: 0,
|
|
398
408
|
to: n.to,
|
|
399
409
|
role: "tab",
|
|
@@ -401,7 +411,7 @@ var Ge = {
|
|
|
401
411
|
class: "ca-auth__tab",
|
|
402
412
|
onKeydown: (e) => F(e, r)
|
|
403
413
|
}, {
|
|
404
|
-
default:
|
|
414
|
+
default: N(() => [l(E(n.label), 1)]),
|
|
405
415
|
_: 2
|
|
406
416
|
}, 1032, ["to", "onKeydown"])) : (y(), o("button", {
|
|
407
417
|
key: 1,
|
|
@@ -412,111 +422,139 @@ var Ge = {
|
|
|
412
422
|
tabindex: n.key === t.active ? 0 : -1,
|
|
413
423
|
onClick: (e) => n.to ? void 0 : u("update:active", n.key),
|
|
414
424
|
onKeydown: (e) => F(e, r)
|
|
415
|
-
}, E(n.label), 43,
|
|
416
|
-
s("div",
|
|
417
|
-
P.value.length ? (y(), o("div",
|
|
418
|
-
])], 4), D(m).version ? (y(), o("span",
|
|
425
|
+
}, E(n.label), 43, at))], 64))), 128))]),
|
|
426
|
+
s("div", ot, [C(n.$slots, "default", {}, void 0, !0)]),
|
|
427
|
+
P.value.length ? (y(), o("div", st, [(y(!0), o(e, null, S(P.value, (e) => (y(), o("p", { key: e }, E(e), 1))), 128))])) : a("v-if", !0)
|
|
428
|
+
])], 4), D(m).version ? (y(), o("span", ct, E(D(m).version), 1)) : a("v-if", !0)], 4)], 2));
|
|
419
429
|
}
|
|
420
|
-
}),
|
|
430
|
+
}), Z = (e, t) => {
|
|
421
431
|
let n = e.__vccOpts || e;
|
|
422
432
|
for (let [e, r] of t) n[e] = r;
|
|
423
433
|
return n;
|
|
424
|
-
},
|
|
425
|
-
let e = x(!1), t = x("desktop"), r = x(!1), i = x(!1), a = x(
|
|
426
|
-
function
|
|
427
|
-
|
|
434
|
+
}, ut = /*#__PURE__*/ Z(lt, [["__scopeId", "data-v-3545cdf2"]]), dt = "side-collapsed", ft = L("campus-layout", () => {
|
|
435
|
+
let e = x(!1), t = x("desktop"), r = x(!1), i = x(!1), a = x(_e(dt) === "1"), o = x(null), s = n(() => o.value ?? a.value), c = x(!1), l = n(() => c.value && t.value === "desktop"), u = x({}), d = x({}), f;
|
|
436
|
+
function p(e, t = !1) {
|
|
437
|
+
f = e, e && !t && (o.value = u.value[e] ?? !1);
|
|
438
|
+
}
|
|
439
|
+
function m(e, t) {
|
|
440
|
+
d.value[e] = t;
|
|
441
|
+
}
|
|
442
|
+
function h(e) {
|
|
443
|
+
e in d.value || m(e, !0);
|
|
444
|
+
}
|
|
445
|
+
async function g(e, n, r) {
|
|
446
|
+
e.path && n !== e.path ? (await r(e.path), m(e.key, !0), t.value === "phone" ? V() : t.value === "pad" && re()) : m(e.key, !(d.value[e.key] ?? !1));
|
|
428
447
|
}
|
|
429
|
-
function
|
|
448
|
+
async function _(e, n, r, a) {
|
|
449
|
+
if (e.path) {
|
|
450
|
+
if (e.path !== n) {
|
|
451
|
+
await r(e.path);
|
|
452
|
+
let n = e.openMode == null ? e.sideCollapse === "panel" || e.sideCollapse === "all" : e.openMode !== "normal";
|
|
453
|
+
a && e.children.length && t.value === "desktop" && !n && (o.value = !1, u.value[e.key] = !1);
|
|
454
|
+
} else e.children.length && (t.value === "desktop" ? v() : t.value === "pad" && (i.value = !i.value));
|
|
455
|
+
e.path !== n && e.children.length && t.value === "pad" && re(), e.children.length && t.value === "phone" && V(), e.children.length || H();
|
|
456
|
+
} else t.value === "pad" ? i.value = !(a && i.value) : t.value === "desktop" && s.value && v();
|
|
457
|
+
}
|
|
458
|
+
function v() {
|
|
459
|
+
o.value === null ? (a.value = !a.value, K(dt, a.value ? "1" : "0")) : (o.value = !o.value, f && (u.value[f] = o.value));
|
|
460
|
+
}
|
|
461
|
+
function y() {
|
|
430
462
|
c.value = !1, o.value = null;
|
|
431
463
|
}
|
|
432
|
-
function
|
|
464
|
+
function b(e = "none") {
|
|
433
465
|
o.value = e === "panel" || null, c.value = e === "all";
|
|
434
466
|
}
|
|
435
|
-
let
|
|
436
|
-
function
|
|
437
|
-
|
|
467
|
+
let S = "normal", C = null, w = !1, T, E = !1, D = !1, O = !1, k = x(!1);
|
|
468
|
+
function A() {
|
|
469
|
+
C !== null && (e.value = C);
|
|
438
470
|
}
|
|
439
|
-
function
|
|
440
|
-
|
|
441
|
-
|
|
471
|
+
function j() {
|
|
472
|
+
w && document.fullscreenElement === document.documentElement && (w = !1, document.exitFullscreen().catch(() => {
|
|
473
|
+
w = document.fullscreenElement === document.documentElement;
|
|
442
474
|
}).finally(() => {
|
|
443
|
-
|
|
475
|
+
S === "screen" && !document.fullscreenElement && (D = !0, M());
|
|
444
476
|
}));
|
|
445
477
|
}
|
|
446
|
-
function
|
|
447
|
-
|
|
478
|
+
function M() {
|
|
479
|
+
E || (S === "screen" ? O || (D || !document.fullscreenElement ? (e.value = !0, k.value = !0) : (A(), k.value = !1)) : j());
|
|
448
480
|
}
|
|
449
|
-
function
|
|
450
|
-
if (
|
|
451
|
-
else if (!
|
|
452
|
-
|
|
481
|
+
function N() {
|
|
482
|
+
if (E = !0, document.fullscreenElement) D = !1;
|
|
483
|
+
else if (!T) {
|
|
484
|
+
D = !1;
|
|
453
485
|
try {
|
|
454
|
-
|
|
455
|
-
|
|
486
|
+
T = document.documentElement.requestFullscreen().then(() => {
|
|
487
|
+
D = !1, w = document.fullscreenElement === document.documentElement;
|
|
456
488
|
}, () => {
|
|
457
|
-
|
|
489
|
+
D = !0;
|
|
458
490
|
}).finally(() => {
|
|
459
|
-
|
|
491
|
+
T = void 0, M();
|
|
460
492
|
});
|
|
461
493
|
} catch {
|
|
462
|
-
|
|
494
|
+
D = !0;
|
|
463
495
|
}
|
|
464
496
|
}
|
|
465
497
|
}
|
|
466
|
-
function
|
|
467
|
-
|
|
498
|
+
function P() {
|
|
499
|
+
E = !1, S !== "screen" && j();
|
|
468
500
|
}
|
|
469
|
-
function
|
|
470
|
-
|
|
471
|
-
let r =
|
|
472
|
-
r &&
|
|
501
|
+
function F(t, n) {
|
|
502
|
+
S = t ?? "normal", O = !1, k.value = !1, b(t == null ? n : t === "collapsePanel" ? "panel" : t === "collapseAll" ? "all" : "none");
|
|
503
|
+
let r = S === "content" || S === "screen";
|
|
504
|
+
r && C === null && (C = e.value), r || (A(), C = null), S === "content" && (e.value = !0), S === "screen" && !E && N(), E = !1, S === "screen" ? M() : j();
|
|
473
505
|
}
|
|
474
|
-
function
|
|
475
|
-
|
|
506
|
+
function I() {
|
|
507
|
+
O = !0, w = !1, k.value = !1;
|
|
476
508
|
}
|
|
477
|
-
function
|
|
478
|
-
|
|
509
|
+
function L() {
|
|
510
|
+
w && document.fullscreenElement !== document.documentElement && (w = !1, O = !0, k.value = !1);
|
|
479
511
|
}
|
|
480
|
-
function
|
|
481
|
-
|
|
512
|
+
function R() {
|
|
513
|
+
O = !1, N(), E = !1, T || M();
|
|
482
514
|
}
|
|
483
|
-
function
|
|
484
|
-
|
|
515
|
+
function z() {
|
|
516
|
+
k.value = !1;
|
|
485
517
|
}
|
|
486
|
-
function
|
|
487
|
-
|
|
518
|
+
function ee() {
|
|
519
|
+
O = !0, k.value = !1, e.value = !e.value;
|
|
488
520
|
}
|
|
489
|
-
function
|
|
521
|
+
function te(e) {
|
|
490
522
|
t.value = e, e !== "phone" && (r.value = !1), e !== "pad" && (i.value = !1);
|
|
491
523
|
}
|
|
492
|
-
function
|
|
524
|
+
function B() {
|
|
493
525
|
r.value = !1;
|
|
494
526
|
}
|
|
495
|
-
function
|
|
527
|
+
function V() {
|
|
496
528
|
r.value = !0;
|
|
497
529
|
}
|
|
498
|
-
function
|
|
530
|
+
function ne() {
|
|
499
531
|
i.value = !1;
|
|
500
532
|
}
|
|
501
|
-
function
|
|
533
|
+
function re() {
|
|
502
534
|
i.value = !0;
|
|
503
535
|
}
|
|
504
|
-
function
|
|
536
|
+
function H() {
|
|
505
537
|
r.value = !1, i.value = !1;
|
|
506
538
|
}
|
|
507
|
-
function
|
|
508
|
-
|
|
539
|
+
function U() {
|
|
540
|
+
F("normal"), e.value = !1, b("none"), H(), u.value = {}, d.value = {}, f = void 0;
|
|
509
541
|
}
|
|
510
542
|
return {
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
543
|
+
enterParentPage: p,
|
|
544
|
+
menuGroups: d,
|
|
545
|
+
ensureMenuGroup: h,
|
|
546
|
+
setMenuGroup: m,
|
|
547
|
+
clickMenuApp: _,
|
|
548
|
+
clickMenuGroup: g,
|
|
549
|
+
reset: U,
|
|
550
|
+
pageScreenPrompt: k,
|
|
551
|
+
preparePageScreen: N,
|
|
552
|
+
cancelPageScreen: P,
|
|
553
|
+
applyPageOpenMode: F,
|
|
554
|
+
pageScreenManual: I,
|
|
555
|
+
syncPageScreen: L,
|
|
556
|
+
retryPageScreen: R,
|
|
557
|
+
dismissPageScreenPrompt: z,
|
|
520
558
|
contentFullscreen: e,
|
|
521
559
|
mode: t,
|
|
522
560
|
mobileMenuOpen: r,
|
|
@@ -526,41 +564,41 @@ var Ge = {
|
|
|
526
564
|
sidePanelCollapsed: s,
|
|
527
565
|
sideHidden: c,
|
|
528
566
|
sideHiddenActive: l,
|
|
529
|
-
toggleSidePanel:
|
|
530
|
-
showSide:
|
|
531
|
-
applySideCollapse:
|
|
532
|
-
toggleContentFullscreen:
|
|
533
|
-
setMode:
|
|
534
|
-
closeMobileMenu:
|
|
535
|
-
openMobileMenu:
|
|
536
|
-
closePadPanel:
|
|
537
|
-
openPadPanel:
|
|
538
|
-
closeOverlays:
|
|
567
|
+
toggleSidePanel: v,
|
|
568
|
+
showSide: y,
|
|
569
|
+
applySideCollapse: b,
|
|
570
|
+
toggleContentFullscreen: ee,
|
|
571
|
+
setMode: te,
|
|
572
|
+
closeMobileMenu: B,
|
|
573
|
+
openMobileMenu: V,
|
|
574
|
+
closePadPanel: ne,
|
|
575
|
+
openPadPanel: re,
|
|
576
|
+
closeOverlays: H
|
|
539
577
|
};
|
|
540
578
|
});
|
|
541
579
|
// packages/core/src/tabs-policy.ts
|
|
542
|
-
function
|
|
580
|
+
function pt(e, t, n = Date.now()) {
|
|
543
581
|
return {
|
|
544
582
|
...e,
|
|
545
583
|
[t]: Math.max(n, ...Object.values(e).map((e) => e + 1))
|
|
546
584
|
};
|
|
547
585
|
}
|
|
548
|
-
function
|
|
586
|
+
function mt(e, t, n, r, i) {
|
|
549
587
|
let a = e.filter((e) => !r.includes(e));
|
|
550
588
|
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);
|
|
551
589
|
}
|
|
552
590
|
// packages/core/src/stores/tabs.ts
|
|
553
|
-
var
|
|
554
|
-
let e =
|
|
591
|
+
var ht = "tabs", gt = L("campus-tabs", () => {
|
|
592
|
+
let e = Pe(J().menus), t = new Set(e.map((e) => e.key)), r = e.filter((e) => e.affix).map((e) => e.key), i = ve(ht, "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 = J().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))));
|
|
555
593
|
for (let [e, t] of d.value.entries()) Number.isFinite(p.value[t]) || (p.value[t] = e + 1);
|
|
556
594
|
for (;;) {
|
|
557
|
-
let e =
|
|
595
|
+
let e = mt(d.value, p.value, "", s.value, l);
|
|
558
596
|
if (!e) break;
|
|
559
597
|
d.value.splice(d.value.indexOf(e), 1), delete p.value[e];
|
|
560
598
|
}
|
|
561
599
|
let h = x({}), g = x(null), _ = n(() => d.value.filter((e) => e !== g.value));
|
|
562
600
|
function v() {
|
|
563
|
-
p.value = Object.fromEntries(d.value.map((e) => [e, p.value[e] ?? 0])),
|
|
601
|
+
p.value = Object.fromEntries(d.value.map((e) => [e, p.value[e] ?? 0])), ye(ht, {
|
|
564
602
|
visited: d.value,
|
|
565
603
|
active: p.value,
|
|
566
604
|
affix: o.value
|
|
@@ -568,8 +606,8 @@ var dt = "tabs", ft = I("campus-tabs", () => {
|
|
|
568
606
|
}
|
|
569
607
|
function y(e) {
|
|
570
608
|
if (!t.has(e)) return;
|
|
571
|
-
d.value.includes(e) || d.value.push(e), p.value =
|
|
572
|
-
let n =
|
|
609
|
+
d.value.includes(e) || d.value.push(e), p.value = pt(p.value, e);
|
|
610
|
+
let n = mt(d.value, p.value, e, s.value, l);
|
|
573
611
|
n && d.value.splice(d.value.indexOf(n), 1), v();
|
|
574
612
|
}
|
|
575
613
|
function b(e) {
|
|
@@ -617,8 +655,8 @@ var dt = "tabs", ft = I("campus-tabs", () => {
|
|
|
617
655
|
refresh: E,
|
|
618
656
|
setAffix: D
|
|
619
657
|
};
|
|
620
|
-
}),
|
|
621
|
-
let e =
|
|
658
|
+
}), _t = "session", Q = L("campus-session", () => {
|
|
659
|
+
let e = ve(_t, "session"), t = x(e?.token ?? ""), r = x(e?.user), i = n(() => !!(t.value && r.value));
|
|
622
660
|
function a(e) {
|
|
623
661
|
if (!e) return !0;
|
|
624
662
|
let t = r.value?.permissions;
|
|
@@ -628,28 +666,28 @@ var dt = "tabs", ft = I("campus-tabs", () => {
|
|
|
628
666
|
r.value && (r.value = {
|
|
629
667
|
...r.value,
|
|
630
668
|
permissions: e
|
|
631
|
-
},
|
|
669
|
+
}, ye(_t, {
|
|
632
670
|
token: t.value,
|
|
633
671
|
user: r.value
|
|
634
672
|
}, "session"));
|
|
635
673
|
}
|
|
636
674
|
async function s(e) {
|
|
637
|
-
c(await
|
|
675
|
+
c(await J().auth.login(e));
|
|
638
676
|
}
|
|
639
677
|
function c(e) {
|
|
640
|
-
t.value = e.token, r.value = e.user,
|
|
678
|
+
t.value = e.token, r.value = e.user, ye(_t, e, "session");
|
|
641
679
|
}
|
|
642
680
|
async function l() {
|
|
643
681
|
try {
|
|
644
|
-
await
|
|
682
|
+
await J().auth.logout?.();
|
|
645
683
|
} catch (e) {
|
|
646
684
|
console.warn("[campus] 退出时通知服务端失败,已清除本地登录态:", e);
|
|
647
685
|
} finally {
|
|
648
|
-
t.value = "", r.value = void 0,
|
|
686
|
+
t.value = "", r.value = void 0, K(_t, null, "session"), gt().reset(), ft().reset();
|
|
649
687
|
}
|
|
650
688
|
}
|
|
651
689
|
function u() {
|
|
652
|
-
t.value = "", r.value = void 0,
|
|
690
|
+
t.value = "", r.value = void 0, K(_t, null, "session"), gt().reset(), ft().reset();
|
|
653
691
|
}
|
|
654
692
|
return {
|
|
655
693
|
token: t,
|
|
@@ -662,7 +700,7 @@ var dt = "tabs", ft = I("campus-tabs", () => {
|
|
|
662
700
|
logout: l,
|
|
663
701
|
expire: u
|
|
664
702
|
};
|
|
665
|
-
}),
|
|
703
|
+
}), vt = {
|
|
666
704
|
class: "ca-auth-icon",
|
|
667
705
|
viewBox: "0 0 24 24",
|
|
668
706
|
width: "16",
|
|
@@ -673,7 +711,7 @@ var dt = "tabs", ft = I("campus-tabs", () => {
|
|
|
673
711
|
"stroke-linecap": "round",
|
|
674
712
|
"stroke-linejoin": "round",
|
|
675
713
|
"aria-hidden": "true"
|
|
676
|
-
},
|
|
714
|
+
}, yt = ["d"], $ = /* @__PURE__ */ d({
|
|
677
715
|
__name: "AuthIcon",
|
|
678
716
|
props: { name: {} },
|
|
679
717
|
setup(e) {
|
|
@@ -684,15 +722,19 @@ var dt = "tabs", ft = I("campus-tabs", () => {
|
|
|
684
722
|
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",
|
|
685
723
|
message: "M4 5h16v11H9l-4 3.500V16H4z"
|
|
686
724
|
};
|
|
687
|
-
return (n, r) => (y(), o("svg",
|
|
725
|
+
return (n, r) => (y(), o("svg", vt, [s("path", { d: t[e.name] }, null, 8, yt)]));
|
|
688
726
|
}
|
|
689
|
-
}),
|
|
727
|
+
}), bt = { class: "ca-auth-row" }, xt = [
|
|
690
728
|
"title",
|
|
691
729
|
"aria-label",
|
|
692
730
|
"disabled"
|
|
693
|
-
],
|
|
731
|
+
], St = ["src"], Ct = { key: 1 }, wt = /*#__PURE__*/ Z(/* @__PURE__ */ d({
|
|
694
732
|
__name: "CaptchaField",
|
|
695
|
-
props: /*@__PURE__*/ p({
|
|
733
|
+
props: /*@__PURE__*/ p({
|
|
734
|
+
scene: {},
|
|
735
|
+
inputId: {},
|
|
736
|
+
inputErrorId: {}
|
|
737
|
+
}, {
|
|
696
738
|
code: { default: "" },
|
|
697
739
|
codeModifiers: {},
|
|
698
740
|
captchaKey: { default: "" },
|
|
@@ -700,11 +742,11 @@ var dt = "tabs", ft = I("campus-tabs", () => {
|
|
|
700
742
|
}),
|
|
701
743
|
emits: ["update:code", "update:captchaKey"],
|
|
702
744
|
setup(e, { expose: t }) {
|
|
703
|
-
let n = e, r =
|
|
704
|
-
async function
|
|
745
|
+
let n = e, r = k(e, "code"), i = k(e, "captchaKey"), { t: c, label: l } = q(), d = X().fields?.captcha, f = x(""), p = x(!1), m = x(!1);
|
|
746
|
+
async function g() {
|
|
705
747
|
m.value = !0;
|
|
706
748
|
try {
|
|
707
|
-
let e = await
|
|
749
|
+
let e = await J().auth.captcha(n.scene);
|
|
708
750
|
i.value = e.key, f.value = e.image, p.value = !1;
|
|
709
751
|
} catch {
|
|
710
752
|
f.value = "", p.value = !0;
|
|
@@ -712,22 +754,30 @@ var dt = "tabs", ft = I("campus-tabs", () => {
|
|
|
712
754
|
r.value = "", m.value = !1;
|
|
713
755
|
}
|
|
714
756
|
}
|
|
715
|
-
return v(
|
|
716
|
-
let
|
|
717
|
-
return y(), o("div",
|
|
757
|
+
return v(g), t({ refresh: g }), (t, n) => {
|
|
758
|
+
let i = w("ca-input");
|
|
759
|
+
return y(), o("div", bt, [u(i, {
|
|
718
760
|
modelValue: r.value,
|
|
719
|
-
"onUpdate:modelValue":
|
|
720
|
-
|
|
721
|
-
"
|
|
761
|
+
"onUpdate:modelValue": n[0] ||= (e) => r.value = e,
|
|
762
|
+
id: e.inputId,
|
|
763
|
+
class: h({ "ca-auth-captcha__input": e.inputId }),
|
|
764
|
+
placeholder: D(d)?.placeholder ? D(l)(D(d).placeholder) : e.inputId ? void 0 : D(c)("campus.auth.captchaPlaceholder"),
|
|
765
|
+
"aria-label": e.inputId ? void 0 : D(c)("campus.auth.captcha"),
|
|
766
|
+
"aria-invalid": e.inputErrorId ? "true" : void 0,
|
|
767
|
+
"aria-describedby": e.inputErrorId,
|
|
722
768
|
autocomplete: "off",
|
|
723
769
|
maxlength: D(d)?.maxlength ?? 8
|
|
724
770
|
}, {
|
|
725
|
-
prefix:
|
|
771
|
+
prefix: N(() => [u($, { name: "shield" })]),
|
|
726
772
|
_: 1
|
|
727
773
|
}, 8, [
|
|
728
774
|
"modelValue",
|
|
775
|
+
"id",
|
|
776
|
+
"class",
|
|
729
777
|
"placeholder",
|
|
730
778
|
"aria-label",
|
|
779
|
+
"aria-invalid",
|
|
780
|
+
"aria-describedby",
|
|
731
781
|
"maxlength"
|
|
732
782
|
]), s("button", {
|
|
733
783
|
type: "button",
|
|
@@ -735,26 +785,26 @@ var dt = "tabs", ft = I("campus-tabs", () => {
|
|
|
735
785
|
title: D(c)("campus.auth.captchaRefresh"),
|
|
736
786
|
"aria-label": D(c)("campus.auth.captchaRefresh"),
|
|
737
787
|
disabled: m.value,
|
|
738
|
-
onClick:
|
|
788
|
+
onClick: g
|
|
739
789
|
}, [f.value ? (y(), o("img", {
|
|
740
790
|
key: 0,
|
|
741
791
|
src: f.value,
|
|
742
792
|
alt: ""
|
|
743
|
-
}, null, 8,
|
|
793
|
+
}, null, 8, St)) : p.value ? (y(), o("span", Ct, E(D(c)("campus.auth.captchaFailed")), 1)) : a("v-if", !0)], 8, xt)]);
|
|
744
794
|
};
|
|
745
795
|
}
|
|
746
|
-
}),
|
|
796
|
+
}), [["__scopeId", "data-v-bd481e4d"]]), Tt = {
|
|
747
797
|
key: 1,
|
|
748
798
|
class: "ca-auth-links"
|
|
749
|
-
},
|
|
799
|
+
}, Et = { class: "ca-auth-help" }, Dt = /* @__PURE__ */ d({
|
|
750
800
|
__name: "LoginForm",
|
|
751
801
|
props: { preview: { type: Boolean } },
|
|
752
802
|
setup(t) {
|
|
753
|
-
let r = t, c =
|
|
803
|
+
let r = t, c = W(), d = G(), f = Q(), { t: p, label: m } = q(), h = Ke(), g = X(), _ = g.fields ?? {}, v = b({
|
|
754
804
|
username: "",
|
|
755
805
|
password: "",
|
|
756
806
|
captcha: ""
|
|
757
|
-
}), C = x(""), T = x(), O = x(), k = x(!1), A = x(""), j = x("error"),
|
|
807
|
+
}), C = x(""), T = x(), O = x(), k = x(!1), A = x(""), j = x("error"), M = n(() => ({
|
|
758
808
|
username: [{
|
|
759
809
|
required: !0,
|
|
760
810
|
message: p("campus.login.required", { label: p("campus.login.username") }),
|
|
@@ -770,7 +820,7 @@ var dt = "tabs", ft = I("campus-tabs", () => {
|
|
|
770
820
|
message: p("campus.auth.captchaRequired"),
|
|
771
821
|
trigger: "blur"
|
|
772
822
|
}] : []
|
|
773
|
-
})),
|
|
823
|
+
})), P = n(() => (g.helps ?? [
|
|
774
824
|
1,
|
|
775
825
|
2,
|
|
776
826
|
3,
|
|
@@ -796,7 +846,7 @@ var dt = "tabs", ft = I("campus-tabs", () => {
|
|
|
796
846
|
key: C.value,
|
|
797
847
|
code: v.captcha
|
|
798
848
|
} : void 0
|
|
799
|
-
}), await d.replace(
|
|
849
|
+
}), await d.replace(qe(c.query.redirect));
|
|
800
850
|
} catch (e) {
|
|
801
851
|
A.value = e instanceof Error && e.message ? e.message : p("campus.login.failed"), T.value?.refresh();
|
|
802
852
|
} finally {
|
|
@@ -807,7 +857,7 @@ var dt = "tabs", ft = I("campus-tabs", () => {
|
|
|
807
857
|
function R(e) {
|
|
808
858
|
r.preview && e.preventDefault();
|
|
809
859
|
}
|
|
810
|
-
let
|
|
860
|
+
let z = n(() => h.forgot || h.register);
|
|
811
861
|
return (t, n) => {
|
|
812
862
|
let r = w("ca-alert"), c = w("ca-input"), d = w("ca-form-item"), f = w("ca-button"), g = w("ca-form");
|
|
813
863
|
return y(), o(e, null, [
|
|
@@ -823,14 +873,14 @@ var dt = "tabs", ft = I("campus-tabs", () => {
|
|
|
823
873
|
ref_key: "formRef",
|
|
824
874
|
ref: O,
|
|
825
875
|
model: v,
|
|
826
|
-
rules:
|
|
876
|
+
rules: M.value,
|
|
827
877
|
size: "large",
|
|
828
878
|
class: "ca-auth-form",
|
|
829
|
-
onSubmit:
|
|
879
|
+
onSubmit: F(L, ["prevent"])
|
|
830
880
|
}, {
|
|
831
|
-
default:
|
|
881
|
+
default: N(() => [
|
|
832
882
|
u(d, { prop: "username" }, {
|
|
833
|
-
default:
|
|
883
|
+
default: N(() => [u(c, {
|
|
834
884
|
modelValue: v.username,
|
|
835
885
|
"onUpdate:modelValue": n[0] ||= (e) => v.username = e,
|
|
836
886
|
placeholder: D(_).username?.placeholder ? D(m)(D(_).username.placeholder) : D(p)("campus.auth.accountPlaceholder"),
|
|
@@ -840,7 +890,7 @@ var dt = "tabs", ft = I("campus-tabs", () => {
|
|
|
840
890
|
"aria-label": D(p)("campus.login.username"),
|
|
841
891
|
autocomplete: "username"
|
|
842
892
|
}, {
|
|
843
|
-
prefix:
|
|
893
|
+
prefix: N(() => [u($, { name: "user" })]),
|
|
844
894
|
_: 1
|
|
845
895
|
}, 8, [
|
|
846
896
|
"modelValue",
|
|
@@ -852,7 +902,7 @@ var dt = "tabs", ft = I("campus-tabs", () => {
|
|
|
852
902
|
_: 1
|
|
853
903
|
}),
|
|
854
904
|
u(d, { prop: "password" }, {
|
|
855
|
-
default:
|
|
905
|
+
default: N(() => [u(c, {
|
|
856
906
|
modelValue: v.password,
|
|
857
907
|
"onUpdate:modelValue": n[1] ||= (e) => v.password = e,
|
|
858
908
|
type: "password",
|
|
@@ -862,7 +912,7 @@ var dt = "tabs", ft = I("campus-tabs", () => {
|
|
|
862
912
|
"aria-label": D(p)("campus.login.password"),
|
|
863
913
|
autocomplete: "current-password"
|
|
864
914
|
}, {
|
|
865
|
-
prefix:
|
|
915
|
+
prefix: N(() => [u($, { name: "lock" })]),
|
|
866
916
|
_: 1
|
|
867
917
|
}, 8, [
|
|
868
918
|
"modelValue",
|
|
@@ -876,7 +926,7 @@ var dt = "tabs", ft = I("campus-tabs", () => {
|
|
|
876
926
|
key: 0,
|
|
877
927
|
prop: "captcha"
|
|
878
928
|
}, {
|
|
879
|
-
default:
|
|
929
|
+
default: N(() => [u(wt, {
|
|
880
930
|
ref_key: "captchaRef",
|
|
881
931
|
ref: T,
|
|
882
932
|
code: v.captcha,
|
|
@@ -894,33 +944,33 @@ var dt = "tabs", ft = I("campus-tabs", () => {
|
|
|
894
944
|
loading: k.value,
|
|
895
945
|
class: "ca-auth-submit"
|
|
896
946
|
}, {
|
|
897
|
-
default:
|
|
947
|
+
default: N(() => [l(E(D(p)("campus.login.submit")), 1)]),
|
|
898
948
|
_: 1
|
|
899
949
|
}, 8, ["loading"])
|
|
900
950
|
]),
|
|
901
951
|
_: 1
|
|
902
952
|
}, 8, ["model", "rules"]),
|
|
903
|
-
|
|
953
|
+
z.value ? (y(), o("div", Tt, [D(h).forgot ? (y(), i(D(ne), {
|
|
904
954
|
key: 0,
|
|
905
|
-
to: { name: D(
|
|
955
|
+
to: { name: D(Y)(D(J)()).forgot },
|
|
906
956
|
onClick: R
|
|
907
957
|
}, {
|
|
908
|
-
default:
|
|
958
|
+
default: N(() => [l(E(D(p)("campus.auth.forgotLink")), 1)]),
|
|
909
959
|
_: 1
|
|
910
|
-
}, 8, ["to"])) : a("v-if", !0), D(h).register ? (y(), i(D(
|
|
960
|
+
}, 8, ["to"])) : a("v-if", !0), D(h).register ? (y(), i(D(ne), {
|
|
911
961
|
key: 1,
|
|
912
|
-
to: { name: D(
|
|
962
|
+
to: { name: D(Y)(D(J)()).register },
|
|
913
963
|
onClick: R
|
|
914
964
|
}, {
|
|
915
|
-
default:
|
|
965
|
+
default: N(() => [l(E(D(p)("campus.auth.registerLink")), 1)]),
|
|
916
966
|
_: 1
|
|
917
967
|
}, 8, ["to"])) : a("v-if", !0)])) : a("v-if", !0),
|
|
918
|
-
s("div",
|
|
968
|
+
s("div", Et, [s("h3", null, E(D(p)("campus.auth.helpTitle")), 1), s("ol", null, [(y(!0), o(e, null, S(P.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(ne), {
|
|
919
969
|
key: 1,
|
|
920
|
-
to: { name: D(
|
|
970
|
+
to: { name: D(Y)(D(J)()).forgot },
|
|
921
971
|
onClick: R
|
|
922
972
|
}, {
|
|
923
|
-
default:
|
|
973
|
+
default: N(() => [l(E(D(p)("campus.auth.findPassword")), 1)]),
|
|
924
974
|
_: 1
|
|
925
975
|
}, 8, ["to"])) : (y(), o(e, { key: 2 }, [l(E(D(p)("campus.auth.findPassword")), 1)], 64)) : (y(), o(e, { key: 0 }, [l(E(t), 1)], 64))], 64))), 128))]))), 128))])])
|
|
926
976
|
], 64);
|
|
@@ -928,7 +978,7 @@ var dt = "tabs", ft = I("campus-tabs", () => {
|
|
|
928
978
|
}
|
|
929
979
|
});
|
|
930
980
|
// packages/core/src/pages/auth/wechat-host.ts
|
|
931
|
-
function
|
|
981
|
+
function Ot(e, t) {
|
|
932
982
|
let n, r = !1, i = () => {
|
|
933
983
|
if (!r) {
|
|
934
984
|
r = !0;
|
|
@@ -955,75 +1005,75 @@ function wt(e, t) {
|
|
|
955
1005
|
};
|
|
956
1006
|
}
|
|
957
1007
|
// packages/core/src/pages/auth/WechatPane.vue?vue&type=script&setup=true&lang.ts
|
|
958
|
-
var
|
|
1008
|
+
var kt = {
|
|
959
1009
|
key: 0,
|
|
960
1010
|
class: "ca-auth-wechat"
|
|
961
|
-
},
|
|
1011
|
+
}, At = {
|
|
962
1012
|
key: 0,
|
|
963
1013
|
class: "ca-auth-wechat__failed",
|
|
964
1014
|
role: "alert"
|
|
965
|
-
},
|
|
1015
|
+
}, jt = {
|
|
966
1016
|
key: 1,
|
|
967
1017
|
class: "ca-auth-wechat"
|
|
968
|
-
},
|
|
1018
|
+
}, Mt = { class: "ca-auth-wechat__code" }, Nt = ["src", "alt"], Pt = ["aria-label"], Ft = { class: "ca-auth-wechat__hint" }, It = {
|
|
969
1019
|
key: 0,
|
|
970
1020
|
class: "ca-auth-wechat__note"
|
|
971
|
-
},
|
|
1021
|
+
}, Lt = /* @__PURE__ */ d({
|
|
972
1022
|
__name: "WechatPane",
|
|
973
1023
|
props: { preview: { type: Boolean } },
|
|
974
1024
|
setup(e) {
|
|
975
|
-
let t = e, { t: r } =
|
|
1025
|
+
let t = e, { t: r } = q(), i = n(() => X().panel?.qrcode), d = !t.preview && Ke().wechat, f = x(), p = x(!1), h;
|
|
976
1026
|
function g() {
|
|
977
1027
|
h?.release(), h = void 0;
|
|
978
1028
|
}
|
|
979
1029
|
async function b() {
|
|
980
|
-
g(), p.value = !1, await m(), f.value && (h =
|
|
1030
|
+
g(), p.value = !1, await m(), f.value && (h = Ot(J().auth.wechat.mount, f.value), p.value = !h.ok);
|
|
981
1031
|
}
|
|
982
1032
|
return v(() => {
|
|
983
1033
|
d && b();
|
|
984
1034
|
}), _(g), (e, t) => {
|
|
985
1035
|
let n = w("ca-button");
|
|
986
|
-
return D(d) ? (y(), o("div",
|
|
1036
|
+
return D(d) ? (y(), o("div", kt, [P(s("div", {
|
|
987
1037
|
ref_key: "host",
|
|
988
1038
|
ref: f,
|
|
989
1039
|
class: "ca-auth-wechat__host"
|
|
990
|
-
}, null, 512), [[
|
|
991
|
-
default:
|
|
1040
|
+
}, null, 512), [[A, !p.value]]), p.value ? (y(), o("div", At, [s("p", null, E(D(r)("campus.auth.wechatMountFailed")), 1), u(n, { onClick: b }, {
|
|
1041
|
+
default: N(() => [l(E(D(r)("campus.auth.wechatRetry")), 1)]),
|
|
992
1042
|
_: 1
|
|
993
|
-
})])) : a("v-if", !0)])) : (y(), o("div",
|
|
994
|
-
s("div",
|
|
1043
|
+
})])) : a("v-if", !0)])) : (y(), o("div", jt, [
|
|
1044
|
+
s("div", Mt, [i.value ? (y(), o("img", {
|
|
995
1045
|
key: 0,
|
|
996
1046
|
src: i.value,
|
|
997
1047
|
alt: D(r)("campus.auth.qrcodeAlt")
|
|
998
|
-
}, null, 8,
|
|
1048
|
+
}, null, 8, Nt)) : (y(), o("svg", {
|
|
999
1049
|
key: 1,
|
|
1000
1050
|
viewBox: "0 0 100 100",
|
|
1001
1051
|
role: "img",
|
|
1002
1052
|
"aria-label": D(r)("campus.auth.qrcodeAlt")
|
|
1003
|
-
}, [...t[0] ||= [c("<rect x=\"8\" y=\"8\" width=\"26\" height=\"26\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"5\"></rect><rect x=\"66\" y=\"8\" width=\"26\" height=\"26\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"5\"></rect><rect x=\"8\" y=\"66\" width=\"26\" height=\"26\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"5\"></rect><rect x=\"16\" y=\"16\" width=\"10\" height=\"10\" fill=\"currentColor\"></rect><rect x=\"74\" y=\"16\" width=\"10\" height=\"10\" fill=\"currentColor\"></rect><rect x=\"16\" y=\"74\" width=\"10\" height=\"10\" fill=\"currentColor\"></rect><path d=\"M44 10h8v10h-8zM44 28h16v8H44zM10 44h10v8H10zM28 44h16v10H28zM52 46h10v10H52zM70 44h22v8H70zM44 62h8v14h-8zM58 66h14v8H58zM78 62h14v14H78zM56 82h14v10H56z\" fill=\"currentColor\"></path>", 7)]], 8,
|
|
1004
|
-
s("p",
|
|
1005
|
-
i.value ? a("v-if", !0) : (y(), o("p",
|
|
1053
|
+
}, [...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, Pt))]),
|
|
1054
|
+
s("p", Ft, E(D(r)("campus.auth.wechatHint")), 1),
|
|
1055
|
+
i.value ? a("v-if", !0) : (y(), o("p", It, E(D(r)("campus.auth.wechatNote")), 1))
|
|
1006
1056
|
]));
|
|
1007
1057
|
};
|
|
1008
1058
|
}
|
|
1009
|
-
}),
|
|
1059
|
+
}), Rt = /* @__PURE__ */ d({
|
|
1010
1060
|
__name: "LoginSplit",
|
|
1011
1061
|
props: { preview: { type: Boolean } },
|
|
1012
1062
|
setup(e) {
|
|
1013
|
-
let { t } =
|
|
1063
|
+
let { t } = q(), r = X().tabs?.length ? X().tabs : ["account", "wechat"], a = x(r[0]), o = n(() => r.map((e) => ({
|
|
1014
1064
|
key: e,
|
|
1015
1065
|
label: t(e === "account" ? "campus.auth.tabAccount" : "campus.auth.tabWechat")
|
|
1016
1066
|
})));
|
|
1017
|
-
return (t, n) => (y(), i(
|
|
1067
|
+
return (t, n) => (y(), i(ut, {
|
|
1018
1068
|
active: a.value,
|
|
1019
1069
|
"onUpdate:active": n[0] ||= (e) => a.value = e,
|
|
1020
1070
|
tabs: o.value,
|
|
1021
1071
|
preview: e.preview
|
|
1022
1072
|
}, {
|
|
1023
|
-
default:
|
|
1073
|
+
default: N(() => [a.value === "account" ? (y(), i(Dt, {
|
|
1024
1074
|
key: 0,
|
|
1025
1075
|
preview: e.preview
|
|
1026
|
-
}, null, 8, ["preview"])) : (y(), i(
|
|
1076
|
+
}, null, 8, ["preview"])) : (y(), i(Lt, { key: 1 }))]),
|
|
1027
1077
|
_: 1
|
|
1028
1078
|
}, 8, [
|
|
1029
1079
|
"active",
|
|
@@ -1033,39 +1083,39 @@ var Tt = {
|
|
|
1033
1083
|
}
|
|
1034
1084
|
});
|
|
1035
1085
|
// packages/core/src/security.ts
|
|
1036
|
-
function
|
|
1086
|
+
function zt(e) {
|
|
1037
1087
|
return e.environment ? e.environment : "production";
|
|
1038
1088
|
}
|
|
1039
|
-
function
|
|
1040
|
-
if (
|
|
1089
|
+
function Bt(e) {
|
|
1090
|
+
if (zt(e) === "production" && typeof e.auth.captcha != "function") throw Error("[campus] 生产环境必须在 auth 中提供 captcha()(图形验证码);测试环境可设置 environment: 'test' 跳过");
|
|
1041
1091
|
}
|
|
1042
|
-
function
|
|
1092
|
+
function Vt(e, t) {
|
|
1043
1093
|
return t === "test" || e.length >= 8 && /[A-Za-z]/.test(e) && /\d/.test(e);
|
|
1044
1094
|
}
|
|
1045
1095
|
// packages/core/src/services/feedback.ts
|
|
1046
|
-
var
|
|
1047
|
-
function
|
|
1048
|
-
|
|
1096
|
+
var Ht = (e) => e;
|
|
1097
|
+
function Ut(e) {
|
|
1098
|
+
Ht = e;
|
|
1049
1099
|
}
|
|
1050
|
-
async function
|
|
1051
|
-
await pe.alert(e, t.title ??
|
|
1100
|
+
async function Wt(e, t = {}) {
|
|
1101
|
+
await pe.alert(e, t.title ?? Ht("campus.common.tip"), {
|
|
1052
1102
|
type: t.type ?? "info",
|
|
1053
|
-
confirmButtonText: t.confirmText ??
|
|
1103
|
+
confirmButtonText: t.confirmText ?? Ht("campus.common.ok")
|
|
1054
1104
|
});
|
|
1055
1105
|
}
|
|
1056
|
-
async function
|
|
1106
|
+
async function Gt(e, t = {}) {
|
|
1057
1107
|
try {
|
|
1058
|
-
return await pe.confirm(e, t.title ??
|
|
1108
|
+
return await pe.confirm(e, t.title ?? Ht("campus.common.tip"), {
|
|
1059
1109
|
type: t.type ?? "warning",
|
|
1060
|
-
confirmButtonText: t.confirmText ??
|
|
1061
|
-
cancelButtonText: t.cancelText ??
|
|
1110
|
+
confirmButtonText: t.confirmText ?? Ht("campus.common.confirm"),
|
|
1111
|
+
cancelButtonText: t.cancelText ?? Ht("campus.common.cancel")
|
|
1062
1112
|
}), !0;
|
|
1063
1113
|
} catch (e) {
|
|
1064
1114
|
if (e === "cancel" || e === "close") return !1;
|
|
1065
1115
|
throw e;
|
|
1066
1116
|
}
|
|
1067
1117
|
}
|
|
1068
|
-
var
|
|
1118
|
+
var Kt = {
|
|
1069
1119
|
info: (e) => void fe({
|
|
1070
1120
|
message: e,
|
|
1071
1121
|
type: "info"
|
|
@@ -1082,29 +1132,29 @@ var Ht = {
|
|
|
1082
1132
|
message: e,
|
|
1083
1133
|
type: "error"
|
|
1084
1134
|
})
|
|
1085
|
-
},
|
|
1086
|
-
function
|
|
1135
|
+
}, qt = de.service;
|
|
1136
|
+
function Jt(e, t, n = {}) {
|
|
1087
1137
|
let r = me({
|
|
1088
1138
|
...n,
|
|
1089
|
-
title: n.title ??
|
|
1139
|
+
title: n.title ?? Ht(`campus.notify.${e}`),
|
|
1090
1140
|
message: t,
|
|
1091
1141
|
type: e
|
|
1092
1142
|
});
|
|
1093
1143
|
return m(() => me.updateOffsets(n.position)), r;
|
|
1094
1144
|
}
|
|
1095
1145
|
// packages/core/src/services/ca.ts
|
|
1096
|
-
var
|
|
1097
|
-
alert:
|
|
1098
|
-
confirm:
|
|
1099
|
-
toast:
|
|
1100
|
-
loading:
|
|
1146
|
+
var Yt = {
|
|
1147
|
+
alert: Wt,
|
|
1148
|
+
confirm: Gt,
|
|
1149
|
+
toast: Kt,
|
|
1150
|
+
loading: qt,
|
|
1101
1151
|
notify: {
|
|
1102
|
-
success: (e, t) =>
|
|
1103
|
-
info: (e, t) =>
|
|
1104
|
-
warning: (e, t) =>
|
|
1105
|
-
error: (e, t) =>
|
|
1152
|
+
success: (e, t) => Jt("success", e, t),
|
|
1153
|
+
info: (e, t) => Jt("info", e, t),
|
|
1154
|
+
warning: (e, t) => Jt("warning", e, t),
|
|
1155
|
+
error: (e, t) => Jt("error", e, t)
|
|
1106
1156
|
}
|
|
1107
|
-
},
|
|
1157
|
+
}, Xt = { class: "ca-auth-row" }, Zt = ["disabled"], Qt = 60, $t = /* @__PURE__ */ d({
|
|
1108
1158
|
__name: "SmsField",
|
|
1109
1159
|
props: /*@__PURE__*/ p({ send: { type: Function } }, {
|
|
1110
1160
|
modelValue: { default: "" },
|
|
@@ -1112,7 +1162,7 @@ var Gt = {
|
|
|
1112
1162
|
}),
|
|
1113
1163
|
emits: ["update:modelValue"],
|
|
1114
1164
|
setup(e) {
|
|
1115
|
-
let t = e, n =
|
|
1165
|
+
let t = e, n = k(e, "modelValue"), { t: r } = q(), i = x(0), a = x(!1), c;
|
|
1116
1166
|
function l() {
|
|
1117
1167
|
c && clearInterval(c), c = void 0;
|
|
1118
1168
|
}
|
|
@@ -1126,14 +1176,14 @@ var Gt = {
|
|
|
1126
1176
|
} finally {
|
|
1127
1177
|
a.value = !1;
|
|
1128
1178
|
}
|
|
1129
|
-
i.value =
|
|
1179
|
+
i.value = Qt, l(), c = setInterval(() => {
|
|
1130
1180
|
--i.value, i.value <= 0 && l();
|
|
1131
1181
|
}, 1e3);
|
|
1132
1182
|
}
|
|
1133
1183
|
}
|
|
1134
1184
|
return _(l), (e, t) => {
|
|
1135
1185
|
let c = w("ca-input");
|
|
1136
|
-
return y(), o("div",
|
|
1186
|
+
return y(), o("div", Xt, [u(c, {
|
|
1137
1187
|
modelValue: n.value,
|
|
1138
1188
|
"onUpdate:modelValue": t[0] ||= (e) => n.value = e,
|
|
1139
1189
|
placeholder: D(r)("campus.auth.smsPlaceholder"),
|
|
@@ -1141,7 +1191,7 @@ var Gt = {
|
|
|
1141
1191
|
autocomplete: "one-time-code",
|
|
1142
1192
|
maxlength: "8"
|
|
1143
1193
|
}, {
|
|
1144
|
-
prefix:
|
|
1194
|
+
prefix: N(() => [u($, { name: "message" })]),
|
|
1145
1195
|
_: 1
|
|
1146
1196
|
}, 8, [
|
|
1147
1197
|
"modelValue",
|
|
@@ -1152,30 +1202,30 @@ var Gt = {
|
|
|
1152
1202
|
class: "ca-auth-sms",
|
|
1153
1203
|
disabled: i.value > 0 || a.value,
|
|
1154
1204
|
onClick: d
|
|
1155
|
-
}, E(i.value > 0 ? D(r)("campus.auth.resend", { n: i.value }) : D(r)("campus.auth.getCode")), 9,
|
|
1205
|
+
}, E(i.value > 0 ? D(r)("campus.auth.resend", { n: i.value }) : D(r)("campus.auth.getCode")), 9, Zt)]);
|
|
1156
1206
|
};
|
|
1157
1207
|
}
|
|
1158
|
-
}),
|
|
1208
|
+
}), en = {
|
|
1159
1209
|
key: 0,
|
|
1160
1210
|
class: "ca-auth-hint"
|
|
1161
|
-
},
|
|
1211
|
+
}, tn = { class: "ca-auth-agreements" }, nn = ["href"], rn = /* @__PURE__ */ d({
|
|
1162
1212
|
__name: "RegisterForm",
|
|
1163
1213
|
props: { preview: { type: Boolean } },
|
|
1164
1214
|
setup(t) {
|
|
1165
|
-
let r = t, c =
|
|
1215
|
+
let r = t, c = G(), { t: d, label: f } = q(), p = Ke(), m = zt(J()), g = X(), _ = g.agreements ?? [], v = b({
|
|
1166
1216
|
phone: "",
|
|
1167
1217
|
captcha: "",
|
|
1168
1218
|
code: "",
|
|
1169
1219
|
password: "",
|
|
1170
1220
|
confirm: "",
|
|
1171
1221
|
agree: !1
|
|
1172
|
-
}), C = x(""), T = x(), O = x(), k = x(!1), A = x(""), j = x("error"),
|
|
1222
|
+
}), C = x(""), T = x(), O = x(), k = x(!1), A = x(""), j = x("error"), M = n(() => ({
|
|
1173
1223
|
phone: [{
|
|
1174
1224
|
required: !0,
|
|
1175
1225
|
message: d("campus.auth.phonePlaceholder"),
|
|
1176
1226
|
trigger: "blur"
|
|
1177
1227
|
}, {
|
|
1178
|
-
pattern:
|
|
1228
|
+
pattern: Ge,
|
|
1179
1229
|
message: d("campus.auth.phoneInvalid"),
|
|
1180
1230
|
trigger: "blur"
|
|
1181
1231
|
}],
|
|
@@ -1194,7 +1244,7 @@ var Gt = {
|
|
|
1194
1244
|
message: d("campus.auth.registerPasswordPlaceholder"),
|
|
1195
1245
|
trigger: "blur"
|
|
1196
1246
|
}, {
|
|
1197
|
-
validator: (e, t, n) => n(
|
|
1247
|
+
validator: (e, t, n) => n(Vt(t, m) ? void 0 : Error(d("campus.auth.passwordPolicy"))),
|
|
1198
1248
|
trigger: "blur"
|
|
1199
1249
|
}],
|
|
1200
1250
|
confirm: [{
|
|
@@ -1209,7 +1259,7 @@ var Gt = {
|
|
|
1209
1259
|
validator: (e, t, n) => n(t ? void 0 : Error(d("campus.auth.agreeRequired"))),
|
|
1210
1260
|
trigger: "change"
|
|
1211
1261
|
}] : []
|
|
1212
|
-
})),
|
|
1262
|
+
})), P = n(() => !!(v.phone && v.code && v.password && v.confirm) && (!p.captcha || !!v.captcha) && (!_.length || v.agree));
|
|
1213
1263
|
function I(e, t) {
|
|
1214
1264
|
j.value = "error", A.value = e instanceof Error && e.message ? e.message : t;
|
|
1215
1265
|
}
|
|
@@ -1222,20 +1272,20 @@ var Gt = {
|
|
|
1222
1272
|
}
|
|
1223
1273
|
if (A.value = "", r.preview) j.value = "info", A.value = d("campus.auth.previewNote");
|
|
1224
1274
|
else try {
|
|
1225
|
-
await
|
|
1275
|
+
await J().auth.sendSmsCode({
|
|
1226
1276
|
phone: v.phone,
|
|
1227
1277
|
scene: "register",
|
|
1228
1278
|
captcha: p.captcha ? {
|
|
1229
1279
|
key: C.value,
|
|
1230
1280
|
code: v.captcha
|
|
1231
1281
|
} : void 0
|
|
1232
|
-
}),
|
|
1282
|
+
}), Yt.toast.success(d("campus.auth.smsSent"));
|
|
1233
1283
|
} catch (e) {
|
|
1234
1284
|
throw I(e, d("campus.login.failed")), T.value?.refresh(), e;
|
|
1235
1285
|
}
|
|
1236
1286
|
}
|
|
1237
1287
|
async function R() {
|
|
1238
|
-
if (
|
|
1288
|
+
if (P.value) {
|
|
1239
1289
|
try {
|
|
1240
1290
|
await O.value?.validate();
|
|
1241
1291
|
} catch {
|
|
@@ -1245,7 +1295,7 @@ var Gt = {
|
|
|
1245
1295
|
else {
|
|
1246
1296
|
k.value = !0, A.value = "";
|
|
1247
1297
|
try {
|
|
1248
|
-
await
|
|
1298
|
+
await J().auth.register({
|
|
1249
1299
|
phone: v.phone,
|
|
1250
1300
|
code: v.code,
|
|
1251
1301
|
password: v.password,
|
|
@@ -1253,7 +1303,7 @@ var Gt = {
|
|
|
1253
1303
|
key: C.value,
|
|
1254
1304
|
code: v.captcha
|
|
1255
1305
|
} : void 0
|
|
1256
|
-
}),
|
|
1306
|
+
}), Yt.toast.success(d("campus.auth.registerOk")), await c.replace({ name: Y(J()).login });
|
|
1257
1307
|
} catch (e) {
|
|
1258
1308
|
I(e, d("campus.login.failed")), T.value?.refresh();
|
|
1259
1309
|
} finally {
|
|
@@ -1275,14 +1325,14 @@ var Gt = {
|
|
|
1275
1325
|
ref_key: "formRef",
|
|
1276
1326
|
ref: O,
|
|
1277
1327
|
model: v,
|
|
1278
|
-
rules:
|
|
1328
|
+
rules: M.value,
|
|
1279
1329
|
size: "large",
|
|
1280
1330
|
class: "ca-auth-form",
|
|
1281
|
-
onSubmit:
|
|
1331
|
+
onSubmit: F(R, ["prevent"])
|
|
1282
1332
|
}, {
|
|
1283
|
-
default:
|
|
1333
|
+
default: N(() => [
|
|
1284
1334
|
u(m, { prop: "phone" }, {
|
|
1285
|
-
default:
|
|
1335
|
+
default: N(() => [u(c, {
|
|
1286
1336
|
modelValue: v.phone,
|
|
1287
1337
|
"onUpdate:modelValue": n[0] ||= (e) => v.phone = e,
|
|
1288
1338
|
placeholder: D(d)("campus.auth.phonePlaceholder"),
|
|
@@ -1290,7 +1340,7 @@ var Gt = {
|
|
|
1290
1340
|
autocomplete: "tel",
|
|
1291
1341
|
maxlength: "11"
|
|
1292
1342
|
}, {
|
|
1293
|
-
prefix:
|
|
1343
|
+
prefix: N(() => [u($, { name: "phone" })]),
|
|
1294
1344
|
_: 1
|
|
1295
1345
|
}, 8, [
|
|
1296
1346
|
"modelValue",
|
|
@@ -1303,7 +1353,7 @@ var Gt = {
|
|
|
1303
1353
|
key: 0,
|
|
1304
1354
|
prop: "captcha"
|
|
1305
1355
|
}, {
|
|
1306
|
-
default:
|
|
1356
|
+
default: N(() => [u(wt, {
|
|
1307
1357
|
ref_key: "captchaRef",
|
|
1308
1358
|
ref: T,
|
|
1309
1359
|
code: v.captcha,
|
|
@@ -1315,15 +1365,15 @@ var Gt = {
|
|
|
1315
1365
|
_: 1
|
|
1316
1366
|
})) : a("v-if", !0),
|
|
1317
1367
|
u(m, { prop: "code" }, {
|
|
1318
|
-
default:
|
|
1368
|
+
default: N(() => [u($t, {
|
|
1319
1369
|
modelValue: v.code,
|
|
1320
1370
|
"onUpdate:modelValue": n[3] ||= (e) => v.code = e,
|
|
1321
1371
|
send: L
|
|
1322
|
-
}, null, 8, ["modelValue"]), D(g).smsHint ? (y(), o("p",
|
|
1372
|
+
}, null, 8, ["modelValue"]), D(g).smsHint ? (y(), o("p", en, E(D(f)(D(g).smsHint)), 1)) : a("v-if", !0)]),
|
|
1323
1373
|
_: 1
|
|
1324
1374
|
}),
|
|
1325
1375
|
u(m, { prop: "password" }, {
|
|
1326
|
-
default:
|
|
1376
|
+
default: N(() => [u(c, {
|
|
1327
1377
|
modelValue: v.password,
|
|
1328
1378
|
"onUpdate:modelValue": n[4] ||= (e) => v.password = e,
|
|
1329
1379
|
type: "password",
|
|
@@ -1332,7 +1382,7 @@ var Gt = {
|
|
|
1332
1382
|
"aria-label": D(d)("campus.auth.registerPassword"),
|
|
1333
1383
|
autocomplete: "new-password"
|
|
1334
1384
|
}, {
|
|
1335
|
-
prefix:
|
|
1385
|
+
prefix: N(() => [u($, { name: "lock" })]),
|
|
1336
1386
|
_: 1
|
|
1337
1387
|
}, 8, [
|
|
1338
1388
|
"modelValue",
|
|
@@ -1342,7 +1392,7 @@ var Gt = {
|
|
|
1342
1392
|
_: 1
|
|
1343
1393
|
}),
|
|
1344
1394
|
u(m, { prop: "confirm" }, {
|
|
1345
|
-
default:
|
|
1395
|
+
default: N(() => [u(c, {
|
|
1346
1396
|
modelValue: v.confirm,
|
|
1347
1397
|
"onUpdate:modelValue": n[5] ||= (e) => v.confirm = e,
|
|
1348
1398
|
type: "password",
|
|
@@ -1351,7 +1401,7 @@ var Gt = {
|
|
|
1351
1401
|
"aria-label": D(d)("campus.auth.confirmPlaceholder"),
|
|
1352
1402
|
autocomplete: "new-password"
|
|
1353
1403
|
}, {
|
|
1354
|
-
prefix:
|
|
1404
|
+
prefix: N(() => [u($, { name: "lock" })]),
|
|
1355
1405
|
_: 1
|
|
1356
1406
|
}, 8, [
|
|
1357
1407
|
"modelValue",
|
|
@@ -1364,18 +1414,18 @@ var Gt = {
|
|
|
1364
1414
|
key: 1,
|
|
1365
1415
|
prop: "agree"
|
|
1366
1416
|
}, {
|
|
1367
|
-
default:
|
|
1417
|
+
default: N(() => [u(b, {
|
|
1368
1418
|
modelValue: v.agree,
|
|
1369
1419
|
"onUpdate:modelValue": n[6] ||= (e) => v.agree = e
|
|
1370
1420
|
}, {
|
|
1371
|
-
default:
|
|
1421
|
+
default: N(() => [l(E(D(d)("campus.auth.agreePrefix")), 1)]),
|
|
1372
1422
|
_: 1
|
|
1373
|
-
}, 8, ["modelValue"]), s("span",
|
|
1423
|
+
}, 8, ["modelValue"]), s("span", tn, [(y(!0), o(e, null, S(D(_), (e) => (y(), o("a", {
|
|
1374
1424
|
key: e.href,
|
|
1375
1425
|
href: e.href,
|
|
1376
1426
|
target: "_blank",
|
|
1377
1427
|
rel: "noopener noreferrer"
|
|
1378
|
-
}, E(D(f)(e.text)), 9,
|
|
1428
|
+
}, E(D(f)(e.text)), 9, nn))), 128))])]),
|
|
1379
1429
|
_: 1
|
|
1380
1430
|
})) : a("v-if", !0),
|
|
1381
1431
|
u(x, {
|
|
@@ -1383,10 +1433,10 @@ var Gt = {
|
|
|
1383
1433
|
"native-type": "submit",
|
|
1384
1434
|
size: "large",
|
|
1385
1435
|
loading: k.value,
|
|
1386
|
-
disabled: !
|
|
1387
|
-
class: h(["ca-auth-submit", { "ca-auth-submit--off": !
|
|
1436
|
+
disabled: !P.value,
|
|
1437
|
+
class: h(["ca-auth-submit", { "ca-auth-submit--off": !P.value }])
|
|
1388
1438
|
}, {
|
|
1389
|
-
default:
|
|
1439
|
+
default: N(() => [l(E(D(d)("campus.common.ok")), 1)]),
|
|
1390
1440
|
_: 1
|
|
1391
1441
|
}, 8, [
|
|
1392
1442
|
"loading",
|
|
@@ -1398,42 +1448,42 @@ var Gt = {
|
|
|
1398
1448
|
}, 8, ["model", "rules"])], 64);
|
|
1399
1449
|
};
|
|
1400
1450
|
}
|
|
1401
|
-
}),
|
|
1451
|
+
}), an = {
|
|
1402
1452
|
key: 1,
|
|
1403
1453
|
class: "ca-auth-off",
|
|
1404
1454
|
role: "status"
|
|
1405
|
-
},
|
|
1455
|
+
}, on = /* @__PURE__ */ d({
|
|
1406
1456
|
__name: "RegisterPage",
|
|
1407
1457
|
props: { preview: { type: Boolean } },
|
|
1408
1458
|
setup(e) {
|
|
1409
|
-
let { t } =
|
|
1459
|
+
let { t } = q(), r = Ke().register, a = n(() => [{
|
|
1410
1460
|
key: "register",
|
|
1411
1461
|
label: t("campus.auth.tabRegister")
|
|
1412
1462
|
}, {
|
|
1413
1463
|
key: "login",
|
|
1414
1464
|
label: t("campus.auth.backLogin"),
|
|
1415
|
-
to:
|
|
1465
|
+
to: Fe(J()).login
|
|
1416
1466
|
}]);
|
|
1417
|
-
return (n, c) => (y(), i(
|
|
1467
|
+
return (n, c) => (y(), i(ut, {
|
|
1418
1468
|
active: "register",
|
|
1419
1469
|
tabs: a.value,
|
|
1420
1470
|
preview: e.preview
|
|
1421
1471
|
}, {
|
|
1422
|
-
default:
|
|
1472
|
+
default: N(() => [D(r) ? (y(), i(rn, {
|
|
1423
1473
|
key: 0,
|
|
1424
1474
|
preview: e.preview
|
|
1425
|
-
}, null, 8, ["preview"])) : (y(), o("div",
|
|
1475
|
+
}, null, 8, ["preview"])) : (y(), o("div", an, [s("h3", null, E(D(t)("campus.auth.unavailableTitle")), 1), s("p", null, E(D(t)("campus.auth.unavailableDesc")), 1)]))]),
|
|
1426
1476
|
_: 1
|
|
1427
1477
|
}, 8, ["tabs", "preview"]));
|
|
1428
1478
|
}
|
|
1429
|
-
}),
|
|
1479
|
+
}), sn = {
|
|
1430
1480
|
key: 0,
|
|
1431
1481
|
class: "ca-auth-hint"
|
|
1432
|
-
},
|
|
1482
|
+
}, cn = /* @__PURE__ */ d({
|
|
1433
1483
|
__name: "ForgotForm",
|
|
1434
1484
|
props: { preview: { type: Boolean } },
|
|
1435
1485
|
setup(t) {
|
|
1436
|
-
let r = t, s =
|
|
1486
|
+
let r = t, s = G(), { t: c, label: d } = q(), f = Ke(), p = zt(J()), m = X(), g = b({
|
|
1437
1487
|
account: "",
|
|
1438
1488
|
captcha: "",
|
|
1439
1489
|
code: "",
|
|
@@ -1460,7 +1510,7 @@ var Gt = {
|
|
|
1460
1510
|
message: c("campus.auth.newPasswordPlaceholder"),
|
|
1461
1511
|
trigger: "blur"
|
|
1462
1512
|
}, {
|
|
1463
|
-
validator: (e, t, n) => n(
|
|
1513
|
+
validator: (e, t, n) => n(Vt(t, p) ? void 0 : Error(c("campus.auth.passwordPolicy"))),
|
|
1464
1514
|
trigger: "blur"
|
|
1465
1515
|
}],
|
|
1466
1516
|
confirm: [{
|
|
@@ -1475,7 +1525,7 @@ var Gt = {
|
|
|
1475
1525
|
function j(e, t) {
|
|
1476
1526
|
O.value = "error", T.value = e instanceof Error && e.message ? e.message : t;
|
|
1477
1527
|
}
|
|
1478
|
-
async function
|
|
1528
|
+
async function M() {
|
|
1479
1529
|
let e = f.captcha ? ["account", "captcha"] : ["account"];
|
|
1480
1530
|
try {
|
|
1481
1531
|
await S.value?.validateField(e);
|
|
@@ -1484,19 +1534,19 @@ var Gt = {
|
|
|
1484
1534
|
}
|
|
1485
1535
|
if (T.value = "", r.preview) O.value = "info", T.value = c("campus.auth.previewNote");
|
|
1486
1536
|
else try {
|
|
1487
|
-
await
|
|
1488
|
-
...
|
|
1537
|
+
await J().auth.sendSmsCode({
|
|
1538
|
+
...Ge.test(g.account) ? { phone: g.account } : { username: g.account },
|
|
1489
1539
|
scene: "forgot",
|
|
1490
1540
|
captcha: f.captcha ? {
|
|
1491
1541
|
key: _.value,
|
|
1492
1542
|
code: g.captcha
|
|
1493
1543
|
} : void 0
|
|
1494
|
-
}),
|
|
1544
|
+
}), Yt.toast.success(c("campus.auth.smsSent"));
|
|
1495
1545
|
} catch (e) {
|
|
1496
1546
|
throw j(e, c("campus.login.failed")), v.value?.refresh(), e;
|
|
1497
1547
|
}
|
|
1498
1548
|
}
|
|
1499
|
-
async function
|
|
1549
|
+
async function P() {
|
|
1500
1550
|
if (A.value) {
|
|
1501
1551
|
try {
|
|
1502
1552
|
await S.value?.validate();
|
|
@@ -1507,7 +1557,7 @@ var Gt = {
|
|
|
1507
1557
|
else {
|
|
1508
1558
|
C.value = !0, T.value = "";
|
|
1509
1559
|
try {
|
|
1510
|
-
await
|
|
1560
|
+
await J().auth.resetPassword({
|
|
1511
1561
|
account: g.account,
|
|
1512
1562
|
code: g.code,
|
|
1513
1563
|
password: g.password,
|
|
@@ -1515,7 +1565,7 @@ var Gt = {
|
|
|
1515
1565
|
key: _.value,
|
|
1516
1566
|
code: g.captcha
|
|
1517
1567
|
} : void 0
|
|
1518
|
-
}),
|
|
1568
|
+
}), Yt.toast.success(c("campus.auth.resetOk")), await s.replace({ name: Y(J()).login });
|
|
1519
1569
|
} catch (e) {
|
|
1520
1570
|
j(e, c("campus.login.failed")), v.value?.refresh();
|
|
1521
1571
|
} finally {
|
|
@@ -1540,18 +1590,18 @@ var Gt = {
|
|
|
1540
1590
|
rules: k.value,
|
|
1541
1591
|
size: "large",
|
|
1542
1592
|
class: "ca-auth-form",
|
|
1543
|
-
onSubmit: P
|
|
1593
|
+
onSubmit: F(P, ["prevent"])
|
|
1544
1594
|
}, {
|
|
1545
|
-
default:
|
|
1595
|
+
default: N(() => [
|
|
1546
1596
|
u(p, { prop: "account" }, {
|
|
1547
|
-
default:
|
|
1597
|
+
default: N(() => [u(s, {
|
|
1548
1598
|
modelValue: g.account,
|
|
1549
1599
|
"onUpdate:modelValue": n[0] ||= (e) => g.account = e,
|
|
1550
1600
|
placeholder: D(c)("campus.auth.accountPlaceholder"),
|
|
1551
1601
|
"aria-label": D(c)("campus.auth.account"),
|
|
1552
1602
|
autocomplete: "username"
|
|
1553
1603
|
}, {
|
|
1554
|
-
prefix:
|
|
1604
|
+
prefix: N(() => [u($, { name: "user" })]),
|
|
1555
1605
|
_: 1
|
|
1556
1606
|
}, 8, [
|
|
1557
1607
|
"modelValue",
|
|
@@ -1564,7 +1614,7 @@ var Gt = {
|
|
|
1564
1614
|
key: 0,
|
|
1565
1615
|
prop: "captcha"
|
|
1566
1616
|
}, {
|
|
1567
|
-
default:
|
|
1617
|
+
default: N(() => [u(wt, {
|
|
1568
1618
|
ref_key: "captchaRef",
|
|
1569
1619
|
ref: v,
|
|
1570
1620
|
code: g.captcha,
|
|
@@ -1576,15 +1626,15 @@ var Gt = {
|
|
|
1576
1626
|
_: 1
|
|
1577
1627
|
})) : a("v-if", !0),
|
|
1578
1628
|
u(p, { prop: "code" }, {
|
|
1579
|
-
default:
|
|
1629
|
+
default: N(() => [u($t, {
|
|
1580
1630
|
modelValue: g.code,
|
|
1581
1631
|
"onUpdate:modelValue": n[3] ||= (e) => g.code = e,
|
|
1582
|
-
send:
|
|
1583
|
-
}, null, 8, ["modelValue"]), D(m).smsHint ? (y(), o("p",
|
|
1632
|
+
send: M
|
|
1633
|
+
}, null, 8, ["modelValue"]), D(m).smsHint ? (y(), o("p", sn, E(D(d)(D(m).smsHint)), 1)) : a("v-if", !0)]),
|
|
1584
1634
|
_: 1
|
|
1585
1635
|
}),
|
|
1586
1636
|
u(p, { prop: "password" }, {
|
|
1587
|
-
default:
|
|
1637
|
+
default: N(() => [u(s, {
|
|
1588
1638
|
modelValue: g.password,
|
|
1589
1639
|
"onUpdate:modelValue": n[4] ||= (e) => g.password = e,
|
|
1590
1640
|
type: "password",
|
|
@@ -1593,7 +1643,7 @@ var Gt = {
|
|
|
1593
1643
|
"aria-label": D(c)("campus.auth.newPasswordPlaceholder"),
|
|
1594
1644
|
autocomplete: "new-password"
|
|
1595
1645
|
}, {
|
|
1596
|
-
prefix:
|
|
1646
|
+
prefix: N(() => [u($, { name: "lock" })]),
|
|
1597
1647
|
_: 1
|
|
1598
1648
|
}, 8, [
|
|
1599
1649
|
"modelValue",
|
|
@@ -1603,7 +1653,7 @@ var Gt = {
|
|
|
1603
1653
|
_: 1
|
|
1604
1654
|
}),
|
|
1605
1655
|
u(p, { prop: "confirm" }, {
|
|
1606
|
-
default:
|
|
1656
|
+
default: N(() => [u(s, {
|
|
1607
1657
|
modelValue: g.confirm,
|
|
1608
1658
|
"onUpdate:modelValue": n[5] ||= (e) => g.confirm = e,
|
|
1609
1659
|
type: "password",
|
|
@@ -1612,7 +1662,7 @@ var Gt = {
|
|
|
1612
1662
|
"aria-label": D(c)("campus.auth.confirmPlaceholder"),
|
|
1613
1663
|
autocomplete: "new-password"
|
|
1614
1664
|
}, {
|
|
1615
|
-
prefix:
|
|
1665
|
+
prefix: N(() => [u($, { name: "lock" })]),
|
|
1616
1666
|
_: 1
|
|
1617
1667
|
}, 8, [
|
|
1618
1668
|
"modelValue",
|
|
@@ -1629,7 +1679,7 @@ var Gt = {
|
|
|
1629
1679
|
disabled: !A.value,
|
|
1630
1680
|
class: h(["ca-auth-submit", { "ca-auth-submit--off": !A.value }])
|
|
1631
1681
|
}, {
|
|
1632
|
-
default:
|
|
1682
|
+
default: N(() => [l(E(D(c)("campus.common.ok")), 1)]),
|
|
1633
1683
|
_: 1
|
|
1634
1684
|
}, 8, [
|
|
1635
1685
|
"loading",
|
|
@@ -1641,50 +1691,50 @@ var Gt = {
|
|
|
1641
1691
|
}, 8, ["model", "rules"])], 64);
|
|
1642
1692
|
};
|
|
1643
1693
|
}
|
|
1644
|
-
}),
|
|
1694
|
+
}), ln = {
|
|
1645
1695
|
key: 1,
|
|
1646
1696
|
class: "ca-auth-off",
|
|
1647
1697
|
role: "status"
|
|
1648
|
-
},
|
|
1698
|
+
}, un = /* @__PURE__ */ d({
|
|
1649
1699
|
__name: "ForgotPage",
|
|
1650
1700
|
props: { preview: { type: Boolean } },
|
|
1651
1701
|
setup(e) {
|
|
1652
|
-
let { t } =
|
|
1702
|
+
let { t } = q(), r = Ke().forgot, a = n(() => [{
|
|
1653
1703
|
key: "forgot",
|
|
1654
1704
|
label: t("campus.auth.tabForgot")
|
|
1655
1705
|
}, {
|
|
1656
1706
|
key: "login",
|
|
1657
1707
|
label: t("campus.auth.backLogin"),
|
|
1658
|
-
to:
|
|
1708
|
+
to: Fe(J()).login
|
|
1659
1709
|
}]);
|
|
1660
|
-
return (n, c) => (y(), i(
|
|
1710
|
+
return (n, c) => (y(), i(ut, {
|
|
1661
1711
|
active: "forgot",
|
|
1662
1712
|
tabs: a.value,
|
|
1663
1713
|
preview: e.preview
|
|
1664
1714
|
}, {
|
|
1665
|
-
default:
|
|
1715
|
+
default: N(() => [D(r) ? (y(), i(cn, {
|
|
1666
1716
|
key: 0,
|
|
1667
1717
|
preview: e.preview
|
|
1668
|
-
}, null, 8, ["preview"])) : (y(), o("div",
|
|
1718
|
+
}, null, 8, ["preview"])) : (y(), o("div", ln, [s("h3", null, E(D(t)("campus.auth.unavailableTitle")), 1), s("p", null, E(D(t)("campus.auth.unavailableDesc")), 1)]))]),
|
|
1669
1719
|
_: 1
|
|
1670
1720
|
}, 8, ["tabs", "preview"]));
|
|
1671
1721
|
}
|
|
1672
|
-
}),
|
|
1722
|
+
}), dn = /* @__PURE__ */ d({
|
|
1673
1723
|
__name: "AuthPreview",
|
|
1674
1724
|
props: { kind: {} },
|
|
1675
1725
|
setup(e) {
|
|
1676
|
-
return (t, n) => e.kind === "login" ? (y(), i(
|
|
1726
|
+
return (t, n) => e.kind === "login" ? (y(), i(Rt, {
|
|
1677
1727
|
key: 0,
|
|
1678
1728
|
preview: ""
|
|
1679
|
-
})) : e.kind === "register" ? (y(), i(
|
|
1729
|
+
})) : e.kind === "register" ? (y(), i(on, {
|
|
1680
1730
|
key: 1,
|
|
1681
1731
|
preview: ""
|
|
1682
|
-
})) : (y(), i(
|
|
1732
|
+
})) : (y(), i(un, {
|
|
1683
1733
|
key: 2,
|
|
1684
1734
|
preview: ""
|
|
1685
1735
|
}));
|
|
1686
1736
|
}
|
|
1687
|
-
}),
|
|
1737
|
+
}), fn = { class: "ca-user-avatar" }, pn = ["src"], mn = /*#__PURE__*/ Z(/* @__PURE__ */ d({
|
|
1688
1738
|
__name: "UserAvatar",
|
|
1689
1739
|
props: {
|
|
1690
1740
|
name: {},
|
|
@@ -1692,48 +1742,248 @@ var Gt = {
|
|
|
1692
1742
|
},
|
|
1693
1743
|
setup(t) {
|
|
1694
1744
|
let n = t, r = x(!1);
|
|
1695
|
-
return
|
|
1745
|
+
return j(() => n.src, () => {
|
|
1696
1746
|
r.value = !1;
|
|
1697
|
-
}), (n, i) => (y(), o("span",
|
|
1747
|
+
}), (n, i) => (y(), o("span", fn, [t.src && !r.value ? (y(), o("img", {
|
|
1698
1748
|
key: 0,
|
|
1699
1749
|
src: t.src,
|
|
1700
1750
|
alt: "",
|
|
1701
1751
|
draggable: "false",
|
|
1702
1752
|
onError: i[0] ||= (e) => r.value = !0
|
|
1703
|
-
}, null, 40,
|
|
1753
|
+
}, null, 40, pn)) : (y(), o(e, { key: 1 }, [l(E(t.name?.slice(0, 1)), 1)], 64))]));
|
|
1704
1754
|
}
|
|
1705
|
-
}), [["__scopeId", "data-v-b67c1b85"]]),
|
|
1755
|
+
}), [["__scopeId", "data-v-b67c1b85"]]), hn = (e) => e.normalize("NFKC").toLowerCase().trim();
|
|
1756
|
+
function gn(e) {
|
|
1757
|
+
return e.filter((e) => /\p{Script=Han}/u.test(e)).flatMap((e) => {
|
|
1758
|
+
let t = {
|
|
1759
|
+
toneType: "none",
|
|
1760
|
+
type: "array",
|
|
1761
|
+
nonZh: "consecutive",
|
|
1762
|
+
v: !0
|
|
1763
|
+
};
|
|
1764
|
+
return [he(e, t), he(e, {
|
|
1765
|
+
...t,
|
|
1766
|
+
pattern: "first"
|
|
1767
|
+
})].map((e) => e.join("").replace(/[^a-z0-9]/g, ""));
|
|
1768
|
+
}).filter(Boolean);
|
|
1769
|
+
}
|
|
1770
|
+
function _n(e, t, n) {
|
|
1771
|
+
return Pe(J().menus).filter((t) => e(t.permission)).map((e) => {
|
|
1772
|
+
let r = Me(e.key)?.titles.slice(0, -1) ?? [], i = t(e.title), a = r.map(t).join(" / "), o = [i, n(e.title)].map(hn);
|
|
1773
|
+
return {
|
|
1774
|
+
key: e.key,
|
|
1775
|
+
path: e.path,
|
|
1776
|
+
title: i,
|
|
1777
|
+
trail: a,
|
|
1778
|
+
icon: e.icon,
|
|
1779
|
+
titles: o,
|
|
1780
|
+
pinyinTitles: gn(o),
|
|
1781
|
+
terms: hn([
|
|
1782
|
+
a,
|
|
1783
|
+
...r.map(n),
|
|
1784
|
+
...o,
|
|
1785
|
+
e.path
|
|
1786
|
+
].join(" "))
|
|
1787
|
+
};
|
|
1788
|
+
});
|
|
1789
|
+
}
|
|
1790
|
+
function vn(e, t) {
|
|
1791
|
+
let n = hn(t);
|
|
1792
|
+
if (!n) return e;
|
|
1793
|
+
let r = n.split(/\s+/), i = /^[a-z0-9\s]+$/.test(n) ? r.join("") : "";
|
|
1794
|
+
return e.flatMap((e) => {
|
|
1795
|
+
let t = r.every((t) => e.terms.includes(t)), a = i && e.pinyinTitles.some((e) => e.includes(i));
|
|
1796
|
+
return !t && !a ? [] : [{
|
|
1797
|
+
entry: e,
|
|
1798
|
+
score: e.titles.includes(n) || hn(e.path) === n ? 0 : e.titles.some((e) => e.startsWith(n)) ? 1 : e.titles.some((e) => e.includes(n)) ? 2 : e.pinyinTitles.includes(i) ? 3 : t ? 4 : 5
|
|
1799
|
+
}];
|
|
1800
|
+
}).sort((e, t) => e.score - t.score).map(({ entry: e }) => e);
|
|
1801
|
+
}
|
|
1802
|
+
// packages/core/src/layout/MenuSearch.vue?vue&type=script&setup=true&lang.ts
|
|
1803
|
+
var yn = ["aria-label"], bn = [
|
|
1804
|
+
"id",
|
|
1805
|
+
"aria-selected",
|
|
1806
|
+
"onMousemove",
|
|
1807
|
+
"onClick"
|
|
1808
|
+
], xn = { class: "ca-menu-search__label" }, Sn = { key: 0 }, Cn = {
|
|
1809
|
+
key: 0,
|
|
1810
|
+
class: "ca-menu-search__empty",
|
|
1811
|
+
role: "status"
|
|
1812
|
+
}, wn = { class: "ca-menu-search__keys" }, Tn = /*#__PURE__*/ Z(/* @__PURE__ */ d({
|
|
1813
|
+
__name: "MenuSearch",
|
|
1814
|
+
props: {
|
|
1815
|
+
modelValue: {
|
|
1816
|
+
type: Boolean,
|
|
1817
|
+
required: !0
|
|
1818
|
+
},
|
|
1819
|
+
modelModifiers: {}
|
|
1820
|
+
},
|
|
1821
|
+
emits: ["update:modelValue"],
|
|
1822
|
+
setup(t) {
|
|
1823
|
+
let r = k(t, "modelValue"), { t: c, te: d, label: f, locale: p } = q(), h = Q(), g = G(), _ = x(""), v = x(0), b = O(), C = `${b}-input`, T = `${b}-results`, M = (e) => `${T}-${e}`, I = n(() => {
|
|
1824
|
+
let e = p.value === "zh-CN" ? "en-US" : "zh-CN";
|
|
1825
|
+
return _n((e) => h.can(e), f, (t) => d(t, e) ? c(t, {}, { locale: e }) : t);
|
|
1826
|
+
}), L = n(() => vn(I.value, _.value));
|
|
1827
|
+
j(r, (e) => {
|
|
1828
|
+
e && (_.value = "", v.value = 0);
|
|
1829
|
+
}), j(L, () => {
|
|
1830
|
+
v.value = 0;
|
|
1831
|
+
});
|
|
1832
|
+
async function R() {
|
|
1833
|
+
await m(), await m(), r.value && document.getElementById(C)?.focus();
|
|
1834
|
+
}
|
|
1835
|
+
function z(e) {
|
|
1836
|
+
r.value = !1, g.push({ name: e.key });
|
|
1837
|
+
}
|
|
1838
|
+
async function ee(e) {
|
|
1839
|
+
if (e.isComposing || e.keyCode === 229 || !L.value.length) return;
|
|
1840
|
+
if (e.key === "Enter") {
|
|
1841
|
+
e.preventDefault(), z(L.value[v.value]);
|
|
1842
|
+
return;
|
|
1843
|
+
}
|
|
1844
|
+
if (e.key !== "ArrowDown" && e.key !== "ArrowUp") return;
|
|
1845
|
+
e.preventDefault();
|
|
1846
|
+
let t = e.key === "ArrowDown" ? 1 : -1;
|
|
1847
|
+
v.value = (v.value + t + L.value.length) % L.value.length, await m(), document.getElementById(M(v.value))?.scrollIntoView({ block: "nearest" });
|
|
1848
|
+
}
|
|
1849
|
+
return (t, n) => {
|
|
1850
|
+
let d = w("ca-icon"), f = w("ca-input"), p = w("ca-dialog");
|
|
1851
|
+
return y(), i(p, {
|
|
1852
|
+
modelValue: r.value,
|
|
1853
|
+
"onUpdate:modelValue": n[2] ||= (e) => r.value = e,
|
|
1854
|
+
title: D(c)("campus.menuSearch.title"),
|
|
1855
|
+
width: "min(560px, calc(100vw - 24px))",
|
|
1856
|
+
top: "min(12vh, 96px)",
|
|
1857
|
+
"append-to-body": "",
|
|
1858
|
+
"destroy-on-close": "",
|
|
1859
|
+
"close-on-press-escape": !1,
|
|
1860
|
+
"header-class": "ca-menu-search__header",
|
|
1861
|
+
"body-class": "ca-menu-search__body",
|
|
1862
|
+
class: "ca-menu-search",
|
|
1863
|
+
onOpenAutoFocus: R
|
|
1864
|
+
}, {
|
|
1865
|
+
default: N(() => [
|
|
1866
|
+
s("div", {
|
|
1867
|
+
class: "ca-menu-search__input",
|
|
1868
|
+
onKeydown: ee
|
|
1869
|
+
}, [u(f, {
|
|
1870
|
+
id: C,
|
|
1871
|
+
modelValue: _.value,
|
|
1872
|
+
"onUpdate:modelValue": n[0] ||= (e) => _.value = e,
|
|
1873
|
+
class: "ca-menu-search__control",
|
|
1874
|
+
placeholder: D(c)("campus.menuSearch.placeholder"),
|
|
1875
|
+
"aria-label": D(c)("campus.menuSearch.title"),
|
|
1876
|
+
"aria-controls": T,
|
|
1877
|
+
"aria-expanded": L.value.length > 0,
|
|
1878
|
+
"aria-activedescendant": L.value.length ? M(v.value) : void 0,
|
|
1879
|
+
"container-role": "combobox",
|
|
1880
|
+
"aria-autocomplete": "list",
|
|
1881
|
+
autocomplete: "off",
|
|
1882
|
+
spellcheck: "false"
|
|
1883
|
+
}, {
|
|
1884
|
+
prefix: N(() => [u(d, {
|
|
1885
|
+
name: "search",
|
|
1886
|
+
size: 18,
|
|
1887
|
+
"aria-hidden": "true"
|
|
1888
|
+
})]),
|
|
1889
|
+
_: 1
|
|
1890
|
+
}, 8, [
|
|
1891
|
+
"modelValue",
|
|
1892
|
+
"placeholder",
|
|
1893
|
+
"aria-label",
|
|
1894
|
+
"aria-expanded",
|
|
1895
|
+
"aria-activedescendant"
|
|
1896
|
+
])], 32),
|
|
1897
|
+
P(s("ul", {
|
|
1898
|
+
id: T,
|
|
1899
|
+
class: "ca-menu-search__results",
|
|
1900
|
+
role: "listbox",
|
|
1901
|
+
"aria-label": D(c)("campus.menuSearch.results")
|
|
1902
|
+
}, [(y(!0), o(e, null, S(L.value, (e, t) => (y(), o("li", {
|
|
1903
|
+
id: M(t),
|
|
1904
|
+
key: e.key,
|
|
1905
|
+
role: "option",
|
|
1906
|
+
"aria-selected": t === v.value,
|
|
1907
|
+
onMousemove: (e) => v.value = t,
|
|
1908
|
+
onMousedown: n[1] ||= F(() => {}, ["prevent"]),
|
|
1909
|
+
onClick: (t) => z(e)
|
|
1910
|
+
}, [
|
|
1911
|
+
u(d, {
|
|
1912
|
+
name: e.icon || "document",
|
|
1913
|
+
size: 18,
|
|
1914
|
+
"aria-hidden": "true"
|
|
1915
|
+
}, null, 8, ["name"]),
|
|
1916
|
+
s("span", xn, [s("strong", null, E(e.title), 1), e.trail ? (y(), o("small", Sn, E(e.trail), 1)) : a("v-if", !0)]),
|
|
1917
|
+
u(d, {
|
|
1918
|
+
name: "right",
|
|
1919
|
+
size: 16,
|
|
1920
|
+
class: "ca-menu-search__arrow",
|
|
1921
|
+
"aria-hidden": "true"
|
|
1922
|
+
})
|
|
1923
|
+
], 40, bn))), 128))], 8, yn), [[A, L.value.length]]),
|
|
1924
|
+
L.value.length ? a("v-if", !0) : (y(), o("p", Cn, E(D(c)("campus.menuSearch.empty")), 1)),
|
|
1925
|
+
s("div", wn, [
|
|
1926
|
+
s("span", null, [
|
|
1927
|
+
n[3] ||= s("kbd", null, "↑", -1),
|
|
1928
|
+
n[4] ||= l(),
|
|
1929
|
+
n[5] ||= s("kbd", null, "↓", -1),
|
|
1930
|
+
l(" " + E(D(c)("campus.menuSearch.navigate")), 1)
|
|
1931
|
+
]),
|
|
1932
|
+
s("span", null, [n[6] ||= s("kbd", null, "↵", -1), l(" " + E(D(c)("campus.menuSearch.open")), 1)]),
|
|
1933
|
+
s("span", null, [n[7] ||= s("kbd", null, "Esc", -1), l(" " + E(D(c)("campus.menuSearch.close")), 1)])
|
|
1934
|
+
])
|
|
1935
|
+
]),
|
|
1936
|
+
_: 1
|
|
1937
|
+
}, 8, ["modelValue", "title"]);
|
|
1938
|
+
};
|
|
1939
|
+
}
|
|
1940
|
+
}), [["__scopeId", "data-v-1f227e14"]]), En = { class: "ca-header" }, Dn = [
|
|
1706
1941
|
"title",
|
|
1707
1942
|
"aria-label",
|
|
1708
1943
|
"aria-expanded"
|
|
1709
|
-
],
|
|
1944
|
+
], On = { class: "ca-header__brand" }, kn = ["src"], An = { class: "ca-header__titles" }, jn = { class: "ca-header__name" }, Mn = {
|
|
1710
1945
|
key: 0,
|
|
1711
1946
|
class: "ca-header__subtitle"
|
|
1712
|
-
},
|
|
1947
|
+
}, Nn = ["aria-label"], Pn = ["onClick"], Fn = { class: "ca-header__tools" }, In = ["aria-label", "aria-haspopup"], Ln = { class: "ca-header__search-text" }, Rn = {
|
|
1948
|
+
class: "ca-header__kbd",
|
|
1949
|
+
"aria-hidden": "true"
|
|
1950
|
+
}, zn = [
|
|
1713
1951
|
"title",
|
|
1714
1952
|
"aria-label",
|
|
1715
1953
|
"aria-pressed"
|
|
1716
|
-
],
|
|
1954
|
+
], Bn = ["title", "aria-label"], Vn = { class: "ca-header__icon-text" }, Hn = ["title", "aria-label"], Un = ["title", "aria-label"], Wn = ["title", "aria-label"], Gn = ["title", "aria-label"], Kn = { class: "ca-settings__intro" }, qn = { class: "ca-settings__group" }, Jn = { class: "ca-settings__title" }, Yn = ["aria-label"], Xn = ["aria-pressed", "onClick"], Zn = {
|
|
1717
1955
|
key: 0,
|
|
1718
1956
|
class: "ca-settings__group"
|
|
1719
|
-
},
|
|
1957
|
+
}, Qn = { class: "ca-settings__color-heading" }, $n = { class: "ca-settings__title" }, er = {
|
|
1958
|
+
class: "ca-settings__color-value",
|
|
1959
|
+
"aria-live": "polite"
|
|
1960
|
+
}, tr = { key: 0 }, nr = ["aria-label"], rr = [
|
|
1720
1961
|
"aria-label",
|
|
1721
|
-
"
|
|
1962
|
+
"title",
|
|
1963
|
+
"aria-pressed",
|
|
1722
1964
|
"onClick"
|
|
1723
|
-
],
|
|
1965
|
+
], ir = { class: "ca-settings__color-actions" }, ar = { class: "ca-settings__custom" }, or = ["value", "aria-label"], sr = ["disabled"], cr = { class: "ca-settings__group" }, lr = { class: "ca-settings__title" }, ur = ["aria-label"], dr = ["aria-pressed", "onClick"], fr = /*#__PURE__*/ Z(/* @__PURE__ */ d({
|
|
1724
1966
|
__name: "HeaderBar",
|
|
1725
1967
|
setup(t) {
|
|
1726
|
-
let r =
|
|
1968
|
+
let r = W(), c = G(), d = Q(), f = ft(), p = Ue(), { t: m, label: b, locale: C } = q(), T = J(), O = x(!1), k = typeof navigator < "u" && /Mac|iPhone|iPad/i.test(navigator.platform) ? "⌘ K" : "Ctrl K";
|
|
1969
|
+
function A() {
|
|
1970
|
+
T.headerTools?.search ? T.headerTools.search() : O.value = !0;
|
|
1971
|
+
}
|
|
1972
|
+
function j(e) {
|
|
1973
|
+
e.isComposing || e.defaultPrevented || (e.key === "Escape" && O.value ? (e.preventDefault(), e.stopPropagation(), O.value = !1) : !(e.metaKey || e.ctrlKey) || e.altKey || e.shiftKey || e.key.toLowerCase() !== "k" || e.target instanceof Element && e.target.closest("[aria-modal=\"true\"]") || (e.preventDefault(), e.repeat || A()));
|
|
1974
|
+
}
|
|
1975
|
+
v(() => window.addEventListener("keydown", j, !0)), _(() => window.removeEventListener("keydown", j, !0));
|
|
1976
|
+
let M = x(!1), P = [{
|
|
1727
1977
|
value: "border",
|
|
1728
1978
|
label: "campus.settings.boxBorder"
|
|
1729
1979
|
}, {
|
|
1730
1980
|
value: "shadow",
|
|
1731
1981
|
label: "campus.settings.boxShadow"
|
|
1732
|
-
}],
|
|
1733
|
-
function
|
|
1982
|
+
}], F = n(() => b(p.theme.siteName ?? T.brand.name)), I = n(() => p.theme.logo ?? T.brand.logo), L = n(() => (T.shortcuts ?? []).filter((e) => d.can(e.permission)));
|
|
1983
|
+
function R(e) {
|
|
1734
1984
|
r.path !== e && c.push(e);
|
|
1735
1985
|
}
|
|
1736
|
-
let
|
|
1986
|
+
let z = [
|
|
1737
1987
|
{
|
|
1738
1988
|
value: "light",
|
|
1739
1989
|
icon: "sunny"
|
|
@@ -1746,7 +1996,7 @@ var Gt = {
|
|
|
1746
1996
|
value: "auto",
|
|
1747
1997
|
icon: "monitor"
|
|
1748
1998
|
}
|
|
1749
|
-
],
|
|
1999
|
+
], te = [
|
|
1750
2000
|
"#1677ff",
|
|
1751
2001
|
"#364fc7",
|
|
1752
2002
|
"#6b1d7a",
|
|
@@ -1755,39 +2005,39 @@ var Gt = {
|
|
|
1755
2005
|
"#f59f00",
|
|
1756
2006
|
"#0f9d58",
|
|
1757
2007
|
"#0ca678"
|
|
1758
|
-
],
|
|
1759
|
-
function
|
|
2008
|
+
], B = n(() => ue(se(p.theme.primary))), V = n(() => p.userPrimary && te.find((e) => e === B.value));
|
|
2009
|
+
function ne(e, t) {
|
|
1760
2010
|
let n = t.currentTarget?.getBoundingClientRect();
|
|
1761
2011
|
p.setMode(e, n ? {
|
|
1762
2012
|
x: n.left + n.width / 2,
|
|
1763
2013
|
y: n.top + n.height / 2
|
|
1764
2014
|
} : void 0);
|
|
1765
2015
|
}
|
|
1766
|
-
function
|
|
1767
|
-
C.value = e,
|
|
2016
|
+
function re(e) {
|
|
2017
|
+
C.value = e, De(e);
|
|
1768
2018
|
}
|
|
1769
|
-
async function
|
|
1770
|
-
e === "account" ? T.onAccountClick ? await T.onAccountClick("header") : T.accountPath &&
|
|
2019
|
+
async function H(e) {
|
|
2020
|
+
e === "account" ? T.onAccountClick ? await T.onAccountClick("header") : T.accountPath && R(T.accountPath) : (await d.logout(), await c.replace({ name: Y(J()).login }));
|
|
1771
2021
|
}
|
|
1772
|
-
let
|
|
1773
|
-
function
|
|
1774
|
-
|
|
2022
|
+
let U = x(!1);
|
|
2023
|
+
function ie() {
|
|
2024
|
+
U.value = !!document.fullscreenElement;
|
|
1775
2025
|
}
|
|
1776
|
-
async function
|
|
2026
|
+
async function ae() {
|
|
1777
2027
|
f.pageScreenManual();
|
|
1778
2028
|
try {
|
|
1779
2029
|
document.fullscreenElement ? await document.exitFullscreen() : await document.documentElement.requestFullscreen();
|
|
1780
2030
|
} catch {}
|
|
1781
2031
|
}
|
|
1782
2032
|
v(() => {
|
|
1783
|
-
|
|
1784
|
-
}), _(() => document.removeEventListener("fullscreenchange",
|
|
1785
|
-
function
|
|
2033
|
+
ie(), document.addEventListener("fullscreenchange", ie);
|
|
2034
|
+
}), _(() => document.removeEventListener("fullscreenchange", ie));
|
|
2035
|
+
function oe(e) {
|
|
1786
2036
|
T.headerTools?.[e]?.();
|
|
1787
2037
|
}
|
|
1788
2038
|
return (t, n) => {
|
|
1789
|
-
let c = w("ca-icon"), _ = w("ca-dropdown-item"), v = w("ca-dropdown-menu"), x = w("ca-dropdown"),
|
|
1790
|
-
return y(), o("header",
|
|
2039
|
+
let c = w("ca-icon"), _ = w("ca-dropdown-item"), v = w("ca-dropdown-menu"), x = w("ca-dropdown"), j = w("ca-drawer");
|
|
2040
|
+
return y(), o("header", En, [
|
|
1791
2041
|
a(" 菜单按钮:手机打开抽屉;电脑档两栏都收起时也显示,点击重新显示侧栏 "),
|
|
1792
2042
|
s("button", {
|
|
1793
2043
|
type: "button",
|
|
@@ -1805,13 +2055,13 @@ var Gt = {
|
|
|
1805
2055
|
"stroke-width": "2",
|
|
1806
2056
|
"stroke-linecap": "round",
|
|
1807
2057
|
"aria-hidden": "true"
|
|
1808
|
-
}, [s("path", { d: "M4 6h16M4 12h16M4 18h16" })], -1)]], 10,
|
|
1809
|
-
s("div",
|
|
2058
|
+
}, [s("path", { d: "M4 6h16M4 12h16M4 18h16" })], -1)]], 10, Dn),
|
|
2059
|
+
s("div", On, [I.value ? (y(), o("img", {
|
|
1810
2060
|
key: 0,
|
|
1811
|
-
src:
|
|
2061
|
+
src: I.value,
|
|
1812
2062
|
alt: "",
|
|
1813
2063
|
class: "ca-header__logo"
|
|
1814
|
-
}, null, 8,
|
|
2064
|
+
}, null, 8, kn)) : (y(), o(e, { key: 1 }, [a(" 没有配置 logo 时用框架默认标志(学士帽),颜色跟随头部前景色 "), n[9] ||= s("svg", {
|
|
1815
2065
|
class: "ca-header__logo",
|
|
1816
2066
|
viewBox: "0 0 32 32",
|
|
1817
2067
|
fill: "none",
|
|
@@ -1824,58 +2074,64 @@ var Gt = {
|
|
|
1824
2074
|
s("path", { d: "M16 6 3 12.5 16 19l13-6.5L16 6Z" }),
|
|
1825
2075
|
s("path", { d: "M9 16.5v5.2c0 1.6 3.1 3.3 7 3.3s7-1.7 7-3.3v-5.2" }),
|
|
1826
2076
|
s("path", { d: "M29 12.5V20" })
|
|
1827
|
-
], -1)], 2112)), s("div",
|
|
2077
|
+
], -1)], 2112)), s("div", An, [s("strong", jn, E(F.value), 1), D(T).brand.subtitle ? (y(), o("span", Mn, E(D(b)(D(T).brand.subtitle)), 1)) : a("v-if", !0)])]),
|
|
1828
2078
|
s("nav", {
|
|
1829
2079
|
class: "ca-header__nav",
|
|
1830
2080
|
"aria-label": D(m)("campus.header.shortcuts")
|
|
1831
|
-
}, [(y(!0), o(e, null, S(
|
|
2081
|
+
}, [(y(!0), o(e, null, S(L.value, (e) => (y(), o("button", {
|
|
1832
2082
|
key: e.key,
|
|
1833
2083
|
class: h(["ca-header__nav-item", { "is-active": D(r).path === e.path }]),
|
|
1834
2084
|
type: "button",
|
|
1835
|
-
onClick: (t) =>
|
|
1836
|
-
}, E(D(b)(e.title)), 11,
|
|
1837
|
-
s("div",
|
|
2085
|
+
onClick: (t) => R(e.path)
|
|
2086
|
+
}, E(D(b)(e.title)), 11, Pn))), 128))], 8, Nn),
|
|
2087
|
+
s("div", Fn, [
|
|
1838
2088
|
s("button", {
|
|
1839
2089
|
type: "button",
|
|
1840
2090
|
class: "ca-header__search",
|
|
1841
|
-
|
|
2091
|
+
"aria-label": D(m)("campus.header.search"),
|
|
2092
|
+
"aria-haspopup": D(T).headerTools?.search ? void 0 : "dialog",
|
|
2093
|
+
"aria-keyshortcuts": "Meta+K Control+K",
|
|
2094
|
+
onClick: A
|
|
1842
2095
|
}, [
|
|
1843
|
-
u(c, {
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
2096
|
+
u(c, {
|
|
2097
|
+
name: "search",
|
|
2098
|
+
"aria-hidden": "true"
|
|
2099
|
+
}),
|
|
2100
|
+
s("span", Ln, E(D(m)("campus.header.search")), 1),
|
|
2101
|
+
s("kbd", Rn, E(D(k)), 1)
|
|
2102
|
+
], 8, In),
|
|
1847
2103
|
s("button", {
|
|
1848
2104
|
type: "button",
|
|
1849
2105
|
class: "ca-header__icon ca-header__desktop-tool",
|
|
1850
|
-
title:
|
|
1851
|
-
"aria-label":
|
|
1852
|
-
"aria-pressed":
|
|
1853
|
-
onClick:
|
|
2106
|
+
title: U.value ? D(m)("campus.header.exitFullscreen") : D(m)("campus.header.fullscreen"),
|
|
2107
|
+
"aria-label": U.value ? D(m)("campus.header.exitFullscreen") : D(m)("campus.header.fullscreen"),
|
|
2108
|
+
"aria-pressed": U.value,
|
|
2109
|
+
onClick: ae
|
|
1854
2110
|
}, [u(c, {
|
|
1855
|
-
name:
|
|
2111
|
+
name: U.value ? "exitFullscreen" : "fullscreen",
|
|
1856
2112
|
size: 18
|
|
1857
|
-
}, null, 8, ["name"])], 8,
|
|
2113
|
+
}, null, 8, ["name"])], 8, zn),
|
|
1858
2114
|
u(x, {
|
|
1859
2115
|
trigger: "click",
|
|
1860
|
-
onCommand:
|
|
2116
|
+
onCommand: re
|
|
1861
2117
|
}, {
|
|
1862
|
-
dropdown:
|
|
1863
|
-
default:
|
|
2118
|
+
dropdown: N(() => [u(v, null, {
|
|
2119
|
+
default: N(() => [(y(!0), o(e, null, S(D(ee), (e) => (y(), i(_, {
|
|
1864
2120
|
key: e.code,
|
|
1865
2121
|
command: e.code,
|
|
1866
2122
|
class: h({ "is-current": D(C) === e.code })
|
|
1867
2123
|
}, {
|
|
1868
|
-
default:
|
|
2124
|
+
default: N(() => [l(E(e.code === "zh-CN" ? "简体中文" : "English"), 1)]),
|
|
1869
2125
|
_: 2
|
|
1870
2126
|
}, 1032, ["command", "class"]))), 128))]),
|
|
1871
2127
|
_: 1
|
|
1872
2128
|
})]),
|
|
1873
|
-
default:
|
|
2129
|
+
default: N(() => [s("button", {
|
|
1874
2130
|
type: "button",
|
|
1875
2131
|
class: "ca-header__icon",
|
|
1876
2132
|
title: D(m)("campus.header.language"),
|
|
1877
2133
|
"aria-label": D(m)("campus.header.language")
|
|
1878
|
-
}, [s("span",
|
|
2134
|
+
}, [s("span", Vn, E(D(ee).find((e) => e.code === D(C))?.label), 1)], 8, Bn)]),
|
|
1879
2135
|
_: 1
|
|
1880
2136
|
}),
|
|
1881
2137
|
s("button", {
|
|
@@ -1883,154 +2139,177 @@ var Gt = {
|
|
|
1883
2139
|
class: "ca-header__icon ca-header__desktop-tool",
|
|
1884
2140
|
title: D(m)("campus.header.notifications"),
|
|
1885
2141
|
"aria-label": D(m)("campus.header.notifications"),
|
|
1886
|
-
onClick: n[
|
|
2142
|
+
onClick: n[1] ||= (e) => oe("notifications")
|
|
1887
2143
|
}, [u(c, {
|
|
1888
2144
|
name: "bell",
|
|
1889
2145
|
size: 18
|
|
1890
|
-
}), n[
|
|
2146
|
+
}), n[10] ||= s("i", {
|
|
1891
2147
|
class: "ca-header__dot is-danger",
|
|
1892
2148
|
"aria-hidden": "true"
|
|
1893
|
-
}, null, -1)], 8,
|
|
2149
|
+
}, null, -1)], 8, Hn),
|
|
1894
2150
|
s("button", {
|
|
1895
2151
|
type: "button",
|
|
1896
2152
|
class: "ca-header__icon ca-header__desktop-tool",
|
|
1897
2153
|
title: D(m)("campus.header.assistant"),
|
|
1898
2154
|
"aria-label": D(m)("campus.header.assistant"),
|
|
1899
|
-
onClick: n[
|
|
2155
|
+
onClick: n[2] ||= (e) => oe("assistant")
|
|
1900
2156
|
}, [u(c, {
|
|
1901
2157
|
name: "chat",
|
|
1902
2158
|
size: 18
|
|
1903
|
-
}), n[
|
|
2159
|
+
}), n[11] ||= s("i", {
|
|
1904
2160
|
class: "ca-header__dot is-success",
|
|
1905
2161
|
"aria-hidden": "true"
|
|
1906
|
-
}, null, -1)], 8,
|
|
2162
|
+
}, null, -1)], 8, Un),
|
|
1907
2163
|
s("button", {
|
|
1908
2164
|
type: "button",
|
|
1909
2165
|
class: "ca-header__icon",
|
|
1910
2166
|
title: D(m)("campus.header.settings"),
|
|
1911
2167
|
"aria-label": D(m)("campus.header.settings"),
|
|
1912
|
-
onClick: n[
|
|
2168
|
+
onClick: n[3] ||= (e) => M.value = !0
|
|
1913
2169
|
}, [u(c, {
|
|
1914
2170
|
name: "setting",
|
|
1915
2171
|
size: 18
|
|
1916
|
-
})], 8,
|
|
2172
|
+
})], 8, Wn),
|
|
1917
2173
|
u(x, {
|
|
1918
2174
|
trigger: "click",
|
|
1919
|
-
onCommand:
|
|
2175
|
+
onCommand: H
|
|
1920
2176
|
}, {
|
|
1921
|
-
dropdown:
|
|
1922
|
-
default:
|
|
2177
|
+
dropdown: N(() => [u(v, null, {
|
|
2178
|
+
default: N(() => [D(T).accountEntry?.header !== !1 && (D(T).accountPath || D(T).onAccountClick) ? (y(), i(_, {
|
|
1923
2179
|
key: 0,
|
|
1924
2180
|
command: "account"
|
|
1925
2181
|
}, {
|
|
1926
|
-
default:
|
|
2182
|
+
default: N(() => [l(E(D(m)("campus.header.myAccount")), 1)]),
|
|
1927
2183
|
_: 1
|
|
1928
2184
|
})) : a("v-if", !0), u(_, {
|
|
1929
2185
|
command: "logout",
|
|
1930
2186
|
divided: ""
|
|
1931
2187
|
}, {
|
|
1932
|
-
default:
|
|
2188
|
+
default: N(() => [l(E(D(m)("campus.header.logout")), 1)]),
|
|
1933
2189
|
_: 1
|
|
1934
2190
|
})]),
|
|
1935
2191
|
_: 1
|
|
1936
2192
|
})]),
|
|
1937
|
-
default:
|
|
2193
|
+
default: N(() => [s("button", {
|
|
1938
2194
|
type: "button",
|
|
1939
2195
|
class: "ca-header__user",
|
|
1940
2196
|
title: D(m)("campus.header.account"),
|
|
1941
2197
|
"aria-label": D(d).user?.name
|
|
1942
|
-
}, [u(
|
|
2198
|
+
}, [u(mn, {
|
|
1943
2199
|
class: "ca-header__avatar",
|
|
1944
2200
|
name: D(d).user?.name,
|
|
1945
2201
|
src: D(d).user?.avatar
|
|
1946
2202
|
}, null, 8, ["name", "src"]), u(c, {
|
|
1947
2203
|
name: "arrowDown",
|
|
1948
2204
|
size: 12
|
|
1949
|
-
})], 8,
|
|
2205
|
+
})], 8, Gn)]),
|
|
1950
2206
|
_: 1
|
|
1951
2207
|
})
|
|
1952
2208
|
]),
|
|
1953
|
-
|
|
2209
|
+
D(T).headerTools?.search ? a("v-if", !0) : (y(), i(Tn, {
|
|
2210
|
+
key: 0,
|
|
1954
2211
|
modelValue: O.value,
|
|
1955
|
-
"onUpdate:modelValue": n[
|
|
2212
|
+
"onUpdate:modelValue": n[4] ||= (e) => O.value = e
|
|
2213
|
+
}, null, 8, ["modelValue"])),
|
|
2214
|
+
u(j, {
|
|
2215
|
+
modelValue: M.value,
|
|
2216
|
+
"onUpdate:modelValue": n[7] ||= (e) => M.value = e,
|
|
1956
2217
|
title: D(m)("campus.settings.title"),
|
|
1957
|
-
size: "
|
|
2218
|
+
size: "min(352px, 100vw)",
|
|
1958
2219
|
"append-to-body": "",
|
|
2220
|
+
"header-class": "ca-settings__header",
|
|
2221
|
+
"body-class": "ca-settings__body",
|
|
1959
2222
|
class: "ca-settings"
|
|
1960
2223
|
}, {
|
|
1961
|
-
default:
|
|
1962
|
-
s("
|
|
2224
|
+
default: N(() => [
|
|
2225
|
+
s("p", Kn, E(D(m)("campus.settings.deviceNote")), 1),
|
|
2226
|
+
s("section", qn, [s("h3", Jn, E(D(m)("campus.settings.themeMode")), 1), s("div", {
|
|
1963
2227
|
class: "ca-settings__segment is-three",
|
|
1964
|
-
role: "
|
|
2228
|
+
role: "group",
|
|
1965
2229
|
"aria-label": D(m)("campus.settings.themeMode")
|
|
1966
|
-
}, [(y(), o(e, null, S(
|
|
2230
|
+
}, [(y(), o(e, null, S(z, (e) => s("button", {
|
|
1967
2231
|
key: e.value,
|
|
1968
2232
|
type: "button",
|
|
1969
|
-
|
|
1970
|
-
"aria-checked": D(p).mode === e.value,
|
|
2233
|
+
"aria-pressed": D(p).mode === e.value,
|
|
1971
2234
|
class: h({ "is-active": D(p).mode === e.value }),
|
|
1972
|
-
onClick: (t) =>
|
|
2235
|
+
onClick: (t) => ne(e.value, t)
|
|
1973
2236
|
}, [u(c, {
|
|
1974
2237
|
name: e.icon,
|
|
1975
|
-
size: 16
|
|
1976
|
-
|
|
1977
|
-
D(
|
|
1978
|
-
|
|
2238
|
+
size: 16,
|
|
2239
|
+
"aria-hidden": "true"
|
|
2240
|
+
}, null, 8, ["name"]), l(E(D(m)(`campus.mode.${e.value}`)), 1)], 10, Xn)), 64))], 8, Yn)]),
|
|
2241
|
+
D(p).primaryLocked ? a("v-if", !0) : (y(), o("section", Zn, [
|
|
2242
|
+
s("div", Qn, [s("h3", $n, E(D(m)("campus.settings.themeColor")), 1), s("span", er, [D(p).userPrimary ? a("v-if", !0) : (y(), o("span", tr, E(D(m)("campus.settings.siteDefault")), 1)), s("code", null, E(B.value), 1)])]),
|
|
1979
2243
|
s("div", {
|
|
1980
2244
|
class: "ca-settings__swatches",
|
|
1981
|
-
role: "
|
|
2245
|
+
role: "group",
|
|
1982
2246
|
"aria-label": D(m)("campus.settings.themeColor")
|
|
1983
|
-
}, [(y(), o(e, null, S(
|
|
2247
|
+
}, [(y(), o(e, null, S(te, (e) => s("button", {
|
|
1984
2248
|
key: e,
|
|
1985
2249
|
type: "button",
|
|
1986
|
-
|
|
1987
|
-
class: h(["ca-settings__swatch", { "is-active": D(p).userPrimary?.toLowerCase() === e }]),
|
|
1988
|
-
style: g({ background: e }),
|
|
2250
|
+
class: "ca-settings__swatch",
|
|
1989
2251
|
"aria-label": e,
|
|
1990
|
-
|
|
2252
|
+
title: e,
|
|
2253
|
+
"aria-pressed": V.value === e,
|
|
1991
2254
|
onClick: (t) => D(p).setPrimary(e)
|
|
1992
|
-
},
|
|
1993
|
-
class: "ca-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2255
|
+
}, [s("span", {
|
|
2256
|
+
class: "ca-settings__chip",
|
|
2257
|
+
style: g({ background: e }),
|
|
2258
|
+
"aria-hidden": "true"
|
|
2259
|
+
}, null, 4), V.value === e ? (y(), i(c, {
|
|
2260
|
+
key: 0,
|
|
2261
|
+
name: "check",
|
|
2262
|
+
size: 14,
|
|
2263
|
+
"aria-hidden": "true"
|
|
2264
|
+
})) : a("v-if", !0)], 8, rr)), 64))], 8, nr),
|
|
2265
|
+
s("div", ir, [s("label", ar, [
|
|
2266
|
+
u(c, {
|
|
2267
|
+
name: "brush",
|
|
2268
|
+
size: 16,
|
|
2269
|
+
"aria-hidden": "true"
|
|
2270
|
+
}),
|
|
2271
|
+
l(" " + E(D(m)("campus.settings.themeColorCustom")) + " ", 1),
|
|
2272
|
+
s("input", {
|
|
2273
|
+
type: "color",
|
|
2274
|
+
value: B.value,
|
|
2275
|
+
"aria-label": D(m)("campus.settings.themeColorCustom"),
|
|
2276
|
+
onInput: n[5] ||= (e) => D(p).setPrimary(e.target.value)
|
|
2277
|
+
}, null, 40, or)
|
|
2278
|
+
]), s("button", {
|
|
2002
2279
|
type: "button",
|
|
2003
2280
|
class: "ca-settings__reset",
|
|
2004
2281
|
disabled: !D(p).userPrimary,
|
|
2005
2282
|
onClick: n[6] ||= (e) => D(p).setPrimary(void 0)
|
|
2006
|
-
}, E(D(m)("campus.settings.themeColorReset")), 9,
|
|
2283
|
+
}, E(D(m)("campus.settings.themeColorReset")), 9, sr)])
|
|
2007
2284
|
])),
|
|
2008
|
-
s("section",
|
|
2009
|
-
class: "ca-settings__segment",
|
|
2010
|
-
role: "
|
|
2285
|
+
s("section", cr, [s("h3", lr, E(D(m)("campus.settings.boxStyle")), 1), s("div", {
|
|
2286
|
+
class: "ca-settings__segment ca-settings__boxes",
|
|
2287
|
+
role: "group",
|
|
2011
2288
|
"aria-label": D(m)("campus.settings.boxStyle")
|
|
2012
|
-
}, [(y(), o(e, null, S(
|
|
2289
|
+
}, [(y(), o(e, null, S(P, (e) => s("button", {
|
|
2013
2290
|
key: e.value,
|
|
2014
2291
|
type: "button",
|
|
2015
|
-
|
|
2016
|
-
"aria-checked": D(p).boxStyle === e.value,
|
|
2292
|
+
"aria-pressed": D(p).boxStyle === e.value,
|
|
2017
2293
|
class: h({ "is-active": D(p).boxStyle === e.value }),
|
|
2018
2294
|
onClick: (t) => D(p).setBoxStyle(e.value)
|
|
2019
|
-
},
|
|
2295
|
+
}, [s("span", {
|
|
2296
|
+
class: h(["ca-settings__box-sample", `is-${e.value}`]),
|
|
2297
|
+
"aria-hidden": "true"
|
|
2298
|
+
}, [...n[12] ||= [s("span", null, null, -1)]], 2), l(" " + E(D(m)(e.label)), 1)], 10, dr)), 64))], 8, ur)])
|
|
2020
2299
|
]),
|
|
2021
2300
|
_: 1
|
|
2022
2301
|
}, 8, ["modelValue", "title"])
|
|
2023
2302
|
]);
|
|
2024
2303
|
};
|
|
2025
2304
|
}
|
|
2026
|
-
}), [["__scopeId", "data-v-
|
|
2305
|
+
}), [["__scopeId", "data-v-9af060a7"]]), pr = {
|
|
2027
2306
|
key: 0,
|
|
2028
2307
|
class: "ca-page-header"
|
|
2029
|
-
},
|
|
2308
|
+
}, mr = { class: "ca-page-header__top" }, hr = { class: "ca-page-header__crumb" }, gr = ["title", "aria-label"], _r = { class: "ca-page-header__date" }, vr = /*#__PURE__*/ Z(/* @__PURE__ */ d({
|
|
2030
2309
|
__name: "PageHeader",
|
|
2031
2310
|
setup(t) {
|
|
2032
|
-
let r =
|
|
2033
|
-
let e = h.value ?
|
|
2311
|
+
let r = W(), { t: c, label: d, locale: f } = q(), p = gt(), m = new Map(Pe(J().menus).map((e) => [e.key, e])), h = n(() => r.meta.pageKey ? m.get(r.meta.pageKey) : void 0), g = n(() => {
|
|
2312
|
+
let e = h.value ? Me(h.value.key) : void 0;
|
|
2034
2313
|
if (!e) return [];
|
|
2035
2314
|
let t = e.titles.map((e) => d(e));
|
|
2036
2315
|
return h.value?.affix ? t.filter((e, n) => e !== t[n - 1]) : t;
|
|
@@ -2046,15 +2325,15 @@ var Gt = {
|
|
|
2046
2325
|
});
|
|
2047
2326
|
return (t, n) => {
|
|
2048
2327
|
let r = w("ca-icon"), d = w("ca-breadcrumb-item"), f = w("ca-breadcrumb");
|
|
2049
|
-
return h.value ? (y(), o("header",
|
|
2328
|
+
return h.value ? (y(), o("header", pr, [s("div", mr, [s("div", hr, [
|
|
2050
2329
|
u(r, {
|
|
2051
2330
|
name: "location",
|
|
2052
2331
|
class: "ca-page-header__icon"
|
|
2053
2332
|
}),
|
|
2054
2333
|
s("span", null, E(D(c)("campus.breadcrumb.current")), 1),
|
|
2055
2334
|
u(f, { separator: ">" }, {
|
|
2056
|
-
default:
|
|
2057
|
-
default:
|
|
2335
|
+
default: N(() => [(y(!0), o(e, null, S(g.value, (e, t) => (y(), i(d, { key: t }, {
|
|
2336
|
+
default: N(() => [l(E(e), 1)]),
|
|
2058
2337
|
_: 2
|
|
2059
2338
|
}, 1024))), 128))]),
|
|
2060
2339
|
_: 1
|
|
@@ -2066,29 +2345,29 @@ var Gt = {
|
|
|
2066
2345
|
title: D(c)("campus.tabs.refresh"),
|
|
2067
2346
|
"aria-label": D(c)("campus.tabs.refresh"),
|
|
2068
2347
|
onClick: n[0] ||= (e) => h.value && D(p).refresh(h.value.key)
|
|
2069
|
-
}, [u(r, { name: "refresh" })], 8,
|
|
2070
|
-
]), s("time",
|
|
2348
|
+
}, [u(r, { name: "refresh" })], 8, gr)
|
|
2349
|
+
]), s("time", _r, E(C.value), 1)])])) : a("v-if", !0);
|
|
2071
2350
|
};
|
|
2072
2351
|
}
|
|
2073
|
-
}), [["__scopeId", "data-v-e0f9b42f"]]),
|
|
2352
|
+
}), [["__scopeId", "data-v-e0f9b42f"]]), yr = {
|
|
2074
2353
|
key: 0,
|
|
2075
2354
|
class: "ca-page-header__titles"
|
|
2076
|
-
},
|
|
2355
|
+
}, br = { class: "ca-page-header__title" }, xr = ["title"], Sr = /*#__PURE__*/ Z(/* @__PURE__ */ d({
|
|
2077
2356
|
__name: "PageTitle",
|
|
2078
2357
|
setup(e) {
|
|
2079
|
-
let t =
|
|
2358
|
+
let t = W(), { label: r } = q(), i = new Map(Pe(J().menus).map((e) => [e.key, e])), c = n(() => t.meta.pageKey ? i.get(t.meta.pageKey) : void 0), l = n(() => c.value?.pageHeader ?? J().pageHeader ?? !0), u = n(() => c.value ? r(c.value.title) : ""), d = n(() => c.value?.description ? r(c.value.description) : "");
|
|
2080
2359
|
return (e, t) => c.value ? (y(), o("header", {
|
|
2081
2360
|
key: 0,
|
|
2082
2361
|
class: h(["ca-page-header__main", { "is-title-hidden": !l.value }])
|
|
2083
2362
|
}, [
|
|
2084
|
-
l.value ? (y(), o("div",
|
|
2085
|
-
s("h2",
|
|
2363
|
+
l.value ? (y(), o("div", yr, [
|
|
2364
|
+
s("h2", br, E(u.value), 1),
|
|
2086
2365
|
a(" 说明和标题同一行,放不下时省略;窗口较矮时直接隐藏,把高度留给内容 "),
|
|
2087
2366
|
d.value ? (y(), o("p", {
|
|
2088
2367
|
key: 0,
|
|
2089
2368
|
class: "ca-page-header__desc",
|
|
2090
2369
|
title: d.value
|
|
2091
|
-
}, E(d.value), 9,
|
|
2370
|
+
}, E(d.value), 9, xr)) : a("v-if", !0)
|
|
2092
2371
|
])) : a("v-if", !0),
|
|
2093
2372
|
a(" 页面通过 <ca-page-actions> 把按钮放到这里 "),
|
|
2094
2373
|
t[0] ||= s("div", {
|
|
@@ -2097,234 +2376,289 @@ var Gt = {
|
|
|
2097
2376
|
}, null, -1)
|
|
2098
2377
|
], 2)) : a("v-if", !0);
|
|
2099
2378
|
}
|
|
2100
|
-
}), [["__scopeId", "data-v-
|
|
2379
|
+
}), [["__scopeId", "data-v-22464957"]]), Cr = ["aria-label"], wr = ["onClick"], Tr = { class: "ca-side__rail-list" }, Er = ["aria-current", "title"], Dr = [
|
|
2101
2380
|
"aria-current",
|
|
2381
|
+
"aria-expanded",
|
|
2102
2382
|
"title",
|
|
2103
2383
|
"onClick"
|
|
2104
|
-
],
|
|
2384
|
+
], Or = {
|
|
2105
2385
|
key: 0,
|
|
2106
2386
|
class: "ca-side__badge"
|
|
2107
|
-
},
|
|
2387
|
+
}, kr = { class: "ca-side__tools" }, Ar = [
|
|
2108
2388
|
"title",
|
|
2109
2389
|
"aria-label",
|
|
2110
2390
|
"aria-pressed"
|
|
2111
|
-
],
|
|
2391
|
+
], jr = [
|
|
2112
2392
|
"title",
|
|
2113
2393
|
"aria-label",
|
|
2114
2394
|
"aria-expanded"
|
|
2115
|
-
],
|
|
2395
|
+
], Mr = ["title", "aria-label"], Nr = ["inert"], Pr = { class: "ca-side__panel-inner" }, Fr = {
|
|
2116
2396
|
key: 0,
|
|
2117
2397
|
class: "ca-side__title"
|
|
2118
|
-
},
|
|
2398
|
+
}, Ir = { class: "ca-side__group-label" }, Lr = {
|
|
2119
2399
|
key: 1,
|
|
2120
2400
|
class: "ca-side__group-badge"
|
|
2121
|
-
},
|
|
2401
|
+
}, Rr = /*#__PURE__*/ Z(/* @__PURE__ */ d({
|
|
2122
2402
|
__name: "SideMenu",
|
|
2123
2403
|
setup(t) {
|
|
2124
|
-
let r =
|
|
2125
|
-
function
|
|
2126
|
-
|
|
2404
|
+
let r = W(), c = G(), d = Q(), f = ft(), { t: p, label: g } = q(), _ = J(), v = n(() => f.sidePanelCollapsed), b = () => f.toggleSidePanel(), C = x(_e("side-text-hidden") === "1");
|
|
2405
|
+
function T() {
|
|
2406
|
+
C.value = !C.value, K("side-text-hidden", C.value ? "1" : "0");
|
|
2127
2407
|
}
|
|
2128
|
-
async function
|
|
2129
|
-
e === "account" ?
|
|
2408
|
+
async function O(e) {
|
|
2409
|
+
e === "account" ? _.onAccountClick ? await _.onAccountClick("side") : _.accountPath && r.path !== _.accountPath && await c.push(_.accountPath) : (await d.logout(), await c.replace({ name: Y(J()).login }));
|
|
2130
2410
|
}
|
|
2131
|
-
let
|
|
2132
|
-
|
|
2133
|
-
|
|
2411
|
+
let k = n(() => Ie(_, (e) => d.can(e))), M = n(() => k.value.home), F = n(() => k.value.apps), I = k.value.accountStandalone, L = x(), R = n(() => !!M.value && r.path === M.value.path);
|
|
2412
|
+
j(() => [r.path, r.meta.appKey], () => {
|
|
2413
|
+
L.value = R.value || I && r.path === _.accountPath ? void 0 : r.meta.appKey ?? F.value[0]?.key;
|
|
2134
2414
|
}, { immediate: !0 });
|
|
2135
|
-
let
|
|
2136
|
-
|
|
2137
|
-
let
|
|
2138
|
-
function
|
|
2415
|
+
let z = n(() => F.value.find((e) => e.key === L.value)), ee = n(() => (f.mode === "phone" ? !f.mobileMenuOpen : f.mode === "pad" ? !f.padPanelOpen : v.value || f.sideHiddenActive) || !z.value?.children.length), te = x();
|
|
2416
|
+
j(z, (e) => e?.children.length && (te.value = e), { immediate: !0 });
|
|
2417
|
+
let B = n(() => z.value?.children.length ? z.value : te.value);
|
|
2418
|
+
function V(e) {
|
|
2139
2419
|
let t = typeof e.badge == "function" ? e.badge() : e.badge ?? 0;
|
|
2140
2420
|
return t > 0 ? t : 0;
|
|
2141
2421
|
}
|
|
2142
|
-
function
|
|
2143
|
-
return e.children.reduce((e, t) => e + (
|
|
2422
|
+
function ne(e) {
|
|
2423
|
+
return e.children.reduce((e, t) => e + (ke(t) ? V(t) : 0), 0);
|
|
2144
2424
|
}
|
|
2145
|
-
let re =
|
|
2146
|
-
function
|
|
2147
|
-
|
|
2425
|
+
let re = x(), H = !0;
|
|
2426
|
+
function U(e, t) {
|
|
2427
|
+
H || f.setMenuGroup(e, t);
|
|
2148
2428
|
}
|
|
2149
|
-
let
|
|
2150
|
-
|
|
2429
|
+
let ie = n(() => Object.keys(f.menuGroups).filter((e) => f.menuGroups[e]));
|
|
2430
|
+
j(() => r.meta.groupKey, (e) => {
|
|
2431
|
+
e && f.ensureMenuGroup(e);
|
|
2432
|
+
}, { immediate: !0 }), j([
|
|
2433
|
+
() => f.menuGroups,
|
|
2434
|
+
B,
|
|
2435
|
+
() => r.path
|
|
2436
|
+
], async () => {
|
|
2437
|
+
H = !0, await m();
|
|
2438
|
+
for (let e of B.value?.children ?? []) ke(e) && e.children.length && (f.menuGroups[e.key] ? re.value?.open(e.key) : re.value?.close(e.key));
|
|
2439
|
+
H = !1;
|
|
2440
|
+
}, {
|
|
2441
|
+
deep: !0,
|
|
2442
|
+
immediate: !0
|
|
2443
|
+
});
|
|
2444
|
+
async function ae(e) {
|
|
2445
|
+
let t = F.value.find((t) => t.key === e);
|
|
2446
|
+
if (!t) return;
|
|
2447
|
+
let n = L.value === e;
|
|
2448
|
+
L.value = e, await f.clickMenuApp(t, r.path, (e) => c.push(e), n);
|
|
2449
|
+
}
|
|
2450
|
+
function oe(e, t) {
|
|
2451
|
+
let n = e.currentTarget, i = e.type === "keydown";
|
|
2452
|
+
(n.firstElementChild?.contains(e.target) || i && e.target === n) && (!i || ["Enter", " "].includes(e.key)) && (e.preventDefault(), e.stopPropagation(), f.clickMenuGroup(t, r.path, (e) => c.push(e)));
|
|
2453
|
+
}
|
|
2454
|
+
let se = n(() => (_.shortcuts ?? []).filter((e) => d.can(e.permission)));
|
|
2455
|
+
function ce(e) {
|
|
2151
2456
|
f.closeOverlays(), r.path !== e && c.push(e);
|
|
2152
2457
|
}
|
|
2153
2458
|
return (t, n) => {
|
|
2154
|
-
let c = w("ca-icon"),
|
|
2459
|
+
let c = w("ca-icon"), m = w("ca-dropdown-item"), x = w("ca-dropdown-menu"), k = w("ca-dropdown"), j = w("ca-menu-item"), I = w("ca-sub-menu"), L = w("ca-menu");
|
|
2155
2460
|
return y(), o(e, null, [a(" 两栏都收起(只在电脑档):整个侧栏向左滑出,第二栏同时收起;不可聚焦由 CaLayout 的 inert 负责 "), s("aside", { class: h(["ca-side", {
|
|
2156
2461
|
"is-pad-open": D(f).mode === "pad" && D(f).padPanelOpen,
|
|
2157
2462
|
"is-hidden": D(f).sideHiddenActive,
|
|
2158
|
-
"is-text-hidden":
|
|
2463
|
+
"is-text-hidden": C.value
|
|
2159
2464
|
}]) }, [
|
|
2160
|
-
|
|
2465
|
+
se.value.length ? (y(), o("nav", {
|
|
2161
2466
|
key: 0,
|
|
2162
2467
|
class: "ca-side__shortcuts",
|
|
2163
2468
|
"aria-label": D(p)("campus.header.shortcuts")
|
|
2164
|
-
}, [(y(!0), o(e, null, S(
|
|
2469
|
+
}, [(y(!0), o(e, null, S(se.value, (e) => (y(), o("button", {
|
|
2165
2470
|
key: e.key,
|
|
2166
2471
|
type: "button",
|
|
2167
2472
|
class: h({ "is-active": D(r).path === e.path }),
|
|
2168
|
-
onClick: (t) =>
|
|
2169
|
-
}, E(D(
|
|
2170
|
-
s("nav", { class: h(["ca-side__rail", { "is-compact":
|
|
2473
|
+
onClick: (t) => ce(e.path)
|
|
2474
|
+
}, E(D(g)(e.title)), 11, wr))), 128))], 8, Cr)) : a("v-if", !0),
|
|
2475
|
+
s("nav", { class: h(["ca-side__rail", { "is-compact": C.value }]) }, [
|
|
2171
2476
|
a(" 入口列表单独滚动;底部工具按钮固定在外面,窗口再矮也不会被挤出屏幕 "),
|
|
2172
|
-
s("div",
|
|
2477
|
+
s("div", Tr, [M.value ? (y(), o("button", {
|
|
2173
2478
|
key: 0,
|
|
2174
2479
|
type: "button",
|
|
2175
|
-
class: h(["ca-side__rail-item", { "is-active":
|
|
2176
|
-
"aria-current":
|
|
2177
|
-
title:
|
|
2178
|
-
onClick: n[0] ||= (e) =>
|
|
2179
|
-
}, [u(c, { name: "home" }),
|
|
2480
|
+
class: h(["ca-side__rail-item", { "is-active": R.value }]),
|
|
2481
|
+
"aria-current": R.value ? "page" : void 0,
|
|
2482
|
+
title: D(p)("campus.side.home"),
|
|
2483
|
+
onClick: n[0] ||= (e) => ce(M.value.path)
|
|
2484
|
+
}, [u(c, { name: "home" }), P(s("span", { class: "ca-side__rail-text" }, E(D(p)("campus.side.home")), 513), [[A, !C.value || D(f).mobileMenuOpen]])], 10, Er)) : a("v-if", !0), (y(!0), o(e, null, S(F.value, (e) => (y(), o("button", {
|
|
2180
2485
|
key: e.key,
|
|
2181
2486
|
type: "button",
|
|
2182
|
-
class: h(["ca-side__rail-item", {
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2487
|
+
class: h(["ca-side__rail-item", {
|
|
2488
|
+
"is-active": e.path === D(r).path,
|
|
2489
|
+
"is-ancestor": e.key === z.value?.key && e.path !== D(r).path
|
|
2490
|
+
}]),
|
|
2491
|
+
"aria-current": e.path === D(r).path ? "page" : void 0,
|
|
2492
|
+
"aria-expanded": e.children.length ? e.key === z.value?.key && !ee.value : void 0,
|
|
2493
|
+
title: D(g)(e.title),
|
|
2494
|
+
onClick: (t) => ae(e.key)
|
|
2186
2495
|
}, [
|
|
2187
2496
|
u(c, {
|
|
2188
2497
|
name: e.icon,
|
|
2189
2498
|
fallback: "grid"
|
|
2190
2499
|
}, null, 8, ["name"]),
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
], 10,
|
|
2194
|
-
s("div",
|
|
2500
|
+
P(s("span", { class: "ca-side__rail-text" }, E(D(g)(e.title)), 513), [[A, !C.value || D(f).mobileMenuOpen]]),
|
|
2501
|
+
ne(e) ? (y(), o("span", Or, E(ne(e)), 1)) : a("v-if", !0)
|
|
2502
|
+
], 10, Dr))), 128))]),
|
|
2503
|
+
s("div", kr, [
|
|
2195
2504
|
s("button", {
|
|
2196
2505
|
type: "button",
|
|
2197
2506
|
class: "ca-side__tool",
|
|
2198
|
-
title:
|
|
2199
|
-
"aria-label":
|
|
2200
|
-
"aria-pressed":
|
|
2201
|
-
onClick:
|
|
2507
|
+
title: C.value ? D(p)("campus.side.showText") : D(p)("campus.side.hideText"),
|
|
2508
|
+
"aria-label": C.value ? D(p)("campus.side.showText") : D(p)("campus.side.hideText"),
|
|
2509
|
+
"aria-pressed": C.value,
|
|
2510
|
+
onClick: T
|
|
2202
2511
|
}, [u(c, {
|
|
2203
|
-
name:
|
|
2512
|
+
name: C.value ? "view" : "hide",
|
|
2204
2513
|
size: 18
|
|
2205
|
-
}, null, 8, ["name"])], 8,
|
|
2514
|
+
}, null, 8, ["name"])], 8, Ar),
|
|
2206
2515
|
s("button", {
|
|
2207
2516
|
type: "button",
|
|
2208
2517
|
class: "ca-side__tool ca-side__tool--collapse",
|
|
2209
|
-
title:
|
|
2210
|
-
"aria-label":
|
|
2211
|
-
"aria-expanded": !
|
|
2212
|
-
onClick:
|
|
2518
|
+
title: v.value ? D(p)("campus.side.expand") : D(p)("campus.side.collapse"),
|
|
2519
|
+
"aria-label": v.value ? D(p)("campus.side.expand") : D(p)("campus.side.collapse"),
|
|
2520
|
+
"aria-expanded": !v.value,
|
|
2521
|
+
onClick: b
|
|
2213
2522
|
}, [u(c, {
|
|
2214
|
-
name:
|
|
2523
|
+
name: v.value ? "expand" : "fold",
|
|
2215
2524
|
size: 18
|
|
2216
|
-
}, null, 8, ["name"])], 8,
|
|
2217
|
-
u(
|
|
2525
|
+
}, null, 8, ["name"])], 8, jr),
|
|
2526
|
+
u(k, {
|
|
2218
2527
|
trigger: "click",
|
|
2219
2528
|
placement: "right-end",
|
|
2220
|
-
onCommand:
|
|
2529
|
+
onCommand: O
|
|
2221
2530
|
}, {
|
|
2222
|
-
dropdown:
|
|
2223
|
-
default:
|
|
2531
|
+
dropdown: N(() => [u(x, null, {
|
|
2532
|
+
default: N(() => [D(_).accountEntry?.side !== !1 && (D(_).accountPath || D(_).onAccountClick) ? (y(), i(m, {
|
|
2224
2533
|
key: 0,
|
|
2225
2534
|
command: "account"
|
|
2226
2535
|
}, {
|
|
2227
|
-
default:
|
|
2536
|
+
default: N(() => [l(E(D(p)("campus.header.myAccount")), 1)]),
|
|
2228
2537
|
_: 1
|
|
2229
|
-
})) : a("v-if", !0), u(
|
|
2538
|
+
})) : a("v-if", !0), u(m, {
|
|
2230
2539
|
command: "logout",
|
|
2231
2540
|
divided: ""
|
|
2232
2541
|
}, {
|
|
2233
|
-
default:
|
|
2542
|
+
default: N(() => [l(E(D(p)("campus.header.logout")), 1)]),
|
|
2234
2543
|
_: 1
|
|
2235
2544
|
})]),
|
|
2236
2545
|
_: 1
|
|
2237
2546
|
})]),
|
|
2238
|
-
default:
|
|
2547
|
+
default: N(() => [s("button", {
|
|
2239
2548
|
type: "button",
|
|
2240
2549
|
class: "ca-side__tool",
|
|
2241
2550
|
title: D(d).user?.name,
|
|
2242
2551
|
"aria-label": D(d).user?.name
|
|
2243
|
-
}, [u(
|
|
2552
|
+
}, [u(mn, {
|
|
2244
2553
|
class: "ca-side__avatar",
|
|
2245
2554
|
name: D(d).user?.name,
|
|
2246
2555
|
src: D(d).user?.avatar
|
|
2247
|
-
}, null, 8, ["name", "src"])], 8,
|
|
2556
|
+
}, null, 8, ["name", "src"])], 8, Mr)]),
|
|
2248
2557
|
_: 1
|
|
2249
2558
|
})
|
|
2250
2559
|
])
|
|
2251
2560
|
], 2),
|
|
2252
2561
|
a(" 第二栏:隐藏时宽度渐变到 0(而不是直接消失),首页与其他页之间切换时内容区不会突然跳动 "),
|
|
2253
2562
|
s("div", {
|
|
2254
|
-
class: h(["ca-side__panel", {
|
|
2563
|
+
class: h(["ca-side__panel", {
|
|
2564
|
+
"is-hidden": ee.value,
|
|
2565
|
+
"is-empty": !z.value?.children.length
|
|
2566
|
+
}]),
|
|
2255
2567
|
inert: ee.value && !D(f).mobileMenuOpen
|
|
2256
|
-
}, [s("div",
|
|
2257
|
-
|
|
2568
|
+
}, [s("div", Pr, [
|
|
2569
|
+
B.value ? (y(), o("div", Fr, E(D(g)(B.value.title)), 1)) : a("v-if", !0),
|
|
2258
2570
|
a(" key 绑定场景:切换场景时重建菜单,展开状态不会串到别的场景 "),
|
|
2259
|
-
(y(), i(
|
|
2260
|
-
|
|
2571
|
+
(y(), i(L, {
|
|
2572
|
+
ref_key: "menuRef",
|
|
2573
|
+
ref: re,
|
|
2574
|
+
key: B.value?.key,
|
|
2261
2575
|
"default-active": D(r).path,
|
|
2262
|
-
"default-openeds":
|
|
2576
|
+
"default-openeds": ie.value,
|
|
2263
2577
|
router: "",
|
|
2264
2578
|
class: "ca-side__menu",
|
|
2265
|
-
onSelect: n[1] ||= (e) => D(f).closeOverlays()
|
|
2579
|
+
onSelect: n[1] ||= (e) => D(f).closeOverlays(),
|
|
2580
|
+
onOpen: n[2] ||= (e) => U(e, !0),
|
|
2581
|
+
onClose: n[3] ||= (e) => U(e, !1)
|
|
2266
2582
|
}, {
|
|
2267
|
-
default:
|
|
2583
|
+
default: N(() => [(y(!0), o(e, null, S(B.value?.children ?? [], (t) => (y(), o(e, { key: t.key }, [a(" 二级是菜单组:可展开,下面是三级页面 "), D(ke)(t) && t.children.length ? (y(), i(I, {
|
|
2268
2584
|
key: 0,
|
|
2269
|
-
index: t.key
|
|
2585
|
+
index: t.key,
|
|
2586
|
+
tabindex: "0",
|
|
2587
|
+
class: h({
|
|
2588
|
+
"is-current-page": t.path === D(r).path,
|
|
2589
|
+
"is-ancestor": D(r).meta.groupKey === t.key && t.path !== D(r).path
|
|
2590
|
+
}),
|
|
2591
|
+
"aria-current": t.path === D(r).path ? "page" : void 0,
|
|
2592
|
+
onClickCapture: (e) => oe(e, t),
|
|
2593
|
+
onKeydownCapture: (e) => oe(e, t)
|
|
2270
2594
|
}, {
|
|
2271
|
-
title:
|
|
2595
|
+
title: N(() => [s("span", Ir, [
|
|
2272
2596
|
t.icon ? (y(), i(c, {
|
|
2273
2597
|
key: 0,
|
|
2274
2598
|
name: t.icon
|
|
2275
2599
|
}, null, 8, ["name"])) : a("v-if", !0),
|
|
2276
|
-
s("span", null, E(D(
|
|
2277
|
-
|
|
2278
|
-
]),
|
|
2279
|
-
default:
|
|
2600
|
+
s("span", null, E(D(g)(t.title)), 1),
|
|
2601
|
+
V(t) ? (y(), o("span", Lr, E(V(t)), 1)) : a("v-if", !0)
|
|
2602
|
+
])]),
|
|
2603
|
+
default: N(() => [(y(!0), o(e, null, S(t.children, (e) => (y(), i(j, {
|
|
2280
2604
|
class: "ca-side__submenu-item",
|
|
2281
2605
|
key: e.key,
|
|
2282
|
-
index: e.path
|
|
2606
|
+
index: e.path,
|
|
2607
|
+
"aria-current": e.path === D(r).path ? "page" : void 0
|
|
2283
2608
|
}, {
|
|
2284
|
-
default:
|
|
2609
|
+
default: N(() => [e.icon ? (y(), i(c, {
|
|
2285
2610
|
key: 0,
|
|
2286
2611
|
name: e.icon
|
|
2287
|
-
}, null, 8, ["name"])) : a("v-if", !0), s("span", null, E(D(
|
|
2612
|
+
}, null, 8, ["name"])) : a("v-if", !0), s("span", null, E(D(g)(e.title)), 1)]),
|
|
2288
2613
|
_: 2
|
|
2289
|
-
}, 1032, ["index"]))), 128))]),
|
|
2614
|
+
}, 1032, ["index", "aria-current"]))), 128))]),
|
|
2290
2615
|
_: 2
|
|
2291
|
-
}, 1032, [
|
|
2292
|
-
|
|
2616
|
+
}, 1032, [
|
|
2617
|
+
"index",
|
|
2618
|
+
"class",
|
|
2619
|
+
"aria-current",
|
|
2620
|
+
"onClickCapture",
|
|
2621
|
+
"onKeydownCapture"
|
|
2622
|
+
])) : (y(), o(e, { key: 1 }, [a(" 二级直接是页面 "), u(j, {
|
|
2623
|
+
index: t.path,
|
|
2624
|
+
"aria-current": t.path === D(r).path ? "page" : void 0
|
|
2625
|
+
}, {
|
|
2626
|
+
default: N(() => [t.icon ? (y(), i(c, {
|
|
2293
2627
|
key: 0,
|
|
2294
2628
|
name: t.icon
|
|
2295
|
-
}, null, 8, ["name"])) : a("v-if", !0), s("span", null, E(D(
|
|
2629
|
+
}, null, 8, ["name"])) : a("v-if", !0), s("span", null, E(D(g)(t.title)), 1)]),
|
|
2296
2630
|
_: 2
|
|
2297
|
-
}, 1032, ["index"])], 2112))], 64))), 128))]),
|
|
2631
|
+
}, 1032, ["index", "aria-current"])], 2112))], 64))), 128))]),
|
|
2298
2632
|
_: 1
|
|
2299
2633
|
}, 8, ["default-active", "default-openeds"]))
|
|
2300
|
-
])], 10,
|
|
2634
|
+
])], 10, Nr)
|
|
2301
2635
|
], 2)], 2112);
|
|
2302
2636
|
};
|
|
2303
2637
|
}
|
|
2304
|
-
}), [["__scopeId", "data-v-
|
|
2638
|
+
}), [["__scopeId", "data-v-54cb2f14"]]), zr = {
|
|
2305
2639
|
key: 0,
|
|
2306
2640
|
class: "ca-copyright"
|
|
2307
|
-
},
|
|
2641
|
+
}, Br = ["href"], Vr = /*#__PURE__*/ Z(/* @__PURE__ */ d({
|
|
2308
2642
|
__name: "CaCopyright",
|
|
2309
2643
|
setup(t) {
|
|
2310
|
-
let r =
|
|
2311
|
-
return (t, n) => c.value ? (y(), o("footer",
|
|
2644
|
+
let r = J().brand, { label: i } = q(), c = n(() => r.copyright ? We(i(r.copyright)) : ""), l = n(() => r.copyrightLinks ?? []);
|
|
2645
|
+
return (t, n) => c.value ? (y(), o("footer", zr, [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", {
|
|
2312
2646
|
class: "ca-copyright__dot",
|
|
2313
2647
|
"aria-hidden": "true"
|
|
2314
2648
|
}, "·", -1), s("a", {
|
|
2315
2649
|
href: t.href,
|
|
2316
2650
|
target: "_blank",
|
|
2317
2651
|
rel: "noopener noreferrer"
|
|
2318
|
-
}, E(t.text), 9,
|
|
2652
|
+
}, E(t.text), 9, Br)], 64))), 128))])) : a("v-if", !0);
|
|
2319
2653
|
}
|
|
2320
|
-
}), [["__scopeId", "data-v-c51879e8"]]),
|
|
2654
|
+
}), [["__scopeId", "data-v-c51879e8"]]), Hr = { class: "ca-tabs" }, Ur = ["onClick"], Wr = { class: "ca-tabs__more" }, Gr = [
|
|
2321
2655
|
"title",
|
|
2322
2656
|
"aria-label",
|
|
2323
2657
|
"aria-pressed"
|
|
2324
|
-
],
|
|
2658
|
+
], Kr = /*#__PURE__*/ Z(/* @__PURE__ */ d({
|
|
2325
2659
|
__name: "TabsBar",
|
|
2326
2660
|
setup(t) {
|
|
2327
|
-
let r =
|
|
2661
|
+
let r = W(), c = G(), d = gt(), f = ft(), { t: p, label: g } = q(), _ = new Map(Pe(J().menus).map((e) => [e.key, e])), b = n(() => d.visited.map((e) => _.get(e)).filter((e) => !!e).map((e) => ({
|
|
2328
2662
|
key: e.key,
|
|
2329
2663
|
path: e.path,
|
|
2330
2664
|
title: g(e.title),
|
|
@@ -2348,27 +2682,27 @@ var Gt = {
|
|
|
2348
2682
|
});
|
|
2349
2683
|
});
|
|
2350
2684
|
}
|
|
2351
|
-
|
|
2352
|
-
function
|
|
2685
|
+
j([C, () => b.value.length], k), v(k);
|
|
2686
|
+
function A(e) {
|
|
2353
2687
|
let t = d.close(e);
|
|
2354
2688
|
if (e !== C.value) return;
|
|
2355
2689
|
let n = t ? _.get(t)?.path : void 0;
|
|
2356
2690
|
c.push(n ?? "/");
|
|
2357
2691
|
}
|
|
2358
|
-
let
|
|
2692
|
+
let M = n(() => {
|
|
2359
2693
|
let e = d.visited.indexOf(C.value ?? "");
|
|
2360
2694
|
return d.visited.some((t, n) => n < e && !d.affixKeys.includes(t));
|
|
2361
|
-
}),
|
|
2695
|
+
}), P = n(() => {
|
|
2362
2696
|
let e = d.visited.indexOf(C.value ?? "");
|
|
2363
2697
|
return e !== -1 && d.visited.some((t, n) => n > e && !d.affixKeys.includes(t));
|
|
2364
2698
|
});
|
|
2365
2699
|
function I(e) {
|
|
2366
2700
|
let t = C.value;
|
|
2367
|
-
e === "closeAll" ? (d.closeAll(), c.push(_.get(d.affixKeys[0] ?? "")?.path ?? "/")) : t && (e === "close" ?
|
|
2701
|
+
e === "closeAll" ? (d.closeAll(), c.push(_.get(d.affixKeys[0] ?? "")?.path ?? "/")) : t && (e === "close" ? A(t) : e === "closeLeft" ? d.closeLeft(t) : e === "closeRight" ? d.closeRight(t) : d.closeOthers(t));
|
|
2368
2702
|
}
|
|
2369
2703
|
return (t, n) => {
|
|
2370
2704
|
let r = w("ca-icon"), d = w("ca-dropdown-item"), m = w("ca-dropdown-menu"), g = w("ca-dropdown");
|
|
2371
|
-
return y(), o("div",
|
|
2705
|
+
return y(), o("div", Hr, [
|
|
2372
2706
|
(y(!0), o(e, null, S(T.value, (t) => (y(), o("div", {
|
|
2373
2707
|
key: t.name,
|
|
2374
2708
|
ref_for: !0,
|
|
@@ -2390,45 +2724,45 @@ var Gt = {
|
|
|
2390
2724
|
key: 1,
|
|
2391
2725
|
name: "close",
|
|
2392
2726
|
class: "ca-tabs__close",
|
|
2393
|
-
onClick:
|
|
2727
|
+
onClick: F((t) => A(e.key), ["stop"])
|
|
2394
2728
|
}, null, 8, ["onClick"])) : a("v-if", !0)
|
|
2395
|
-
], 10,
|
|
2729
|
+
], 10, Ur))), 128))], 2))), 128)),
|
|
2396
2730
|
u(g, {
|
|
2397
2731
|
trigger: "click",
|
|
2398
2732
|
onCommand: I
|
|
2399
2733
|
}, {
|
|
2400
|
-
dropdown:
|
|
2401
|
-
default:
|
|
2734
|
+
dropdown: N(() => [u(m, null, {
|
|
2735
|
+
default: N(() => [
|
|
2402
2736
|
u(d, { command: "close" }, {
|
|
2403
|
-
default:
|
|
2737
|
+
default: N(() => [l(E(D(p)("campus.tabs.close")), 1)]),
|
|
2404
2738
|
_: 1
|
|
2405
2739
|
}),
|
|
2406
|
-
|
|
2740
|
+
M.value ? (y(), i(d, {
|
|
2407
2741
|
key: 0,
|
|
2408
2742
|
command: "closeLeft"
|
|
2409
2743
|
}, {
|
|
2410
|
-
default:
|
|
2744
|
+
default: N(() => [l(E(D(p)("campus.tabs.closeLeft")), 1)]),
|
|
2411
2745
|
_: 1
|
|
2412
2746
|
})) : a("v-if", !0),
|
|
2413
|
-
|
|
2747
|
+
P.value ? (y(), i(d, {
|
|
2414
2748
|
key: 1,
|
|
2415
2749
|
command: "closeRight"
|
|
2416
2750
|
}, {
|
|
2417
|
-
default:
|
|
2751
|
+
default: N(() => [l(E(D(p)("campus.tabs.closeRight")), 1)]),
|
|
2418
2752
|
_: 1
|
|
2419
2753
|
})) : a("v-if", !0),
|
|
2420
2754
|
u(d, { command: "closeOthers" }, {
|
|
2421
|
-
default:
|
|
2755
|
+
default: N(() => [l(E(D(p)("campus.tabs.closeOthers")), 1)]),
|
|
2422
2756
|
_: 1
|
|
2423
2757
|
}),
|
|
2424
2758
|
u(d, { command: "closeAll" }, {
|
|
2425
|
-
default:
|
|
2759
|
+
default: N(() => [l(E(D(p)("campus.tabs.closeAll")), 1)]),
|
|
2426
2760
|
_: 1
|
|
2427
2761
|
})
|
|
2428
2762
|
]),
|
|
2429
2763
|
_: 1
|
|
2430
2764
|
})]),
|
|
2431
|
-
default:
|
|
2765
|
+
default: N(() => [s("span", Wr, [u(r, { name: "arrowDown" })])]),
|
|
2432
2766
|
_: 1
|
|
2433
2767
|
}),
|
|
2434
2768
|
a(" 内容全屏:隐藏头部和侧栏,再点一次恢复 "),
|
|
@@ -2439,25 +2773,25 @@ var Gt = {
|
|
|
2439
2773
|
"aria-label": D(f).contentFullscreen ? D(p)("campus.tabs.exitFullscreen") : D(p)("campus.tabs.fullscreen"),
|
|
2440
2774
|
"aria-pressed": D(f).contentFullscreen,
|
|
2441
2775
|
onClick: n[0] ||= (e) => D(f).toggleContentFullscreen()
|
|
2442
|
-
}, [u(r, { name: D(f).contentFullscreen ? "exitFullscreen" : "fullscreen" }, null, 8, ["name"])], 8,
|
|
2776
|
+
}, [u(r, { name: D(f).contentFullscreen ? "exitFullscreen" : "fullscreen" }, null, 8, ["name"])], 8, Gr)
|
|
2443
2777
|
]);
|
|
2444
2778
|
};
|
|
2445
2779
|
}
|
|
2446
|
-
}), [["__scopeId", "data-v-1d7ba823"]]),
|
|
2780
|
+
}), [["__scopeId", "data-v-1d7ba823"]]), qr = 1200, Jr = "(max-width: 768px)", Yr = `(min-width: 769px) and (max-width: ${qr}px)`, Xr = ["aria-label"], Zr = ["aria-label"], Qr = { class: "ca-main" }, $r = {
|
|
2447
2781
|
key: 0,
|
|
2448
2782
|
class: "ca-screen-prompt",
|
|
2449
2783
|
role: "status"
|
|
2450
|
-
},
|
|
2784
|
+
}, ei = { class: "ca-content" }, ti = { class: "ca-content__page" }, ni = /*#__PURE__*/ Z(/* @__PURE__ */ d({
|
|
2451
2785
|
__name: "CaLayout",
|
|
2452
2786
|
setup(e) {
|
|
2453
|
-
let n =
|
|
2787
|
+
let n = W(), r = gt(), c = ft(), { t: d } = q(), f = window.matchMedia(Jr), p = window.matchMedia(Yr), m = "";
|
|
2454
2788
|
function g() {
|
|
2455
2789
|
let e = f.matches ? "phone" : p.matches ? "pad" : "desktop";
|
|
2456
2790
|
c.setMode(e);
|
|
2457
2791
|
}
|
|
2458
|
-
g(),
|
|
2792
|
+
g(), j(() => c.mode === "phone" && c.mobileMenuOpen, (e) => {
|
|
2459
2793
|
e ? (m = document.body.style.overflow, document.body.style.overflow = "hidden") : document.body.style.overflow = m;
|
|
2460
|
-
}),
|
|
2794
|
+
}), j(() => n.fullPath, () => c.closeOverlays());
|
|
2461
2795
|
function b(e) {
|
|
2462
2796
|
e.key === "Escape" && (c.mobileMenuOpen || c.padPanelOpen ? c.closeOverlays() : c.contentFullscreen && c.toggleContentFullscreen());
|
|
2463
2797
|
}
|
|
@@ -2472,212 +2806,261 @@ var Gt = {
|
|
|
2472
2806
|
}
|
|
2473
2807
|
return (e, n) => {
|
|
2474
2808
|
let f = w("ca-button"), p = w("router-view");
|
|
2475
|
-
return y(), o("div", { class: h(["ca-shell", { "is-fullscreen": D(c).contentFullscreen }]) }, [
|
|
2809
|
+
return y(), o("div", { class: h(["ca-shell", { "is-fullscreen": D(c).contentFullscreen }]) }, [P(u(fr, null, null, 512), [[A, !D(c).contentFullscreen]]), s("div", { class: h(["ca-body", { "is-fullscreen": D(c).contentFullscreen }]) }, [
|
|
2476
2810
|
D(c).mode === "phone" && D(c).mobileMenuOpen ? (y(), o("button", {
|
|
2477
2811
|
key: 0,
|
|
2478
2812
|
type: "button",
|
|
2479
2813
|
class: "ca-mobile-scrim",
|
|
2480
2814
|
"aria-label": D(d)("campus.side.closeMenu"),
|
|
2481
2815
|
onClick: n[0] ||= (e) => D(c).closeMobileMenu()
|
|
2482
|
-
}, null, 8,
|
|
2816
|
+
}, null, 8, Xr)) : a("v-if", !0),
|
|
2483
2817
|
D(c).mode === "pad" && D(c).padPanelOpen ? (y(), o("button", {
|
|
2484
2818
|
key: 1,
|
|
2485
2819
|
type: "button",
|
|
2486
2820
|
class: "ca-pad-scrim",
|
|
2487
2821
|
"aria-label": D(d)("campus.side.closeMenu"),
|
|
2488
2822
|
onClick: n[1] ||= (e) => D(c).closePadPanel()
|
|
2489
|
-
}, null, 8,
|
|
2823
|
+
}, null, 8, Zr)) : a("v-if", !0),
|
|
2490
2824
|
a(" 手机抽屉关闭时、电脑档两栏都收起时,侧栏不在屏幕上,不可聚焦 "),
|
|
2491
|
-
|
|
2825
|
+
P(u(Rr, {
|
|
2492
2826
|
class: h({ "is-mobile-open": D(c).mobileMenuOpen }),
|
|
2493
2827
|
inert: D(c).mode === "phone" && !D(c).mobileMenuOpen || D(c).sideHiddenActive
|
|
2494
|
-
}, null, 8, ["class", "inert"]), [[
|
|
2495
|
-
s("main",
|
|
2496
|
-
u(
|
|
2497
|
-
u(
|
|
2498
|
-
D(c).pageScreenPrompt ? (y(), o("div",
|
|
2828
|
+
}, null, 8, ["class", "inert"]), [[A, !D(c).contentFullscreen]]),
|
|
2829
|
+
s("main", Qr, [
|
|
2830
|
+
u(Kr),
|
|
2831
|
+
u(vr),
|
|
2832
|
+
D(c).pageScreenPrompt ? (y(), o("div", $r, [u(f, {
|
|
2499
2833
|
size: "small",
|
|
2500
2834
|
onClick: n[2] ||= (e) => D(c).retryPageScreen()
|
|
2501
2835
|
}, {
|
|
2502
|
-
default:
|
|
2836
|
+
default: N(() => [l(E(D(d)("campus.tabs.enterScreen")), 1)]),
|
|
2503
2837
|
_: 1
|
|
2504
2838
|
}), u(f, {
|
|
2505
2839
|
size: "small",
|
|
2506
2840
|
"aria-label": D(d)("campus.tabs.dismissScreen"),
|
|
2507
2841
|
onClick: n[3] ||= (e) => D(c).dismissPageScreenPrompt()
|
|
2508
2842
|
}, {
|
|
2509
|
-
default:
|
|
2843
|
+
default: N(() => [l(E(D(d)("campus.tabs.dismissScreen")), 1)]),
|
|
2510
2844
|
_: 1
|
|
2511
2845
|
}, 8, ["aria-label"])])) : a("v-if", !0),
|
|
2512
|
-
s("div",
|
|
2513
|
-
u(
|
|
2846
|
+
s("div", ei, [
|
|
2847
|
+
u(Sr),
|
|
2514
2848
|
a(" 页面区撑满剩余高度,版权在其后:内容少时贴窗口底,内容长时滚到最底才出现 "),
|
|
2515
|
-
s("div",
|
|
2516
|
-
default:
|
|
2849
|
+
s("div", ti, [u(p, null, {
|
|
2850
|
+
default: N(({ Component: e }) => [a(" include 与标签名单同步;缓存容量包含固定标签。 "), (y(), i(t, {
|
|
2517
2851
|
include: D(r).cached,
|
|
2518
2852
|
max: D(r).maxTabs + D(r).affixKeys.length
|
|
2519
2853
|
}, [e ? (y(), i(T(e), { key: x() })) : a("v-if", !0)], 1032, ["include", "max"]))]),
|
|
2520
2854
|
_: 1
|
|
2521
2855
|
})]),
|
|
2522
|
-
u(
|
|
2856
|
+
u(Vr)
|
|
2523
2857
|
])
|
|
2524
2858
|
])
|
|
2525
2859
|
], 2)], 2);
|
|
2526
2860
|
};
|
|
2527
2861
|
}
|
|
2528
|
-
}), [["__scopeId", "data-v-90594751"]]),
|
|
2862
|
+
}), [["__scopeId", "data-v-90594751"]]), ri = { class: "ca-exception" }, ii = { class: "ca-exception__code" }, ai = { class: "ca-exception__text" }, oi = /*#__PURE__*/ Z(/* @__PURE__ */ d({
|
|
2529
2863
|
__name: "ExceptionPage",
|
|
2530
2864
|
props: { kind: {} },
|
|
2531
2865
|
setup(e) {
|
|
2532
|
-
let t = e, r =
|
|
2866
|
+
let t = e, r = G(), i = Fe(J()).home, { t: a } = q(), c = n(() => t.kind === "forbidden" ? "403" : "404"), d = n(() => a(t.kind === "forbidden" ? "campus.error.forbidden" : "campus.error.notFound"));
|
|
2533
2867
|
return (e, t) => {
|
|
2534
2868
|
let n = w("ca-button");
|
|
2535
|
-
return y(), o("div",
|
|
2536
|
-
s("
|
|
2537
|
-
s("p",
|
|
2869
|
+
return y(), o("div", ri, [
|
|
2870
|
+
s("h1", ii, E(c.value), 1),
|
|
2871
|
+
s("p", ai, E(d.value), 1),
|
|
2538
2872
|
u(n, {
|
|
2539
2873
|
type: "primary",
|
|
2540
2874
|
onClick: t[0] ||= (e) => D(r).replace(D(i))
|
|
2541
2875
|
}, {
|
|
2542
|
-
default:
|
|
2876
|
+
default: N(() => [l(E(D(a)("campus.error.backHome")), 1)]),
|
|
2543
2877
|
_: 1
|
|
2544
2878
|
})
|
|
2545
2879
|
]);
|
|
2546
2880
|
};
|
|
2547
2881
|
}
|
|
2548
|
-
}), [["__scopeId", "data-v-
|
|
2882
|
+
}), [["__scopeId", "data-v-c6bc58c6"]]), si = { class: "ca-login" }, ci = { class: "ca-login__main" }, li = { class: "ca-card ca-login__card" }, ui = { class: "ca-login__brand" }, di = ["src"], fi = { class: "ca-login__name" }, pi = {
|
|
2549
2883
|
key: 1,
|
|
2550
2884
|
class: "ca-login__subtitle"
|
|
2551
|
-
},
|
|
2885
|
+
}, mi = ["id"], hi = /*#__PURE__*/ Z(/* @__PURE__ */ d({
|
|
2552
2886
|
__name: "LoginPage",
|
|
2553
|
-
setup(
|
|
2554
|
-
let
|
|
2887
|
+
setup(t) {
|
|
2888
|
+
let r = W(), c = G(), d = Q(), f = Ue(), { t: p, label: h } = q(), g = J().brand, _ = n(() => h(f.theme.siteName ?? g.name)), v = n(() => f.theme.logo ?? g.logo), C = Ke(), T = b({
|
|
2555
2889
|
username: "",
|
|
2556
2890
|
password: "",
|
|
2557
2891
|
captcha: ""
|
|
2558
|
-
}),
|
|
2892
|
+
}), k = x(""), A = x([]), j = x(), M = x(!1), P = x(""), I = O(), L = n(() => [
|
|
2893
|
+
{
|
|
2894
|
+
key: "username",
|
|
2895
|
+
label: p("campus.login.username")
|
|
2896
|
+
},
|
|
2897
|
+
{
|
|
2898
|
+
key: "password",
|
|
2899
|
+
label: p("campus.login.password")
|
|
2900
|
+
},
|
|
2901
|
+
...C.captcha ? [{
|
|
2902
|
+
key: "captcha",
|
|
2903
|
+
label: p("campus.auth.captcha")
|
|
2904
|
+
}] : []
|
|
2905
|
+
].map((e) => {
|
|
2906
|
+
let t = j.value?.getField(e.key), n = `${I}-${e.key}`, r = t?.validateState === "error" ? t.validateMessage : "";
|
|
2907
|
+
return {
|
|
2908
|
+
...e,
|
|
2909
|
+
id: n,
|
|
2910
|
+
error: r,
|
|
2911
|
+
errorId: r ? `${n}-error` : void 0
|
|
2912
|
+
};
|
|
2913
|
+
})), R = n(() => ({
|
|
2559
2914
|
username: [{
|
|
2560
2915
|
required: !0,
|
|
2561
|
-
message:
|
|
2916
|
+
message: p("campus.login.required", { label: p("campus.login.username") }),
|
|
2562
2917
|
trigger: "blur"
|
|
2563
2918
|
}],
|
|
2564
2919
|
password: [{
|
|
2565
2920
|
required: !0,
|
|
2566
|
-
message:
|
|
2921
|
+
message: p("campus.login.required", { label: p("campus.login.password") }),
|
|
2567
2922
|
trigger: "blur"
|
|
2568
2923
|
}],
|
|
2569
|
-
captcha:
|
|
2924
|
+
captcha: C.captcha ? [{
|
|
2570
2925
|
required: !0,
|
|
2571
|
-
message:
|
|
2926
|
+
message: p("campus.auth.captchaRequired"),
|
|
2572
2927
|
trigger: "blur"
|
|
2573
2928
|
}] : []
|
|
2574
2929
|
}));
|
|
2575
|
-
async function
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2930
|
+
async function z() {
|
|
2931
|
+
if (!M.value) {
|
|
2932
|
+
P.value = "";
|
|
2933
|
+
try {
|
|
2934
|
+
await j.value?.validate();
|
|
2935
|
+
} catch {
|
|
2936
|
+
await m();
|
|
2937
|
+
let e = L.value.find((e) => e.error);
|
|
2938
|
+
e && document.getElementById(e.id)?.focus();
|
|
2939
|
+
return;
|
|
2940
|
+
}
|
|
2941
|
+
if (!M.value) {
|
|
2942
|
+
M.value = !0;
|
|
2943
|
+
try {
|
|
2944
|
+
await d.login({
|
|
2945
|
+
username: T.username,
|
|
2946
|
+
password: T.password,
|
|
2947
|
+
captcha: C.captcha ? {
|
|
2948
|
+
key: k.value,
|
|
2949
|
+
code: T.captcha
|
|
2950
|
+
} : void 0
|
|
2951
|
+
}), await c.replace(qe(r.query.redirect));
|
|
2952
|
+
} catch (e) {
|
|
2953
|
+
P.value = e instanceof Error && e.message ? e.message : p("campus.login.failed"), A.value[0]?.refresh();
|
|
2954
|
+
} finally {
|
|
2955
|
+
M.value = !1;
|
|
2956
|
+
}
|
|
2957
|
+
}
|
|
2595
2958
|
}
|
|
2596
2959
|
}
|
|
2597
|
-
return (
|
|
2598
|
-
let
|
|
2599
|
-
return y(), o("div",
|
|
2600
|
-
s("div",
|
|
2601
|
-
|
|
2960
|
+
return (t, n) => {
|
|
2961
|
+
let r = w("ca-alert"), c = w("ca-input"), d = w("ca-form-item"), f = w("ca-button"), m = w("ca-form");
|
|
2962
|
+
return y(), o("div", si, [s("main", ci, [s("div", li, [
|
|
2963
|
+
s("div", ui, [
|
|
2964
|
+
v.value ? (y(), o("img", {
|
|
2602
2965
|
key: 0,
|
|
2603
|
-
src:
|
|
2966
|
+
src: v.value,
|
|
2604
2967
|
alt: "",
|
|
2605
2968
|
class: "ca-login__logo"
|
|
2606
|
-
}, null, 8,
|
|
2607
|
-
s("h1",
|
|
2608
|
-
D(
|
|
2969
|
+
}, null, 8, di)) : a("v-if", !0),
|
|
2970
|
+
s("h1", fi, E(_.value), 1),
|
|
2971
|
+
D(g).subtitle ? (y(), o("p", pi, E(D(h)(D(g).subtitle)), 1)) : a("v-if", !0)
|
|
2609
2972
|
]),
|
|
2610
|
-
|
|
2973
|
+
P.value ? (y(), i(r, {
|
|
2611
2974
|
key: 0,
|
|
2612
|
-
title:
|
|
2975
|
+
title: P.value,
|
|
2613
2976
|
type: "error",
|
|
2614
2977
|
"show-icon": "",
|
|
2615
2978
|
closable: !1,
|
|
2616
2979
|
class: "ca-login__error"
|
|
2617
2980
|
}, null, 8, ["title"])) : a("v-if", !0),
|
|
2618
|
-
u(
|
|
2981
|
+
u(m, {
|
|
2619
2982
|
ref_key: "formRef",
|
|
2620
|
-
ref:
|
|
2621
|
-
model:
|
|
2622
|
-
rules:
|
|
2983
|
+
ref: j,
|
|
2984
|
+
model: T,
|
|
2985
|
+
rules: R.value,
|
|
2623
2986
|
size: "large",
|
|
2624
|
-
|
|
2625
|
-
|
|
2987
|
+
"label-position": "top",
|
|
2988
|
+
"hide-required-asterisk": "",
|
|
2989
|
+
class: "ca-auth-form ca-login__form",
|
|
2990
|
+
onSubmit: F(z, ["prevent"])
|
|
2626
2991
|
}, {
|
|
2627
|
-
default:
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
}),
|
|
2637
|
-
u(c, { prop: "password" }, {
|
|
2638
|
-
default: M(() => [u(r, {
|
|
2639
|
-
modelValue: v.password,
|
|
2640
|
-
"onUpdate:modelValue": t[1] ||= (e) => v.password = e,
|
|
2641
|
-
type: "password",
|
|
2642
|
-
"show-password": "",
|
|
2643
|
-
placeholder: D(f)("campus.login.password"),
|
|
2644
|
-
autocomplete: "current-password"
|
|
2645
|
-
}, null, 8, ["modelValue", "placeholder"])]),
|
|
2646
|
-
_: 1
|
|
2647
|
-
}),
|
|
2648
|
-
D(_).captcha ? (y(), i(c, {
|
|
2992
|
+
default: N(() => [(y(!0), o(e, null, S(L.value, (e) => (y(), i(d, {
|
|
2993
|
+
key: e.key,
|
|
2994
|
+
prop: e.key,
|
|
2995
|
+
label: e.label,
|
|
2996
|
+
for: e.id,
|
|
2997
|
+
"show-message": !1,
|
|
2998
|
+
class: "ca-login__field"
|
|
2999
|
+
}, {
|
|
3000
|
+
default: N(() => [e.key === "captcha" ? (y(), i(wt, {
|
|
2649
3001
|
key: 0,
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
3002
|
+
ref_for: !0,
|
|
3003
|
+
ref_key: "captchaFields",
|
|
3004
|
+
ref: A,
|
|
3005
|
+
code: T.captcha,
|
|
3006
|
+
"onUpdate:code": n[0] ||= (e) => T.captcha = e,
|
|
3007
|
+
"captcha-key": k.value,
|
|
3008
|
+
"onUpdate:captchaKey": n[1] ||= (e) => k.value = e,
|
|
3009
|
+
scene: "login",
|
|
3010
|
+
"input-id": e.id,
|
|
3011
|
+
"input-error-id": e.errorId
|
|
3012
|
+
}, null, 8, [
|
|
3013
|
+
"code",
|
|
3014
|
+
"captcha-key",
|
|
3015
|
+
"input-id",
|
|
3016
|
+
"input-error-id"
|
|
3017
|
+
])) : (y(), i(c, {
|
|
3018
|
+
key: 1,
|
|
3019
|
+
id: e.id,
|
|
3020
|
+
modelValue: T[e.key],
|
|
3021
|
+
"onUpdate:modelValue": (t) => T[e.key] = t,
|
|
3022
|
+
class: "ca-login__input",
|
|
3023
|
+
type: e.key === "password" ? "password" : "text",
|
|
3024
|
+
"show-password": e.key === "password",
|
|
3025
|
+
autocomplete: e.key === "password" ? "current-password" : "username",
|
|
3026
|
+
"aria-invalid": e.error ? "true" : void 0,
|
|
3027
|
+
"aria-describedby": e.errorId
|
|
3028
|
+
}, null, 8, [
|
|
3029
|
+
"id",
|
|
3030
|
+
"modelValue",
|
|
3031
|
+
"onUpdate:modelValue",
|
|
3032
|
+
"type",
|
|
3033
|
+
"show-password",
|
|
3034
|
+
"autocomplete",
|
|
3035
|
+
"aria-invalid",
|
|
3036
|
+
"aria-describedby"
|
|
3037
|
+
])), e.error ? (y(), o("p", {
|
|
3038
|
+
key: 2,
|
|
3039
|
+
id: e.errorId,
|
|
3040
|
+
class: "ca-login__field-error"
|
|
3041
|
+
}, E(e.error), 9, mi)) : a("v-if", !0)]),
|
|
3042
|
+
_: 2
|
|
3043
|
+
}, 1032, [
|
|
3044
|
+
"prop",
|
|
3045
|
+
"label",
|
|
3046
|
+
"for"
|
|
3047
|
+
]))), 128)), u(f, {
|
|
3048
|
+
type: "primary",
|
|
3049
|
+
"native-type": "submit",
|
|
3050
|
+
loading: M.value,
|
|
3051
|
+
class: "ca-login__submit"
|
|
3052
|
+
}, {
|
|
3053
|
+
default: N(() => [l(E(D(p)("campus.login.submit")), 1)]),
|
|
3054
|
+
_: 1
|
|
3055
|
+
}, 8, ["loading"])]),
|
|
2673
3056
|
_: 1
|
|
2674
3057
|
}, 8, ["model", "rules"])
|
|
2675
|
-
])]), u(
|
|
3058
|
+
])]), u(Vr, { class: "ca-login__copyright" })]);
|
|
2676
3059
|
};
|
|
2677
3060
|
}
|
|
2678
|
-
}), [["__scopeId", "data-v-
|
|
3061
|
+
}), [["__scopeId", "data-v-163d1aec"]]);
|
|
2679
3062
|
// packages/core/src/router.ts
|
|
2680
|
-
function
|
|
3063
|
+
function gi(e) {
|
|
2681
3064
|
return async () => {
|
|
2682
3065
|
let t = await e.component();
|
|
2683
3066
|
return d({
|
|
@@ -2686,17 +3069,17 @@ function Kr(e) {
|
|
|
2686
3069
|
});
|
|
2687
3070
|
};
|
|
2688
3071
|
}
|
|
2689
|
-
var
|
|
3072
|
+
var _i = d({
|
|
2690
3073
|
name: "CaForbidden",
|
|
2691
|
-
setup: () => () => f(
|
|
2692
|
-
}),
|
|
3074
|
+
setup: () => () => f(oi, { kind: "forbidden" })
|
|
3075
|
+
}), vi = d({
|
|
2693
3076
|
name: "CaNotFound",
|
|
2694
|
-
setup: () => () => f(
|
|
3077
|
+
setup: () => () => f(oi, { kind: "notFound" })
|
|
2695
3078
|
});
|
|
2696
|
-
function
|
|
2697
|
-
let n =
|
|
3079
|
+
function yi(e, t) {
|
|
3080
|
+
let n = Pe(e.menus);
|
|
2698
3081
|
if (!n.length) throw Error("[campus] 菜单里至少需要一个页面");
|
|
2699
|
-
let r =
|
|
3082
|
+
let r = Fe(e), i = Y(e);
|
|
2700
3083
|
if (new Set(Object.values(i)).size !== 5 || n.some((e) => Object.values(i).includes(e.key))) throw Error("[campus] 系统路由名称重复或与页面键冲突,请配置 routeNames");
|
|
2701
3084
|
for (let e of n) if ([
|
|
2702
3085
|
r.login,
|
|
@@ -2709,24 +3092,24 @@ function Yr(e, t) {
|
|
|
2709
3092
|
{
|
|
2710
3093
|
path: r.login,
|
|
2711
3094
|
name: i.login,
|
|
2712
|
-
component: e.login?.style === "split" ?
|
|
3095
|
+
component: e.login?.style === "split" ? Rt : hi,
|
|
2713
3096
|
meta: { public: !0 }
|
|
2714
3097
|
},
|
|
2715
3098
|
{
|
|
2716
3099
|
path: r.register,
|
|
2717
3100
|
name: i.register,
|
|
2718
|
-
component:
|
|
3101
|
+
component: on,
|
|
2719
3102
|
meta: { public: !0 }
|
|
2720
3103
|
},
|
|
2721
3104
|
{
|
|
2722
3105
|
path: r.forgot,
|
|
2723
3106
|
name: i.forgot,
|
|
2724
|
-
component:
|
|
3107
|
+
component: un,
|
|
2725
3108
|
meta: { public: !0 }
|
|
2726
3109
|
},
|
|
2727
3110
|
{
|
|
2728
3111
|
path: "/",
|
|
2729
|
-
component:
|
|
3112
|
+
component: ni,
|
|
2730
3113
|
redirect: n.some((e) => e.path === "/") ? void 0 : () => {
|
|
2731
3114
|
let e = Q(t);
|
|
2732
3115
|
return r.home === "/" ? n.find((t) => e.can(t.permission))?.path ?? r.forbidden : r.home;
|
|
@@ -2735,7 +3118,7 @@ function Yr(e, t) {
|
|
|
2735
3118
|
...n.map((e) => ({
|
|
2736
3119
|
path: e.path,
|
|
2737
3120
|
name: e.key,
|
|
2738
|
-
component:
|
|
3121
|
+
component: gi(e),
|
|
2739
3122
|
meta: {
|
|
2740
3123
|
pageKey: e.key,
|
|
2741
3124
|
appKey: e.appKey,
|
|
@@ -2748,12 +3131,12 @@ function Yr(e, t) {
|
|
|
2748
3131
|
{
|
|
2749
3132
|
path: r.forbidden,
|
|
2750
3133
|
name: i.forbidden,
|
|
2751
|
-
component:
|
|
3134
|
+
component: _i
|
|
2752
3135
|
},
|
|
2753
3136
|
{
|
|
2754
3137
|
path: r.notFound,
|
|
2755
3138
|
name: i.notFound,
|
|
2756
|
-
component:
|
|
3139
|
+
component: vi
|
|
2757
3140
|
},
|
|
2758
3141
|
...r.notFound === "/:pathMatch(.*)*" ? [] : [{
|
|
2759
3142
|
path: "/:pathMatch(.*)*",
|
|
@@ -2762,57 +3145,64 @@ function Yr(e, t) {
|
|
|
2762
3145
|
]
|
|
2763
3146
|
}
|
|
2764
3147
|
], o = re({
|
|
2765
|
-
history: e.history === "web" ?
|
|
3148
|
+
history: e.history === "web" ? U() : H(),
|
|
2766
3149
|
routes: a
|
|
2767
|
-
}), s =
|
|
3150
|
+
}), s = ft(t);
|
|
2768
3151
|
return o.beforeEach((e, n) => {
|
|
2769
3152
|
let a = Q(t);
|
|
2770
3153
|
return e.meta.public ? a.isLoggedIn && e.name === i.login ? { path: r.home } : !0 : a.isLoggedIn ? a.can(e.meta.permission) ? (e.path === n.path && n.matched.length || e.meta.openMode !== "screen" || s.preparePageScreen(), !0) : { name: i.forbidden } : {
|
|
2771
3154
|
name: i.login,
|
|
2772
3155
|
query: e.fullPath === r.home ? void 0 : { redirect: e.fullPath }
|
|
2773
3156
|
};
|
|
2774
|
-
}), o.afterEach((
|
|
2775
|
-
|
|
3157
|
+
}), o.afterEach((n, r, i) => {
|
|
3158
|
+
if (i) s.cancelPageScreen();
|
|
3159
|
+
else {
|
|
3160
|
+
if (n.path === r.path && r.matched.length || s.applyPageOpenMode(n.meta.openMode, n.meta.sideCollapse), n.path !== r.path || !r.matched.length) {
|
|
3161
|
+
let r = Ie(e, (e) => Q(t).can(e)).apps.find((e) => e.key === n.meta.appKey);
|
|
3162
|
+
s.enterParentPage(r?.path === n.path && r.children.length ? r.key : void 0, n.meta.openMode == null ? n.meta.sideCollapse === "panel" || n.meta.sideCollapse === "all" : n.meta.openMode !== "normal"), n.meta.groupKey && s.ensureMenuGroup(n.meta.groupKey);
|
|
3163
|
+
}
|
|
3164
|
+
n.meta.pageKey && gt(t).open(n.meta.pageKey);
|
|
3165
|
+
}
|
|
2776
3166
|
}), o.onError(() => s.cancelPageScreen()), o;
|
|
2777
3167
|
}
|
|
2778
3168
|
// packages/core/src/services/login.ts
|
|
2779
|
-
async function
|
|
2780
|
-
e.signIn(n), await t.replace(
|
|
3169
|
+
async function bi(e, t, n, r) {
|
|
3170
|
+
e.signIn(n), await t.replace(qe(r));
|
|
2781
3171
|
}
|
|
2782
3172
|
// packages/core/src/services/auth.ts
|
|
2783
|
-
var
|
|
2784
|
-
function
|
|
2785
|
-
|
|
3173
|
+
var xi, Si;
|
|
3174
|
+
function Ci(e, t) {
|
|
3175
|
+
xi = e, Si = t;
|
|
2786
3176
|
}
|
|
2787
|
-
async function
|
|
2788
|
-
if (
|
|
2789
|
-
let t = Q(
|
|
3177
|
+
async function wi(e) {
|
|
3178
|
+
if (J(), !xi || !Si) return;
|
|
3179
|
+
let t = Q(Si);
|
|
2790
3180
|
if (!t.isLoggedIn) return;
|
|
2791
|
-
t.expire(),
|
|
2792
|
-
let n =
|
|
2793
|
-
n.name !== "login" && await
|
|
2794
|
-
name:
|
|
2795
|
-
query: n.fullPath ===
|
|
3181
|
+
t.expire(), Yt.toast.warning(e || Ee("campus.auth.sessionExpired"));
|
|
3182
|
+
let n = xi.currentRoute.value;
|
|
3183
|
+
n.name !== "login" && await xi.replace({
|
|
3184
|
+
name: Y(J()).login,
|
|
3185
|
+
query: n.fullPath === Fe(J()).home ? void 0 : { redirect: n.fullPath }
|
|
2796
3186
|
});
|
|
2797
3187
|
}
|
|
2798
|
-
async function
|
|
2799
|
-
if (
|
|
2800
|
-
await
|
|
3188
|
+
async function Ti(e, t) {
|
|
3189
|
+
if (J(), !xi || !Si) throw Error("[campus] 应用尚未创建,无法完成登录");
|
|
3190
|
+
await bi(Q(Si), xi, e, t);
|
|
2801
3191
|
}
|
|
2802
3192
|
// packages/core/src/app.ts
|
|
2803
|
-
function
|
|
2804
|
-
|
|
2805
|
-
let t = r(
|
|
3193
|
+
function Ei(e) {
|
|
3194
|
+
Bt(e), je(e);
|
|
3195
|
+
let t = r(Oe), n = I();
|
|
2806
3196
|
t.use(n);
|
|
2807
|
-
let i =
|
|
3197
|
+
let i = we(e);
|
|
2808
3198
|
t.use(i);
|
|
2809
3199
|
let a = (e, t) => i.global.t(e, t ?? {});
|
|
2810
|
-
t.provide(
|
|
2811
|
-
let o =
|
|
2812
|
-
return
|
|
3200
|
+
t.provide(z, a), Ut(a), t.config.globalProperties.$ca = Yt, R(t), t.component("CaAuthPreview", dn);
|
|
3201
|
+
let o = yi(e, n);
|
|
3202
|
+
return Ci(o, n), t.use(o), Ue(n).boot(), t;
|
|
2813
3203
|
}
|
|
2814
3204
|
// packages/core/src/index.ts
|
|
2815
|
-
function
|
|
3205
|
+
function Di(e) {
|
|
2816
3206
|
return e;
|
|
2817
3207
|
}
|
|
2818
|
-
export {
|
|
3208
|
+
export { Yt as ca, Ti as completeLogin, Ei as createCampusApp, Di as defineMenus, wi as handleUnauthorized, zt as resolveEnvironment, Ee as t, q as useCampusT, ft as useLayoutStore, Q as useSessionStore, gt as useTabsStore, Ue as useThemeStore };
|