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.
@@ -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
- // 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
- // }
73
+ console.log('val2===>');
106
74
  try {
107
- 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
- console.log('res', res);
118
- console.log('res?.data?.status?.code', res?.data?.status?.code);
119
- if (res?.data?.status?.code === 0) {
120
- console.log('res?.data?.status?.code2', res?.data?.status?.code);
121
- apiResolve(res);
122
- setVisible(false);
123
- }
124
- else {
125
- console.log('res?.data?.status?.code3', res?.data?.status?.code);
126
- message.error('验证失败');
127
- setOtp('');
128
- }
129
- resolve(res);
130
- }).catch(err => {
131
- console.log('err', err);
132
- reject(err);
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "message-verify",
3
- "version": "1.0.1-beta.50",
3
+ "version": "1.0.1-beta.52",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "dependencies": {
@@ -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
- // 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
- // }
89
+ console.log('val2===>');
122
90
  try {
123
- new Promise((resolve, reject) => {
124
- http({
125
- ...config,
126
- headers: {
127
- ...http.defaults.headers.common,
128
- 'sms-code': val,
129
- 'sms-code-key': verifyCodeKey,
130
- 'Content-Type': config.headers['Content-Type'],
131
- }
132
- }).then((res: any) => {
133
- console.log('res', res);
134
- console.log('res?.data?.status?.code', res?.data?.status?.code)
135
- if (res?.data?.status?.code === 0) {
136
- console.log('res?.data?.status?.code2', res?.data?.status?.code)
137
- apiResolve(res);
138
- setVisible(false);
139
- } else {
140
- console.log('res?.data?.status?.code3', res?.data?.status?.code)
141
- message.error('验证失败');
142
- setOtp('');
143
- }
144
- resolve(res);
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('验证失败');