message-verify 1.0.1-beta.50 → 1.0.1-beta.51
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 +36 -62
- package/package.json +1 -1
- package/src/modal/verify-modal.tsx +34 -60
@@ -68,70 +68,44 @@ 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
|
-
// 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
|
-
// }
|
106
73
|
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
|
-
|
74
|
+
const res = await Promise.race([
|
75
|
+
// new Promise((resolve, reject) => {
|
76
|
+
// setTimeout(() => {
|
77
|
+
// reject(new Error('Timeout'));
|
78
|
+
// }, 1000);
|
79
|
+
// }),
|
80
|
+
new Promise((resolve, reject) => {
|
81
|
+
http({
|
82
|
+
...config,
|
83
|
+
headers: {
|
84
|
+
...http.defaults.headers.common,
|
85
|
+
'sms-code': val,
|
86
|
+
'sms-code-key': verifyCodeKey,
|
87
|
+
'Content-Type': config.headers['Content-Type'],
|
88
|
+
}
|
89
|
+
}).then(res => {
|
90
|
+
console.log('res', res);
|
91
|
+
resolve(res);
|
92
|
+
}).catch(err => {
|
93
|
+
console.log('err', err);
|
94
|
+
reject(err);
|
95
|
+
});
|
96
|
+
})
|
97
|
+
]);
|
98
|
+
console.log('res', res);
|
99
|
+
if (res?.data?.status?.code === 0) {
|
100
|
+
console.log('code', res?.data?.status?.code);
|
101
|
+
apiResolve(res);
|
102
|
+
setVisible(false);
|
103
|
+
}
|
104
|
+
else {
|
105
|
+
console.log('验证失败');
|
106
|
+
message.error('验证失败');
|
107
|
+
setOtp('');
|
108
|
+
}
|
135
109
|
}
|
136
110
|
catch (error) {
|
137
111
|
console.warn('catch=>error', error);
|
package/package.json
CHANGED
@@ -84,69 +84,43 @@ 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
|
-
// 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
|
-
// }
|
122
89
|
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);
|
90
|
+
const res = await Promise.race([
|
91
|
+
// new Promise((resolve, reject) => {
|
92
|
+
// setTimeout(() => {
|
93
|
+
// reject(new Error('Timeout'));
|
94
|
+
// }, 1000);
|
95
|
+
// }),
|
96
|
+
new Promise((resolve, reject) => {
|
97
|
+
http({
|
98
|
+
...config,
|
99
|
+
headers: {
|
100
|
+
...http.defaults.headers.common,
|
101
|
+
'sms-code': val,
|
102
|
+
'sms-code-key': verifyCodeKey,
|
103
|
+
'Content-Type': config.headers['Content-Type'],
|
104
|
+
}
|
105
|
+
}).then(res => {
|
106
|
+
console.log('res', res);
|
107
|
+
resolve(res);
|
108
|
+
}).catch(err => {
|
109
|
+
console.log('err', err);
|
110
|
+
reject(err);
|
111
|
+
})
|
148
112
|
})
|
149
|
-
|
113
|
+
]) as any;
|
114
|
+
console.log('res', res);
|
115
|
+
if (res?.data?.status?.code === 0) {
|
116
|
+
console.log('code', res?.data?.status?.code);
|
117
|
+
apiResolve(res);
|
118
|
+
setVisible(false);
|
119
|
+
} else {
|
120
|
+
console.log('验证失败');
|
121
|
+
message.error('验证失败');
|
122
|
+
setOtp('');
|
123
|
+
}
|
150
124
|
} catch (error) {
|
151
125
|
console.warn('catch=>error', error);
|
152
126
|
message.error('验证失败');
|