xto-fronted 0.9.3 → 0.9.5

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.
@@ -1,3268 +0,0 @@
1
- import { y as T, z as st, A as Me, B as rt, C as it, D as ct, E as ut, F as Te, p as yt, G as dt, H as bt, j as ot, n as wt, I as kt, J as at, K as xt, L as Ct, M as $t, h as Lt, N as Mt } from "./user-B0q24FmO.js";
2
- import { ref as y, computed as k, watch as Le, defineComponent as ce, resolveComponent as mt, openBlock as o, createBlock as A, unref as n, withCtx as S, createElementBlock as c, Fragment as j, renderList as J, createElementVNode as e, toDisplayString as x, createCommentVNode as z, normalizeClass as Z, withDirectives as De, vShow as St, createVNode as w, createTextVNode as Ce, onMounted as qe, onUnmounted as He, vModelText as Ye, Transition as Se, withModifiers as Ae, normalizeStyle as Ue, reactive as Ge, createStaticVNode as Fe, withKeys as Nt, h as Et } from "vue";
3
- import { defineStore as Pe } from "pinia";
4
- import { useRoute as Ee, useRouter as be, createRouter as Xe, createWebHistory as Je } from "vue-router";
5
- import { SubMenu as We, MenuItem as Ie, Menu as Ze, Tabs as It, TabPane as Ut } from "@xto/navigation";
6
- import { Icon as U, Button as Ne } from "@xto/base";
7
- import { Drawer as Qe, Message as Tt } from "@xto/feedback";
8
- import { Form as Pt, FormItem as Be, Input as nt, Checkbox as zt } from "@xto/form";
9
- import { createLocaleProvider as Ft, getSupportedLocales as Dt, useLocale as At } from "@xto/core/locale";
10
- function Bt(t) {
11
- const a = /^#?([0-9a-f]{6})$/i.exec(t.trim());
12
- if (!a) return null;
13
- const p = parseInt(a[1], 16);
14
- return [p >> 16 & 255, p >> 8 & 255, p & 255];
15
- }
16
- function $e(t) {
17
- const a = T.get(t);
18
- return a === null || a === "" ? void 0 : a;
19
- }
20
- const Vt = ["layout", "primaryColor", "theme", "isDark", "showTabs", "showBreadcrumb", "showFooter"], _e = Pe("app", () => {
21
- const t = st(), a = t.features || {}, p = y(T.get("appName") || "XTO App"), l = y(T.get("indexPath") || "/dashboard"), s = y(T.get("loginPath") || "/login"), d = y(t.theme ?? $e("theme") ?? "light"), i = y(d.value === "dark"), h = y(t.layout ?? $e("layout") ?? "sidebar"), m = y(T.get("isCollapsed") || !1), f = y(a.showTabs ?? $e("showTabs") ?? !0), _ = y(a.showFooter ?? $e("showFooter") ?? !0), g = y(a.showBreadcrumb ?? $e("showBreadcrumb") ?? !0), u = y(t.primaryColor ?? $e("primaryColor") ?? "#4F46E5"), W = y(t.allowUserOverride !== !1), P = y([]), B = y([]), V = k(() => i.value ? "dark" : "light"), R = (M) => {
22
- p.value = M, T.set("appName", M);
23
- }, H = (M) => {
24
- l.value = M, T.set("indexPath", M);
25
- }, Q = (M) => {
26
- s.value = M, T.set("loginPath", M);
27
- }, G = () => {
28
- const M = document.documentElement;
29
- i.value ? M.classList.add("dark") : M.classList.remove("dark");
30
- }, ee = () => {
31
- i.value = !i.value, d.value = i.value ? "dark" : "light", te();
32
- }, Y = (M) => {
33
- d.value = M, i.value = M === "dark", te();
34
- }, te = () => {
35
- G(), T.set("isDark", i.value), T.set("theme", d.value);
36
- }, D = () => {
37
- m.value = !m.value, T.set("isCollapsed", m.value);
38
- }, E = (M) => {
39
- h.value = M, T.set("layout", M);
40
- }, F = () => {
41
- f.value = !f.value, T.set("showTabs", f.value);
42
- }, X = () => {
43
- _.value = !_.value, T.set("showFooter", _.value);
44
- }, K = () => {
45
- g.value = !g.value, T.set("showBreadcrumb", g.value);
46
- }, oe = (M) => {
47
- const q = document.documentElement;
48
- q.style.setProperty("--xto-color-primary", M);
49
- const pe = Bt(M);
50
- if (pe) {
51
- const ve = (ne, ke) => {
52
- const ye = ke ? [255, 255, 255] : [0, 0, 0];
53
- return `#${pe.map((I, b) => Math.round(I + (ye[b] - I) * ne)).map((I) => I.toString(16).padStart(2, "0")).join("")}`;
54
- };
55
- for (let ne = 1; ne <= 9; ne++)
56
- q.style.setProperty(`--xto-color-primary-light-${ne}`, ve(ne * 0.1, !0));
57
- q.style.setProperty("--xto-color-primary-dark-1", ve(0.12, !1)), q.style.setProperty("--xto-color-primary-dark-2", ve(0.28, !1)), q.style.setProperty("--xto-color-primary-dark-3", ve(0.45, !1)), q.style.setProperty("--xto-color-ring", M);
58
- }
59
- }, he = (M) => {
60
- u.value = M, oe(M), T.set("primaryColor", M);
61
- }, we = () => {
62
- Vt.forEach((pe) => T.remove(pe));
63
- const M = st(), q = M.features || {};
64
- h.value = M.layout ?? "sidebar", u.value = M.primaryColor ?? "#4F46E5", d.value = M.theme ?? "light", i.value = d.value === "dark", f.value = q.showTabs ?? !0, _.value = q.showFooter ?? !0, g.value = q.showBreadcrumb ?? !0, G(), oe(u.value);
65
- }, re = (M) => {
66
- P.value.includes(M) || P.value.push(M);
67
- }, me = (M) => {
68
- const q = P.value.indexOf(M);
69
- q > -1 && P.value.splice(q, 1);
70
- }, ge = () => {
71
- P.value = [];
72
- }, ie = (M) => {
73
- B.value = M;
74
- }, ae = () => {
75
- G(), oe(u.value);
76
- };
77
- return Le(i, G), {
78
- appName: p,
79
- indexPath: l,
80
- loginPath: s,
81
- isDark: i,
82
- theme: d,
83
- layout: h,
84
- isCollapsed: m,
85
- showTabs: f,
86
- showFooter: _,
87
- showBreadcrumb: g,
88
- primaryColor: u,
89
- allowUserOverride: W,
90
- cachedViews: P,
91
- mixSubMenus: B,
92
- themeClass: V,
93
- setAppName: R,
94
- setIndexPath: H,
95
- setLoginPath: Q,
96
- toggleTheme: ee,
97
- toggleCollapse: D,
98
- setTheme: Y,
99
- setLayout: E,
100
- toggleTabs: F,
101
- toggleFooter: X,
102
- toggleBreadcrumb: K,
103
- setPrimaryColor: he,
104
- resetToServerDefaults: we,
105
- addCachedView: re,
106
- removeCachedView: me,
107
- clearCachedViews: ge,
108
- setMixSubMenus: ie,
109
- initTheme: ae
110
- };
111
- }), Ot = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
112
- __proto__: null,
113
- useAppStore: _e
114
- }, Symbol.toStringTag, { value: "Module" })), Rt = "menu_list", Kt = "permission_list", Ve = () => `${Rt}_${Me()}`, Oe = () => `${Kt}_${Me()}`, jt = {
115
- menuCode: "home",
116
- menuName: "首页",
117
- menuUrl: "/dashboard",
118
- icon: "home",
119
- closable: !1,
120
- isDefault: !1,
121
- isOut: !1
122
- };
123
- function pt(t) {
124
- return t.filter((a) => a.type !== 1).map((a) => ({
125
- ...a,
126
- children: a.children ? pt(a.children) : void 0
127
- }));
128
- }
129
- function Wt(t) {
130
- const a = [];
131
- function p(l) {
132
- l.forEach((s) => {
133
- s.type === 1 && s.menuCode && a.push(s.menuCode), s.children && p(s.children);
134
- });
135
- }
136
- return p(t), a;
137
- }
138
- const fe = Pe("menu", () => {
139
- const t = y(T.get(Ve()) || []), a = y(T.get(Oe()) || []), p = k(() => t.value.length > 0);
140
- return {
141
- menuList: t,
142
- permissions: a,
143
- hasMenu: p,
144
- setMenuList: (i) => {
145
- a.value = Wt(i), T.set(Oe(), a.value);
146
- const h = pt(i);
147
- t.value = [jt, ...h], T.set(Ve(), t.value);
148
- },
149
- clearMenu: () => {
150
- t.value = [], a.value = [], T.remove(Ve()), T.remove(Oe());
151
- },
152
- hasPermission: (i) => Array.isArray(i) ? i.some((h) => a.value.includes(h)) : a.value.includes(i)
153
- };
154
- }), Re = "user_info", ue = Pe("user", () => {
155
- const t = y(T.get(Re)), a = k(() => !!t.value), p = k(() => {
156
- var u;
157
- return ((u = t.value) == null ? void 0 : u.userId) || "";
158
- }), l = k(() => {
159
- var u;
160
- return ((u = t.value) == null ? void 0 : u.userName) || "";
161
- }), s = k(() => {
162
- var u;
163
- return ((u = t.value) == null ? void 0 : u.departmentName) || "";
164
- }), d = k(() => {
165
- var u;
166
- return ((u = t.value) == null ? void 0 : u.roleName) || "";
167
- }), i = k(() => {
168
- var u;
169
- return ((u = t.value) == null ? void 0 : u.email) || "";
170
- }), h = k(() => {
171
- var u;
172
- return ((u = t.value) == null ? void 0 : u.mobilePhone) || "";
173
- }), m = k(() => {
174
- var u;
175
- return ((u = t.value) == null ? void 0 : u.positionName) || "";
176
- }), f = k(() => {
177
- var u;
178
- return ((u = t.value) == null ? void 0 : u.avatar) || "";
179
- });
180
- return {
181
- userInfo: t,
182
- isLoggedIn: a,
183
- userId: p,
184
- userName: l,
185
- departmentName: s,
186
- roleName: d,
187
- email: i,
188
- mobilePhone: h,
189
- positionName: m,
190
- avatar: f,
191
- setUserInfo: (u) => {
192
- t.value = u, T.set(Re, u);
193
- },
194
- clearUserInfo: () => {
195
- t.value = null, T.remove(Re);
196
- }
197
- };
198
- }), ze = Pe("auth", () => {
199
- const t = y(rt()), a = k(() => it()), p = y(""), l = y(""), s = y(""), d = y("/login");
200
- return {
201
- token: t,
202
- isLoggedIn: a,
203
- baseUrl: p,
204
- appId: l,
205
- clientId: s,
206
- loginPath: d,
207
- login: (u) => {
208
- t.value = u.access_token, ut(u);
209
- },
210
- logout: () => {
211
- t.value = null, ct();
212
- },
213
- setBaseUrl: (u) => {
214
- p.value = u;
215
- },
216
- setAppId: (u) => {
217
- l.value = u;
218
- },
219
- setClientId: (u) => {
220
- s.value = u;
221
- },
222
- setLoginPath: (u) => {
223
- d.value = u;
224
- }
225
- };
226
- }), qt = { class: "menu-item__content" }, Ht = { class: "menu-item__icon" }, Yt = {
227
- key: 1,
228
- class: "menu-item__char"
229
- }, Gt = { class: "menu-item__text" }, Xt = { class: "menu-item__content" }, Jt = {
230
- key: 0,
231
- class: "menu-item__icon"
232
- }, Zt = {
233
- key: 1,
234
- class: "menu-item__char"
235
- }, Qt = { class: "menu-item__text" }, es = /* @__PURE__ */ ce({
236
- __name: "SidebarMenuItem",
237
- props: {
238
- menu: {}
239
- },
240
- setup(t) {
241
- const a = t, p = /* @__PURE__ */ new Set([
242
- "arrow-up",
243
- "arrow-down",
244
- "arrow-left",
245
- "arrow-right",
246
- "caret-down",
247
- "caret-right",
248
- "plus",
249
- "minus",
250
- "close",
251
- "check",
252
- "edit",
253
- "delete",
254
- "copy",
255
- "download",
256
- "upload",
257
- "refresh",
258
- "search",
259
- "filter",
260
- "more",
261
- "setting",
262
- "share",
263
- "loading",
264
- "info",
265
- "success",
266
- "warning",
267
- "error",
268
- "question",
269
- "user",
270
- "user-add",
271
- "user-group",
272
- "logout",
273
- "login",
274
- "file",
275
- "folder",
276
- "folder-open",
277
- "document",
278
- "image",
279
- "video",
280
- "music",
281
- "camera",
282
- "mail",
283
- "phone",
284
- "chat",
285
- "bell",
286
- "message",
287
- "eye",
288
- "eye-off",
289
- "calendar",
290
- "clock",
291
- "history",
292
- "timer",
293
- "location",
294
- "map",
295
- "globe",
296
- "star",
297
- "heart",
298
- "thumb-up",
299
- "link",
300
- "external-link",
301
- "lock",
302
- "unlock",
303
- "key",
304
- "home",
305
- "menu",
306
- "menu-fold",
307
- "menu-unfold",
308
- "sidebar-fold",
309
- "sidebar-expand",
310
- "sidebar-left",
311
- "dashboard",
312
- "chart",
313
- "chart-pie",
314
- "chart-line",
315
- "report",
316
- "analytics",
317
- "system",
318
- "permission",
319
- "role",
320
- "user-manage",
321
- "log",
322
- "notification",
323
- "app",
324
- "list",
325
- "grid",
326
- "fullscreen",
327
- "fullscreen-exit",
328
- "zoom-in",
329
- "zoom-out",
330
- "print",
331
- "bookmark",
332
- "tag",
333
- "code",
334
- "terminal",
335
- "database",
336
- "server",
337
- "cloud",
338
- "gift",
339
- "moon",
340
- "sun",
341
- "theme",
342
- "skin"
343
- ]), l = (m) => {
344
- if (!m || m === "") return "";
345
- if (m.startsWith("tineco-icon-")) {
346
- const _ = m.replace("tineco-icon-", "");
347
- return {
348
- home: "home",
349
- dashboard: "dashboard",
350
- system: "system",
351
- user: "user",
352
- role: "role",
353
- menu: "list",
354
- setting: "setting",
355
- file: "file",
356
- folder: "folder",
357
- chart: "chart",
358
- report: "report",
359
- analytics: "analytics"
360
- }[_] || _;
361
- }
362
- return {
363
- dashboard: "dashboard",
364
- system: "system",
365
- user: "user",
366
- role: "role",
367
- menu: "list",
368
- setting: "setting",
369
- home: "home",
370
- chart: "chart",
371
- report: "report",
372
- analytics: "analytics",
373
- permission: "permission",
374
- log: "log",
375
- notification: "notification",
376
- app: "app",
377
- list: "list",
378
- grid: "grid"
379
- }[m] || m;
380
- }, s = (m) => m ? m.charAt(0) : "", d = (m) => p.has(m), i = k(() => a.menu.menuId || a.menu.menuCode || a.menu.menuUrl || ""), h = k(() => a.menu.children && a.menu.children.length > 0);
381
- return (m, f) => {
382
- const _ = mt("SidebarMenuItem", !0);
383
- return h.value ? (o(), A(n(We), {
384
- key: 0,
385
- index: i.value
386
- }, {
387
- title: S(() => [
388
- e("span", qt, [
389
- e("span", Ht, [
390
- d(l(t.menu.icon)) ? (o(), A(n(U), {
391
- key: 0,
392
- name: l(t.menu.icon),
393
- size: 16
394
- }, null, 8, ["name"])) : (o(), c("span", Yt, x(s(t.menu.menuName)), 1))
395
- ]),
396
- e("span", Gt, x(t.menu.menuName), 1)
397
- ])
398
- ]),
399
- default: S(() => [
400
- (o(!0), c(j, null, J(t.menu.children, (g) => (o(), A(_, {
401
- key: g.menuId || g.menuCode || g.menuUrl,
402
- menu: g
403
- }, null, 8, ["menu"]))), 128))
404
- ]),
405
- _: 1
406
- }, 8, ["index"])) : (o(), A(n(Ie), {
407
- key: 1,
408
- index: t.menu.menuUrl || i.value
409
- }, {
410
- default: S(() => [
411
- e("span", Xt, [
412
- t.menu.menuName !== "首页" ? (o(), c("span", Jt, [
413
- d(l(t.menu.icon)) ? (o(), A(n(U), {
414
- key: 0,
415
- name: l(t.menu.icon),
416
- size: 16
417
- }, null, 8, ["name"])) : (o(), c("span", Zt, x(s(t.menu.menuName)), 1))
418
- ])) : z("", !0),
419
- e("span", Qt, x(t.menu.menuName), 1)
420
- ])
421
- ]),
422
- _: 1
423
- }, 8, ["index"]));
424
- };
425
- }
426
- }), de = (t, a) => {
427
- const p = t.__vccOpts || t;
428
- for (const [l, s] of a)
429
- p[l] = s;
430
- return p;
431
- }, ts = /* @__PURE__ */ de(es, [["__scopeId", "data-v-03a4d35c"]]), ss = {
432
- key: 0,
433
- class: "sidebar__logo"
434
- }, os = ["src"], as = {
435
- key: 1,
436
- class: "sidebar__user"
437
- }, ns = { class: "sidebar__user-info" }, ls = { class: "sidebar__user-name" }, rs = { class: "sidebar__user-role" }, Ke = "sidebar_opened_menus", je = "sidebar_menu_list_key", is = /* @__PURE__ */ ce({
438
- __name: "Sidebar",
439
- props: {
440
- menuList: { default: () => [] },
441
- showLogo: { type: Boolean, default: !0 },
442
- showUser: { type: Boolean, default: !0 },
443
- logoSrc: {}
444
- },
445
- setup(t) {
446
- const a = t, p = k(() => a.logoSrc || Te("/vite.svg")), l = Ee(), s = be(), d = fe(), i = ue(), h = ze(), m = _e(), f = k(() => a.menuList.length > 0 ? a.menuList : d.menuList), _ = k(() => m.isCollapsed), g = k(() => l.path), u = (D) => D.menuId || D.menuCode || D.menuUrl || "", W = () => f.value.map(u).join(","), P = T.get(je) || "", B = W(), V = P === B ? T.get(Ke) || [] : [], R = y(V);
447
- Le(R, (D) => {
448
- T.set(Ke, D), T.set(je, W());
449
- }, { deep: !0 });
450
- const H = (D, E, F = []) => {
451
- var X;
452
- for (const K of D) {
453
- if (K.menuUrl && (E === K.menuUrl || E.startsWith(K.menuUrl + "/")))
454
- return [...F, u(K)];
455
- if ((X = K.children) != null && X.length) {
456
- const oe = H(K.children, E, [...F, u(K)]);
457
- if (oe) return oe;
458
- }
459
- }
460
- return null;
461
- };
462
- Le([() => l.path, f], ([D, E]) => {
463
- if (E.length > 0) {
464
- const F = H(E, D);
465
- if (F) {
466
- const X = F.slice(0, -1), K = /* @__PURE__ */ new Set([...R.value, ...X]);
467
- R.value = Array.from(K);
468
- }
469
- }
470
- }, { immediate: !0 }), Le(f, (D, E) => {
471
- D !== E && (R.value = [], T.set(Ke, []), T.set(je, W()));
472
- }, { immediate: !1 });
473
- const Q = k(() => m.isDark ? "#161B21" : "#fff"), G = k(() => m.isDark ? "#D9DCE1" : "#4E5566"), ee = k(() => m.isDark ? "#818CF8" : "#4F46E5"), Y = (D) => {
474
- D && D !== l.path && s.push(D);
475
- }, te = () => {
476
- h.logout(), i.clearUserInfo(), d.clearMenu(), s.push(m.loginPath);
477
- };
478
- return (D, E) => (o(), c("div", {
479
- class: Z(["sidebar", { "sidebar--collapsed": _.value }])
480
- }, [
481
- a.showLogo ? (o(), c("div", ss, [
482
- e("img", {
483
- src: p.value,
484
- alt: "Logo",
485
- class: "sidebar__logo-img"
486
- }, null, 8, os),
487
- De(e("span", { class: "sidebar__logo-text" }, x(n(m).appName), 513), [
488
- [St, !_.value]
489
- ])
490
- ])) : z("", !0),
491
- w(n(Ze), {
492
- modelValue: g.value,
493
- "onUpdate:modelValue": E[0] || (E[0] = (F) => g.value = F),
494
- openeds: R.value,
495
- "onUpdate:openeds": E[1] || (E[1] = (F) => R.value = F),
496
- mode: "vertical",
497
- collapse: _.value,
498
- "collapse-transition": !1,
499
- "background-color": Q.value,
500
- "text-color": G.value,
501
- "active-text-color": ee.value,
502
- class: "sidebar__menu",
503
- onSelect: Y
504
- }, {
505
- default: S(() => [
506
- (o(!0), c(j, null, J(f.value, (F) => (o(), A(ts, {
507
- key: u(F),
508
- menu: F
509
- }, null, 8, ["menu"]))), 128))
510
- ]),
511
- _: 1
512
- }, 8, ["modelValue", "openeds", "collapse", "background-color", "text-color", "active-text-color"]),
513
- a.showUser && !_.value ? (o(), c("div", as, [
514
- e("div", ns, [
515
- e("span", ls, x(n(i).userName), 1),
516
- e("span", rs, x(n(i).departmentName), 1)
517
- ]),
518
- w(n(Ne), {
519
- type: "text",
520
- size: "small",
521
- onClick: te
522
- }, {
523
- default: S(() => [...E[2] || (E[2] = [
524
- Ce("退出", -1)
525
- ])]),
526
- _: 1
527
- })
528
- ])) : z("", !0)
529
- ], 2));
530
- }
531
- }), lt = /* @__PURE__ */ de(is, [["__scopeId", "data-v-3145ea3a"]]), cs = { class: "header" }, us = { class: "header__left" }, ds = {
532
- key: 0,
533
- class: "header__breadcrumb"
534
- }, ms = {
535
- key: 0,
536
- class: "breadcrumb-separator"
537
- }, ps = { class: "header__right" }, vs = {
538
- key: 0,
539
- class: "header__search-dropdown"
540
- }, hs = {
541
- key: 0,
542
- class: "header__search-results"
543
- }, _s = ["onClick"], fs = {
544
- key: 0,
545
- class: "header__search-icon"
546
- }, gs = {
547
- key: 1,
548
- class: "header__search-char"
549
- }, ys = { class: "header__search-item-title" }, bs = {
550
- key: 1,
551
- class: "header__search-item-parent"
552
- }, ws = {
553
- key: 1,
554
- class: "header__search-empty"
555
- }, ks = ["title"], xs = { class: "header__avatar" }, Cs = { class: "header__user-name" }, $s = {
556
- key: 0,
557
- class: "header__dropdown"
558
- }, Ls = { class: "header__dropdown-header" }, Ms = { class: "header__dropdown-avatar" }, Ss = { class: "header__dropdown-info" }, Ns = { class: "header__dropdown-name" }, Es = { class: "header__dropdown-role" }, Is = { class: "header__dropdown-menu" }, Us = { class: "settings-drawer" }, Ts = { class: "settings-section" }, Ps = { class: "settings-layout-options" }, zs = ["onClick"], Fs = { class: "layout-option__preview" }, Ds = {
559
- key: 0,
560
- class: "layout-preview-sidebar"
561
- }, As = {
562
- key: 1,
563
- class: "layout-preview-top"
564
- }, Bs = {
565
- key: 2,
566
- class: "layout-preview-mix"
567
- }, Vs = { class: "layout-option__label" }, Os = { class: "settings-section" }, Rs = { class: "settings-color-options" }, Ks = ["title", "onClick"], js = { class: "settings-section" }, Ws = { class: "settings-switch-list" }, qs = { class: "settings-switch-item" }, Hs = { class: "settings-switch-item" }, Ys = { class: "settings-section" }, Gs = /* @__PURE__ */ ce({
568
- __name: "Header",
569
- setup(t) {
570
- const a = Ee(), p = be(), l = _e(), s = ue(), d = ze(), i = fe(), h = y(!1), m = y(!1), f = y(null), _ = y(!1), g = y(!1), u = y(""), W = y(null), P = y(!1), B = [
571
- { value: "sidebar", label: "左侧菜单", icon: "sidebar-left" },
572
- { value: "top", label: "顶部菜单", icon: "menu" },
573
- { value: "mix", label: "混合菜单", icon: "grid" }
574
- ], V = [
575
- { value: "#4F46E5", label: "品牌蓝" },
576
- { value: "#0F6FDE", label: "企业蓝" },
577
- { value: "#00A870", label: "翡翠绿" },
578
- { value: "#D46B08", label: "琥珀橙" },
579
- { value: "#1F2329", label: "石墨黑" }
580
- ], R = k(() => a.matched.filter((b) => b.meta && b.meta.title).map((b) => ({
581
- title: b.meta.title,
582
- path: b.path
583
- }))), H = (I, b = "") => {
584
- const se = [];
585
- return I.forEach(($) => {
586
- $.children && $.children.length > 0 ? se.push(...H($.children, $.menuName)) : se.push({ ...$, parentTitle: b, title: $.menuName, path: $.menuUrl });
587
- }), se;
588
- }, Q = /* @__PURE__ */ new Set([
589
- "arrow-up",
590
- "arrow-down",
591
- "arrow-left",
592
- "arrow-right",
593
- "caret-down",
594
- "caret-right",
595
- "plus",
596
- "minus",
597
- "close",
598
- "check",
599
- "edit",
600
- "delete",
601
- "copy",
602
- "download",
603
- "upload",
604
- "refresh",
605
- "search",
606
- "filter",
607
- "more",
608
- "setting",
609
- "share",
610
- "loading",
611
- "info",
612
- "success",
613
- "warning",
614
- "error",
615
- "question",
616
- "user",
617
- "user-add",
618
- "user-group",
619
- "logout",
620
- "login",
621
- "file",
622
- "folder",
623
- "folder-open",
624
- "document",
625
- "image",
626
- "video",
627
- "music",
628
- "camera",
629
- "mail",
630
- "phone",
631
- "chat",
632
- "bell",
633
- "message",
634
- "eye",
635
- "eye-off",
636
- "calendar",
637
- "clock",
638
- "history",
639
- "timer",
640
- "location",
641
- "map",
642
- "globe",
643
- "star",
644
- "heart",
645
- "thumb-up",
646
- "link",
647
- "external-link",
648
- "lock",
649
- "unlock",
650
- "key",
651
- "home",
652
- "menu",
653
- "menu-fold",
654
- "menu-unfold",
655
- "sidebar-fold",
656
- "sidebar-expand",
657
- "sidebar-left",
658
- "dashboard",
659
- "chart",
660
- "chart-pie",
661
- "chart-line",
662
- "report",
663
- "analytics",
664
- "system",
665
- "permission",
666
- "role",
667
- "user-manage",
668
- "log",
669
- "notification",
670
- "app",
671
- "list",
672
- "grid",
673
- "fullscreen",
674
- "fullscreen-exit",
675
- "zoom-in",
676
- "zoom-out",
677
- "print",
678
- "bookmark",
679
- "tag",
680
- "code",
681
- "terminal",
682
- "database",
683
- "server",
684
- "cloud",
685
- "gift",
686
- "moon",
687
- "sun",
688
- "theme",
689
- "skin"
690
- ]), G = (I) => {
691
- if (!I || I === "") return "";
692
- if (I.startsWith("tineco-icon-")) {
693
- const se = I.replace("tineco-icon-", "");
694
- return {
695
- home: "home",
696
- dashboard: "dashboard",
697
- system: "system",
698
- user: "user",
699
- role: "role",
700
- menu: "list",
701
- setting: "setting",
702
- file: "file",
703
- folder: "folder",
704
- chart: "chart",
705
- report: "report",
706
- analytics: "analytics"
707
- }[se] || se;
708
- }
709
- return {
710
- dashboard: "dashboard",
711
- system: "system",
712
- user: "user",
713
- role: "role",
714
- menu: "list",
715
- setting: "setting",
716
- home: "home",
717
- chart: "chart",
718
- report: "report",
719
- analytics: "analytics",
720
- permission: "permission",
721
- log: "log",
722
- notification: "notification",
723
- app: "app",
724
- list: "list",
725
- grid: "grid"
726
- }[I] || I;
727
- }, ee = (I) => I ? I.charAt(0) : "", Y = (I) => Q.has(I), te = k(() => u.value.trim() ? H(i.menuList).filter(
728
- (b) => b.title.toLowerCase().includes(u.value.toLowerCase())
729
- ) : []), D = k(() => l.layout), E = () => {
730
- l.toggleCollapse();
731
- }, F = () => {
732
- l.toggleTheme();
733
- }, X = () => {
734
- m.value = !0;
735
- }, K = (I) => {
736
- l.setLayout(I), m.value = !1;
737
- }, oe = (I) => {
738
- P.value = I;
739
- const b = document.documentElement;
740
- I ? b.classList.add("grey-mode") : b.classList.remove("grey-mode");
741
- }, he = () => {
742
- oe(!P.value), m.value = !1;
743
- }, we = () => {
744
- l.toggleTheme(), m.value = !1;
745
- }, re = () => {
746
- l.resetToServerDefaults(), m.value = !1;
747
- }, me = () => {
748
- document.fullscreenElement ? document.exitFullscreen() : document.documentElement.requestFullscreen();
749
- }, ge = () => {
750
- _.value = !!document.fullscreenElement;
751
- }, ie = () => {
752
- h.value = !h.value;
753
- }, ae = () => {
754
- h.value = !1;
755
- }, M = () => {
756
- g.value = !1, u.value = "";
757
- }, q = (I) => {
758
- p.push(I), M();
759
- }, pe = (I) => {
760
- l.setPrimaryColor(I), m.value = !1;
761
- }, ve = () => {
762
- ae(), p.push("/profile");
763
- }, ne = () => {
764
- ae(), p.push("/change-password");
765
- }, ke = () => {
766
- ae(), d.logout(), s.clearUserInfo(), i.clearMenu(), p.push(l.loginPath);
767
- }, ye = (I) => {
768
- f.value && !f.value.contains(I.target) && ae(), W.value && !W.value.contains(I.target) && M();
769
- }, xe = (I) => {
770
- I.key === "Escape" && (M(), ae());
771
- };
772
- return qe(() => {
773
- document.addEventListener("click", ye), document.addEventListener("fullscreenchange", ge), document.addEventListener("keydown", xe), l.initTheme(), P.value = document.documentElement.classList.contains("grey-mode");
774
- }), He(() => {
775
- document.removeEventListener("click", ye), document.removeEventListener("fullscreenchange", ge), document.removeEventListener("keydown", xe);
776
- }), (I, b) => {
777
- var se;
778
- return o(), c("div", cs, [
779
- e("div", us, [
780
- e("div", {
781
- class: "header__collapse",
782
- onClick: E
783
- }, [
784
- w(n(U), {
785
- name: n(l).isCollapsed ? "menu-unfold" : "menu-fold",
786
- size: 18
787
- }, null, 8, ["name"])
788
- ]),
789
- n(l).showBreadcrumb ? (o(), c("div", ds, [
790
- (o(!0), c(j, null, J(R.value, ($, N) => (o(), c("span", {
791
- key: $.path
792
- }, [
793
- N > 0 ? (o(), c("span", ms, "/")) : z("", !0),
794
- e("span", {
795
- class: Z({ "is-current": N === R.value.length - 1 })
796
- }, x($.title), 3)
797
- ]))), 128))
798
- ])) : z("", !0)
799
- ]),
800
- e("div", ps, [
801
- e("div", {
802
- class: "header__search",
803
- ref_key: "searchRef",
804
- ref: W
805
- }, [
806
- w(n(U), {
807
- name: "search",
808
- size: 14,
809
- class: "header__search-icon"
810
- }),
811
- De(e("input", {
812
- "onUpdate:modelValue": b[0] || (b[0] = ($) => u.value = $),
813
- type: "text",
814
- class: "header__search-input",
815
- placeholder: "搜索菜单...",
816
- onFocus: b[1] || (b[1] = ($) => g.value = !0)
817
- }, null, 544), [
818
- [Ye, u.value]
819
- ]),
820
- w(Se, { name: "search-dropdown" }, {
821
- default: S(() => [
822
- g.value && (te.value.length > 0 || u.value) ? (o(), c("div", vs, [
823
- te.value.length > 0 ? (o(), c("div", hs, [
824
- (o(!0), c(j, null, J(te.value, ($) => (o(), c("div", {
825
- key: $.path,
826
- class: "header__search-item",
827
- onClick: (N) => q($.path)
828
- }, [
829
- $.title !== "首页" ? (o(), c("span", fs, [
830
- Y(G($.icon)) ? (o(), A(n(U), {
831
- key: 0,
832
- name: G($.icon),
833
- size: 16
834
- }, null, 8, ["name"])) : (o(), c("span", gs, x(ee($.title)), 1))
835
- ])) : z("", !0),
836
- e("span", ys, x($.title), 1),
837
- $.parentTitle ? (o(), c("span", bs, x($.parentTitle), 1)) : z("", !0)
838
- ], 8, _s))), 128))
839
- ])) : (o(), c("div", ws, " 未找到匹配的菜单 "))
840
- ])) : z("", !0)
841
- ]),
842
- _: 1
843
- })
844
- ], 512),
845
- e("div", {
846
- class: "header__action",
847
- onClick: me,
848
- title: _.value ? "退出全屏" : "全屏"
849
- }, [
850
- w(n(U), {
851
- name: _.value ? "fullscreen-exit" : "fullscreen",
852
- size: 16
853
- }, null, 8, ["name"])
854
- ], 8, ks),
855
- n(l).allowUserOverride ? (o(), c("div", {
856
- key: 0,
857
- class: "header__action",
858
- onClick: X,
859
- title: "换肤设置"
860
- }, [
861
- w(n(U), {
862
- name: "skin",
863
- size: 16
864
- })
865
- ])) : z("", !0),
866
- e("div", {
867
- class: "header__action",
868
- onClick: F,
869
- title: "切换主题"
870
- }, [
871
- w(n(U), {
872
- name: n(l).isDark ? "sun" : "moon",
873
- size: 16
874
- }, null, 8, ["name"])
875
- ]),
876
- e("div", {
877
- class: "header__user",
878
- ref_key: "dropdownRef",
879
- ref: f
880
- }, [
881
- e("div", {
882
- class: "header__user-trigger",
883
- onClick: Ae(ie, ["stop"])
884
- }, [
885
- e("div", xs, [
886
- e("span", null, x(((se = n(s).userName) == null ? void 0 : se.charAt(0)) || "U"), 1)
887
- ]),
888
- e("span", Cs, x(n(s).userName), 1),
889
- e("span", {
890
- class: Z(["header__user-arrow", { "is-active": h.value }])
891
- }, [...b[3] || (b[3] = [
892
- e("svg", {
893
- viewBox: "0 0 12 12",
894
- width: "10",
895
- height: "10",
896
- fill: "none",
897
- stroke: "currentColor",
898
- "stroke-width": "1.5",
899
- "stroke-linecap": "round",
900
- "stroke-linejoin": "round"
901
- }, [
902
- e("path", { d: "M2.5 4.5 6 8l3.5-3.5" })
903
- ], -1)
904
- ])], 2)
905
- ]),
906
- w(Se, { name: "dropdown" }, {
907
- default: S(() => {
908
- var $;
909
- return [
910
- h.value ? (o(), c("div", $s, [
911
- e("div", Ls, [
912
- e("div", Ms, [
913
- e("span", null, x((($ = n(s).userName) == null ? void 0 : $.charAt(0)) || "U"), 1)
914
- ]),
915
- e("div", Ss, [
916
- e("div", Ns, x(n(s).userName), 1),
917
- e("div", Es, x(n(s).roleName || n(s).departmentName), 1)
918
- ])
919
- ]),
920
- b[8] || (b[8] = e("div", { class: "header__dropdown-divider" }, null, -1)),
921
- e("div", Is, [
922
- e("div", {
923
- class: "header__dropdown-item",
924
- onClick: ve
925
- }, [
926
- w(n(U), {
927
- name: "user",
928
- size: 16
929
- }),
930
- b[4] || (b[4] = e("span", null, "个人信息", -1))
931
- ]),
932
- e("div", {
933
- class: "header__dropdown-item",
934
- onClick: ne
935
- }, [
936
- w(n(U), {
937
- name: "lock",
938
- size: 16
939
- }),
940
- b[5] || (b[5] = e("span", null, "修改密码", -1))
941
- ]),
942
- b[7] || (b[7] = e("div", { class: "header__dropdown-divider" }, null, -1)),
943
- e("div", {
944
- class: "header__dropdown-item header__dropdown-item--danger",
945
- onClick: ke
946
- }, [
947
- w(n(U), {
948
- name: "logout",
949
- size: 16
950
- }),
951
- b[6] || (b[6] = e("span", null, "退出登录", -1))
952
- ])
953
- ])
954
- ])) : z("", !0)
955
- ];
956
- }),
957
- _: 1
958
- })
959
- ], 512)
960
- ]),
961
- w(n(Qe), {
962
- modelValue: m.value,
963
- "onUpdate:modelValue": b[2] || (b[2] = ($) => m.value = $),
964
- title: "换肤设置",
965
- direction: "rtl",
966
- size: "320px"
967
- }, {
968
- default: S(() => [
969
- e("div", Us, [
970
- e("div", Ts, [
971
- b[12] || (b[12] = e("div", { class: "settings-title" }, "布局模式", -1)),
972
- e("div", Ps, [
973
- (o(), c(j, null, J(B, ($) => e("div", {
974
- key: $.value,
975
- class: Z(["layout-option", { "is-active": D.value === $.value }]),
976
- onClick: (N) => K($.value)
977
- }, [
978
- e("div", Fs, [
979
- $.value === "sidebar" ? (o(), c("div", Ds, [...b[9] || (b[9] = [
980
- e("div", { class: "preview-aside" }, null, -1),
981
- e("div", { class: "preview-main" }, [
982
- e("div", { class: "preview-header" }),
983
- e("div", { class: "preview-content" })
984
- ], -1)
985
- ])])) : $.value === "top" ? (o(), c("div", As, [...b[10] || (b[10] = [
986
- e("div", { class: "preview-header-full" }, null, -1),
987
- e("div", { class: "preview-content-full" }, null, -1)
988
- ])])) : (o(), c("div", Bs, [...b[11] || (b[11] = [
989
- e("div", { class: "preview-header-mix" }, [
990
- e("div", { class: "preview-mix-left" })
991
- ], -1),
992
- e("div", { class: "preview-mix-body" }, [
993
- e("div", { class: "preview-mix-aside" }),
994
- e("div", { class: "preview-mix-content" })
995
- ], -1)
996
- ])]))
997
- ]),
998
- e("span", Vs, x($.label), 1)
999
- ], 10, zs)), 64))
1000
- ])
1001
- ]),
1002
- e("div", Os, [
1003
- b[13] || (b[13] = e("div", { class: "settings-title" }, "主题色", -1)),
1004
- e("div", Rs, [
1005
- (o(), c(j, null, J(V, ($) => e("div", {
1006
- key: $.value,
1007
- class: Z(["color-option", { "is-active": n(l).primaryColor === $.value }]),
1008
- style: Ue({ backgroundColor: $.value }),
1009
- title: $.label,
1010
- onClick: (N) => pe($.value)
1011
- }, [
1012
- n(l).primaryColor === $.value ? (o(), A(n(U), {
1013
- key: 0,
1014
- name: "check",
1015
- size: 12,
1016
- color: "#fff"
1017
- })) : z("", !0)
1018
- ], 14, Ks)), 64))
1019
- ])
1020
- ]),
1021
- e("div", js, [
1022
- b[18] || (b[18] = e("div", { class: "settings-title" }, "功能设置", -1)),
1023
- e("div", Ws, [
1024
- e("div", qs, [
1025
- b[15] || (b[15] = e("span", null, "灰色模式", -1)),
1026
- e("div", {
1027
- class: Z(["switch-wrapper", { "is-checked": P.value }]),
1028
- onClick: he
1029
- }, [...b[14] || (b[14] = [
1030
- e("span", { class: "switch-core" }, null, -1)
1031
- ])], 2)
1032
- ]),
1033
- e("div", Hs, [
1034
- b[17] || (b[17] = e("span", null, "暗黑模式", -1)),
1035
- e("div", {
1036
- class: Z(["switch-wrapper", { "is-checked": n(l).isDark }]),
1037
- onClick: we
1038
- }, [...b[16] || (b[16] = [
1039
- e("span", { class: "switch-core" }, null, -1)
1040
- ])], 2)
1041
- ])
1042
- ])
1043
- ]),
1044
- e("div", Ys, [
1045
- e("div", {
1046
- class: "settings-reset",
1047
- onClick: re
1048
- }, [
1049
- w(n(U), {
1050
- name: "refresh",
1051
- size: 14
1052
- }),
1053
- b[19] || (b[19] = e("span", null, "恢复默认", -1))
1054
- ])
1055
- ])
1056
- ])
1057
- ]),
1058
- _: 1
1059
- }, 8, ["modelValue"])
1060
- ]);
1061
- };
1062
- }
1063
- }), Xs = /* @__PURE__ */ de(Gs, [["__scopeId", "data-v-21769fe5"]]), Js = { class: "top-menu" }, Zs = { class: "top-menu__logo" }, Qs = ["src"], eo = { class: "top-menu__logo-text" }, to = { class: "top-menu__menu-content" }, so = {
1064
- key: 0,
1065
- class: "top-menu__menu-icon"
1066
- }, oo = {
1067
- key: 1,
1068
- class: "top-menu__menu-char"
1069
- }, ao = { class: "top-menu__menu-text" }, no = { class: "top-menu__menu-content" }, lo = { class: "top-menu__menu-icon" }, ro = {
1070
- key: 1,
1071
- class: "top-menu__menu-char"
1072
- }, io = { class: "top-menu__menu-text" }, co = { class: "top-menu__menu-content" }, uo = { class: "top-menu__menu-icon" }, mo = {
1073
- key: 1,
1074
- class: "top-menu__menu-char"
1075
- }, po = { class: "top-menu__menu-text" }, vo = { class: "top-menu__menu-content" }, ho = { class: "top-menu__menu-icon" }, _o = {
1076
- key: 1,
1077
- class: "top-menu__menu-char"
1078
- }, fo = { class: "top-menu__menu-text" }, go = { class: "top-menu__menu-content" }, yo = {
1079
- key: 0,
1080
- class: "top-menu__menu-icon"
1081
- }, bo = {
1082
- key: 1,
1083
- class: "top-menu__menu-char"
1084
- }, wo = { class: "top-menu__menu-text" }, ko = { class: "top-menu__actions" }, xo = {
1085
- key: 0,
1086
- class: "top-menu__search-dropdown"
1087
- }, Co = {
1088
- key: 0,
1089
- class: "top-menu__search-results"
1090
- }, $o = ["onClick"], Lo = {
1091
- key: 0,
1092
- class: "top-menu__search-icon-item"
1093
- }, Mo = {
1094
- key: 1,
1095
- class: "top-menu__search-char"
1096
- }, So = { class: "top-menu__search-item-title" }, No = {
1097
- key: 1,
1098
- class: "top-menu__search-item-parent"
1099
- }, Eo = {
1100
- key: 1,
1101
- class: "top-menu__search-empty"
1102
- }, Io = ["title"], Uo = { class: "top-menu__avatar" }, To = { class: "top-menu__user-name" }, Po = {
1103
- key: 0,
1104
- class: "top-menu__dropdown"
1105
- }, zo = { class: "top-menu__dropdown-header" }, Fo = { class: "top-menu__dropdown-avatar" }, Do = { class: "top-menu__dropdown-info" }, Ao = { class: "top-menu__dropdown-name" }, Bo = { class: "top-menu__dropdown-role" }, Vo = { class: "top-menu__dropdown-menu" }, Oo = { class: "settings-drawer" }, Ro = { class: "settings-section" }, Ko = { class: "settings-layout-options" }, jo = ["onClick"], Wo = { class: "layout-option__preview" }, qo = {
1106
- key: 0,
1107
- class: "layout-preview-sidebar"
1108
- }, Ho = {
1109
- key: 1,
1110
- class: "layout-preview-top"
1111
- }, Yo = {
1112
- key: 2,
1113
- class: "layout-preview-mix"
1114
- }, Go = { class: "layout-option__label" }, Xo = { class: "settings-section" }, Jo = { class: "settings-color-options" }, Zo = ["title", "onClick"], Qo = { class: "settings-section" }, ea = { class: "settings-switch-list" }, ta = { class: "settings-switch-item" }, sa = { class: "settings-switch-item" }, oa = /* @__PURE__ */ ce({
1115
- __name: "TopMenu",
1116
- props: {
1117
- logoSrc: {}
1118
- },
1119
- setup(t) {
1120
- const a = t, p = k(() => a.logoSrc || Te("/vite.svg")), l = Ee(), s = be(), d = fe(), i = _e(), h = ue(), m = ze(), f = k(() => l.path), _ = (N, C = "") => {
1121
- const le = [];
1122
- return N.forEach((r) => {
1123
- r.children && r.children.length > 0 ? le.push(..._(r.children, r.menuName)) : le.push({ ...r, parentTitle: C, title: r.menuName, path: r.menuUrl });
1124
- }), le;
1125
- }, g = k(() => ee.value.trim() ? _(d.menuList).filter(
1126
- (C) => C.title.toLowerCase().includes(ee.value.toLowerCase())
1127
- ) : []), u = k(() => i.isDark ? "#1d1e1f" : "#fff"), W = k(() => i.isDark ? "#cfd3dc" : "#303133"), P = k(() => "#409eff"), B = y(!1), V = y(null), R = y(!1), H = y(!1), Q = y(!1), G = y(!1), ee = y(""), Y = y(null), te = (N) => {
1128
- N && N !== l.path && s.push(N);
1129
- }, D = /* @__PURE__ */ new Set([
1130
- "arrow-up",
1131
- "arrow-down",
1132
- "arrow-left",
1133
- "arrow-right",
1134
- "caret-down",
1135
- "caret-right",
1136
- "plus",
1137
- "minus",
1138
- "close",
1139
- "check",
1140
- "edit",
1141
- "delete",
1142
- "copy",
1143
- "download",
1144
- "upload",
1145
- "refresh",
1146
- "search",
1147
- "filter",
1148
- "more",
1149
- "setting",
1150
- "share",
1151
- "loading",
1152
- "info",
1153
- "success",
1154
- "warning",
1155
- "error",
1156
- "question",
1157
- "user",
1158
- "user-add",
1159
- "user-group",
1160
- "logout",
1161
- "login",
1162
- "file",
1163
- "folder",
1164
- "folder-open",
1165
- "document",
1166
- "image",
1167
- "video",
1168
- "music",
1169
- "camera",
1170
- "mail",
1171
- "phone",
1172
- "chat",
1173
- "bell",
1174
- "message",
1175
- "eye",
1176
- "eye-off",
1177
- "calendar",
1178
- "clock",
1179
- "history",
1180
- "timer",
1181
- "location",
1182
- "map",
1183
- "globe",
1184
- "star",
1185
- "heart",
1186
- "thumb-up",
1187
- "link",
1188
- "external-link",
1189
- "lock",
1190
- "unlock",
1191
- "key",
1192
- "home",
1193
- "menu",
1194
- "menu-fold",
1195
- "menu-unfold",
1196
- "sidebar-fold",
1197
- "sidebar-expand",
1198
- "sidebar-left",
1199
- "dashboard",
1200
- "chart",
1201
- "chart-pie",
1202
- "chart-line",
1203
- "report",
1204
- "analytics",
1205
- "system",
1206
- "permission",
1207
- "role",
1208
- "user-manage",
1209
- "log",
1210
- "notification",
1211
- "app",
1212
- "list",
1213
- "grid",
1214
- "fullscreen",
1215
- "fullscreen-exit",
1216
- "zoom-in",
1217
- "zoom-out",
1218
- "print",
1219
- "bookmark",
1220
- "tag",
1221
- "code",
1222
- "terminal",
1223
- "database",
1224
- "server",
1225
- "cloud",
1226
- "gift",
1227
- "moon",
1228
- "sun",
1229
- "theme",
1230
- "skin"
1231
- ]), E = (N) => {
1232
- if (!N || N === "") return "";
1233
- if (N.startsWith("tineco-icon-")) {
1234
- const le = N.replace("tineco-icon-", "");
1235
- return {
1236
- home: "home",
1237
- dashboard: "dashboard",
1238
- system: "system",
1239
- user: "user",
1240
- role: "role",
1241
- menu: "list",
1242
- setting: "setting",
1243
- file: "file",
1244
- folder: "folder",
1245
- chart: "chart",
1246
- report: "report",
1247
- analytics: "analytics"
1248
- }[le] || le;
1249
- }
1250
- return {
1251
- dashboard: "dashboard",
1252
- system: "system",
1253
- user: "user",
1254
- role: "role",
1255
- menu: "list",
1256
- setting: "setting",
1257
- home: "home",
1258
- chart: "chart",
1259
- report: "report",
1260
- analytics: "analytics",
1261
- permission: "permission",
1262
- log: "log",
1263
- notification: "notification",
1264
- app: "app",
1265
- list: "list",
1266
- grid: "grid"
1267
- }[N] || N;
1268
- }, F = (N) => N ? N.charAt(0) : "", X = (N) => D.has(N), K = () => {
1269
- i.toggleTheme(), H.value = !1;
1270
- }, oe = () => {
1271
- document.fullscreenElement ? document.exitFullscreen() : document.documentElement.requestFullscreen();
1272
- }, he = () => {
1273
- R.value = !!document.fullscreenElement;
1274
- }, we = () => {
1275
- B.value = !B.value;
1276
- }, re = () => {
1277
- B.value = !1;
1278
- }, me = () => {
1279
- G.value = !1, ee.value = "";
1280
- }, ge = (N) => {
1281
- s.push(N), me();
1282
- }, ie = () => {
1283
- H.value = !0;
1284
- }, ae = (N) => {
1285
- Q.value = N;
1286
- const C = document.documentElement;
1287
- N ? C.classList.add("grey-mode") : C.classList.remove("grey-mode");
1288
- }, M = () => {
1289
- ae(!Q.value), H.value = !1;
1290
- }, q = () => {
1291
- i.toggleTheme(), H.value = !1;
1292
- }, pe = [
1293
- { value: "sidebar", label: "左侧菜单", icon: "sidebar-left" },
1294
- { value: "top", label: "顶部菜单", icon: "menu" },
1295
- { value: "mix", label: "混合菜单", icon: "grid" }
1296
- ], ve = k(() => i.layout), ne = (N) => {
1297
- i.setLayout(N), H.value = !1;
1298
- }, ke = [
1299
- { value: "#409eff", label: "默认蓝" },
1300
- { value: "#0F6FDE", label: "企业蓝" },
1301
- { value: "#00A870", label: "翡翠绿" },
1302
- { value: "#D46B08", label: "琥珀橙" },
1303
- { value: "#1F2329", label: "石墨黑" }
1304
- ], ye = (N) => {
1305
- i.setPrimaryColor(N), H.value = !1;
1306
- }, xe = () => {
1307
- re(), s.push("/profile");
1308
- }, I = () => {
1309
- re(), s.push("/change-password");
1310
- }, b = () => {
1311
- re(), m.logout(), h.clearUserInfo(), d.clearMenu(), s.push(i.loginPath);
1312
- }, se = (N) => {
1313
- V.value && !V.value.contains(N.target) && re(), Y.value && !Y.value.contains(N.target) && me();
1314
- }, $ = (N) => {
1315
- N.key === "Escape" && (me(), re());
1316
- };
1317
- return qe(() => {
1318
- document.addEventListener("click", se), document.addEventListener("fullscreenchange", he), document.addEventListener("keydown", $), Q.value = document.documentElement.classList.contains("grey-mode");
1319
- }), He(() => {
1320
- document.removeEventListener("click", se), document.removeEventListener("fullscreenchange", he), document.removeEventListener("keydown", $);
1321
- }), (N, C) => {
1322
- var le;
1323
- return o(), c("div", Js, [
1324
- e("div", Zs, [
1325
- e("img", {
1326
- src: p.value,
1327
- alt: "Logo",
1328
- class: "top-menu__logo-img"
1329
- }, null, 8, Qs),
1330
- e("span", eo, x(n(i).appName), 1)
1331
- ]),
1332
- w(n(Ze), {
1333
- "model-value": f.value,
1334
- mode: "horizontal",
1335
- "background-color": u.value,
1336
- "text-color": W.value,
1337
- "active-text-color": P.value,
1338
- class: "top-menu__menu",
1339
- onSelect: te
1340
- }, {
1341
- default: S(() => [
1342
- (o(!0), c(j, null, J(n(d).menuList, (r) => (o(), c(j, {
1343
- key: r.menuUrl
1344
- }, [
1345
- r.children && r.children.length > 0 ? (o(), A(n(We), {
1346
- key: 0,
1347
- index: r.menuUrl
1348
- }, {
1349
- title: S(() => [
1350
- e("span", to, [
1351
- r.menuName !== "首页" ? (o(), c("span", so, [
1352
- X(E(r.icon)) ? (o(), A(n(U), {
1353
- key: 0,
1354
- name: E(r.icon),
1355
- size: 16
1356
- }, null, 8, ["name"])) : (o(), c("span", oo, x(F(r.menuName)), 1))
1357
- ])) : z("", !0),
1358
- e("span", ao, x(r.menuName), 1)
1359
- ])
1360
- ]),
1361
- default: S(() => [
1362
- (o(!0), c(j, null, J(r.children, (v) => (o(), c(j, {
1363
- key: v.menuUrl
1364
- }, [
1365
- v.children && v.children.length > 0 ? (o(), A(n(We), {
1366
- key: 0,
1367
- index: v.menuUrl
1368
- }, {
1369
- title: S(() => [
1370
- e("span", no, [
1371
- e("span", lo, [
1372
- X(E(v.icon)) ? (o(), A(n(U), {
1373
- key: 0,
1374
- name: E(v.icon),
1375
- size: 16
1376
- }, null, 8, ["name"])) : (o(), c("span", ro, x(F(v.menuName)), 1))
1377
- ]),
1378
- e("span", io, x(v.menuName), 1)
1379
- ])
1380
- ]),
1381
- default: S(() => [
1382
- (o(!0), c(j, null, J(v.children, (O) => (o(), A(n(Ie), {
1383
- key: O.menuUrl,
1384
- index: O.menuUrl
1385
- }, {
1386
- default: S(() => [
1387
- e("span", co, [
1388
- e("span", uo, [
1389
- X(E(O.icon)) ? (o(), A(n(U), {
1390
- key: 0,
1391
- name: E(O.icon),
1392
- size: 16
1393
- }, null, 8, ["name"])) : (o(), c("span", mo, x(F(O.menuName)), 1))
1394
- ]),
1395
- e("span", po, x(O.menuName), 1)
1396
- ])
1397
- ]),
1398
- _: 2
1399
- }, 1032, ["index"]))), 128))
1400
- ]),
1401
- _: 2
1402
- }, 1032, ["index"])) : (o(), A(n(Ie), {
1403
- key: 1,
1404
- index: v.menuUrl
1405
- }, {
1406
- default: S(() => [
1407
- e("span", vo, [
1408
- e("span", ho, [
1409
- X(E(v.icon)) ? (o(), A(n(U), {
1410
- key: 0,
1411
- name: E(v.icon),
1412
- size: 16
1413
- }, null, 8, ["name"])) : (o(), c("span", _o, x(F(v.menuName)), 1))
1414
- ]),
1415
- e("span", fo, x(v.menuName), 1)
1416
- ])
1417
- ]),
1418
- _: 2
1419
- }, 1032, ["index"]))
1420
- ], 64))), 128))
1421
- ]),
1422
- _: 2
1423
- }, 1032, ["index"])) : (o(), A(n(Ie), {
1424
- key: 1,
1425
- index: r.menuUrl
1426
- }, {
1427
- default: S(() => [
1428
- e("span", go, [
1429
- r.menuName !== "首页" ? (o(), c("span", yo, [
1430
- X(E(r.icon)) ? (o(), A(n(U), {
1431
- key: 0,
1432
- name: E(r.icon),
1433
- size: 16
1434
- }, null, 8, ["name"])) : (o(), c("span", bo, x(F(r.menuName)), 1))
1435
- ])) : z("", !0),
1436
- e("span", wo, x(r.menuName), 1)
1437
- ])
1438
- ]),
1439
- _: 2
1440
- }, 1032, ["index"]))
1441
- ], 64))), 128))
1442
- ]),
1443
- _: 1
1444
- }, 8, ["model-value", "background-color", "text-color", "active-text-color"]),
1445
- e("div", ko, [
1446
- e("div", {
1447
- class: "top-menu__search",
1448
- ref_key: "searchRef",
1449
- ref: Y
1450
- }, [
1451
- w(n(U), {
1452
- name: "search",
1453
- size: 14,
1454
- class: "top-menu__search-icon"
1455
- }),
1456
- De(e("input", {
1457
- "onUpdate:modelValue": C[0] || (C[0] = (r) => ee.value = r),
1458
- type: "text",
1459
- class: "top-menu__search-input",
1460
- placeholder: "搜索菜单...",
1461
- onFocus: C[1] || (C[1] = (r) => G.value = !0)
1462
- }, null, 544), [
1463
- [Ye, ee.value]
1464
- ]),
1465
- w(Se, { name: "search-dropdown" }, {
1466
- default: S(() => [
1467
- G.value && (g.value.length > 0 || ee.value) ? (o(), c("div", xo, [
1468
- g.value.length > 0 ? (o(), c("div", Co, [
1469
- (o(!0), c(j, null, J(g.value, (r) => (o(), c("div", {
1470
- key: r.path,
1471
- class: "top-menu__search-item",
1472
- onClick: (v) => ge(r.path)
1473
- }, [
1474
- r.title !== "首页" ? (o(), c("span", Lo, [
1475
- X(E(r.icon)) ? (o(), A(n(U), {
1476
- key: 0,
1477
- name: E(r.icon),
1478
- size: 16
1479
- }, null, 8, ["name"])) : (o(), c("span", Mo, x(F(r.title)), 1))
1480
- ])) : z("", !0),
1481
- e("span", So, x(r.title), 1),
1482
- r.parentTitle ? (o(), c("span", No, x(r.parentTitle), 1)) : z("", !0)
1483
- ], 8, $o))), 128))
1484
- ])) : (o(), c("div", Eo, " 未找到匹配的菜单 "))
1485
- ])) : z("", !0)
1486
- ]),
1487
- _: 1
1488
- })
1489
- ], 512),
1490
- e("div", {
1491
- class: "top-menu__action",
1492
- onClick: oe,
1493
- title: R.value ? "退出全屏" : "全屏"
1494
- }, [
1495
- w(n(U), {
1496
- name: R.value ? "fullscreen-exit" : "fullscreen",
1497
- size: 16
1498
- }, null, 8, ["name"])
1499
- ], 8, Io),
1500
- e("div", {
1501
- class: "top-menu__action",
1502
- onClick: ie,
1503
- title: "换肤设置"
1504
- }, [
1505
- w(n(U), {
1506
- name: "skin",
1507
- size: 16
1508
- })
1509
- ]),
1510
- e("div", {
1511
- class: "top-menu__action",
1512
- onClick: K,
1513
- title: "切换主题"
1514
- }, [
1515
- w(n(U), {
1516
- name: n(i).isDark ? "sun" : "moon",
1517
- size: 16
1518
- }, null, 8, ["name"])
1519
- ]),
1520
- e("div", {
1521
- class: "top-menu__user",
1522
- ref_key: "dropdownRef",
1523
- ref: V
1524
- }, [
1525
- e("div", {
1526
- class: "top-menu__user-trigger",
1527
- onClick: Ae(we, ["stop"])
1528
- }, [
1529
- e("div", Uo, [
1530
- e("span", null, x(((le = n(h).userName) == null ? void 0 : le.charAt(0)) || "U"), 1)
1531
- ]),
1532
- e("span", To, x(n(h).userName), 1),
1533
- e("span", {
1534
- class: Z(["top-menu__user-arrow", { "is-active": B.value }])
1535
- }, [...C[3] || (C[3] = [
1536
- e("svg", {
1537
- viewBox: "0 0 12 12",
1538
- width: "10",
1539
- height: "10",
1540
- fill: "none",
1541
- stroke: "currentColor",
1542
- "stroke-width": "1.5",
1543
- "stroke-linecap": "round",
1544
- "stroke-linejoin": "round"
1545
- }, [
1546
- e("path", { d: "M2.5 4.5 6 8l3.5-3.5" })
1547
- ], -1)
1548
- ])], 2)
1549
- ]),
1550
- w(Se, { name: "dropdown" }, {
1551
- default: S(() => {
1552
- var r;
1553
- return [
1554
- B.value ? (o(), c("div", Po, [
1555
- e("div", zo, [
1556
- e("div", Fo, [
1557
- e("span", null, x(((r = n(h).userName) == null ? void 0 : r.charAt(0)) || "U"), 1)
1558
- ]),
1559
- e("div", Do, [
1560
- e("div", Ao, x(n(h).userName), 1),
1561
- e("div", Bo, x(n(h).departmentName), 1)
1562
- ])
1563
- ]),
1564
- C[8] || (C[8] = e("div", { class: "top-menu__dropdown-divider" }, null, -1)),
1565
- e("div", Vo, [
1566
- e("div", {
1567
- class: "top-menu__dropdown-item",
1568
- onClick: xe
1569
- }, [
1570
- w(n(U), {
1571
- name: "user",
1572
- size: 16
1573
- }),
1574
- C[4] || (C[4] = e("span", null, "个人信息", -1))
1575
- ]),
1576
- e("div", {
1577
- class: "top-menu__dropdown-item",
1578
- onClick: I
1579
- }, [
1580
- w(n(U), {
1581
- name: "lock",
1582
- size: 16
1583
- }),
1584
- C[5] || (C[5] = e("span", null, "修改密码", -1))
1585
- ]),
1586
- C[7] || (C[7] = e("div", { class: "top-menu__dropdown-divider" }, null, -1)),
1587
- e("div", {
1588
- class: "top-menu__dropdown-item top-menu__dropdown-item--danger",
1589
- onClick: b
1590
- }, [
1591
- w(n(U), {
1592
- name: "logout",
1593
- size: 16
1594
- }),
1595
- C[6] || (C[6] = e("span", null, "退出登录", -1))
1596
- ])
1597
- ])
1598
- ])) : z("", !0)
1599
- ];
1600
- }),
1601
- _: 1
1602
- })
1603
- ], 512)
1604
- ]),
1605
- w(n(Qe), {
1606
- modelValue: H.value,
1607
- "onUpdate:modelValue": C[2] || (C[2] = (r) => H.value = r),
1608
- title: "换肤设置",
1609
- direction: "rtl",
1610
- size: "320px"
1611
- }, {
1612
- default: S(() => [
1613
- e("div", Oo, [
1614
- e("div", Ro, [
1615
- C[12] || (C[12] = e("div", { class: "settings-title" }, "布局模式", -1)),
1616
- e("div", Ko, [
1617
- (o(), c(j, null, J(pe, (r) => e("div", {
1618
- key: r.value,
1619
- class: Z(["layout-option", { "is-active": ve.value === r.value }]),
1620
- onClick: (v) => ne(r.value)
1621
- }, [
1622
- e("div", Wo, [
1623
- r.value === "sidebar" ? (o(), c("div", qo, [...C[9] || (C[9] = [
1624
- e("div", { class: "preview-aside" }, null, -1),
1625
- e("div", { class: "preview-main" }, [
1626
- e("div", { class: "preview-header" }),
1627
- e("div", { class: "preview-content" })
1628
- ], -1)
1629
- ])])) : r.value === "top" ? (o(), c("div", Ho, [...C[10] || (C[10] = [
1630
- e("div", { class: "preview-header-full" }, null, -1),
1631
- e("div", { class: "preview-content-full" }, null, -1)
1632
- ])])) : (o(), c("div", Yo, [...C[11] || (C[11] = [
1633
- e("div", { class: "preview-header-mix" }, [
1634
- e("div", { class: "preview-mix-left" })
1635
- ], -1),
1636
- e("div", { class: "preview-mix-body" }, [
1637
- e("div", { class: "preview-mix-aside" }),
1638
- e("div", { class: "preview-mix-content" })
1639
- ], -1)
1640
- ])]))
1641
- ]),
1642
- e("span", Go, x(r.label), 1)
1643
- ], 10, jo)), 64))
1644
- ])
1645
- ]),
1646
- e("div", Xo, [
1647
- C[13] || (C[13] = e("div", { class: "settings-title" }, "主题色", -1)),
1648
- e("div", Jo, [
1649
- (o(), c(j, null, J(ke, (r) => e("div", {
1650
- key: r.value,
1651
- class: Z(["color-option", { "is-active": n(i).primaryColor === r.value }]),
1652
- style: Ue({ backgroundColor: r.value }),
1653
- title: r.label,
1654
- onClick: (v) => ye(r.value)
1655
- }, [
1656
- n(i).primaryColor === r.value ? (o(), A(n(U), {
1657
- key: 0,
1658
- name: "check",
1659
- size: 12,
1660
- color: "#fff"
1661
- })) : z("", !0)
1662
- ], 14, Zo)), 64))
1663
- ])
1664
- ]),
1665
- e("div", Qo, [
1666
- C[18] || (C[18] = e("div", { class: "settings-title" }, "功能设置", -1)),
1667
- e("div", ea, [
1668
- e("div", ta, [
1669
- C[15] || (C[15] = e("span", null, "灰色模式", -1)),
1670
- e("div", {
1671
- class: Z(["switch-wrapper", { "is-checked": Q.value }]),
1672
- onClick: M
1673
- }, [...C[14] || (C[14] = [
1674
- e("span", { class: "switch-core" }, null, -1)
1675
- ])], 2)
1676
- ]),
1677
- e("div", sa, [
1678
- C[17] || (C[17] = e("span", null, "暗黑模式", -1)),
1679
- e("div", {
1680
- class: Z(["switch-wrapper", { "is-checked": n(i).isDark }]),
1681
- onClick: q
1682
- }, [...C[16] || (C[16] = [
1683
- e("span", { class: "switch-core" }, null, -1)
1684
- ])], 2)
1685
- ])
1686
- ])
1687
- ])
1688
- ])
1689
- ]),
1690
- _: 1
1691
- }, 8, ["modelValue"])
1692
- ]);
1693
- };
1694
- }
1695
- }), aa = /* @__PURE__ */ de(oa, [["__scopeId", "data-v-711d5b8d"]]), na = { class: "mix-top-menu" }, la = { class: "mix-top-menu__logo" }, ra = ["src"], ia = { class: "mix-top-menu__logo-text" }, ca = { class: "mix-top-menu__menu-content" }, ua = {
1696
- key: 0,
1697
- class: "mix-top-menu__menu-icon"
1698
- }, da = {
1699
- key: 1,
1700
- class: "mix-top-menu__menu-char"
1701
- }, ma = { class: "mix-top-menu__menu-text" }, pa = { class: "mix-top-menu__actions" }, va = {
1702
- key: 0,
1703
- class: "mix-top-menu__search-dropdown"
1704
- }, ha = {
1705
- key: 0,
1706
- class: "mix-top-menu__search-results"
1707
- }, _a = ["onClick"], fa = {
1708
- key: 0,
1709
- class: "mix-top-menu__search-icon-item"
1710
- }, ga = {
1711
- key: 1,
1712
- class: "mix-top-menu__search-char"
1713
- }, ya = { class: "mix-top-menu__search-item-title" }, ba = {
1714
- key: 1,
1715
- class: "mix-top-menu__search-item-parent"
1716
- }, wa = {
1717
- key: 1,
1718
- class: "mix-top-menu__search-empty"
1719
- }, ka = ["title"], xa = { class: "mix-top-menu__avatar" }, Ca = { class: "mix-top-menu__user-name" }, $a = {
1720
- key: 0,
1721
- class: "mix-top-menu__dropdown"
1722
- }, La = { class: "mix-top-menu__dropdown-header" }, Ma = { class: "mix-top-menu__dropdown-avatar" }, Sa = { class: "mix-top-menu__dropdown-info" }, Na = { class: "mix-top-menu__dropdown-name" }, Ea = { class: "mix-top-menu__dropdown-role" }, Ia = { class: "mix-top-menu__dropdown-menu" }, Ua = { class: "settings-drawer" }, Ta = { class: "settings-section" }, Pa = { class: "settings-layout-options" }, za = ["onClick"], Fa = { class: "layout-option__preview" }, Da = {
1723
- key: 0,
1724
- class: "layout-preview-sidebar"
1725
- }, Aa = {
1726
- key: 1,
1727
- class: "layout-preview-top"
1728
- }, Ba = {
1729
- key: 2,
1730
- class: "layout-preview-mix"
1731
- }, Va = { class: "layout-option__label" }, Oa = { class: "settings-section" }, Ra = { class: "settings-color-options" }, Ka = ["title", "onClick"], ja = { class: "settings-section" }, Wa = { class: "settings-switch-list" }, qa = { class: "settings-switch-item" }, Ha = { class: "settings-switch-item" }, Ya = /* @__PURE__ */ ce({
1732
- __name: "MixTopMenu",
1733
- props: {
1734
- logoSrc: {}
1735
- },
1736
- setup(t) {
1737
- const a = t, p = k(() => a.logoSrc || Te("/vite.svg")), l = Ee(), s = be(), d = fe(), i = _e(), h = ue(), m = ze(), f = y(""), _ = (r, v = "") => {
1738
- const O = [];
1739
- return r.forEach((L) => {
1740
- L.children && L.children.length > 0 ? O.push(..._(L.children, L.menuName)) : O.push({ ...L, parentTitle: v, title: L.menuName, path: L.menuUrl });
1741
- }), O;
1742
- }, g = k(() => E.value.trim() ? _(d.menuList).filter(
1743
- (v) => v.title.toLowerCase().includes(E.value.toLowerCase())
1744
- ) : []), u = k(() => {
1745
- const r = d.menuList.find((v) => v.menuUrl === f.value);
1746
- return (r == null ? void 0 : r.children) || [];
1747
- }), W = k(() => d.menuList.find((r) => !!(l.path === r.menuUrl || r.children && r.children.some((v) => l.path.startsWith(v.menuUrl) || l.path === v.menuUrl)))), P = () => {
1748
- W.value ? f.value = W.value.menuUrl : d.menuList.length > 0 && (f.value = d.menuList[0].menuUrl);
1749
- }, B = (r) => {
1750
- f.value = r;
1751
- const v = d.menuList.find((O) => O.menuUrl === r);
1752
- if (v)
1753
- if (v.children && v.children.length > 0) {
1754
- const O = v.children[0].menuUrl;
1755
- l.path !== O && s.push(O);
1756
- } else
1757
- l.path !== r && s.push(r);
1758
- }, V = k(() => i.isDark ? "#1d1e1f" : "#fff"), R = k(() => i.isDark ? "#cfd3dc" : "#303133"), H = k(() => "#409eff"), Q = y(!1), G = y(null), ee = y(!1), Y = y(!1), te = y(!1), D = y(!1), E = y(""), F = y(null);
1759
- Le(() => l.path, () => {
1760
- P(), i.setMixSubMenus(u.value);
1761
- }), Le(() => d.menuList, (r) => {
1762
- r && r.length > 0 && (P(), i.setMixSubMenus(u.value));
1763
- }, { immediate: !0 });
1764
- const X = /* @__PURE__ */ new Set([
1765
- "arrow-up",
1766
- "arrow-down",
1767
- "arrow-left",
1768
- "arrow-right",
1769
- "caret-down",
1770
- "caret-right",
1771
- "plus",
1772
- "minus",
1773
- "close",
1774
- "check",
1775
- "edit",
1776
- "delete",
1777
- "copy",
1778
- "download",
1779
- "upload",
1780
- "refresh",
1781
- "search",
1782
- "filter",
1783
- "more",
1784
- "setting",
1785
- "share",
1786
- "loading",
1787
- "info",
1788
- "success",
1789
- "warning",
1790
- "error",
1791
- "question",
1792
- "user",
1793
- "user-add",
1794
- "user-group",
1795
- "logout",
1796
- "login",
1797
- "file",
1798
- "folder",
1799
- "folder-open",
1800
- "document",
1801
- "image",
1802
- "video",
1803
- "music",
1804
- "camera",
1805
- "mail",
1806
- "phone",
1807
- "chat",
1808
- "bell",
1809
- "message",
1810
- "eye",
1811
- "eye-off",
1812
- "calendar",
1813
- "clock",
1814
- "history",
1815
- "timer",
1816
- "location",
1817
- "map",
1818
- "globe",
1819
- "star",
1820
- "heart",
1821
- "thumb-up",
1822
- "link",
1823
- "external-link",
1824
- "lock",
1825
- "unlock",
1826
- "key",
1827
- "home",
1828
- "menu",
1829
- "menu-fold",
1830
- "menu-unfold",
1831
- "sidebar-fold",
1832
- "sidebar-expand",
1833
- "sidebar-left",
1834
- "dashboard",
1835
- "chart",
1836
- "chart-pie",
1837
- "chart-line",
1838
- "report",
1839
- "analytics",
1840
- "system",
1841
- "permission",
1842
- "role",
1843
- "user-manage",
1844
- "log",
1845
- "notification",
1846
- "app",
1847
- "list",
1848
- "grid",
1849
- "fullscreen",
1850
- "fullscreen-exit",
1851
- "zoom-in",
1852
- "zoom-out",
1853
- "print",
1854
- "bookmark",
1855
- "tag",
1856
- "code",
1857
- "terminal",
1858
- "database",
1859
- "server",
1860
- "cloud",
1861
- "gift",
1862
- "moon",
1863
- "sun",
1864
- "theme",
1865
- "skin"
1866
- ]), K = (r) => {
1867
- if (!r || r === "") return "";
1868
- if (r.startsWith("tineco-icon-")) {
1869
- const O = r.replace("tineco-icon-", "");
1870
- return {
1871
- home: "home",
1872
- dashboard: "dashboard",
1873
- system: "system",
1874
- user: "user",
1875
- role: "role",
1876
- menu: "list",
1877
- setting: "setting",
1878
- file: "file",
1879
- folder: "folder",
1880
- chart: "chart",
1881
- report: "report",
1882
- analytics: "analytics"
1883
- }[O] || O;
1884
- }
1885
- return {
1886
- dashboard: "dashboard",
1887
- system: "system",
1888
- user: "user",
1889
- role: "role",
1890
- menu: "list",
1891
- setting: "setting",
1892
- home: "home",
1893
- chart: "chart",
1894
- report: "report",
1895
- analytics: "analytics",
1896
- permission: "permission",
1897
- log: "log",
1898
- notification: "notification",
1899
- app: "app",
1900
- list: "list",
1901
- grid: "grid"
1902
- }[r] || r;
1903
- }, oe = (r) => r ? r.charAt(0) : "", he = (r) => X.has(r), we = () => {
1904
- i.toggleTheme(), Y.value = !1;
1905
- }, re = () => {
1906
- document.fullscreenElement ? document.exitFullscreen() : document.documentElement.requestFullscreen();
1907
- }, me = () => {
1908
- ee.value = !!document.fullscreenElement;
1909
- }, ge = () => {
1910
- Q.value = !Q.value;
1911
- }, ie = () => {
1912
- Q.value = !1;
1913
- }, ae = () => {
1914
- D.value = !1, E.value = "";
1915
- }, M = (r) => {
1916
- s.push(r), ae();
1917
- }, q = () => {
1918
- Y.value = !0;
1919
- }, pe = (r) => {
1920
- te.value = r;
1921
- const v = document.documentElement;
1922
- r ? v.classList.add("grey-mode") : v.classList.remove("grey-mode");
1923
- }, ve = () => {
1924
- pe(!te.value), Y.value = !1;
1925
- }, ne = () => {
1926
- i.toggleTheme(), Y.value = !1;
1927
- }, ke = [
1928
- { value: "sidebar", label: "左侧菜单", icon: "sidebar-left" },
1929
- { value: "top", label: "顶部菜单", icon: "menu" },
1930
- { value: "mix", label: "混合菜单", icon: "grid" }
1931
- ], ye = k(() => i.layout), xe = (r) => {
1932
- i.setLayout(r), Y.value = !1;
1933
- }, I = [
1934
- { value: "#409eff", label: "默认蓝" },
1935
- { value: "#0F6FDE", label: "企业蓝" },
1936
- { value: "#00A870", label: "翡翠绿" },
1937
- { value: "#D46B08", label: "琥珀橙" },
1938
- { value: "#1F2329", label: "石墨黑" }
1939
- ], b = (r) => {
1940
- i.setPrimaryColor(r), Y.value = !1;
1941
- }, se = () => {
1942
- ie(), s.push("/profile");
1943
- }, $ = () => {
1944
- ie(), s.push("/change-password");
1945
- }, N = () => {
1946
- ie(), m.logout(), h.clearUserInfo(), d.clearMenu(), s.push(i.loginPath);
1947
- }, C = (r) => {
1948
- G.value && !G.value.contains(r.target) && ie(), F.value && !F.value.contains(r.target) && ae();
1949
- }, le = (r) => {
1950
- r.key === "Escape" && (ae(), ie());
1951
- };
1952
- return qe(() => {
1953
- document.addEventListener("click", C), document.addEventListener("fullscreenchange", me), document.addEventListener("keydown", le), te.value = document.documentElement.classList.contains("grey-mode"), P();
1954
- }), He(() => {
1955
- document.removeEventListener("click", C), document.removeEventListener("fullscreenchange", me), document.removeEventListener("keydown", le);
1956
- }), (r, v) => {
1957
- var O;
1958
- return o(), c("div", na, [
1959
- e("div", la, [
1960
- e("img", {
1961
- src: p.value,
1962
- alt: "Logo",
1963
- class: "mix-top-menu__logo-img"
1964
- }, null, 8, ra),
1965
- e("span", ia, x(n(i).appName), 1)
1966
- ]),
1967
- w(n(Ze), {
1968
- "model-value": f.value,
1969
- mode: "horizontal",
1970
- "background-color": V.value,
1971
- "text-color": R.value,
1972
- "active-text-color": H.value,
1973
- class: "mix-top-menu__menu",
1974
- onSelect: B
1975
- }, {
1976
- default: S(() => [
1977
- (o(!0), c(j, null, J(n(d).menuList, (L) => (o(), A(n(Ie), {
1978
- key: L.menuUrl,
1979
- index: L.menuUrl
1980
- }, {
1981
- default: S(() => [
1982
- e("span", ca, [
1983
- L.menuName !== "首页" ? (o(), c("span", ua, [
1984
- he(K(L.icon)) ? (o(), A(n(U), {
1985
- key: 0,
1986
- name: K(L.icon),
1987
- size: 16
1988
- }, null, 8, ["name"])) : (o(), c("span", da, x(oe(L.menuName)), 1))
1989
- ])) : z("", !0),
1990
- e("span", ma, x(L.menuName), 1)
1991
- ])
1992
- ]),
1993
- _: 2
1994
- }, 1032, ["index"]))), 128))
1995
- ]),
1996
- _: 1
1997
- }, 8, ["model-value", "background-color", "text-color", "active-text-color"]),
1998
- e("div", pa, [
1999
- e("div", {
2000
- class: "mix-top-menu__search",
2001
- ref_key: "searchRef",
2002
- ref: F
2003
- }, [
2004
- w(n(U), {
2005
- name: "search",
2006
- size: 14,
2007
- class: "mix-top-menu__search-icon"
2008
- }),
2009
- De(e("input", {
2010
- "onUpdate:modelValue": v[0] || (v[0] = (L) => E.value = L),
2011
- type: "text",
2012
- class: "mix-top-menu__search-input",
2013
- placeholder: "搜索菜单...",
2014
- onFocus: v[1] || (v[1] = (L) => D.value = !0)
2015
- }, null, 544), [
2016
- [Ye, E.value]
2017
- ]),
2018
- w(Se, { name: "search-dropdown" }, {
2019
- default: S(() => [
2020
- D.value && (g.value.length > 0 || E.value) ? (o(), c("div", va, [
2021
- g.value.length > 0 ? (o(), c("div", ha, [
2022
- (o(!0), c(j, null, J(g.value, (L) => (o(), c("div", {
2023
- key: L.path,
2024
- class: "mix-top-menu__search-item",
2025
- onClick: (tt) => M(L.path)
2026
- }, [
2027
- L.title !== "首页" ? (o(), c("span", fa, [
2028
- he(K(L.icon)) ? (o(), A(n(U), {
2029
- key: 0,
2030
- name: K(L.icon),
2031
- size: 16
2032
- }, null, 8, ["name"])) : (o(), c("span", ga, x(oe(L.title)), 1))
2033
- ])) : z("", !0),
2034
- e("span", ya, x(L.title), 1),
2035
- L.parentTitle ? (o(), c("span", ba, x(L.parentTitle), 1)) : z("", !0)
2036
- ], 8, _a))), 128))
2037
- ])) : (o(), c("div", wa, " 未找到匹配的菜单 "))
2038
- ])) : z("", !0)
2039
- ]),
2040
- _: 1
2041
- })
2042
- ], 512),
2043
- e("div", {
2044
- class: "mix-top-menu__action",
2045
- onClick: re,
2046
- title: ee.value ? "退出全屏" : "全屏"
2047
- }, [
2048
- w(n(U), {
2049
- name: ee.value ? "fullscreen-exit" : "fullscreen",
2050
- size: 16
2051
- }, null, 8, ["name"])
2052
- ], 8, ka),
2053
- e("div", {
2054
- class: "mix-top-menu__action",
2055
- onClick: q,
2056
- title: "换肤设置"
2057
- }, [
2058
- w(n(U), {
2059
- name: "skin",
2060
- size: 16
2061
- })
2062
- ]),
2063
- e("div", {
2064
- class: "mix-top-menu__action",
2065
- onClick: we,
2066
- title: "切换主题"
2067
- }, [
2068
- w(n(U), {
2069
- name: n(i).isDark ? "sun" : "moon",
2070
- size: 16
2071
- }, null, 8, ["name"])
2072
- ]),
2073
- e("div", {
2074
- class: "mix-top-menu__user",
2075
- ref_key: "dropdownRef",
2076
- ref: G
2077
- }, [
2078
- e("div", {
2079
- class: "mix-top-menu__user-trigger",
2080
- onClick: Ae(ge, ["stop"])
2081
- }, [
2082
- e("div", xa, [
2083
- e("span", null, x(((O = n(h).userName) == null ? void 0 : O.charAt(0)) || "U"), 1)
2084
- ]),
2085
- e("span", Ca, x(n(h).userName), 1),
2086
- e("span", {
2087
- class: Z(["mix-top-menu__user-arrow", { "is-active": Q.value }])
2088
- }, [...v[3] || (v[3] = [
2089
- e("svg", {
2090
- viewBox: "0 0 12 12",
2091
- width: "10",
2092
- height: "10",
2093
- fill: "none",
2094
- stroke: "currentColor",
2095
- "stroke-width": "1.5",
2096
- "stroke-linecap": "round",
2097
- "stroke-linejoin": "round"
2098
- }, [
2099
- e("path", { d: "M2.5 4.5 6 8l3.5-3.5" })
2100
- ], -1)
2101
- ])], 2)
2102
- ]),
2103
- w(Se, { name: "dropdown" }, {
2104
- default: S(() => {
2105
- var L;
2106
- return [
2107
- Q.value ? (o(), c("div", $a, [
2108
- e("div", La, [
2109
- e("div", Ma, [
2110
- e("span", null, x(((L = n(h).userName) == null ? void 0 : L.charAt(0)) || "U"), 1)
2111
- ]),
2112
- e("div", Sa, [
2113
- e("div", Na, x(n(h).userName), 1),
2114
- e("div", Ea, x(n(h).departmentName), 1)
2115
- ])
2116
- ]),
2117
- v[8] || (v[8] = e("div", { class: "mix-top-menu__dropdown-divider" }, null, -1)),
2118
- e("div", Ia, [
2119
- e("div", {
2120
- class: "mix-top-menu__dropdown-item",
2121
- onClick: se
2122
- }, [
2123
- w(n(U), {
2124
- name: "user",
2125
- size: 16
2126
- }),
2127
- v[4] || (v[4] = e("span", null, "个人信息", -1))
2128
- ]),
2129
- e("div", {
2130
- class: "mix-top-menu__dropdown-item",
2131
- onClick: $
2132
- }, [
2133
- w(n(U), {
2134
- name: "lock",
2135
- size: 16
2136
- }),
2137
- v[5] || (v[5] = e("span", null, "修改密码", -1))
2138
- ]),
2139
- v[7] || (v[7] = e("div", { class: "mix-top-menu__dropdown-divider" }, null, -1)),
2140
- e("div", {
2141
- class: "mix-top-menu__dropdown-item mix-top-menu__dropdown-item--danger",
2142
- onClick: N
2143
- }, [
2144
- w(n(U), {
2145
- name: "logout",
2146
- size: 16
2147
- }),
2148
- v[6] || (v[6] = e("span", null, "退出登录", -1))
2149
- ])
2150
- ])
2151
- ])) : z("", !0)
2152
- ];
2153
- }),
2154
- _: 1
2155
- })
2156
- ], 512)
2157
- ]),
2158
- w(n(Qe), {
2159
- modelValue: Y.value,
2160
- "onUpdate:modelValue": v[2] || (v[2] = (L) => Y.value = L),
2161
- title: "换肤设置",
2162
- direction: "rtl",
2163
- size: "320px"
2164
- }, {
2165
- default: S(() => [
2166
- e("div", Ua, [
2167
- e("div", Ta, [
2168
- v[12] || (v[12] = e("div", { class: "settings-title" }, "布局模式", -1)),
2169
- e("div", Pa, [
2170
- (o(), c(j, null, J(ke, (L) => e("div", {
2171
- key: L.value,
2172
- class: Z(["layout-option", { "is-active": ye.value === L.value }]),
2173
- onClick: (tt) => xe(L.value)
2174
- }, [
2175
- e("div", Fa, [
2176
- L.value === "sidebar" ? (o(), c("div", Da, [...v[9] || (v[9] = [
2177
- e("div", { class: "preview-aside" }, null, -1),
2178
- e("div", { class: "preview-main" }, [
2179
- e("div", { class: "preview-header" }),
2180
- e("div", { class: "preview-content" })
2181
- ], -1)
2182
- ])])) : L.value === "top" ? (o(), c("div", Aa, [...v[10] || (v[10] = [
2183
- e("div", { class: "preview-header-full" }, null, -1),
2184
- e("div", { class: "preview-content-full" }, null, -1)
2185
- ])])) : (o(), c("div", Ba, [...v[11] || (v[11] = [
2186
- e("div", { class: "preview-header-mix" }, [
2187
- e("div", { class: "preview-mix-left" })
2188
- ], -1),
2189
- e("div", { class: "preview-mix-body" }, [
2190
- e("div", { class: "preview-mix-aside" }),
2191
- e("div", { class: "preview-mix-content" })
2192
- ], -1)
2193
- ])]))
2194
- ]),
2195
- e("span", Va, x(L.label), 1)
2196
- ], 10, za)), 64))
2197
- ])
2198
- ]),
2199
- e("div", Oa, [
2200
- v[13] || (v[13] = e("div", { class: "settings-title" }, "主题色", -1)),
2201
- e("div", Ra, [
2202
- (o(), c(j, null, J(I, (L) => e("div", {
2203
- key: L.value,
2204
- class: Z(["color-option", { "is-active": n(i).primaryColor === L.value }]),
2205
- style: Ue({ backgroundColor: L.value }),
2206
- title: L.label,
2207
- onClick: (tt) => b(L.value)
2208
- }, [
2209
- n(i).primaryColor === L.value ? (o(), A(n(U), {
2210
- key: 0,
2211
- name: "check",
2212
- size: 12,
2213
- color: "#fff"
2214
- })) : z("", !0)
2215
- ], 14, Ka)), 64))
2216
- ])
2217
- ]),
2218
- e("div", ja, [
2219
- v[18] || (v[18] = e("div", { class: "settings-title" }, "功能设置", -1)),
2220
- e("div", Wa, [
2221
- e("div", qa, [
2222
- v[15] || (v[15] = e("span", null, "灰色模式", -1)),
2223
- e("div", {
2224
- class: Z(["switch-wrapper", { "is-checked": te.value }]),
2225
- onClick: ve
2226
- }, [...v[14] || (v[14] = [
2227
- e("span", { class: "switch-core" }, null, -1)
2228
- ])], 2)
2229
- ]),
2230
- e("div", Ha, [
2231
- v[17] || (v[17] = e("span", null, "暗黑模式", -1)),
2232
- e("div", {
2233
- class: Z(["switch-wrapper", { "is-checked": n(i).isDark }]),
2234
- onClick: ne
2235
- }, [...v[16] || (v[16] = [
2236
- e("span", { class: "switch-core" }, null, -1)
2237
- ])], 2)
2238
- ])
2239
- ])
2240
- ])
2241
- ])
2242
- ]),
2243
- _: 1
2244
- }, 8, ["modelValue"])
2245
- ]);
2246
- };
2247
- }
2248
- }), Ga = /* @__PURE__ */ de(Ya, [["__scopeId", "data-v-ec17777f"]]), Xa = {
2249
- key: 0,
2250
- class: "layout layout--sidebar"
2251
- }, Ja = { class: "layout__main" }, Za = { class: "layout__header" }, Qa = { class: "layout__content" }, en = {
2252
- key: 1,
2253
- class: "layout layout--top"
2254
- }, tn = { class: "layout__top-menu" }, sn = { class: "layout__main" }, on = { class: "layout__content" }, an = {
2255
- key: 2,
2256
- class: "layout layout--mix"
2257
- }, nn = { class: "layout__mix-top-menu" }, ln = { class: "layout__mix-body" }, rn = { class: "layout__content" }, cn = /* @__PURE__ */ ce({
2258
- __name: "index",
2259
- props: {
2260
- logoSrc: {}
2261
- },
2262
- setup(t) {
2263
- const a = t, p = k(() => a.logoSrc || Te("/vite.svg")), l = _e(), s = fe(), d = k(
2264
- () => l.isCollapsed ? "64px" : "210px"
2265
- ), i = k(() => l.layout), h = k(() => i.value === "mix"), m = k(() => i.value === "sidebar" ? s.menuList : i.value === "mix" ? l.mixSubMenus : []), f = k(() => h.value ? m.value.length > 0 : !1);
2266
- return (_, g) => {
2267
- const u = mt("router-view");
2268
- return o(), c(j, null, [
2269
- i.value === "sidebar" ? (o(), c("div", Xa, [
2270
- e("aside", {
2271
- class: "layout__aside",
2272
- style: Ue({ width: d.value })
2273
- }, [
2274
- w(lt, {
2275
- "menu-list": m.value,
2276
- "show-logo": !0,
2277
- "show-user": !0,
2278
- "logo-src": p.value
2279
- }, null, 8, ["menu-list", "logo-src"])
2280
- ], 4),
2281
- e("div", Ja, [
2282
- e("header", Za, [
2283
- w(Xs)
2284
- ]),
2285
- e("main", Qa, [
2286
- w(u)
2287
- ])
2288
- ])
2289
- ])) : z("", !0),
2290
- i.value === "top" ? (o(), c("div", en, [
2291
- e("div", tn, [
2292
- w(aa, { "logo-src": p.value }, null, 8, ["logo-src"])
2293
- ]),
2294
- e("div", sn, [
2295
- e("main", on, [
2296
- w(u)
2297
- ])
2298
- ])
2299
- ])) : z("", !0),
2300
- i.value === "mix" ? (o(), c("div", an, [
2301
- e("div", nn, [
2302
- w(Ga, { "logo-src": p.value }, null, 8, ["logo-src"])
2303
- ]),
2304
- e("div", ln, [
2305
- f.value ? (o(), c("aside", {
2306
- key: 0,
2307
- class: "layout__aside",
2308
- style: Ue({ width: d.value })
2309
- }, [
2310
- w(lt, {
2311
- "menu-list": m.value,
2312
- "show-logo": !1,
2313
- "show-user": !1
2314
- }, null, 8, ["menu-list"])
2315
- ], 4)) : z("", !0),
2316
- e("main", rn, [
2317
- w(u)
2318
- ])
2319
- ])
2320
- ])) : z("", !0)
2321
- ], 64);
2322
- };
2323
- }
2324
- }), vt = /* @__PURE__ */ de(cn, [["__scopeId", "data-v-4e5f3bf5"]]), un = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2325
- __proto__: null,
2326
- default: vt
2327
- }, Symbol.toStringTag, { value: "Module" })), dn = { class: "tabs-wrapper" }, mn = { class: "tab-label" }, pn = ["onClick"], vn = /* @__PURE__ */ ce({
2328
- __name: "Tabs",
2329
- setup(t) {
2330
- const a = Ee(), p = be(), l = k(() => {
2331
- const h = [];
2332
- return a.matched.forEach((m) => {
2333
- var f;
2334
- (f = m.meta) != null && f.affix && h.push({
2335
- name: m.name,
2336
- title: m.meta.title,
2337
- path: m.path,
2338
- affix: !0
2339
- });
2340
- }), h;
2341
- }), s = k(() => a.path), d = (h) => {
2342
- p.push(h);
2343
- }, i = (h) => {
2344
- const m = l.value.find((f) => f.path === h);
2345
- if (!(m != null && m.affix) && h === s.value) {
2346
- const f = l.value.findIndex((g) => g.path === h), _ = l.value[f - 1] || l.value[f + 1];
2347
- _ && p.push(_.path);
2348
- }
2349
- };
2350
- return (h, m) => (o(), c("div", dn, [
2351
- w(n(It), {
2352
- modelValue: s.value,
2353
- "onUpdate:modelValue": m[0] || (m[0] = (f) => s.value = f),
2354
- type: "card",
2355
- onTabClick: d
2356
- }, {
2357
- default: S(() => [
2358
- (o(!0), c(j, null, J(l.value, (f) => (o(), A(n(Ut), {
2359
- key: f.path,
2360
- name: f.path,
2361
- label: f.title,
2362
- closable: !f.affix
2363
- }, {
2364
- label: S(() => [
2365
- e("span", mn, [
2366
- Ce(x(f.title) + " ", 1),
2367
- f.affix ? z("", !0) : (o(), c("span", {
2368
- key: 0,
2369
- class: "tab-close",
2370
- onClick: Ae((_) => i(f.path), ["stop"])
2371
- }, " ✕ ", 8, pn))
2372
- ])
2373
- ]),
2374
- _: 2
2375
- }, 1032, ["name", "label", "closable"]))), 128))
2376
- ]),
2377
- _: 1
2378
- }, 8, ["modelValue"])
2379
- ]));
2380
- }
2381
- }), ol = /* @__PURE__ */ de(vn, [["__scopeId", "data-v-0a4ca30d"]]), hn = {}, _n = { class: "footer" };
2382
- function fn(t, a) {
2383
- return o(), c("div", _n, [...a[0] || (a[0] = [
2384
- e("span", null, "Copyright © 2024 Xto Demo. All Rights Reserved.", -1)
2385
- ])]);
2386
- }
2387
- const al = /* @__PURE__ */ de(hn, [["render", fn], ["__scopeId", "data-v-ac63e349"]]), gn = { class: "login-page" }, yn = { class: "login-form-section" }, bn = { class: "form-container" }, wn = { class: "input-wrapper" }, kn = { class: "input-wrapper" }, xn = { class: "form-options" }, Cn = { key: 0 }, $n = { key: 1 }, Ln = /* @__PURE__ */ ce({
2388
- __name: "index",
2389
- setup(t) {
2390
- const a = be(), p = Ee(), l = y(!1), s = y(!1), d = Ge({
2391
- uid: "",
2392
- password: ""
2393
- }), i = {
2394
- uid: [
2395
- { required: !0, message: "请输入用户名", trigger: "blur" }
2396
- ],
2397
- password: [
2398
- { required: !0, message: "请输入密码", trigger: "blur" },
2399
- { min: 6, message: "密码长度至少6位", trigger: "blur" }
2400
- ]
2401
- }, h = y(), m = async () => {
2402
- var f;
2403
- try {
2404
- await ((f = h.value) == null ? void 0 : f.validate()), l.value = !0;
2405
- const _ = await yt({
2406
- appId: Me(),
2407
- clientId: dt(),
2408
- uid: d.uid,
2409
- password: d.password,
2410
- code: !0
2411
- });
2412
- ut(_), Tt.success("登录成功");
2413
- const g = p.query.redirect;
2414
- g ? a.push(g) : a.push({ name: "Dashboard" });
2415
- } catch (_) {
2416
- console.error("登录失败:", _);
2417
- } finally {
2418
- l.value = !1;
2419
- }
2420
- };
2421
- return (f, _) => (o(), c("div", gn, [
2422
- _[10] || (_[10] = Fe('<div class="login-brand" data-v-20b19b53><div class="brand-content" data-v-20b19b53><div class="brand-logo" data-v-20b19b53><div class="logo-icon" data-v-20b19b53><svg viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg" data-v-20b19b53><rect width="48" height="48" rx="12" fill="currentColor" data-v-20b19b53></rect><path d="M14 24L20 30L34 16" stroke="white" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" data-v-20b19b53></path></svg></div><span class="logo-text" data-v-20b19b53>XTO</span></div><div class="brand-slogan" data-v-20b19b53><h1 data-v-20b19b53>企业级后台管理解决方案</h1><p data-v-20b19b53>开箱即用的中后台前端/设计解决方案</p></div><div class="brand-features" data-v-20b19b53><div class="feature-item" data-v-20b19b53><div class="feature-icon" data-v-20b19b53><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" data-v-20b19b53><path d="M13 2L3 14h9l-1 8 10-12h-9l1-8z" data-v-20b19b53></path></svg></div><div class="feature-text" data-v-20b19b53><h4 data-v-20b19b53>高性能</h4><p data-v-20b19b53>极致的渲染性能与响应速度</p></div></div><div class="feature-item" data-v-20b19b53><div class="feature-icon" data-v-20b19b53><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" data-v-20b19b53><rect x="3" y="3" width="18" height="18" rx="2" data-v-20b19b53></rect><path d="M9 9h6M9 12h6M9 15h4" data-v-20b19b53></path></svg></div><div class="feature-text" data-v-20b19b53><h4 data-v-20b19b53>丰富组件</h4><p data-v-20b19b53>60+ 高质量业务组件</p></div></div><div class="feature-item" data-v-20b19b53><div class="feature-icon" data-v-20b19b53><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" data-v-20b19b53><circle cx="12" cy="12" r="10" data-v-20b19b53></circle><path d="M12 6v6l4 2" data-v-20b19b53></path></svg></div><div class="feature-text" data-v-20b19b53><h4 data-v-20b19b53>持续更新</h4><p data-v-20b19b53>活跃的社区与快速迭代</p></div></div></div><div class="brand-decoration" data-v-20b19b53><div class="decoration-line" data-v-20b19b53></div><div class="decoration-dots" data-v-20b19b53><span data-v-20b19b53></span><span data-v-20b19b53></span><span data-v-20b19b53></span></div></div></div><div class="brand-bg" data-v-20b19b53><div class="bg-grid" data-v-20b19b53></div></div></div>', 1)),
2423
- e("div", yn, [
2424
- e("div", bn, [
2425
- _[7] || (_[7] = e("div", { class: "form-header" }, [
2426
- e("h2", null, "欢迎登录"),
2427
- e("p", null, "请输入您的账户信息")
2428
- ], -1)),
2429
- w(n(Pt), {
2430
- ref_key: "formRef",
2431
- ref: h,
2432
- model: d,
2433
- rules: i,
2434
- class: "login-form",
2435
- "label-width": "0"
2436
- }, {
2437
- default: S(() => [
2438
- w(n(Be), { prop: "uid" }, {
2439
- default: S(() => [
2440
- e("div", wn, [
2441
- _[3] || (_[3] = e("label", { class: "input-label" }, "用户名", -1)),
2442
- w(n(nt), {
2443
- modelValue: d.uid,
2444
- "onUpdate:modelValue": _[0] || (_[0] = (g) => d.uid = g),
2445
- placeholder: "请输入用户名",
2446
- size: "large"
2447
- }, {
2448
- prefix: S(() => [
2449
- w(n(U), {
2450
- name: "user",
2451
- size: 18
2452
- })
2453
- ]),
2454
- _: 1
2455
- }, 8, ["modelValue"])
2456
- ])
2457
- ]),
2458
- _: 1
2459
- }),
2460
- w(n(Be), { prop: "password" }, {
2461
- default: S(() => [
2462
- e("div", kn, [
2463
- _[4] || (_[4] = e("label", { class: "input-label" }, "密码", -1)),
2464
- w(n(nt), {
2465
- modelValue: d.password,
2466
- "onUpdate:modelValue": _[1] || (_[1] = (g) => d.password = g),
2467
- type: "password",
2468
- placeholder: "请输入密码",
2469
- size: "large",
2470
- "show-password": "",
2471
- onKeyup: Nt(m, ["enter"])
2472
- }, {
2473
- prefix: S(() => [
2474
- w(n(U), {
2475
- name: "lock",
2476
- size: 18
2477
- })
2478
- ]),
2479
- _: 1
2480
- }, 8, ["modelValue"])
2481
- ])
2482
- ]),
2483
- _: 1
2484
- }),
2485
- e("div", xn, [
2486
- w(n(zt), {
2487
- modelValue: s.value,
2488
- "onUpdate:modelValue": _[2] || (_[2] = (g) => s.value = g)
2489
- }, {
2490
- default: S(() => [..._[5] || (_[5] = [
2491
- Ce("记住我", -1)
2492
- ])]),
2493
- _: 1
2494
- }, 8, ["modelValue"]),
2495
- _[6] || (_[6] = e("a", {
2496
- href: "#",
2497
- class: "forgot-link"
2498
- }, "忘记密码?", -1))
2499
- ]),
2500
- w(n(Be), null, {
2501
- default: S(() => [
2502
- w(n(Ne), {
2503
- type: "primary",
2504
- size: "large",
2505
- loading: l.value,
2506
- class: "login-btn",
2507
- onClick: m
2508
- }, {
2509
- default: S(() => [
2510
- l.value ? (o(), c("span", $n, "登录中...")) : (o(), c("span", Cn, "登 录"))
2511
- ]),
2512
- _: 1
2513
- }, 8, ["loading"])
2514
- ]),
2515
- _: 1
2516
- })
2517
- ]),
2518
- _: 1
2519
- }, 8, ["model"]),
2520
- _[8] || (_[8] = Fe('<div class="form-footer" data-v-20b19b53><p data-v-20b19b53>其他登录方式</p><div class="social-login" data-v-20b19b53><button class="social-btn" title="企业微信" data-v-20b19b53><svg viewBox="0 0 24 24" fill="currentColor" data-v-20b19b53><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-1 17.93c-3.95-.49-7-3.85-7-7.93 0-.62.08-1.21.21-1.79L9 15v1c0 1.1.9 2 2 2v1.93zm6.9-2.54c-.26-.81-1-1.39-1.9-1.39h-1v-3c0-.55-.45-1-1-1H8v-2h2c.55 0 1-.45 1-1V7h2c1.1 0 2-.9 2-2v-.41c2.93 1.19 5 4.06 5 7.41 0 2.08-.8 3.97-2.1 5.39z" data-v-20b19b53></path></svg></button><button class="social-btn" title="钉钉" data-v-20b19b53><svg viewBox="0 0 24 24" fill="currentColor" data-v-20b19b53><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm4.64 6.8c-.15 1.58-.8 5.42-1.13 7.19-.14.75-.42 1-.68 1.03-.58.05-1.02-.38-1.58-.75-.88-.58-1.38-.94-2.23-1.5-.99-.65-.35-1.01.22-1.59.15-.15 2.71-2.48 2.76-2.69a.2.2 0 00-.05-.18c-.06-.05-.14-.03-.21-.02-.09.02-1.49.95-4.22 2.79-.4.27-.76.41-1.08.4-.36-.01-1.04-.2-1.55-.37-.63-.2-1.12-.31-1.08-.66.02-.18.27-.36.74-.55 2.92-1.27 4.86-2.11 5.83-2.51 2.78-1.16 3.35-1.36 3.73-1.36.08 0 .27.02.39.12.1.08.13.19.14.27-.01.06.01.24 0 .38z" data-v-20b19b53></path></svg></button><button class="social-btn" title="飞书" data-v-20b19b53><svg viewBox="0 0 24 24" fill="currentColor" data-v-20b19b53><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z" data-v-20b19b53></path></svg></button></div></div>', 1))
2521
- ]),
2522
- _[9] || (_[9] = e("div", { class: "copyright" }, [
2523
- e("p", null, "© 2024 XTO Team. All rights reserved.")
2524
- ], -1))
2525
- ])
2526
- ]));
2527
- }
2528
- }), Mn = /* @__PURE__ */ de(Ln, [["__scopeId", "data-v-20b19b53"]]), Sn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2529
- __proto__: null,
2530
- default: Mn
2531
- }, Symbol.toStringTag, { value: "Module" })), Nn = { class: "error-page" }, En = { class: "error-container" }, In = { class: "error-content" }, Un = { class: "error-actions" }, Tn = /* @__PURE__ */ ce({
2532
- __name: "404",
2533
- setup(t) {
2534
- const a = be(), p = () => {
2535
- a.push("/");
2536
- };
2537
- return (l, s) => (o(), c("div", Nn, [
2538
- e("div", En, [
2539
- s[7] || (s[7] = e("div", { class: "error-bg" }, [
2540
- e("div", { class: "bg-circle circle-1" }),
2541
- e("div", { class: "bg-circle circle-2" }),
2542
- e("div", { class: "bg-circle circle-3" })
2543
- ], -1)),
2544
- e("div", In, [
2545
- s[5] || (s[5] = Fe('<div class="error-code" data-v-c36cc0ad><span class="code-digit" data-v-c36cc0ad>4</span><span class="code-zero" data-v-c36cc0ad><span class="zero-inner" data-v-c36cc0ad>0</span></span><span class="code-digit" data-v-c36cc0ad>4</span></div><div class="error-illustration" data-v-c36cc0ad><svg viewBox="0 0 200 120" fill="none" xmlns="http://www.w3.org/2000/svg" data-v-c36cc0ad><rect x="40" y="20" width="120" height="80" rx="8" fill="var(--xto-fill-color, #F2F3F5)" stroke="var(--xto-border-color, #D9DCE1)" stroke-width="2" data-v-c36cc0ad></rect><rect x="50" y="30" width="100" height="60" rx="4" fill="var(--xto-bg-color, #FFFFFF)" data-v-c36cc0ad></rect><line x1="60" y1="45" x2="140" y2="45" stroke="var(--xto-border-color-light, #E5E6EB)" stroke-width="2" data-v-c36cc0ad></line><line x1="60" y1="55" x2="120" y2="55" stroke="var(--xto-border-color-light, #E5E6EB)" stroke-width="2" data-v-c36cc0ad></line><line x1="60" y1="65" x2="100" y2="65" stroke="var(--xto-border-color-light, #E5E6EB)" stroke-width="2" data-v-c36cc0ad></line><text x="100" y="75" text-anchor="middle" fill="var(--xto-color-primary, #4F46E5)" font-size="24" font-weight="600" data-v-c36cc0ad>?</text><circle cx="150" cy="35" r="12" stroke="var(--xto-color-primary, #4F46E5)" stroke-width="2" fill="none" data-v-c36cc0ad></circle><line x1="158" y1="43" x2="168" y2="53" stroke="var(--xto-color-primary, #4F46E5)" stroke-width="2" stroke-linecap="round" data-v-c36cc0ad></line></svg></div><h1 class="error-title" data-v-c36cc0ad>页面不存在</h1><p class="error-desc" data-v-c36cc0ad>抱歉,您访问的页面不存在或已被删除</p>', 4)),
2546
- e("div", Un, [
2547
- w(n(Ne), {
2548
- type: "primary",
2549
- size: "large",
2550
- onClick: p
2551
- }, {
2552
- icon: S(() => [...s[1] || (s[1] = [
2553
- e("svg", {
2554
- viewBox: "0 0 24 24",
2555
- fill: "none",
2556
- stroke: "currentColor",
2557
- "stroke-width": "2"
2558
- }, [
2559
- e("path", { d: "M3 9l9-7 9 7v11a2 2 0 01-2 2H5a2 2 0 01-2-2V9z" }),
2560
- e("polyline", { points: "9,22 9,12 15,12 15,22" })
2561
- ], -1)
2562
- ])]),
2563
- default: S(() => [
2564
- s[2] || (s[2] = Ce(" 返回首页 ", -1))
2565
- ]),
2566
- _: 1
2567
- }),
2568
- w(n(Ne), {
2569
- size: "large",
2570
- onClick: s[0] || (s[0] = (d) => n(a).go(-1))
2571
- }, {
2572
- icon: S(() => [...s[3] || (s[3] = [
2573
- e("svg", {
2574
- viewBox: "0 0 24 24",
2575
- fill: "none",
2576
- stroke: "currentColor",
2577
- "stroke-width": "2"
2578
- }, [
2579
- e("path", { d: "M19 12H5M12 19l-7-7 7-7" })
2580
- ], -1)
2581
- ])]),
2582
- default: S(() => [
2583
- s[4] || (s[4] = Ce(" 返回上一页 ", -1))
2584
- ]),
2585
- _: 1
2586
- })
2587
- ]),
2588
- s[6] || (s[6] = e("div", { class: "error-tip" }, [
2589
- e("p", null, "您可以尝试:"),
2590
- e("ul", null, [
2591
- e("li", null, "检查您输入的网址是否正确"),
2592
- e("li", null, "返回首页重新浏览"),
2593
- e("li", null, "联系管理员反馈问题")
2594
- ])
2595
- ], -1))
2596
- ])
2597
- ])
2598
- ]));
2599
- }
2600
- }), Pn = /* @__PURE__ */ de(Tn, [["__scopeId", "data-v-c36cc0ad"]]), ht = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2601
- __proto__: null,
2602
- default: Pn
2603
- }, Symbol.toStringTag, { value: "Module" })), zn = { class: "error-page" }, Fn = { class: "error-container" }, Dn = { class: "error-content" }, An = { class: "error-actions" }, Bn = /* @__PURE__ */ ce({
2604
- __name: "403",
2605
- setup(t) {
2606
- const a = be(), p = () => {
2607
- a.push("/");
2608
- };
2609
- return (l, s) => (o(), c("div", zn, [
2610
- e("div", Fn, [
2611
- s[7] || (s[7] = e("div", { class: "error-bg" }, [
2612
- e("div", { class: "bg-circle circle-1" }),
2613
- e("div", { class: "bg-circle circle-2" }),
2614
- e("div", { class: "bg-circle circle-3" })
2615
- ], -1)),
2616
- e("div", Dn, [
2617
- s[5] || (s[5] = Fe('<div class="error-code" data-v-e6e1f7ac><span class="code-digit" data-v-e6e1f7ac>4</span><span class="code-zero warning" data-v-e6e1f7ac><span class="zero-inner" data-v-e6e1f7ac>0</span></span><span class="code-digit" data-v-e6e1f7ac>3</span></div><div class="error-illustration" data-v-e6e1f7ac><svg viewBox="0 0 200 120" fill="none" xmlns="http://www.w3.org/2000/svg" data-v-e6e1f7ac><path d="M100 15 L150 35 L150 70 C150 95 100 110 100 110 C100 110 50 95 50 70 L50 35 Z" fill="var(--xto-color-warning-light-9, #FFF3E8)" stroke="var(--xto-color-warning, #FF7D00)" stroke-width="2" data-v-e6e1f7ac></path><rect x="85" y="55" width="30" height="25" rx="4" fill="var(--xto-color-warning, #FF7D00)" data-v-e6e1f7ac></rect><path d="M92 55 V48 A8 8 0 0 1 108 48 V55" fill="none" stroke="var(--xto-color-warning, #FF7D00)" stroke-width="3" data-v-e6e1f7ac></path><circle cx="100" cy="67" r="6" fill="none" stroke="#fff" stroke-width="2" data-v-e6e1f7ac></circle><line x1="96" y1="63" x2="104" y2="71" stroke="#fff" stroke-width="2" data-v-e6e1f7ac></line></svg></div><h1 class="error-title" data-v-e6e1f7ac>无访问权限</h1><p class="error-desc" data-v-e6e1f7ac>抱歉,您没有权限访问此页面,请联系管理员获取权限</p>', 4)),
2618
- e("div", An, [
2619
- w(n(Ne), {
2620
- type: "primary",
2621
- size: "large",
2622
- onClick: p
2623
- }, {
2624
- icon: S(() => [...s[1] || (s[1] = [
2625
- e("svg", {
2626
- viewBox: "0 0 24 24",
2627
- fill: "none",
2628
- stroke: "currentColor",
2629
- "stroke-width": "2"
2630
- }, [
2631
- e("path", { d: "M3 9l9-7 9 7v11a2 2 0 01-2 2H5a2 2 0 01-2-2V9z" }),
2632
- e("polyline", { points: "9,22 9,12 15,12 15,22" })
2633
- ], -1)
2634
- ])]),
2635
- default: S(() => [
2636
- s[2] || (s[2] = Ce(" 返回首页 ", -1))
2637
- ]),
2638
- _: 1
2639
- }),
2640
- w(n(Ne), {
2641
- size: "large",
2642
- onClick: s[0] || (s[0] = (d) => n(a).go(-1))
2643
- }, {
2644
- icon: S(() => [...s[3] || (s[3] = [
2645
- e("svg", {
2646
- viewBox: "0 0 24 24",
2647
- fill: "none",
2648
- stroke: "currentColor",
2649
- "stroke-width": "2"
2650
- }, [
2651
- e("path", { d: "M19 12H5M12 19l-7-7 7-7" })
2652
- ], -1)
2653
- ])]),
2654
- default: S(() => [
2655
- s[4] || (s[4] = Ce(" 返回上一页 ", -1))
2656
- ]),
2657
- _: 1
2658
- })
2659
- ]),
2660
- s[6] || (s[6] = e("div", { class: "error-tip" }, [
2661
- e("p", null, "可能的原因:"),
2662
- e("ul", null, [
2663
- e("li", null, "您的账号权限不足"),
2664
- e("li", null, "该页面需要特定角色才能访问"),
2665
- e("li", null, "您的登录状态已过期")
2666
- ])
2667
- ], -1))
2668
- ])
2669
- ])
2670
- ]));
2671
- }
2672
- }), nl = /* @__PURE__ */ de(Bn, [["__scopeId", "data-v-e6e1f7ac"]]);
2673
- function ll() {
2674
- const t = _e(), a = ue(), p = ze(), l = k(() => a.userName || ""), s = k(() => a.userInfo), d = k(() => t.appName), i = k(() => p.isLoggedIn), h = k(() => t.isDark), m = k(() => t.theme), f = k(() => t.isCollapsed), _ = k(() => t.layout);
2675
- return {
2676
- userName: l,
2677
- userInfo: s,
2678
- appName: d,
2679
- isLoggedIn: i,
2680
- isDark: h,
2681
- theme: m,
2682
- isCollapsed: f,
2683
- layout: _,
2684
- toggleTheme: () => {
2685
- t.toggleTheme();
2686
- },
2687
- toggleCollapse: () => {
2688
- t.toggleCollapse();
2689
- }
2690
- };
2691
- }
2692
- function rl() {
2693
- const t = ue();
2694
- return {
2695
- isLoggedIn: k(() => t.isLoggedIn)
2696
- };
2697
- }
2698
- function il(t, a = {}) {
2699
- const { rules: p, onSubmit: l } = a, s = y(), d = Ge({ ...t }), i = y(!1), h = y(!1), m = y(!1), f = () => {
2700
- u(), m.value = !1, h.value = !0;
2701
- }, _ = (P) => {
2702
- Object.assign(d, P), m.value = !0, h.value = !0;
2703
- }, g = () => {
2704
- h.value = !1, u();
2705
- }, u = () => {
2706
- var P;
2707
- Object.keys(t).forEach((B) => {
2708
- d[B] = t[B];
2709
- }), (P = s.value) == null || P.resetFields();
2710
- };
2711
- return {
2712
- formRef: s,
2713
- formData: d,
2714
- rules: p,
2715
- loading: i,
2716
- visible: h,
2717
- isEdit: m,
2718
- openAdd: f,
2719
- openEdit: _,
2720
- close: g,
2721
- resetForm: u,
2722
- handleSubmit: async () => {
2723
- var P;
2724
- try {
2725
- await ((P = s.value) == null ? void 0 : P.validate()), i.value = !0, await (l == null ? void 0 : l(d)), g();
2726
- } catch (B) {
2727
- console.error(B);
2728
- } finally {
2729
- i.value = !1;
2730
- }
2731
- }
2732
- };
2733
- }
2734
- function cl(t) {
2735
- const { fetchData: a, defaultPageSize: p = 10 } = t, l = y(!1), s = y([]), d = y(0), i = y(1), h = y(p), m = Ge({}), f = async () => {
2736
- l.value = !0;
2737
- try {
2738
- const V = {
2739
- ...m,
2740
- page: i.value,
2741
- pageSize: h.value
2742
- }, R = await a(V);
2743
- s.value = R.list, d.value = R.total;
2744
- } catch (V) {
2745
- console.error(V);
2746
- } finally {
2747
- l.value = !1;
2748
- }
2749
- }, _ = () => {
2750
- i.value = 1, f();
2751
- }, g = () => {
2752
- Object.keys(m).forEach((V) => {
2753
- m[V] = void 0;
2754
- }), i.value = 1, f();
2755
- }, u = (V) => {
2756
- i.value = V, f();
2757
- }, W = (V) => {
2758
- h.value = V, i.value = 1, f();
2759
- }, P = () => {
2760
- f();
2761
- }, B = k(() => ({
2762
- current: i.value,
2763
- pageSize: h.value,
2764
- total: d.value
2765
- }));
2766
- return {
2767
- loading: l,
2768
- data: s,
2769
- total: d,
2770
- currentPage: i,
2771
- pageSize: h,
2772
- searchParams: m,
2773
- pagination: B,
2774
- getData: f,
2775
- handleSearch: _,
2776
- handleReset: g,
2777
- handlePageChange: u,
2778
- handleSizeChange: W,
2779
- refresh: P
2780
- };
2781
- }
2782
- const et = Pe("locale", () => {
2783
- const t = T.get("locale") || "zh-CN", a = Ft(t), p = y(t), l = Dt(), { t: s, messages: d, setLocale: i, mergeMessages: h } = At(), m = k(() => {
2784
- const u = l.find((W) => W.code === p.value);
2785
- return (u == null ? void 0 : u.name) || p.value;
2786
- });
2787
- return {
2788
- locale: p,
2789
- localeName: m,
2790
- locales: l,
2791
- messages: d,
2792
- t: s,
2793
- changeLocale: (u) => {
2794
- p.value = u, i(u), T.set("locale", u), a.setLocale(u);
2795
- },
2796
- addMessages: (u) => {
2797
- h(u);
2798
- },
2799
- initLocale: () => {
2800
- i(t);
2801
- },
2802
- provider: a
2803
- };
2804
- }), Vn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2805
- __proto__: null,
2806
- useLocaleStore: et
2807
- }, Symbol.toStringTag, { value: "Module" }));
2808
- function ul() {
2809
- const t = et();
2810
- return {
2811
- /** 当前语言代码 */
2812
- locale: t.locale,
2813
- /** 当前语言名称 */
2814
- localeName: t.localeName,
2815
- /** 支持的语言列表 */
2816
- locales: t.locales,
2817
- /** 翻译函数 */
2818
- t: t.t,
2819
- /** 当前语言包 */
2820
- messages: t.messages,
2821
- /** 切换语言 */
2822
- setLocale: t.changeLocale,
2823
- /** 添加自定义翻译 */
2824
- addMessages: t.addMessages
2825
- };
2826
- }
2827
- function dl() {
2828
- return et().t;
2829
- }
2830
- function ml(t) {
2831
- const a = ue(), p = fe();
2832
- return a.isLoggedIn ? p.hasPermission(t) : !1;
2833
- }
2834
- function pl(t) {
2835
- return ue().isLoggedIn;
2836
- }
2837
- function vl() {
2838
- return !0;
2839
- }
2840
- const _t = [
2841
- {
2842
- path: "/login",
2843
- name: "Login",
2844
- component: () => Promise.resolve().then(() => Sn),
2845
- meta: {
2846
- title: "登录",
2847
- hidden: !0
2848
- }
2849
- }
2850
- ], ft = {
2851
- path: "/",
2852
- name: "Layout",
2853
- component: () => Promise.resolve().then(() => un),
2854
- redirect: "/dashboard",
2855
- children: [
2856
- {
2857
- path: "/dashboard",
2858
- name: "Dashboard",
2859
- component: () => import("./index-U6a8866w.js"),
2860
- meta: {
2861
- title: "仪表盘",
2862
- icon: "dashboard",
2863
- keepAlive: !0,
2864
- affix: !0
2865
- }
2866
- },
2867
- {
2868
- path: "/system/user",
2869
- name: "SystemUser",
2870
- component: () => import("./index-DkpGZDBh.js"),
2871
- meta: {
2872
- title: "用户管理",
2873
- icon: "user",
2874
- keepAlive: !0
2875
- }
2876
- },
2877
- {
2878
- path: "/system/role",
2879
- name: "SystemRole",
2880
- component: () => import("./index-B6OJp8lX.js"),
2881
- meta: {
2882
- title: "角色管理",
2883
- icon: "role",
2884
- keepAlive: !0
2885
- }
2886
- },
2887
- {
2888
- path: "/system/menu",
2889
- name: "SystemMenu",
2890
- component: () => import("./index-rfFkJbFI.js"),
2891
- meta: {
2892
- title: "菜单管理",
2893
- icon: "menu",
2894
- keepAlive: !0
2895
- }
2896
- },
2897
- // catch-all 路由:让 404 在 Layout 内部渲染,保持左侧菜单显示
2898
- {
2899
- path: "/:pathMatch(.*)*",
2900
- name: "CatchAll",
2901
- component: () => Promise.resolve().then(() => ht),
2902
- meta: {
2903
- title: "404",
2904
- hidden: !0
2905
- }
2906
- }
2907
- ]
2908
- }, hl = [
2909
- {
2910
- path: "/dashboard",
2911
- name: "Dashboard",
2912
- component: () => import("./index-U6a8866w.js"),
2913
- meta: {
2914
- title: "仪表盘",
2915
- icon: "dashboard",
2916
- keepAlive: !0,
2917
- affix: !0
2918
- }
2919
- },
2920
- {
2921
- path: "/system",
2922
- name: "System",
2923
- redirect: "/system/user",
2924
- meta: {
2925
- title: "系统管理",
2926
- icon: "setting"
2927
- },
2928
- children: [
2929
- {
2930
- path: "user",
2931
- name: "SystemUser",
2932
- component: () => import("./index-DkpGZDBh.js"),
2933
- meta: {
2934
- title: "用户管理",
2935
- icon: "user",
2936
- keepAlive: !0
2937
- }
2938
- },
2939
- {
2940
- path: "role",
2941
- name: "SystemRole",
2942
- component: () => import("./index-B6OJp8lX.js"),
2943
- meta: {
2944
- title: "角色管理",
2945
- icon: "role",
2946
- keepAlive: !0
2947
- }
2948
- },
2949
- {
2950
- path: "menu",
2951
- name: "SystemMenu",
2952
- component: () => import("./index-rfFkJbFI.js"),
2953
- meta: {
2954
- title: "菜单管理",
2955
- icon: "menu",
2956
- keepAlive: !0
2957
- }
2958
- }
2959
- ]
2960
- }
2961
- ], On = [
2962
- {
2963
- menuCode: "dashboard",
2964
- menuName: "仪表盘",
2965
- menuUrl: "/dashboard",
2966
- icon: "dashboard",
2967
- closable: !0,
2968
- isDefault: !0,
2969
- isOut: !1
2970
- },
2971
- {
2972
- menuCode: "system",
2973
- menuName: "系统管理",
2974
- menuUrl: "/system",
2975
- icon: "setting",
2976
- closable: !1,
2977
- isDefault: !1,
2978
- isOut: !1,
2979
- children: [
2980
- {
2981
- menuCode: "system_user",
2982
- menuName: "用户管理",
2983
- menuUrl: "/system/user",
2984
- icon: "user",
2985
- closable: !0,
2986
- isDefault: !1,
2987
- isOut: !1
2988
- },
2989
- {
2990
- menuCode: "system_role",
2991
- menuName: "角色管理",
2992
- menuUrl: "/system/role",
2993
- icon: "role",
2994
- closable: !0,
2995
- isDefault: !1,
2996
- isOut: !1
2997
- },
2998
- {
2999
- menuCode: "system_menu",
3000
- menuName: "菜单管理",
3001
- menuUrl: "/system/menu",
3002
- icon: "menu",
3003
- closable: !0,
3004
- isDefault: !1,
3005
- isOut: !1
3006
- }
3007
- ]
3008
- }
3009
- ], gt = Xe({
3010
- history: Je(),
3011
- routes: [..._t, ft],
3012
- scrollBehavior: () => ({ left: 0, top: 0 })
3013
- }), Rn = ["/login"];
3014
- gt.beforeEach(async (t, a, p) => {
3015
- const l = _e();
3016
- if (l.initTheme(), it())
3017
- if (t.path === "/login")
3018
- p({ path: "/" });
3019
- else {
3020
- const s = ue();
3021
- s.isLoggedIn || (s.setUserInfo({
3022
- appId: Me(),
3023
- userId: "1",
3024
- userName: "管理员",
3025
- departmentName: "技术部",
3026
- email: "admin@example.com",
3027
- mobilePhone: "13800138000",
3028
- positionName: "管理员",
3029
- avatar: ""
3030
- }), fe().setMenuList(On)), t.name && t.meta.keepAlive && l.addCachedView(t.name), p();
3031
- }
3032
- else
3033
- Rn.includes(t.path) ? p() : p("/login");
3034
- });
3035
- function _l() {
3036
- const t = Xe({
3037
- history: Je(),
3038
- routes: [..._t, ft]
3039
- });
3040
- gt.matcher = t.matcher;
3041
- }
3042
- function fl(t, a = {}) {
3043
- const p = a.indexPath || "/dashboard", l = a.logoSrc, s = {
3044
- path: "/:pathMatch(.*)*",
3045
- name: "CatchAll",
3046
- component: () => Promise.resolve().then(() => ht),
3047
- meta: {
3048
- title: "404"
3049
- }
3050
- };
3051
- return {
3052
- path: "/",
3053
- name: "Layout",
3054
- component: ce({
3055
- name: "LayoutWrapper",
3056
- render() {
3057
- return Et(vt, { logoSrc: l || Te("/vite.svg") });
3058
- }
3059
- }),
3060
- redirect: p,
3061
- children: [...t, s]
3062
- };
3063
- }
3064
- function gl(t, a = {}) {
3065
- const p = a.base || bt();
3066
- return Xe({
3067
- history: Je(p),
3068
- routes: t,
3069
- scrollBehavior: () => ({ left: 0, top: 0 })
3070
- });
3071
- }
3072
- const Kn = ["login", "404", "403", "/login", "/404", "/403"];
3073
- function jn(t, a) {
3074
- if (a.includes(t)) return !0;
3075
- const p = t.startsWith("/") ? t.slice(1) : t;
3076
- return a.includes(p);
3077
- }
3078
- function yl(t, a = {}) {
3079
- const p = a.whiteList || Kn;
3080
- t.beforeEach(async (l, s, d) => {
3081
- const i = _e(), h = ue(), m = fe(), f = i.loginPath || a.loginPath || "/login";
3082
- if (i.initTheme(), rt())
3083
- if (l.path === f || l.name === "Login")
3084
- d({ name: "Dashboard" });
3085
- else if (h.isLoggedIn) {
3086
- if (!m.hasMenu)
3087
- try {
3088
- const g = a.fetchMenu ? await a.fetchMenu() : await ot(a.appId);
3089
- m.setMenuList(g);
3090
- } catch (g) {
3091
- console.warn("补拉菜单失败:", g);
3092
- }
3093
- l.name && l.meta.keepAlive && i.addCachedView(l.name), d();
3094
- } else
3095
- try {
3096
- if (a.fetchUserInfo) {
3097
- const g = await a.fetchUserInfo();
3098
- h.setUserInfo(g);
3099
- } else {
3100
- const g = await wt();
3101
- h.setUserInfo(g);
3102
- }
3103
- if (a.fetchMenu) {
3104
- const g = await a.fetchMenu();
3105
- m.setMenuList(g);
3106
- } else {
3107
- const g = await ot(a.appId);
3108
- m.setMenuList(g);
3109
- }
3110
- a.onLoginSuccess && a.onLoginSuccess(), l.name && l.meta.keepAlive && i.addCachedView(l.name), d({ ...l, replace: !0 });
3111
- } catch (g) {
3112
- console.error("获取用户信息失败:", g), h.clearUserInfo(), m.clearMenu(), ct(), d({ name: "Login", query: { redirect: l.fullPath } });
3113
- }
3114
- else
3115
- jn(l.path, p) || l.name === "Login" || l.name === "NotFound" || l.name === "Forbidden" ? d() : d({ name: "Login", query: { redirect: l.fullPath } });
3116
- }), t.afterEach(() => {
3117
- });
3118
- }
3119
- var Wn = /* @__PURE__ */ ((t) => (t[t.ENABLED = 1] = "ENABLED", t[t.DISABLED = 0] = "DISABLED", t))(Wn || {}), qn = /* @__PURE__ */ ((t) => (t[t.UNKNOWN = 0] = "UNKNOWN", t[t.MALE = 1] = "MALE", t[t.FEMALE = 2] = "FEMALE", t))(qn || {}), Hn = /* @__PURE__ */ ((t) => (t[t.DIRECTORY = 0] = "DIRECTORY", t[t.MENU = 1] = "MENU", t[t.BUTTON = 2] = "BUTTON", t))(Hn || {});
3120
- const bl = {
3121
- 1: "启用",
3122
- 0: "禁用"
3123
- }, wl = {
3124
- 0: "未知",
3125
- 1: "男",
3126
- 2: "女"
3127
- }, kl = {
3128
- 0: "目录",
3129
- 1: "菜单",
3130
- 2: "按钮"
3131
- }, xl = [
3132
- {
3133
- label: "启用",
3134
- value: 1
3135
- /* ENABLED */
3136
- },
3137
- {
3138
- label: "禁用",
3139
- value: 0
3140
- /* DISABLED */
3141
- }
3142
- ], Cl = [
3143
- {
3144
- label: "未知",
3145
- value: 0
3146
- /* UNKNOWN */
3147
- },
3148
- {
3149
- label: "男",
3150
- value: 1
3151
- /* MALE */
3152
- },
3153
- {
3154
- label: "女",
3155
- value: 2
3156
- /* FEMALE */
3157
- }
3158
- ], $l = [
3159
- {
3160
- label: "目录",
3161
- value: 0
3162
- /* DIRECTORY */
3163
- },
3164
- {
3165
- label: "菜单",
3166
- value: 1
3167
- /* MENU */
3168
- },
3169
- {
3170
- label: "按钮",
3171
- value: 2
3172
- /* BUTTON */
3173
- }
3174
- ], Ll = {
3175
- mounted(t, a) {
3176
- var i, h;
3177
- const p = ue(), l = fe();
3178
- if (!p.isLoggedIn) {
3179
- (i = t.parentNode) == null || i.removeChild(t);
3180
- return;
3181
- }
3182
- const s = a.value, d = Array.isArray(s) ? s : [s];
3183
- l.hasPermission(d) || (h = t.parentNode) == null || h.removeChild(t);
3184
- }
3185
- };
3186
- async function Ml(t) {
3187
- await kt(t.basePath);
3188
- const a = at();
3189
- a && xt(a), Ct({
3190
- appId: t.appId,
3191
- clientId: t.clientId,
3192
- apiBaseUrl: a || t.apiBaseUrl,
3193
- basePath: t.basePath
3194
- }), t.basePath && $t(t.basePath);
3195
- const p = typeof window < "u" && window.location.pathname.includes("/h5/"), l = t.appId || Me();
3196
- if (l && !p)
3197
- try {
3198
- const s = await Promise.race([
3199
- Lt(l),
3200
- new Promise((d) => setTimeout(() => d(null), 2e3))
3201
- ]);
3202
- s && typeof s == "object" && Mt(s);
3203
- } catch (s) {
3204
- console.warn("加载应用界面配置失败,使用内置默认", s);
3205
- }
3206
- return Promise.resolve().then(() => Ot).then(({ useAppStore: s }) => {
3207
- const d = s();
3208
- t.appName && d.setAppName(t.appName), t.indexPath && d.setIndexPath(t.indexPath), t.loginPath && d.setLoginPath(t.loginPath);
3209
- }), t.locale && Promise.resolve().then(() => Vn).then(({ useLocaleStore: s }) => {
3210
- s().changeLocale(t.locale);
3211
- }), {
3212
- config: {
3213
- appName: t.appName || "XTO App",
3214
- appId: Me(),
3215
- clientId: dt(),
3216
- apiBaseUrl: at(),
3217
- basePath: t.basePath || "/",
3218
- indexPath: t.indexPath || "/dashboard",
3219
- loginPath: t.loginPath || "/login",
3220
- locale: t.locale || "zh-CN"
3221
- }
3222
- };
3223
- }
3224
- export {
3225
- _e as A,
3226
- rl as B,
3227
- ze as C,
3228
- il as D,
3229
- ul as E,
3230
- al as F,
3231
- qn as G,
3232
- Xs as H,
3233
- et as I,
3234
- fe as J,
3235
- cl as K,
3236
- vt as L,
3237
- Hn as M,
3238
- ue as N,
3239
- Wn as S,
3240
- ol as T,
3241
- de as _,
3242
- xl as a,
3243
- $l as b,
3244
- nl as c,
3245
- Cl as d,
3246
- wl as e,
3247
- kl as f,
3248
- Pn as g,
3249
- lt as h,
3250
- Mn as i,
3251
- bl as j,
3252
- fl as k,
3253
- gl as l,
3254
- dl as m,
3255
- Ml as n,
3256
- hl as o,
3257
- ml as p,
3258
- pl as q,
3259
- vl as r,
3260
- ft as s,
3261
- On as t,
3262
- Ll as u,
3263
- _l as v,
3264
- gt as w,
3265
- yl as x,
3266
- _t as y,
3267
- ll as z
3268
- };