xto-fronted 0.3.5 → 0.3.6

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,1664 @@
1
+ import { ref as h, computed as k, watch as We, defineComponent as K, openBlock as _, createElementBlock as y, normalizeClass as z, createElementVNode as s, withDirectives as Re, toDisplayString as R, unref as d, vShow as Ye, createVNode as g, withCtx as I, Fragment as B, renderList as j, createBlock as Q, createTextVNode as H, createCommentVNode as O, onMounted as Xe, onUnmounted as Je, withModifiers as $e, Transition as Ee, withKeys as Me, vModelText as Qe, normalizeStyle as De, resolveComponent as Ze, reactive as he } from "vue";
2
+ import { defineStore as ne } from "pinia";
3
+ import { createRouter as fe, createWebHistory as _e, useRoute as ge, useRouter as W } from "vue-router";
4
+ import { Menu as Ge, SubMenu as et, MenuItem as Ie, Tabs as tt, TabPane as st } from "@xto/navigation";
5
+ import { Icon as M, Button as ae } from "@xto/base";
6
+ import { Drawer as ot, Message as V } from "@xto/feedback";
7
+ import { Form as nt, FormItem as te, Input as Ae, Checkbox as at } from "@xto/form";
8
+ import rt from "axios";
9
+ const X = "xto_", Ue = (e) => ({
10
+ get(o) {
11
+ const t = e.getItem(X + o);
12
+ if (!t) return null;
13
+ try {
14
+ return JSON.parse(t);
15
+ } catch {
16
+ return t;
17
+ }
18
+ },
19
+ set(o, t) {
20
+ if (t == null) {
21
+ e.removeItem(X + o);
22
+ return;
23
+ }
24
+ const n = typeof t == "string" ? t : JSON.stringify(t);
25
+ e.setItem(X + o, n);
26
+ },
27
+ remove(o) {
28
+ e.removeItem(X + o);
29
+ },
30
+ clear() {
31
+ Object.keys(e).forEach((t) => {
32
+ t.startsWith(X) && e.removeItem(t);
33
+ });
34
+ }
35
+ }), se = Ue(window.localStorage), oe = Ue(window.sessionStorage), v = {
36
+ get: se.get,
37
+ set: se.set,
38
+ remove: se.remove,
39
+ clear: se.clear
40
+ }, Zs = {
41
+ get: oe.get,
42
+ set: oe.set,
43
+ remove: oe.remove,
44
+ clear: oe.clear
45
+ }, Z = ne("app", () => {
46
+ const e = h(v.get("appName") || "XTO App"), o = h(v.get("indexPath") || "/dashboard"), t = h(v.get("isDark") || !1), n = h(v.get("theme") || "light"), l = h(v.get("layout") || "sidebar"), c = h(v.get("isCollapsed") || !1), u = h(v.get("showTabs") ?? !0), r = h(v.get("showFooter") ?? !0), m = h(v.get("showBreadcrumb") ?? !0), p = h(v.get("primaryColor") || "#409eff"), b = h([]), T = k(() => t.value ? "dark" : "light"), a = (w) => {
47
+ e.value = w, v.set("appName", w);
48
+ }, L = (w) => {
49
+ o.value = w, v.set("indexPath", w);
50
+ }, E = () => {
51
+ t.value = !t.value, n.value = t.value ? "dark" : "light", x();
52
+ }, A = (w) => {
53
+ n.value = w, t.value = w === "dark", x();
54
+ }, x = () => {
55
+ const w = document.documentElement;
56
+ t.value ? w.classList.add("dark") : w.classList.remove("dark"), v.set("isDark", t.value), v.set("theme", n.value);
57
+ }, U = () => {
58
+ c.value = !c.value, v.set("isCollapsed", c.value);
59
+ }, $ = (w) => {
60
+ l.value = w, v.set("layout", w);
61
+ }, D = () => {
62
+ u.value = !u.value, v.set("showTabs", u.value);
63
+ }, ie = () => {
64
+ r.value = !r.value, v.set("showFooter", r.value);
65
+ }, ue = () => {
66
+ m.value = !m.value, v.set("showBreadcrumb", m.value);
67
+ }, G = (w) => {
68
+ p.value = w, document.documentElement.style.setProperty("--color-primary", w), v.set("primaryColor", w);
69
+ }, ce = (w) => {
70
+ b.value.includes(w) || b.value.push(w);
71
+ }, de = (w) => {
72
+ const ee = b.value.indexOf(w);
73
+ ee > -1 && b.value.splice(ee, 1);
74
+ }, me = () => {
75
+ b.value = [];
76
+ }, pe = () => {
77
+ x(), p.value !== "#409eff" && document.documentElement.style.setProperty("--color-primary", p.value);
78
+ };
79
+ return We(t, x), {
80
+ appName: e,
81
+ indexPath: o,
82
+ isDark: t,
83
+ theme: n,
84
+ layout: l,
85
+ isCollapsed: c,
86
+ showTabs: u,
87
+ showFooter: r,
88
+ showBreadcrumb: m,
89
+ primaryColor: p,
90
+ cachedViews: b,
91
+ themeClass: T,
92
+ setAppName: a,
93
+ setIndexPath: L,
94
+ toggleTheme: E,
95
+ toggleCollapse: U,
96
+ setTheme: A,
97
+ setLayout: $,
98
+ toggleTabs: D,
99
+ toggleFooter: ie,
100
+ toggleBreadcrumb: ue,
101
+ setPrimaryColor: G,
102
+ addCachedView: ce,
103
+ removeCachedView: de,
104
+ clearCachedViews: me,
105
+ initTheme: pe
106
+ };
107
+ }), Pe = "/vite.svg", lt = (e, o, t) => {
108
+ const n = e[o];
109
+ return n ? typeof n == "function" ? n() : Promise.resolve(n) : new Promise((l, c) => {
110
+ (typeof queueMicrotask == "function" ? queueMicrotask : setTimeout)(
111
+ c.bind(
112
+ null,
113
+ new Error(
114
+ "Unknown variable dynamic import: " + o + (o.split("/").length !== t ? ". 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(() => Ls),
124
+ meta: {
125
+ title: "登录",
126
+ hidden: !0
127
+ }
128
+ },
129
+ {
130
+ path: "/404",
131
+ name: "NotFound",
132
+ component: () => Promise.resolve().then(() => $s),
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-C0VN9nFF.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-B7etKk33.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-CeCysOnl.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-BBqvHkzE.js"),
194
+ meta: {
195
+ title: "菜单管理",
196
+ icon: "menu",
197
+ keepAlive: !0
198
+ }
199
+ }
200
+ ]
201
+ }, Gs = [
202
+ {
203
+ path: "/dashboard",
204
+ name: "Dashboard",
205
+ component: () => import("./index-C0VN9nFF.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-B7etKk33.js"),
226
+ meta: {
227
+ title: "用户管理",
228
+ icon: "user",
229
+ keepAlive: !0
230
+ }
231
+ },
232
+ {
233
+ path: "role",
234
+ name: "SystemRole",
235
+ component: () => import("./index-CeCysOnl.js"),
236
+ meta: {
237
+ title: "角色管理",
238
+ icon: "role",
239
+ keepAlive: !0
240
+ }
241
+ },
242
+ {
243
+ path: "menu",
244
+ name: "SystemMenu",
245
+ component: () => import("./index-BBqvHkzE.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
+ ], ye = "token", ke = "refresh_token", be = "token_expire", we = () => v.get(ye), ut = (e) => {
303
+ v.set(ye, e);
304
+ }, eo = () => v.get(ke), ct = (e) => {
305
+ v.set(ke, e);
306
+ }, dt = () => v.get(be), mt = (e) => {
307
+ v.set(be, e);
308
+ }, pt = (e) => {
309
+ ut(e.token), ct(e.refreshToken), mt(e.expireTime);
310
+ }, Ve = () => {
311
+ v.remove(ye), v.remove(ke), v.remove(be);
312
+ }, vt = () => {
313
+ const e = dt();
314
+ return e ? Date.now() > e : !0;
315
+ }, Be = () => !!we() && !vt(), N = ne("user", () => {
316
+ const e = h(v.get("userInfo")), o = h(v.get("roles") || []), t = h(v.get("permissions") || []), n = k(() => !!e.value), l = k(() => {
317
+ var a;
318
+ return ((a = e.value) == null ? void 0 : a.username) || "";
319
+ }), c = k(() => {
320
+ var a;
321
+ return ((a = e.value) == null ? void 0 : a.nickname) || "";
322
+ }), u = k(() => {
323
+ var a;
324
+ return ((a = e.value) == null ? void 0 : a.avatar) || "";
325
+ }), r = k(() => {
326
+ var a;
327
+ return (a = e.value) == null ? void 0 : a.id;
328
+ });
329
+ return {
330
+ userInfo: e,
331
+ roles: o,
332
+ permissions: t,
333
+ isLoggedIn: n,
334
+ username: l,
335
+ nickname: c,
336
+ avatar: u,
337
+ userId: r,
338
+ setUserInfo: (a) => {
339
+ e.value = a, o.value = a.roles || [], t.value = a.permissions || [], v.set("userInfo", a), v.set("roles", a.roles || []), v.set("permissions", a.permissions || []);
340
+ },
341
+ clearUserInfo: () => {
342
+ e.value = null, o.value = [], t.value = [], v.remove("userInfo"), v.remove("roles"), v.remove("permissions");
343
+ },
344
+ hasPermission: (a) => Array.isArray(a) ? a.some((L) => t.value.includes(L)) : t.value.includes(a),
345
+ hasRole: (a) => Array.isArray(a) ? a.some((L) => o.value.includes(L)) : o.value.includes(a)
346
+ };
347
+ }), Se = fe({
348
+ history: _e(),
349
+ routes: [...Oe, ze, Ne],
350
+ scrollBehavior: () => ({ left: 0, top: 0 })
351
+ }), ht = ["/login", "/404", "/403"];
352
+ Se.beforeEach(async (e, o, t) => {
353
+ const n = Z();
354
+ if (n.initTheme(), Be())
355
+ if (e.path === "/login")
356
+ t({ path: "/" });
357
+ else {
358
+ const l = N();
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
+ }), re().setMenuList(it)), e.name && e.meta.keepAlive && n.addCachedView(e.name), t();
371
+ }
372
+ else
373
+ ht.includes(e.path) ? t() : t("/login");
374
+ });
375
+ function to() {
376
+ const e = fe({
377
+ history: _e(),
378
+ routes: [...Oe, ze, Ne]
379
+ });
380
+ Se.matcher = e.matcher;
381
+ }
382
+ const re = ne("menu", () => {
383
+ const e = h(v.get("menuList") || []), o = k(() => e.value.length > 0), t = (u) => {
384
+ e.value = u, v.set("menuList", u);
385
+ }, n = () => {
386
+ e.value = [], v.remove("menuList");
387
+ }, l = (u) => u.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: o,
403
+ setMenuList: t,
404
+ clearMenu: n,
405
+ generateRoutes: l,
406
+ addRoutes: (u) => {
407
+ l(u).forEach((m) => {
408
+ Se.addRoute("Layout", m);
409
+ });
410
+ }
411
+ };
412
+ }), le = ne("auth", () => {
413
+ const e = h(we()), o = k(() => Be()), t = h(""), n = h(""), l = h(""), c = h("/login");
414
+ return {
415
+ token: e,
416
+ isLoggedIn: o,
417
+ baseUrl: t,
418
+ appId: n,
419
+ clientId: l,
420
+ loginPath: c,
421
+ login: (a) => {
422
+ e.value = a.token, pt(a);
423
+ },
424
+ logout: () => {
425
+ e.value = null, Ve();
426
+ },
427
+ setBaseUrl: (a) => {
428
+ t.value = a;
429
+ },
430
+ setAppId: (a) => {
431
+ n.value = a;
432
+ },
433
+ setClientId: (a) => {
434
+ l.value = a;
435
+ },
436
+ setLoginPath: (a) => {
437
+ c.value = a;
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 o = ge(), t = W(), n = re(), l = N(), c = le(), u = Z(), r = k(() => u.isCollapsed), m = k(() => o.path), p = k(() => u.isDark ? "#1d1e1f" : "#fff"), b = k(() => u.isDark ? "#cfd3dc" : "#303133"), T = k(() => "#409eff"), a = (A) => {
447
+ A && A !== o.path && t.push(A);
448
+ }, L = () => {
449
+ c.logout(), l.clearUserInfo(), n.clearMenu(), t.push("/login");
450
+ }, E = (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 U;
460
+ return _(), y("div", {
461
+ class: z(["sidebar", { "sidebar--collapsed": r.value }])
462
+ }, [
463
+ s("div", ft, [
464
+ x[0] || (x[0] = s("img", {
465
+ src: Pe,
466
+ alt: "Logo",
467
+ class: "sidebar__logo-img"
468
+ }, null, -1)),
469
+ Re(s("span", { class: "sidebar__logo-text" }, R(d(u).appName), 513), [
470
+ [Ye, !r.value]
471
+ ])
472
+ ]),
473
+ g(d(Ge), {
474
+ "default-active": m.value,
475
+ mode: "vertical",
476
+ collapse: r.value,
477
+ "collapse-transition": !1,
478
+ "background-color": p.value,
479
+ "text-color": b.value,
480
+ "active-text-color": T.value,
481
+ class: "sidebar__menu",
482
+ onSelect: a
483
+ }, {
484
+ default: I(() => [
485
+ (_(!0), y(B, null, j(d(n).menuList, ($) => (_(), y(B, {
486
+ key: $.path
487
+ }, [
488
+ $.children && $.children.length > 0 ? (_(), Q(d(et), {
489
+ key: 0,
490
+ index: $.path
491
+ }, {
492
+ title: I(() => [
493
+ g(d(M), {
494
+ name: E($.icon),
495
+ size: 16
496
+ }, null, 8, ["name"]),
497
+ s("span", null, R($.title), 1)
498
+ ]),
499
+ default: I(() => [
500
+ (_(!0), y(B, null, j($.children, (D) => (_(), Q(d(Ie), {
501
+ key: D.path,
502
+ index: D.path
503
+ }, {
504
+ default: I(() => [
505
+ g(d(M), {
506
+ name: E(D.icon),
507
+ size: 16
508
+ }, null, 8, ["name"]),
509
+ s("span", null, R(D.title), 1)
510
+ ]),
511
+ _: 2
512
+ }, 1032, ["index"]))), 128))
513
+ ]),
514
+ _: 2
515
+ }, 1032, ["index"])) : (_(), Q(d(Ie), {
516
+ key: 1,
517
+ index: $.path
518
+ }, {
519
+ default: I(() => [
520
+ g(d(M), {
521
+ name: E($.icon),
522
+ size: 16
523
+ }, null, 8, ["name"]),
524
+ s("span", null, R($.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 ? O("", !0) : (_(), y("div", _t, [
533
+ s("div", gt, [
534
+ s("span", yt, R(d(l).nickname), 1),
535
+ s("span", kt, R((U = d(l).roles) == null ? void 0 : U.join(", ")), 1)
536
+ ]),
537
+ g(d(ae), {
538
+ type: "text",
539
+ size: "small",
540
+ onClick: L
541
+ }, {
542
+ default: I(() => [...x[1] || (x[1] = [
543
+ H("退出", -1)
544
+ ])]),
545
+ _: 1
546
+ })
547
+ ]))
548
+ ], 2);
549
+ };
550
+ }
551
+ }), F = (e, o) => {
552
+ const t = e.__vccOpts || e;
553
+ for (const [n, l] of o)
554
+ t[n] = l;
555
+ return t;
556
+ }, wt = /* @__PURE__ */ F(bt, [["__scopeId", "data-v-a7668285"]]), St = { class: "header" }, xt = { class: "header__left" }, Ct = {
557
+ key: 0,
558
+ class: "header__breadcrumb"
559
+ }, Tt = {
560
+ key: 0,
561
+ class: "breadcrumb-separator"
562
+ }, Lt = { class: "header__right" }, Et = ["title"], It = { class: "header__avatar" }, At = { class: "header__user-name" }, Rt = {
563
+ key: 0,
564
+ class: "header__dropdown"
565
+ }, $t = { class: "header__dropdown-header" }, Mt = { class: "header__dropdown-avatar" }, Dt = { class: "header__dropdown-info" }, Ut = { class: "header__dropdown-name" }, Pt = { 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
+ }, Ht = { class: "settings-drawer" }, Wt = { 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 o = ge(), t = W(), n = Z(), l = N(), c = le(), u = re(), r = h(!1), m = h(!1), p = h(null), b = h(!1), T = h(!1), a = h(""), L = h(null), E = 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
+ ], U = k(() => o.matched.filter((i) => i.meta && i.meta.title).map((i) => ({
598
+ title: i.meta.title,
599
+ path: i.path
600
+ }))), $ = (C, i = "") => {
601
+ const q = [];
602
+ return C.forEach((f) => {
603
+ f.children && f.children.length > 0 ? q.push(...$(f.children, f.title)) : q.push({ ...f, parentTitle: i });
604
+ }), q;
605
+ }, D = k(() => a.value.trim() ? $(u.menuList).filter(
606
+ (i) => i.title.toLowerCase().includes(a.value.toLowerCase())
607
+ ) : []), ie = k(() => n.layout), ue = () => {
608
+ n.toggleCollapse();
609
+ }, G = () => {
610
+ n.toggleTheme();
611
+ }, ce = () => {
612
+ m.value = !0;
613
+ }, de = (C) => {
614
+ n.setLayout(C);
615
+ }, me = (C) => {
616
+ E.value = C;
617
+ const i = document.documentElement;
618
+ C ? i.classList.add("grey-mode") : i.classList.remove("grey-mode");
619
+ }, pe = () => {
620
+ document.fullscreenElement ? document.exitFullscreen() : document.documentElement.requestFullscreen();
621
+ }, w = () => {
622
+ b.value = !!document.fullscreenElement;
623
+ }, ee = () => {
624
+ r.value = !r.value;
625
+ }, Y = () => {
626
+ r.value = !1;
627
+ }, xe = () => {
628
+ T.value = !0;
629
+ }, ve = () => {
630
+ T.value = !1, a.value = "";
631
+ }, Ce = (C) => {
632
+ t.push(C), ve();
633
+ }, je = (C) => {
634
+ n.setPrimaryColor(C);
635
+ }, Ke = () => {
636
+ Y(), t.push("/profile");
637
+ }, qe = () => {
638
+ Y(), t.push("/change-password");
639
+ }, He = () => {
640
+ Y(), c.logout(), l.clearUserInfo(), u.clearMenu(), t.push("/login");
641
+ }, Te = (C) => {
642
+ p.value && !p.value.contains(C.target) && Y(), L.value && !L.value.contains(C.target) && ve();
643
+ }, Le = (C) => {
644
+ C.key === "Escape" && (ve(), Y()), (C.ctrlKey || C.metaKey) && C.key === "k" && (C.preventDefault(), xe());
645
+ };
646
+ return Xe(() => {
647
+ document.addEventListener("click", Te), document.addEventListener("fullscreenchange", w), document.addEventListener("keydown", Le), n.initTheme(), E.value = document.documentElement.classList.contains("grey-mode");
648
+ }), Je(() => {
649
+ document.removeEventListener("click", Te), document.removeEventListener("fullscreenchange", w), document.removeEventListener("keydown", Le);
650
+ }), (C, i) => {
651
+ var q;
652
+ return _(), y("div", St, [
653
+ s("div", xt, [
654
+ s("div", {
655
+ class: "header__collapse",
656
+ onClick: ue
657
+ }, [
658
+ g(d(M), {
659
+ name: d(n).isCollapsed ? "menu-unfold" : "menu-fold",
660
+ size: 18
661
+ }, null, 8, ["name"])
662
+ ]),
663
+ d(n).showBreadcrumb ? (_(), y("div", Ct, [
664
+ (_(!0), y(B, null, j(U.value, (f, P) => (_(), y("span", {
665
+ key: f.path
666
+ }, [
667
+ P > 0 ? (_(), y("span", Tt, "/")) : O("", !0),
668
+ s("span", {
669
+ class: z({ "is-current": P === U.value.length - 1 })
670
+ }, R(f.title), 3)
671
+ ]))), 128))
672
+ ])) : O("", !0)
673
+ ]),
674
+ s("div", Lt, [
675
+ s("div", {
676
+ class: "header__action",
677
+ onClick: xe,
678
+ title: "搜索 (Ctrl+K)"
679
+ }, [
680
+ g(d(M), {
681
+ name: "search",
682
+ size: 16
683
+ })
684
+ ]),
685
+ s("div", {
686
+ class: "header__action",
687
+ onClick: pe,
688
+ title: b.value ? "退出全屏" : "全屏"
689
+ }, [
690
+ g(d(M), {
691
+ name: b.value ? "fullscreen-exit" : "fullscreen",
692
+ size: 16
693
+ }, null, 8, ["name"])
694
+ ], 8, Et),
695
+ s("div", {
696
+ class: "header__action",
697
+ onClick: ce,
698
+ title: "换肤设置"
699
+ }, [
700
+ g(d(M), {
701
+ name: "setting",
702
+ size: 16
703
+ })
704
+ ]),
705
+ s("div", {
706
+ class: "header__action",
707
+ onClick: G,
708
+ title: "切换主题"
709
+ }, [
710
+ g(d(M), {
711
+ name: d(n).isDark ? "sun" : "moon",
712
+ size: 16
713
+ }, null, 8, ["name"])
714
+ ]),
715
+ s("div", {
716
+ class: "header__user",
717
+ ref_key: "dropdownRef",
718
+ ref: p
719
+ }, [
720
+ s("div", {
721
+ class: "header__user-trigger",
722
+ onClick: $e(ee, ["stop"])
723
+ }, [
724
+ s("div", It, [
725
+ s("span", null, R(((q = d(l).nickname) == null ? void 0 : q.charAt(0)) || "U"), 1)
726
+ ]),
727
+ s("span", At, R(d(l).nickname), 1),
728
+ s("span", {
729
+ class: z(["header__user-arrow", { "is-active": r.value }])
730
+ }, "▼", 2)
731
+ ]),
732
+ g(Ee, { name: "dropdown" }, {
733
+ default: I(() => {
734
+ var f, P;
735
+ return [
736
+ r.value ? (_(), y("div", Rt, [
737
+ s("div", $t, [
738
+ s("div", Mt, [
739
+ s("span", null, R(((f = d(l).nickname) == null ? void 0 : f.charAt(0)) || "U"), 1)
740
+ ]),
741
+ s("div", Dt, [
742
+ s("div", Ut, R(d(l).nickname), 1),
743
+ s("div", Pt, R((P = d(l).roles) == null ? void 0 : P.join(", ")), 1)
744
+ ])
745
+ ]),
746
+ i[8] || (i[8] = s("div", { class: "header__dropdown-divider" }, null, -1)),
747
+ s("div", Ot, [
748
+ s("div", {
749
+ class: "header__dropdown-item",
750
+ onClick: Ke
751
+ }, [
752
+ g(d(M), {
753
+ name: "user",
754
+ size: 16
755
+ }),
756
+ i[4] || (i[4] = s("span", null, "个人信息", -1))
757
+ ]),
758
+ s("div", {
759
+ class: "header__dropdown-item",
760
+ onClick: qe
761
+ }, [
762
+ g(d(M), {
763
+ name: "lock",
764
+ size: 16
765
+ }),
766
+ i[5] || (i[5] = s("span", null, "修改密码", -1))
767
+ ]),
768
+ i[7] || (i[7] = s("div", { class: "header__dropdown-divider" }, null, -1)),
769
+ s("div", {
770
+ class: "header__dropdown-item header__dropdown-item--danger",
771
+ onClick: He
772
+ }, [
773
+ g(d(M), {
774
+ name: "logout",
775
+ size: 16
776
+ }),
777
+ i[6] || (i[6] = s("span", null, "退出登录", -1))
778
+ ])
779
+ ])
780
+ ])) : O("", !0)
781
+ ];
782
+ }),
783
+ _: 1
784
+ })
785
+ ], 512)
786
+ ]),
787
+ g(Ee, { name: "search" }, {
788
+ default: I(() => [
789
+ T.value ? (_(), y("div", {
790
+ key: 0,
791
+ class: "header__search-modal",
792
+ ref_key: "searchRef",
793
+ ref: L
794
+ }, [
795
+ s("div", Nt, [
796
+ s("div", zt, [
797
+ g(d(M), {
798
+ class: "search-icon",
799
+ name: "search",
800
+ size: 20
801
+ }),
802
+ Re(s("input", {
803
+ "onUpdate:modelValue": i[0] || (i[0] = (f) => a.value = f),
804
+ type: "text",
805
+ class: "search-input",
806
+ placeholder: "搜索菜单...",
807
+ autofocus: "",
808
+ onKeyup: i[1] || (i[1] = Me((f) => D.value[0] && Ce(D.value[0].path), ["enter"]))
809
+ }, null, 544), [
810
+ [Qe, a.value]
811
+ ]),
812
+ i[9] || (i[9] = s("span", { class: "search-shortcut" }, "ESC 关闭", -1))
813
+ ]),
814
+ D.value.length > 0 ? (_(), y("div", Vt, [
815
+ (_(!0), y(B, null, j(D.value, (f, P) => (_(), y("div", {
816
+ key: f.path,
817
+ class: z(["search-result-item", { "is-first": P === 0 }]),
818
+ onClick: (js) => Ce(f.path)
819
+ }, [
820
+ g(d(M), {
821
+ class: "search-result-icon",
822
+ name: f.icon || "file",
823
+ size: 20
824
+ }, null, 8, ["name"]),
825
+ s("div", Ft, [
826
+ s("span", jt, R(f.title), 1),
827
+ f.parentTitle ? (_(), y("span", Kt, R(f.parentTitle), 1)) : O("", !0)
828
+ ])
829
+ ], 10, Bt))), 128))
830
+ ])) : a.value ? (_(), y("div", qt, " 未找到匹配的菜单 ")) : O("", !0)
831
+ ])
832
+ ], 512)) : O("", !0)
833
+ ]),
834
+ _: 1
835
+ }),
836
+ g(d(ot), {
837
+ modelValue: m.value,
838
+ "onUpdate:modelValue": i[3] || (i[3] = (f) => m.value = f),
839
+ title: "换肤设置",
840
+ direction: "rtl",
841
+ size: "320px"
842
+ }, {
843
+ default: I(() => [
844
+ s("div", Ht, [
845
+ s("div", Wt, [
846
+ i[13] || (i[13] = s("div", { class: "settings-title" }, "布局模式", -1)),
847
+ s("div", Yt, [
848
+ (_(), y(B, null, j(A, (f) => s("div", {
849
+ key: f.value,
850
+ class: z(["layout-option", { "is-active": ie.value === f.value }]),
851
+ onClick: (P) => de(f.value)
852
+ }, [
853
+ s("div", Jt, [
854
+ f.value === "sidebar" ? (_(), y("div", Qt, [...i[10] || (i[10] = [
855
+ s("div", { class: "preview-aside" }, null, -1),
856
+ s("div", { class: "preview-main" }, [
857
+ s("div", { class: "preview-header" }),
858
+ s("div", { class: "preview-content" })
859
+ ], -1)
860
+ ])])) : f.value === "top" ? (_(), y("div", Zt, [...i[11] || (i[11] = [
861
+ s("div", { class: "preview-header-full" }, null, -1),
862
+ s("div", { class: "preview-content-full" }, null, -1)
863
+ ])])) : (_(), y("div", Gt, [...i[12] || (i[12] = [
864
+ s("div", { class: "preview-header-mix" }, [
865
+ s("div", { class: "preview-mix-left" })
866
+ ], -1),
867
+ s("div", { class: "preview-mix-body" }, [
868
+ s("div", { class: "preview-mix-aside" }),
869
+ s("div", { class: "preview-mix-content" })
870
+ ], -1)
871
+ ])]))
872
+ ]),
873
+ s("span", es, R(f.label), 1)
874
+ ], 10, Xt)), 64))
875
+ ])
876
+ ]),
877
+ s("div", ts, [
878
+ i[14] || (i[14] = s("div", { class: "settings-title" }, "主题色", -1)),
879
+ s("div", ss, [
880
+ (_(), y(B, null, j(x, (f) => s("div", {
881
+ key: f.value,
882
+ class: z(["color-option", { "is-active": d(n).primaryColor === f.value }]),
883
+ style: De({ backgroundColor: f.value }),
884
+ title: f.label,
885
+ onClick: (P) => je(f.value)
886
+ }, [
887
+ d(n).primaryColor === f.value ? (_(), Q(d(M), {
888
+ key: 0,
889
+ name: "check",
890
+ size: 12,
891
+ color: "#fff"
892
+ })) : O("", !0)
893
+ ], 14, os)), 64))
894
+ ])
895
+ ]),
896
+ s("div", ns, [
897
+ i[19] || (i[19] = s("div", { class: "settings-title" }, "功能设置", -1)),
898
+ s("div", as, [
899
+ s("div", rs, [
900
+ i[16] || (i[16] = s("span", null, "灰色模式", -1)),
901
+ s("div", {
902
+ class: z(["switch-wrapper", { "is-checked": E.value }]),
903
+ onClick: i[2] || (i[2] = (f) => me(!E.value))
904
+ }, [...i[15] || (i[15] = [
905
+ s("span", { class: "switch-core" }, null, -1)
906
+ ])], 2)
907
+ ]),
908
+ s("div", ls, [
909
+ i[18] || (i[18] = s("span", null, "暗黑模式", -1)),
910
+ s("div", {
911
+ class: z(["switch-wrapper", { "is-checked": d(n).isDark }]),
912
+ onClick: G
913
+ }, [...i[17] || (i[17] = [
914
+ s("span", { class: "switch-core" }, null, -1)
915
+ ])], 2)
916
+ ])
917
+ ])
918
+ ])
919
+ ])
920
+ ]),
921
+ _: 1
922
+ }, 8, ["modelValue"])
923
+ ]);
924
+ };
925
+ }
926
+ }), us = /* @__PURE__ */ F(is, [["__scopeId", "data-v-015c45c9"]]), cs = { 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 o = Z(), t = k(
930
+ () => o.isCollapsed ? "64px" : "210px"
931
+ );
932
+ return (n, l) => {
933
+ const c = Ze("router-view");
934
+ return _(), y("div", cs, [
935
+ s("aside", {
936
+ class: "layout__aside",
937
+ style: De({ width: t.value })
938
+ }, [
939
+ g(wt)
940
+ ], 4),
941
+ s("div", ds, [
942
+ s("header", ms, [
943
+ g(us)
944
+ ]),
945
+ s("main", ps, [
946
+ g(c)
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 o = ge(), t = W(), n = k(() => {
959
+ const r = [];
960
+ return o.matched.forEach((m) => {
961
+ var p;
962
+ (p = m.meta) != null && p.affix && r.push({
963
+ name: m.name,
964
+ title: m.meta.title,
965
+ path: m.path,
966
+ affix: !0
967
+ });
968
+ }), r;
969
+ }), l = k(() => o.path), c = (r) => {
970
+ t.push(r);
971
+ }, u = (r) => {
972
+ const m = n.value.find((p) => p.path === r);
973
+ if (!(m != null && m.affix) && r === l.value) {
974
+ const p = n.value.findIndex((T) => T.path === r), b = n.value[p - 1] || n.value[p + 1];
975
+ b && t.push(b.path);
976
+ }
977
+ };
978
+ return (r, m) => (_(), y("div", fs, [
979
+ g(d(tt), {
980
+ modelValue: l.value,
981
+ "onUpdate:modelValue": m[0] || (m[0] = (p) => l.value = p),
982
+ type: "card",
983
+ onTabClick: c
984
+ }, {
985
+ default: I(() => [
986
+ (_(!0), y(B, null, j(n.value, (p) => (_(), Q(d(st), {
987
+ key: p.path,
988
+ name: p.path,
989
+ label: p.title,
990
+ closable: !p.affix
991
+ }, {
992
+ label: I(() => [
993
+ s("span", _s, [
994
+ H(R(p.title) + " ", 1),
995
+ p.affix ? O("", !0) : (_(), y("span", {
996
+ key: 0,
997
+ class: "tab-close",
998
+ onClick: $e((b) => u(p.path), ["stop"])
999
+ }, " ✕ ", 8, gs))
1000
+ ])
1001
+ ]),
1002
+ _: 2
1003
+ }, 1032, ["name", "label", "closable"]))), 128))
1004
+ ]),
1005
+ _: 1
1006
+ }, 8, ["modelValue"])
1007
+ ]));
1008
+ }
1009
+ }), so = /* @__PURE__ */ F(ys, [["__scopeId", "data-v-9156d8cd"]]), ks = {}, bs = { class: "footer" };
1010
+ function ws(e, o) {
1011
+ return _(), y("div", bs, [...o[0] || (o[0] = [
1012
+ s("span", null, "Copyright © 2024 Xto Demo. All Rights Reserved.", -1)
1013
+ ])]);
1014
+ }
1015
+ const oo = /* @__PURE__ */ F(ks, [["render", ws], ["__scopeId", "data-v-4852826a"]]), Ss = { class: "login" }, xs = { class: "login__container" }, Cs = /* @__PURE__ */ K({
1016
+ __name: "index",
1017
+ setup(e) {
1018
+ const o = W(), t = le(), n = N(), l = re(), c = h(!1), u = h(!1), r = he({
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
+ }, p = h(), b = async () => {
1030
+ var T;
1031
+ try {
1032
+ await ((T = p.value) == null ? void 0 : T.validate()), c.value = !0, setTimeout(() => {
1033
+ t.login({
1034
+ token: "mock_token_" + Date.now(),
1035
+ refreshToken: "mock_refresh_token",
1036
+ expireTime: Date.now() + 7 * 24 * 60 * 60 * 1e3
1037
+ }), n.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("登录成功"), o.push("/"), c.value = !1;
1097
+ }, 1e3);
1098
+ } catch {
1099
+ c.value = !1;
1100
+ }
1101
+ };
1102
+ return (T, a) => (_(), y("div", Ss, [
1103
+ s("div", xs, [
1104
+ a[5] || (a[5] = s("div", { class: "login__header" }, [
1105
+ s("img", {
1106
+ src: Pe,
1107
+ alt: "Logo",
1108
+ class: "login__logo"
1109
+ }),
1110
+ s("h1", { class: "login__title" }, "Xto Demo"),
1111
+ s("p", { class: "login__subtitle" }, "后台管理系统")
1112
+ ], -1)),
1113
+ g(d(nt), {
1114
+ ref_key: "formRef",
1115
+ ref: p,
1116
+ model: r,
1117
+ rules: m,
1118
+ class: "login__form",
1119
+ "label-width": "0"
1120
+ }, {
1121
+ default: I(() => [
1122
+ g(d(te), { prop: "username" }, {
1123
+ default: I(() => [
1124
+ g(d(Ae), {
1125
+ modelValue: r.username,
1126
+ "onUpdate:modelValue": a[0] || (a[0] = (L) => r.username = L),
1127
+ placeholder: "用户名",
1128
+ "prefix-icon": "👤",
1129
+ size: "large"
1130
+ }, null, 8, ["modelValue"])
1131
+ ]),
1132
+ _: 1
1133
+ }),
1134
+ g(d(te), { prop: "password" }, {
1135
+ default: I(() => [
1136
+ g(d(Ae), {
1137
+ modelValue: r.password,
1138
+ "onUpdate:modelValue": a[1] || (a[1] = (L) => r.password = L),
1139
+ type: "password",
1140
+ placeholder: "密码",
1141
+ "prefix-icon": "🔒",
1142
+ size: "large",
1143
+ "show-password": "",
1144
+ onKeyup: Me(b, ["enter"])
1145
+ }, null, 8, ["modelValue"])
1146
+ ]),
1147
+ _: 1
1148
+ }),
1149
+ g(d(te), null, {
1150
+ default: I(() => [
1151
+ g(d(at), {
1152
+ modelValue: u.value,
1153
+ "onUpdate:modelValue": a[2] || (a[2] = (L) => u.value = L)
1154
+ }, {
1155
+ default: I(() => [...a[3] || (a[3] = [
1156
+ H("记住我", -1)
1157
+ ])]),
1158
+ _: 1
1159
+ }, 8, ["modelValue"])
1160
+ ]),
1161
+ _: 1
1162
+ }),
1163
+ g(d(te), null, {
1164
+ default: I(() => [
1165
+ g(d(ae), {
1166
+ type: "primary",
1167
+ size: "large",
1168
+ loading: c.value,
1169
+ class: "login__submit",
1170
+ onClick: b
1171
+ }, {
1172
+ default: I(() => [...a[4] || (a[4] = [
1173
+ H(" 登录 ", -1)
1174
+ ])]),
1175
+ _: 1
1176
+ }, 8, ["loading"])
1177
+ ]),
1178
+ _: 1
1179
+ })
1180
+ ]),
1181
+ _: 1
1182
+ }, 8, ["model"]),
1183
+ a[6] || (a[6] = s("div", { class: "login__footer" }, [
1184
+ s("p", null, "提示: 任意用户名密码即可登录 (Mock 模式)")
1185
+ ], -1))
1186
+ ])
1187
+ ]));
1188
+ }
1189
+ }), Ts = /* @__PURE__ */ F(Cs, [["__scopeId", "data-v-40e9f7eb"]]), Ls = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1190
+ __proto__: null,
1191
+ default: Ts
1192
+ }, Symbol.toStringTag, { value: "Module" })), Es = { class: "error-page" }, Is = { class: "error-page__content" }, As = /* @__PURE__ */ K({
1193
+ __name: "404",
1194
+ setup(e) {
1195
+ const o = W(), t = () => {
1196
+ o.push("/");
1197
+ };
1198
+ return (n, l) => (_(), y("div", Es, [
1199
+ s("div", Is, [
1200
+ l[1] || (l[1] = s("div", { class: "error-page__code" }, "404", -1)),
1201
+ l[2] || (l[2] = s("div", { class: "error-page__title" }, "页面不存在", -1)),
1202
+ l[3] || (l[3] = s("div", { class: "error-page__desc" }, "抱歉,您访问的页面不存在或已被删除", -1)),
1203
+ g(d(ae), {
1204
+ type: "primary",
1205
+ onClick: t
1206
+ }, {
1207
+ default: I(() => [...l[0] || (l[0] = [
1208
+ H("返回首页", -1)
1209
+ ])]),
1210
+ _: 1
1211
+ })
1212
+ ])
1213
+ ]));
1214
+ }
1215
+ }), Rs = /* @__PURE__ */ F(As, [["__scopeId", "data-v-c3c12c24"]]), $s = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1216
+ __proto__: null,
1217
+ default: Rs
1218
+ }, Symbol.toStringTag, { value: "Module" })), Ms = { class: "error-page" }, Ds = { class: "error-page__content" }, Us = /* @__PURE__ */ K({
1219
+ __name: "403",
1220
+ setup(e) {
1221
+ const o = W(), t = () => {
1222
+ o.push("/");
1223
+ };
1224
+ return (n, l) => (_(), y("div", Ms, [
1225
+ s("div", Ds, [
1226
+ l[1] || (l[1] = s("div", { class: "error-page__code" }, "403", -1)),
1227
+ l[2] || (l[2] = s("div", { class: "error-page__title" }, "无访问权限", -1)),
1228
+ l[3] || (l[3] = s("div", { class: "error-page__desc" }, "抱歉,您没有权限访问此页面", -1)),
1229
+ g(d(ae), {
1230
+ type: "primary",
1231
+ onClick: t
1232
+ }, {
1233
+ default: I(() => [...l[0] || (l[0] = [
1234
+ H("返回首页", -1)
1235
+ ])]),
1236
+ _: 1
1237
+ })
1238
+ ])
1239
+ ]));
1240
+ }
1241
+ }), Ps = /* @__PURE__ */ F(Us, [["__scopeId", "data-v-dd5f2795"]]), Os = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1242
+ __proto__: null,
1243
+ default: Ps
1244
+ }, Symbol.toStringTag, { value: "Module" }));
1245
+ function no() {
1246
+ const e = Z(), o = N(), t = le(), n = k(() => o.nickname || o.username || ""), l = k(() => o.userInfo), c = k(() => e.appName), u = k(() => t.isLoggedIn), r = k(() => e.isDark), m = k(() => e.theme), p = k(() => e.isCollapsed), b = k(() => e.layout);
1247
+ return {
1248
+ userName: n,
1249
+ userInfo: l,
1250
+ appName: c,
1251
+ isLoggedIn: u,
1252
+ isDark: r,
1253
+ theme: m,
1254
+ isCollapsed: p,
1255
+ layout: b,
1256
+ toggleTheme: () => {
1257
+ e.toggleTheme();
1258
+ },
1259
+ toggleCollapse: () => {
1260
+ e.toggleCollapse();
1261
+ }
1262
+ };
1263
+ }
1264
+ function ao() {
1265
+ const e = N(), o = (c) => {
1266
+ const u = e.permissions;
1267
+ return u.includes("*") ? !0 : Array.isArray(c) ? c.some((r) => u.includes(r)) : u.includes(c);
1268
+ }, t = (c) => {
1269
+ const u = e.roles;
1270
+ return u.includes("admin") ? !0 : Array.isArray(c) ? c.some((r) => u.includes(r)) : u.includes(c);
1271
+ }, n = k(() => e.roles.includes("admin")), l = k(() => e.isLoggedIn);
1272
+ return {
1273
+ hasPermission: o,
1274
+ hasRole: t,
1275
+ isAdmin: n,
1276
+ isLoggedIn: l
1277
+ };
1278
+ }
1279
+ function ro(e, o = {}) {
1280
+ const { rules: t, onSubmit: n } = o, l = h(), c = he({ ...e }), u = h(!1), r = h(!1), m = h(!1), p = () => {
1281
+ a(), m.value = !1, r.value = !0;
1282
+ }, b = (E) => {
1283
+ Object.assign(c, E), m.value = !0, r.value = !0;
1284
+ }, T = () => {
1285
+ r.value = !1, a();
1286
+ }, a = () => {
1287
+ var E;
1288
+ Object.keys(e).forEach((A) => {
1289
+ c[A] = e[A];
1290
+ }), (E = l.value) == null || E.resetFields();
1291
+ };
1292
+ return {
1293
+ formRef: l,
1294
+ formData: c,
1295
+ rules: t,
1296
+ loading: u,
1297
+ visible: r,
1298
+ isEdit: m,
1299
+ openAdd: p,
1300
+ openEdit: b,
1301
+ close: T,
1302
+ resetForm: a,
1303
+ handleSubmit: async () => {
1304
+ var E;
1305
+ try {
1306
+ await ((E = l.value) == null ? void 0 : E.validate()), u.value = !0, await (n == null ? void 0 : n(c)), T();
1307
+ } catch (A) {
1308
+ console.error(A);
1309
+ } finally {
1310
+ u.value = !1;
1311
+ }
1312
+ }
1313
+ };
1314
+ }
1315
+ function lo(e) {
1316
+ const { fetchData: o, defaultPageSize: t = 10 } = e, n = h(!1), l = h([]), c = h(0), u = h(1), r = h(t), m = he({}), p = async () => {
1317
+ n.value = !0;
1318
+ try {
1319
+ const x = {
1320
+ ...m,
1321
+ page: u.value,
1322
+ pageSize: r.value
1323
+ }, U = await o(x);
1324
+ l.value = U.list, c.value = U.total;
1325
+ } catch (x) {
1326
+ console.error(x);
1327
+ } finally {
1328
+ n.value = !1;
1329
+ }
1330
+ }, b = () => {
1331
+ u.value = 1, p();
1332
+ }, T = () => {
1333
+ Object.keys(m).forEach((x) => {
1334
+ m[x] = void 0;
1335
+ }), u.value = 1, p();
1336
+ }, a = (x) => {
1337
+ u.value = x, p();
1338
+ }, L = (x) => {
1339
+ r.value = x, u.value = 1, p();
1340
+ }, E = () => {
1341
+ p();
1342
+ }, A = k(() => ({
1343
+ current: u.value,
1344
+ pageSize: r.value,
1345
+ total: c.value
1346
+ }));
1347
+ return {
1348
+ loading: n,
1349
+ data: l,
1350
+ total: c,
1351
+ currentPage: u,
1352
+ pageSize: r,
1353
+ searchParams: m,
1354
+ pagination: A,
1355
+ getData: p,
1356
+ handleSearch: b,
1357
+ handleReset: T,
1358
+ handlePageChange: a,
1359
+ handleSizeChange: L,
1360
+ refresh: E
1361
+ };
1362
+ }
1363
+ function io(e) {
1364
+ const t = N().permissions;
1365
+ return Array.isArray(e) ? e.some((n) => t.includes(n)) : t.includes(e);
1366
+ }
1367
+ function Ns(e) {
1368
+ const t = N().roles;
1369
+ return Array.isArray(e) ? e.some((n) => t.includes(n)) : t.includes(e);
1370
+ }
1371
+ function uo() {
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
+ (o) => {
1384
+ const t = we();
1385
+ return t && (o.headers.Authorization = `Bearer ${t}`), o;
1386
+ },
1387
+ (o) => Promise.reject(o)
1388
+ ), e.interceptors.response.use(
1389
+ (o) => {
1390
+ const { data: t } = o;
1391
+ return t.code === 200 || t.code === 0 ? t.data : (V.error(t.message || "请求失败"), Promise.reject(new Error(t.message || "请求失败")));
1392
+ },
1393
+ (o) => {
1394
+ var n;
1395
+ const { response: t } = o;
1396
+ if (t)
1397
+ switch (t.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(((n = t.data) == null ? void 0 : n.message) || "请求失败");
1412
+ }
1413
+ else
1414
+ V.error("网络连接失败");
1415
+ return Promise.reject(o);
1416
+ }
1417
+ ), e;
1418
+ }, J = zs(), S = {
1419
+ get(e, o) {
1420
+ return J.get(e, o);
1421
+ },
1422
+ post(e, o, t) {
1423
+ return J.post(e, o, t);
1424
+ },
1425
+ put(e, o, t) {
1426
+ return J.put(e, o, t);
1427
+ },
1428
+ patch(e, o, t) {
1429
+ return J.patch(e, o, t);
1430
+ },
1431
+ delete(e, o) {
1432
+ return J.delete(e, o);
1433
+ }
1434
+ };
1435
+ function co(e, o = {}) {
1436
+ const t = o.indexPath || "/dashboard";
1437
+ return {
1438
+ path: "/",
1439
+ name: "Layout",
1440
+ component: Fe,
1441
+ redirect: t,
1442
+ children: e
1443
+ };
1444
+ }
1445
+ function mo(e) {
1446
+ return fe({
1447
+ history: _e(),
1448
+ routes: e,
1449
+ scrollBehavior: () => ({ left: 0, top: 0 })
1450
+ });
1451
+ }
1452
+ function po(e) {
1453
+ return S.post("/auth/login", e);
1454
+ }
1455
+ function vo() {
1456
+ return S.post("/auth/logout");
1457
+ }
1458
+ function ho() {
1459
+ return S.get("/user/info");
1460
+ }
1461
+ function fo(e) {
1462
+ return S.post("/auth/refresh", { refreshToken: e });
1463
+ }
1464
+ function _o(e) {
1465
+ return S.get("/role/list", { params: e });
1466
+ }
1467
+ function go(e) {
1468
+ return S.get(`/role/${e}`);
1469
+ }
1470
+ function yo(e) {
1471
+ return S.post("/role", e);
1472
+ }
1473
+ function ko(e, o) {
1474
+ return S.put(`/role/${e}`, o);
1475
+ }
1476
+ function bo(e) {
1477
+ return S.delete(`/role/${e}`);
1478
+ }
1479
+ function wo(e, o) {
1480
+ return S.patch(`/role/${e}/status`, { status: o });
1481
+ }
1482
+ function So() {
1483
+ return S.get("/menu/list");
1484
+ }
1485
+ function xo() {
1486
+ return S.get("/menu/tree");
1487
+ }
1488
+ function Co(e) {
1489
+ return S.post("/menu", e);
1490
+ }
1491
+ function To(e, o) {
1492
+ return S.put(`/menu/${e}`, o);
1493
+ }
1494
+ function Lo(e) {
1495
+ return S.delete(`/menu/${e}`);
1496
+ }
1497
+ function Eo(e) {
1498
+ return S.get("/user/list", { params: e });
1499
+ }
1500
+ function Io(e) {
1501
+ return S.get(`/user/${e}`);
1502
+ }
1503
+ function Ao(e) {
1504
+ return S.post("/user", e);
1505
+ }
1506
+ function Ro(e, o) {
1507
+ return S.put(`/user/${e}`, o);
1508
+ }
1509
+ function $o(e) {
1510
+ return S.delete(`/user/${e}`);
1511
+ }
1512
+ function Mo(e) {
1513
+ return S.post("/user/batch-delete", { ids: e });
1514
+ }
1515
+ function Do(e, o) {
1516
+ return S.patch(`/user/${e}/status`, { status: o });
1517
+ }
1518
+ function Uo(e) {
1519
+ return S.post(`/user/${e}/reset-password`);
1520
+ }
1521
+ var Vs = /* @__PURE__ */ ((e) => (e[e.ENABLED = 1] = "ENABLED", e[e.DISABLED = 0] = "DISABLED", e))(Vs || {}), Bs = /* @__PURE__ */ ((e) => (e[e.UNKNOWN = 0] = "UNKNOWN", e[e.MALE = 1] = "MALE", e[e.FEMALE = 2] = "FEMALE", e))(Bs || {}), Fs = /* @__PURE__ */ ((e) => (e[e.DIRECTORY = 0] = "DIRECTORY", e[e.MENU = 1] = "MENU", e[e.BUTTON = 2] = "BUTTON", e))(Fs || {});
1522
+ const Po = {
1523
+ 1: "启用",
1524
+ 0: "禁用"
1525
+ }, Oo = {
1526
+ 0: "未知",
1527
+ 1: "男",
1528
+ 2: "女"
1529
+ }, No = {
1530
+ 0: "目录",
1531
+ 1: "菜单",
1532
+ 2: "按钮"
1533
+ }, zo = [
1534
+ {
1535
+ label: "启用",
1536
+ value: 1
1537
+ /* ENABLED */
1538
+ },
1539
+ {
1540
+ label: "禁用",
1541
+ value: 0
1542
+ /* DISABLED */
1543
+ }
1544
+ ], Vo = [
1545
+ {
1546
+ label: "未知",
1547
+ value: 0
1548
+ /* UNKNOWN */
1549
+ },
1550
+ {
1551
+ label: "男",
1552
+ value: 1
1553
+ /* MALE */
1554
+ },
1555
+ {
1556
+ label: "女",
1557
+ value: 2
1558
+ /* FEMALE */
1559
+ }
1560
+ ], Bo = [
1561
+ {
1562
+ label: "目录",
1563
+ value: 0
1564
+ /* DIRECTORY */
1565
+ },
1566
+ {
1567
+ label: "菜单",
1568
+ value: 1
1569
+ /* MENU */
1570
+ },
1571
+ {
1572
+ label: "按钮",
1573
+ value: 2
1574
+ /* BUTTON */
1575
+ }
1576
+ ], Fo = {
1577
+ mounted(e, o) {
1578
+ var u;
1579
+ const t = N(), { value: n } = o;
1580
+ if (!n) return;
1581
+ const l = t.permissions;
1582
+ let c = !1;
1583
+ Array.isArray(n) ? c = n.some((r) => l.includes(r) || l.includes("*")) : c = l.includes(n) || l.includes("*"), c || (u = e.parentNode) == null || u.removeChild(e);
1584
+ }
1585
+ };
1586
+ export {
1587
+ fo as $,
1588
+ _o as A,
1589
+ we as B,
1590
+ dt as C,
1591
+ Io as D,
1592
+ ho as E,
1593
+ oo as F,
1594
+ Bs as G,
1595
+ us as H,
1596
+ Eo as I,
1597
+ io as J,
1598
+ Ns as K,
1599
+ Fe as L,
1600
+ Fs as M,
1601
+ Be as N,
1602
+ S as O,
1603
+ uo as P,
1604
+ vt as Q,
1605
+ ze as R,
1606
+ Vs as S,
1607
+ so as T,
1608
+ v as U,
1609
+ se as V,
1610
+ po as W,
1611
+ vo as X,
1612
+ it as Y,
1613
+ Fo as Z,
1614
+ F as _,
1615
+ zo as a,
1616
+ Uo as a0,
1617
+ to as a1,
1618
+ Se as a2,
1619
+ Zs as a3,
1620
+ oe as a4,
1621
+ ct as a5,
1622
+ ut as a6,
1623
+ mt as a7,
1624
+ pt as a8,
1625
+ Oe as a9,
1626
+ To as aa,
1627
+ ko as ab,
1628
+ wo as ac,
1629
+ Ro as ad,
1630
+ Do as ae,
1631
+ no as af,
1632
+ Z as ag,
1633
+ ao as ah,
1634
+ le as ai,
1635
+ ro as aj,
1636
+ re as ak,
1637
+ lo as al,
1638
+ N as am,
1639
+ Bo as b,
1640
+ Ps as c,
1641
+ Vo as d,
1642
+ Oo as e,
1643
+ No as f,
1644
+ Rs as g,
1645
+ wt as h,
1646
+ Ts as i,
1647
+ Po as j,
1648
+ Mo as k,
1649
+ Ve as l,
1650
+ co as m,
1651
+ Co as n,
1652
+ yo as o,
1653
+ mo as p,
1654
+ Ao as q,
1655
+ Gs as r,
1656
+ Lo as s,
1657
+ bo as t,
1658
+ $o as u,
1659
+ Ne as v,
1660
+ So as w,
1661
+ xo as x,
1662
+ eo as y,
1663
+ go as z
1664
+ };