xto-fronted 0.4.9 → 0.4.10

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