xto-fronted 0.4.17 → 0.4.19

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