message-verify 1.0.1-beta.46 → 1.0.1-beta.48
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/modal/verify-modal.js +50 -22
- package/package.json +1 -1
- package/src/modal/verify-modal.tsx +37 -9
@@ -69,29 +69,57 @@ const CreateMessageVerifyModal = ({ props }) => {
|
|
69
69
|
}, 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) => {
|
70
70
|
setOtp(val);
|
71
71
|
if (val.length === 6) {
|
72
|
+
// try {
|
73
|
+
// const res = await Promise.race([
|
74
|
+
// new Promise((resolve, reject) => {
|
75
|
+
// setTimeout(() => {
|
76
|
+
// reject(new Error('Timeout'));
|
77
|
+
// }, 1000);
|
78
|
+
// }),
|
79
|
+
// new Promise((resolve, reject) => {
|
80
|
+
// http({
|
81
|
+
// ...config,
|
82
|
+
// headers: {
|
83
|
+
// ...http.defaults.headers.common,
|
84
|
+
// 'sms-code': val,
|
85
|
+
// 'sms-code-key': verifyCodeKey,
|
86
|
+
// 'Content-Type': config.headers['Content-Type'],
|
87
|
+
// }
|
88
|
+
// }).then(res => {
|
89
|
+
// resolve(res);
|
90
|
+
// }).catch(err => {
|
91
|
+
// reject(err);
|
92
|
+
// })
|
93
|
+
// ]) as any;
|
94
|
+
// if (res?.data?.status?.code === 0) {
|
95
|
+
// apiResolve(res);
|
96
|
+
// setVisible(false);
|
97
|
+
// } else {
|
98
|
+
// message.error('验证失败');
|
99
|
+
// setOtp('');
|
100
|
+
// }
|
101
|
+
// } catch (error) {
|
102
|
+
// console.warn('catch', error);
|
103
|
+
// message.error('验证失败');
|
104
|
+
// setOtp('');
|
105
|
+
// }
|
72
106
|
try {
|
73
|
-
const res =
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
resolve(res);
|
90
|
-
}).catch(err => {
|
91
|
-
reject(err);
|
92
|
-
});
|
93
|
-
})
|
94
|
-
]);
|
107
|
+
const res = new Promise((resolve, reject) => {
|
108
|
+
http({
|
109
|
+
...config,
|
110
|
+
headers: {
|
111
|
+
...http.defaults.headers.common,
|
112
|
+
'sms-code': val,
|
113
|
+
'sms-code-key': verifyCodeKey,
|
114
|
+
'Content-Type': config.headers['Content-Type'],
|
115
|
+
}
|
116
|
+
}).then(res => {
|
117
|
+
resolve(res);
|
118
|
+
}).catch(err => {
|
119
|
+
reject(err);
|
120
|
+
});
|
121
|
+
});
|
122
|
+
console.log('res', res);
|
95
123
|
if (res?.data?.status?.code === 0) {
|
96
124
|
apiResolve(res);
|
97
125
|
setVisible(false);
|
package/package.json
CHANGED
@@ -85,14 +85,42 @@ const CreateMessageVerifyModal = ({ props }: { props: VerifyModalConfig }) => {
|
|
85
85
|
onChange={async (val) => {
|
86
86
|
setOtp(val);
|
87
87
|
if (val.length === 6) {
|
88
|
+
// try {
|
89
|
+
// const res = await Promise.race([
|
90
|
+
// new Promise((resolve, reject) => {
|
91
|
+
// setTimeout(() => {
|
92
|
+
// reject(new Error('Timeout'));
|
93
|
+
// }, 1000);
|
94
|
+
// }),
|
95
|
+
// new Promise((resolve, reject) => {
|
96
|
+
// http({
|
97
|
+
// ...config,
|
98
|
+
// headers: {
|
99
|
+
// ...http.defaults.headers.common,
|
100
|
+
// 'sms-code': val,
|
101
|
+
// 'sms-code-key': verifyCodeKey,
|
102
|
+
// 'Content-Type': config.headers['Content-Type'],
|
103
|
+
// }
|
104
|
+
// }).then(res => {
|
105
|
+
// resolve(res);
|
106
|
+
// }).catch(err => {
|
107
|
+
// reject(err);
|
108
|
+
// })
|
109
|
+
// ]) as any;
|
110
|
+
// if (res?.data?.status?.code === 0) {
|
111
|
+
// apiResolve(res);
|
112
|
+
// setVisible(false);
|
113
|
+
// } else {
|
114
|
+
// message.error('验证失败');
|
115
|
+
// setOtp('');
|
116
|
+
// }
|
117
|
+
// } catch (error) {
|
118
|
+
// console.warn('catch', error);
|
119
|
+
// message.error('验证失败');
|
120
|
+
// setOtp('');
|
121
|
+
// }
|
88
122
|
try {
|
89
|
-
const res =
|
90
|
-
new Promise((resolve, reject) => {
|
91
|
-
setTimeout(() => {
|
92
|
-
reject(new Error('Timeout'));
|
93
|
-
}, 8000);
|
94
|
-
}),
|
95
|
-
new Promise((resolve, reject) => {
|
123
|
+
const res = new Promise((resolve, reject) => {
|
96
124
|
http({
|
97
125
|
...config,
|
98
126
|
headers: {
|
@@ -105,9 +133,9 @@ const CreateMessageVerifyModal = ({ props }: { props: VerifyModalConfig }) => {
|
|
105
133
|
resolve(res);
|
106
134
|
}).catch(err => {
|
107
135
|
reject(err);
|
108
|
-
})
|
109
136
|
})
|
110
|
-
|
137
|
+
}) as any;
|
138
|
+
console.log('res', res);
|
111
139
|
if (res?.data?.status?.code === 0) {
|
112
140
|
apiResolve(res);
|
113
141
|
setVisible(false);
|