@huyooo/ui 0.5.59 → 0.5.62

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,931 @@
1
+ import { defineComponent as z, computed as N, createElementBlock as k, openBlock as g, normalizeStyle as O, createElementVNode as s, createCommentVNode as $, renderSlot as D, ref as m, toDisplayString as P, createVNode as t, unref as l, withCtx as i, createTextVNode as V, onMounted as K, createBlock as E, useSlots as G } from "vue";
2
+ import { _ as C } from "./_plugin-vue_export-helper-CHgC5LLL.js";
3
+ /* empty css */
4
+ /* empty css */
5
+ /* empty css */
6
+ /* empty css */
7
+ /* empty css */
8
+ /* empty css */
9
+ /* empty css */
10
+ import { List as J, ListItem as x, ListItemMeta as T, Avatar as F, Button as R, Form as A, FormItem as b, Input as w, Link as M } from "@arco-design/web-vue";
11
+ import { a as Q } from "./useAuthkitAppsAuthPageInfo-CzZmhPMm.js";
12
+ import { o as W } from "./auth-bwwc2iT8.js";
13
+ import { u as X, a as Y } from "./useAuthkitUsersProfile-hZ9L3rYe.js";
14
+ import { S as U, v as Z, q as L, g as ee, h as te } from "./AuthkitAuthModal-BfwODnpI.js";
15
+ const oe = {
16
+ class: "header"
17
+ }, le = ["href"], ae = {
18
+ class: "container"
19
+ }, se = /* @__PURE__ */ z({
20
+ __name: "AuthkitAuthContainer",
21
+ props: {
22
+ applicationLogoUrl: {
23
+ type: String,
24
+ required: !0,
25
+ default: () => ""
26
+ },
27
+ name: {
28
+ type: String,
29
+ required: !0,
30
+ default: () => ""
31
+ },
32
+ description: {
33
+ type: String,
34
+ required: !0,
35
+ default: () => ""
36
+ },
37
+ appHomePage: {
38
+ type: String,
39
+ required: !0,
40
+ default: () => ""
41
+ },
42
+ backgroundImage: {
43
+ type: String,
44
+ required: !0,
45
+ default: () => ""
46
+ },
47
+ backgroundColor: {
48
+ type: String,
49
+ required: !0,
50
+ default: () => ""
51
+ },
52
+ linkColor: {
53
+ type: String,
54
+ default: "rgb(22, 93, 255)"
55
+ },
56
+ backgroundType: {
57
+ type: String,
58
+ default: "color"
59
+ }
60
+ },
61
+ setup(y) {
62
+ const p = y, n = N(() => p.backgroundType === "color" ? {
63
+ backgroundColor: p.backgroundColor
64
+ } : {
65
+ backgroundImage: `url(${p.backgroundImage})`
66
+ });
67
+ return (a, f) => (g(), k("div", {
68
+ class: "auth",
69
+ style: O(n.value)
70
+ }, [s("div", oe, [p.name ? (g(), k("a", {
71
+ key: 0,
72
+ href: p.appHomePage,
73
+ target: "_self",
74
+ class: "link",
75
+ style: O({
76
+ color: p.linkColor
77
+ })
78
+ }, " 返回主页 ", 12, le)) : $("", !0)]), s("div", ae, [D(a.$slots, "default", {}, void 0, !0)])], 4));
79
+ }
80
+ }), Ze = /* @__PURE__ */ C(se, [["__scopeId", "data-v-203946ff"]]), ie = {
81
+ class: "box"
82
+ }, ne = {
83
+ class: "title"
84
+ }, re = {
85
+ class: "content"
86
+ }, de = {
87
+ class: "redirect"
88
+ }, ue = {
89
+ style: {
90
+ "font-weight": "bold",
91
+ "font-size": "12px"
92
+ }
93
+ }, ce = /* @__PURE__ */ z({
94
+ __name: "AuthkitAuthorize",
95
+ props: {
96
+ size: {
97
+ type: String,
98
+ required: !0
99
+ },
100
+ title: {
101
+ type: String,
102
+ required: !0,
103
+ default: () => "授权登录"
104
+ },
105
+ logo: {
106
+ type: String,
107
+ required: !0,
108
+ default: () => ""
109
+ },
110
+ clientId: {
111
+ type: String,
112
+ required: !0,
113
+ default: () => ""
114
+ },
115
+ responseType: {
116
+ type: String,
117
+ required: !0,
118
+ default: () => ""
119
+ },
120
+ scope: {
121
+ type: String,
122
+ required: !0,
123
+ default: () => ""
124
+ },
125
+ state: {
126
+ type: String,
127
+ required: !0,
128
+ default: () => ""
129
+ },
130
+ redirectUri: {
131
+ type: String,
132
+ required: !0,
133
+ default: () => ""
134
+ },
135
+ userInfo: {
136
+ type: Object,
137
+ required: !0,
138
+ default: () => ""
139
+ }
140
+ },
141
+ setup(y) {
142
+ const p = m(!1), n = y, a = m({
143
+ appKey: "",
144
+ name: "",
145
+ homePageUrl: "",
146
+ createAt: "",
147
+ authorizationCallback: ""
148
+ });
149
+ function f() {
150
+ Q({
151
+ id: n.clientId
152
+ }).then(({
153
+ data: u
154
+ }) => {
155
+ a.value = u;
156
+ }).catch((u) => {
157
+ console.error("获取应用信息失败:", u);
158
+ });
159
+ }
160
+ f();
161
+ function d() {
162
+ p.value = !0, W({
163
+ client_id: n.clientId,
164
+ response_type: n.responseType,
165
+ scope: n.scope,
166
+ state: n.state,
167
+ redirect_uri: n.redirectUri
168
+ }).then(({
169
+ data: u
170
+ }) => {
171
+ p.value = !1, window.location = u.authorizeUrl;
172
+ }).catch((u) => {
173
+ p.value = !1, console.error("授权失败:", u);
174
+ });
175
+ }
176
+ return (u, e) => (g(), k("div", ie, [s("div", ne, P(`授权 ${a.value.name}`), 1), s("div", re, [t(l(J), null, {
177
+ default: i(() => [t(l(x), null, {
178
+ default: i(() => {
179
+ var _;
180
+ return [t(l(T), {
181
+ title: a.value.name,
182
+ description: `想要使用您的${(_ = n.userInfo) == null ? void 0 : _.nickname}账户`
183
+ }, {
184
+ avatar: i(() => {
185
+ var v;
186
+ return [t(l(F), {
187
+ shape: "square",
188
+ "image-url": (v = n.userInfo) == null ? void 0 : v.avatar
189
+ }, null, 8, ["image-url"])];
190
+ }),
191
+ _: 1
192
+ }, 8, ["title", "description"])];
193
+ }),
194
+ _: 1
195
+ }), t(l(x), null, {
196
+ default: i(() => [t(l(T), {
197
+ title: "公开信息",
198
+ description: "头像、昵称"
199
+ }, {
200
+ avatar: i(() => [t(l(F), {
201
+ shape: "square"
202
+ }, {
203
+ default: i(() => [...e[0] || (e[0] = [s("img", {
204
+ alt: "avatar",
205
+ src: "https://p1-arco.byteimg.com/tos-cn-i-uwbnlip3yd/3ee5f13fb09879ecb5185e440cef6eb9.png~tplv-uwbnlip3yd-webp.webp"
206
+ }, null, -1)])]),
207
+ _: 1
208
+ })]),
209
+ _: 1
210
+ })]),
211
+ _: 1
212
+ }), t(l(x), null, {
213
+ default: i(() => [t(l(T), {
214
+ title: "个人用户数据",
215
+ description: "电子邮件地址"
216
+ }, {
217
+ avatar: i(() => [t(l(F), {
218
+ shape: "square"
219
+ }, {
220
+ default: i(() => [...e[1] || (e[1] = [s("img", {
221
+ alt: "avatar",
222
+ src: "https://p1-arco.byteimg.com/tos-cn-i-uwbnlip3yd/3ee5f13fb09879ecb5185e440cef6eb9.png~tplv-uwbnlip3yd-webp.webp"
223
+ }, null, -1)])]),
224
+ _: 1
225
+ })]),
226
+ _: 1
227
+ })]),
228
+ _: 1
229
+ })]),
230
+ _: 1
231
+ }), t(l(R), {
232
+ type: "primary",
233
+ size: n.size,
234
+ loading: p.value,
235
+ onClick: d
236
+ }, {
237
+ default: i(() => [...e[2] || (e[2] = [V(" 授权 ", -1)])]),
238
+ _: 1
239
+ }, 8, ["size", "loading"]), s("div", de, [e[3] || (e[3] = s("div", {
240
+ style: {
241
+ color: "#888",
242
+ "font-size": "12px"
243
+ }
244
+ }, "授权后将跳转至", -1)), s("div", ue, P(a.value.authorizationCallback), 1)])])]));
245
+ }
246
+ }), et = /* @__PURE__ */ C(ce, [["__scopeId", "data-v-cc821ddc"]]), pe = {
247
+ class: "oauth-callback"
248
+ }, fe = {
249
+ key: 0,
250
+ class: "callback-loading"
251
+ }, me = {
252
+ key: 1,
253
+ class: "callback-error"
254
+ }, ve = {
255
+ key: 2,
256
+ class: "callback-success"
257
+ }, he = /* @__PURE__ */ z({
258
+ __name: "AuthkitOauthCallback",
259
+ props: {
260
+ defaultRedirect: {},
261
+ loadingText: {},
262
+ bindIdentityRedirect: {}
263
+ },
264
+ emits: ["success", "error", "needBindIdentity"],
265
+ setup(y, {
266
+ emit: p
267
+ }) {
268
+ const n = y, a = p, f = m(!0), d = m(""), {
269
+ setToken: u,
270
+ initializeAuth: e
271
+ } = X(), {
272
+ fetchUserProfile: _
273
+ } = Y();
274
+ async function v() {
275
+ const c = new URLSearchParams(window.location.search), o = c.get("error");
276
+ if (o) {
277
+ d.value = decodeURIComponent(o), f.value = !1, a("error", d.value);
278
+ return;
279
+ }
280
+ const r = c.get("token"), h = c.get("userId"), I = c.get("appId"), q = c.get("needBindIdentity") === "true";
281
+ if (!r) {
282
+ d.value = "登录失败:未收到认证令牌", f.value = !1, a("error", d.value);
283
+ return;
284
+ }
285
+ try {
286
+ u(r), await _();
287
+ const B = window.location.pathname;
288
+ if (window.history.replaceState({}, "", B), q && (a("needBindIdentity", {
289
+ token: r,
290
+ userId: h || "",
291
+ appId: I || ""
292
+ }), n.bindIdentityRedirect)) {
293
+ f.value = !1, setTimeout(() => {
294
+ window.location.href = n.bindIdentityRedirect;
295
+ }, 300);
296
+ return;
297
+ }
298
+ a("success", {
299
+ token: r,
300
+ userId: h || "",
301
+ appId: I || "",
302
+ needBindIdentity: q
303
+ });
304
+ const H = sessionStorage.getItem("auth_redirect");
305
+ sessionStorage.removeItem("auth_redirect");
306
+ const j = H || n.defaultRedirect || "/";
307
+ f.value = !1, setTimeout(() => {
308
+ window.location.href = j;
309
+ }, 500);
310
+ } catch (B) {
311
+ console.error("OAuth 回调处理失败:", B), d.value = "登录处理失败,请重试", f.value = !1, a("error", d.value);
312
+ }
313
+ }
314
+ function S() {
315
+ const c = sessionStorage.getItem("auth_redirect");
316
+ sessionStorage.removeItem("auth_redirect"), window.location.href = c || n.defaultRedirect || "/";
317
+ }
318
+ return K(() => {
319
+ const c = new URLSearchParams(window.location.search);
320
+ if (c.has("token") || c.has("error"))
321
+ v();
322
+ else if (e()) {
323
+ const o = sessionStorage.getItem("auth_redirect");
324
+ sessionStorage.removeItem("auth_redirect"), window.location.href = o || n.defaultRedirect || "/";
325
+ } else
326
+ d.value = "无效的访问", f.value = !1;
327
+ }), (c, o) => (g(), k("div", pe, [f.value ? (g(), k("div", fe, [o[0] || (o[0] = s("div", {
328
+ class: "spinner"
329
+ }, null, -1)), s("p", null, P(y.loadingText), 1)])) : d.value ? (g(), k("div", me, [o[1] || (o[1] = s("div", {
330
+ class: "error-icon"
331
+ }, "✕", -1)), o[2] || (o[2] = s("h2", null, "登录失败", -1)), s("p", null, P(d.value), 1), s("button", {
332
+ class: "retry-btn",
333
+ onClick: S
334
+ }, "返回重试")])) : (g(), k("div", ve, [...o[3] || (o[3] = [s("div", {
335
+ class: "success-icon"
336
+ }, "✓", -1), s("p", null, "登录成功,正在跳转...", -1)])]))]));
337
+ }
338
+ }), tt = /* @__PURE__ */ C(he, [["__scopeId", "data-v-07b0e1e4"]]), ge = {
339
+ class: "BindEmail"
340
+ }, ye = {
341
+ class: "content"
342
+ }, _e = {
343
+ class: "sendVerifyCodeItem"
344
+ }, ke = {
345
+ class: "handle"
346
+ }, be = {
347
+ key: 0,
348
+ class: "skip"
349
+ }, we = /* @__PURE__ */ z({
350
+ __name: "AuthkitBindEmail",
351
+ props: {
352
+ size: {
353
+ type: String,
354
+ required: !0
355
+ },
356
+ loading: {
357
+ type: Boolean,
358
+ required: !0,
359
+ default: () => !1
360
+ },
361
+ /** 是否显示跳过按钮 */
362
+ showSkip: {
363
+ type: Boolean,
364
+ default: !1
365
+ }
366
+ },
367
+ emits: ["submit", "skip"],
368
+ setup(y, {
369
+ emit: p
370
+ }) {
371
+ const n = p, a = y, f = m(), d = m(!1), u = m(), e = m({
372
+ email: void 0,
373
+ userToken: void 0,
374
+ emailVerifyId: void 0
375
+ });
376
+ async function _() {
377
+ u.value.validateField(["email"]).then((c) => {
378
+ c || (d.value = !0, Z({
379
+ email: e.value.email
380
+ }).then(({
381
+ data: o
382
+ }) => {
383
+ e.value.emailVerifyId = o.emailVerifyId, d.value = !1, f.value.startCountFn();
384
+ }).catch(() => {
385
+ d.value = !1;
386
+ }));
387
+ });
388
+ }
389
+ async function v() {
390
+ u.value.validate().then((c) => {
391
+ c || n("submit", {
392
+ email: e.value.email,
393
+ userToken: e.value.userToken,
394
+ emailVerifyId: e.value.emailVerifyId
395
+ });
396
+ });
397
+ }
398
+ function S() {
399
+ n("skip");
400
+ }
401
+ return (c, o) => (g(), k("div", ge, [o[4] || (o[4] = s("div", {
402
+ class: "header"
403
+ }, [s("h3", {
404
+ class: "title"
405
+ }, "绑定邮箱"), s("p", {
406
+ class: "subtitle"
407
+ }, "请绑定邮箱以完成账号设置,绑定后可使用邮箱登录")], -1)), s("div", ye, [t(l(A), {
408
+ ref_key: "formRef",
409
+ ref: u,
410
+ model: e.value,
411
+ size: a.size,
412
+ "auto-label-width": ""
413
+ }, {
414
+ default: i(() => [t(l(b), {
415
+ field: "email",
416
+ label: "邮箱",
417
+ "hide-label": "",
418
+ rules: [{
419
+ required: !0,
420
+ message: "请输入邮箱"
421
+ }, {
422
+ type: "email",
423
+ message: "请输入有效的邮箱"
424
+ }]
425
+ }, {
426
+ default: i(() => [t(l(w), {
427
+ modelValue: e.value.email,
428
+ "onUpdate:modelValue": o[0] || (o[0] = (r) => e.value.email = r),
429
+ placeholder: "请输入邮箱",
430
+ autocomplete: "email",
431
+ type: "email"
432
+ }, null, 8, ["modelValue"])]),
433
+ _: 1
434
+ }), t(l(b), {
435
+ field: "userToken",
436
+ label: "验证码",
437
+ "hide-label": "",
438
+ rules: [{
439
+ required: !0,
440
+ message: "请输入验证码"
441
+ }]
442
+ }, {
443
+ default: i(() => [s("div", _e, [t(l(w), {
444
+ modelValue: e.value.userToken,
445
+ "onUpdate:modelValue": o[1] || (o[1] = (r) => e.value.userToken = r),
446
+ placeholder: "请输入验证码",
447
+ autocomplete: "one-time-code"
448
+ }, null, 8, ["modelValue"]), t(U, {
449
+ ref_key: "SendVerifyCodeRef",
450
+ ref: f,
451
+ size: a.size,
452
+ loading: d.value,
453
+ style: {
454
+ "margin-left": "10px"
455
+ },
456
+ onSend: _
457
+ }, null, 8, ["size", "loading"])])]),
458
+ _: 1
459
+ }), s("div", ke, [t(l(R), {
460
+ type: "primary",
461
+ loading: a.loading,
462
+ long: "",
463
+ size: a.size,
464
+ onClick: v
465
+ }, {
466
+ default: i(() => [...o[2] || (o[2] = [V(" 绑定邮箱 ", -1)])]),
467
+ _: 1
468
+ }, 8, ["loading", "size"])])]),
469
+ _: 1
470
+ }, 8, ["model", "size"])]), a.showSkip ? (g(), k("div", be, [t(l(M), {
471
+ onClick: S
472
+ }, {
473
+ default: i(() => [...o[3] || (o[3] = [V("稍后绑定", -1)])]),
474
+ _: 1
475
+ })])) : $("", !0)]));
476
+ }
477
+ }), ot = /* @__PURE__ */ C(we, [["__scopeId", "data-v-ad4da8d9"]]), Se = {
478
+ class: "BindPhone"
479
+ }, Ie = {
480
+ class: "content"
481
+ }, Ve = {
482
+ class: "sendVerifyCodeItem"
483
+ }, ze = {
484
+ class: "handle"
485
+ }, Ce = {
486
+ key: 0,
487
+ class: "skip"
488
+ }, qe = /* @__PURE__ */ z({
489
+ __name: "AuthkitBindPhone",
490
+ props: {
491
+ size: {
492
+ type: String,
493
+ required: !0
494
+ },
495
+ loading: {
496
+ type: Boolean,
497
+ required: !0,
498
+ default: () => !1
499
+ },
500
+ showSkip: {
501
+ type: Boolean,
502
+ default: !1
503
+ }
504
+ },
505
+ emits: ["submit", "skip"],
506
+ setup(y, {
507
+ emit: p
508
+ }) {
509
+ const n = p, a = y, f = m(), d = m(!1), u = m(), e = m({
510
+ phone: void 0,
511
+ code: void 0
512
+ });
513
+ async function _() {
514
+ u.value.validateField(["phone"]).then((c) => {
515
+ c || (d.value = !0, L({
516
+ phone: e.value.phone
517
+ }).then(() => {
518
+ d.value = !1, f.value.startCountFn();
519
+ }).catch(() => {
520
+ d.value = !1;
521
+ }));
522
+ });
523
+ }
524
+ async function v() {
525
+ u.value.validate().then((c) => {
526
+ c || n("submit", {
527
+ phone: e.value.phone,
528
+ code: e.value.code
529
+ });
530
+ });
531
+ }
532
+ function S() {
533
+ n("skip");
534
+ }
535
+ return (c, o) => (g(), k("div", Se, [o[4] || (o[4] = s("div", {
536
+ class: "header"
537
+ }, [s("h3", {
538
+ class: "title"
539
+ }, "绑定手机号"), s("p", {
540
+ class: "subtitle"
541
+ }, "请绑定手机号以完成账号设置")], -1)), s("div", Ie, [t(l(A), {
542
+ ref_key: "formRef",
543
+ ref: u,
544
+ model: e.value,
545
+ size: a.size,
546
+ "auto-label-width": ""
547
+ }, {
548
+ default: i(() => [t(l(b), {
549
+ field: "phone",
550
+ label: "手机号",
551
+ "hide-label": "",
552
+ rules: [{
553
+ required: !0,
554
+ message: "请输入手机号"
555
+ }, {
556
+ match: /^1[3-9]\d{9}$/,
557
+ message: "请输入有效的手机号"
558
+ }]
559
+ }, {
560
+ default: i(() => [t(l(w), {
561
+ modelValue: e.value.phone,
562
+ "onUpdate:modelValue": o[0] || (o[0] = (r) => e.value.phone = r),
563
+ placeholder: "请输入手机号",
564
+ autocomplete: "tel",
565
+ type: "tel"
566
+ }, null, 8, ["modelValue"])]),
567
+ _: 1
568
+ }), t(l(b), {
569
+ field: "code",
570
+ label: "验证码",
571
+ "hide-label": "",
572
+ rules: [{
573
+ required: !0,
574
+ message: "请输入验证码"
575
+ }]
576
+ }, {
577
+ default: i(() => [s("div", Ve, [t(l(w), {
578
+ modelValue: e.value.code,
579
+ "onUpdate:modelValue": o[1] || (o[1] = (r) => e.value.code = r),
580
+ placeholder: "请输入验证码",
581
+ autocomplete: "one-time-code"
582
+ }, null, 8, ["modelValue"]), t(U, {
583
+ ref_key: "SendVerifyCodeRef",
584
+ ref: f,
585
+ size: a.size,
586
+ loading: d.value,
587
+ style: {
588
+ "margin-left": "10px"
589
+ },
590
+ onSend: _
591
+ }, null, 8, ["size", "loading"])])]),
592
+ _: 1
593
+ }), s("div", ze, [t(l(R), {
594
+ type: "primary",
595
+ loading: a.loading,
596
+ long: "",
597
+ size: a.size,
598
+ onClick: v
599
+ }, {
600
+ default: i(() => [...o[2] || (o[2] = [V(" 绑定手机号 ", -1)])]),
601
+ _: 1
602
+ }, 8, ["loading", "size"])])]),
603
+ _: 1
604
+ }, 8, ["model", "size"])]), a.showSkip ? (g(), k("div", Ce, [t(l(M), {
605
+ onClick: S
606
+ }, {
607
+ default: i(() => [...o[3] || (o[3] = [V("稍后绑定", -1)])]),
608
+ _: 1
609
+ })])) : $("", !0)]));
610
+ }
611
+ }), lt = /* @__PURE__ */ C(qe, [["__scopeId", "data-v-a4313398"]]), $e = {
612
+ class: "SignUpPhone"
613
+ }, Re = {
614
+ class: "content"
615
+ }, Pe = {
616
+ class: "sendVerifyCodeItem"
617
+ }, Ae = {
618
+ class: "handle"
619
+ }, Ue = /* @__PURE__ */ z({
620
+ __name: "AuthkitSignUpPhone",
621
+ props: {
622
+ size: {
623
+ type: String,
624
+ required: !0
625
+ },
626
+ loading: {
627
+ type: Boolean,
628
+ required: !0,
629
+ default: () => !1
630
+ },
631
+ /** 是否要求设置密码 */
632
+ requirePassword: {
633
+ type: Boolean,
634
+ default: !1
635
+ }
636
+ },
637
+ emits: ["switchSignIn", "submit"],
638
+ setup(y, {
639
+ emit: p
640
+ }) {
641
+ const n = p, a = y, f = m(), d = m(!1), u = m(), e = m({
642
+ phone: void 0,
643
+ code: void 0,
644
+ password: void 0,
645
+ confirmPassword: void 0,
646
+ referrerId: void 0
647
+ }), _ = [{
648
+ required: !0,
649
+ message: "请输入确认密码"
650
+ }, {
651
+ validator: (o, r) => {
652
+ e.value.password && o !== e.value.password ? r("两次密码输入不一致") : r();
653
+ }
654
+ }];
655
+ function v() {
656
+ n("switchSignIn");
657
+ }
658
+ async function S() {
659
+ u.value.validateField(["phone"]).then((o) => {
660
+ o || (d.value = !0, L({
661
+ phone: e.value.phone
662
+ }).then(() => {
663
+ d.value = !1, f.value.startCountFn();
664
+ }).catch(() => {
665
+ d.value = !1;
666
+ }));
667
+ });
668
+ }
669
+ async function c() {
670
+ u.value.validate().then((o) => {
671
+ o || n("submit", {
672
+ phone: e.value.phone,
673
+ code: e.value.code,
674
+ password: e.value.password,
675
+ referrerId: e.value.referrerId
676
+ });
677
+ });
678
+ }
679
+ return (o, r) => (g(), k("div", $e, [s("div", Re, [t(l(A), {
680
+ ref_key: "formRef",
681
+ ref: u,
682
+ model: e.value,
683
+ size: a.size,
684
+ "auto-label-width": ""
685
+ }, {
686
+ default: i(() => [t(l(b), {
687
+ field: "phone",
688
+ label: "手机号",
689
+ "hide-label": "",
690
+ rules: [{
691
+ required: !0,
692
+ message: "请输入手机号"
693
+ }, {
694
+ match: /^1[3-9]\d{9}$/,
695
+ message: "请输入有效的手机号"
696
+ }]
697
+ }, {
698
+ default: i(() => [t(l(w), {
699
+ modelValue: e.value.phone,
700
+ "onUpdate:modelValue": r[0] || (r[0] = (h) => e.value.phone = h),
701
+ placeholder: "请输入手机号",
702
+ autocomplete: "tel",
703
+ type: "tel"
704
+ }, null, 8, ["modelValue"])]),
705
+ _: 1
706
+ }), t(l(b), {
707
+ field: "code",
708
+ label: "验证码",
709
+ "hide-label": "",
710
+ rules: [{
711
+ required: !0,
712
+ message: "请输入验证码"
713
+ }]
714
+ }, {
715
+ default: i(() => [s("div", Pe, [t(l(w), {
716
+ modelValue: e.value.code,
717
+ "onUpdate:modelValue": r[1] || (r[1] = (h) => e.value.code = h),
718
+ placeholder: "请输入验证码",
719
+ autocomplete: "one-time-code"
720
+ }, null, 8, ["modelValue"]), t(U, {
721
+ ref_key: "SendVerifyCodeRef",
722
+ ref: f,
723
+ size: a.size,
724
+ loading: d.value,
725
+ style: {
726
+ "margin-left": "10px"
727
+ },
728
+ onSend: S
729
+ }, null, 8, ["size", "loading"])])]),
730
+ _: 1
731
+ }), a.requirePassword ? (g(), E(l(b), {
732
+ key: 0,
733
+ field: "password",
734
+ label: "密码",
735
+ "hide-label": "",
736
+ rules: [{
737
+ required: a.requirePassword,
738
+ message: "密码请输入"
739
+ }, {
740
+ minLength: 10,
741
+ message: "密码不能少于10字符"
742
+ }]
743
+ }, {
744
+ default: i(() => [t(l(w), {
745
+ modelValue: e.value.password,
746
+ "onUpdate:modelValue": r[2] || (r[2] = (h) => e.value.password = h),
747
+ placeholder: "请输入密码(可选)",
748
+ type: "password",
749
+ autocomplete: "new-password"
750
+ }, null, 8, ["modelValue"])]),
751
+ _: 1
752
+ }, 8, ["rules"])) : $("", !0), a.requirePassword && e.value.password ? (g(), E(l(b), {
753
+ key: 1,
754
+ field: "confirmPassword",
755
+ label: "确认密码",
756
+ "hide-label": "",
757
+ rules: _
758
+ }, {
759
+ default: i(() => [t(l(w), {
760
+ modelValue: e.value.confirmPassword,
761
+ "onUpdate:modelValue": r[3] || (r[3] = (h) => e.value.confirmPassword = h),
762
+ placeholder: "请输入确认密码",
763
+ type: "password",
764
+ autocomplete: "new-password"
765
+ }, null, 8, ["modelValue"])]),
766
+ _: 1
767
+ })) : $("", !0), t(l(b), {
768
+ field: "referrerId",
769
+ label: "邀请人",
770
+ "hide-label": "",
771
+ rules: [{
772
+ required: !1
773
+ }]
774
+ }, {
775
+ default: i(() => [t(l(w), {
776
+ modelValue: e.value.referrerId,
777
+ "onUpdate:modelValue": r[4] || (r[4] = (h) => e.value.referrerId = h),
778
+ placeholder: "邀请人ID(可选)",
779
+ autocomplete: "off"
780
+ }, null, 8, ["modelValue"])]),
781
+ _: 1
782
+ }), s("div", Ae, [t(l(R), {
783
+ type: "primary",
784
+ loading: a.loading,
785
+ long: "",
786
+ size: a.size,
787
+ onClick: c
788
+ }, {
789
+ default: i(() => [...r[5] || (r[5] = [V(" 注册 ", -1)])]),
790
+ _: 1
791
+ }, 8, ["loading", "size"])])]),
792
+ _: 1
793
+ }, 8, ["model", "size"])]), t(ee, {
794
+ onSwitchSignIn: v
795
+ })]));
796
+ }
797
+ }), at = /* @__PURE__ */ C(Ue, [["__scopeId", "data-v-930b6d57"]]), Be = {
798
+ class: "SignInPhone"
799
+ }, xe = {
800
+ class: "content"
801
+ }, Te = {
802
+ class: "sendVerifyCodeItem"
803
+ }, Fe = {
804
+ class: "handle"
805
+ }, Le = /* @__PURE__ */ z({
806
+ __name: "AuthkitSignInPhone",
807
+ props: {
808
+ size: {
809
+ type: String,
810
+ required: !0
811
+ },
812
+ loading: {
813
+ type: Boolean,
814
+ required: !0,
815
+ default: () => !1
816
+ }
817
+ },
818
+ emits: ["submit", "switchSignUp", "switchResetPassword"],
819
+ setup(y, {
820
+ emit: p
821
+ }) {
822
+ const n = p, a = y, f = G(), d = N(() => !!f.OAuth), u = m(), e = m(!1), _ = m(), v = m({
823
+ phone: void 0,
824
+ code: void 0
825
+ });
826
+ function S() {
827
+ n("switchSignUp");
828
+ }
829
+ function c() {
830
+ n("switchResetPassword");
831
+ }
832
+ async function o() {
833
+ _.value.validateField(["phone"]).then((h) => {
834
+ h || (e.value = !0, L({
835
+ phone: v.value.phone
836
+ }).then(() => {
837
+ e.value = !1, u.value.startCountFn();
838
+ }).catch(() => {
839
+ e.value = !1;
840
+ }));
841
+ });
842
+ }
843
+ async function r() {
844
+ _.value.validate().then((h) => {
845
+ h || n("submit", {
846
+ identifier: v.value.phone,
847
+ code: v.value.code,
848
+ method: "code"
849
+ });
850
+ });
851
+ }
852
+ return (h, I) => (g(), k("div", Be, [s("div", xe, [t(l(A), {
853
+ ref_key: "formRef",
854
+ ref: _,
855
+ model: v.value,
856
+ size: a.size,
857
+ "auto-label-width": ""
858
+ }, {
859
+ default: i(() => [t(l(b), {
860
+ field: "phone",
861
+ label: "手机号",
862
+ "hide-label": "",
863
+ rules: [{
864
+ required: !0,
865
+ message: "请输入手机号"
866
+ }, {
867
+ match: /^1[3-9]\d{9}$/,
868
+ message: "请输入有效的手机号"
869
+ }]
870
+ }, {
871
+ default: i(() => [t(l(w), {
872
+ modelValue: v.value.phone,
873
+ "onUpdate:modelValue": I[0] || (I[0] = (q) => v.value.phone = q),
874
+ placeholder: "请输入手机号",
875
+ autocomplete: "tel",
876
+ type: "tel"
877
+ }, null, 8, ["modelValue"])]),
878
+ _: 1
879
+ }), t(l(b), {
880
+ field: "code",
881
+ label: "验证码",
882
+ "hide-label": "",
883
+ rules: [{
884
+ required: !0,
885
+ message: "请输入验证码"
886
+ }]
887
+ }, {
888
+ default: i(() => [s("div", Te, [t(l(w), {
889
+ modelValue: v.value.code,
890
+ "onUpdate:modelValue": I[1] || (I[1] = (q) => v.value.code = q),
891
+ placeholder: "请输入验证码",
892
+ autocomplete: "one-time-code"
893
+ }, null, 8, ["modelValue"]), t(U, {
894
+ ref_key: "SendVerifyCodeRef",
895
+ ref: u,
896
+ size: a.size,
897
+ loading: e.value,
898
+ style: {
899
+ "margin-left": "10px"
900
+ },
901
+ onSend: o
902
+ }, null, 8, ["size", "loading"])])]),
903
+ _: 1
904
+ }), s("div", Fe, [t(l(R), {
905
+ type: "primary",
906
+ loading: a.loading,
907
+ long: "",
908
+ size: a.size,
909
+ onClick: r
910
+ }, {
911
+ default: i(() => [...I[2] || (I[2] = [V(" 登录 ", -1)])]),
912
+ _: 1
913
+ }, 8, ["loading", "size"])])]),
914
+ _: 1
915
+ }, 8, ["model", "size"])]), d.value ? D(h.$slots, "OAuth", {
916
+ key: 0
917
+ }, void 0, !0) : $("", !0), t(te, {
918
+ onSwitchSignUp: S,
919
+ onSwitchResetPassword: c
920
+ })]));
921
+ }
922
+ }), st = /* @__PURE__ */ C(Le, [["__scopeId", "data-v-221e9659"]]);
923
+ export {
924
+ Ze as A,
925
+ et as a,
926
+ tt as b,
927
+ ot as c,
928
+ lt as d,
929
+ at as e,
930
+ st as f
931
+ };