jmash-core 0.1.18 → 0.1.20

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.
@@ -0,0 +1,257 @@
1
+ import { v as k, u as _, a as G, w as J, k as X, l as Y, F as Z, H as ee, A as te, e as le, f as oe } from "./index-CZvJYG4-.mjs";
2
+ import { defineComponent as se, ref as d, computed as re, watchEffect as ae, resolveComponent as c, createElementBlock as ne, openBlock as D, createElementVNode as l, createVNode as o, withDirectives as Q, createBlock as ie, createCommentVNode as ue, unref as V, withCtx as u, normalizeStyle as de, vShow as j, withKeys as z, withModifiers as ce, createTextVNode as pe, toDisplayString as B, normalizeClass as me } from "vue";
3
+ import fe from "./assets/0cda52992278af9e.png";
4
+ import { useI18n as ve } from "vue-i18n";
5
+ import "element-plus";
6
+ import { useRoute as ge, useRouter as _e } from "vue-router";
7
+ import he from "./assets/09fcc36c527efda6.jpg";
8
+ const we = { class: "login-container" }, ye = { class: "absolute top-0 flex items-center justify-end px-5 h-20 w-full" }, Ce = { class: "qrcode-container" }, be = ["src"], ke = { class: "flex justify-between items-center w-full" }, Ve = ["src"], qe = { class: "flex justify-between items-center w-full" }, $e = { class: "bg-small" }, Ee = 992, Te = /* @__PURE__ */ se({
9
+ __name: "index",
10
+ setup(Ie) {
11
+ const { t: q } = ve(), h = d(k.APP_ACTIVE), K = (e) => {
12
+ e.props.name === "user" ? (C(), m()) : I(), h.value = e.props.name;
13
+ }, s = d({
14
+ scope: "",
15
+ username: "",
16
+ password: ""
17
+ }), N = re(() => {
18
+ const e = _().language === "en" ? "Please enter " : "请输入";
19
+ return {
20
+ username: [
21
+ {
22
+ required: !0,
23
+ trigger: "blur",
24
+ message: `${e}${q("login.username")}`
25
+ }
26
+ ],
27
+ password: [
28
+ {
29
+ required: !0,
30
+ trigger: "blur",
31
+ validator: (t, n, r) => {
32
+ n.length < 5 ? r(new Error("The password can not be less than 5 digits")) : r();
33
+ },
34
+ message: `${e}${q("login.password")}`
35
+ }
36
+ ],
37
+ captchaCode: [
38
+ {
39
+ required: !0,
40
+ trigger: "blur",
41
+ message: `${e}${q("login.captchaCode")}`
42
+ }
43
+ ]
44
+ };
45
+ }), $ = d(!1), P = d(), x = ge(), E = _e(), A = G(), T = () => {
46
+ var e;
47
+ (e = P.value) == null || e.validate((t) => {
48
+ t && ($.value = !0, A.login({ ...s.value, password: ee(s.value.password) }).then(() => {
49
+ const n = x.query, r = n.redirect ?? k.APP_REDIRECT, i = Object.keys(n).reduce(
50
+ (p, g) => (g !== "redirect" && (p[g] = n[g]), p),
51
+ {}
52
+ );
53
+ E.push({ path: r, query: i }), m();
54
+ }).catch(() => {
55
+ m();
56
+ }).finally(() => {
57
+ $.value = !1;
58
+ }));
59
+ });
60
+ }, R = d(""), m = () => {
61
+ te().then(({ data: e }) => {
62
+ s.value.captchaKey = e.captchaId, R.value = e.base64Image;
63
+ });
64
+ };
65
+ m();
66
+ let w = setInterval(S, 3e3);
67
+ const f = d({});
68
+ function I() {
69
+ le().then(({ data: e }) => {
70
+ f.value = e, v.value = !1, L(), w = setInterval(S, 3e3);
71
+ });
72
+ }
73
+ h.value === "qrCode" && I();
74
+ function S() {
75
+ f.value.ticket && A.loginByQrcode({ ticket: f.value.ticket }).then(() => {
76
+ C(), v.value = !1, f.value.qrcodeUrl = he;
77
+ const e = x.query, t = e.redirect ?? k.APP_REDIRECT, n = Object.keys(e).reduce(
78
+ (r, i) => (i !== "redirect" && (r[i] = e[i]), r),
79
+ {}
80
+ );
81
+ E.push({ path: t, query: n });
82
+ });
83
+ }
84
+ let y = null;
85
+ const v = d(!1);
86
+ function C() {
87
+ w && (clearInterval(w), w = null), y && (clearTimeout(y), y = null);
88
+ }
89
+ function L() {
90
+ C(), y = setTimeout(() => {
91
+ C(), v.value = !0;
92
+ }, k.APP_TIMEOUT);
93
+ }
94
+ function M() {
95
+ E.push({ path: "/register" });
96
+ }
97
+ const b = d(!1), U = _(), { width: O } = J();
98
+ return ae(() => {
99
+ O.value < Ee ? U.toggleDevice("mobile") : U.toggleDevice("desktop");
100
+ }), (e, t) => {
101
+ const n = X, r = c("el-tab-pane"), i = c("el-input"), p = c("el-form-item"), g = c("el-button"), H = c("el-form"), W = c("el-tabs"), F = c("el-card");
102
+ return D(), ne("div", we, [
103
+ l("div", ye, [
104
+ o(n, {
105
+ class: "ml-2 cursor-pointer",
106
+ style: { "font-size": "18px" }
107
+ })
108
+ ]),
109
+ o(F, {
110
+ device: V(_)().device,
111
+ class: "z-1 !border-none w-100 !bg-transparent !rounded-4% <sm:w-83"
112
+ }, {
113
+ default: u(() => [
114
+ o(W, {
115
+ modelValue: h.value,
116
+ "onUpdate:modelValue": t[3] || (t[3] = (a) => h.value = a),
117
+ class: "demo-tabs",
118
+ onTabClick: K
119
+ }, {
120
+ default: u(() => [
121
+ o(r, {
122
+ label: "扫码登录",
123
+ name: "qrCode"
124
+ }, {
125
+ default: u(() => [
126
+ l("div", Ce, [
127
+ l("img", {
128
+ src: f.value.qrcodeUrl,
129
+ style: de({ opacity: v.value ? 0.02 : 1 }),
130
+ alt: "二维码"
131
+ }, null, 12, be),
132
+ Q(l("div", null, [
133
+ t[6] || (t[6] = l("div", null, "二维码已过期", -1)),
134
+ l("div", { onClick: I }, "点击刷新")
135
+ ], 512), [
136
+ [j, v.value]
137
+ ])
138
+ ]),
139
+ t[7] || (t[7] = l("div", null, "微信扫一扫登录", -1))
140
+ ]),
141
+ _: 1,
142
+ __: [7]
143
+ }),
144
+ o(r, {
145
+ label: "账号登录",
146
+ name: "user"
147
+ }, {
148
+ default: u(() => [
149
+ o(H, {
150
+ ref_key: "formRef",
151
+ ref: P,
152
+ model: s.value,
153
+ rules: N.value
154
+ }, {
155
+ default: u(() => [
156
+ o(p, { prop: "username" }, {
157
+ default: u(() => [
158
+ o(i, {
159
+ modelValue: s.value.username,
160
+ "onUpdate:modelValue": t[0] || (t[0] = (a) => s.value.username = a),
161
+ placeholder: e.$t("login.username")
162
+ }, null, 8, ["modelValue", "placeholder"])
163
+ ]),
164
+ _: 1
165
+ }),
166
+ o(p, { prop: "password" }, {
167
+ default: u(() => [
168
+ o(i, {
169
+ modelValue: s.value.password,
170
+ "onUpdate:modelValue": t[1] || (t[1] = (a) => s.value.password = a),
171
+ placeholder: e.$t("login.password"),
172
+ type: "password",
173
+ "show-password": "",
174
+ onKeyup: z(T, ["enter"])
175
+ }, null, 8, ["modelValue", "placeholder"])
176
+ ]),
177
+ _: 1
178
+ }),
179
+ o(p, { prop: "captchaCode" }, {
180
+ default: u(() => [
181
+ l("div", ke, [
182
+ o(i, {
183
+ style: { width: "65%" },
184
+ modelValue: s.value.captchaCode,
185
+ "onUpdate:modelValue": t[2] || (t[2] = (a) => s.value.captchaCode = a),
186
+ placeholder: e.$t("login.captchaCode"),
187
+ onKeyup: z(T, ["enter"])
188
+ }, null, 8, ["modelValue", "placeholder"]),
189
+ l("img", {
190
+ class: "flex-1 h-[40px] cursor-pointer ml-2",
191
+ src: R.value,
192
+ onClick: m,
193
+ alt: "验证码"
194
+ }, null, 8, Ve)
195
+ ])
196
+ ]),
197
+ _: 1
198
+ }),
199
+ o(g, {
200
+ loading: $.value,
201
+ type: "primary",
202
+ class: "w-full",
203
+ onClick: ce(T, ["prevent"])
204
+ }, {
205
+ default: u(() => [
206
+ pe(B(e.$t("login.login")), 1)
207
+ ]),
208
+ _: 1
209
+ }, 8, ["loading"])
210
+ ]),
211
+ _: 1
212
+ }, 8, ["model", "rules"])
213
+ ]),
214
+ _: 1
215
+ })
216
+ ]),
217
+ _: 1
218
+ }, 8, ["modelValue"]),
219
+ l("div", qe, [
220
+ l("div", {
221
+ class: "cursor-pointer register-btn",
222
+ onClick: t[4] || (t[4] = (a) => b.value = !0)
223
+ }, " 忘记密码 "),
224
+ l("div", {
225
+ class: "cursor-pointer register-btn",
226
+ onClick: M
227
+ }, " 没有密码,前往注册 ")
228
+ ])
229
+ ]),
230
+ _: 1
231
+ }, 8, ["device"]),
232
+ Q(l("div", $e, [
233
+ l("div", null, B(V(Y).title), 1),
234
+ t[8] || (t[8] = l("img", {
235
+ src: fe,
236
+ alt: "login-bg-small"
237
+ }, null, -1))
238
+ ], 512), [
239
+ [j, V(_)().device === "desktop"]
240
+ ]),
241
+ l("div", {
242
+ class: me(V(_)().device)
243
+ }, " Copyright © 2018-2025 Apache 2.0 开源协议. ", 2),
244
+ b.value ? (D(), ie(Z, {
245
+ key: 0,
246
+ width: "400",
247
+ modelValue: b.value,
248
+ "onUpdate:modelValue": t[5] || (t[5] = (a) => b.value = a),
249
+ title: e.$t("forgot.forgot")
250
+ }, null, 8, ["modelValue", "title"])) : ue("", !0)
251
+ ]);
252
+ };
253
+ }
254
+ }), Qe = /* @__PURE__ */ oe(Te, [["__scopeId", "data-v-60b95e49"]]);
255
+ export {
256
+ Qe as default
257
+ };