xto-fronted 0.4.17 → 0.4.18

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