@npm.365xs.cn/vue-admin-framework 0.1.0 → 0.2.0
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/README.md +91 -63
- package/dist/access.d.ts +43 -0
- package/dist/components/AdminFrameworkLayout.vue.d.ts +2 -2
- package/dist/index.d.ts +6 -2
- package/dist/index.js +702 -466
- package/dist/navigation.d.ts +6 -0
- package/dist/oauth.d.ts +4 -1
- package/dist/session.d.ts +32 -0
- package/package.json +37 -37
package/dist/index.js
CHANGED
|
@@ -1,37 +1,85 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useRoute as
|
|
3
|
-
import { UserFilled as
|
|
4
|
-
function
|
|
5
|
-
return e.flatMap((
|
|
6
|
-
...
|
|
7
|
-
...
|
|
1
|
+
import { defineComponent as se, computed as z, resolveComponent as x, openBlock as d, createBlock as T, withCtx as v, createElementBlock as A, Fragment as G, renderList as Q, createVNode as w, resolveDynamicComponent as X, createElementVNode as g, toDisplayString as I, createTextVNode as H, ref as R, onMounted as ge, watch as ie, normalizeClass as ee, unref as N, createCommentVNode as B, withModifiers as Ee, KeepAlive as Te, nextTick as xe } from "vue";
|
|
2
|
+
import { useRoute as ve, useRouter as ye } from "vue-router";
|
|
3
|
+
import { UserFilled as Me, User as Ie, Tickets as Ue, Key as le, DataAnalysis as Le, OfficeBuilding as Ne, Menu as te, Lock as pe, List as Re, Grid as $e, Document as Ve, Connection as ce, Avatar as Oe, Aim as ue, Setting as Fe, ArrowRight as De, ArrowLeft as Be, Bell as ze, SwitchButton as qe, Close as Pe, MoreFilled as He, Refresh as je, Loading as Ke } from "@element-plus/icons-vue";
|
|
4
|
+
function ne(e) {
|
|
5
|
+
return e.flatMap((t) => [
|
|
6
|
+
...t.route ? [t] : [],
|
|
7
|
+
...ne(t.children)
|
|
8
8
|
]);
|
|
9
9
|
}
|
|
10
|
-
function
|
|
11
|
-
for (const
|
|
12
|
-
const
|
|
13
|
-
if (
|
|
14
|
-
const
|
|
15
|
-
if (
|
|
10
|
+
function Je(e, t, r = []) {
|
|
11
|
+
for (const a of e) {
|
|
12
|
+
const n = [...r, a];
|
|
13
|
+
if (a.route === t) return n;
|
|
14
|
+
const i = Je(a.children, t, n);
|
|
15
|
+
if (i.length) return i;
|
|
16
16
|
}
|
|
17
17
|
return [];
|
|
18
18
|
}
|
|
19
|
-
function
|
|
20
|
-
return
|
|
19
|
+
function Wt(e, t) {
|
|
20
|
+
return ne(e).find((r) => r.route === t);
|
|
21
21
|
}
|
|
22
|
-
function
|
|
22
|
+
function ae(e) {
|
|
23
23
|
return `menu:${e.applicationCode}:${e.menuCode}`;
|
|
24
24
|
}
|
|
25
|
-
function
|
|
26
|
-
for (const
|
|
27
|
-
const
|
|
28
|
-
if (
|
|
29
|
-
const
|
|
30
|
-
if (
|
|
25
|
+
function we(e, t, r = []) {
|
|
26
|
+
for (const a of e) {
|
|
27
|
+
const n = [...r, a];
|
|
28
|
+
if (a === t) return n;
|
|
29
|
+
const i = we(a.children, t, n);
|
|
30
|
+
if (i.length) return i;
|
|
31
31
|
}
|
|
32
32
|
return [];
|
|
33
33
|
}
|
|
34
|
-
|
|
34
|
+
function be(e) {
|
|
35
|
+
if (!Array.isArray(e)) throw new Error("当前账号菜单响应格式无效。");
|
|
36
|
+
return e.map(We).sort(Ge);
|
|
37
|
+
}
|
|
38
|
+
function Gt(e, t, r, a) {
|
|
39
|
+
if (a.length === 0) return !1;
|
|
40
|
+
const n = new Set(a);
|
|
41
|
+
return _e(e).some((i) => i.applicationCode === t && (r === null || i.menuCode === r) && i.apiCodes.some((l) => n.has(l)));
|
|
42
|
+
}
|
|
43
|
+
function Qt(e) {
|
|
44
|
+
return (t) => {
|
|
45
|
+
if (t.applicationCode === e) return null;
|
|
46
|
+
if (!t.menuDomain || !t.route) return "";
|
|
47
|
+
try {
|
|
48
|
+
const r = new URL(t.menuDomain);
|
|
49
|
+
if (!["http:", "https:"].includes(r.protocol) || !r.hostname || r.username || r.password || r.pathname !== "/" || r.search || r.hash || r.origin !== t.menuDomain.replace(/\/$/, "") || !t.route.startsWith("/") || t.route.startsWith("//") || /[\\?#]/.test(t.route) || Array.from(t.route).some((n) => {
|
|
50
|
+
const i = n.charCodeAt(0);
|
|
51
|
+
return i < 32 || i === 127;
|
|
52
|
+
})) return "";
|
|
53
|
+
const a = new URL(t.route, r.origin);
|
|
54
|
+
return a.origin === r.origin ? a.href : "";
|
|
55
|
+
} catch {
|
|
56
|
+
return "";
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
function We(e) {
|
|
61
|
+
if (!e || typeof e != "object") throw new Error("当前账号菜单节点格式无效。");
|
|
62
|
+
const t = e;
|
|
63
|
+
if (typeof t.applicationCode != "string" || typeof t.menuCode != "string" || typeof t.name != "string") throw new Error("当前账号菜单节点缺少应用编码、菜单编码或名称。");
|
|
64
|
+
return {
|
|
65
|
+
applicationCode: t.applicationCode,
|
|
66
|
+
menuDomain: typeof t.menuDomain == "string" && t.menuDomain ? t.menuDomain : null,
|
|
67
|
+
menuCode: t.menuCode,
|
|
68
|
+
name: t.name,
|
|
69
|
+
route: typeof t.route == "string" && t.route ? t.route : null,
|
|
70
|
+
icon: typeof t.icon == "string" && t.icon ? t.icon : null,
|
|
71
|
+
sortOrder: typeof t.sortOrder == "number" && Number.isFinite(t.sortOrder) ? t.sortOrder : 0,
|
|
72
|
+
apiCodes: Array.isArray(t.apiCodes) ? t.apiCodes.filter((r) => typeof r == "string") : [],
|
|
73
|
+
children: be(t.children || [])
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
function _e(e) {
|
|
77
|
+
return e.flatMap((t) => [t, ..._e(t.children)]);
|
|
78
|
+
}
|
|
79
|
+
function Ge(e, t) {
|
|
80
|
+
return e.applicationCode.localeCompare(t.applicationCode) || e.sortOrder - t.sortOrder || e.menuCode.localeCompare(t.menuCode);
|
|
81
|
+
}
|
|
82
|
+
const de = /* @__PURE__ */ se({
|
|
35
83
|
name: "FrameworkMenuItem",
|
|
36
84
|
__name: "FrameworkMenuItem",
|
|
37
85
|
props: {
|
|
@@ -39,79 +87,79 @@ const le = /* @__PURE__ */ oe({
|
|
|
39
87
|
resolveExternalMenuHref: { type: Function }
|
|
40
88
|
},
|
|
41
89
|
setup(e) {
|
|
42
|
-
const
|
|
43
|
-
api:
|
|
44
|
-
avatar:
|
|
45
|
-
connection:
|
|
46
|
-
document:
|
|
90
|
+
const t = e, r = {
|
|
91
|
+
api: ce,
|
|
92
|
+
avatar: Oe,
|
|
93
|
+
connection: ce,
|
|
94
|
+
document: Ve,
|
|
47
95
|
grid: $e,
|
|
48
|
-
key:
|
|
49
|
-
list:
|
|
50
|
-
lock:
|
|
51
|
-
menu:
|
|
52
|
-
"office-building":
|
|
53
|
-
overview:
|
|
54
|
-
shield:
|
|
55
|
-
tickets:
|
|
56
|
-
user:
|
|
57
|
-
users:
|
|
58
|
-
},
|
|
59
|
-
const
|
|
60
|
-
return
|
|
61
|
-
}),
|
|
62
|
-
return (
|
|
63
|
-
const
|
|
64
|
-
return e.item.children.length ? (
|
|
96
|
+
key: le,
|
|
97
|
+
list: Re,
|
|
98
|
+
lock: pe,
|
|
99
|
+
menu: te,
|
|
100
|
+
"office-building": Ne,
|
|
101
|
+
overview: Le,
|
|
102
|
+
shield: le,
|
|
103
|
+
tickets: Ue,
|
|
104
|
+
user: Ie,
|
|
105
|
+
users: Me
|
|
106
|
+
}, a = z(() => {
|
|
107
|
+
const l = t.item.icon?.toLowerCase();
|
|
108
|
+
return l ? r[l] || te : te;
|
|
109
|
+
}), n = z(() => ae(t.item)), i = z(() => t.resolveExternalMenuHref?.(t.item) ?? null);
|
|
110
|
+
return (l, c) => {
|
|
111
|
+
const u = x("el-icon"), m = x("FrameworkMenuItem", !0), f = x("el-sub-menu"), k = x("el-menu-item");
|
|
112
|
+
return e.item.children.length ? (d(), T(f, {
|
|
65
113
|
key: 0,
|
|
66
|
-
index:
|
|
114
|
+
index: n.value
|
|
67
115
|
}, {
|
|
68
|
-
title:
|
|
69
|
-
|
|
70
|
-
default:
|
|
71
|
-
(
|
|
116
|
+
title: v(() => [
|
|
117
|
+
w(u, null, {
|
|
118
|
+
default: v(() => [
|
|
119
|
+
(d(), T(X(a.value)))
|
|
72
120
|
]),
|
|
73
121
|
_: 1
|
|
74
122
|
}),
|
|
75
|
-
|
|
123
|
+
g("span", null, I(e.item.name), 1)
|
|
76
124
|
]),
|
|
77
|
-
default:
|
|
78
|
-
(
|
|
125
|
+
default: v(() => [
|
|
126
|
+
(d(!0), A(G, null, Q(e.item.children, (_) => (d(), T(m, {
|
|
79
127
|
key: `${_.applicationCode}:${_.menuCode}`,
|
|
80
128
|
item: _,
|
|
81
129
|
"resolve-external-menu-href": e.resolveExternalMenuHref
|
|
82
130
|
}, null, 8, ["item", "resolve-external-menu-href"]))), 128))
|
|
83
131
|
]),
|
|
84
132
|
_: 1
|
|
85
|
-
}, 8, ["index"])) : e.item.route ? (
|
|
133
|
+
}, 8, ["index"])) : e.item.route ? (d(), T(k, {
|
|
86
134
|
key: 1,
|
|
87
|
-
index:
|
|
88
|
-
disabled:
|
|
89
|
-
title:
|
|
135
|
+
index: n.value,
|
|
136
|
+
disabled: i.value === "",
|
|
137
|
+
title: i.value === "" ? "跨应用菜单缺少有效域名或路径" : i.value || void 0
|
|
90
138
|
}, {
|
|
91
|
-
title:
|
|
92
|
-
|
|
139
|
+
title: v(() => [
|
|
140
|
+
H(I(e.item.name), 1)
|
|
93
141
|
]),
|
|
94
|
-
default:
|
|
95
|
-
|
|
96
|
-
default:
|
|
97
|
-
(
|
|
142
|
+
default: v(() => [
|
|
143
|
+
w(u, null, {
|
|
144
|
+
default: v(() => [
|
|
145
|
+
(d(), T(X(a.value)))
|
|
98
146
|
]),
|
|
99
147
|
_: 1
|
|
100
148
|
})
|
|
101
149
|
]),
|
|
102
150
|
_: 1
|
|
103
|
-
}, 8, ["index", "disabled", "title"])) : (
|
|
151
|
+
}, 8, ["index", "disabled", "title"])) : (d(), T(k, {
|
|
104
152
|
key: 2,
|
|
105
|
-
index:
|
|
153
|
+
index: n.value,
|
|
106
154
|
disabled: ""
|
|
107
155
|
}, {
|
|
108
|
-
title:
|
|
109
|
-
|
|
156
|
+
title: v(() => [
|
|
157
|
+
H(I(e.item.name), 1)
|
|
110
158
|
]),
|
|
111
|
-
default:
|
|
112
|
-
|
|
113
|
-
default:
|
|
114
|
-
(
|
|
159
|
+
default: v(() => [
|
|
160
|
+
w(u, null, {
|
|
161
|
+
default: v(() => [
|
|
162
|
+
(d(), T(X(a.value)))
|
|
115
163
|
]),
|
|
116
164
|
_: 1
|
|
117
165
|
})
|
|
@@ -121,50 +169,50 @@ const le = /* @__PURE__ */ oe({
|
|
|
121
169
|
};
|
|
122
170
|
}
|
|
123
171
|
});
|
|
124
|
-
function
|
|
172
|
+
function re(e) {
|
|
125
173
|
if (!Array.isArray(e)) return [];
|
|
126
|
-
const
|
|
174
|
+
const t = /* @__PURE__ */ new Set();
|
|
127
175
|
return e.flatMap((r) => {
|
|
128
176
|
if (!r || typeof r != "object") return [];
|
|
129
|
-
const
|
|
130
|
-
return !
|
|
177
|
+
const a = "path" in r && typeof r.path == "string" ? r.path : "", n = "title" in r && typeof r.title == "string" ? r.title : "";
|
|
178
|
+
return !Ze(a) || !n.trim() || t.has(a) ? [] : (t.add(a), [{ path: a, title: n.trim() }]);
|
|
131
179
|
});
|
|
132
180
|
}
|
|
133
|
-
function
|
|
134
|
-
const
|
|
135
|
-
for (;
|
|
136
|
-
const
|
|
137
|
-
if (
|
|
138
|
-
|
|
139
|
-
}
|
|
140
|
-
return
|
|
141
|
-
}
|
|
142
|
-
function
|
|
143
|
-
const
|
|
144
|
-
if (
|
|
145
|
-
return { tabs:
|
|
146
|
-
const
|
|
147
|
-
if (
|
|
148
|
-
const
|
|
149
|
-
return { tabs:
|
|
150
|
-
}
|
|
151
|
-
function
|
|
152
|
-
const r =
|
|
181
|
+
function Qe(e, t, r) {
|
|
182
|
+
const a = re(e), n = a.findIndex((c) => c.path === t.path), i = n >= 0 ? a.map((c, u) => u === n ? t : c) : [...a, t], l = Math.max(1, r);
|
|
183
|
+
for (; i.length > l; ) {
|
|
184
|
+
const c = i.findIndex((u) => u.path !== t.path);
|
|
185
|
+
if (c < 0) break;
|
|
186
|
+
i.splice(c, 1);
|
|
187
|
+
}
|
|
188
|
+
return i;
|
|
189
|
+
}
|
|
190
|
+
function Xe(e, t, r) {
|
|
191
|
+
const a = re(e), n = a.findIndex((c) => c.path === t);
|
|
192
|
+
if (n < 0 || a.length <= 1)
|
|
193
|
+
return { tabs: a, navigateTo: null };
|
|
194
|
+
const i = a.filter((c) => c.path !== t);
|
|
195
|
+
if (t !== r) return { tabs: i, navigateTo: null };
|
|
196
|
+
const l = i[Math.min(n, i.length - 1)];
|
|
197
|
+
return { tabs: i, navigateTo: l?.path || null };
|
|
198
|
+
}
|
|
199
|
+
function Ye(e, t) {
|
|
200
|
+
const r = re(e).find((a) => a.path === t);
|
|
153
201
|
return r ? [r] : [];
|
|
154
202
|
}
|
|
155
|
-
function
|
|
203
|
+
function Ze(e) {
|
|
156
204
|
return e.startsWith("/") && !e.startsWith("//");
|
|
157
205
|
}
|
|
158
|
-
const
|
|
206
|
+
const et = { class: "saf-sidebar saf-desktop-sidebar" }, tt = { class: "saf-brand-mark" }, nt = { key: 0 }, rt = { key: 0 }, ot = { class: "saf-sidebar-nav" }, at = { key: 0 }, st = ["title"], it = { key: 2 }, lt = { class: "saf-sidebar-footer" }, ct = { key: 0 }, ut = ["title"], dt = { key: 0 }, ft = { class: "saf-main-shell" }, mt = { class: "saf-topbar" }, ht = { class: "saf-topbar-context" }, gt = { class: "saf-topbar-actions" }, vt = {
|
|
159
207
|
key: 1,
|
|
160
208
|
class: "saf-topbar-divider"
|
|
161
|
-
},
|
|
209
|
+
}, yt = { class: "saf-operator" }, pt = { class: "saf-page-tabs" }, wt = { class: "saf-page-tabs__scroller" }, bt = ["onClick"], _t = { class: "saf-content-frame" }, kt = { class: "saf-workspace" }, Ct = {
|
|
162
210
|
key: 0,
|
|
163
211
|
class: "saf-route-breadcrumbs"
|
|
164
|
-
},
|
|
212
|
+
}, At = { class: "saf-sidebar saf-mobile-sidebar" }, St = { class: "saf-brand" }, Et = { class: "saf-brand-mark" }, Tt = { key: 0 }, xt = { class: "saf-sidebar-nav" }, Mt = {
|
|
165
213
|
key: 1,
|
|
166
214
|
class: "saf-nav-feedback"
|
|
167
|
-
},
|
|
215
|
+
}, It = /* @__PURE__ */ se({
|
|
168
216
|
__name: "AdminFrameworkLayout",
|
|
169
217
|
props: {
|
|
170
218
|
brandName: {},
|
|
@@ -183,35 +231,35 @@ const We = { class: "saf-sidebar saf-desktop-sidebar" }, Ge = { class: "saf-bran
|
|
|
183
231
|
showNotifications: { type: Boolean, default: !0 }
|
|
184
232
|
},
|
|
185
233
|
emits: ["logout", "settings", "notifications"],
|
|
186
|
-
setup(e, { emit:
|
|
187
|
-
const r = e,
|
|
188
|
-
|
|
189
|
-
)), _ =
|
|
190
|
-
(
|
|
191
|
-
)),
|
|
192
|
-
() => _.value ?
|
|
193
|
-
),
|
|
194
|
-
() => _.value?.name || String(
|
|
195
|
-
), F =
|
|
196
|
-
() => `${
|
|
234
|
+
setup(e, { emit: t }) {
|
|
235
|
+
const r = e, a = t, n = ve(), i = ye(), l = R(!1), c = R(!1), u = R([]), m = R({}), f = R(!0), k = z(() => new Map(
|
|
236
|
+
ne(r.menus).map((o) => [ae(o), o])
|
|
237
|
+
)), _ = z(() => ne(r.menus).find(
|
|
238
|
+
(o) => o.route === n.path && (r.resolveExternalMenuHref?.(o) ?? null) === null
|
|
239
|
+
)), C = z(() => _.value ? ae(_.value) : ""), S = z(
|
|
240
|
+
() => _.value ? we(r.menus, _.value) : []
|
|
241
|
+
), $ = z(
|
|
242
|
+
() => _.value?.name || String(n.meta.title || r.consoleName)
|
|
243
|
+
), F = z(
|
|
244
|
+
() => `${n.path}:${m.value[n.path] || 0}`
|
|
197
245
|
);
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
}),
|
|
201
|
-
() => [
|
|
246
|
+
ge(() => {
|
|
247
|
+
u.value = D(), y();
|
|
248
|
+
}), ie(
|
|
249
|
+
() => [n.path, n.meta.title, r.menus],
|
|
202
250
|
y,
|
|
203
251
|
{ deep: !0 }
|
|
204
|
-
),
|
|
205
|
-
|
|
206
|
-
(
|
|
207
|
-
typeof window < "u" && window.sessionStorage.setItem(r.tabStorageKey, JSON.stringify(
|
|
252
|
+
), ie(
|
|
253
|
+
u,
|
|
254
|
+
(o) => {
|
|
255
|
+
typeof window < "u" && window.sessionStorage.setItem(r.tabStorageKey, JSON.stringify(o));
|
|
208
256
|
},
|
|
209
257
|
{ deep: !0 }
|
|
210
258
|
);
|
|
211
|
-
function
|
|
259
|
+
function D() {
|
|
212
260
|
if (typeof window > "u") return [];
|
|
213
261
|
try {
|
|
214
|
-
return
|
|
262
|
+
return re(
|
|
215
263
|
JSON.parse(window.sessionStorage.getItem(r.tabStorageKey) || "[]")
|
|
216
264
|
);
|
|
217
265
|
} catch {
|
|
@@ -219,226 +267,226 @@ const We = { class: "saf-sidebar saf-desktop-sidebar" }, Ge = { class: "saf-bran
|
|
|
219
267
|
}
|
|
220
268
|
}
|
|
221
269
|
function y() {
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
{ path:
|
|
270
|
+
n.name !== "oauth-callback" && (u.value = Qe(
|
|
271
|
+
u.value,
|
|
272
|
+
{ path: n.path, title: $.value },
|
|
225
273
|
r.maxTabs
|
|
226
274
|
));
|
|
227
275
|
}
|
|
228
|
-
async function U(
|
|
229
|
-
const
|
|
230
|
-
if (!
|
|
231
|
-
const
|
|
232
|
-
if (
|
|
233
|
-
|
|
276
|
+
async function U(o) {
|
|
277
|
+
const s = k.value.get(o);
|
|
278
|
+
if (!s?.route) return;
|
|
279
|
+
const h = r.resolveExternalMenuHref?.(s) ?? null;
|
|
280
|
+
if (h !== null) {
|
|
281
|
+
h && window.location.assign(h), c.value = !1;
|
|
234
282
|
return;
|
|
235
283
|
}
|
|
236
|
-
await
|
|
284
|
+
await V(s.route);
|
|
237
285
|
}
|
|
238
|
-
async function
|
|
239
|
-
|
|
286
|
+
async function V(o) {
|
|
287
|
+
o !== n.path && await i.push(o), c.value = !1;
|
|
240
288
|
}
|
|
241
|
-
async function
|
|
242
|
-
const
|
|
243
|
-
|
|
289
|
+
async function M(o) {
|
|
290
|
+
const s = Xe(u.value, o, n.path);
|
|
291
|
+
u.value = s.tabs, s.navigateTo && await i.push(s.navigateTo);
|
|
244
292
|
}
|
|
245
|
-
function
|
|
246
|
-
|
|
293
|
+
function O() {
|
|
294
|
+
u.value = Ye(u.value, n.path);
|
|
247
295
|
}
|
|
248
|
-
function
|
|
249
|
-
|
|
296
|
+
function p() {
|
|
297
|
+
O();
|
|
250
298
|
}
|
|
251
|
-
async function
|
|
252
|
-
|
|
253
|
-
...
|
|
254
|
-
[
|
|
255
|
-
}, await
|
|
299
|
+
async function q() {
|
|
300
|
+
f.value = !1, m.value = {
|
|
301
|
+
...m.value,
|
|
302
|
+
[n.path]: (m.value[n.path] || 0) + 1
|
|
303
|
+
}, await xe(), f.value = !0;
|
|
256
304
|
}
|
|
257
|
-
function
|
|
258
|
-
|
|
305
|
+
function W() {
|
|
306
|
+
u.value = [], typeof window < "u" && window.sessionStorage.removeItem(r.tabStorageKey), a("logout");
|
|
259
307
|
}
|
|
260
|
-
return (
|
|
261
|
-
const
|
|
262
|
-
return
|
|
263
|
-
class:
|
|
308
|
+
return (o, s) => {
|
|
309
|
+
const h = x("el-icon"), E = x("el-menu"), L = x("el-button"), K = x("el-avatar"), J = x("el-dropdown-item"), oe = x("el-dropdown-menu"), Y = x("el-dropdown"), Z = x("RouterView"), Ae = x("el-drawer");
|
|
310
|
+
return d(), A("div", {
|
|
311
|
+
class: ee(["saf-shell", { "saf-shell--collapsed": l.value }])
|
|
264
312
|
}, [
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
class:
|
|
313
|
+
g("aside", et, [
|
|
314
|
+
g("div", {
|
|
315
|
+
class: ee(["saf-brand", { "saf-brand--compact": l.value }])
|
|
268
316
|
}, [
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
default:
|
|
272
|
-
|
|
317
|
+
g("span", tt, [
|
|
318
|
+
w(h, null, {
|
|
319
|
+
default: v(() => [
|
|
320
|
+
w(N(ue))
|
|
273
321
|
]),
|
|
274
322
|
_: 1
|
|
275
323
|
})
|
|
276
324
|
]),
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
e.brandSubtitle ? (
|
|
325
|
+
l.value ? B("", !0) : (d(), A("div", nt, [
|
|
326
|
+
g("strong", null, I(e.brandName), 1),
|
|
327
|
+
e.brandSubtitle ? (d(), A("small", rt, I(e.brandSubtitle), 1)) : B("", !0)
|
|
280
328
|
]))
|
|
281
329
|
], 2),
|
|
282
|
-
|
|
283
|
-
e.menus.length ? (
|
|
330
|
+
g("nav", ot, [
|
|
331
|
+
e.menus.length ? (d(), T(E, {
|
|
284
332
|
key: 0,
|
|
285
|
-
"default-active":
|
|
286
|
-
collapse:
|
|
333
|
+
"default-active": C.value,
|
|
334
|
+
collapse: l.value,
|
|
287
335
|
"collapse-transition": !1,
|
|
288
336
|
onSelect: U
|
|
289
337
|
}, {
|
|
290
|
-
default:
|
|
291
|
-
(
|
|
292
|
-
key: `${
|
|
293
|
-
item:
|
|
338
|
+
default: v(() => [
|
|
339
|
+
(d(!0), A(G, null, Q(e.menus, (b) => (d(), T(de, {
|
|
340
|
+
key: `${b.applicationCode}:${b.menuCode}`,
|
|
341
|
+
item: b,
|
|
294
342
|
"resolve-external-menu-href": e.resolveExternalMenuHref
|
|
295
343
|
}, null, 8, ["item", "resolve-external-menu-href"]))), 128))
|
|
296
344
|
]),
|
|
297
345
|
_: 1
|
|
298
|
-
}, 8, ["default-active", "collapse"])) : (
|
|
346
|
+
}, 8, ["default-active", "collapse"])) : (d(), A("div", {
|
|
299
347
|
key: 1,
|
|
300
|
-
class:
|
|
348
|
+
class: ee(["saf-nav-feedback", { "saf-nav-feedback--compact": l.value }])
|
|
301
349
|
}, [
|
|
302
|
-
e.navigationLoaded ? e.navigationError ? (
|
|
350
|
+
e.navigationLoaded ? e.navigationError ? (d(), A("span", {
|
|
303
351
|
key: 1,
|
|
304
352
|
title: e.navigationError
|
|
305
|
-
}, "菜单加载失败", 8,
|
|
353
|
+
}, "菜单加载失败", 8, st)) : (d(), A("span", it, "当前账号暂无菜单")) : (d(), A("span", at, "正在加载菜单..."))
|
|
306
354
|
], 2))
|
|
307
355
|
]),
|
|
308
|
-
|
|
309
|
-
e.showSettings ? (
|
|
356
|
+
g("div", lt, [
|
|
357
|
+
e.showSettings ? (d(), A("button", {
|
|
310
358
|
key: 0,
|
|
311
359
|
type: "button",
|
|
312
360
|
title: "系统设置",
|
|
313
|
-
onClick:
|
|
361
|
+
onClick: s[0] || (s[0] = (b) => a("settings"))
|
|
314
362
|
}, [
|
|
315
|
-
|
|
316
|
-
default:
|
|
317
|
-
|
|
363
|
+
w(h, null, {
|
|
364
|
+
default: v(() => [
|
|
365
|
+
w(N(Fe))
|
|
318
366
|
]),
|
|
319
367
|
_: 1
|
|
320
368
|
}),
|
|
321
|
-
|
|
322
|
-
])) :
|
|
323
|
-
|
|
369
|
+
l.value ? B("", !0) : (d(), A("span", ct, "系统设置"))
|
|
370
|
+
])) : B("", !0),
|
|
371
|
+
g("button", {
|
|
324
372
|
type: "button",
|
|
325
|
-
title:
|
|
326
|
-
onClick:
|
|
373
|
+
title: l.value ? "展开侧栏" : "收起侧栏",
|
|
374
|
+
onClick: s[1] || (s[1] = (b) => l.value = !l.value)
|
|
327
375
|
}, [
|
|
328
|
-
|
|
329
|
-
default:
|
|
330
|
-
(
|
|
376
|
+
w(h, null, {
|
|
377
|
+
default: v(() => [
|
|
378
|
+
(d(), T(X(l.value ? N(De) : N(Be))))
|
|
331
379
|
]),
|
|
332
380
|
_: 1
|
|
333
381
|
}),
|
|
334
|
-
|
|
335
|
-
], 8,
|
|
382
|
+
l.value ? B("", !0) : (d(), A("span", dt, "收起侧栏"))
|
|
383
|
+
], 8, ut)
|
|
336
384
|
])
|
|
337
385
|
]),
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
386
|
+
g("div", ft, [
|
|
387
|
+
g("header", mt, [
|
|
388
|
+
w(L, {
|
|
341
389
|
class: "saf-mobile-menu-button",
|
|
342
390
|
text: "",
|
|
343
391
|
circle: "",
|
|
344
|
-
icon:
|
|
392
|
+
icon: N(te),
|
|
345
393
|
"aria-label": "打开导航",
|
|
346
|
-
onClick:
|
|
394
|
+
onClick: s[2] || (s[2] = (b) => c.value = !0)
|
|
347
395
|
}, null, 8, ["icon"]),
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
default:
|
|
352
|
-
|
|
396
|
+
g("div", ht, [
|
|
397
|
+
g("span", null, [
|
|
398
|
+
w(h, null, {
|
|
399
|
+
default: v(() => [
|
|
400
|
+
w(N(pe))
|
|
353
401
|
]),
|
|
354
402
|
_: 1
|
|
355
403
|
}),
|
|
356
|
-
|
|
404
|
+
H(I(e.consoleName), 1)
|
|
357
405
|
]),
|
|
358
|
-
|
|
359
|
-
|
|
406
|
+
s[5] || (s[5] = g("i", null, null, -1)),
|
|
407
|
+
g("strong", null, I($.value), 1)
|
|
360
408
|
]),
|
|
361
|
-
|
|
362
|
-
e.showNotifications ? (
|
|
409
|
+
g("div", gt, [
|
|
410
|
+
e.showNotifications ? (d(), T(L, {
|
|
363
411
|
key: 0,
|
|
364
412
|
text: "",
|
|
365
413
|
circle: "",
|
|
366
|
-
icon:
|
|
414
|
+
icon: N(ze),
|
|
367
415
|
"aria-label": "通知",
|
|
368
|
-
onClick:
|
|
369
|
-
}, null, 8, ["icon"])) :
|
|
370
|
-
e.showNotifications ? (
|
|
371
|
-
|
|
372
|
-
default:
|
|
373
|
-
|
|
416
|
+
onClick: s[3] || (s[3] = (b) => a("notifications"))
|
|
417
|
+
}, null, 8, ["icon"])) : B("", !0),
|
|
418
|
+
e.showNotifications ? (d(), A("i", vt)) : B("", !0),
|
|
419
|
+
w(K, { size: 30 }, {
|
|
420
|
+
default: v(() => [
|
|
421
|
+
H(I(e.initials), 1)
|
|
374
422
|
]),
|
|
375
423
|
_: 1
|
|
376
424
|
}),
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
425
|
+
g("div", yt, [
|
|
426
|
+
g("strong", null, I(e.username), 1),
|
|
427
|
+
g("span", null, I(e.loginAccount), 1)
|
|
380
428
|
]),
|
|
381
|
-
|
|
429
|
+
w(L, {
|
|
382
430
|
text: "",
|
|
383
431
|
circle: "",
|
|
384
|
-
icon:
|
|
432
|
+
icon: N(qe),
|
|
385
433
|
"aria-label": "退出登录",
|
|
386
434
|
title: "退出登录",
|
|
387
|
-
onClick:
|
|
435
|
+
onClick: W
|
|
388
436
|
}, null, 8, ["icon"])
|
|
389
437
|
])
|
|
390
438
|
]),
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
(
|
|
394
|
-
key:
|
|
439
|
+
g("div", pt, [
|
|
440
|
+
g("div", wt, [
|
|
441
|
+
(d(!0), A(G, null, Q(u.value, (b) => (d(), A("button", {
|
|
442
|
+
key: b.path,
|
|
395
443
|
type: "button",
|
|
396
|
-
class:
|
|
397
|
-
onClick: (
|
|
444
|
+
class: ee(["saf-page-tab", { "saf-page-tab--active": N(n).path === b.path }]),
|
|
445
|
+
onClick: (Se) => V(b.path)
|
|
398
446
|
}, [
|
|
399
|
-
|
|
400
|
-
|
|
447
|
+
g("span", null, I(b.title), 1),
|
|
448
|
+
u.value.length > 1 ? (d(), T(h, {
|
|
401
449
|
key: 0,
|
|
402
450
|
class: "saf-page-tab__close",
|
|
403
451
|
title: "关闭",
|
|
404
|
-
onClick:
|
|
452
|
+
onClick: Ee((Se) => M(b.path), ["stop"])
|
|
405
453
|
}, {
|
|
406
|
-
default:
|
|
407
|
-
|
|
454
|
+
default: v(() => [
|
|
455
|
+
w(N(Pe))
|
|
408
456
|
]),
|
|
409
457
|
_: 1
|
|
410
|
-
}, 8, ["onClick"])) :
|
|
411
|
-
], 10,
|
|
458
|
+
}, 8, ["onClick"])) : B("", !0)
|
|
459
|
+
], 10, bt))), 128))
|
|
412
460
|
]),
|
|
413
|
-
|
|
414
|
-
dropdown:
|
|
415
|
-
|
|
416
|
-
default:
|
|
417
|
-
|
|
418
|
-
icon:
|
|
419
|
-
onClick:
|
|
461
|
+
w(Y, { trigger: "click" }, {
|
|
462
|
+
dropdown: v(() => [
|
|
463
|
+
w(oe, null, {
|
|
464
|
+
default: v(() => [
|
|
465
|
+
w(J, {
|
|
466
|
+
icon: N(je),
|
|
467
|
+
onClick: q
|
|
420
468
|
}, {
|
|
421
|
-
default:
|
|
422
|
-
|
|
469
|
+
default: v(() => [...s[6] || (s[6] = [
|
|
470
|
+
H(" 刷新当前 ", -1)
|
|
423
471
|
])]),
|
|
424
472
|
_: 1
|
|
425
473
|
}, 8, ["icon"]),
|
|
426
|
-
|
|
427
|
-
disabled:
|
|
428
|
-
onClick:
|
|
474
|
+
w(J, {
|
|
475
|
+
disabled: u.value.length <= 1,
|
|
476
|
+
onClick: O
|
|
429
477
|
}, {
|
|
430
|
-
default:
|
|
431
|
-
|
|
478
|
+
default: v(() => [...s[7] || (s[7] = [
|
|
479
|
+
H(" 关闭其他 ", -1)
|
|
432
480
|
])]),
|
|
433
481
|
_: 1
|
|
434
482
|
}, 8, ["disabled"]),
|
|
435
|
-
|
|
436
|
-
disabled:
|
|
483
|
+
w(J, {
|
|
484
|
+
disabled: u.value.length <= 1,
|
|
437
485
|
divided: "",
|
|
438
|
-
onClick:
|
|
486
|
+
onClick: p
|
|
439
487
|
}, {
|
|
440
|
-
default:
|
|
441
|
-
|
|
488
|
+
default: v(() => [...s[8] || (s[8] = [
|
|
489
|
+
H(" 关闭全部 ", -1)
|
|
442
490
|
])]),
|
|
443
491
|
_: 1
|
|
444
492
|
}, 8, ["disabled"])
|
|
@@ -446,28 +494,28 @@ const We = { class: "saf-sidebar saf-desktop-sidebar" }, Ge = { class: "saf-bran
|
|
|
446
494
|
_: 1
|
|
447
495
|
})
|
|
448
496
|
]),
|
|
449
|
-
default:
|
|
450
|
-
|
|
497
|
+
default: v(() => [
|
|
498
|
+
w(L, {
|
|
451
499
|
class: "saf-tab-menu-button",
|
|
452
500
|
text: "",
|
|
453
|
-
icon:
|
|
501
|
+
icon: N(He),
|
|
454
502
|
"aria-label": "页签操作"
|
|
455
503
|
}, null, 8, ["icon"])
|
|
456
504
|
]),
|
|
457
505
|
_: 1
|
|
458
506
|
})
|
|
459
507
|
]),
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
(
|
|
464
|
-
key: `${
|
|
465
|
-
},
|
|
466
|
-
])) :
|
|
467
|
-
|
|
468
|
-
default:
|
|
469
|
-
(
|
|
470
|
-
|
|
508
|
+
g("div", _t, [
|
|
509
|
+
g("main", kt, [
|
|
510
|
+
S.value.length > 1 ? (d(), A("div", Ct, [
|
|
511
|
+
(d(!0), A(G, null, Q(S.value, (b) => (d(), A("span", {
|
|
512
|
+
key: `${b.applicationCode}:${b.menuCode}`
|
|
513
|
+
}, I(b.name), 1))), 128))
|
|
514
|
+
])) : B("", !0),
|
|
515
|
+
w(Z, null, {
|
|
516
|
+
default: v(({ Component: b }) => [
|
|
517
|
+
(d(), T(Te, { max: e.maxTabs }, [
|
|
518
|
+
f.value ? (d(), T(X(b), { key: F.value })) : B("", !0)
|
|
471
519
|
], 1032, ["max"]))
|
|
472
520
|
]),
|
|
473
521
|
_: 1
|
|
@@ -475,45 +523,45 @@ const We = { class: "saf-sidebar saf-desktop-sidebar" }, Ge = { class: "saf-bran
|
|
|
475
523
|
])
|
|
476
524
|
])
|
|
477
525
|
]),
|
|
478
|
-
|
|
479
|
-
modelValue:
|
|
480
|
-
"onUpdate:modelValue":
|
|
526
|
+
w(Ae, {
|
|
527
|
+
modelValue: c.value,
|
|
528
|
+
"onUpdate:modelValue": s[4] || (s[4] = (b) => c.value = b),
|
|
481
529
|
direction: "ltr",
|
|
482
530
|
size: "248px",
|
|
483
531
|
"with-header": !1,
|
|
484
532
|
class: "saf-mobile-nav-drawer"
|
|
485
533
|
}, {
|
|
486
|
-
default:
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
default:
|
|
492
|
-
|
|
534
|
+
default: v(() => [
|
|
535
|
+
g("aside", At, [
|
|
536
|
+
g("div", St, [
|
|
537
|
+
g("span", Et, [
|
|
538
|
+
w(h, null, {
|
|
539
|
+
default: v(() => [
|
|
540
|
+
w(N(ue))
|
|
493
541
|
]),
|
|
494
542
|
_: 1
|
|
495
543
|
})
|
|
496
544
|
]),
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
e.brandSubtitle ? (
|
|
545
|
+
g("div", null, [
|
|
546
|
+
g("strong", null, I(e.brandName), 1),
|
|
547
|
+
e.brandSubtitle ? (d(), A("small", Tt, I(e.brandSubtitle), 1)) : B("", !0)
|
|
500
548
|
])
|
|
501
549
|
]),
|
|
502
|
-
|
|
503
|
-
e.menus.length ? (
|
|
550
|
+
g("nav", xt, [
|
|
551
|
+
e.menus.length ? (d(), T(E, {
|
|
504
552
|
key: 0,
|
|
505
|
-
"default-active":
|
|
553
|
+
"default-active": C.value,
|
|
506
554
|
onSelect: U
|
|
507
555
|
}, {
|
|
508
|
-
default:
|
|
509
|
-
(
|
|
510
|
-
key: `${
|
|
511
|
-
item:
|
|
556
|
+
default: v(() => [
|
|
557
|
+
(d(!0), A(G, null, Q(e.menus, (b) => (d(), T(de, {
|
|
558
|
+
key: `${b.applicationCode}:${b.menuCode}`,
|
|
559
|
+
item: b,
|
|
512
560
|
"resolve-external-menu-href": e.resolveExternalMenuHref
|
|
513
561
|
}, null, 8, ["item", "resolve-external-menu-href"]))), 128))
|
|
514
562
|
]),
|
|
515
563
|
_: 1
|
|
516
|
-
}, 8, ["default-active"])) : (
|
|
564
|
+
}, 8, ["default-active"])) : (d(), A("div", Mt, I(e.navigationError || "当前账号暂无菜单"), 1))
|
|
517
565
|
])
|
|
518
566
|
])
|
|
519
567
|
]),
|
|
@@ -522,81 +570,176 @@ const We = { class: "saf-sidebar saf-desktop-sidebar" }, Ge = { class: "saf-bran
|
|
|
522
570
|
], 2);
|
|
523
571
|
};
|
|
524
572
|
}
|
|
525
|
-
}),
|
|
573
|
+
}), ke = (e, t) => {
|
|
526
574
|
const r = e.__vccOpts || e;
|
|
527
|
-
for (const [
|
|
528
|
-
r[
|
|
575
|
+
for (const [a, n] of t)
|
|
576
|
+
r[a] = n;
|
|
529
577
|
return r;
|
|
530
|
-
},
|
|
578
|
+
}, Xt = /* @__PURE__ */ ke(It, [["__scopeId", "data-v-6ef4786f"]]), Ut = { class: "saf-oauth-callback" }, Lt = {
|
|
531
579
|
key: 1,
|
|
532
580
|
class: "saf-oauth-loading"
|
|
533
|
-
},
|
|
581
|
+
}, Nt = /* @__PURE__ */ se({
|
|
534
582
|
__name: "OAuthCallbackView",
|
|
535
583
|
props: {
|
|
536
584
|
client: {},
|
|
537
585
|
retryPath: { default: "/" }
|
|
538
586
|
},
|
|
539
587
|
emits: ["completed"],
|
|
540
|
-
setup(e, { emit:
|
|
541
|
-
const r = e,
|
|
542
|
-
|
|
543
|
-
async function
|
|
544
|
-
const
|
|
588
|
+
setup(e, { emit: t }) {
|
|
589
|
+
const r = e, a = t, n = ve(), i = ye(), l = R(""), c = R(!1);
|
|
590
|
+
ge(u);
|
|
591
|
+
async function u() {
|
|
592
|
+
const f = typeof n.query.code == "string" ? n.query.code : "", k = typeof n.query.state == "string" ? n.query.state : "", _ = typeof n.query.error_description == "string" ? n.query.error_description : typeof n.query.error == "string" ? n.query.error : "";
|
|
545
593
|
try {
|
|
546
594
|
if (_) throw new Error(_);
|
|
547
|
-
if (!
|
|
548
|
-
const
|
|
549
|
-
|
|
550
|
-
} catch (
|
|
551
|
-
|
|
595
|
+
if (!f || !k) throw new Error("登录回调缺少 code 或 state。");
|
|
596
|
+
const C = await r.client.completeLogin(f, k);
|
|
597
|
+
a("completed", C), await i.replace(C);
|
|
598
|
+
} catch (C) {
|
|
599
|
+
l.value = C instanceof Error ? C.message : "登录失败。";
|
|
552
600
|
}
|
|
553
601
|
}
|
|
554
|
-
async function
|
|
555
|
-
|
|
602
|
+
async function m() {
|
|
603
|
+
c.value = !0;
|
|
556
604
|
try {
|
|
557
605
|
await r.client.beginLogin(r.retryPath);
|
|
558
|
-
} catch (
|
|
559
|
-
|
|
606
|
+
} catch (f) {
|
|
607
|
+
l.value = f instanceof Error ? f.message : "重新登录失败。", c.value = !1;
|
|
560
608
|
}
|
|
561
609
|
}
|
|
562
|
-
return (
|
|
563
|
-
const _ =
|
|
564
|
-
return
|
|
565
|
-
|
|
610
|
+
return (f, k) => {
|
|
611
|
+
const _ = x("el-button"), C = x("el-result"), S = x("el-icon");
|
|
612
|
+
return d(), A("main", Ut, [
|
|
613
|
+
l.value ? (d(), T(C, {
|
|
566
614
|
key: 0,
|
|
567
615
|
icon: "error",
|
|
568
616
|
title: "登录失败",
|
|
569
|
-
"sub-title":
|
|
617
|
+
"sub-title": l.value
|
|
570
618
|
}, {
|
|
571
|
-
extra:
|
|
572
|
-
|
|
619
|
+
extra: v(() => [
|
|
620
|
+
w(_, {
|
|
573
621
|
type: "primary",
|
|
574
|
-
loading:
|
|
575
|
-
onClick:
|
|
622
|
+
loading: c.value,
|
|
623
|
+
onClick: m
|
|
576
624
|
}, {
|
|
577
|
-
default:
|
|
578
|
-
|
|
625
|
+
default: v(() => [...k[0] || (k[0] = [
|
|
626
|
+
H(" 重新登录 ", -1)
|
|
579
627
|
])]),
|
|
580
628
|
_: 1
|
|
581
629
|
}, 8, ["loading"])
|
|
582
630
|
]),
|
|
583
631
|
_: 1
|
|
584
|
-
}, 8, ["sub-title"])) : (
|
|
585
|
-
|
|
632
|
+
}, 8, ["sub-title"])) : (d(), A("div", Lt, [
|
|
633
|
+
w(S, {
|
|
586
634
|
class: "is-loading",
|
|
587
635
|
size: 28
|
|
588
636
|
}, {
|
|
589
|
-
default:
|
|
590
|
-
|
|
637
|
+
default: v(() => [
|
|
638
|
+
w(N(Ke))
|
|
591
639
|
]),
|
|
592
640
|
_: 1
|
|
593
641
|
}),
|
|
594
|
-
k[1] || (k[1] =
|
|
642
|
+
k[1] || (k[1] = g("span", null, "正在完成登录...", -1))
|
|
595
643
|
]))
|
|
596
644
|
]);
|
|
597
645
|
};
|
|
598
646
|
}
|
|
599
|
-
}),
|
|
647
|
+
}), Yt = /* @__PURE__ */ ke(Nt, [["__scopeId", "data-v-ef3407f8"]]);
|
|
648
|
+
class j extends Error {
|
|
649
|
+
status;
|
|
650
|
+
code;
|
|
651
|
+
requestId;
|
|
652
|
+
constructor(t, r, a = "ACCESS_REQUEST_FAILED", n = "") {
|
|
653
|
+
super(t), this.name = "AdminAccessError", this.status = r, this.code = a, this.requestId = n;
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
function Rt(e) {
|
|
657
|
+
const t = e.baseUrl.trim().replace(/\/$/, "");
|
|
658
|
+
async function r() {
|
|
659
|
+
return $t(await n("/api/current/me"));
|
|
660
|
+
}
|
|
661
|
+
async function a() {
|
|
662
|
+
const l = await n("/api/me/menus");
|
|
663
|
+
if (!l || typeof l != "object")
|
|
664
|
+
throw new j("当前账号菜单响应格式无效。", 502, "INVALID_MENU_RESPONSE");
|
|
665
|
+
const c = l;
|
|
666
|
+
if (c.applicationCode !== null)
|
|
667
|
+
throw new j("当前账号菜单响应不是全应用菜单。", 502, "INVALID_MENU_SCOPE");
|
|
668
|
+
return be(c.menus);
|
|
669
|
+
}
|
|
670
|
+
async function n(l, c = !0) {
|
|
671
|
+
if (!t)
|
|
672
|
+
throw new j(
|
|
673
|
+
"缺少 VITE_ACCESS_API_BASE_URL,无法读取当前用户和菜单。",
|
|
674
|
+
0,
|
|
675
|
+
"ACCESS_API_NOT_CONFIGURED"
|
|
676
|
+
);
|
|
677
|
+
const u = await e.oauthClient.getValidAccessToken();
|
|
678
|
+
if (!u)
|
|
679
|
+
throw new j("登录状态已失效,请重新登录。", 401, "UNAUTHENTICATED");
|
|
680
|
+
const m = await i()(new URL(`${t}${Vt(l)}`), {
|
|
681
|
+
method: "GET",
|
|
682
|
+
headers: {
|
|
683
|
+
Accept: "application/json",
|
|
684
|
+
Authorization: `Bearer ${u}`
|
|
685
|
+
}
|
|
686
|
+
});
|
|
687
|
+
if (m.status === 401 && c) {
|
|
688
|
+
if (await e.oauthClient.refreshAccessToken()) return n(l, !1);
|
|
689
|
+
e.oauthClient.clearSession();
|
|
690
|
+
}
|
|
691
|
+
if (!m.ok) {
|
|
692
|
+
const f = await Ot(m);
|
|
693
|
+
throw new j(
|
|
694
|
+
f.message || f.detail || f.title || Ft(m.status),
|
|
695
|
+
m.status,
|
|
696
|
+
f.code,
|
|
697
|
+
f.requestId || f.traceId || m.headers.get("X-Request-Id") || ""
|
|
698
|
+
);
|
|
699
|
+
}
|
|
700
|
+
return m.json();
|
|
701
|
+
}
|
|
702
|
+
function i() {
|
|
703
|
+
const l = e.fetcher || globalThis.fetch;
|
|
704
|
+
if (!l) throw new Error("管理后台 Access 客户端缺少 Fetch 运行环境。");
|
|
705
|
+
return l;
|
|
706
|
+
}
|
|
707
|
+
return { getCurrentUser: r, getCurrentMenus: a };
|
|
708
|
+
}
|
|
709
|
+
function $t(e) {
|
|
710
|
+
if (!e || typeof e != "object")
|
|
711
|
+
throw new j("当前用户响应格式无效。", 502, "INVALID_CURRENT_USER");
|
|
712
|
+
const t = e;
|
|
713
|
+
if ([
|
|
714
|
+
"userId",
|
|
715
|
+
"displayName",
|
|
716
|
+
"username",
|
|
717
|
+
"loginAccount",
|
|
718
|
+
"employeeNo",
|
|
719
|
+
"mobile",
|
|
720
|
+
"email",
|
|
721
|
+
"status",
|
|
722
|
+
"lastLoginAt",
|
|
723
|
+
"createdAt"
|
|
724
|
+
].some((a) => typeof t[a] != "string"))
|
|
725
|
+
throw new j("当前用户响应缺少标准字段。", 502, "INVALID_CURRENT_USER");
|
|
726
|
+
if (!fe(t.organizations) || !fe(t.roles))
|
|
727
|
+
throw new j("当前用户关系数据格式无效。", 502, "INVALID_CURRENT_USER");
|
|
728
|
+
return t;
|
|
729
|
+
}
|
|
730
|
+
function fe(e) {
|
|
731
|
+
return Array.isArray(e) && e.every((t) => t !== null && typeof t == "object" && typeof t.id == "string" && typeof t.name == "string" && (t.code === void 0 || typeof t.code == "string"));
|
|
732
|
+
}
|
|
733
|
+
function Vt(e) {
|
|
734
|
+
return e.startsWith("/") ? e : `/${e}`;
|
|
735
|
+
}
|
|
736
|
+
async function Ot(e) {
|
|
737
|
+
return e.json().catch(() => ({}));
|
|
738
|
+
}
|
|
739
|
+
function Ft(e) {
|
|
740
|
+
return e === 401 ? "登录状态已失效,请重新登录。" : e === 403 ? "当前用户无权从该页面调用此 API。" : e === 404 ? "请求的数据不存在或已被移除。" : e === 429 ? "请求过于频繁,请稍后再试。" : e >= 500 ? "用户中心暂时不可用,请稍后再试。" : "用户中心请求失败。";
|
|
741
|
+
}
|
|
742
|
+
const Dt = new Uint32Array([
|
|
600
743
|
1116352408,
|
|
601
744
|
1899447441,
|
|
602
745
|
3049323471,
|
|
@@ -661,7 +804,7 @@ const We = { class: "saf-sidebar saf-desktop-sidebar" }, Ge = { class: "saf-bran
|
|
|
661
804
|
2756734187,
|
|
662
805
|
3204031479,
|
|
663
806
|
3329325298
|
|
664
|
-
]),
|
|
807
|
+
]), Bt = new Uint32Array([
|
|
665
808
|
1779033703,
|
|
666
809
|
3144134277,
|
|
667
810
|
1013904242,
|
|
@@ -671,233 +814,326 @@ const We = { class: "saf-sidebar saf-desktop-sidebar" }, Ge = { class: "saf-bran
|
|
|
671
814
|
528734635,
|
|
672
815
|
1541459225
|
|
673
816
|
]);
|
|
674
|
-
function
|
|
675
|
-
const
|
|
817
|
+
function zt(e) {
|
|
818
|
+
const t = Math.ceil((e.length + 9) / 64) * 64, r = new Uint8Array(t);
|
|
676
819
|
r.set(e), r[e.length] = 128;
|
|
677
|
-
const
|
|
678
|
-
for (let
|
|
679
|
-
r[
|
|
680
|
-
const
|
|
681
|
-
for (let
|
|
820
|
+
const a = BigInt(e.length) * 8n;
|
|
821
|
+
for (let m = 0; m < 8; m += 1)
|
|
822
|
+
r[t - 1 - m] = Number(a >> BigInt(m * 8) & 0xffn);
|
|
823
|
+
const n = new Uint32Array(Bt), i = new Uint32Array(64), l = new DataView(r.buffer);
|
|
824
|
+
for (let m = 0; m < t; m += 64) {
|
|
682
825
|
for (let y = 0; y < 16; y += 1)
|
|
683
|
-
|
|
826
|
+
i[y] = l.getUint32(m + y * 4);
|
|
684
827
|
for (let y = 16; y < 64; y += 1) {
|
|
685
|
-
const U =
|
|
686
|
-
|
|
828
|
+
const U = i[y - 15], V = i[y - 2], M = P(U, 7) ^ P(U, 18) ^ U >>> 3, O = P(V, 17) ^ P(V, 19) ^ V >>> 10;
|
|
829
|
+
i[y] = i[y - 16] + M + i[y - 7] + O >>> 0;
|
|
687
830
|
}
|
|
688
|
-
let
|
|
831
|
+
let f = n[0], k = n[1], _ = n[2], C = n[3], S = n[4], $ = n[5], F = n[6], D = n[7];
|
|
689
832
|
for (let y = 0; y < 64; y += 1) {
|
|
690
|
-
const U =
|
|
691
|
-
|
|
833
|
+
const U = P(S, 6) ^ P(S, 11) ^ P(S, 25), V = S & $ ^ ~S & F, M = D + U + V + Dt[y] + i[y] >>> 0, O = P(f, 2) ^ P(f, 13) ^ P(f, 22), p = f & k ^ f & _ ^ k & _, q = O + p >>> 0;
|
|
834
|
+
D = F, F = $, $ = S, S = C + M >>> 0, C = _, _ = k, k = f, f = M + q >>> 0;
|
|
692
835
|
}
|
|
693
|
-
|
|
836
|
+
n[0] = n[0] + f >>> 0, n[1] = n[1] + k >>> 0, n[2] = n[2] + _ >>> 0, n[3] = n[3] + C >>> 0, n[4] = n[4] + S >>> 0, n[5] = n[5] + $ >>> 0, n[6] = n[6] + F >>> 0, n[7] = n[7] + D >>> 0;
|
|
694
837
|
}
|
|
695
|
-
const
|
|
696
|
-
return
|
|
838
|
+
const c = new Uint8Array(32), u = new DataView(c.buffer);
|
|
839
|
+
return n.forEach((m, f) => u.setUint32(f * 4, m)), c;
|
|
697
840
|
}
|
|
698
|
-
function
|
|
699
|
-
return e >>>
|
|
841
|
+
function P(e, t) {
|
|
842
|
+
return e >>> t | e << 32 - t;
|
|
700
843
|
}
|
|
701
|
-
function
|
|
702
|
-
const
|
|
703
|
-
if (!
|
|
704
|
-
const
|
|
705
|
-
let
|
|
706
|
-
function
|
|
844
|
+
function Zt(e) {
|
|
845
|
+
const t = e.now || Date.now, r = e.refreshSkewMs ?? 3e4, a = e.transactionLifetimeMs ?? 10 * 6e4, n = e.storageNamespace.trim();
|
|
846
|
+
if (!n) throw new Error("OAuth storageNamespace 不能为空。");
|
|
847
|
+
const i = `${n}_oauth_session`, l = `${n}_oauth_transaction`, c = `${n}-oauth-session-changed`;
|
|
848
|
+
let u = null;
|
|
849
|
+
function m() {
|
|
707
850
|
return e.mockMode === !0;
|
|
708
851
|
}
|
|
709
|
-
function
|
|
710
|
-
const
|
|
711
|
-
if (!
|
|
852
|
+
function f() {
|
|
853
|
+
const o = M(), s = o.getItem(i);
|
|
854
|
+
if (!s) return null;
|
|
712
855
|
try {
|
|
713
|
-
const
|
|
714
|
-
return
|
|
856
|
+
const h = JSON.parse(s);
|
|
857
|
+
return h.accessToken && h.refreshToken && Number.isFinite(h.expiresAt) ? h : null;
|
|
715
858
|
} catch {
|
|
716
|
-
return
|
|
859
|
+
return o.removeItem(i), null;
|
|
717
860
|
}
|
|
718
861
|
}
|
|
719
862
|
function k() {
|
|
720
|
-
|
|
863
|
+
M().removeItem(i), p().dispatchEvent(new Event(c));
|
|
721
864
|
}
|
|
722
|
-
function _(
|
|
723
|
-
const
|
|
724
|
-
return
|
|
865
|
+
function _(o) {
|
|
866
|
+
const s = p();
|
|
867
|
+
return s.addEventListener(c, o), () => s.removeEventListener(c, o);
|
|
725
868
|
}
|
|
726
|
-
async function
|
|
727
|
-
if (
|
|
728
|
-
const
|
|
729
|
-
state:
|
|
730
|
-
verifier:
|
|
869
|
+
async function C(o = Pt(O()), s = {}) {
|
|
870
|
+
if (m()) return;
|
|
871
|
+
const h = M(), E = O(), L = q(), K = he(L, 64), J = he(L, 32), oe = {
|
|
872
|
+
state: J,
|
|
873
|
+
verifier: K,
|
|
731
874
|
redirectUri: e.redirectUri,
|
|
732
|
-
returnUrl:
|
|
733
|
-
createdAt:
|
|
875
|
+
returnUrl: qt(o, e.defaultReturnUrl),
|
|
876
|
+
createdAt: t()
|
|
734
877
|
};
|
|
735
|
-
|
|
736
|
-
const
|
|
737
|
-
Q.search = new URLSearchParams({
|
|
878
|
+
h.setItem(l, JSON.stringify(oe));
|
|
879
|
+
const Y = me(e.authority, "/oauth2/authorize", E.origin), Z = new URLSearchParams({
|
|
738
880
|
response_type: "code",
|
|
739
881
|
client_id: e.clientId,
|
|
740
882
|
redirect_uri: e.redirectUri,
|
|
741
|
-
state:
|
|
742
|
-
code_challenge: await
|
|
883
|
+
state: J,
|
|
884
|
+
code_challenge: await Ht(L, K),
|
|
743
885
|
code_challenge_method: "S256"
|
|
744
|
-
})
|
|
886
|
+
});
|
|
887
|
+
s.prompt && Z.set("prompt", s.prompt), Y.search = Z.toString(), E.assign(Y.toString());
|
|
745
888
|
}
|
|
746
|
-
async function
|
|
747
|
-
const
|
|
748
|
-
if (
|
|
889
|
+
async function S(o, s) {
|
|
890
|
+
const h = M(), E = V();
|
|
891
|
+
if (h.removeItem(l), !E || E.state !== s || t() - E.createdAt > a)
|
|
749
892
|
throw new Error("登录状态校验失败,请重新登录。");
|
|
750
|
-
const
|
|
893
|
+
const L = await U({
|
|
751
894
|
grant_type: "authorization_code",
|
|
752
895
|
client_id: e.clientId,
|
|
753
|
-
code:
|
|
754
|
-
redirect_uri:
|
|
755
|
-
code_verifier:
|
|
896
|
+
code: o,
|
|
897
|
+
redirect_uri: E.redirectUri,
|
|
898
|
+
code_verifier: E.verifier
|
|
756
899
|
});
|
|
757
|
-
return y(
|
|
900
|
+
return y(L), E.returnUrl;
|
|
758
901
|
}
|
|
759
|
-
async function
|
|
760
|
-
const
|
|
761
|
-
return
|
|
902
|
+
async function $() {
|
|
903
|
+
const o = f();
|
|
904
|
+
return o ? o.expiresAt > t() + r ? o.accessToken : F() : null;
|
|
762
905
|
}
|
|
763
906
|
async function F() {
|
|
764
|
-
return
|
|
765
|
-
const
|
|
766
|
-
if (!
|
|
907
|
+
return u || (u = (async () => {
|
|
908
|
+
const o = f();
|
|
909
|
+
if (!o) return null;
|
|
767
910
|
try {
|
|
768
|
-
const
|
|
911
|
+
const s = await U({
|
|
769
912
|
grant_type: "refresh_token",
|
|
770
913
|
client_id: e.clientId,
|
|
771
|
-
refresh_token:
|
|
914
|
+
refresh_token: o.refreshToken
|
|
772
915
|
});
|
|
773
|
-
return y(
|
|
916
|
+
return y(s), s.access_token;
|
|
774
917
|
} catch {
|
|
775
918
|
return k(), null;
|
|
776
919
|
}
|
|
777
920
|
})().finally(() => {
|
|
778
|
-
|
|
779
|
-
}),
|
|
921
|
+
u = null;
|
|
922
|
+
}), u);
|
|
780
923
|
}
|
|
781
|
-
function
|
|
924
|
+
function D(o) {
|
|
782
925
|
try {
|
|
783
|
-
const
|
|
784
|
-
if (!
|
|
785
|
-
const
|
|
926
|
+
const s = o.split(".")[1];
|
|
927
|
+
if (!s) return "";
|
|
928
|
+
const h = s.replace(/-/g, "+").replace(/_/g, "/"), E = h.padEnd(Math.ceil(h.length / 4) * 4, "=");
|
|
786
929
|
return JSON.parse(decodeURIComponent(
|
|
787
|
-
Array.from(atob(
|
|
930
|
+
Array.from(atob(E)).map((K) => `%${K.charCodeAt(0).toString(16).padStart(2, "0")}`).join("")
|
|
788
931
|
)).sub || "";
|
|
789
932
|
} catch {
|
|
790
933
|
return "";
|
|
791
934
|
}
|
|
792
935
|
}
|
|
793
|
-
function y(
|
|
794
|
-
if (
|
|
936
|
+
function y(o) {
|
|
937
|
+
if (o.token_type.toLowerCase() !== "bearer" || !o.access_token || !o.refresh_token || o.expires_in <= 0)
|
|
795
938
|
throw new Error("用户中心返回的 Token 响应无效。");
|
|
796
|
-
const
|
|
797
|
-
accessToken:
|
|
798
|
-
refreshToken:
|
|
799
|
-
expiresAt:
|
|
939
|
+
const s = {
|
|
940
|
+
accessToken: o.access_token,
|
|
941
|
+
refreshToken: o.refresh_token,
|
|
942
|
+
expiresAt: t() + o.expires_in * 1e3
|
|
800
943
|
};
|
|
801
|
-
|
|
944
|
+
M().setItem(i, JSON.stringify(s)), p().dispatchEvent(new Event(c));
|
|
802
945
|
}
|
|
803
|
-
async function U(
|
|
804
|
-
const
|
|
805
|
-
|
|
946
|
+
async function U(o) {
|
|
947
|
+
const s = O(), h = await W()(
|
|
948
|
+
me(e.authority, "/oauth2/token", s.origin),
|
|
806
949
|
{
|
|
807
950
|
method: "POST",
|
|
808
951
|
headers: { "Content-Type": "application/x-www-form-urlencoded" },
|
|
809
|
-
body: new URLSearchParams(
|
|
952
|
+
body: new URLSearchParams(o)
|
|
810
953
|
}
|
|
811
|
-
),
|
|
812
|
-
if (!
|
|
813
|
-
const
|
|
954
|
+
), E = await h.json().catch(() => null);
|
|
955
|
+
if (!h.ok) {
|
|
956
|
+
const L = E;
|
|
814
957
|
throw new Error(
|
|
815
|
-
|
|
958
|
+
L?.error_description || L?.error || "Token 请求失败。"
|
|
816
959
|
);
|
|
817
960
|
}
|
|
818
|
-
return
|
|
961
|
+
return E;
|
|
819
962
|
}
|
|
820
|
-
function
|
|
821
|
-
const
|
|
822
|
-
if (!
|
|
963
|
+
function V() {
|
|
964
|
+
const s = M().getItem(l);
|
|
965
|
+
if (!s) return null;
|
|
823
966
|
try {
|
|
824
|
-
return JSON.parse(
|
|
967
|
+
return JSON.parse(s);
|
|
825
968
|
} catch {
|
|
826
969
|
return null;
|
|
827
970
|
}
|
|
828
971
|
}
|
|
829
|
-
function
|
|
830
|
-
const
|
|
831
|
-
if (!
|
|
832
|
-
return
|
|
972
|
+
function M() {
|
|
973
|
+
const o = e.storage || (typeof window > "u" ? void 0 : window.sessionStorage);
|
|
974
|
+
if (!o) throw new Error("OAuth 客户端缺少 Storage 运行环境。");
|
|
975
|
+
return o;
|
|
833
976
|
}
|
|
834
|
-
function
|
|
835
|
-
const
|
|
836
|
-
if (!
|
|
837
|
-
return
|
|
977
|
+
function O() {
|
|
978
|
+
const o = e.location || (typeof window > "u" ? void 0 : window.location);
|
|
979
|
+
if (!o) throw new Error("OAuth 客户端缺少 Location 运行环境。");
|
|
980
|
+
return o;
|
|
838
981
|
}
|
|
839
|
-
function
|
|
840
|
-
const
|
|
841
|
-
if (!
|
|
842
|
-
return
|
|
982
|
+
function p() {
|
|
983
|
+
const o = e.eventTarget || (typeof window > "u" ? void 0 : window);
|
|
984
|
+
if (!o) throw new Error("OAuth 客户端缺少 EventTarget 运行环境。");
|
|
985
|
+
return o;
|
|
843
986
|
}
|
|
844
|
-
function
|
|
845
|
-
const
|
|
846
|
-
if (!
|
|
847
|
-
return
|
|
987
|
+
function q() {
|
|
988
|
+
const o = e.crypto || globalThis.crypto;
|
|
989
|
+
if (!o) throw new Error("OAuth 客户端缺少 Crypto 运行环境。");
|
|
990
|
+
return o;
|
|
848
991
|
}
|
|
849
|
-
function
|
|
850
|
-
const
|
|
851
|
-
if (!
|
|
852
|
-
return
|
|
992
|
+
function W() {
|
|
993
|
+
const o = e.fetcher || globalThis.fetch;
|
|
994
|
+
if (!o) throw new Error("OAuth 客户端缺少 Fetch 运行环境。");
|
|
995
|
+
return o;
|
|
853
996
|
}
|
|
854
997
|
return {
|
|
855
|
-
isMockMode:
|
|
856
|
-
getSession:
|
|
998
|
+
isMockMode: m,
|
|
999
|
+
getSession: f,
|
|
857
1000
|
clearSession: k,
|
|
858
1001
|
onSessionChanged: _,
|
|
859
|
-
beginLogin:
|
|
860
|
-
completeLogin:
|
|
861
|
-
getValidAccessToken:
|
|
1002
|
+
beginLogin: C,
|
|
1003
|
+
completeLogin: S,
|
|
1004
|
+
getValidAccessToken: $,
|
|
862
1005
|
refreshAccessToken: F,
|
|
863
|
-
readAccessTokenSubject:
|
|
1006
|
+
readAccessTokenSubject: D
|
|
864
1007
|
};
|
|
865
1008
|
}
|
|
866
|
-
function
|
|
867
|
-
return e.startsWith("/") && !e.startsWith("//") ? e :
|
|
1009
|
+
function qt(e, t) {
|
|
1010
|
+
return e.startsWith("/") && !e.startsWith("//") ? e : t;
|
|
868
1011
|
}
|
|
869
|
-
function
|
|
870
|
-
return new URL(`${e.replace(/\/$/, "")}${
|
|
1012
|
+
function me(e, t, r) {
|
|
1013
|
+
return new URL(`${e.replace(/\/$/, "")}${t}`, r);
|
|
871
1014
|
}
|
|
872
|
-
function
|
|
1015
|
+
function Pt(e) {
|
|
873
1016
|
return `${e.pathname}${e.search}${e.hash}`;
|
|
874
1017
|
}
|
|
875
|
-
function
|
|
876
|
-
const r = e.getRandomValues(new Uint8Array(
|
|
877
|
-
return
|
|
1018
|
+
function he(e, t) {
|
|
1019
|
+
const r = e.getRandomValues(new Uint8Array(t));
|
|
1020
|
+
return Ce(r);
|
|
878
1021
|
}
|
|
879
|
-
async function
|
|
880
|
-
const r = new TextEncoder().encode(
|
|
881
|
-
return
|
|
1022
|
+
async function Ht(e, t) {
|
|
1023
|
+
const r = new TextEncoder().encode(t), a = e.subtle ? new Uint8Array(await e.subtle.digest("SHA-256", r)) : zt(r);
|
|
1024
|
+
return Ce(a);
|
|
882
1025
|
}
|
|
883
|
-
function
|
|
884
|
-
let
|
|
1026
|
+
function Ce(e) {
|
|
1027
|
+
let t = "";
|
|
885
1028
|
return e.forEach((r) => {
|
|
886
|
-
|
|
887
|
-
}), btoa(
|
|
1029
|
+
t += String.fromCharCode(r);
|
|
1030
|
+
}), btoa(t).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
1031
|
+
}
|
|
1032
|
+
function en(e) {
|
|
1033
|
+
const t = e.accessClient || Rt({
|
|
1034
|
+
oauthClient: e.oauthClient,
|
|
1035
|
+
baseUrl: e.accessApiBaseUrl
|
|
1036
|
+
}), r = R(""), a = R(null), n = R(""), i = R(""), l = R([]), c = R(!1), u = R("");
|
|
1037
|
+
let m = null, f = 0;
|
|
1038
|
+
const k = z(() => (n.value.trim() || "?").slice(0, 1).toUpperCase()), _ = z(() => e.oauthClient.isMockMode() || !!r.value);
|
|
1039
|
+
function C() {
|
|
1040
|
+
const p = r.value;
|
|
1041
|
+
r.value = e.oauthClient.isMockMode() ? "" : e.oauthClient.getSession()?.accessToken || "", p !== r.value && U(), !r.value && !e.oauthClient.isMockMode() && y();
|
|
1042
|
+
}
|
|
1043
|
+
async function S() {
|
|
1044
|
+
if (e.oauthClient.isMockMode()) return !0;
|
|
1045
|
+
const p = await e.oauthClient.getValidAccessToken();
|
|
1046
|
+
return C(), !!p;
|
|
1047
|
+
}
|
|
1048
|
+
async function $() {
|
|
1049
|
+
if (!c.value)
|
|
1050
|
+
return m || (m = F().finally(() => {
|
|
1051
|
+
m = null;
|
|
1052
|
+
}), m);
|
|
1053
|
+
}
|
|
1054
|
+
async function F() {
|
|
1055
|
+
if (u.value = "", e.oauthClient.isMockMode()) {
|
|
1056
|
+
a.value = e.mockUser ? structuredClone(e.mockUser) : null, D(a.value, ""), l.value = structuredClone(e.mockMenus || []), c.value = !0;
|
|
1057
|
+
return;
|
|
1058
|
+
}
|
|
1059
|
+
const p = await e.oauthClient.getValidAccessToken();
|
|
1060
|
+
if (C(), !p) {
|
|
1061
|
+
y(), l.value = [], u.value = "登录状态已失效。", c.value = !0;
|
|
1062
|
+
return;
|
|
1063
|
+
}
|
|
1064
|
+
const q = f, W = r.value || p, o = e.oauthClient.readAccessTokenSubject(p);
|
|
1065
|
+
D(null, o);
|
|
1066
|
+
const [s, h] = await Promise.allSettled([
|
|
1067
|
+
t.getCurrentUser(),
|
|
1068
|
+
t.getCurrentMenus()
|
|
1069
|
+
]);
|
|
1070
|
+
q !== f || W !== r.value || (s.status === "fulfilled" ? (a.value = s.value, D(s.value, o)) : a.value = null, h.status === "fulfilled" ? l.value = h.value : (l.value = [], u.value = h.reason instanceof Error ? h.reason.message : "当前账号菜单加载失败。"), c.value = !0);
|
|
1071
|
+
}
|
|
1072
|
+
function D(p, q) {
|
|
1073
|
+
n.value = p?.displayName || p?.username || p?.loginAccount || p?.userId || q || (e.oauthClient.isMockMode() ? "演示用户" : "当前用户"), i.value = p?.loginAccount || q;
|
|
1074
|
+
}
|
|
1075
|
+
function y() {
|
|
1076
|
+
a.value = null, n.value = "", i.value = "";
|
|
1077
|
+
}
|
|
1078
|
+
function U() {
|
|
1079
|
+
f += 1, l.value = [], c.value = !1, u.value = "", y();
|
|
1080
|
+
}
|
|
1081
|
+
function V() {
|
|
1082
|
+
U();
|
|
1083
|
+
for (const p of e.storageKeysToClear || [])
|
|
1084
|
+
typeof sessionStorage < "u" && sessionStorage.removeItem(p);
|
|
1085
|
+
C();
|
|
1086
|
+
}
|
|
1087
|
+
async function M(p) {
|
|
1088
|
+
await e.oauthClient.beginLogin(p);
|
|
1089
|
+
}
|
|
1090
|
+
async function O(p = e.defaultReturnUrl) {
|
|
1091
|
+
if (e.oauthClient.clearSession(), V(), e.oauthClient.isMockMode()) {
|
|
1092
|
+
await $();
|
|
1093
|
+
return;
|
|
1094
|
+
}
|
|
1095
|
+
await e.oauthClient.beginLogin(p, { prompt: "login" });
|
|
1096
|
+
}
|
|
1097
|
+
return C(), e.oauthClient.onSessionChanged(() => {
|
|
1098
|
+
C();
|
|
1099
|
+
}), {
|
|
1100
|
+
accessToken: r,
|
|
1101
|
+
currentUser: a,
|
|
1102
|
+
username: n,
|
|
1103
|
+
loginAccount: i,
|
|
1104
|
+
menus: l,
|
|
1105
|
+
navigationLoaded: c,
|
|
1106
|
+
navigationError: u,
|
|
1107
|
+
initials: k,
|
|
1108
|
+
authenticated: _,
|
|
1109
|
+
sync: C,
|
|
1110
|
+
ensureAuthenticated: S,
|
|
1111
|
+
ensureLoaded: $,
|
|
1112
|
+
ensureNavigation: $,
|
|
1113
|
+
clear: V,
|
|
1114
|
+
login: M,
|
|
1115
|
+
logout: O
|
|
1116
|
+
};
|
|
888
1117
|
}
|
|
889
1118
|
export {
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
Rt as
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
1119
|
+
j as AdminAccessError,
|
|
1120
|
+
Xt as AdminFrameworkLayout,
|
|
1121
|
+
de as FrameworkMenuItem,
|
|
1122
|
+
Yt as OAuthCallbackView,
|
|
1123
|
+
Xe as closeVisitedTab,
|
|
1124
|
+
Rt as createAdminAccessClient,
|
|
1125
|
+
en as createAdminFrameworkSession,
|
|
1126
|
+
Qt as createExternalMenuHrefResolver,
|
|
1127
|
+
Zt as createOAuthPkceClient,
|
|
1128
|
+
Wt as findMenuByRoute,
|
|
1129
|
+
Je as findMenuTrail,
|
|
1130
|
+
ne as flattenRoutableMenus,
|
|
1131
|
+
Gt as hasPageAccess,
|
|
1132
|
+
$t as normalizeCurrentUser,
|
|
1133
|
+
be as normalizeFrameworkMenus,
|
|
1134
|
+
re as normalizeVisitedTabs,
|
|
1135
|
+
Ye as retainActiveTab,
|
|
1136
|
+
qt as sanitizeReturnUrl,
|
|
1137
|
+
zt as sha256,
|
|
1138
|
+
Qe as upsertVisitedTab
|
|
903
1139
|
};
|