@pubinfo-pr/core 0.222.4 → 0.224.1
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/{AppSetting-BWVulLPM.js → AppSetting-7jlhUzze.js} +40 -40
- package/dist/{HCheckList-Bb4GvZ2_.js → HCheckList-cPBgATmv.js} +1 -1
- package/dist/HSlideover-DVQDc9q6.js +3151 -0
- package/dist/{HToggle-Bnr5k93p.js → HToggle-Ce_2-yhZ.js} +2 -2
- package/dist/PreferencesContent-BAIH81yS.js +701 -0
- package/dist/{SettingBreadcrumb-DKCK6V-n.js → SettingBreadcrumb-O9-PhAFT.js} +7 -6
- package/dist/{SettingCopyright-C5Pc0I1w.js → SettingCopyright-DIKsWTuf.js} +4 -4
- package/dist/{SettingEnableTransition-D2FDj0oR.js → SettingEnableTransition-61O7W00b.js} +6 -6
- package/dist/{SettingHome-1Y1rYeQb.js → SettingHome-Sv65TPH8.js} +6 -6
- package/dist/{SettingMenu-DWtNX8Ti.js → SettingMenu-BvwJOUZV.js} +9 -8
- package/dist/{SettingMode-CZV84QeW.js → SettingMode-B8H_eQc8.js} +5 -5
- package/dist/{SettingNavSearch-CrMpbXFg.js → SettingNavSearch-BHsmYBA7.js} +5 -5
- package/dist/{SettingOther-D6gGuQJw.js → SettingOther-CyyNnaDX.js} +6 -6
- package/dist/{SettingPage-DuN13bXO.js → SettingPage-B82lW41P.js} +3 -3
- package/dist/{SettingTabbar-BhJxcU35.js → SettingTabbar-Bky2xvH-.js} +11 -10
- package/dist/{SettingThemes-BjkWfY1C.js → SettingThemes-CkdzS1xt.js} +13 -12
- package/dist/{SettingToolbar-BYOxXAXL.js → SettingToolbar-CD4qns1J.js} +5 -5
- package/dist/{SettingTopbar-CxKsnIRK.js → SettingTopbar-1shjoe3s.js} +9 -8
- package/dist/{SettingWidthMode-dM88qSol.js → SettingWidthMode-DlG6lXjA.js} +6 -6
- package/dist/auth-BLGKOyc5.js +4432 -0
- package/dist/built-in/layout-component/index.d.ts +2 -6
- package/dist/{change-organization-BXl4ZC7j.js → change-organization-hsqeSzDu.js} +25 -25
- package/dist/{change-password-P4SGdvdU.js → change-password-EtccCDRX.js} +74 -65
- package/dist/chunk-CD4vhpVs.js +18 -0
- package/dist/components-DFNyaAb9.js +5238 -0
- package/dist/{core-D2ocBD0r.js → core-DJIGzMMM.js} +51 -57
- package/dist/dist-7OjQvlya.js +468 -0
- package/dist/form-C3VHofnN.js +2768 -0
- package/dist/index.js +8391 -2411
- package/dist/modal-Bl5xHbxa.js +43824 -0
- package/dist/{not-found-C-1699o2.js → not-found-BCjngLzt.js} +5 -4
- package/dist/{not-permission-CZGJzlSF.js → not-permission-C26vTMvf.js} +5 -4
- package/dist/profile-BVXIFuBG.js +19269 -0
- package/dist/{question-line-B4oDBb2H.js → question-line-BG__Ycfv.js} +2 -2
- package/dist/{right-BTHgfOSp.js → right-BxBlFUwj.js} +4 -4
- package/dist/style.css +1 -1
- package/dist/tree-select-B8cTcGLa.js +12497 -0
- package/dist/watchDiff-CPZFtaOC.js +655 -0
- package/package.json +7 -7
- package/src/built-in/authentication/pages/change-organization/index.vue +5 -22
- package/src/built-in/authentication/pages/change-password/index.vue +3 -30
- package/src/built-in/layout-component/Layout.vue +30 -81
- package/src/built-in/layout-component/components/Copyright/index.vue +3 -29
- package/src/built-in/layout-component/components/Header/HeaderFullMenu/More.vue +6 -17
- package/src/built-in/layout-component/components/Header/HeaderFullMenu/NotCursor.vue +7 -18
- package/src/built-in/layout-component/components/Header/index.vue +22 -119
- package/src/built-in/layout-component/components/Logo/index.vue +1 -4
- package/src/built-in/layout-component/components/Menu/item.vue +6 -29
- package/src/built-in/layout-component/components/SettingBar/AppSetting.vue +13 -33
- package/src/built-in/layout-component/components/SettingBar/components/DayNightToggle.vue +25 -113
- package/src/built-in/layout-component/components/SettingBar/components/SettingEnableTransition.vue +4 -57
- package/src/built-in/layout-component/components/SettingBar/components/SettingMode.vue +20 -123
- package/src/built-in/layout-component/components/SettingBar/components/SettingThemes.vue +25 -102
- package/src/built-in/layout-component/components/SettingBar/components/SettingWidthMode.vue +16 -100
- package/src/built-in/layout-component/components/SettingBar/index.vue +10 -64
- package/src/built-in/layout-component/components/Sidebar/MainSidebar.vue +22 -76
- package/src/built-in/layout-component/components/Sidebar/SubSidebar.vue +10 -16
- package/src/built-in/layout-component/components/Tools/Breadcrumb/index.vue +2 -2
- package/src/built-in/layout-component/components/Tools/DarkModeToggle.vue +4 -26
- package/src/built-in/layout-component/components/Tools/Preferences/PreferencesContent.vue +51 -404
- package/src/built-in/layout-component/components/Topbar/Tabbar/MoreAction.vue +13 -68
- package/src/built-in/layout-component/components/Topbar/Tabbar/index.vue +49 -177
- package/src/built-in/layout-component/components/Topbar/Toolbar/Favorites.vue +2 -2
- package/src/built-in/layout-component/components/Topbar/Toolbar/index.vue +12 -45
- package/src/built-in/layout-component/components/ui/HToggle.vue +9 -55
- package/src/built-in/layout-component/index.ts +2 -4
- package/src/features/components/PassStrengthValidator/index.vue +10 -36
- package/src/features/components/PassStrengthValidator/rule.vue +4 -17
- package/dist/HSlideover-DoCRa4dK.js +0 -152
- package/dist/HeaderFullMenu--AOcAS-6.js +0 -251
- package/dist/HeaderThinMenu-CRPVfGgM.js +0 -438
- package/dist/PreferencesContent-DW9HAzpr.js +0 -486
- package/dist/auth-DILNNEQ8.js +0 -1230
- package/dist/components-C9kcavB4.js +0 -2768
- package/dist/core-CKIhF3Vi.js +0 -270
- package/dist/profile-B3Q7hRgl.js +0 -123
- /package/dist/{HButton-BPbXqVbA.js → HButton-Dt6qGhhR.js} +0 -0
- /package/dist/{HDivider-BSENlYnI.js → HDivider-BwvBr5OE.js} +0 -0
- /package/dist/{HInput-DbvnkEO7.js → HInput-KJ5nFBpF.js} +0 -0
- /package/dist/{HTooltip-tCnNrJUE.js → HTooltip-DjAU-Evn.js} +0 -0
- /package/dist/{_plugin-vue_export-helper-BBf_fmJ_.js → _plugin-vue_export-helper-sUTDUeGO.js} +0 -0
- /package/dist/{engine-oniguruma-Bl7ZtyDI.js → engine-oniguruma-CaNXwGSv.js} +0 -0
- /package/dist/{json-BuUwnwNo.js → json-Bu_Zprin.js} +0 -0
- /package/dist/{reload-DWTXo9r2.js → reload-DHx5Vwus.js} +0 -0
- /package/dist/{useContext-mDF2-tXy.js → useContext-DLtu9F7E.js} +0 -0
- /package/dist/{vitesse-dark-j0hKJETh.js → vitesse-dark-CTe40QT_.js} +0 -0
- /package/dist/{vitesse-light-BfgKNo3X.js → vitesse-light-BWXC_WeB.js} +0 -0
- /package/dist/{wasm-tXaxAgz9.js → wasm-2zDVqo-C.js} +0 -0
package/dist/auth-DILNNEQ8.js
DELETED
|
@@ -1,1230 +0,0 @@
|
|
|
1
|
-
import { _ as getPersistedState, a as setupPage, g as createContext$1, o as setupDefaultLayout, p as callHookAsync } from "./core-CKIhF3Vi.js";
|
|
2
|
-
import { watchDiffObject } from "./index.js";
|
|
3
|
-
import { createContext as createRawContext } from "unctx";
|
|
4
|
-
import { defineStore } from "pinia";
|
|
5
|
-
import { computed, createVNode, reactive, ref, toRaw, watch } from "vue";
|
|
6
|
-
import { cloneDeep, defaultTo, defaultsDeep, find, get, has, isArray, isEmpty, isFunction, isNumber, isObject, isString, isUndefined, merge, omit, omitBy, reduce, set, template } from "lodash-es";
|
|
7
|
-
import "@pubinfo-pr/shared";
|
|
8
|
-
import { computedAsync, usePreferredDark, useToggle } from "@vueuse/core";
|
|
9
|
-
import { match } from "path-to-regexp";
|
|
10
|
-
import { useRoute } from "vue-router";
|
|
11
|
-
import { FrownOutlined } from "@ant-design/icons-vue";
|
|
12
|
-
import { Modal } from "ant-design-vue";
|
|
13
|
-
import Message from "vue-m-message";
|
|
14
|
-
import path from "path-browserify";
|
|
15
|
-
import JSEncrypt from "jsencrypt";
|
|
16
|
-
var ctx = createContext$1("ctx", { stateKey: "state" });
|
|
17
|
-
function createPubinfoContext(e) {
|
|
18
|
-
ctx.set(e), ctx.use();
|
|
19
|
-
}
|
|
20
|
-
function usePubinfoContext() {
|
|
21
|
-
return ctx.use();
|
|
22
|
-
}
|
|
23
|
-
let STORE_NAME = /* @__PURE__ */ function(e) {
|
|
24
|
-
return e.FAVORITES = "favorites", e.IFRAME = "iframe", e.KEEP_ALIVE = "keepAlive", e.MENU = "menu", e.NOTIFICATION = "notification", e.ROUTE = "route", e.SETTINGS = "settings", e.TABBAR = "tabbar", e.USER = "user", e;
|
|
25
|
-
}({});
|
|
26
|
-
var useFavoritesStore = defineStore(STORE_NAME.FAVORITES, () => {
|
|
27
|
-
let e = ref([]);
|
|
28
|
-
function t(e) {
|
|
29
|
-
let t = !0;
|
|
30
|
-
return e.children?.every((e) => e.meta?.sidebar === !1) && (t = !1), t;
|
|
31
|
-
}
|
|
32
|
-
function n(e, r) {
|
|
33
|
-
let i = [];
|
|
34
|
-
for (let a of e) a.meta?.sidebar !== !1 && (a.children && t(a) ? i.push(...n(a.children, resolveRoutePath(r, a.path))) : i.push(a.redirect ?? resolveRoutePath(r, a.path)));
|
|
35
|
-
return i;
|
|
36
|
-
}
|
|
37
|
-
function r(e = []) {
|
|
38
|
-
let t = [];
|
|
39
|
-
return e.forEach((e) => {
|
|
40
|
-
if (e.children) {
|
|
41
|
-
let r = n(e.children);
|
|
42
|
-
t.push(...r);
|
|
43
|
-
}
|
|
44
|
-
}), t;
|
|
45
|
-
}
|
|
46
|
-
function i(e, t = []) {
|
|
47
|
-
return r(t).includes(e);
|
|
48
|
-
}
|
|
49
|
-
function a(t) {
|
|
50
|
-
return e.value.some((e) => e.fullPath === t);
|
|
51
|
-
}
|
|
52
|
-
function o(t) {
|
|
53
|
-
let n = t.matched.at(-1)?.meta;
|
|
54
|
-
e.value.find((e) => e.fullPath === t.fullPath) || e.value.push({
|
|
55
|
-
fullPath: t.fullPath,
|
|
56
|
-
title: n?.title,
|
|
57
|
-
icon: n?.icon ?? n?.breadcrumbNeste?.findLast((e) => e.icon)?.icon
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
function s(t) {
|
|
61
|
-
e.value = e.value.filter((e) => e.fullPath !== t);
|
|
62
|
-
}
|
|
63
|
-
function c(t, n) {
|
|
64
|
-
e.value.splice(t, 0, e.value.splice(n, 1)[0]);
|
|
65
|
-
}
|
|
66
|
-
return {
|
|
67
|
-
list: e,
|
|
68
|
-
canAdd: i,
|
|
69
|
-
isAdd: a,
|
|
70
|
-
add: o,
|
|
71
|
-
remove: s,
|
|
72
|
-
sort: c
|
|
73
|
-
};
|
|
74
|
-
}), useIframeStore = defineStore(STORE_NAME.IFRAME, () => {
|
|
75
|
-
let e = ref(!1), t = ref([]), n = ref([]), r = computed(() => t.value.filter((e) => e.isOpen));
|
|
76
|
-
async function i(n, r) {
|
|
77
|
-
for (let e of n) e.meta.iframe && !e.meta.link && (isFunction(e.meta.iframe) && (e.meta.iframe = await e.meta.iframe(toRaw(r))), t.value.push({
|
|
78
|
-
path: e.path,
|
|
79
|
-
src: e.meta.iframe,
|
|
80
|
-
isOpen: !1,
|
|
81
|
-
isLoading: !0
|
|
82
|
-
}));
|
|
83
|
-
e.value = !0;
|
|
84
|
-
}
|
|
85
|
-
function a(e) {
|
|
86
|
-
let n = t.value.findIndex((t) => t.path === e);
|
|
87
|
-
t.value[n].isLoading = !~n;
|
|
88
|
-
}
|
|
89
|
-
function o(e) {
|
|
90
|
-
let r = t.value.find((t) => t.path === e);
|
|
91
|
-
if (r) {
|
|
92
|
-
r.isOpen = !0;
|
|
93
|
-
let t = n.value.findIndex((t) => t === e);
|
|
94
|
-
~t ? (n.value.splice(0, 0, n.value[t]), n.value.splice(t)) : n.value.unshift(e);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
function s(e, r = !1) {
|
|
98
|
-
function i(e) {
|
|
99
|
-
let i = t.value.findIndex((t) => t.path === e);
|
|
100
|
-
~i && r && (t.value[i].isOpen = !1, t.value[i].isLoading = !0), n.value = n.value.filter((t) => t !== e);
|
|
101
|
-
}
|
|
102
|
-
isString(e) ? i(e) : e.forEach(i);
|
|
103
|
-
}
|
|
104
|
-
function l() {
|
|
105
|
-
t.value = [], e.value = !1;
|
|
106
|
-
}
|
|
107
|
-
return {
|
|
108
|
-
isGenerate: e,
|
|
109
|
-
openedList: r,
|
|
110
|
-
generateList: i,
|
|
111
|
-
closeLoading: a,
|
|
112
|
-
open: o,
|
|
113
|
-
close: s,
|
|
114
|
-
clean: l,
|
|
115
|
-
recentPathList: n,
|
|
116
|
-
list: t
|
|
117
|
-
};
|
|
118
|
-
});
|
|
119
|
-
function useAuth() {
|
|
120
|
-
function e(e) {
|
|
121
|
-
let t = useSettingsStore(), n = useUserStore();
|
|
122
|
-
return t.settings.app.enablePermission ? n.user.permissions.includes(e) : !0;
|
|
123
|
-
}
|
|
124
|
-
function t(t) {
|
|
125
|
-
let n;
|
|
126
|
-
return n = typeof t == "string" ? t === "" ? !0 : e(t) : t.length > 0 ? t.some((t) => e(t)) : !0, n;
|
|
127
|
-
}
|
|
128
|
-
function n(t) {
|
|
129
|
-
return t.length > 0 ? t.every((t) => e(t)) : !0;
|
|
130
|
-
}
|
|
131
|
-
return {
|
|
132
|
-
auth: t,
|
|
133
|
-
authAll: n
|
|
134
|
-
};
|
|
135
|
-
}
|
|
136
|
-
var LOG_TYPE = /* @__PURE__ */ function(e) {
|
|
137
|
-
return e.ERROR = "error", e.SUCCESS = "success", e.WARN = "warn", e.INFO = "info", e.START = "start", e.BOX = "box", e;
|
|
138
|
-
}(LOG_TYPE || {}), EMOJI = /* @__PURE__ */ function(e) {
|
|
139
|
-
return e.ERROR = "🔴", e.SUCCESS = "🟢", e.WARN = "🟡", e.INFO = "🔵", e.START = "🟩", e.BOX = "🟧", e;
|
|
140
|
-
}(EMOJI || {});
|
|
141
|
-
function createLog(e, t) {
|
|
142
|
-
return (e) => {};
|
|
143
|
-
}
|
|
144
|
-
const useError = createLog(LOG_TYPE.ERROR, EMOJI.ERROR), useSuccess = createLog(LOG_TYPE.SUCCESS, EMOJI.SUCCESS), useWarn = createLog(LOG_TYPE.WARN, EMOJI.WARN), useInfo = createLog(LOG_TYPE.INFO, EMOJI.INFO), useStart = createLog(LOG_TYPE.START, EMOJI.START), useBox = createLog(LOG_TYPE.BOX, EMOJI.BOX);
|
|
145
|
-
function useTheme() {
|
|
146
|
-
let e = useSettingsStore();
|
|
147
|
-
return { isDark: computed({
|
|
148
|
-
get() {
|
|
149
|
-
return e.settings.app.colorScheme === "dark";
|
|
150
|
-
},
|
|
151
|
-
set(t) {
|
|
152
|
-
e.settings.app.colorScheme = t ? "dark" : "light";
|
|
153
|
-
}
|
|
154
|
-
}) };
|
|
155
|
-
}
|
|
156
|
-
var useKeepAliveStore = defineStore(STORE_NAME.KEEP_ALIVE, () => {
|
|
157
|
-
let e = ref([]);
|
|
158
|
-
function t(n) {
|
|
159
|
-
if (isString(n)) return !e.value.includes(n) && e.value.push(n);
|
|
160
|
-
if (isArray(n)) {
|
|
161
|
-
n.forEach((e) => t(e));
|
|
162
|
-
return;
|
|
163
|
-
}
|
|
164
|
-
useWarn(`KeepAlive 需要接受一个字符串或者字符串数组作为参数, 但是接受到了 ${typeof n} 类型`);
|
|
165
|
-
}
|
|
166
|
-
function n(t) {
|
|
167
|
-
isString(t) && (e.value = e.value.filter((e) => e !== t)), isArray(t) && (e.value = e.value.filter((e) => !t.includes(e)));
|
|
168
|
-
}
|
|
169
|
-
function r() {
|
|
170
|
-
e.value = [];
|
|
171
|
-
}
|
|
172
|
-
return {
|
|
173
|
-
list: e,
|
|
174
|
-
add: t,
|
|
175
|
-
remove: n,
|
|
176
|
-
clean: r
|
|
177
|
-
};
|
|
178
|
-
});
|
|
179
|
-
function putRbacUserChangePassword(e, t) {
|
|
180
|
-
return basic.Put("/rbac/user/changePassword", {}, {
|
|
181
|
-
params: { ...e },
|
|
182
|
-
...t || {}
|
|
183
|
-
});
|
|
184
|
-
}
|
|
185
|
-
function getRbacUserUserEntireInfo(e) {
|
|
186
|
-
return basic.Get("/rbac/user/userEntireInfo", { ...e || {} });
|
|
187
|
-
}
|
|
188
|
-
function getRbacResourceGrantedResources(e) {
|
|
189
|
-
return basic.Get("/rbac/resource/grantedResources", { ...e || {} });
|
|
190
|
-
}
|
|
191
|
-
function postRbacResourceMineOrAllResourceTree(e, t) {
|
|
192
|
-
return basic.Post("/rbac/resource/mineOrAllResourceTree", {}, {
|
|
193
|
-
params: {
|
|
194
|
-
enable: "true",
|
|
195
|
-
...e
|
|
196
|
-
},
|
|
197
|
-
...t || {}
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
|
-
let RESOURCE_TYPE = /* @__PURE__ */ function(e) {
|
|
201
|
-
return e.APP = "1", e.INDEX = "2", e.MENU = "3", e.BUTTON = "4", e.NON_MENU = "5", e.DYNAMIC_APP = "7", e.IFRAME = "8", e.LINK = "9", e;
|
|
202
|
-
}({});
|
|
203
|
-
var rawAsyncRoutes = [];
|
|
204
|
-
function defineAsyncRoutes(e, t) {
|
|
205
|
-
return rawAsyncRoutes.push({
|
|
206
|
-
routes: e,
|
|
207
|
-
sort: t?.sort ?? 0
|
|
208
|
-
}), e;
|
|
209
|
-
}
|
|
210
|
-
function getAsyncRoutes() {
|
|
211
|
-
return rawAsyncRoutes.sort((e, t) => e?.sort - t?.sort).map((e) => e.routes).flat();
|
|
212
|
-
}
|
|
213
|
-
var systemRoutes = [{
|
|
214
|
-
path: "/",
|
|
215
|
-
meta: {
|
|
216
|
-
title: () => useSettingsStore().settings.home.title,
|
|
217
|
-
breadcrumb: !1
|
|
218
|
-
},
|
|
219
|
-
children: [{
|
|
220
|
-
path: "profile",
|
|
221
|
-
name: "Profile",
|
|
222
|
-
component: () => import("./profile-B3Q7hRgl.js"),
|
|
223
|
-
meta: {
|
|
224
|
-
title: "个人中心",
|
|
225
|
-
icon: "i-iconamoon-profile-duotone"
|
|
226
|
-
}
|
|
227
|
-
}]
|
|
228
|
-
}];
|
|
229
|
-
function defineSystemRoutes(e) {
|
|
230
|
-
systemRoutes[0].children?.push(...e);
|
|
231
|
-
}
|
|
232
|
-
function getSystemRoutes() {
|
|
233
|
-
return systemRoutes[0].component || (systemRoutes[0].component = setupDefaultLayout()), systemRoutes;
|
|
234
|
-
}
|
|
235
|
-
function formatBackRoutes(e = [], t = {}) {
|
|
236
|
-
let n = filterRoutes(e, [RESOURCE_TYPE.BUTTON]).map((e) => {
|
|
237
|
-
let n = e?.children && e.children.length > 0 ? formatBackRoutes(e.children, e) : [], r = omitBy({
|
|
238
|
-
id: e?.id,
|
|
239
|
-
title: e?.name ?? "",
|
|
240
|
-
auth: e?.code,
|
|
241
|
-
icon: e?.icon,
|
|
242
|
-
...e?.meta,
|
|
243
|
-
...e.type === RESOURCE_TYPE.APP || e.type === RESOURCE_TYPE.DYNAMIC_APP ? {
|
|
244
|
-
sidebar: !0,
|
|
245
|
-
tabbar: !0,
|
|
246
|
-
devText: e?.meta?.devText || "该功能暂未上线,敬请期待!"
|
|
247
|
-
} : {},
|
|
248
|
-
...e.type === RESOURCE_TYPE.INDEX ? { tabbar: !0 } : {}
|
|
249
|
-
}, isUndefined), i = cloneDeep(omitBy({
|
|
250
|
-
name: e?.meta?.routeName ?? void 0,
|
|
251
|
-
path: e?.meta?.url ?? void 0,
|
|
252
|
-
component: e?.meta?.component ?? void 0,
|
|
253
|
-
children: n,
|
|
254
|
-
meta: r
|
|
255
|
-
}, isUndefined));
|
|
256
|
-
switch (e.type) {
|
|
257
|
-
case RESOURCE_TYPE.DYNAMIC_APP: return i;
|
|
258
|
-
case RESOURCE_TYPE.INDEX: return transformIndex(i, t);
|
|
259
|
-
case RESOURCE_TYPE.MENU:
|
|
260
|
-
case RESOURCE_TYPE.IFRAME:
|
|
261
|
-
case RESOURCE_TYPE.LINK: return transformMenuAndIframe(i, t);
|
|
262
|
-
case RESOURCE_TYPE.NON_MENU: return transformNonMenu(i, t);
|
|
263
|
-
default: return i;
|
|
264
|
-
}
|
|
265
|
-
});
|
|
266
|
-
return isEmpty(t) ? filterEmptyComponentRoutes(n) : n;
|
|
267
|
-
}
|
|
268
|
-
function filterRoutes(e = [], t) {
|
|
269
|
-
return e.filter((e) => e.type ? !t.includes(e.type) : !1);
|
|
270
|
-
}
|
|
271
|
-
function filterEmptyComponentRoutes(e, t = 3) {
|
|
272
|
-
function n(e) {
|
|
273
|
-
let t = e.children?.map(n).filter(Boolean);
|
|
274
|
-
if (t && t.length > 0) return {
|
|
275
|
-
...e,
|
|
276
|
-
children: t
|
|
277
|
-
};
|
|
278
|
-
if (t?.length === 0 && e.component) {
|
|
279
|
-
let { children: t, ...n } = e;
|
|
280
|
-
return {
|
|
281
|
-
...n,
|
|
282
|
-
children: []
|
|
283
|
-
};
|
|
284
|
-
}
|
|
285
|
-
return null;
|
|
286
|
-
}
|
|
287
|
-
function r(e) {
|
|
288
|
-
return !e.children || e.children.length === 0 ? 1 : 1 + Math.max(...e.children.map(r));
|
|
289
|
-
}
|
|
290
|
-
return e.map(n).filter((e) => !!e).filter((e) => r(e) >= t);
|
|
291
|
-
}
|
|
292
|
-
function transformIndex(e, t = {}) {
|
|
293
|
-
switch (t.type) {
|
|
294
|
-
case RESOURCE_TYPE.DYNAMIC_APP: return {
|
|
295
|
-
...e,
|
|
296
|
-
path: startsWithSlash(e.path),
|
|
297
|
-
component: setupDefaultLayout()
|
|
298
|
-
};
|
|
299
|
-
case RESOURCE_TYPE.INDEX: return {
|
|
300
|
-
...e,
|
|
301
|
-
path: e.path,
|
|
302
|
-
component: void 0
|
|
303
|
-
};
|
|
304
|
-
default: return e;
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
function transformMenuAndIframe(e, t = {}) {
|
|
308
|
-
!e?.component && !e?.meta?.iframe && !e?.meta?.link && console.warn(`[PUBINFO] 资源"${e.meta.title}"的component字段不存在, 将会导致未知错误!`);
|
|
309
|
-
let n = cloneDeep(e), i = [{
|
|
310
|
-
path: "",
|
|
311
|
-
name: e.name,
|
|
312
|
-
component: replaceComponent(e.component, e.meta?.scope),
|
|
313
|
-
meta: {
|
|
314
|
-
...e.meta,
|
|
315
|
-
title: e.meta.title,
|
|
316
|
-
sidebar: !1,
|
|
317
|
-
breadcrumb: !1
|
|
318
|
-
},
|
|
319
|
-
children: []
|
|
320
|
-
}, ...e.children];
|
|
321
|
-
switch (t.type) {
|
|
322
|
-
case RESOURCE_TYPE.DYNAMIC_APP:
|
|
323
|
-
n = {
|
|
324
|
-
...e,
|
|
325
|
-
path: startsWithSlash(e.path),
|
|
326
|
-
name: void 0,
|
|
327
|
-
component: setupDefaultLayout(),
|
|
328
|
-
children: i
|
|
329
|
-
};
|
|
330
|
-
break;
|
|
331
|
-
case RESOURCE_TYPE.INDEX:
|
|
332
|
-
n = {
|
|
333
|
-
...e,
|
|
334
|
-
path: e.path,
|
|
335
|
-
name: void 0,
|
|
336
|
-
component: void 0,
|
|
337
|
-
children: i
|
|
338
|
-
};
|
|
339
|
-
break;
|
|
340
|
-
}
|
|
341
|
-
return n;
|
|
342
|
-
}
|
|
343
|
-
function transformNonMenu(e, t = {}) {
|
|
344
|
-
switch (t.type) {
|
|
345
|
-
case RESOURCE_TYPE.INDEX:
|
|
346
|
-
case RESOURCE_TYPE.MENU:
|
|
347
|
-
case RESOURCE_TYPE.NON_MENU: return {
|
|
348
|
-
...e,
|
|
349
|
-
path: e.path,
|
|
350
|
-
component: replaceComponent(e.component, e.meta?.scope),
|
|
351
|
-
meta: {
|
|
352
|
-
...e.meta,
|
|
353
|
-
sidebar: !1
|
|
354
|
-
}
|
|
355
|
-
};
|
|
356
|
-
default: return e;
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
function startsWithSlash(e) {
|
|
360
|
-
return e ? e.startsWith("/") ? e : `/${e}` : "/";
|
|
361
|
-
}
|
|
362
|
-
function replaceComponent(e, n) {
|
|
363
|
-
return setupPage(e, n);
|
|
364
|
-
}
|
|
365
|
-
function postSysconfigAddOrEditUserThemeStyleConfig(e, t) {
|
|
366
|
-
return basic.Post("/sysconfig/addOrEditUserThemeStyleConfig", e, {
|
|
367
|
-
headers: { "Content-Type": "application/json" },
|
|
368
|
-
...t || {}
|
|
369
|
-
});
|
|
370
|
-
}
|
|
371
|
-
function getSysconfigGetSysThemeStyleConfig(e) {
|
|
372
|
-
return basic.Get("/sysconfig/getSysThemeStyleConfig", { ...e || {} });
|
|
373
|
-
}
|
|
374
|
-
function getSysconfigGetThemeStyleConfig(e) {
|
|
375
|
-
return basic.Get("/sysconfig/getThemeStyleConfig", { ...e || {} });
|
|
376
|
-
}
|
|
377
|
-
function getSysconfigGetUserThemeStyleConfig(e) {
|
|
378
|
-
return basic.Get("/sysconfig/getUserThemeStyleConfig", { ...e || {} });
|
|
379
|
-
}
|
|
380
|
-
function postSysconfigResetUserThemeStyleConfig(e) {
|
|
381
|
-
return basic.Post("/sysconfig/resetUserThemeStyleConfig", {}, { ...e || {} });
|
|
382
|
-
}
|
|
383
|
-
var globalSettings = {
|
|
384
|
-
app: {
|
|
385
|
-
lightTheme: "classic",
|
|
386
|
-
darkTheme: "dark",
|
|
387
|
-
colorScheme: "light",
|
|
388
|
-
defaultLang: "zh-cn",
|
|
389
|
-
enablePermission: !0,
|
|
390
|
-
enableProgress: !0,
|
|
391
|
-
enableDynamicTitle: !0,
|
|
392
|
-
storagePrefix: "wsy_rbac",
|
|
393
|
-
enableUserPreferences: !0,
|
|
394
|
-
enableSettingPreferences: !0,
|
|
395
|
-
enableAppSetting: !0
|
|
396
|
-
},
|
|
397
|
-
home: {
|
|
398
|
-
enable: !1,
|
|
399
|
-
title: "主页"
|
|
400
|
-
},
|
|
401
|
-
layout: {
|
|
402
|
-
widthMode: "adaption",
|
|
403
|
-
enableMobileAdaptation: !1
|
|
404
|
-
},
|
|
405
|
-
menu: {
|
|
406
|
-
menuMode: "head",
|
|
407
|
-
isRounded: !0,
|
|
408
|
-
menuActiveStyle: "",
|
|
409
|
-
switchMainMenuAndPageJump: !0,
|
|
410
|
-
subMenuUniqueOpened: !0,
|
|
411
|
-
subMenuOnlyOneHide: !0,
|
|
412
|
-
subMenuCollapse: !1,
|
|
413
|
-
enableSubMenuCollapseButton: !0,
|
|
414
|
-
enableHotkeys: !1,
|
|
415
|
-
showWithoutPermission: !1
|
|
416
|
-
},
|
|
417
|
-
topbar: {
|
|
418
|
-
mode: "fixed",
|
|
419
|
-
switchTabbarAndToolbar: !1
|
|
420
|
-
},
|
|
421
|
-
tabbar: {
|
|
422
|
-
enable: !0,
|
|
423
|
-
style: "fashion",
|
|
424
|
-
enableIcon: !0,
|
|
425
|
-
mergeTabsBy: "activeMenu",
|
|
426
|
-
enableMemory: !0,
|
|
427
|
-
enableHotkeys: !0,
|
|
428
|
-
storageTo: "local"
|
|
429
|
-
},
|
|
430
|
-
toolbar: {
|
|
431
|
-
enableNotification: !0,
|
|
432
|
-
enableFullscreen: !0,
|
|
433
|
-
enablePageReload: !0,
|
|
434
|
-
enableColorScheme: !0
|
|
435
|
-
},
|
|
436
|
-
favorites: {
|
|
437
|
-
enable: !0,
|
|
438
|
-
storageTo: "local"
|
|
439
|
-
},
|
|
440
|
-
breadcrumb: {
|
|
441
|
-
enable: !0,
|
|
442
|
-
style: "",
|
|
443
|
-
enableMainMenu: !0
|
|
444
|
-
},
|
|
445
|
-
mainPage: {
|
|
446
|
-
enableHotkeys: !0,
|
|
447
|
-
iframeCacheMax: 3,
|
|
448
|
-
enableTransition: !0,
|
|
449
|
-
transitionMode: "fade"
|
|
450
|
-
},
|
|
451
|
-
navSearch: {
|
|
452
|
-
enable: !0,
|
|
453
|
-
enableHotkeys: !0
|
|
454
|
-
},
|
|
455
|
-
copyright: {
|
|
456
|
-
enable: !1,
|
|
457
|
-
dates: "2024-2025",
|
|
458
|
-
company: "浙江省公众信息产业有限公司",
|
|
459
|
-
website: "",
|
|
460
|
-
beian: ""
|
|
461
|
-
},
|
|
462
|
-
watermark: {
|
|
463
|
-
enable: !1,
|
|
464
|
-
text: "PUBINFO",
|
|
465
|
-
width: 150,
|
|
466
|
-
x: 0,
|
|
467
|
-
y: 0,
|
|
468
|
-
x_space: 50,
|
|
469
|
-
y_space: 50,
|
|
470
|
-
alpha: .1
|
|
471
|
-
}
|
|
472
|
-
};
|
|
473
|
-
function defineSettings(e) {
|
|
474
|
-
return globalSettings = defaultsDeep(e, globalSettings), e;
|
|
475
|
-
}
|
|
476
|
-
function getSettings() {
|
|
477
|
-
return globalSettings;
|
|
478
|
-
}
|
|
479
|
-
function objectToPaths(e, t = "") {
|
|
480
|
-
return reduce(e, (e, n, r) => {
|
|
481
|
-
let i = t.length ? `${t}.${r}` : r;
|
|
482
|
-
return isObject(n) && !isArray(n) && !isEmpty(n) ? e = e.concat(objectToPaths(n, i)) : e.push(i), e;
|
|
483
|
-
}, []);
|
|
484
|
-
}
|
|
485
|
-
var useSettingsStore = defineStore(STORE_NAME.SETTINGS, () => {
|
|
486
|
-
let e = getSettings(), t = ref(e), n = ref({}), r = ref(e), i = ref(!1);
|
|
487
|
-
watchDiffObject(r, (e) => {
|
|
488
|
-
if (!i.value) return;
|
|
489
|
-
let r = objectToPaths(e);
|
|
490
|
-
if (objectToPaths(n.value).includes(r.at(0))) {
|
|
491
|
-
if (storage.session.has("userSettingIsGod")) return;
|
|
492
|
-
Modal.confirm({
|
|
493
|
-
title: "系统设置提示",
|
|
494
|
-
icon: createVNode(FrownOutlined),
|
|
495
|
-
content: "当前设置被个人设置覆盖无法预览当前全局系统配置,是否需要恢复个人设置为系统默认设置",
|
|
496
|
-
okText: "重置个人配置",
|
|
497
|
-
cancelText: "不在提示",
|
|
498
|
-
onOk() {
|
|
499
|
-
W();
|
|
500
|
-
},
|
|
501
|
-
onCancel() {
|
|
502
|
-
storage.session.set("userSettingIsGod", "");
|
|
503
|
-
}
|
|
504
|
-
});
|
|
505
|
-
} else {
|
|
506
|
-
let n = get(e, r.at(0));
|
|
507
|
-
set(t.value, r.at(0), n);
|
|
508
|
-
}
|
|
509
|
-
}, { flush: "post" }), watch([
|
|
510
|
-
() => t.value.app.colorScheme,
|
|
511
|
-
() => t.value.app.lightTheme,
|
|
512
|
-
() => t.value.app.darkTheme
|
|
513
|
-
], ([e, t, n]) => {
|
|
514
|
-
switch (e === "" && (e = usePreferredDark() ? "dark" : "light"), e) {
|
|
515
|
-
case "light":
|
|
516
|
-
document.documentElement.classList.remove("dark"), document.body.setAttribute("data-theme", t);
|
|
517
|
-
break;
|
|
518
|
-
case "dark":
|
|
519
|
-
document.documentElement.classList.add("dark"), document.body.setAttribute("data-theme", n);
|
|
520
|
-
break;
|
|
521
|
-
}
|
|
522
|
-
}, { immediate: !0 }), watch(() => t.value.layout.widthMode, (e) => {
|
|
523
|
-
document.body.setAttribute("data-app-width-mode", e);
|
|
524
|
-
}, { immediate: !0 }), watch(() => t.value.menu.menuMode, (e) => {
|
|
525
|
-
document.body.setAttribute("data-menu-mode", e);
|
|
526
|
-
}, { immediate: !0 });
|
|
527
|
-
let o = ref("other"), s = navigator.userAgent.toLowerCase();
|
|
528
|
-
switch (!0) {
|
|
529
|
-
case s.includes("mac os"):
|
|
530
|
-
o.value = "mac";
|
|
531
|
-
break;
|
|
532
|
-
case s.includes("windows"):
|
|
533
|
-
o.value = "windows";
|
|
534
|
-
break;
|
|
535
|
-
case s.includes("linux"):
|
|
536
|
-
o.value = "linux";
|
|
537
|
-
break;
|
|
538
|
-
}
|
|
539
|
-
let c = ref();
|
|
540
|
-
function u(e) {
|
|
541
|
-
Array.isArray(e) ? (useWarn("在使用数据范围的时候,router auth字段不能为数组"), c.value = e[0] || "") : c.value = e;
|
|
542
|
-
}
|
|
543
|
-
let f = ref();
|
|
544
|
-
function h(e) {
|
|
545
|
-
f.value = e;
|
|
546
|
-
}
|
|
547
|
-
let _ = ref([]);
|
|
548
|
-
function y(e, t) {
|
|
549
|
-
let n = _.value.findIndex((t) => t.fullPath === e);
|
|
550
|
-
n > -1 ? _.value[n].title = t : _.value.push({
|
|
551
|
-
fullPath: e,
|
|
552
|
-
title: t
|
|
553
|
-
});
|
|
554
|
-
}
|
|
555
|
-
function b(e) {
|
|
556
|
-
let t = _.value.findIndex((t) => t.fullPath === e);
|
|
557
|
-
t > -1 && _.value.splice(t, 1);
|
|
558
|
-
}
|
|
559
|
-
let x = ref("pc");
|
|
560
|
-
function S(e) {
|
|
561
|
-
t.value.layout.enableMobileAdaptation ? /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ? x.value = "mobile" : x.value = e < 992 ? "mobile" : "pc" : x.value = "pc";
|
|
562
|
-
}
|
|
563
|
-
let C = ref(e.menu.subMenuCollapse);
|
|
564
|
-
function w() {
|
|
565
|
-
t.value.menu.subMenuCollapse = !t.value.menu.subMenuCollapse, x.value === "pc" && (C.value = !C.value);
|
|
566
|
-
}
|
|
567
|
-
watch(x, (e) => {
|
|
568
|
-
switch (e) {
|
|
569
|
-
case "pc":
|
|
570
|
-
t.value.menu.subMenuCollapse = C.value;
|
|
571
|
-
break;
|
|
572
|
-
case "mobile":
|
|
573
|
-
t.value.menu.subMenuCollapse = !0;
|
|
574
|
-
break;
|
|
575
|
-
}
|
|
576
|
-
document.body.setAttribute("data-mode", e);
|
|
577
|
-
}, { immediate: !0 });
|
|
578
|
-
function T(e) {
|
|
579
|
-
t.value.app.defaultLang = e;
|
|
580
|
-
}
|
|
581
|
-
function E(e) {
|
|
582
|
-
t.value.app.colorScheme = e;
|
|
583
|
-
}
|
|
584
|
-
let [D, O] = useToggle(!1);
|
|
585
|
-
function k(n, r = !1) {
|
|
586
|
-
t.value = defaultsDeep(n, r ? e : t.value);
|
|
587
|
-
}
|
|
588
|
-
function A(t) {
|
|
589
|
-
r.value = defaultsDeep(t, e);
|
|
590
|
-
}
|
|
591
|
-
function M(e) {
|
|
592
|
-
Object.keys(e).length > 0 ? n.value = defaultsDeep(e, cloneDeep(n.value)) : n.value = {};
|
|
593
|
-
}
|
|
594
|
-
function N(e = !0) {
|
|
595
|
-
i.value = e;
|
|
596
|
-
}
|
|
597
|
-
async function I() {
|
|
598
|
-
let e = (await getSysconfigGetThemeStyleConfig())?.data?.content;
|
|
599
|
-
e && k(JSON.parse(e || "{}"), !0);
|
|
600
|
-
}
|
|
601
|
-
async function L() {
|
|
602
|
-
let e = (await getSysconfigGetUserThemeStyleConfig())?.data?.content;
|
|
603
|
-
e && M(JSON.parse(e || "{}"));
|
|
604
|
-
}
|
|
605
|
-
async function V() {
|
|
606
|
-
let e = (await getSysconfigGetSysThemeStyleConfig())?.data?.content;
|
|
607
|
-
e && A(JSON.parse(e || "{}"));
|
|
608
|
-
}
|
|
609
|
-
async function H() {
|
|
610
|
-
await Promise.all([
|
|
611
|
-
I(),
|
|
612
|
-
V(),
|
|
613
|
-
L()
|
|
614
|
-
]), N(!0);
|
|
615
|
-
}
|
|
616
|
-
async function U(e) {
|
|
617
|
-
await postSysconfigAddOrEditUserThemeStyleConfig({ content: JSON.stringify(e) }), M(e);
|
|
618
|
-
}
|
|
619
|
-
async function W() {
|
|
620
|
-
await postSysconfigResetUserThemeStyleConfig(), await I(), await L(), Message.success("已还原系统设置");
|
|
621
|
-
}
|
|
622
|
-
return {
|
|
623
|
-
settings: t,
|
|
624
|
-
os: o,
|
|
625
|
-
auth: c,
|
|
626
|
-
setAuth: u,
|
|
627
|
-
title: f,
|
|
628
|
-
setTitle: h,
|
|
629
|
-
customTitleList: _,
|
|
630
|
-
setCustomTitle: y,
|
|
631
|
-
resetCustomTitle: b,
|
|
632
|
-
mode: x,
|
|
633
|
-
setMode: S,
|
|
634
|
-
subMenuCollapseLastStatus: C,
|
|
635
|
-
toggleSidebarCollapse: w,
|
|
636
|
-
setDefaultLang: T,
|
|
637
|
-
setColorScheme: E,
|
|
638
|
-
mainPageMaximizeStatus: D,
|
|
639
|
-
setMainPageMaximize: O,
|
|
640
|
-
updateSettings: k,
|
|
641
|
-
globalSettings: r,
|
|
642
|
-
updateGlobalSettings: A,
|
|
643
|
-
userSettings: n,
|
|
644
|
-
updateUserSettings: M,
|
|
645
|
-
setGlobaleSettingsFlag: N,
|
|
646
|
-
getPreferencesAll: H,
|
|
647
|
-
setPreferencesSetting: U,
|
|
648
|
-
resetSettings: W
|
|
649
|
-
};
|
|
650
|
-
}), useTabbarStore = defineStore(STORE_NAME.TABBAR, () => {
|
|
651
|
-
let e = useSettingsStore(), t = useRouteStore(), n = useKeepAliveStore(), r = useIframeStore(), i = ref([]), a = ref(-1);
|
|
652
|
-
function o() {
|
|
653
|
-
let n = [];
|
|
654
|
-
function r(t) {
|
|
655
|
-
t.children && t.children.forEach((t) => {
|
|
656
|
-
if (t.meta?.permanent && t.meta?.breadcrumbNeste && t.meta?.tabbar !== !1) {
|
|
657
|
-
let r = t.meta.breadcrumbNeste.at(-1)?.path, i = e.settings.tabbar.mergeTabsBy === "activeMenu" && t.meta.activeMenu || r;
|
|
658
|
-
n.push({
|
|
659
|
-
tabId: i,
|
|
660
|
-
fullPath: r,
|
|
661
|
-
routeName: t.name,
|
|
662
|
-
activeMenu: t.meta.activeMenu,
|
|
663
|
-
title: typeof t.meta.title == "function" ? t.meta.title() : t.meta.title,
|
|
664
|
-
iframe: t.meta.iframe,
|
|
665
|
-
icon: t.meta?.icon ?? t.meta?.breadcrumbNeste?.findLast((e) => e.icon)?.icon,
|
|
666
|
-
activeIcon: t.meta?.activeIcon ?? t.meta?.breadcrumbNeste?.findLast((e) => e.activeIcon)?.activeIcon,
|
|
667
|
-
name: t.name ? [t.name] : [],
|
|
668
|
-
customTitleList: [],
|
|
669
|
-
isPin: t.meta?.pin === void 0 ? !1 : t.meta?.pin,
|
|
670
|
-
isTabbar: t.meta?.tabbar !== !1,
|
|
671
|
-
isPermanent: !0
|
|
672
|
-
});
|
|
673
|
-
}
|
|
674
|
-
});
|
|
675
|
-
}
|
|
676
|
-
t.flatSystemRoutes.forEach(r), t.flatRoutes.forEach(r), n.length && i.value.unshift(...n);
|
|
677
|
-
}
|
|
678
|
-
async function s(t) {
|
|
679
|
-
let n = [];
|
|
680
|
-
t.matched.forEach((e, t) => {
|
|
681
|
-
t > 0 && e.components?.default.name && n.push(e.components.default.name);
|
|
682
|
-
});
|
|
683
|
-
let r = t.matched.at(-1)?.meta, o = e.settings.tabbar.mergeTabsBy === "activeMenu" ? r?.activeMenu ?? t.fullPath : t.fullPath;
|
|
684
|
-
if (t.name !== "Reload" && r?.tabbar !== !1) {
|
|
685
|
-
let s = i.value.find((n) => e.settings.tabbar.mergeTabsBy === "routeName" && n.routeName ? n.routeName === t.name : n.tabId === o);
|
|
686
|
-
if (s) e.settings.tabbar.mergeTabsBy !== "" && (s.tabId = o, s.fullPath = t.fullPath, s.routeName = t.name, s.activeMenu = r?.activeMenu, s.title = typeof r?.title == "function" ? r.title() : r?.title, s.iframe = r?.iframe, s.icon = r?.icon ?? r?.breadcrumbNeste?.findLast((e) => e.icon)?.icon, s.activeIcon = r?.activeIcon ?? r?.breadcrumbNeste?.findLast((e) => e.activeIcon)?.activeIcon, s.isTabbar = r?.tabbar !== !1);
|
|
687
|
-
else {
|
|
688
|
-
let e = {
|
|
689
|
-
tabId: o,
|
|
690
|
-
fullPath: t.fullPath,
|
|
691
|
-
routeName: t.name,
|
|
692
|
-
activeMenu: r?.activeMenu,
|
|
693
|
-
title: typeof r?.title == "function" ? r.title() : r?.title,
|
|
694
|
-
iframe: r?.iframe,
|
|
695
|
-
icon: r?.icon ?? r?.breadcrumbNeste?.findLast((e) => e.icon)?.icon,
|
|
696
|
-
activeIcon: r?.activeIcon ?? r?.breadcrumbNeste?.findLast((e) => e.activeIcon)?.activeIcon,
|
|
697
|
-
name: n,
|
|
698
|
-
customTitleList: [],
|
|
699
|
-
isPin: r?.pin === void 0 ? !1 : r?.pin,
|
|
700
|
-
isTabbar: r?.tabbar !== !1,
|
|
701
|
-
isPermanent: !1
|
|
702
|
-
};
|
|
703
|
-
a.value >= 0 ? (i.value.splice(a.value + 1, 0, e), a.value = -1) : i.value.push(e);
|
|
704
|
-
}
|
|
705
|
-
}
|
|
706
|
-
}
|
|
707
|
-
function c(e) {
|
|
708
|
-
let t = [], a = [], o = [];
|
|
709
|
-
i.value.forEach((n, r) => {
|
|
710
|
-
e(n, r) ? n.iframe ? o.push(n.tabId) : a.push(...n.name) : t.push(...n.name);
|
|
711
|
-
}), n.remove(a.filter((e) => !t.includes(e))), r.close(o);
|
|
712
|
-
}
|
|
713
|
-
function l(e) {
|
|
714
|
-
c((t) => t.tabId === e), i.value = i.value.filter((t) => t.tabId !== e);
|
|
715
|
-
}
|
|
716
|
-
function u(e) {
|
|
717
|
-
c((t) => t.tabId !== e && !t.isPermanent && !t.isPin), i.value = i.value.filter((t) => t.tabId === e || t.isPermanent || t.isPin);
|
|
718
|
-
}
|
|
719
|
-
function f(e) {
|
|
720
|
-
let t = i.value.findIndex((t) => t.tabId === e);
|
|
721
|
-
c((e, n) => n < t && !e.isPermanent && !e.isPin), i.value = i.value.filter((e, n) => n >= t || e.isPermanent || e.isPin);
|
|
722
|
-
}
|
|
723
|
-
function p(e) {
|
|
724
|
-
let t = i.value.findIndex((t) => t.tabId === e);
|
|
725
|
-
c((e, n) => n > t && !e.isPermanent && !e.isPin), i.value = i.value.filter((e, n) => n <= t || e.isPermanent || e.isPin);
|
|
726
|
-
}
|
|
727
|
-
function m(e) {
|
|
728
|
-
let t = i.value.findIndex((t) => t.tabId === e), n = -1;
|
|
729
|
-
i.value.forEach((e, t) => {
|
|
730
|
-
(e.isPermanent || e.isPin) && (n = t);
|
|
731
|
-
}), t > n && (i.value.splice(n + 1, 0, i.value[t]), i.value.splice(t + 1, 1)), i.value.forEach((t) => {
|
|
732
|
-
t.tabId === e && (t.isPin = !0);
|
|
733
|
-
});
|
|
734
|
-
}
|
|
735
|
-
function h(e) {
|
|
736
|
-
let t = i.value.findIndex((t) => t.tabId === e), n = -1;
|
|
737
|
-
i.value.forEach((e, t) => {
|
|
738
|
-
(e.isPermanent || e.isPin) && (n = t);
|
|
739
|
-
}), i.value.splice(n + 1, 0, i.value[t]), i.value.splice(t, 1), i.value.forEach((t) => {
|
|
740
|
-
t.tabId === e && (t.isPin = !1);
|
|
741
|
-
});
|
|
742
|
-
}
|
|
743
|
-
function g() {
|
|
744
|
-
i.value = [];
|
|
745
|
-
}
|
|
746
|
-
function _(e, t) {
|
|
747
|
-
i.value.splice(e, 0, i.value.splice(t, 1)[0]);
|
|
748
|
-
}
|
|
749
|
-
function v({ tabId: e, title: t }) {
|
|
750
|
-
i.value.forEach((n) => {
|
|
751
|
-
if (n.tabId === e) {
|
|
752
|
-
let e = n.customTitleList.find((e) => e.fullPath === n.fullPath);
|
|
753
|
-
e ? e.title = t : n.customTitleList.push({
|
|
754
|
-
fullPath: n.fullPath,
|
|
755
|
-
title: t
|
|
756
|
-
});
|
|
757
|
-
}
|
|
758
|
-
});
|
|
759
|
-
}
|
|
760
|
-
function y(e) {
|
|
761
|
-
i.value.forEach((t) => {
|
|
762
|
-
if (t.tabId === e) {
|
|
763
|
-
let e = t.customTitleList.findIndex((e) => e.fullPath === t.fullPath);
|
|
764
|
-
e > -1 && t.customTitleList.splice(e, 1);
|
|
765
|
-
}
|
|
766
|
-
});
|
|
767
|
-
}
|
|
768
|
-
return {
|
|
769
|
-
list: i,
|
|
770
|
-
leaveIndex: a,
|
|
771
|
-
initPermanentTab: o,
|
|
772
|
-
add: s,
|
|
773
|
-
remove: l,
|
|
774
|
-
removeOtherSide: u,
|
|
775
|
-
removeLeftSide: f,
|
|
776
|
-
removeRightSide: p,
|
|
777
|
-
pin: m,
|
|
778
|
-
unPin: h,
|
|
779
|
-
clean: g,
|
|
780
|
-
sort: _,
|
|
781
|
-
setCustomTitle: v,
|
|
782
|
-
resetCustomTitle: y
|
|
783
|
-
};
|
|
784
|
-
}), useUserStore = defineStore(STORE_NAME.USER, () => {
|
|
785
|
-
let { router: e } = usePubinfoContext(), t = reactive({
|
|
786
|
-
account: "",
|
|
787
|
-
userId: "",
|
|
788
|
-
token: "",
|
|
789
|
-
avatar: "",
|
|
790
|
-
refreshToken: "",
|
|
791
|
-
orgList: [],
|
|
792
|
-
orgId: "",
|
|
793
|
-
permissions: [],
|
|
794
|
-
department: ""
|
|
795
|
-
}), n = computed(() => !!t.token), r = computed(() => {
|
|
796
|
-
let e;
|
|
797
|
-
return e = t.orgId ? find(t.orgList, ["orgId", t.orgId])?.orgName : find(t.orgList, ["main", !0])?.orgName, e || "";
|
|
798
|
-
});
|
|
799
|
-
async function i(e) {
|
|
800
|
-
let { account: t, password: n, captchaHash: r, captchas: i, loginType: a = "password" } = e, o = await postAuthLogin({
|
|
801
|
-
loginType: a,
|
|
802
|
-
loginName: t,
|
|
803
|
-
loginPwd: await publicKeyEncryption(n),
|
|
804
|
-
codeHash: r,
|
|
805
|
-
code: i
|
|
806
|
-
}), { accessToken: s, refreshToken: c } = o.data;
|
|
807
|
-
return f(s, c), o;
|
|
808
|
-
}
|
|
809
|
-
async function a(e) {
|
|
810
|
-
let { account: t, password: n, captchaHash: r, captchas: i, loginType: a = "password", captchaType: o } = e, s = await postAuthLoginNew({
|
|
811
|
-
loginType: a,
|
|
812
|
-
loginName: t,
|
|
813
|
-
loginPwd: await publicKeyEncryption(n),
|
|
814
|
-
codeHash: r,
|
|
815
|
-
code: i,
|
|
816
|
-
captchaType: o
|
|
817
|
-
}), { accessToken: c, refreshToken: l } = s.data;
|
|
818
|
-
return f(c, l), s;
|
|
819
|
-
}
|
|
820
|
-
function o() {
|
|
821
|
-
e?.push({ name: "Login" });
|
|
822
|
-
}
|
|
823
|
-
function s() {
|
|
824
|
-
t.account = "", t.userId = "", t.token = "", t.refreshToken = "", t.avatar = "", t.permissions = [], t.orgId = "", t.orgList = [];
|
|
825
|
-
}
|
|
826
|
-
async function l() {
|
|
827
|
-
let e = await getRbacUserUserEntireInfo(), n = e.data;
|
|
828
|
-
return t.account = n.realName || n.loginName, t.avatar = n.userPic, t.userId = n.id, t.orgList = n.userOrgList, n.userOrgList?.length && !t.orgId && (t.orgId = find(n.userOrgList, ["main", !0]).orgId), e;
|
|
829
|
-
}
|
|
830
|
-
async function d(e) {
|
|
831
|
-
let t = {};
|
|
832
|
-
return e.token && (t.authorization = e.token), await putRbacUserChangePassword({
|
|
833
|
-
oldPassword: await publicKeyEncryption(e.oldPassword),
|
|
834
|
-
newPassword: await publicKeyEncryption(e.newPassword)
|
|
835
|
-
}, { headers: t });
|
|
836
|
-
}
|
|
837
|
-
function f(e, n) {
|
|
838
|
-
t.token = e, t.refreshToken = n;
|
|
839
|
-
}
|
|
840
|
-
async function p() {
|
|
841
|
-
return t.permissions = (await getRbacResourceGrantedResources()).data, t.permissions;
|
|
842
|
-
}
|
|
843
|
-
async function m(n) {
|
|
844
|
-
let { accessToken: r, refreshToken: i } = (await postAuthChangeLoginOrg({ orgId: n })).data;
|
|
845
|
-
f(r, i), t.orgId = n, e?.push({ path: "/" });
|
|
846
|
-
}
|
|
847
|
-
return {
|
|
848
|
-
user: t,
|
|
849
|
-
userOrgName: r,
|
|
850
|
-
isLogin: n,
|
|
851
|
-
getUserInfo: l,
|
|
852
|
-
getPermissions: p,
|
|
853
|
-
login: i,
|
|
854
|
-
signIn: a,
|
|
855
|
-
logout: o,
|
|
856
|
-
changePassword: d,
|
|
857
|
-
changeOrg: m,
|
|
858
|
-
setToken: f,
|
|
859
|
-
clean: s
|
|
860
|
-
};
|
|
861
|
-
}, { persist: !0 }), useRouteStore = defineStore(STORE_NAME.ROUTE, () => {
|
|
862
|
-
let e = getAsyncRoutes(), t = useSettingsStore(), n = useUserStore(), a = useTabbarStore(), o = ref(!1), s = ref([]), l = ref([]), u = ref([]), p = ref([]), g = computed(() => {
|
|
863
|
-
let { app: e, menu: n } = t.settings;
|
|
864
|
-
return e.enablePermission && !n.showWithoutPermission;
|
|
865
|
-
});
|
|
866
|
-
function _(e, t) {
|
|
867
|
-
let { title: n, icon: r, activeIcon: i, breadcrumb: a = !0 } = defaultTo(e.meta, {});
|
|
868
|
-
return {
|
|
869
|
-
path: defaultTo(t, e.path),
|
|
870
|
-
title: n,
|
|
871
|
-
icon: r,
|
|
872
|
-
activeIcon: i,
|
|
873
|
-
hide: !a
|
|
874
|
-
};
|
|
875
|
-
}
|
|
876
|
-
function x(e, t, n, r) {
|
|
877
|
-
let i = cloneDeep(r), a = _(e, t);
|
|
878
|
-
i.push(a);
|
|
879
|
-
function o(e) {
|
|
880
|
-
return has(e, "children") ? omit(e, "children") : e;
|
|
881
|
-
}
|
|
882
|
-
let s = {
|
|
883
|
-
path: t,
|
|
884
|
-
meta: {
|
|
885
|
-
auth: n,
|
|
886
|
-
breadcrumbNeste: i
|
|
887
|
-
}
|
|
888
|
-
};
|
|
889
|
-
return merge(o(cloneDeep(toRaw(e))), s);
|
|
890
|
-
}
|
|
891
|
-
function S(e) {
|
|
892
|
-
return e.children &&= C(e.children, [_(e)], e.path, e.meta?.auth), e;
|
|
893
|
-
}
|
|
894
|
-
function C(e, t = [], n = "", r) {
|
|
895
|
-
return toRaw(e).reduce((e, i) => {
|
|
896
|
-
let a = resolveRoutePath(n, i.path), o = defaultTo(i.meta?.auth, r), s = x(i, a, o, t);
|
|
897
|
-
return e.push(s), i.children && C(i.children, s?.meta?.breadcrumbNeste, a, o).forEach((t) => {
|
|
898
|
-
e.some((e) => e.path === t.path) ? e.forEach((n, r) => {
|
|
899
|
-
n.path === t.path && (e[r] = t);
|
|
900
|
-
}) : e.push(t);
|
|
901
|
-
}), e;
|
|
902
|
-
}, []);
|
|
903
|
-
}
|
|
904
|
-
let w = computed(() => {
|
|
905
|
-
let e = [];
|
|
906
|
-
return s.value.length && (s.value.forEach((t) => {
|
|
907
|
-
if (get(t, "meta.isDev", !1)) {
|
|
908
|
-
useWarn(`开发模式应用"${t.meta?.title}"的子路由将不会被注册到vue-router中`);
|
|
909
|
-
return;
|
|
910
|
-
}
|
|
911
|
-
if (t.children?.length) {
|
|
912
|
-
let n = cloneDeep(t.children);
|
|
913
|
-
n = n.map((e) => merge(e, { meta: { auth: defaultTo(e.meta?.auth, t.meta?.auth) } })), e.push(...n);
|
|
914
|
-
}
|
|
915
|
-
}), e.forEach((e) => S(e))), e;
|
|
916
|
-
}), k = computed(() => {
|
|
917
|
-
let e = [...getSystemRoutes()];
|
|
918
|
-
return e.forEach((e) => S(e)), e;
|
|
919
|
-
});
|
|
920
|
-
function A(e, t) {
|
|
921
|
-
if (isUndefined(t.meta?.auth)) return !0;
|
|
922
|
-
let n = t.meta.auth;
|
|
923
|
-
return toRaw(e).some((e) => isString(n) ? n === "" ? !0 : n === e : isArray(n) ? n.length === 0 ? !0 : n.includes(e) : (useWarn("路由权限类型配置错误, 请检查路由 meta.auth"), !1));
|
|
924
|
-
}
|
|
925
|
-
function j(e, t) {
|
|
926
|
-
let n = [];
|
|
927
|
-
return e.forEach((e) => {
|
|
928
|
-
if (A(t, e)) {
|
|
929
|
-
let r = cloneDeep(e);
|
|
930
|
-
r.children && r.children.length > 0 ? (r.children = j(r.children, t), (r.children.length || get(r, "meta.isDev", !1)) && n.push(r)) : (get(r, "meta.isDev", !1) && (r.children = []), n.push(r));
|
|
931
|
-
}
|
|
932
|
-
}), n;
|
|
933
|
-
}
|
|
934
|
-
let M = computed(() => g.value ? j(s.value, n?.user?.permissions ?? []) : cloneDeep(s.value));
|
|
935
|
-
function N(e) {
|
|
936
|
-
return e.map((e) => {
|
|
937
|
-
let t = setupDefaultLayout(e?.meta?.layoutComponent);
|
|
938
|
-
return e.children && e.children.length > 0 && e.children.forEach((n, r, i) => {
|
|
939
|
-
if (n.meta?.singleMenu) {
|
|
940
|
-
let { name: e, ...a } = n;
|
|
941
|
-
i[r] = {
|
|
942
|
-
...a,
|
|
943
|
-
component: t,
|
|
944
|
-
children: [{
|
|
945
|
-
path: "",
|
|
946
|
-
name: e,
|
|
947
|
-
component: n.component,
|
|
948
|
-
meta: {
|
|
949
|
-
title: n.meta.title,
|
|
950
|
-
sidebar: !1,
|
|
951
|
-
breadcrumb: !1
|
|
952
|
-
}
|
|
953
|
-
}]
|
|
954
|
-
}, delete i[r].meta.singleMenu;
|
|
955
|
-
}
|
|
956
|
-
n.component ||= t, e.meta?.provider && (n.meta = {
|
|
957
|
-
...n.meta,
|
|
958
|
-
provider: e.meta.provider
|
|
959
|
-
});
|
|
960
|
-
}), e;
|
|
961
|
-
}), e;
|
|
962
|
-
}
|
|
963
|
-
function P(e) {
|
|
964
|
-
return e.length ? e.filter((e) => (e.children && e.children.length > 0 && (e.children = P(e.children)), e?.meta?.enabled !== !1)) : [];
|
|
965
|
-
}
|
|
966
|
-
async function F() {
|
|
967
|
-
t.settings.app.enablePermission && await n.getPermissions();
|
|
968
|
-
let r = await postRbacResourceMineOrAllResourceTree({ needAll: !g.value });
|
|
969
|
-
if (r.success) {
|
|
970
|
-
l.value = r?.data ?? [];
|
|
971
|
-
let t = N(P(cloneDeep(e))), n = r.data?.map((e) => {
|
|
972
|
-
if (e.type === RESOURCE_TYPE.APP) {
|
|
973
|
-
let n = t.find((t) => t.meta?.auth === e.code);
|
|
974
|
-
return n && get(n, "meta.isDev", !1) && useWarn(`静态应用"${n.meta?.title}"处于开发模式,将在TopMode中显示开发状态`), n;
|
|
975
|
-
}
|
|
976
|
-
return e.type === RESOURCE_TYPE.DYNAMIC_APP ? (e.meta?.isDev && useWarn(`动态应用"${e.name}"处于开发模式,将在TopMode中显示开发状态`), formatBackRoutes([e])[0]) : !1;
|
|
977
|
-
}).filter((e) => !!e) ?? [], a = t.filter((e) => {
|
|
978
|
-
let { auth: t } = e.meta ?? {};
|
|
979
|
-
return isString(t) ? !r.data?.map((e) => e.code).includes(t) : !0;
|
|
980
|
-
});
|
|
981
|
-
s.value = await callHookAsync("route:transform", I([...n, ...a], r.data ?? []));
|
|
982
|
-
}
|
|
983
|
-
o.value = !0, t.settings.tabbar.enable && a.initPermanentTab();
|
|
984
|
-
}
|
|
985
|
-
function I(e, t) {
|
|
986
|
-
let n = new Map(t.map((e, t) => [e.code, t])), r = e.filter((e) => n.has(e.meta?.auth)), i = e.filter((e) => !n.has(e.meta?.auth));
|
|
987
|
-
return r.sort((e, t) => (n.get(e.meta.auth) ?? Infinity) - (n.get(t.meta.auth) ?? Infinity)), [...r, ...i];
|
|
988
|
-
}
|
|
989
|
-
function R(e) {
|
|
990
|
-
p.value = e;
|
|
991
|
-
}
|
|
992
|
-
function z(e = !1) {
|
|
993
|
-
o.value = !1, s.value = [], u.value = [], e ? p.value = p.value.filter((e) => e.system) : (p.value.forEach((e) => e()), p.value = []);
|
|
994
|
-
}
|
|
995
|
-
function B(e) {
|
|
996
|
-
let t = e ?? (typeof useRoute == "function" ? useRoute() : void 0);
|
|
997
|
-
if (!t) {
|
|
998
|
-
useWarn("getRemoteRouteById: 无法获取路由对象");
|
|
999
|
-
return;
|
|
1000
|
-
}
|
|
1001
|
-
let n = t.meta?.id;
|
|
1002
|
-
if (!n) {
|
|
1003
|
-
useWarn("getRemoteRouteById: 路由 meta 中未找到 id");
|
|
1004
|
-
return;
|
|
1005
|
-
}
|
|
1006
|
-
function r(e) {
|
|
1007
|
-
for (let t of e) {
|
|
1008
|
-
if (t.id === n) return t;
|
|
1009
|
-
if (t.children && t.children.length > 0) {
|
|
1010
|
-
let e = r(t.children);
|
|
1011
|
-
if (e) return e;
|
|
1012
|
-
}
|
|
1013
|
-
}
|
|
1014
|
-
}
|
|
1015
|
-
return r(l.value);
|
|
1016
|
-
}
|
|
1017
|
-
function V(e) {
|
|
1018
|
-
let t = e ?? (typeof useRoute == "function" ? useRoute() : void 0);
|
|
1019
|
-
if (!t) {
|
|
1020
|
-
useWarn("getRemoteAppRouteById: 无法获取路由对象");
|
|
1021
|
-
return;
|
|
1022
|
-
}
|
|
1023
|
-
let n = t.meta?.id;
|
|
1024
|
-
if (!n) {
|
|
1025
|
-
useWarn("getRemoteAppRouteById: 路由 meta 中未找到 id");
|
|
1026
|
-
return;
|
|
1027
|
-
}
|
|
1028
|
-
function r(e, t) {
|
|
1029
|
-
for (let i of e) {
|
|
1030
|
-
let e = i.type === RESOURCE_TYPE.APP || i.type === RESOURCE_TYPE.DYNAMIC_APP ? i : t;
|
|
1031
|
-
if (i.id === n) return e;
|
|
1032
|
-
if (i.children && i.children.length > 0) {
|
|
1033
|
-
let t = r(i.children, e);
|
|
1034
|
-
if (t) return t;
|
|
1035
|
-
}
|
|
1036
|
-
}
|
|
1037
|
-
}
|
|
1038
|
-
return r(l.value);
|
|
1039
|
-
}
|
|
1040
|
-
return {
|
|
1041
|
-
isGenerate: o,
|
|
1042
|
-
routes: M,
|
|
1043
|
-
currentRemoveRoutes: p,
|
|
1044
|
-
flatRoutes: w,
|
|
1045
|
-
flatSystemRoutes: k,
|
|
1046
|
-
remoteRoutesRaw: l,
|
|
1047
|
-
generateRoutes: F,
|
|
1048
|
-
setCurrentRemoveRoutes: R,
|
|
1049
|
-
removeRoutes: z,
|
|
1050
|
-
getRemoteRouteById: B,
|
|
1051
|
-
getRemoteAppRouteById: V
|
|
1052
|
-
};
|
|
1053
|
-
}), useMenuStore = defineStore(STORE_NAME.MENU, () => {
|
|
1054
|
-
let e = useSettingsStore(), t = useRouteStore(), n = ref([{
|
|
1055
|
-
meta: {},
|
|
1056
|
-
children: []
|
|
1057
|
-
}]), r = ref(0);
|
|
1058
|
-
function a(e = [], t = "") {
|
|
1059
|
-
return e.map((e) => (e.path = resolveRoutePath(t, e.path), e.children &&= a(e.children, e.path), e));
|
|
1060
|
-
}
|
|
1061
|
-
let o = computedAsync(async () => {
|
|
1062
|
-
let n = [{
|
|
1063
|
-
meta: {},
|
|
1064
|
-
children: []
|
|
1065
|
-
}];
|
|
1066
|
-
return e.settings.menu.menuMode === "single" ? (n[0].children = [], t.routes.forEach((e) => {
|
|
1067
|
-
get(e, "meta.isDev", !1) ? useWarn(`侧边栏模式(不含主导航)下省略${e.meta.title}的子集菜单,因为该菜单开启了isDev属性。`) : n[0].children?.push(...e.children);
|
|
1068
|
-
})) : n = t.routes, n.forEach((e) => a(e.children)), await callHookAsync("menu:transform", n);
|
|
1069
|
-
}, []), s = computed(() => {
|
|
1070
|
-
if (o.value.filter((e) => !get(e, "meta.isDev", !1)).length === 0) return [];
|
|
1071
|
-
for (;;) {
|
|
1072
|
-
let e = o.value[r.value];
|
|
1073
|
-
if (r.value >= o.value.length - 1 || e.children.length > 0 && !get(e, "meta.isDev", !1)) break;
|
|
1074
|
-
r.value++;
|
|
1075
|
-
}
|
|
1076
|
-
return o.value[r.value].children ?? [];
|
|
1077
|
-
}), l = computed(() => s.value.length > 0 ? u(s.value[0]) : "/");
|
|
1078
|
-
function u(e, t = "") {
|
|
1079
|
-
let n = "";
|
|
1080
|
-
if (e.children && e.children.length > 0) {
|
|
1081
|
-
let r = e.children.find((e) => e.meta?.sidebar !== !1);
|
|
1082
|
-
r ? n = u(r, resolveRoutePath(t, e.path)) : e.children.some((e) => e.meta?.sidebar !== !1 || e.children && e.children.length > 0) ? n = u(e.children[0], resolveRoutePath(t, e.path)) : (useWarn(`目录"${e.meta?.title || e.path}"下没有可显示的菜单项`), n = resolveRoutePath(t, e.path));
|
|
1083
|
-
} else n = resolveRoutePath(t, e.path);
|
|
1084
|
-
return n;
|
|
1085
|
-
}
|
|
1086
|
-
let f = computed(() => {
|
|
1087
|
-
let e = [];
|
|
1088
|
-
return o.value.forEach((t) => {
|
|
1089
|
-
e.push(...p(t.children));
|
|
1090
|
-
}), e;
|
|
1091
|
-
});
|
|
1092
|
-
function p(e = [], t = "") {
|
|
1093
|
-
let n = [];
|
|
1094
|
-
return e.forEach((e) => {
|
|
1095
|
-
if (e.meta?.defaultOpened && e.children) {
|
|
1096
|
-
n.push(resolveRoutePath(t, e.path));
|
|
1097
|
-
let r = p(e.children, resolveRoutePath(t, e.path));
|
|
1098
|
-
r.length > 0 && n.push(...r);
|
|
1099
|
-
}
|
|
1100
|
-
}), n;
|
|
1101
|
-
}
|
|
1102
|
-
function m(e) {
|
|
1103
|
-
if (isNumber(e)) r.value = e;
|
|
1104
|
-
else {
|
|
1105
|
-
let t = h(o.value, e);
|
|
1106
|
-
t >= 0 && (r.value = t);
|
|
1107
|
-
}
|
|
1108
|
-
}
|
|
1109
|
-
function h(e, t) {
|
|
1110
|
-
function n(e) {
|
|
1111
|
-
return match(e.path ?? "", { decode: decodeURIComponent })(t) ? !0 : e.children ? e.children.some((e) => n(e)) : !1;
|
|
1112
|
-
}
|
|
1113
|
-
for (let t = 0; t < e.length; t++) if (n(e[t])) return t;
|
|
1114
|
-
return 0;
|
|
1115
|
-
}
|
|
1116
|
-
return {
|
|
1117
|
-
menus: n,
|
|
1118
|
-
actived: r,
|
|
1119
|
-
allMenus: o,
|
|
1120
|
-
sidebarMenus: s,
|
|
1121
|
-
sidebarMenusFirstDeepestPath: l,
|
|
1122
|
-
defaultOpenedPaths: f,
|
|
1123
|
-
setActived: m
|
|
1124
|
-
};
|
|
1125
|
-
});
|
|
1126
|
-
function cleanup() {
|
|
1127
|
-
useUserStore().clean(), cleanupWithoutUser();
|
|
1128
|
-
}
|
|
1129
|
-
function cleanupWithoutUser() {
|
|
1130
|
-
useTabbarStore().clean(), useIframeStore().clean(), useRouteStore().removeRoutes(), useMenuStore().setActived(0);
|
|
1131
|
-
}
|
|
1132
|
-
function resolveRoutePath(e, t) {
|
|
1133
|
-
return e ? path.resolve(e, t ?? "") : t ?? "";
|
|
1134
|
-
}
|
|
1135
|
-
function wrapProxy(t, n) {
|
|
1136
|
-
return new Proxy({}, { get(r, i) {
|
|
1137
|
-
let a;
|
|
1138
|
-
try {
|
|
1139
|
-
a = t();
|
|
1140
|
-
} catch (t) {
|
|
1141
|
-
let r = getPersistedState("state");
|
|
1142
|
-
if (r && r[n]) {
|
|
1143
|
-
let e = r[n], t = e[i];
|
|
1144
|
-
return typeof t == "function" ? t.bind(e) : t;
|
|
1145
|
-
}
|
|
1146
|
-
throw t;
|
|
1147
|
-
}
|
|
1148
|
-
let o = a[n];
|
|
1149
|
-
if (!o) throw Error(`Instance "${String(n)}" has not been set. Please call createContext() before using "${String(i)}".`);
|
|
1150
|
-
let s = o[i];
|
|
1151
|
-
return typeof s == "function" ? s.bind(o) : s;
|
|
1152
|
-
} });
|
|
1153
|
-
}
|
|
1154
|
-
function compilePublicKey(e) {
|
|
1155
|
-
return template("-----BEGIN PUBLIC KEY-----\n<%= publickKey %>\n-----END PUBLIC KEY-----")({ publickKey: e });
|
|
1156
|
-
}
|
|
1157
|
-
async function getPublicKey() {
|
|
1158
|
-
return compilePublicKey((await getAuthLoginKey()).data ?? "");
|
|
1159
|
-
}
|
|
1160
|
-
async function publicKeyEncryption(e) {
|
|
1161
|
-
let t = await getPublicKey(), n = new JSEncrypt();
|
|
1162
|
-
return n.setPublicKey(t), n.encrypt(e);
|
|
1163
|
-
}
|
|
1164
|
-
function getStoragePrefix() {
|
|
1165
|
-
return getSettings()?.app?.storagePrefix;
|
|
1166
|
-
}
|
|
1167
|
-
const storage = {
|
|
1168
|
-
local: {
|
|
1169
|
-
has: (e) => Object.prototype.hasOwnProperty.call(localStorage, `${getStoragePrefix()}${e}`),
|
|
1170
|
-
get: (e) => localStorage.getItem(`${getStoragePrefix()}${e}`),
|
|
1171
|
-
set: (e, t) => {
|
|
1172
|
-
localStorage.setItem(`${getStoragePrefix()}${e}`, t);
|
|
1173
|
-
},
|
|
1174
|
-
remove: (e) => {
|
|
1175
|
-
localStorage.removeItem(`${getStoragePrefix()}${e}`);
|
|
1176
|
-
},
|
|
1177
|
-
clear: () => {
|
|
1178
|
-
localStorage.clear();
|
|
1179
|
-
},
|
|
1180
|
-
getItem: (e) => localStorage.getItem(`${getStoragePrefix()}${e}`),
|
|
1181
|
-
setItem: (e, t) => {
|
|
1182
|
-
localStorage.setItem(`${getStoragePrefix()}${e}`, t);
|
|
1183
|
-
}
|
|
1184
|
-
},
|
|
1185
|
-
session: {
|
|
1186
|
-
has: (e) => Object.prototype.hasOwnProperty.call(sessionStorage, `${getStoragePrefix()}${e}`),
|
|
1187
|
-
get: (e) => sessionStorage.getItem(`${getStoragePrefix()}${e}`),
|
|
1188
|
-
set: (e, t) => {
|
|
1189
|
-
sessionStorage.setItem(`${getStoragePrefix()}${e}`, t);
|
|
1190
|
-
},
|
|
1191
|
-
remove: (e) => {
|
|
1192
|
-
sessionStorage.removeItem(`${getStoragePrefix()}${e}`);
|
|
1193
|
-
},
|
|
1194
|
-
clear: () => {
|
|
1195
|
-
sessionStorage.clear();
|
|
1196
|
-
},
|
|
1197
|
-
getItem: (e) => sessionStorage.getItem(`${getStoragePrefix()}${e}`),
|
|
1198
|
-
setItem: (e, t) => {
|
|
1199
|
-
sessionStorage.setItem(`${getStoragePrefix()}${e}`, t);
|
|
1200
|
-
}
|
|
1201
|
-
}
|
|
1202
|
-
}, basic = wrapProxy(usePubinfoContext, "requestBasic"), auth = wrapProxy(usePubinfoContext, "requestAuth");
|
|
1203
|
-
function postAuthChangeLoginOrg(e, t) {
|
|
1204
|
-
return auth.Post("/auth/changeLoginOrg", {}, {
|
|
1205
|
-
params: { ...e },
|
|
1206
|
-
...t || {}
|
|
1207
|
-
});
|
|
1208
|
-
}
|
|
1209
|
-
function postAuthLogin(e, t) {
|
|
1210
|
-
return auth.Post("/auth/login", e, {
|
|
1211
|
-
headers: { "Content-Type": "application/json" },
|
|
1212
|
-
...t || {}
|
|
1213
|
-
});
|
|
1214
|
-
}
|
|
1215
|
-
function getAuthLoginKey(e) {
|
|
1216
|
-
return auth.Get("/auth/login/key", { ...e || {} });
|
|
1217
|
-
}
|
|
1218
|
-
function postAuthLoginNew(e, t) {
|
|
1219
|
-
return auth.Post("/auth/loginNew", e, {
|
|
1220
|
-
headers: { "Content-Type": "application/json" },
|
|
1221
|
-
...t || {}
|
|
1222
|
-
});
|
|
1223
|
-
}
|
|
1224
|
-
function postAuthTokenRefresh(e, t) {
|
|
1225
|
-
return auth.Post("/auth/token/refresh", {}, {
|
|
1226
|
-
params: { ...e },
|
|
1227
|
-
...t || {}
|
|
1228
|
-
});
|
|
1229
|
-
}
|
|
1230
|
-
export { useWarn as A, useKeepAliveStore as C, useInfo as D, useError as E, createPubinfoContext as F, useIframeStore as M, useFavoritesStore as N, useStart as O, STORE_NAME as P, getRbacUserUserEntireInfo as S, useBox as T, defineSystemRoutes as _, publicKeyEncryption as a, getAsyncRoutes as b, cleanup as c, useRouteStore as d, useUserStore as f, getSettings as g, defineSettings as h, storage as i, useAuth as j, useSuccess as k, cleanupWithoutUser as l, useSettingsStore as m, basic as n, wrapProxy as o, useTabbarStore as p, createRawContext as r, resolveRoutePath as s, postAuthTokenRefresh as t, useMenuStore as u, getSystemRoutes as v, useTheme as w, RESOURCE_TYPE as x, defineAsyncRoutes as y };
|