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