ss-component-new 1.3.659 → 1.3.660

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,1084 +0,0 @@
1
- import { createElementBlock as D, openBlock as $, createElementVNode as r, renderSlot as N, defineComponent as X, ref as U, resolveComponent as k, createVNode as a, withCtx as s, unref as B, reactive as ne, computed as Z, onMounted as _e, createBlock as ee, resolveDirective as Le, createCommentVNode as le, withDirectives as $e, normalizeClass as re, toDisplayString as S, Transition as Ie, watch as j, Fragment as qe, createTextVNode as P, onBeforeUnmount as Fe } from "vue";
2
- import { _ as H, a as z, p as K, s as se, b as te, c as Ae, d as De, f as Se, e as ce, E as ie, g as be, h as Ne, l as xe, i as Re, j as Me, u as Pe, k as Ee, m as Oe, v as Be } from "./platform-BsULsE0-.js";
3
- import { useRouter as je } from "vue-router";
4
- const Ke = {}, He = { class: "left-wrap" }, ze = { class: "left-bg" };
5
- function Qe(f, _) {
6
- return $(), D("div", He, [
7
- r("div", ze, [
8
- N(f.$slots, "img", {}, void 0, !0)
9
- ])
10
- ]);
11
- }
12
- const We = /* @__PURE__ */ H(Ke, [["render", Qe], ["__scopeId", "data-v-b3dd4a82"]]), ae = {
13
- ACCOUNT: "account",
14
- FACE: "face"
15
- }, Je = { class: "right-wrap" }, Xe = { class: "tab-content" }, Ge = { class: "tab-tips" }, Ye = { class: "tab-content" }, Ze = { class: "tab-tips" }, et = /* @__PURE__ */ X({
16
- __name: "index",
17
- props: {
18
- tabList: {
19
- type: Array,
20
- default: []
21
- },
22
- loading: {
23
- type: Boolean,
24
- default: !1
25
- }
26
- },
27
- emits: ["clickLogin", "handleTabChange"],
28
- setup(f, { emit: _ }) {
29
- const c = U(ae.ACCOUNT), l = _, C = () => {
30
- l("clickLogin", c.value);
31
- }, e = (m) => {
32
- l("handleTabChange", m);
33
- };
34
- return (m, w) => {
35
- const u = k("el-button"), v = k("el-tab-pane"), h = k("el-tabs");
36
- return $(), D("div", Je, [
37
- a(h, {
38
- modelValue: c.value,
39
- "onUpdate:modelValue": w[0] || (w[0] = (b) => c.value = b),
40
- class: "right-tabs",
41
- onTabChange: e
42
- }, {
43
- default: s(() => [
44
- a(v, {
45
- name: B(ae).ACCOUNT
46
- }, {
47
- label: s(() => [
48
- N(m.$slots, "tabLabel1", {}, void 0, !0)
49
- ]),
50
- default: s(() => [
51
- r("div", Xe, [
52
- N(m.$slots, "tabContent1", {}, void 0, !0)
53
- ]),
54
- r("div", {
55
- class: "tab-button special",
56
- onClick: C
57
- }, [
58
- a(u, { loading: f.loading }, {
59
- default: s(() => [
60
- N(m.$slots, "tabButton1", {}, void 0, !0)
61
- ]),
62
- _: 3
63
- }, 8, ["loading"])
64
- ]),
65
- r("div", Ge, [
66
- N(m.$slots, "tabTips1", {}, void 0, !0)
67
- ])
68
- ]),
69
- _: 3
70
- }, 8, ["name"]),
71
- a(v, {
72
- name: B(ae).FACE
73
- }, {
74
- label: s(() => [
75
- N(m.$slots, "tabLabel2", {}, void 0, !0)
76
- ]),
77
- default: s(() => [
78
- r("div", Ye, [
79
- N(m.$slots, "tabContent2", {}, void 0, !0)
80
- ]),
81
- r("div", Ze, [
82
- N(m.$slots, "tabTips2", {}, void 0, !0)
83
- ])
84
- ]),
85
- _: 3
86
- }, 8, ["name"])
87
- ]),
88
- _: 3
89
- }, 8, ["modelValue"])
90
- ]);
91
- };
92
- }
93
- }), tt = /* @__PURE__ */ H(et, [["__scopeId", "data-v-57780a32"]]), at = /^[a-z][a-z0-9+.-]*:\/\//i, ue = (f) => at.test(f);
94
- function st(f) {
95
- ue(f) || (f = `http://${f}`);
96
- try {
97
- const _ = new URL(f);
98
- return {
99
- host: _.hostname,
100
- // 域名:example.com
101
- port: _.port || null
102
- // 端口:8080(默认端口返回空字符串,转为 null)
103
- };
104
- } catch {
105
- return {
106
- host: null,
107
- port: null
108
- };
109
- }
110
- }
111
- const ot = () => ({ initUrlInfo: () => ({
112
- host: null,
113
- port: null
114
- }), hasProtocol: ue, generateUrl: (c) => {
115
- const { host: l, port: C } = c;
116
- if (!l)
117
- return null;
118
- let e = `${l}`;
119
- return ue(l) || (e = `http://${e}`), C && (e = `${e}:${C}`), e;
120
- } }), lt = { class: "body-wrapper" }, nt = { class: "api-form-wrapper" }, it = { class: "edit-footer" }, rt = { class: "footer-right" }, ct = /* @__PURE__ */ X({
121
- __name: "index",
122
- emits: ["updateApiUrl"],
123
- setup(f, { expose: _, emit: c }) {
124
- const l = c, C = z(K), { systemUrl: e } = se(C), { initUrlInfo: m, generateUrl: w } = ot(), u = U(m()), v = U(), h = ne({
125
- host: [
126
- { required: !0, message: "请输入职位名称", trigger: "blur" }
127
- ]
128
- }), b = Z(() => e.value || "http://222.92.178.198:63003"), i = () => {
129
- u.value = st(b.value);
130
- };
131
- _e(() => {
132
- i();
133
- });
134
- const t = U(!1), o = () => {
135
- i(), t.value = !0;
136
- }, p = () => {
137
- t.value = !1;
138
- }, g = () => {
139
- p();
140
- }, I = async () => {
141
- var y;
142
- await ((y = v.value) == null ? void 0 : y.validate());
143
- const L = w(u.value);
144
- l("updateApiUrl", L), g();
145
- };
146
- return _({
147
- openDialog: o,
148
- handleClose: g
149
- }), (L, y) => {
150
- const d = k("el-input"), V = k("el-form-item"), F = k("el-col"), x = k("el-row"), Q = k("el-form"), G = k("el-dialog");
151
- return $(), ee(G, {
152
- class: "api-form-dialog",
153
- modelValue: t.value,
154
- "onUpdate:modelValue": y[2] || (y[2] = (M) => t.value = M),
155
- "before-close": g,
156
- "destroy-on-close": "",
157
- "show-close": !1
158
- }, {
159
- header: s(() => y[3] || (y[3] = [])),
160
- default: s(() => [
161
- r("div", lt, [
162
- r("div", nt, [
163
- a(Q, {
164
- class: "api-edit-form",
165
- ref_key: "apiFormRef",
166
- ref: v,
167
- model: u.value,
168
- rules: h
169
- }, {
170
- default: s(() => [
171
- a(x, { gutter: 20 }, {
172
- default: s(() => [
173
- a(F, { span: 12 }, {
174
- default: s(() => [
175
- a(V, {
176
- prop: "host",
177
- label: "主机名",
178
- "label-position": "top"
179
- }, {
180
- default: s(() => [
181
- a(d, {
182
- modelValue: u.value.host,
183
- "onUpdate:modelValue": y[0] || (y[0] = (M) => u.value.host = M),
184
- "aria-label": "主机名",
185
- placeholder: "主机名"
186
- }, null, 8, ["modelValue"])
187
- ]),
188
- _: 1
189
- })
190
- ]),
191
- _: 1
192
- }),
193
- a(F, { span: 12 }, {
194
- default: s(() => [
195
- a(V, {
196
- prop: "port",
197
- label: "端口",
198
- "label-position": "top"
199
- }, {
200
- default: s(() => [
201
- a(d, {
202
- modelValue: u.value.port,
203
- "onUpdate:modelValue": y[1] || (y[1] = (M) => u.value.port = M),
204
- "aria-label": "端口",
205
- placeholder: "端口"
206
- }, null, 8, ["modelValue"])
207
- ]),
208
- _: 1
209
- })
210
- ]),
211
- _: 1
212
- })
213
- ]),
214
- _: 1
215
- })
216
- ]),
217
- _: 1
218
- }, 8, ["model", "rules"])
219
- ])
220
- ])
221
- ]),
222
- footer: s(() => [
223
- r("div", it, [
224
- y[4] || (y[4] = r("div", { class: "footer-left" }, null, -1)),
225
- r("div", rt, [
226
- a(te, {
227
- class: "cancel",
228
- emptyColor: !0,
229
- onClickTrigger: g,
230
- modelValue: "取消",
231
- buttonType: "info"
232
- }),
233
- a(te, {
234
- class: "confirm",
235
- emptyColor: !0,
236
- onClickTrigger: I,
237
- modelValue: "确定",
238
- buttonType: "primary"
239
- })
240
- ])
241
- ])
242
- ]),
243
- _: 1
244
- }, 8, ["modelValue"]);
245
- };
246
- }
247
- }), ut = /* @__PURE__ */ H(ct, [["__scopeId", "data-v-a0901fa1"]]), dt = { class: "dialog-header" }, pt = { class: "dialog-subtitle" }, mt = {
248
- key: 0,
249
- class: "restart-panel"
250
- }, ft = { class: "restart-title" }, vt = { class: "restart-subtitle" }, gt = {
251
- key: 1,
252
- class: "dialog-body"
253
- }, _t = { class: "db-type-selector" }, bt = { key: "sqlite" }, yt = { key: "pgsql" }, ht = {
254
- key: 0,
255
- class: "dialog-footer"
256
- }, wt = 6e4, fe = 2e3, Ct = /* @__PURE__ */ X({
257
- __name: "index",
258
- setup(f, { expose: _ }) {
259
- const c = z(K), { systemUrl: l } = se(c), C = Z(() => l.value || "http://222.92.178.198:63003"), e = ne({
260
- databaseType: "sqlite",
261
- sqliteDir: "sqlite-data",
262
- user: "",
263
- host: "",
264
- database: "",
265
- password: "",
266
- port: "5432"
267
- }), m = Z(() => e.databaseType === "sqlite" ? {
268
- sqliteDir: [{ required: !0, message: "请输入数据库目录", trigger: "blur" }]
269
- } : {
270
- host: [{ required: !0, message: "请输入主机地址", trigger: "blur" }],
271
- port: [{ required: !0, message: "请输入端口号", trigger: "blur" }],
272
- database: [{ required: !0, message: "请输入数据库名", trigger: "blur" }],
273
- user: [{ required: !0, message: "请输入用户名", trigger: "blur" }]
274
- }), w = U(null), u = U(!1), v = U(!1), h = U(!1), b = U(!1), i = U(0), t = U("running"), o = U(1);
275
- let p = null;
276
- const g = Z(() => t.value === "success" ? "重启成功!" : t.value === "timeout" ? "连接超时" : "正在应用配置并等待服务重新启动中..."), I = Z(() => t.value === "success" ? "服务已恢复,配置已生效" : t.value === "timeout" ? "超过最大等待时间,请手动检查服务状态" : "请稍后" + ".".repeat(o.value));
277
- let L = null, y = null;
278
- const d = () => {
279
- p && (clearInterval(p), p = null);
280
- }, V = () => {
281
- L && (clearInterval(L), L = null), y && (clearInterval(y), y = null), d();
282
- }, F = () => {
283
- i.value = 0;
284
- let T = 0;
285
- L = setInterval(() => {
286
- T += 100;
287
- const n = 90 * (1 - Math.exp(-T / 8e3));
288
- i.value = Math.min(parseFloat(n.toFixed(1)), 90);
289
- }, 100);
290
- }, x = () => {
291
- o.value = 1, p = setInterval(() => {
292
- o.value = o.value >= 3 ? 1 : o.value + 1;
293
- }, 500);
294
- }, Q = () => {
295
- d();
296
- const T = setInterval(() => {
297
- i.value = Math.min(i.value + 3, 100), i.value >= 100 && (clearInterval(T), t.value = "success");
298
- }, 30);
299
- }, G = () => {
300
- let T = 0;
301
- y = setInterval(async () => {
302
- if (T += fe, T >= wt) {
303
- V(), t.value = "timeout";
304
- return;
305
- }
306
- try {
307
- const { data: n } = await ce.get(C.value + "/platform/config/db", { timeout: 3e3 });
308
- (n == null ? void 0 : n.code) === 200 && (V(), Q());
309
- } catch {
310
- }
311
- }, fe);
312
- }, M = async () => {
313
- try {
314
- v.value = !0;
315
- const { data: T } = await ce.get(C.value + "/platform/config/db");
316
- if ((T == null ? void 0 : T.code) === 200 && (T != null && T.data)) {
317
- const n = T.data;
318
- e.databaseType = n.databaseType === "pgsql" ? "pgsql" : "sqlite", e.sqliteDir = n.sqliteDir || "sqlite-data", e.user = n.user || "", e.host = n.host || "", e.database = n.database || "", e.password = n.password || "", e.port = String(n.port || 5432);
319
- }
320
- } catch {
321
- } finally {
322
- v.value = !1;
323
- }
324
- }, we = () => {
325
- b.value = !1, t.value = "running", i.value = 0, o.value = 1, u.value = !0, M();
326
- }, de = () => {
327
- V(), u.value = !1;
328
- }, pe = () => de(), Ce = (T) => {
329
- b.value || T();
330
- }, Te = async () => {
331
- var T, n, W;
332
- await ((T = w.value) == null ? void 0 : T.validate());
333
- try {
334
- h.value = !0;
335
- const A = { databaseType: e.databaseType };
336
- e.databaseType === "sqlite" ? A.sqliteDir = e.sqliteDir.trim() : (A.user = e.user.trim(), A.host = e.host.trim(), A.database = e.database.trim(), A.password = e.password, A.port = Number(e.port)), await ce.post(C.value + "/platform/config/db", A), b.value = !0, t.value = "running", F(), x(), setTimeout(G, 1e3);
337
- } catch (A) {
338
- const R = ((W = (n = A == null ? void 0 : A.response) == null ? void 0 : n.data) == null ? void 0 : W.message) || "保存失败,请重试";
339
- ie.error(R);
340
- } finally {
341
- h.value = !1;
342
- }
343
- };
344
- return _({ openDialog: we, handleClose: pe }), (T, n) => {
345
- const W = k("el-icon"), A = k("el-progress"), R = k("el-input"), J = k("el-form-item"), oe = k("el-col"), me = k("el-row"), Ue = k("el-form"), ke = k("el-dialog"), Ve = Le("loading");
346
- return $(), ee(ke, {
347
- class: "db-config-dialog",
348
- modelValue: u.value,
349
- "onUpdate:modelValue": n[8] || (n[8] = (q) => u.value = q),
350
- "before-close": Ce,
351
- "close-on-click-modal": !b.value,
352
- "close-on-press-escape": !b.value,
353
- "destroy-on-close": "",
354
- "show-close": !1,
355
- width: "480px"
356
- }, {
357
- header: s(() => [
358
- r("div", dt, [
359
- n[9] || (n[9] = r("span", { class: "dialog-title" }, "数据库配置", -1)),
360
- r("span", pt, S(b.value ? "" : "修改后服务将自动重启"), 1)
361
- ])
362
- ]),
363
- default: s(() => [
364
- b.value ? ($(), D("div", mt, [
365
- t.value !== "running" ? ($(), D("div", {
366
- key: 0,
367
- class: re(["restart-icon-wrap", { success: t.value === "success", error: t.value === "timeout" }])
368
- }, [
369
- t.value === "success" ? ($(), ee(W, {
370
- key: 0,
371
- class: "restart-icon"
372
- }, {
373
- default: s(() => [
374
- a(B(Ae))
375
- ]),
376
- _: 1
377
- })) : ($(), ee(W, {
378
- key: 1,
379
- class: "restart-icon"
380
- }, {
381
- default: s(() => [
382
- a(B(De))
383
- ]),
384
- _: 1
385
- }))
386
- ], 2)) : le("", !0),
387
- r("div", ft, S(g.value), 1),
388
- r("div", vt, S(I.value), 1),
389
- a(A, {
390
- class: "restart-progress",
391
- percentage: Math.round(i.value),
392
- status: t.value === "success" ? "success" : t.value === "timeout" ? "exception" : "",
393
- "stroke-width": 10
394
- }, null, 8, ["percentage", "status"]),
395
- t.value === "success" || t.value === "timeout" ? ($(), ee(te, {
396
- key: 1,
397
- class: "restart-close-btn",
398
- emptyColor: !0,
399
- onClickTrigger: de,
400
- modelValue: t.value === "success" ? "确定" : "关闭",
401
- buttonType: t.value === "success" ? "primary" : "info"
402
- }, null, 8, ["modelValue", "buttonType"])) : le("", !0)
403
- ])) : $e(($(), D("div", gt, [
404
- r("div", _t, [
405
- r("div", {
406
- class: re(["db-type-card", { active: e.databaseType === "sqlite" }]),
407
- onClick: n[0] || (n[0] = (q) => e.databaseType = "sqlite")
408
- }, n[10] || (n[10] = [
409
- r("span", { class: "db-label" }, "SQLite", -1),
410
- r("span", { class: "db-desc" }, "本地文件数据库", -1)
411
- ]), 2),
412
- r("div", {
413
- class: re(["db-type-card", { active: e.databaseType === "pgsql" }]),
414
- onClick: n[1] || (n[1] = (q) => e.databaseType = "pgsql")
415
- }, n[11] || (n[11] = [
416
- r("span", { class: "db-label" }, "PostgreSQL", -1),
417
- r("span", { class: "db-desc" }, "远程关系型数据库", -1)
418
- ]), 2)
419
- ]),
420
- a(Ue, {
421
- ref_key: "formRef",
422
- ref: w,
423
- model: e,
424
- rules: m.value,
425
- "label-position": "top",
426
- class: "config-form"
427
- }, {
428
- default: s(() => [
429
- a(Ie, {
430
- name: "fade-slide",
431
- mode: "out-in"
432
- }, {
433
- default: s(() => [
434
- e.databaseType === "sqlite" ? ($(), D("div", bt, [
435
- a(J, {
436
- label: "数据库目录",
437
- prop: "sqliteDir"
438
- }, {
439
- default: s(() => [
440
- a(R, {
441
- modelValue: e.sqliteDir,
442
- "onUpdate:modelValue": n[2] || (n[2] = (q) => e.sqliteDir = q),
443
- placeholder: "例如:sqlite-data",
444
- clearable: ""
445
- }, {
446
- prefix: s(() => [
447
- a(W, null, {
448
- default: s(() => [
449
- a(B(Se))
450
- ]),
451
- _: 1
452
- })
453
- ]),
454
- _: 1
455
- }, 8, ["modelValue"]),
456
- n[12] || (n[12] = r("div", { class: "field-hint" }, "相对于后端 exe 所在目录的路径", -1))
457
- ]),
458
- _: 1,
459
- __: [12]
460
- })
461
- ])) : ($(), D("div", yt, [
462
- a(me, { gutter: 16 }, {
463
- default: s(() => [
464
- a(oe, { span: 16 }, {
465
- default: s(() => [
466
- a(J, {
467
- label: "主机地址",
468
- prop: "host"
469
- }, {
470
- default: s(() => [
471
- a(R, {
472
- modelValue: e.host,
473
- "onUpdate:modelValue": n[3] || (n[3] = (q) => e.host = q),
474
- placeholder: "127.0.0.1",
475
- clearable: ""
476
- }, null, 8, ["modelValue"])
477
- ]),
478
- _: 1
479
- })
480
- ]),
481
- _: 1
482
- }),
483
- a(oe, { span: 8 }, {
484
- default: s(() => [
485
- a(J, {
486
- label: "端口",
487
- prop: "port"
488
- }, {
489
- default: s(() => [
490
- a(R, {
491
- modelValue: e.port,
492
- "onUpdate:modelValue": n[4] || (n[4] = (q) => e.port = q),
493
- placeholder: "5432",
494
- clearable: ""
495
- }, null, 8, ["modelValue"])
496
- ]),
497
- _: 1
498
- })
499
- ]),
500
- _: 1
501
- })
502
- ]),
503
- _: 1
504
- }),
505
- a(J, {
506
- label: "数据库名",
507
- prop: "database"
508
- }, {
509
- default: s(() => [
510
- a(R, {
511
- modelValue: e.database,
512
- "onUpdate:modelValue": n[5] || (n[5] = (q) => e.database = q),
513
- placeholder: "new_insofworks_admin",
514
- clearable: ""
515
- }, null, 8, ["modelValue"])
516
- ]),
517
- _: 1
518
- }),
519
- a(me, { gutter: 16 }, {
520
- default: s(() => [
521
- a(oe, { span: 12 }, {
522
- default: s(() => [
523
- a(J, {
524
- label: "用户名",
525
- prop: "user"
526
- }, {
527
- default: s(() => [
528
- a(R, {
529
- modelValue: e.user,
530
- "onUpdate:modelValue": n[6] || (n[6] = (q) => e.user = q),
531
- placeholder: "postgres",
532
- clearable: ""
533
- }, null, 8, ["modelValue"])
534
- ]),
535
- _: 1
536
- })
537
- ]),
538
- _: 1
539
- }),
540
- a(oe, { span: 12 }, {
541
- default: s(() => [
542
- a(J, {
543
- label: "密码",
544
- prop: "password"
545
- }, {
546
- default: s(() => [
547
- a(R, {
548
- modelValue: e.password,
549
- "onUpdate:modelValue": n[7] || (n[7] = (q) => e.password = q),
550
- type: "password",
551
- "show-password": "",
552
- clearable: ""
553
- }, null, 8, ["modelValue"])
554
- ]),
555
- _: 1
556
- })
557
- ]),
558
- _: 1
559
- })
560
- ]),
561
- _: 1
562
- })
563
- ]))
564
- ]),
565
- _: 1
566
- })
567
- ]),
568
- _: 1
569
- }, 8, ["model", "rules"])
570
- ])), [
571
- [Ve, v.value]
572
- ])
573
- ]),
574
- footer: s(() => [
575
- b.value ? le("", !0) : ($(), D("div", ht, [
576
- a(te, {
577
- emptyColor: !0,
578
- onClickTrigger: pe,
579
- modelValue: "取消",
580
- buttonType: "info"
581
- }),
582
- a(te, {
583
- emptyColor: !0,
584
- loading: h.value,
585
- onClickTrigger: Te,
586
- modelValue: "保存并重启",
587
- buttonType: "primary"
588
- }, null, 8, ["loading"])
589
- ]))
590
- ]),
591
- _: 1
592
- }, 8, ["modelValue", "close-on-click-modal", "close-on-press-escape"]);
593
- };
594
- }
595
- }), Tt = /* @__PURE__ */ H(Ct, [["__scopeId", "data-v-36cdd580"]]), Ut = { class: "account-wrap" }, kt = { class: "extra-operate" }, Vt = /* @__PURE__ */ X({
596
- __name: "index",
597
- props: {
598
- activeTabName: {
599
- type: String,
600
- default: ""
601
- },
602
- isClickLogin: {
603
- type: Boolean,
604
- default: !1
605
- }
606
- },
607
- emits: ["handleLoginFormChange", "updateApiUrl"],
608
- setup(f, { emit: _ }) {
609
- const c = f, l = ne({
610
- account: "",
611
- password: ""
612
- }), C = ne({
613
- account: [
614
- { required: !0, message: "请输入账号", trigger: "blur" }
615
- ],
616
- password: [
617
- { required: !0, message: "请输入密码", trigger: "blur" }
618
- ]
619
- }), e = U(null), m = _;
620
- j(() => c.isClickLogin, (i) => {
621
- var t;
622
- i && (c == null ? void 0 : c.activeTabName) === "account" && ((t = e.value) == null || t.validate((o) => {
623
- var p;
624
- for (let g in l)
625
- l.hasOwnProperty(g) && (l[g] = (p = l[g]) == null ? void 0 : p.trim());
626
- m("handleLoginFormChange", o, o ? l : null);
627
- }));
628
- }, {
629
- immediate: !0
630
- }), j(() => c.activeTabName, (i) => {
631
- var t;
632
- i === "account" && ((t = e.value) == null || t.resetFields());
633
- });
634
- const w = U(), u = () => {
635
- var i, t;
636
- (t = (i = w.value) == null ? void 0 : i.openDialog) == null || t.call(i);
637
- }, v = (i) => {
638
- m("updateApiUrl", i);
639
- }, h = U(), b = () => {
640
- var i, t;
641
- (t = (i = h.value) == null ? void 0 : i.openDialog) == null || t.call(i);
642
- };
643
- return (i, t) => {
644
- const o = k("svg-icon"), p = k("el-input"), g = k("el-form-item"), I = k("el-form"), L = k("el-link");
645
- return $(), D(qe, null, [
646
- r("div", Ut, [
647
- a(I, {
648
- model: l,
649
- rules: C,
650
- ref_key: "formRef",
651
- ref: e
652
- }, {
653
- default: s(() => [
654
- a(g, {
655
- label: "",
656
- prop: "account"
657
- }, {
658
- default: s(() => [
659
- a(p, {
660
- class: "account-input",
661
- modelValue: l.account,
662
- "onUpdate:modelValue": t[0] || (t[0] = (y) => l.account = y),
663
- placeholder: "请输入账号",
664
- clearable: ""
665
- }, {
666
- prefix: s(() => [
667
- a(o, {
668
- name: "account",
669
- style: { width: "15px", height: "15px" }
670
- })
671
- ]),
672
- _: 1
673
- }, 8, ["modelValue"])
674
- ]),
675
- _: 1
676
- }),
677
- a(g, {
678
- label: "",
679
- prop: "password"
680
- }, {
681
- default: s(() => [
682
- a(p, {
683
- class: "account-input",
684
- modelValue: l.password,
685
- "onUpdate:modelValue": t[1] || (t[1] = (y) => l.password = y),
686
- type: "password",
687
- placeholder: "请输入密码",
688
- "show-password": "",
689
- clearable: ""
690
- }, {
691
- prefix: s(() => [
692
- a(o, {
693
- name: "password",
694
- style: { width: "15px", height: "15px" }
695
- })
696
- ]),
697
- _: 1
698
- }, 8, ["modelValue"])
699
- ]),
700
- _: 1
701
- })
702
- ]),
703
- _: 1
704
- }, 8, ["model", "rules"]),
705
- r("div", kt, [
706
- a(L, {
707
- class: "api-button",
708
- type: "primary",
709
- onClick: u
710
- }, {
711
- default: s(() => t[2] || (t[2] = [
712
- P("接口地址")
713
- ])),
714
- _: 1,
715
- __: [2]
716
- }),
717
- a(L, {
718
- class: "db-button",
719
- type: "primary",
720
- onClick: b
721
- }, {
722
- default: s(() => t[3] || (t[3] = [
723
- P("数据库配置")
724
- ])),
725
- _: 1,
726
- __: [3]
727
- })
728
- ])
729
- ]),
730
- a(ut, {
731
- ref_key: "apiFormDialogRef",
732
- ref: w,
733
- onUpdateApiUrl: v
734
- }, null, 512),
735
- a(Tt, {
736
- ref_key: "dbConfigDialogRef",
737
- ref: h
738
- }, null, 512)
739
- ], 64);
740
- };
741
- }
742
- }), Lt = /* @__PURE__ */ H(Vt, [["__scopeId", "data-v-7ec7eefc"]]), $t = z(K), { systemUrl: E, extraUrl: O } = se($t);
743
- let ye = E.value === "" || !E.value ? "http://222.92.178.198:63003" : E.value, he = O.value === "" || !O.value ? "http://139.196.154.85:20015" : O.value;
744
- j(
745
- () => E.value,
746
- () => {
747
- ye = E.value === "" || !E.value ? "http://222.92.178.198:63003" : E.value;
748
- },
749
- { deep: !0, immediate: !0 }
750
- );
751
- j(
752
- () => O.value,
753
- () => {
754
- he = O.value === "" || !O.value ? "http://139.196.154.85:20015" : O.value;
755
- },
756
- { deep: !0, immediate: !0 }
757
- );
758
- function It(f) {
759
- return be({
760
- url: he + "/api/face/face-verify",
761
- method: "post",
762
- data: f
763
- });
764
- }
765
- function qt(f) {
766
- return be({
767
- url: ye + "/platform/updatedata_faceURL",
768
- method: "post",
769
- data: f
770
- });
771
- }
772
- const Ft = () => {
773
- const f = z(), { platId: _, userName: c, account: l, isSuperAdmin: C } = Ne(), e = async (v) => {
774
- if (!v)
775
- return;
776
- const h = new FormData();
777
- h.set("file", v);
778
- const b = f.systemInfo.plat_id;
779
- return h.set("systemKey", b), await It(h);
780
- };
781
- return { updateFacePhoto: async (v) => {
782
- const h = f.loginUserInfo, { password: b } = h || {}, i = {
783
- platId: _.value,
784
- userName: c.value,
785
- password: b,
786
- faceURL: v
787
- };
788
- C.value && (i.platId = ""), await qt(i);
789
- }, initVerifySelf: async (v) => {
790
- var g;
791
- const h = await e(v), { account: b, password: i } = ((g = h == null ? void 0 : h.data) == null ? void 0 : g.data) || {};
792
- if (!l)
793
- return !1;
794
- const t = f.loginUserInfo, { password: o } = t || {};
795
- return b === l.value && i === o;
796
- }, initVerify: async (v) => await e(v) };
797
- }, At = { class: "account-wrap" }, Dt = { class: "video-wrap" }, St = /* @__PURE__ */ X({
798
- __name: "index",
799
- props: {
800
- systemKey: { default: "" },
801
- activeTabName: { default: "" },
802
- isClickLogin: { type: Boolean, default: !1 }
803
- },
804
- emits: ["handleLoginFormChange"],
805
- setup(f, { emit: _ }) {
806
- const c = f, l = _, { initVerify: C } = Ft(), e = U(null), m = U(null);
807
- let w = !1, u = null;
808
- const v = async (o) => {
809
- if (!o)
810
- return;
811
- const p = await C(o), { data: g } = p || {}, { account: I, password: L } = (g == null ? void 0 : g.data) || {}, y = g == null ? void 0 : g.msg;
812
- if (!I) {
813
- ie.warning(y || "识别失败,请重新识别!");
814
- return;
815
- }
816
- l("handleLoginFormChange", !0, {
817
- account: I,
818
- password: L
819
- });
820
- }, h = () => {
821
- if (!m.value || !e.value)
822
- return;
823
- const o = m.value, p = o.getContext("2d"), g = e.value;
824
- o.width = 200, o.height = 200;
825
- const I = g.videoWidth || 640, L = g.videoHeight || 480, y = Math.min(200 / I, 200 / L), d = I * y, V = L * y, F = (200 - d) / 2, x = (200 - V) / 2;
826
- p == null || p.drawImage(g, 0, 0, I, L, F, x, d, V), o.toBlob((Q) => {
827
- if (Q) {
828
- const G = new File([Q], "face.png", { type: "image/png" });
829
- v(G);
830
- }
831
- }, "image/png");
832
- }, b = async () => {
833
- if (!e.value || w)
834
- return;
835
- const o = e.value;
836
- try {
837
- if (u = await navigator.mediaDevices.getUserMedia({
838
- video: { facingMode: "user" },
839
- // 前置;后置用 'environment'
840
- audio: !1
841
- }), o) {
842
- const p = o;
843
- p.srcObject = u, w = !0;
844
- }
845
- } catch {
846
- ie.warning("摄像头启动失败");
847
- }
848
- };
849
- function i(o) {
850
- if (o && (o.getTracks().forEach((p) => p.stop()), e.value)) {
851
- const p = e.value;
852
- p.srcObject = null;
853
- }
854
- }
855
- const t = () => {
856
- i(u), w = !1;
857
- };
858
- return j(() => c.activeTabName, (o) => {
859
- if (o !== ae.FACE) {
860
- t();
861
- return;
862
- }
863
- if (o === ae.FACE && !w) {
864
- b();
865
- return;
866
- }
867
- }), Fe(() => {
868
- t();
869
- }), (o, p) => ($(), D("div", At, [
870
- r("div", Dt, [
871
- r("video", {
872
- class: "face-video",
873
- ref_key: "videoRef",
874
- ref: e,
875
- id: "v",
876
- autoplay: "",
877
- playsinline: ""
878
- }, null, 512)
879
- ]),
880
- N(o.$slots, "default", {}, () => [
881
- r("button", {
882
- class: "face-screenshot",
883
- onClick: h
884
- }, "人脸识别")
885
- ], !0),
886
- r("canvas", {
887
- ref_key: "canvasRef",
888
- ref: m,
889
- id: "canvas"
890
- }, null, 512)
891
- ]));
892
- }
893
- }), Nt = /* @__PURE__ */ H(St, [["__scopeId", "data-v-94ec015b"]]), ve = z(K), { isDefaultModel: xt } = Re(), Rt = async (f, _) => {
894
- var C, e, m, w, u, v, h, b, i;
895
- let c = Object.values(f), l = await xe({
896
- userName: (C = c == null ? void 0 : c[0]) == null ? void 0 : C.trim(),
897
- password: (e = c == null ? void 0 : c[1]) == null ? void 0 : e.trim()
898
- });
899
- if (((m = l == null ? void 0 : l.data) == null ? void 0 : m.status) === 200 && ((u = (w = l == null ? void 0 : l.data) == null ? void 0 : w.result) == null ? void 0 : u.length) > 0) {
900
- const o = ((h = (v = l == null ? void 0 : l.data) == null ? void 0 : v.result) == null ? void 0 : h.find((g) => xt(g))) || ((i = (b = l == null ? void 0 : l.data) == null ? void 0 : b.result) == null ? void 0 : i[0]);
901
- sessionStorage.setItem("systemKey", _ && _ !== "" ? _ : o == null ? void 0 : o.id);
902
- let p = o;
903
- return p.plat_id = p.id ?? _, ve.setLoginUserInfo(p), ve.setSystemKey(_ && _ !== "" ? _ : o == null ? void 0 : o.id), !0;
904
- } else
905
- return ie.error("输入的密码错误,请重新输入"), !1;
906
- }, Mt = z(K), { systemInfo: ge, loginUserInfo: Y } = se(Mt), Pt = async () => (sessionStorage.setItem("loginToken", "111"), !0), Et = async () => (sessionStorage.setItem("magicToken", "123456"), !0), Ot = async (f) => {
907
- var e, m, w;
908
- let _ = [Rt(f, (e = ge.value) == null ? void 0 : e.plat_id), Pt(), Et()];
909
- const c = await Promise.all(_), l = c == null ? void 0 : c.every((u) => u);
910
- let C = [
911
- {
912
- id: "1",
913
- request_method: "Post",
914
- request_url: "/platform/getdata",
915
- request_param: JSON.stringify({
916
- userName: Y.value.userName,
917
- password: Y.value.password
918
- }),
919
- request_result: "{}",
920
- is_delete: !1,
921
- request_table: "admin_user",
922
- request_type: "login"
923
- }
924
- ];
925
- try {
926
- const u = ((m = Y == null ? void 0 : Y.value) == null ? void 0 : m.plat_id) || ((w = ge.value) == null ? void 0 : w.plat_id);
927
- return await Me({
928
- platId: parseInt(u),
929
- changeContents: [{
930
- tableName: "log",
931
- tableContents: C
932
- }]
933
- }), l;
934
- } catch {
935
- return l;
936
- }
937
- }, Bt = { class: "login-wrap" }, jt = { class: "login-body" }, Kt = { class: "login-body-item left" }, Ht = { class: "title" }, zt = { class: "first-level" }, Qt = {
938
- key: 0,
939
- class: "logo"
940
- }, Wt = ["src"], Jt = { class: "english-name" }, Xt = { class: "login-body-item right" }, Gt = /* @__PURE__ */ X({
941
- __name: "index",
942
- props: {
943
- oldSystemKey: {},
944
- loginContent: {}
945
- },
946
- emits: ["change", "projectLogin", "updateApiUrl", "systemContent"],
947
- setup(f, { emit: _ }) {
948
- const c = f, l = Pe(K), C = z(K), { systemInfo: e } = se(C), m = U(""), w = U("account"), u = U(!1), v = U(!1), h = je(), b = _, i = async (d) => {
949
- const V = await Oe({
950
- url: d
951
- });
952
- return URL.createObjectURL(V == null ? void 0 : V.data);
953
- };
954
- j(() => {
955
- var d;
956
- return (d = e.value) == null ? void 0 : d.logo;
957
- }, async (d) => {
958
- d ? m.value = await i(d) : m.value = Ee;
959
- }, { immediate: !0 });
960
- const t = U({
961
- // sysCTitle: 'INSOFWORKS',
962
- sysCTitle: "",
963
- sysETitle: "",
964
- // sysETitle: 'Dynamic Test Information System',
965
- loginTitle: "账户密码登录",
966
- tabs: [
967
- {
968
- name: "密码登录",
969
- btnLabel: "登录",
970
- tips: "温馨提示:建议使用谷歌、Microsoft Edge,版本79.0.1072.62及以上浏览器,360浏览器请使用极速模式"
971
- },
972
- {
973
- name: "人脸识别",
974
- btnLabel: "人脸识别",
975
- tips: "温馨提示:建议使用谷歌、Microsoft Edge,版本79.0.1072.62及以上浏览器,360浏览器请使用极速模式"
976
- },
977
- {
978
- name: "刷卡登录",
979
- btnLabel: "登录",
980
- tips: "温馨提示:建议使用谷歌、Microsoft Edge,版本79.0.1072.62及以上浏览器,360浏览器请使用极速模式"
981
- }
982
- ]
983
- }), o = () => {
984
- u.value = !0;
985
- }, p = (d, V) => {
986
- u.value = !1, d && I(V);
987
- }, g = async () => !0;
988
- _e(async () => {
989
- await g();
990
- });
991
- const I = async (d) => {
992
- if (v.value = !0, await Ot(d)) {
993
- b("projectLogin", d);
994
- let F = await Be();
995
- b("systemContent", F == null ? void 0 : F.allMenuContents), h.push("/"), l.setHasClickEditComp(!1);
996
- } else
997
- v.value = !1;
998
- v.value = !1;
999
- };
1000
- j(
1001
- () => c == null ? void 0 : c.loginContent,
1002
- () => {
1003
- let d = c == null ? void 0 : c.loginContent;
1004
- d != null && d.account && (d != null && d.password) && I(d);
1005
- },
1006
- { deep: !0, immediate: !0 }
1007
- );
1008
- const L = (d) => {
1009
- w.value = d, u.value = !1, v.value = !1;
1010
- }, y = (d) => {
1011
- b("updateApiUrl", d);
1012
- };
1013
- return (d, V) => ($(), D("div", Bt, [
1014
- r("div", jt, [
1015
- r("div", Kt, [
1016
- a(We, { class: "login-left-bg" }, {
1017
- img: s(() => {
1018
- var F, x;
1019
- return [
1020
- r("div", Ht, [
1021
- r("div", zt, [
1022
- m.value ? ($(), D("div", Qt, [
1023
- r("img", {
1024
- src: m.value,
1025
- alt: ""
1026
- }, null, 8, Wt)
1027
- ])) : le("", !0),
1028
- r("div", Jt, S(((F = B(e)) == null ? void 0 : F.EnglishName) || "Insofworks"), 1)
1029
- ]),
1030
- r("div", null, S(((x = B(e)) == null ? void 0 : x.chineseName) || "工业软件建模与开发系统"), 1)
1031
- ]),
1032
- V[0] || (V[0] = r("div", { class: "divide-line" }, null, -1))
1033
- ];
1034
- }),
1035
- _: 1
1036
- })
1037
- ]),
1038
- r("div", Xt, [
1039
- a(tt, {
1040
- loading: v.value,
1041
- onClickLogin: o,
1042
- onHandleTabChange: L
1043
- }, {
1044
- title: s(() => [
1045
- P(S(t.value.loginTitle), 1)
1046
- ]),
1047
- tabLabel1: s(() => [
1048
- P(S(t.value.tabs[0].name), 1)
1049
- ]),
1050
- tabContent1: s(() => [
1051
- a(Lt, {
1052
- activeTabName: w.value,
1053
- isClickLogin: u.value,
1054
- onHandleLoginFormChange: p,
1055
- onUpdateApiUrl: y
1056
- }, null, 8, ["activeTabName", "isClickLogin"])
1057
- ]),
1058
- tabButton1: s(() => [
1059
- P(S(t.value.tabs[0].btnLabel), 1)
1060
- ]),
1061
- tabLabel2: s(() => [
1062
- P(S(t.value.tabs[1].name), 1)
1063
- ]),
1064
- tabContent2: s(() => [
1065
- a(Nt, {
1066
- systemKey: d.oldSystemKey,
1067
- activeTabName: w.value,
1068
- isClickLogin: u.value,
1069
- onHandleLoginFormChange: p
1070
- }, null, 8, ["systemKey", "activeTabName", "isClickLogin"])
1071
- ]),
1072
- tabButton2: s(() => [
1073
- P(S(t.value.tabs[1].btnLabel), 1)
1074
- ]),
1075
- _: 1
1076
- }, 8, ["loading"])
1077
- ])
1078
- ])
1079
- ]));
1080
- }
1081
- }), ta = /* @__PURE__ */ H(Gt, [["__scopeId", "data-v-8aacc6bf"]]);
1082
- export {
1083
- ta as default
1084
- };