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