xto-fronted 0.4.4 → 0.4.5

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