@morningfast/platform 0.0.6
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/assets/main/style.css +13 -0
- package/dist/assets/main.css +1 -0
- package/dist/assets/sub/style.css +1 -0
- package/dist/auth/index.d.ts +32 -0
- package/dist/auth.js +49 -0
- package/dist/chunks/Forbidden-gf6y5Zsh.js +30 -0
- package/dist/chunks/Login-rBkUOl6l.js +209 -0
- package/dist/chunks/MicroAppView-DqTrIZZa.js +249 -0
- package/dist/chunks/NotFound-D0ybyfbK.js +30 -0
- package/dist/chunks/SystemConfig-DxkDxCnC.js +194 -0
- package/dist/chunks/_plugin-vue_export-helper-DvRHjpsZ.js +8 -0
- package/dist/chunks/app-Cn5iHmfI.js +221 -0
- package/dist/chunks/application-config-0d6f-odq.js +287 -0
- package/dist/chunks/auth-C3RvRgcW.js +248 -0
- package/dist/chunks/config-DkMAgPn_.js +44 -0
- package/dist/chunks/main-CfTD1njJ.js +1798 -0
- package/dist/chunks/storage-DNllLr_D.js +18 -0
- package/dist/chunks/sub-DlD5e1ys.js +140 -0
- package/dist/chunks/system-BbMsTIBR.js +160 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +8 -0
- package/dist/main/api/adapter.d.ts +25 -0
- package/dist/main/api/auth.d.ts +12 -0
- package/dist/main/api/client.d.ts +3 -0
- package/dist/main/api/types.d.ts +1 -0
- package/dist/main/app/create-app.d.ts +29 -0
- package/dist/main/app/runtime-config.d.ts +5 -0
- package/dist/main/auth/expired.d.ts +2 -0
- package/dist/main/composables/useSortable.d.ts +197 -0
- package/dist/main/directives/index.d.ts +2 -0
- package/dist/main/index.d.ts +11 -0
- package/dist/main/layouts/AppLayout.vue.d.ts +3 -0
- package/dist/main/layouts/components/AppContentView.vue.d.ts +6 -0
- package/dist/main/layouts/components/AppHeader.vue.d.ts +7 -0
- package/dist/main/layouts/components/AppHeaderMenuNode.vue.d.ts +7 -0
- package/dist/main/layouts/components/AppMenuSearch.vue.d.ts +10 -0
- package/dist/main/layouts/components/AppMenuSearchItem.vue.d.ts +17 -0
- package/dist/main/layouts/components/AppMenuSearchTrigger.vue.d.ts +11 -0
- package/dist/main/layouts/components/AppSidebar.vue.d.ts +3 -0
- package/dist/main/layouts/components/AppSidebarNode.vue.d.ts +8 -0
- package/dist/main/layouts/components/AppSidebarSearch.vue.d.ts +11 -0
- package/dist/main/layouts/components/AppTabs.vue.d.ts +7 -0
- package/dist/main/layouts/components/AppTabsContextMenu.vue.d.ts +38 -0
- package/dist/main/layouts/composables/useAppMenus.d.ts +23 -0
- package/dist/main/layouts/composables/useShortcutLabel.d.ts +4 -0
- package/dist/main/layouts/utils/menuIcons.d.ts +1 -0
- package/dist/main/layouts/utils/menuSearch.d.ts +3 -0
- package/dist/main/micro-apps/config.d.ts +25 -0
- package/dist/main/micro-apps/register.d.ts +1 -0
- package/dist/main/micro-apps/status.d.ts +39 -0
- package/dist/main/micro-apps/types.d.ts +39 -0
- package/dist/main/pages/auth/Login.vue.d.ts +3 -0
- package/dist/main/pages/error/Forbidden.vue.d.ts +3 -0
- package/dist/main/pages/error/NotFound.vue.d.ts +3 -0
- package/dist/main/pages/micro/MicroAppView.vue.d.ts +3 -0
- package/dist/main/pages/system/SystemConfig.vue.d.ts +3 -0
- package/dist/main/pages/system/application-config/index.vue.d.ts +3 -0
- package/dist/main/router/base-routes.d.ts +2 -0
- package/dist/main/router/guard.d.ts +2 -0
- package/dist/main/router/index.d.ts +8 -0
- package/dist/main/settings/components/SystemSettingsDrawer.vue.d.ts +3 -0
- package/dist/main/settings/components/ThemeToggleButton.vue.d.ts +3 -0
- package/dist/main/settings/components/ThemedSvgImage.vue.d.ts +10 -0
- package/dist/main/stores/app.d.ts +85 -0
- package/dist/main/stores/auth.d.ts +110 -0
- package/dist/main/stores/index.d.ts +4 -0
- package/dist/main/stores/system.d.ts +111 -0
- package/dist/main/stores/tabs.d.ts +83 -0
- package/dist/main/utils/auth.d.ts +1 -0
- package/dist/main/utils/persistence.d.ts +3 -0
- package/dist/main/utils/storage.d.ts +3 -0
- package/dist/main/utils/theme.d.ts +20 -0
- package/dist/main.js +5 -0
- package/dist/micro-contract/index.d.ts +13 -0
- package/dist/micro-contract.js +4 -0
- package/dist/request/index.d.ts +72 -0
- package/dist/request.js +153 -0
- package/dist/sub/app/mount.d.ts +7 -0
- package/dist/sub/composables/useRequestClient.d.ts +5 -0
- package/dist/sub/composables/useSubAppContext.d.ts +1 -0
- package/dist/sub/context/sub-app-context.d.ts +10 -0
- package/dist/sub/index.d.ts +8 -0
- package/dist/sub/qiankun/index.d.ts +38 -0
- package/dist/sub/router/index.d.ts +2 -0
- package/dist/sub/theme/index.d.ts +2 -0
- package/dist/sub.js +2 -0
- package/package.json +86 -0
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
import { t as e } from "./app-Cn5iHmfI.js";
|
|
2
|
+
import { t } from "./_plugin-vue_export-helper-DvRHjpsZ.js";
|
|
3
|
+
import { n, o as r, r as i, t as a } from "./config-DkMAgPn_.js";
|
|
4
|
+
import { useRoute as o } from "vue-router";
|
|
5
|
+
import { computed as s, createBlock as c, createCommentVNode as l, createElementBlock as u, createElementVNode as d, createTextVNode as f, createVNode as p, defineComponent as m, nextTick as h, onBeforeUnmount as g, onMounted as ee, openBlock as _, reactive as v, ref as y, resolveComponent as b, toDisplayString as x, unref as S, watch as C, withCtx as w } from "vue";
|
|
6
|
+
import { Link as te, RefreshRight as T, WarningFilled as ne } from "@element-plus/icons-vue";
|
|
7
|
+
import { addGlobalUncaughtErrorHandler as E, registerMicroApps as D, start as O } from "qiankun";
|
|
8
|
+
//#region src/main/micro-apps/status.ts
|
|
9
|
+
var k = v({}), A = v({});
|
|
10
|
+
function j() {
|
|
11
|
+
return k;
|
|
12
|
+
}
|
|
13
|
+
function M(e) {
|
|
14
|
+
return A[e];
|
|
15
|
+
}
|
|
16
|
+
function N(e) {
|
|
17
|
+
return i(n()).find((t) => e === t.activeRule || e.startsWith(`${t.activeRule}/`));
|
|
18
|
+
}
|
|
19
|
+
function P(e) {
|
|
20
|
+
return k[e.name] || (k[e.name] = {
|
|
21
|
+
name: e.name,
|
|
22
|
+
title: e.title,
|
|
23
|
+
entry: e.entry,
|
|
24
|
+
activeRule: e.activeRule,
|
|
25
|
+
status: "idle",
|
|
26
|
+
updatedAt: Date.now()
|
|
27
|
+
}, k[e.name]);
|
|
28
|
+
}
|
|
29
|
+
function F(e) {
|
|
30
|
+
V(e, {
|
|
31
|
+
status: "loading",
|
|
32
|
+
message: void 0
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
function I(e) {
|
|
36
|
+
V(e, {
|
|
37
|
+
status: "mounted",
|
|
38
|
+
message: void 0
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
function L(e, t) {
|
|
42
|
+
H(e, {
|
|
43
|
+
status: "error",
|
|
44
|
+
message: U(t)
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
function R(e, t) {
|
|
48
|
+
let n = k[e];
|
|
49
|
+
return n ? (n.status = "error", n.message = U(t), n.updatedAt = Date.now(), !0) : !1;
|
|
50
|
+
}
|
|
51
|
+
function z(e, t, n) {
|
|
52
|
+
A[t] = {
|
|
53
|
+
path: t,
|
|
54
|
+
name: e.name,
|
|
55
|
+
title: e.title,
|
|
56
|
+
entry: e.entry,
|
|
57
|
+
activeRule: e.activeRule,
|
|
58
|
+
message: U(n),
|
|
59
|
+
updatedAt: Date.now()
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
function B(e) {
|
|
63
|
+
delete A[e];
|
|
64
|
+
}
|
|
65
|
+
function V(e, t) {
|
|
66
|
+
let n = k[e];
|
|
67
|
+
n && (n.status = t.status, n.message = t.message, n.updatedAt = Date.now());
|
|
68
|
+
}
|
|
69
|
+
function H(e, t) {
|
|
70
|
+
let n = P(e);
|
|
71
|
+
n.title = e.title, n.entry = e.entry, n.activeRule = e.activeRule, n.status = t.status, n.message = t.message, n.updatedAt = Date.now();
|
|
72
|
+
}
|
|
73
|
+
function U(e) {
|
|
74
|
+
let t = W(e);
|
|
75
|
+
return t ? G(t) : "子应用入口不可访问、服务未启动,或加载过程中发生异常。";
|
|
76
|
+
}
|
|
77
|
+
function W(e) {
|
|
78
|
+
return e instanceof Error ? e.message : typeof e == "string" ? e : "";
|
|
79
|
+
}
|
|
80
|
+
function G(e) {
|
|
81
|
+
return e.trim().replace(/^(application ['"][^'"]+['"] died in status [A-Z_]+:\s*)\1+/, "$1");
|
|
82
|
+
}
|
|
83
|
+
//#endregion
|
|
84
|
+
//#region src/main/micro-apps/types.ts
|
|
85
|
+
var K = "morningfast:theme-change", q = !1, J = !1;
|
|
86
|
+
function Y() {
|
|
87
|
+
if (q) {
|
|
88
|
+
X();
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
q = !0;
|
|
92
|
+
let e = i(n());
|
|
93
|
+
e.forEach(P), D(e.map((e) => ({
|
|
94
|
+
name: e.name,
|
|
95
|
+
entry: e.entry,
|
|
96
|
+
container: e.container,
|
|
97
|
+
activeRule: e.activeRule,
|
|
98
|
+
props: re(e)
|
|
99
|
+
})), {
|
|
100
|
+
beforeLoad: [async (e) => {
|
|
101
|
+
B(window.location.pathname), F(e.name);
|
|
102
|
+
}],
|
|
103
|
+
afterMount: [async (e) => {
|
|
104
|
+
B(window.location.pathname), I(e.name);
|
|
105
|
+
}]
|
|
106
|
+
}), E((t) => {
|
|
107
|
+
let n = t instanceof ErrorEvent ? t.error || t.message : t, r = Z(n) || Z(t);
|
|
108
|
+
if (r && R(r, n)) {
|
|
109
|
+
let t = e.find((e) => e.name === r);
|
|
110
|
+
t && z(t, window.location.pathname, n);
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
e.forEach((e) => {
|
|
114
|
+
(window.location.pathname === e.activeRule || window.location.pathname.startsWith(`${e.activeRule}/`)) && (L(e, n), z(e, window.location.pathname, n));
|
|
115
|
+
});
|
|
116
|
+
}), X(), ie();
|
|
117
|
+
}
|
|
118
|
+
function X() {
|
|
119
|
+
J || document.querySelector("#micro-app-container") && (J = !0, O({
|
|
120
|
+
prefetch: !1,
|
|
121
|
+
sandbox: { experimentalStyleIsolation: !0 },
|
|
122
|
+
urlRerouteOnly: !0
|
|
123
|
+
}));
|
|
124
|
+
}
|
|
125
|
+
function Z(e) {
|
|
126
|
+
return (e instanceof Error ? e.message : String(e || "")).match(/application ['"]?([^'"\s]+)['"]?/i)?.[1];
|
|
127
|
+
}
|
|
128
|
+
function re(t) {
|
|
129
|
+
let n = e();
|
|
130
|
+
return {
|
|
131
|
+
basePath: t.activeRule,
|
|
132
|
+
app: r(t),
|
|
133
|
+
runtime: {
|
|
134
|
+
env: "production",
|
|
135
|
+
apiBaseUrl: "/api"
|
|
136
|
+
},
|
|
137
|
+
theme: Q(n.isDark),
|
|
138
|
+
getRuntimeProps: () => ({ theme: Q(n.isDark) })
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
function ie() {
|
|
142
|
+
let t = e();
|
|
143
|
+
C(() => [
|
|
144
|
+
t.isDark,
|
|
145
|
+
t.themeColor,
|
|
146
|
+
t.themeColorPosition
|
|
147
|
+
], () => {
|
|
148
|
+
window.setTimeout(() => {
|
|
149
|
+
ae(Q(t.isDark));
|
|
150
|
+
}, 0);
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
function ae(e) {
|
|
154
|
+
window.dispatchEvent(new CustomEvent(K, { detail: e }));
|
|
155
|
+
}
|
|
156
|
+
function Q(e) {
|
|
157
|
+
let t = getComputedStyle(document.documentElement);
|
|
158
|
+
return {
|
|
159
|
+
colorPrimary: $(t, "--el-color-primary", "#409EFF"),
|
|
160
|
+
colorPrimaryLight3: $(t, "--el-color-primary-light-3", "#79bbff"),
|
|
161
|
+
colorPrimaryLight5: $(t, "--el-color-primary-light-5", "#a0cfff"),
|
|
162
|
+
colorPrimaryLight7: $(t, "--el-color-primary-light-7", "#c6e2ff"),
|
|
163
|
+
colorPrimaryLight8: $(t, "--el-color-primary-light-8", "#d9ecff"),
|
|
164
|
+
colorPrimaryLight9: $(t, "--el-color-primary-light-9", "#ecf5ff"),
|
|
165
|
+
colorPrimaryDark2: $(t, "--el-color-primary-dark-2", "#337ecc"),
|
|
166
|
+
mode: e ? "dark" : "light"
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
function $(e, t, n) {
|
|
170
|
+
return e.getPropertyValue(t).trim() || n;
|
|
171
|
+
}
|
|
172
|
+
//#endregion
|
|
173
|
+
//#region src/main/pages/micro/MicroAppView.vue?vue&type=script&setup=true&lang.ts
|
|
174
|
+
var oe = { class: "micro-app-page" }, se = {
|
|
175
|
+
key: 0,
|
|
176
|
+
class: "micro-app-page__state micro-app-page__state--error"
|
|
177
|
+
}, ce = { class: "micro-app-page__body" }, le = { class: "micro-app-page__desc" }, ue = { class: "micro-app-page__meta" }, de = { key: 0 }, fe = { key: 1 }, pe = { key: 2 }, me = { class: "micro-app-page__actions" }, he = ["id"], ge = /* @__PURE__ */ t(/* @__PURE__ */ m({
|
|
178
|
+
name: "MicroAppView",
|
|
179
|
+
__name: "MicroAppView",
|
|
180
|
+
setup(e) {
|
|
181
|
+
let t = o(), n = j(), r = y(""), i = null, m = s(() => N(t.path)), v = s(() => {
|
|
182
|
+
let e = m.value;
|
|
183
|
+
return e ? n[e.name] : void 0;
|
|
184
|
+
}), E = s(() => M(t.path)), D = s(() => v.value?.title || m.value?.title || E.value?.title || "未知子应用"), O = s(() => v.value?.entry || m.value?.entry || E.value?.entry || "-"), k = s(() => v.value?.message ? v.value.message : E.value?.message ? E.value.message : m.value ? "子应用暂时无法访问,请稍后重试。" : "当前路径没有匹配到子应用配置,请检查应用配置里的路由前缀。"), A = s(() => t.path.startsWith("/micro/")), P = s(() => v.value?.status === "error" || !!E.value || !!r.value || A.value && !m.value);
|
|
185
|
+
C(() => t.path, () => {
|
|
186
|
+
h(() => {
|
|
187
|
+
Y(), F();
|
|
188
|
+
});
|
|
189
|
+
}, { immediate: !0 }), ee(() => {
|
|
190
|
+
h(() => {
|
|
191
|
+
Y(), F();
|
|
192
|
+
});
|
|
193
|
+
}), C(() => v.value?.status, (e) => {
|
|
194
|
+
e === "mounted" && (I(), r.value = "");
|
|
195
|
+
}), g(() => {
|
|
196
|
+
I();
|
|
197
|
+
});
|
|
198
|
+
function F() {
|
|
199
|
+
I(), r.value = "", !(!A.value || !m.value) && (i = window.setTimeout(() => {
|
|
200
|
+
v.value?.status !== "mounted" && (r.value = "子应用暂时无法访问,请稍后重试。");
|
|
201
|
+
}, 15e3));
|
|
202
|
+
}
|
|
203
|
+
function I() {
|
|
204
|
+
i !== null && (window.clearTimeout(i), i = null);
|
|
205
|
+
}
|
|
206
|
+
function L() {
|
|
207
|
+
window.location.reload();
|
|
208
|
+
}
|
|
209
|
+
function R() {
|
|
210
|
+
let e = O.value;
|
|
211
|
+
e && e !== "-" && window.open(e, "_blank", "noopener,noreferrer");
|
|
212
|
+
}
|
|
213
|
+
return (e, t) => {
|
|
214
|
+
let n = b("el-icon"), i = b("el-button");
|
|
215
|
+
return _(), u("div", oe, [P.value ? (_(), u("div", se, [p(n, { class: "micro-app-page__icon" }, {
|
|
216
|
+
default: w(() => [p(S(ne))]),
|
|
217
|
+
_: 1
|
|
218
|
+
}), d("div", ce, [
|
|
219
|
+
t[6] ||= d("p", { class: "micro-app-page__title" }, "子应用加载失败", -1),
|
|
220
|
+
d("p", le, x(k.value), 1),
|
|
221
|
+
d("dl", ue, [
|
|
222
|
+
d("div", null, [t[0] ||= d("dt", null, "应用", -1), d("dd", null, x(D.value), 1)]),
|
|
223
|
+
S(!1) ? (_(), u("div", de, [t[1] ||= d("dt", null, "入口", -1), d("dd", null, x(O.value), 1)])) : l("", !0),
|
|
224
|
+
v.value?.message ? (_(), u("div", fe, [t[2] ||= d("dt", null, "原因", -1), d("dd", null, x(v.value.message), 1)])) : r.value ? (_(), u("div", pe, [t[3] ||= d("dt", null, "原因", -1), d("dd", null, x(r.value), 1)])) : l("", !0)
|
|
225
|
+
]),
|
|
226
|
+
d("div", me, [p(i, {
|
|
227
|
+
type: "primary",
|
|
228
|
+
icon: S(T),
|
|
229
|
+
onClick: L
|
|
230
|
+
}, {
|
|
231
|
+
default: w(() => [...t[4] ||= [f("重新加载", -1)]]),
|
|
232
|
+
_: 1
|
|
233
|
+
}, 8, ["icon"]), S(!1) && (v.value?.entry || m.value?.entry) ? (_(), c(i, {
|
|
234
|
+
key: 0,
|
|
235
|
+
icon: S(te),
|
|
236
|
+
onClick: R
|
|
237
|
+
}, {
|
|
238
|
+
default: w(() => [...t[5] ||= [f(" 打开入口 ", -1)]]),
|
|
239
|
+
_: 1
|
|
240
|
+
}, 8, ["icon"])) : l("", !0)])
|
|
241
|
+
])])) : l("", !0), d("section", {
|
|
242
|
+
id: S(a),
|
|
243
|
+
class: "micro-app-page__container"
|
|
244
|
+
}, null, 8, he)]);
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
}), [["__scopeId", "data-v-90c11f85"]]);
|
|
248
|
+
//#endregion
|
|
249
|
+
export { ge as default };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { useRouter as e } from "vue-router";
|
|
2
|
+
import { createElementBlock as t, createElementVNode as n, createStaticVNode as r, createTextVNode as i, createVNode as a, defineComponent as o, openBlock as s, resolveComponent as c, unref as l, withCtx as u } from "vue";
|
|
3
|
+
//#region src/main/pages/error/NotFound.vue?vue&type=script&setup=true&lang.ts
|
|
4
|
+
var d = { class: "result-page" }, f = { class: "result-page__panel" }, p = { class: "result-page__hero result-page__hero--info" }, m = { class: "result-page__body" }, h = { class: "result-page__actions" }, g = /* @__PURE__ */ o({
|
|
5
|
+
__name: "NotFound",
|
|
6
|
+
setup(o) {
|
|
7
|
+
let g = e();
|
|
8
|
+
return (e, o) => {
|
|
9
|
+
let _ = c("el-button");
|
|
10
|
+
return s(), t("div", d, [n("div", f, [n("div", p, [o[8] ||= r("<div class=\"result-page__visual\"><div class=\"result-page__grid\"></div><div class=\"result-page__halo result-page__halo--blue\"></div><div class=\"result-page__orb result-page__orb--blue\"><span>404</span></div><div class=\"result-page__badge\">路径未命中</div></div>", 1), n("div", m, [
|
|
11
|
+
o[4] ||= n("span", { class: "result-page__eyebrow" }, "ROUTE STATUS", -1),
|
|
12
|
+
o[5] ||= n("h1", null, "这个页面地址没有找到对应内容", -1),
|
|
13
|
+
o[6] ||= n("p", { class: "result-page__desc" }, " 访问的页面可能尚未配置、已经下线,或者当前地址有误。返回上一步通常就能回到正常流程。 ", -1),
|
|
14
|
+
o[7] ||= n("div", { class: "result-page__meta" }, [n("span", null, "状态码 404"), n("span", null, "未匹配到路由或页面资源")], -1),
|
|
15
|
+
n("div", h, [a(_, { onClick: o[0] ||= (e) => l(g).back() }, {
|
|
16
|
+
default: u(() => [...o[2] ||= [i("返回上一页", -1)]]),
|
|
17
|
+
_: 1
|
|
18
|
+
}), a(_, {
|
|
19
|
+
type: "primary",
|
|
20
|
+
onClick: o[1] ||= (e) => l(g).push("/dashboard")
|
|
21
|
+
}, {
|
|
22
|
+
default: u(() => [...o[3] ||= [i("返回工作台", -1)]]),
|
|
23
|
+
_: 1
|
|
24
|
+
})])
|
|
25
|
+
])]), o[9] ||= n("div", { class: "result-page__tips" }, [n("span", { class: "result-page__tips-label" }, "排查建议"), n("p", null, "检查菜单配置、页面路由地址,或确认当前环境是否已经发布这个功能页面。")], -1)])]);
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
//#endregion
|
|
30
|
+
export { g as default };
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { t as e } from "./system-BbMsTIBR.js";
|
|
2
|
+
import { t } from "./_plugin-vue_export-helper-DvRHjpsZ.js";
|
|
3
|
+
import { ElMessage as n } from "element-plus";
|
|
4
|
+
import { createElementBlock as r, createElementVNode as i, createTextVNode as a, createVNode as o, defineComponent as s, openBlock as c, reactive as l, ref as u, resolveComponent as d, watch as f, withCtx as p, withModifiers as m } from "vue";
|
|
5
|
+
//#region src/main/pages/system/SystemConfig.vue?vue&type=script&setup=true&lang.ts
|
|
6
|
+
var h = { class: "config-center page" }, g = { class: "config-center__content" }, _ = { class: "config-center__header" }, v = { class: "config-center__actions" }, y = { class: "config-center__asset-list" }, b = { class: "config-center__asset-row" }, x = { class: "config-center__asset-card" }, S = { class: "config-center__asset-preview config-center__asset-preview--icon" }, C = ["src"], w = { class: "config-center__asset-card" }, T = { class: "config-center__asset-preview config-center__asset-preview--wide" }, E = ["src", "alt"], D = { class: "config-center__asset-card" }, O = { class: "config-center__asset-preview config-center__asset-preview--square" }, k = ["src", "alt"], A = { class: "config-center__asset-card" }, j = { class: "config-center__asset-preview config-center__asset-preview--wide" }, M = ["src", "alt"], N = { class: "config-center__asset-card" }, P = { class: "config-center__asset-preview config-center__asset-preview--login" }, F = ["src"], I = /* @__PURE__ */ t(/* @__PURE__ */ s({
|
|
7
|
+
__name: "SystemConfig",
|
|
8
|
+
setup(t) {
|
|
9
|
+
let s = e(), I = u(!1), L = u(null), R = u("expanded"), z = l(B(s.config));
|
|
10
|
+
f(() => s.config, () => {
|
|
11
|
+
V();
|
|
12
|
+
}, { deep: !0 });
|
|
13
|
+
function B(e) {
|
|
14
|
+
return {
|
|
15
|
+
systemName: e.systemName,
|
|
16
|
+
logoExpanded: e.logoExpanded,
|
|
17
|
+
logoCollapsed: e.logoCollapsed,
|
|
18
|
+
logoHeader: e.logoHeader,
|
|
19
|
+
favicon: e.favicon,
|
|
20
|
+
loginBackground: e.loginBackground
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
function V() {
|
|
24
|
+
Object.assign(z, B(s.config));
|
|
25
|
+
}
|
|
26
|
+
function H() {
|
|
27
|
+
V(), n.success("已恢复当前保存内容");
|
|
28
|
+
}
|
|
29
|
+
function U(e) {
|
|
30
|
+
R.value = e, L.value?.click();
|
|
31
|
+
}
|
|
32
|
+
async function W(e) {
|
|
33
|
+
let t = e.target, r = t.files?.[0];
|
|
34
|
+
if (r) try {
|
|
35
|
+
let e = await K(r);
|
|
36
|
+
R.value === "expanded" ? z.logoExpanded = e : R.value === "collapsed" ? z.logoCollapsed = e : R.value === "header" ? z.logoHeader = e : R.value === "loginBackground" ? z.loginBackground = e : z.favicon = e, n.success("已更新草稿");
|
|
37
|
+
} catch {
|
|
38
|
+
n.error("上传失败,请重试");
|
|
39
|
+
} finally {
|
|
40
|
+
t.value = "";
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
async function G() {
|
|
44
|
+
I.value = !0;
|
|
45
|
+
try {
|
|
46
|
+
await s.saveSystemConfig({
|
|
47
|
+
systemName: z.systemName,
|
|
48
|
+
logoExpanded: z.logoExpanded,
|
|
49
|
+
logoCollapsed: z.logoCollapsed,
|
|
50
|
+
logoHeader: z.logoHeader,
|
|
51
|
+
favicon: z.favicon,
|
|
52
|
+
loginBackground: z.loginBackground
|
|
53
|
+
}), n.success("系统配置已保存");
|
|
54
|
+
} finally {
|
|
55
|
+
I.value = !1;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
function K(e) {
|
|
59
|
+
return new Promise((t, n) => {
|
|
60
|
+
let r = new FileReader();
|
|
61
|
+
r.onload = () => t(String(r.result || "")), r.onerror = () => n(/* @__PURE__ */ Error("Failed to read file")), r.readAsDataURL(e);
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
return (e, t) => {
|
|
65
|
+
let n = d("el-button"), s = d("el-input"), l = d("el-form-item"), u = d("el-form");
|
|
66
|
+
return c(), r("div", h, [i("section", g, [i("div", _, [i("div", v, [o(n, { onClick: H }, {
|
|
67
|
+
default: p(() => [...t[7] ||= [a("重置", -1)]]),
|
|
68
|
+
_: 1
|
|
69
|
+
}), o(n, {
|
|
70
|
+
type: "primary",
|
|
71
|
+
loading: I.value,
|
|
72
|
+
onClick: G
|
|
73
|
+
}, {
|
|
74
|
+
default: p(() => [...t[8] ||= [a("保存", -1)]]),
|
|
75
|
+
_: 1
|
|
76
|
+
}, 8, ["loading"])])]), o(u, {
|
|
77
|
+
class: "config-center__form",
|
|
78
|
+
"label-position": "left",
|
|
79
|
+
"label-width": "120px",
|
|
80
|
+
onSubmit: t[6] ||= m(() => {}, ["prevent"])
|
|
81
|
+
}, {
|
|
82
|
+
default: p(() => [o(l, {
|
|
83
|
+
label: "系统名称",
|
|
84
|
+
class: "config-center__item"
|
|
85
|
+
}, {
|
|
86
|
+
default: p(() => [o(s, {
|
|
87
|
+
modelValue: z.systemName,
|
|
88
|
+
"onUpdate:modelValue": t[0] ||= (e) => z.systemName = e,
|
|
89
|
+
placeholder: "请输入系统名称",
|
|
90
|
+
class: "config-center__field"
|
|
91
|
+
}, null, 8, ["modelValue"])]),
|
|
92
|
+
_: 1
|
|
93
|
+
}), i("div", y, [o(l, {
|
|
94
|
+
label: "图片资源",
|
|
95
|
+
class: "config-center__item config-center__item--assets"
|
|
96
|
+
}, {
|
|
97
|
+
default: p(() => [i("div", b, [
|
|
98
|
+
i("article", x, [
|
|
99
|
+
i("div", S, [i("img", {
|
|
100
|
+
src: z.favicon,
|
|
101
|
+
alt: "favicon",
|
|
102
|
+
class: "config-center__asset-image config-center__asset-image--icon"
|
|
103
|
+
}, null, 8, C)]),
|
|
104
|
+
t[10] ||= i("span", null, "Favicon", -1),
|
|
105
|
+
o(n, {
|
|
106
|
+
type: "primary",
|
|
107
|
+
plain: "",
|
|
108
|
+
onClick: t[1] ||= (e) => U("favicon")
|
|
109
|
+
}, {
|
|
110
|
+
default: p(() => [...t[9] ||= [a("上传", -1)]]),
|
|
111
|
+
_: 1
|
|
112
|
+
})
|
|
113
|
+
]),
|
|
114
|
+
i("article", w, [
|
|
115
|
+
i("div", T, [i("img", {
|
|
116
|
+
src: z.logoExpanded,
|
|
117
|
+
alt: z.systemName,
|
|
118
|
+
class: "config-center__asset-image"
|
|
119
|
+
}, null, 8, E)]),
|
|
120
|
+
t[12] ||= i("span", null, "展开 Logo", -1),
|
|
121
|
+
o(n, {
|
|
122
|
+
type: "primary",
|
|
123
|
+
plain: "",
|
|
124
|
+
onClick: t[2] ||= (e) => U("expanded")
|
|
125
|
+
}, {
|
|
126
|
+
default: p(() => [...t[11] ||= [a("上传", -1)]]),
|
|
127
|
+
_: 1
|
|
128
|
+
})
|
|
129
|
+
]),
|
|
130
|
+
i("article", D, [
|
|
131
|
+
i("div", O, [i("img", {
|
|
132
|
+
src: z.logoCollapsed,
|
|
133
|
+
alt: z.systemName,
|
|
134
|
+
class: "config-center__asset-image config-center__asset-image--icon"
|
|
135
|
+
}, null, 8, k)]),
|
|
136
|
+
t[14] ||= i("span", null, "折叠 Logo", -1),
|
|
137
|
+
o(n, {
|
|
138
|
+
type: "primary",
|
|
139
|
+
plain: "",
|
|
140
|
+
onClick: t[3] ||= (e) => U("collapsed")
|
|
141
|
+
}, {
|
|
142
|
+
default: p(() => [...t[13] ||= [a("上传", -1)]]),
|
|
143
|
+
_: 1
|
|
144
|
+
})
|
|
145
|
+
]),
|
|
146
|
+
i("article", A, [
|
|
147
|
+
i("div", j, [i("img", {
|
|
148
|
+
src: z.logoHeader,
|
|
149
|
+
alt: z.systemName,
|
|
150
|
+
class: "config-center__asset-image"
|
|
151
|
+
}, null, 8, M)]),
|
|
152
|
+
t[16] ||= i("span", null, "白色 Logo", -1),
|
|
153
|
+
o(n, {
|
|
154
|
+
type: "primary",
|
|
155
|
+
plain: "",
|
|
156
|
+
onClick: t[4] ||= (e) => U("header")
|
|
157
|
+
}, {
|
|
158
|
+
default: p(() => [...t[15] ||= [a("上传", -1)]]),
|
|
159
|
+
_: 1
|
|
160
|
+
})
|
|
161
|
+
]),
|
|
162
|
+
i("article", N, [
|
|
163
|
+
i("div", P, [i("img", {
|
|
164
|
+
src: z.loginBackground,
|
|
165
|
+
alt: "登录页背景",
|
|
166
|
+
class: "config-center__asset-image"
|
|
167
|
+
}, null, 8, F)]),
|
|
168
|
+
t[18] ||= i("span", null, "登录背景图", -1),
|
|
169
|
+
o(n, {
|
|
170
|
+
type: "primary",
|
|
171
|
+
plain: "",
|
|
172
|
+
onClick: t[5] ||= (e) => U("loginBackground")
|
|
173
|
+
}, {
|
|
174
|
+
default: p(() => [...t[17] ||= [a("上传", -1)]]),
|
|
175
|
+
_: 1
|
|
176
|
+
})
|
|
177
|
+
])
|
|
178
|
+
])]),
|
|
179
|
+
_: 1
|
|
180
|
+
})])]),
|
|
181
|
+
_: 1
|
|
182
|
+
})]), i("input", {
|
|
183
|
+
ref_key: "fileInput",
|
|
184
|
+
ref: L,
|
|
185
|
+
type: "file",
|
|
186
|
+
accept: "image/*",
|
|
187
|
+
class: "config-center__file",
|
|
188
|
+
onChange: W
|
|
189
|
+
}, null, 544)]);
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
}), [["__scopeId", "data-v-5d22ada6"]]);
|
|
193
|
+
//#endregion
|
|
194
|
+
export { I as default };
|