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