xto-fronted 0.3.6 → 0.3.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1700 @@
1
+ import { ref as h, computed as b, watch as He, defineComponent as K, openBlock as _, createElementBlock as k, normalizeClass as z, createElementVNode as o, withDirectives as Re, toDisplayString as R, unref as p, vShow as Ye, createVNode as g, withCtx as E, Fragment as B, renderList as j, createBlock as Z, createTextVNode as W, createCommentVNode as N, onMounted as Xe, onUnmounted as Je, withModifiers as Me, Transition as Ie, withKeys as $e, vModelText as Qe, normalizeStyle as Ue, resolveComponent as Ze, reactive as fe } from "vue";
2
+ import { defineStore as ae } from "pinia";
3
+ import { createRouter as _e, createWebHistory as ge, useRoute as ye, useRouter as H } from "vue-router";
4
+ import { Menu as Ge, SubMenu as et, MenuItem as Ee, Tabs as tt, TabPane as st } from "@xto/navigation";
5
+ import { Icon as $, Button as re } from "@xto/base";
6
+ import { Drawer as ot, Message as V } from "@xto/feedback";
7
+ import { Form as nt, FormItem as se, Input as Ae, Checkbox as at } from "@xto/form";
8
+ import rt from "axios";
9
+ const J = "xto_", Pe = (e) => ({
10
+ get(t) {
11
+ const s = e.getItem(J + t);
12
+ if (!s) return null;
13
+ try {
14
+ return JSON.parse(s);
15
+ } catch {
16
+ return s;
17
+ }
18
+ },
19
+ set(t, s) {
20
+ if (s == null) {
21
+ e.removeItem(J + t);
22
+ return;
23
+ }
24
+ const a = typeof s == "string" ? s : JSON.stringify(s);
25
+ e.setItem(J + t, a);
26
+ },
27
+ remove(t) {
28
+ e.removeItem(J + t);
29
+ },
30
+ clear() {
31
+ Object.keys(e).forEach((s) => {
32
+ s.startsWith(J) && e.removeItem(s);
33
+ });
34
+ }
35
+ }), oe = Pe(window.localStorage), ne = Pe(window.sessionStorage), v = {
36
+ get: oe.get,
37
+ set: oe.set,
38
+ remove: oe.remove,
39
+ clear: oe.clear
40
+ }, to = {
41
+ get: ne.get,
42
+ set: ne.set,
43
+ remove: ne.remove,
44
+ clear: ne.clear
45
+ }, Y = ae("app", () => {
46
+ const e = h(v.get("appName") || "XTO App"), t = h(v.get("indexPath") || "/dashboard"), s = h(v.get("isDark") || !1), a = h(v.get("theme") || "light"), l = h(v.get("layout") || "sidebar"), i = h(v.get("isCollapsed") || !1), c = h(v.get("showTabs") ?? !0), r = h(v.get("showFooter") ?? !0), m = h(v.get("showBreadcrumb") ?? !0), d = h(v.get("primaryColor") || "#409eff"), y = h([]), C = b(() => s.value ? "dark" : "light"), n = (w) => {
47
+ e.value = w, v.set("appName", w);
48
+ }, T = (w) => {
49
+ t.value = w, v.set("indexPath", w);
50
+ }, I = () => {
51
+ s.value = !s.value, a.value = s.value ? "dark" : "light", x();
52
+ }, A = (w) => {
53
+ a.value = w, s.value = w === "dark", x();
54
+ }, x = () => {
55
+ const w = document.documentElement;
56
+ s.value ? w.classList.add("dark") : w.classList.remove("dark"), v.set("isDark", s.value), v.set("theme", a.value);
57
+ }, P = () => {
58
+ i.value = !i.value, v.set("isCollapsed", i.value);
59
+ }, M = (w) => {
60
+ l.value = w, v.set("layout", w);
61
+ }, U = () => {
62
+ c.value = !c.value, v.set("showTabs", c.value);
63
+ }, ce = () => {
64
+ r.value = !r.value, v.set("showFooter", r.value);
65
+ }, ue = () => {
66
+ m.value = !m.value, v.set("showBreadcrumb", m.value);
67
+ }, ee = (w) => {
68
+ d.value = w, document.documentElement.style.setProperty("--color-primary", w), v.set("primaryColor", w);
69
+ }, de = (w) => {
70
+ y.value.includes(w) || y.value.push(w);
71
+ }, me = (w) => {
72
+ const te = y.value.indexOf(w);
73
+ te > -1 && y.value.splice(te, 1);
74
+ }, pe = () => {
75
+ y.value = [];
76
+ }, ve = () => {
77
+ x(), d.value !== "#409eff" && document.documentElement.style.setProperty("--color-primary", d.value);
78
+ };
79
+ return He(s, x), {
80
+ appName: e,
81
+ indexPath: t,
82
+ isDark: s,
83
+ theme: a,
84
+ layout: l,
85
+ isCollapsed: i,
86
+ showTabs: c,
87
+ showFooter: r,
88
+ showBreadcrumb: m,
89
+ primaryColor: d,
90
+ cachedViews: y,
91
+ themeClass: C,
92
+ setAppName: n,
93
+ setIndexPath: T,
94
+ toggleTheme: I,
95
+ toggleCollapse: P,
96
+ setTheme: A,
97
+ setLayout: M,
98
+ toggleTabs: U,
99
+ toggleFooter: ce,
100
+ toggleBreadcrumb: ue,
101
+ setPrimaryColor: ee,
102
+ addCachedView: de,
103
+ removeCachedView: me,
104
+ clearCachedViews: pe,
105
+ initTheme: ve
106
+ };
107
+ }), De = "/vite.svg", lt = (e, t, s) => {
108
+ const a = e[t];
109
+ return a ? typeof a == "function" ? a() : Promise.resolve(a) : new Promise((l, i) => {
110
+ (typeof queueMicrotask == "function" ? queueMicrotask : setTimeout)(
111
+ i.bind(
112
+ null,
113
+ new Error(
114
+ "Unknown variable dynamic import: " + t + (t.split("/").length !== s ? ". Note that variables only represent file names one level deep." : "")
115
+ )
116
+ )
117
+ );
118
+ });
119
+ }, Oe = [
120
+ {
121
+ path: "/login",
122
+ name: "Login",
123
+ component: () => Promise.resolve().then(() => Ts),
124
+ meta: {
125
+ title: "登录",
126
+ hidden: !0
127
+ }
128
+ },
129
+ {
130
+ path: "/404",
131
+ name: "NotFound",
132
+ component: () => Promise.resolve().then(() => Ms),
133
+ meta: {
134
+ title: "404",
135
+ hidden: !0
136
+ }
137
+ },
138
+ {
139
+ path: "/403",
140
+ name: "Forbidden",
141
+ component: () => Promise.resolve().then(() => Os),
142
+ meta: {
143
+ title: "403",
144
+ hidden: !0
145
+ }
146
+ }
147
+ ], Ne = {
148
+ path: "/:pathMatch(.*)*",
149
+ redirect: "/404",
150
+ meta: {
151
+ hidden: !0
152
+ }
153
+ }, ze = {
154
+ path: "/",
155
+ name: "Layout",
156
+ component: () => Promise.resolve().then(() => hs),
157
+ redirect: "/dashboard",
158
+ children: [
159
+ {
160
+ path: "/dashboard",
161
+ name: "Dashboard",
162
+ component: () => import("./index-CD364XjV.js"),
163
+ meta: {
164
+ title: "仪表盘",
165
+ icon: "dashboard",
166
+ keepAlive: !0,
167
+ affix: !0
168
+ }
169
+ },
170
+ {
171
+ path: "/system/user",
172
+ name: "SystemUser",
173
+ component: () => import("./index-DcvRPHuy.js"),
174
+ meta: {
175
+ title: "用户管理",
176
+ icon: "user",
177
+ keepAlive: !0
178
+ }
179
+ },
180
+ {
181
+ path: "/system/role",
182
+ name: "SystemRole",
183
+ component: () => import("./index-DWy_UGhI.js"),
184
+ meta: {
185
+ title: "角色管理",
186
+ icon: "role",
187
+ keepAlive: !0
188
+ }
189
+ },
190
+ {
191
+ path: "/system/menu",
192
+ name: "SystemMenu",
193
+ component: () => import("./index-D88fiqXR.js"),
194
+ meta: {
195
+ title: "菜单管理",
196
+ icon: "menu",
197
+ keepAlive: !0
198
+ }
199
+ }
200
+ ]
201
+ }, so = [
202
+ {
203
+ path: "/dashboard",
204
+ name: "Dashboard",
205
+ component: () => import("./index-CD364XjV.js"),
206
+ meta: {
207
+ title: "仪表盘",
208
+ icon: "dashboard",
209
+ keepAlive: !0,
210
+ affix: !0
211
+ }
212
+ },
213
+ {
214
+ path: "/system",
215
+ name: "System",
216
+ redirect: "/system/user",
217
+ meta: {
218
+ title: "系统管理",
219
+ icon: "setting"
220
+ },
221
+ children: [
222
+ {
223
+ path: "user",
224
+ name: "SystemUser",
225
+ component: () => import("./index-DcvRPHuy.js"),
226
+ meta: {
227
+ title: "用户管理",
228
+ icon: "user",
229
+ keepAlive: !0
230
+ }
231
+ },
232
+ {
233
+ path: "role",
234
+ name: "SystemRole",
235
+ component: () => import("./index-DWy_UGhI.js"),
236
+ meta: {
237
+ title: "角色管理",
238
+ icon: "role",
239
+ keepAlive: !0
240
+ }
241
+ },
242
+ {
243
+ path: "menu",
244
+ name: "SystemMenu",
245
+ component: () => import("./index-D88fiqXR.js"),
246
+ meta: {
247
+ title: "菜单管理",
248
+ icon: "menu",
249
+ keepAlive: !0
250
+ }
251
+ }
252
+ ]
253
+ }
254
+ ], it = [
255
+ {
256
+ id: 1,
257
+ name: "Dashboard",
258
+ path: "/dashboard",
259
+ component: "dashboard/index",
260
+ icon: "dashboard",
261
+ title: "仪表盘",
262
+ keepAlive: !0,
263
+ affix: !0
264
+ },
265
+ {
266
+ id: 2,
267
+ name: "System",
268
+ path: "/system",
269
+ redirect: "/system/user",
270
+ icon: "setting",
271
+ title: "系统管理",
272
+ children: [
273
+ {
274
+ id: 21,
275
+ name: "SystemUser",
276
+ path: "/system/user",
277
+ component: "system/user/index",
278
+ icon: "user",
279
+ title: "用户管理",
280
+ keepAlive: !0
281
+ },
282
+ {
283
+ id: 22,
284
+ name: "SystemRole",
285
+ path: "/system/role",
286
+ component: "system/role/index",
287
+ icon: "role",
288
+ title: "角色管理",
289
+ keepAlive: !0
290
+ },
291
+ {
292
+ id: 23,
293
+ name: "SystemMenu",
294
+ path: "/system/menu",
295
+ component: "system/menu/index",
296
+ icon: "menu",
297
+ title: "菜单管理",
298
+ keepAlive: !0
299
+ }
300
+ ]
301
+ }
302
+ ], ke = "token", be = "refresh_token", we = "token_expire", le = () => v.get(ke), ct = (e) => {
303
+ v.set(ke, e);
304
+ }, oo = () => v.get(be), ut = (e) => {
305
+ v.set(be, e);
306
+ }, dt = () => v.get(we), mt = (e) => {
307
+ v.set(we, e);
308
+ }, pt = (e) => {
309
+ ct(e.token), ut(e.refreshToken), mt(e.expireTime);
310
+ }, Ve = () => {
311
+ v.remove(ke), v.remove(be), v.remove(we);
312
+ }, vt = () => {
313
+ const e = dt();
314
+ return e ? Date.now() > e : !0;
315
+ }, Be = () => !!le() && !vt(), D = ae("user", () => {
316
+ const e = h(v.get("userInfo")), t = h(v.get("roles") || []), s = h(v.get("permissions") || []), a = b(() => !!e.value), l = b(() => {
317
+ var n;
318
+ return ((n = e.value) == null ? void 0 : n.username) || "";
319
+ }), i = b(() => {
320
+ var n;
321
+ return ((n = e.value) == null ? void 0 : n.nickname) || "";
322
+ }), c = b(() => {
323
+ var n;
324
+ return ((n = e.value) == null ? void 0 : n.avatar) || "";
325
+ }), r = b(() => {
326
+ var n;
327
+ return (n = e.value) == null ? void 0 : n.id;
328
+ });
329
+ return {
330
+ userInfo: e,
331
+ roles: t,
332
+ permissions: s,
333
+ isLoggedIn: a,
334
+ username: l,
335
+ nickname: i,
336
+ avatar: c,
337
+ userId: r,
338
+ setUserInfo: (n) => {
339
+ e.value = n, t.value = n.roles || [], s.value = n.permissions || [], v.set("userInfo", n), v.set("roles", n.roles || []), v.set("permissions", n.permissions || []);
340
+ },
341
+ clearUserInfo: () => {
342
+ e.value = null, t.value = [], s.value = [], v.remove("userInfo"), v.remove("roles"), v.remove("permissions");
343
+ },
344
+ hasPermission: (n) => Array.isArray(n) ? n.some((T) => s.value.includes(T)) : s.value.includes(n),
345
+ hasRole: (n) => Array.isArray(n) ? n.some((T) => t.value.includes(T)) : t.value.includes(n)
346
+ };
347
+ }), Se = _e({
348
+ history: ge(),
349
+ routes: [...Oe, ze, Ne],
350
+ scrollBehavior: () => ({ left: 0, top: 0 })
351
+ }), ht = ["/login", "/404", "/403"];
352
+ Se.beforeEach(async (e, t, s) => {
353
+ const a = Y();
354
+ if (a.initTheme(), Be())
355
+ if (e.path === "/login")
356
+ s({ path: "/" });
357
+ else {
358
+ const l = D();
359
+ l.isLoggedIn || (l.setUserInfo({
360
+ id: 1,
361
+ username: "admin",
362
+ nickname: "管理员",
363
+ avatar: "",
364
+ email: "admin@example.com",
365
+ phone: "13800138000",
366
+ status: 1,
367
+ roles: ["admin"],
368
+ permissions: ["*"],
369
+ createTime: (/* @__PURE__ */ new Date()).toISOString()
370
+ }), G().setMenuList(it)), e.name && e.meta.keepAlive && a.addCachedView(e.name), s();
371
+ }
372
+ else
373
+ ht.includes(e.path) ? s() : s("/login");
374
+ });
375
+ function no() {
376
+ const e = _e({
377
+ history: ge(),
378
+ routes: [...Oe, ze, Ne]
379
+ });
380
+ Se.matcher = e.matcher;
381
+ }
382
+ const G = ae("menu", () => {
383
+ const e = h(v.get("menuList") || []), t = b(() => e.value.length > 0), s = (c) => {
384
+ e.value = c, v.set("menuList", c);
385
+ }, a = () => {
386
+ e.value = [], v.remove("menuList");
387
+ }, l = (c) => c.filter((r) => !r.hidden).map((r) => {
388
+ const m = {
389
+ path: r.path,
390
+ name: r.name,
391
+ meta: {
392
+ title: r.title,
393
+ icon: r.icon,
394
+ keepAlive: r.keepAlive,
395
+ hidden: r.hidden
396
+ }
397
+ };
398
+ return r.redirect && (m.redirect = r.redirect), r.component && (m.component = () => lt(/* @__PURE__ */ Object.assign({}), `../views/${r.component}.vue`, 3)), r.children && r.children.length > 0 && (m.children = l(r.children)), m;
399
+ });
400
+ return {
401
+ menuList: e,
402
+ hasMenu: t,
403
+ setMenuList: s,
404
+ clearMenu: a,
405
+ generateRoutes: l,
406
+ addRoutes: (c) => {
407
+ l(c).forEach((m) => {
408
+ Se.addRoute("Layout", m);
409
+ });
410
+ }
411
+ };
412
+ }), ie = ae("auth", () => {
413
+ const e = h(le()), t = b(() => Be()), s = h(""), a = h(""), l = h(""), i = h("/login");
414
+ return {
415
+ token: e,
416
+ isLoggedIn: t,
417
+ baseUrl: s,
418
+ appId: a,
419
+ clientId: l,
420
+ loginPath: i,
421
+ login: (n) => {
422
+ e.value = n.token, pt(n);
423
+ },
424
+ logout: () => {
425
+ e.value = null, Ve();
426
+ },
427
+ setBaseUrl: (n) => {
428
+ s.value = n;
429
+ },
430
+ setAppId: (n) => {
431
+ a.value = n;
432
+ },
433
+ setClientId: (n) => {
434
+ l.value = n;
435
+ },
436
+ setLoginPath: (n) => {
437
+ i.value = n;
438
+ }
439
+ };
440
+ }), ft = { class: "sidebar__logo" }, _t = {
441
+ key: 0,
442
+ class: "sidebar__user"
443
+ }, gt = { class: "sidebar__user-info" }, yt = { class: "sidebar__user-name" }, kt = { class: "sidebar__user-role" }, bt = /* @__PURE__ */ K({
444
+ __name: "Sidebar",
445
+ setup(e) {
446
+ const t = ye(), s = H(), a = G(), l = D(), i = ie(), c = Y(), r = b(() => c.isCollapsed), m = b(() => t.path), d = b(() => c.isDark ? "#1d1e1f" : "#fff"), y = b(() => c.isDark ? "#cfd3dc" : "#303133"), C = b(() => "#409eff"), n = (A) => {
447
+ A && A !== t.path && s.push(A);
448
+ }, T = () => {
449
+ i.logout(), l.clearUserInfo(), a.clearMenu(), s.push("/login");
450
+ }, I = (A) => ({
451
+ dashboard: "dashboard",
452
+ system: "system",
453
+ user: "user",
454
+ role: "role",
455
+ menu: "list",
456
+ setting: "setting"
457
+ })[A || ""] || "file";
458
+ return (A, x) => {
459
+ var P;
460
+ return _(), k("div", {
461
+ class: z(["sidebar", { "sidebar--collapsed": r.value }])
462
+ }, [
463
+ o("div", ft, [
464
+ x[0] || (x[0] = o("img", {
465
+ src: De,
466
+ alt: "Logo",
467
+ class: "sidebar__logo-img"
468
+ }, null, -1)),
469
+ Re(o("span", { class: "sidebar__logo-text" }, R(p(c).appName), 513), [
470
+ [Ye, !r.value]
471
+ ])
472
+ ]),
473
+ g(p(Ge), {
474
+ "default-active": m.value,
475
+ mode: "vertical",
476
+ collapse: r.value,
477
+ "collapse-transition": !1,
478
+ "background-color": d.value,
479
+ "text-color": y.value,
480
+ "active-text-color": C.value,
481
+ class: "sidebar__menu",
482
+ onSelect: n
483
+ }, {
484
+ default: E(() => [
485
+ (_(!0), k(B, null, j(p(a).menuList, (M) => (_(), k(B, {
486
+ key: M.path
487
+ }, [
488
+ M.children && M.children.length > 0 ? (_(), Z(p(et), {
489
+ key: 0,
490
+ index: M.path
491
+ }, {
492
+ title: E(() => [
493
+ g(p($), {
494
+ name: I(M.icon),
495
+ size: 16
496
+ }, null, 8, ["name"]),
497
+ o("span", null, R(M.title), 1)
498
+ ]),
499
+ default: E(() => [
500
+ (_(!0), k(B, null, j(M.children, (U) => (_(), Z(p(Ee), {
501
+ key: U.path,
502
+ index: U.path
503
+ }, {
504
+ default: E(() => [
505
+ g(p($), {
506
+ name: I(U.icon),
507
+ size: 16
508
+ }, null, 8, ["name"]),
509
+ o("span", null, R(U.title), 1)
510
+ ]),
511
+ _: 2
512
+ }, 1032, ["index"]))), 128))
513
+ ]),
514
+ _: 2
515
+ }, 1032, ["index"])) : (_(), Z(p(Ee), {
516
+ key: 1,
517
+ index: M.path
518
+ }, {
519
+ default: E(() => [
520
+ g(p($), {
521
+ name: I(M.icon),
522
+ size: 16
523
+ }, null, 8, ["name"]),
524
+ o("span", null, R(M.title), 1)
525
+ ]),
526
+ _: 2
527
+ }, 1032, ["index"]))
528
+ ], 64))), 128))
529
+ ]),
530
+ _: 1
531
+ }, 8, ["default-active", "collapse", "background-color", "text-color", "active-text-color"]),
532
+ r.value ? N("", !0) : (_(), k("div", _t, [
533
+ o("div", gt, [
534
+ o("span", yt, R(p(l).nickname), 1),
535
+ o("span", kt, R((P = p(l).roles) == null ? void 0 : P.join(", ")), 1)
536
+ ]),
537
+ g(p(re), {
538
+ type: "text",
539
+ size: "small",
540
+ onClick: T
541
+ }, {
542
+ default: E(() => [...x[1] || (x[1] = [
543
+ W("退出", -1)
544
+ ])]),
545
+ _: 1
546
+ })
547
+ ]))
548
+ ], 2);
549
+ };
550
+ }
551
+ }), F = (e, t) => {
552
+ const s = e.__vccOpts || e;
553
+ for (const [a, l] of t)
554
+ s[a] = l;
555
+ return s;
556
+ }, wt = /* @__PURE__ */ F(bt, [["__scopeId", "data-v-a7668285"]]), St = { class: "header" }, Ct = { class: "header__left" }, xt = {
557
+ key: 0,
558
+ class: "header__breadcrumb"
559
+ }, Lt = {
560
+ key: 0,
561
+ class: "breadcrumb-separator"
562
+ }, Tt = { class: "header__right" }, It = ["title"], Et = { class: "header__avatar" }, At = { class: "header__user-name" }, Rt = {
563
+ key: 0,
564
+ class: "header__dropdown"
565
+ }, Mt = { class: "header__dropdown-header" }, $t = { class: "header__dropdown-avatar" }, Ut = { class: "header__dropdown-info" }, Pt = { class: "header__dropdown-name" }, Dt = { class: "header__dropdown-role" }, Ot = { class: "header__dropdown-menu" }, Nt = { class: "search-container" }, zt = { class: "search-input-wrapper" }, Vt = {
566
+ key: 0,
567
+ class: "search-results"
568
+ }, Bt = ["onClick"], Ft = { class: "search-result-info" }, jt = { class: "search-result-title" }, Kt = {
569
+ key: 0,
570
+ class: "search-result-parent"
571
+ }, qt = {
572
+ key: 1,
573
+ class: "search-empty"
574
+ }, Wt = { class: "settings-drawer" }, Ht = { class: "settings-section" }, Yt = { class: "settings-layout-options" }, Xt = ["onClick"], Jt = { class: "layout-option__preview" }, Qt = {
575
+ key: 0,
576
+ class: "layout-preview-sidebar"
577
+ }, Zt = {
578
+ key: 1,
579
+ class: "layout-preview-top"
580
+ }, Gt = {
581
+ key: 2,
582
+ class: "layout-preview-mix"
583
+ }, es = { class: "layout-option__label" }, ts = { class: "settings-section" }, ss = { class: "settings-color-options" }, os = ["title", "onClick"], ns = { class: "settings-section" }, as = { class: "settings-switch-list" }, rs = { class: "settings-switch-item" }, ls = { class: "settings-switch-item" }, is = /* @__PURE__ */ K({
584
+ __name: "Header",
585
+ setup(e) {
586
+ const t = ye(), s = H(), a = Y(), l = D(), i = ie(), c = G(), r = h(!1), m = h(!1), d = h(null), y = h(!1), C = h(!1), n = h(""), T = h(null), I = h(!1), A = [
587
+ { value: "sidebar", label: "左侧菜单", icon: "sidebar-left" },
588
+ { value: "top", label: "顶部菜单", icon: "menu" },
589
+ { value: "mix", label: "混合菜单", icon: "grid" }
590
+ ], x = [
591
+ { value: "#409eff", label: "默认蓝" },
592
+ { value: "#1890ff", label: "科技蓝" },
593
+ { value: "#52c41a", label: "极光绿" },
594
+ { value: "#faad14", label: "日落橙" },
595
+ { value: "#f5222d", label: "薄暮红" },
596
+ { value: "#722ed1", label: "酱紫" }
597
+ ], P = b(() => t.matched.filter((u) => u.meta && u.meta.title).map((u) => ({
598
+ title: u.meta.title,
599
+ path: u.path
600
+ }))), M = (L, u = "") => {
601
+ const q = [];
602
+ return L.forEach((f) => {
603
+ f.children && f.children.length > 0 ? q.push(...M(f.children, f.title)) : q.push({ ...f, parentTitle: u });
604
+ }), q;
605
+ }, U = b(() => n.value.trim() ? M(c.menuList).filter(
606
+ (u) => u.title.toLowerCase().includes(n.value.toLowerCase())
607
+ ) : []), ce = b(() => a.layout), ue = () => {
608
+ a.toggleCollapse();
609
+ }, ee = () => {
610
+ a.toggleTheme();
611
+ }, de = () => {
612
+ m.value = !0;
613
+ }, me = (L) => {
614
+ a.setLayout(L);
615
+ }, pe = (L) => {
616
+ I.value = L;
617
+ const u = document.documentElement;
618
+ L ? u.classList.add("grey-mode") : u.classList.remove("grey-mode");
619
+ }, ve = () => {
620
+ document.fullscreenElement ? document.exitFullscreen() : document.documentElement.requestFullscreen();
621
+ }, w = () => {
622
+ y.value = !!document.fullscreenElement;
623
+ }, te = () => {
624
+ r.value = !r.value;
625
+ }, X = () => {
626
+ r.value = !1;
627
+ }, Ce = () => {
628
+ C.value = !0;
629
+ }, he = () => {
630
+ C.value = !1, n.value = "";
631
+ }, xe = (L) => {
632
+ s.push(L), he();
633
+ }, je = (L) => {
634
+ a.setPrimaryColor(L);
635
+ }, Ke = () => {
636
+ X(), s.push("/profile");
637
+ }, qe = () => {
638
+ X(), s.push("/change-password");
639
+ }, We = () => {
640
+ X(), i.logout(), l.clearUserInfo(), c.clearMenu(), s.push("/login");
641
+ }, Le = (L) => {
642
+ d.value && !d.value.contains(L.target) && X(), T.value && !T.value.contains(L.target) && he();
643
+ }, Te = (L) => {
644
+ L.key === "Escape" && (he(), X()), (L.ctrlKey || L.metaKey) && L.key === "k" && (L.preventDefault(), Ce());
645
+ };
646
+ return Xe(() => {
647
+ document.addEventListener("click", Le), document.addEventListener("fullscreenchange", w), document.addEventListener("keydown", Te), a.initTheme(), I.value = document.documentElement.classList.contains("grey-mode");
648
+ }), Je(() => {
649
+ document.removeEventListener("click", Le), document.removeEventListener("fullscreenchange", w), document.removeEventListener("keydown", Te);
650
+ }), (L, u) => {
651
+ var q;
652
+ return _(), k("div", St, [
653
+ o("div", Ct, [
654
+ o("div", {
655
+ class: "header__collapse",
656
+ onClick: ue
657
+ }, [
658
+ g(p($), {
659
+ name: p(a).isCollapsed ? "menu-unfold" : "menu-fold",
660
+ size: 18
661
+ }, null, 8, ["name"])
662
+ ]),
663
+ p(a).showBreadcrumb ? (_(), k("div", xt, [
664
+ (_(!0), k(B, null, j(P.value, (f, O) => (_(), k("span", {
665
+ key: f.path
666
+ }, [
667
+ O > 0 ? (_(), k("span", Lt, "/")) : N("", !0),
668
+ o("span", {
669
+ class: z({ "is-current": O === P.value.length - 1 })
670
+ }, R(f.title), 3)
671
+ ]))), 128))
672
+ ])) : N("", !0)
673
+ ]),
674
+ o("div", Tt, [
675
+ o("div", {
676
+ class: "header__action",
677
+ onClick: Ce,
678
+ title: "搜索 (Ctrl+K)"
679
+ }, [
680
+ g(p($), {
681
+ name: "search",
682
+ size: 16
683
+ })
684
+ ]),
685
+ o("div", {
686
+ class: "header__action",
687
+ onClick: ve,
688
+ title: y.value ? "退出全屏" : "全屏"
689
+ }, [
690
+ g(p($), {
691
+ name: y.value ? "fullscreen-exit" : "fullscreen",
692
+ size: 16
693
+ }, null, 8, ["name"])
694
+ ], 8, It),
695
+ o("div", {
696
+ class: "header__action",
697
+ onClick: de,
698
+ title: "换肤设置"
699
+ }, [
700
+ g(p($), {
701
+ name: "setting",
702
+ size: 16
703
+ })
704
+ ]),
705
+ o("div", {
706
+ class: "header__action",
707
+ onClick: ee,
708
+ title: "切换主题"
709
+ }, [
710
+ g(p($), {
711
+ name: p(a).isDark ? "sun" : "moon",
712
+ size: 16
713
+ }, null, 8, ["name"])
714
+ ]),
715
+ o("div", {
716
+ class: "header__user",
717
+ ref_key: "dropdownRef",
718
+ ref: d
719
+ }, [
720
+ o("div", {
721
+ class: "header__user-trigger",
722
+ onClick: Me(te, ["stop"])
723
+ }, [
724
+ o("div", Et, [
725
+ o("span", null, R(((q = p(l).nickname) == null ? void 0 : q.charAt(0)) || "U"), 1)
726
+ ]),
727
+ o("span", At, R(p(l).nickname), 1),
728
+ o("span", {
729
+ class: z(["header__user-arrow", { "is-active": r.value }])
730
+ }, "▼", 2)
731
+ ]),
732
+ g(Ie, { name: "dropdown" }, {
733
+ default: E(() => {
734
+ var f, O;
735
+ return [
736
+ r.value ? (_(), k("div", Rt, [
737
+ o("div", Mt, [
738
+ o("div", $t, [
739
+ o("span", null, R(((f = p(l).nickname) == null ? void 0 : f.charAt(0)) || "U"), 1)
740
+ ]),
741
+ o("div", Ut, [
742
+ o("div", Pt, R(p(l).nickname), 1),
743
+ o("div", Dt, R((O = p(l).roles) == null ? void 0 : O.join(", ")), 1)
744
+ ])
745
+ ]),
746
+ u[8] || (u[8] = o("div", { class: "header__dropdown-divider" }, null, -1)),
747
+ o("div", Ot, [
748
+ o("div", {
749
+ class: "header__dropdown-item",
750
+ onClick: Ke
751
+ }, [
752
+ g(p($), {
753
+ name: "user",
754
+ size: 16
755
+ }),
756
+ u[4] || (u[4] = o("span", null, "个人信息", -1))
757
+ ]),
758
+ o("div", {
759
+ class: "header__dropdown-item",
760
+ onClick: qe
761
+ }, [
762
+ g(p($), {
763
+ name: "lock",
764
+ size: 16
765
+ }),
766
+ u[5] || (u[5] = o("span", null, "修改密码", -1))
767
+ ]),
768
+ u[7] || (u[7] = o("div", { class: "header__dropdown-divider" }, null, -1)),
769
+ o("div", {
770
+ class: "header__dropdown-item header__dropdown-item--danger",
771
+ onClick: We
772
+ }, [
773
+ g(p($), {
774
+ name: "logout",
775
+ size: 16
776
+ }),
777
+ u[6] || (u[6] = o("span", null, "退出登录", -1))
778
+ ])
779
+ ])
780
+ ])) : N("", !0)
781
+ ];
782
+ }),
783
+ _: 1
784
+ })
785
+ ], 512)
786
+ ]),
787
+ g(Ie, { name: "search" }, {
788
+ default: E(() => [
789
+ C.value ? (_(), k("div", {
790
+ key: 0,
791
+ class: "header__search-modal",
792
+ ref_key: "searchRef",
793
+ ref: T
794
+ }, [
795
+ o("div", Nt, [
796
+ o("div", zt, [
797
+ g(p($), {
798
+ class: "search-icon",
799
+ name: "search",
800
+ size: 20
801
+ }),
802
+ Re(o("input", {
803
+ "onUpdate:modelValue": u[0] || (u[0] = (f) => n.value = f),
804
+ type: "text",
805
+ class: "search-input",
806
+ placeholder: "搜索菜单...",
807
+ autofocus: "",
808
+ onKeyup: u[1] || (u[1] = $e((f) => U.value[0] && xe(U.value[0].path), ["enter"]))
809
+ }, null, 544), [
810
+ [Qe, n.value]
811
+ ]),
812
+ u[9] || (u[9] = o("span", { class: "search-shortcut" }, "ESC 关闭", -1))
813
+ ]),
814
+ U.value.length > 0 ? (_(), k("div", Vt, [
815
+ (_(!0), k(B, null, j(U.value, (f, O) => (_(), k("div", {
816
+ key: f.path,
817
+ class: z(["search-result-item", { "is-first": O === 0 }]),
818
+ onClick: (Ws) => xe(f.path)
819
+ }, [
820
+ g(p($), {
821
+ class: "search-result-icon",
822
+ name: f.icon || "file",
823
+ size: 20
824
+ }, null, 8, ["name"]),
825
+ o("div", Ft, [
826
+ o("span", jt, R(f.title), 1),
827
+ f.parentTitle ? (_(), k("span", Kt, R(f.parentTitle), 1)) : N("", !0)
828
+ ])
829
+ ], 10, Bt))), 128))
830
+ ])) : n.value ? (_(), k("div", qt, " 未找到匹配的菜单 ")) : N("", !0)
831
+ ])
832
+ ], 512)) : N("", !0)
833
+ ]),
834
+ _: 1
835
+ }),
836
+ g(p(ot), {
837
+ modelValue: m.value,
838
+ "onUpdate:modelValue": u[3] || (u[3] = (f) => m.value = f),
839
+ title: "换肤设置",
840
+ direction: "rtl",
841
+ size: "320px"
842
+ }, {
843
+ default: E(() => [
844
+ o("div", Wt, [
845
+ o("div", Ht, [
846
+ u[13] || (u[13] = o("div", { class: "settings-title" }, "布局模式", -1)),
847
+ o("div", Yt, [
848
+ (_(), k(B, null, j(A, (f) => o("div", {
849
+ key: f.value,
850
+ class: z(["layout-option", { "is-active": ce.value === f.value }]),
851
+ onClick: (O) => me(f.value)
852
+ }, [
853
+ o("div", Jt, [
854
+ f.value === "sidebar" ? (_(), k("div", Qt, [...u[10] || (u[10] = [
855
+ o("div", { class: "preview-aside" }, null, -1),
856
+ o("div", { class: "preview-main" }, [
857
+ o("div", { class: "preview-header" }),
858
+ o("div", { class: "preview-content" })
859
+ ], -1)
860
+ ])])) : f.value === "top" ? (_(), k("div", Zt, [...u[11] || (u[11] = [
861
+ o("div", { class: "preview-header-full" }, null, -1),
862
+ o("div", { class: "preview-content-full" }, null, -1)
863
+ ])])) : (_(), k("div", Gt, [...u[12] || (u[12] = [
864
+ o("div", { class: "preview-header-mix" }, [
865
+ o("div", { class: "preview-mix-left" })
866
+ ], -1),
867
+ o("div", { class: "preview-mix-body" }, [
868
+ o("div", { class: "preview-mix-aside" }),
869
+ o("div", { class: "preview-mix-content" })
870
+ ], -1)
871
+ ])]))
872
+ ]),
873
+ o("span", es, R(f.label), 1)
874
+ ], 10, Xt)), 64))
875
+ ])
876
+ ]),
877
+ o("div", ts, [
878
+ u[14] || (u[14] = o("div", { class: "settings-title" }, "主题色", -1)),
879
+ o("div", ss, [
880
+ (_(), k(B, null, j(x, (f) => o("div", {
881
+ key: f.value,
882
+ class: z(["color-option", { "is-active": p(a).primaryColor === f.value }]),
883
+ style: Ue({ backgroundColor: f.value }),
884
+ title: f.label,
885
+ onClick: (O) => je(f.value)
886
+ }, [
887
+ p(a).primaryColor === f.value ? (_(), Z(p($), {
888
+ key: 0,
889
+ name: "check",
890
+ size: 12,
891
+ color: "#fff"
892
+ })) : N("", !0)
893
+ ], 14, os)), 64))
894
+ ])
895
+ ]),
896
+ o("div", ns, [
897
+ u[19] || (u[19] = o("div", { class: "settings-title" }, "功能设置", -1)),
898
+ o("div", as, [
899
+ o("div", rs, [
900
+ u[16] || (u[16] = o("span", null, "灰色模式", -1)),
901
+ o("div", {
902
+ class: z(["switch-wrapper", { "is-checked": I.value }]),
903
+ onClick: u[2] || (u[2] = (f) => pe(!I.value))
904
+ }, [...u[15] || (u[15] = [
905
+ o("span", { class: "switch-core" }, null, -1)
906
+ ])], 2)
907
+ ]),
908
+ o("div", ls, [
909
+ u[18] || (u[18] = o("span", null, "暗黑模式", -1)),
910
+ o("div", {
911
+ class: z(["switch-wrapper", { "is-checked": p(a).isDark }]),
912
+ onClick: ee
913
+ }, [...u[17] || (u[17] = [
914
+ o("span", { class: "switch-core" }, null, -1)
915
+ ])], 2)
916
+ ])
917
+ ])
918
+ ])
919
+ ])
920
+ ]),
921
+ _: 1
922
+ }, 8, ["modelValue"])
923
+ ]);
924
+ };
925
+ }
926
+ }), cs = /* @__PURE__ */ F(is, [["__scopeId", "data-v-015c45c9"]]), us = { class: "layout" }, ds = { class: "layout__main" }, ms = { class: "layout__header" }, ps = { class: "layout__content" }, vs = /* @__PURE__ */ K({
927
+ __name: "index",
928
+ setup(e) {
929
+ const t = Y(), s = b(
930
+ () => t.isCollapsed ? "64px" : "210px"
931
+ );
932
+ return (a, l) => {
933
+ const i = Ze("router-view");
934
+ return _(), k("div", us, [
935
+ o("aside", {
936
+ class: "layout__aside",
937
+ style: Ue({ width: s.value })
938
+ }, [
939
+ g(wt)
940
+ ], 4),
941
+ o("div", ds, [
942
+ o("header", ms, [
943
+ g(cs)
944
+ ]),
945
+ o("main", ps, [
946
+ g(i)
947
+ ])
948
+ ])
949
+ ]);
950
+ };
951
+ }
952
+ }), Fe = /* @__PURE__ */ F(vs, [["__scopeId", "data-v-a3110011"]]), hs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
953
+ __proto__: null,
954
+ default: Fe
955
+ }, Symbol.toStringTag, { value: "Module" })), fs = { class: "tabs-wrapper" }, _s = { class: "tab-label" }, gs = ["onClick"], ys = /* @__PURE__ */ K({
956
+ __name: "Tabs",
957
+ setup(e) {
958
+ const t = ye(), s = H(), a = b(() => {
959
+ const r = [];
960
+ return t.matched.forEach((m) => {
961
+ var d;
962
+ (d = m.meta) != null && d.affix && r.push({
963
+ name: m.name,
964
+ title: m.meta.title,
965
+ path: m.path,
966
+ affix: !0
967
+ });
968
+ }), r;
969
+ }), l = b(() => t.path), i = (r) => {
970
+ s.push(r);
971
+ }, c = (r) => {
972
+ const m = a.value.find((d) => d.path === r);
973
+ if (!(m != null && m.affix) && r === l.value) {
974
+ const d = a.value.findIndex((C) => C.path === r), y = a.value[d - 1] || a.value[d + 1];
975
+ y && s.push(y.path);
976
+ }
977
+ };
978
+ return (r, m) => (_(), k("div", fs, [
979
+ g(p(tt), {
980
+ modelValue: l.value,
981
+ "onUpdate:modelValue": m[0] || (m[0] = (d) => l.value = d),
982
+ type: "card",
983
+ onTabClick: i
984
+ }, {
985
+ default: E(() => [
986
+ (_(!0), k(B, null, j(a.value, (d) => (_(), Z(p(st), {
987
+ key: d.path,
988
+ name: d.path,
989
+ label: d.title,
990
+ closable: !d.affix
991
+ }, {
992
+ label: E(() => [
993
+ o("span", _s, [
994
+ W(R(d.title) + " ", 1),
995
+ d.affix ? N("", !0) : (_(), k("span", {
996
+ key: 0,
997
+ class: "tab-close",
998
+ onClick: Me((y) => c(d.path), ["stop"])
999
+ }, " ✕ ", 8, gs))
1000
+ ])
1001
+ ]),
1002
+ _: 2
1003
+ }, 1032, ["name", "label", "closable"]))), 128))
1004
+ ]),
1005
+ _: 1
1006
+ }, 8, ["modelValue"])
1007
+ ]));
1008
+ }
1009
+ }), ao = /* @__PURE__ */ F(ys, [["__scopeId", "data-v-9156d8cd"]]), ks = {}, bs = { class: "footer" };
1010
+ function ws(e, t) {
1011
+ return _(), k("div", bs, [...t[0] || (t[0] = [
1012
+ o("span", null, "Copyright © 2024 Xto Demo. All Rights Reserved.", -1)
1013
+ ])]);
1014
+ }
1015
+ const ro = /* @__PURE__ */ F(ks, [["render", ws], ["__scopeId", "data-v-4852826a"]]), Ss = { class: "login" }, Cs = { class: "login__container" }, xs = /* @__PURE__ */ K({
1016
+ __name: "index",
1017
+ setup(e) {
1018
+ const t = H(), s = ie(), a = D(), l = G(), i = h(!1), c = h(!1), r = fe({
1019
+ username: "admin",
1020
+ password: "123456"
1021
+ }), m = {
1022
+ username: [
1023
+ { required: !0, message: "请输入用户名", trigger: "blur" }
1024
+ ],
1025
+ password: [
1026
+ { required: !0, message: "请输入密码", trigger: "blur" },
1027
+ { min: 6, message: "密码长度至少6位", trigger: "blur" }
1028
+ ]
1029
+ }, d = h(), y = async () => {
1030
+ var C;
1031
+ try {
1032
+ await ((C = d.value) == null ? void 0 : C.validate()), i.value = !0, setTimeout(() => {
1033
+ s.login({
1034
+ token: "mock_token_" + Date.now(),
1035
+ refreshToken: "mock_refresh_token",
1036
+ expireTime: Date.now() + 7 * 24 * 60 * 60 * 1e3
1037
+ }), a.setUserInfo({
1038
+ id: 1,
1039
+ username: r.username,
1040
+ nickname: "管理员",
1041
+ avatar: "",
1042
+ email: "admin@example.com",
1043
+ phone: "13800138000",
1044
+ status: 1,
1045
+ roles: ["admin"],
1046
+ permissions: ["*"],
1047
+ createTime: (/* @__PURE__ */ new Date()).toISOString()
1048
+ }), l.setMenuList([
1049
+ {
1050
+ id: 1,
1051
+ name: "Dashboard",
1052
+ path: "/dashboard",
1053
+ component: "dashboard/index",
1054
+ icon: "dashboard",
1055
+ title: "仪表盘",
1056
+ keepAlive: !0,
1057
+ affix: !0
1058
+ },
1059
+ {
1060
+ id: 2,
1061
+ name: "System",
1062
+ path: "/system",
1063
+ redirect: "/system/user",
1064
+ icon: "setting",
1065
+ title: "系统管理",
1066
+ children: [
1067
+ {
1068
+ id: 21,
1069
+ name: "SystemUser",
1070
+ path: "/system/user",
1071
+ component: "system/user/index",
1072
+ icon: "user",
1073
+ title: "用户管理",
1074
+ keepAlive: !0
1075
+ },
1076
+ {
1077
+ id: 22,
1078
+ name: "SystemRole",
1079
+ path: "/system/role",
1080
+ component: "system/role/index",
1081
+ icon: "role",
1082
+ title: "角色管理",
1083
+ keepAlive: !0
1084
+ },
1085
+ {
1086
+ id: 23,
1087
+ name: "SystemMenu",
1088
+ path: "/system/menu",
1089
+ component: "system/menu/index",
1090
+ icon: "menu",
1091
+ title: "菜单管理",
1092
+ keepAlive: !0
1093
+ }
1094
+ ]
1095
+ }
1096
+ ]), V.success("登录成功"), t.push("/"), i.value = !1;
1097
+ }, 1e3);
1098
+ } catch {
1099
+ i.value = !1;
1100
+ }
1101
+ };
1102
+ return (C, n) => (_(), k("div", Ss, [
1103
+ o("div", Cs, [
1104
+ n[5] || (n[5] = o("div", { class: "login__header" }, [
1105
+ o("img", {
1106
+ src: De,
1107
+ alt: "Logo",
1108
+ class: "login__logo"
1109
+ }),
1110
+ o("h1", { class: "login__title" }, "Xto Demo"),
1111
+ o("p", { class: "login__subtitle" }, "后台管理系统")
1112
+ ], -1)),
1113
+ g(p(nt), {
1114
+ ref_key: "formRef",
1115
+ ref: d,
1116
+ model: r,
1117
+ rules: m,
1118
+ class: "login__form",
1119
+ "label-width": "0"
1120
+ }, {
1121
+ default: E(() => [
1122
+ g(p(se), { prop: "username" }, {
1123
+ default: E(() => [
1124
+ g(p(Ae), {
1125
+ modelValue: r.username,
1126
+ "onUpdate:modelValue": n[0] || (n[0] = (T) => r.username = T),
1127
+ placeholder: "用户名",
1128
+ "prefix-icon": "👤",
1129
+ size: "large"
1130
+ }, null, 8, ["modelValue"])
1131
+ ]),
1132
+ _: 1
1133
+ }),
1134
+ g(p(se), { prop: "password" }, {
1135
+ default: E(() => [
1136
+ g(p(Ae), {
1137
+ modelValue: r.password,
1138
+ "onUpdate:modelValue": n[1] || (n[1] = (T) => r.password = T),
1139
+ type: "password",
1140
+ placeholder: "密码",
1141
+ "prefix-icon": "🔒",
1142
+ size: "large",
1143
+ "show-password": "",
1144
+ onKeyup: $e(y, ["enter"])
1145
+ }, null, 8, ["modelValue"])
1146
+ ]),
1147
+ _: 1
1148
+ }),
1149
+ g(p(se), null, {
1150
+ default: E(() => [
1151
+ g(p(at), {
1152
+ modelValue: c.value,
1153
+ "onUpdate:modelValue": n[2] || (n[2] = (T) => c.value = T)
1154
+ }, {
1155
+ default: E(() => [...n[3] || (n[3] = [
1156
+ W("记住我", -1)
1157
+ ])]),
1158
+ _: 1
1159
+ }, 8, ["modelValue"])
1160
+ ]),
1161
+ _: 1
1162
+ }),
1163
+ g(p(se), null, {
1164
+ default: E(() => [
1165
+ g(p(re), {
1166
+ type: "primary",
1167
+ size: "large",
1168
+ loading: i.value,
1169
+ class: "login__submit",
1170
+ onClick: y
1171
+ }, {
1172
+ default: E(() => [...n[4] || (n[4] = [
1173
+ W(" 登录 ", -1)
1174
+ ])]),
1175
+ _: 1
1176
+ }, 8, ["loading"])
1177
+ ]),
1178
+ _: 1
1179
+ })
1180
+ ]),
1181
+ _: 1
1182
+ }, 8, ["model"]),
1183
+ n[6] || (n[6] = o("div", { class: "login__footer" }, [
1184
+ o("p", null, "提示: 任意用户名密码即可登录 (Mock 模式)")
1185
+ ], -1))
1186
+ ])
1187
+ ]));
1188
+ }
1189
+ }), Ls = /* @__PURE__ */ F(xs, [["__scopeId", "data-v-40e9f7eb"]]), Ts = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1190
+ __proto__: null,
1191
+ default: Ls
1192
+ }, Symbol.toStringTag, { value: "Module" })), Is = { class: "error-page" }, Es = { class: "error-page__content" }, As = /* @__PURE__ */ K({
1193
+ __name: "404",
1194
+ setup(e) {
1195
+ const t = H(), s = () => {
1196
+ t.push("/");
1197
+ };
1198
+ return (a, l) => (_(), k("div", Is, [
1199
+ o("div", Es, [
1200
+ l[1] || (l[1] = o("div", { class: "error-page__code" }, "404", -1)),
1201
+ l[2] || (l[2] = o("div", { class: "error-page__title" }, "页面不存在", -1)),
1202
+ l[3] || (l[3] = o("div", { class: "error-page__desc" }, "抱歉,您访问的页面不存在或已被删除", -1)),
1203
+ g(p(re), {
1204
+ type: "primary",
1205
+ onClick: s
1206
+ }, {
1207
+ default: E(() => [...l[0] || (l[0] = [
1208
+ W("返回首页", -1)
1209
+ ])]),
1210
+ _: 1
1211
+ })
1212
+ ])
1213
+ ]));
1214
+ }
1215
+ }), Rs = /* @__PURE__ */ F(As, [["__scopeId", "data-v-c3c12c24"]]), Ms = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1216
+ __proto__: null,
1217
+ default: Rs
1218
+ }, Symbol.toStringTag, { value: "Module" })), $s = { class: "error-page" }, Us = { class: "error-page__content" }, Ps = /* @__PURE__ */ K({
1219
+ __name: "403",
1220
+ setup(e) {
1221
+ const t = H(), s = () => {
1222
+ t.push("/");
1223
+ };
1224
+ return (a, l) => (_(), k("div", $s, [
1225
+ o("div", Us, [
1226
+ l[1] || (l[1] = o("div", { class: "error-page__code" }, "403", -1)),
1227
+ l[2] || (l[2] = o("div", { class: "error-page__title" }, "无访问权限", -1)),
1228
+ l[3] || (l[3] = o("div", { class: "error-page__desc" }, "抱歉,您没有权限访问此页面", -1)),
1229
+ g(p(re), {
1230
+ type: "primary",
1231
+ onClick: s
1232
+ }, {
1233
+ default: E(() => [...l[0] || (l[0] = [
1234
+ W("返回首页", -1)
1235
+ ])]),
1236
+ _: 1
1237
+ })
1238
+ ])
1239
+ ]));
1240
+ }
1241
+ }), Ds = /* @__PURE__ */ F(Ps, [["__scopeId", "data-v-dd5f2795"]]), Os = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1242
+ __proto__: null,
1243
+ default: Ds
1244
+ }, Symbol.toStringTag, { value: "Module" }));
1245
+ function lo() {
1246
+ const e = Y(), t = D(), s = ie(), a = b(() => t.nickname || t.username || ""), l = b(() => t.userInfo), i = b(() => e.appName), c = b(() => s.isLoggedIn), r = b(() => e.isDark), m = b(() => e.theme), d = b(() => e.isCollapsed), y = b(() => e.layout);
1247
+ return {
1248
+ userName: a,
1249
+ userInfo: l,
1250
+ appName: i,
1251
+ isLoggedIn: c,
1252
+ isDark: r,
1253
+ theme: m,
1254
+ isCollapsed: d,
1255
+ layout: y,
1256
+ toggleTheme: () => {
1257
+ e.toggleTheme();
1258
+ },
1259
+ toggleCollapse: () => {
1260
+ e.toggleCollapse();
1261
+ }
1262
+ };
1263
+ }
1264
+ function io() {
1265
+ const e = D(), t = (i) => {
1266
+ const c = e.permissions;
1267
+ return c.includes("*") ? !0 : Array.isArray(i) ? i.some((r) => c.includes(r)) : c.includes(i);
1268
+ }, s = (i) => {
1269
+ const c = e.roles;
1270
+ return c.includes("admin") ? !0 : Array.isArray(i) ? i.some((r) => c.includes(r)) : c.includes(i);
1271
+ }, a = b(() => e.roles.includes("admin")), l = b(() => e.isLoggedIn);
1272
+ return {
1273
+ hasPermission: t,
1274
+ hasRole: s,
1275
+ isAdmin: a,
1276
+ isLoggedIn: l
1277
+ };
1278
+ }
1279
+ function co(e, t = {}) {
1280
+ const { rules: s, onSubmit: a } = t, l = h(), i = fe({ ...e }), c = h(!1), r = h(!1), m = h(!1), d = () => {
1281
+ n(), m.value = !1, r.value = !0;
1282
+ }, y = (I) => {
1283
+ Object.assign(i, I), m.value = !0, r.value = !0;
1284
+ }, C = () => {
1285
+ r.value = !1, n();
1286
+ }, n = () => {
1287
+ var I;
1288
+ Object.keys(e).forEach((A) => {
1289
+ i[A] = e[A];
1290
+ }), (I = l.value) == null || I.resetFields();
1291
+ };
1292
+ return {
1293
+ formRef: l,
1294
+ formData: i,
1295
+ rules: s,
1296
+ loading: c,
1297
+ visible: r,
1298
+ isEdit: m,
1299
+ openAdd: d,
1300
+ openEdit: y,
1301
+ close: C,
1302
+ resetForm: n,
1303
+ handleSubmit: async () => {
1304
+ var I;
1305
+ try {
1306
+ await ((I = l.value) == null ? void 0 : I.validate()), c.value = !0, await (a == null ? void 0 : a(i)), C();
1307
+ } catch (A) {
1308
+ console.error(A);
1309
+ } finally {
1310
+ c.value = !1;
1311
+ }
1312
+ }
1313
+ };
1314
+ }
1315
+ function uo(e) {
1316
+ const { fetchData: t, defaultPageSize: s = 10 } = e, a = h(!1), l = h([]), i = h(0), c = h(1), r = h(s), m = fe({}), d = async () => {
1317
+ a.value = !0;
1318
+ try {
1319
+ const x = {
1320
+ ...m,
1321
+ page: c.value,
1322
+ pageSize: r.value
1323
+ }, P = await t(x);
1324
+ l.value = P.list, i.value = P.total;
1325
+ } catch (x) {
1326
+ console.error(x);
1327
+ } finally {
1328
+ a.value = !1;
1329
+ }
1330
+ }, y = () => {
1331
+ c.value = 1, d();
1332
+ }, C = () => {
1333
+ Object.keys(m).forEach((x) => {
1334
+ m[x] = void 0;
1335
+ }), c.value = 1, d();
1336
+ }, n = (x) => {
1337
+ c.value = x, d();
1338
+ }, T = (x) => {
1339
+ r.value = x, c.value = 1, d();
1340
+ }, I = () => {
1341
+ d();
1342
+ }, A = b(() => ({
1343
+ current: c.value,
1344
+ pageSize: r.value,
1345
+ total: i.value
1346
+ }));
1347
+ return {
1348
+ loading: a,
1349
+ data: l,
1350
+ total: i,
1351
+ currentPage: c,
1352
+ pageSize: r,
1353
+ searchParams: m,
1354
+ pagination: A,
1355
+ getData: d,
1356
+ handleSearch: y,
1357
+ handleReset: C,
1358
+ handlePageChange: n,
1359
+ handleSizeChange: T,
1360
+ refresh: I
1361
+ };
1362
+ }
1363
+ function mo(e) {
1364
+ const s = D().permissions;
1365
+ return Array.isArray(e) ? e.some((a) => s.includes(a)) : s.includes(e);
1366
+ }
1367
+ function Ns(e) {
1368
+ const s = D().roles;
1369
+ return Array.isArray(e) ? e.some((a) => s.includes(a)) : s.includes(e);
1370
+ }
1371
+ function po() {
1372
+ return Ns("admin");
1373
+ }
1374
+ const zs = () => {
1375
+ const e = rt.create({
1376
+ baseURL: void 0,
1377
+ timeout: 3e4,
1378
+ headers: {
1379
+ "Content-Type": "application/json"
1380
+ }
1381
+ });
1382
+ return e.interceptors.request.use(
1383
+ (t) => {
1384
+ const s = le();
1385
+ return s && (t.headers.Authorization = `Bearer ${s}`), t;
1386
+ },
1387
+ (t) => Promise.reject(t)
1388
+ ), e.interceptors.response.use(
1389
+ (t) => {
1390
+ const { data: s } = t;
1391
+ return s.code === 200 || s.code === 0 ? s.data : (V.error(s.message || "请求失败"), Promise.reject(new Error(s.message || "请求失败")));
1392
+ },
1393
+ (t) => {
1394
+ var a;
1395
+ const { response: s } = t;
1396
+ if (s)
1397
+ switch (s.status) {
1398
+ case 401:
1399
+ V.error("登录已过期,请重新登录"), Ve(), window.location.href = "/login";
1400
+ break;
1401
+ case 403:
1402
+ V.error("没有权限访问");
1403
+ break;
1404
+ case 404:
1405
+ V.error("请求资源不存在");
1406
+ break;
1407
+ case 500:
1408
+ V.error("服务器错误");
1409
+ break;
1410
+ default:
1411
+ V.error(((a = s.data) == null ? void 0 : a.message) || "请求失败");
1412
+ }
1413
+ else
1414
+ V.error("网络连接失败");
1415
+ return Promise.reject(t);
1416
+ }
1417
+ ), e;
1418
+ }, Q = zs(), S = {
1419
+ get(e, t) {
1420
+ return Q.get(e, t);
1421
+ },
1422
+ post(e, t, s) {
1423
+ return Q.post(e, t, s);
1424
+ },
1425
+ put(e, t, s) {
1426
+ return Q.put(e, t, s);
1427
+ },
1428
+ patch(e, t, s) {
1429
+ return Q.patch(e, t, s);
1430
+ },
1431
+ delete(e, t) {
1432
+ return Q.delete(e, t);
1433
+ }
1434
+ };
1435
+ function vo(e, t = {}) {
1436
+ const s = t.indexPath || "/dashboard";
1437
+ return {
1438
+ path: "/",
1439
+ name: "Layout",
1440
+ component: Fe,
1441
+ redirect: s,
1442
+ children: e
1443
+ };
1444
+ }
1445
+ function ho(e) {
1446
+ return _e({
1447
+ history: ge(),
1448
+ routes: e,
1449
+ scrollBehavior: () => ({ left: 0, top: 0 })
1450
+ });
1451
+ }
1452
+ function fo(e) {
1453
+ return S.post("/auth/login", e);
1454
+ }
1455
+ function _o() {
1456
+ return S.post("/auth/logout");
1457
+ }
1458
+ function Vs() {
1459
+ return S.get("/user/info");
1460
+ }
1461
+ function go(e) {
1462
+ return S.post("/auth/refresh", { refreshToken: e });
1463
+ }
1464
+ function yo(e) {
1465
+ return S.get("/role/list", { params: e });
1466
+ }
1467
+ function ko(e) {
1468
+ return S.get(`/role/${e}`);
1469
+ }
1470
+ function bo(e) {
1471
+ return S.post("/role", e);
1472
+ }
1473
+ function wo(e, t) {
1474
+ return S.put(`/role/${e}`, t);
1475
+ }
1476
+ function So(e) {
1477
+ return S.delete(`/role/${e}`);
1478
+ }
1479
+ function Co(e, t) {
1480
+ return S.patch(`/role/${e}/status`, { status: t });
1481
+ }
1482
+ function xo() {
1483
+ return S.get("/menu/list");
1484
+ }
1485
+ function Bs() {
1486
+ return S.get("/menu/tree");
1487
+ }
1488
+ function Lo(e) {
1489
+ return S.post("/menu", e);
1490
+ }
1491
+ function To(e, t) {
1492
+ return S.put(`/menu/${e}`, t);
1493
+ }
1494
+ function Io(e) {
1495
+ return S.delete(`/menu/${e}`);
1496
+ }
1497
+ const Fs = ["/login", "/404", "/403"];
1498
+ function Eo(e, t = {}) {
1499
+ const s = t.whiteList || Fs, a = t.loginPath || "/login", l = t.homePath || "/";
1500
+ e.beforeEach(async (i, c, r) => {
1501
+ const m = Y(), d = D(), y = G();
1502
+ if (m.initTheme(), le())
1503
+ if (i.path === a)
1504
+ r({ path: l });
1505
+ else if (d.isLoggedIn)
1506
+ i.name && i.meta.keepAlive && m.addCachedView(i.name), r();
1507
+ else
1508
+ try {
1509
+ if (t.fetchUserInfo) {
1510
+ const n = await t.fetchUserInfo();
1511
+ d.setUserInfo(n);
1512
+ } else {
1513
+ const n = await Vs();
1514
+ d.setUserInfo(n);
1515
+ }
1516
+ if (t.fetchMenu) {
1517
+ const n = await t.fetchMenu();
1518
+ y.setMenuList(n);
1519
+ } else {
1520
+ const n = await Bs();
1521
+ y.setMenuList(n);
1522
+ }
1523
+ t.onLoginSuccess && t.onLoginSuccess(), i.name && i.meta.keepAlive && m.addCachedView(i.name), r({ ...i, replace: !0 });
1524
+ } catch (n) {
1525
+ console.error("获取用户信息失败:", n), d.clearUserInfo(), y.clearMenu(), localStorage.removeItem("token"), localStorage.removeItem("refreshToken"), r({ path: a, query: { redirect: i.fullPath } });
1526
+ }
1527
+ else
1528
+ s.includes(i.path) ? r() : r({ path: a, query: { redirect: i.fullPath } });
1529
+ }), e.afterEach(() => {
1530
+ });
1531
+ }
1532
+ function Ao(e) {
1533
+ return S.get("/user/list", { params: e });
1534
+ }
1535
+ function Ro(e) {
1536
+ return S.get(`/user/${e}`);
1537
+ }
1538
+ function Mo(e) {
1539
+ return S.post("/user", e);
1540
+ }
1541
+ function $o(e, t) {
1542
+ return S.put(`/user/${e}`, t);
1543
+ }
1544
+ function Uo(e) {
1545
+ return S.delete(`/user/${e}`);
1546
+ }
1547
+ function Po(e) {
1548
+ return S.post("/user/batch-delete", { ids: e });
1549
+ }
1550
+ function Do(e, t) {
1551
+ return S.patch(`/user/${e}/status`, { status: t });
1552
+ }
1553
+ function Oo(e) {
1554
+ return S.post(`/user/${e}/reset-password`);
1555
+ }
1556
+ var js = /* @__PURE__ */ ((e) => (e[e.ENABLED = 1] = "ENABLED", e[e.DISABLED = 0] = "DISABLED", e))(js || {}), Ks = /* @__PURE__ */ ((e) => (e[e.UNKNOWN = 0] = "UNKNOWN", e[e.MALE = 1] = "MALE", e[e.FEMALE = 2] = "FEMALE", e))(Ks || {}), qs = /* @__PURE__ */ ((e) => (e[e.DIRECTORY = 0] = "DIRECTORY", e[e.MENU = 1] = "MENU", e[e.BUTTON = 2] = "BUTTON", e))(qs || {});
1557
+ const No = {
1558
+ 1: "启用",
1559
+ 0: "禁用"
1560
+ }, zo = {
1561
+ 0: "未知",
1562
+ 1: "男",
1563
+ 2: "女"
1564
+ }, Vo = {
1565
+ 0: "目录",
1566
+ 1: "菜单",
1567
+ 2: "按钮"
1568
+ }, Bo = [
1569
+ {
1570
+ label: "启用",
1571
+ value: 1
1572
+ /* ENABLED */
1573
+ },
1574
+ {
1575
+ label: "禁用",
1576
+ value: 0
1577
+ /* DISABLED */
1578
+ }
1579
+ ], Fo = [
1580
+ {
1581
+ label: "未知",
1582
+ value: 0
1583
+ /* UNKNOWN */
1584
+ },
1585
+ {
1586
+ label: "男",
1587
+ value: 1
1588
+ /* MALE */
1589
+ },
1590
+ {
1591
+ label: "女",
1592
+ value: 2
1593
+ /* FEMALE */
1594
+ }
1595
+ ], jo = [
1596
+ {
1597
+ label: "目录",
1598
+ value: 0
1599
+ /* DIRECTORY */
1600
+ },
1601
+ {
1602
+ label: "菜单",
1603
+ value: 1
1604
+ /* MENU */
1605
+ },
1606
+ {
1607
+ label: "按钮",
1608
+ value: 2
1609
+ /* BUTTON */
1610
+ }
1611
+ ], Ko = {
1612
+ mounted(e, t) {
1613
+ var c;
1614
+ const s = D(), { value: a } = t;
1615
+ if (!a) return;
1616
+ const l = s.permissions;
1617
+ let i = !1;
1618
+ Array.isArray(a) ? i = a.some((r) => l.includes(r) || l.includes("*")) : i = l.includes(a) || l.includes("*"), i || (c = e.parentNode) == null || c.removeChild(e);
1619
+ }
1620
+ };
1621
+ export {
1622
+ go as $,
1623
+ yo as A,
1624
+ le as B,
1625
+ dt as C,
1626
+ Ro as D,
1627
+ Vs as E,
1628
+ ro as F,
1629
+ Ks as G,
1630
+ cs as H,
1631
+ Ao as I,
1632
+ mo as J,
1633
+ Ns as K,
1634
+ Fe as L,
1635
+ qs as M,
1636
+ Be as N,
1637
+ S as O,
1638
+ po as P,
1639
+ vt as Q,
1640
+ ze as R,
1641
+ js as S,
1642
+ ao as T,
1643
+ v as U,
1644
+ oe as V,
1645
+ fo as W,
1646
+ _o as X,
1647
+ it as Y,
1648
+ Ko as Z,
1649
+ F as _,
1650
+ Bo as a,
1651
+ Oo as a0,
1652
+ no as a1,
1653
+ Se as a2,
1654
+ to as a3,
1655
+ ne as a4,
1656
+ ut as a5,
1657
+ ct as a6,
1658
+ mt as a7,
1659
+ pt as a8,
1660
+ Eo as a9,
1661
+ Oe as aa,
1662
+ To as ab,
1663
+ wo as ac,
1664
+ Co as ad,
1665
+ $o as ae,
1666
+ Do as af,
1667
+ lo as ag,
1668
+ Y as ah,
1669
+ io as ai,
1670
+ ie as aj,
1671
+ co as ak,
1672
+ G as al,
1673
+ uo as am,
1674
+ D as an,
1675
+ jo as b,
1676
+ Ds as c,
1677
+ Fo as d,
1678
+ zo as e,
1679
+ Vo as f,
1680
+ Rs as g,
1681
+ wt as h,
1682
+ Ls as i,
1683
+ No as j,
1684
+ Po as k,
1685
+ Ve as l,
1686
+ vo as m,
1687
+ Lo as n,
1688
+ bo as o,
1689
+ ho as p,
1690
+ Mo as q,
1691
+ so as r,
1692
+ Io as s,
1693
+ So as t,
1694
+ Uo as u,
1695
+ Ne as v,
1696
+ xo as w,
1697
+ Bs as x,
1698
+ oo as y,
1699
+ ko as z
1700
+ };