message-verify 1.0.0-beta.16 → 1.0.0-beta.18
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/verify-modal.js +21 -15
- package/package.json +1 -1
- package/src/verify-modal.tsx +20 -19
package/dist/verify-modal.js
CHANGED
@@ -63,24 +63,30 @@ const CreateMessageVerifyModal = ({ props }) => {
|
|
63
63
|
return (_jsxs(Modal, { width: 420, visible: visible, onClose: () => {
|
64
64
|
setVisible(false);
|
65
65
|
props.onClose?.();
|
66
|
-
}, children: [_jsx("div", { style: { fontSize: 14, color: '#666' }, children: t('alreadySend', lang, { phone: mobile }) }), _jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: 8, marginTop: 12 }, children: [_jsx(Input.OTP, { length: 6, value: otp, onChange: (val) => {
|
66
|
+
}, children: [_jsx("div", { style: { fontSize: 14, color: '#666' }, children: t('alreadySend', lang, { phone: mobile }) }), _jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: 8, marginTop: 12 }, children: [_jsx(Input.OTP, { length: 6, value: otp, onChange: async (val) => {
|
67
67
|
setOtp(val);
|
68
68
|
if (val.length === 6) {
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
69
|
+
try {
|
70
|
+
const res = await http({
|
71
|
+
...config,
|
72
|
+
headers: {
|
73
|
+
...http.defaults.headers.common,
|
74
|
+
'sms-code': val,
|
75
|
+
'sms-code-key': verifyCodeKey,
|
76
|
+
'Content-Type': config.headers['Content-Type'],
|
77
|
+
}
|
78
|
+
});
|
79
|
+
// 健壮性判断
|
80
|
+
if (!res || !res.data || !res.data.status) {
|
81
|
+
console.log('response结构异常', res);
|
82
|
+
return;
|
76
83
|
}
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
});
|
84
|
+
const { code, detail } = res.data.status;
|
85
|
+
console.log('打印', detail, code);
|
86
|
+
}
|
87
|
+
catch (error) {
|
88
|
+
console.log('请求异常', error);
|
89
|
+
}
|
84
90
|
}
|
85
91
|
} }), _jsx(Button, { disabled: countdown > 0 || !captchCode, onClick: handleResend, style: { padding: '8px' }, children: countdown > 0 ? t('countDownSecound', lang, { countdown }) : t('reSend', lang) })] }), countdown > 0 ? null :
|
86
92
|
_jsxs("div", { style: { marginTop: 12, display: 'flex', alignItems: 'center' }, children: [_jsx(Input, { placeholder: t('pleaseEnterPicVerifyCode', lang), onChange: (e) => {
|
package/package.json
CHANGED
package/src/verify-modal.tsx
CHANGED
@@ -78,28 +78,29 @@ const CreateMessageVerifyModal = ({ props }: { props: ModalConfig }) => {
|
|
78
78
|
<Input.OTP
|
79
79
|
length={6}
|
80
80
|
value={otp}
|
81
|
-
onChange={(val) => {
|
81
|
+
onChange={async (val) => {
|
82
82
|
setOtp(val);
|
83
83
|
if (val.length === 6) {
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
84
|
+
try {
|
85
|
+
const res = await http({
|
86
|
+
...config,
|
87
|
+
headers: {
|
88
|
+
...http.defaults.headers.common,
|
89
|
+
'sms-code': val,
|
90
|
+
'sms-code-key': verifyCodeKey,
|
91
|
+
'Content-Type': config.headers['Content-Type'],
|
92
|
+
}
|
93
|
+
}) as any;
|
94
|
+
// 健壮性判断
|
95
|
+
if (!res || !res.data || !res.data.status) {
|
96
|
+
console.log('response结构异常', res);
|
97
|
+
return;
|
91
98
|
}
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
console.log('打印', detail, code, responseType);
|
98
|
-
},
|
99
|
-
(error: unknown) => {
|
100
|
-
console.log('打印', error);
|
101
|
-
},
|
102
|
-
);
|
99
|
+
const { code, detail } = res.data.status;
|
100
|
+
console.log('打印', detail, code);
|
101
|
+
} catch (error) {
|
102
|
+
console.log('请求异常', error);
|
103
|
+
}
|
103
104
|
}
|
104
105
|
}} />
|
105
106
|
<Button
|