message-verify 0.0.36-beta.0 → 0.0.37-beta.0
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/app.js +86 -55
- package/dist/resource.js +4 -4
- package/package.json +1 -2
- package/src/app.tsx +86 -83
- package/src/resource.ts +4 -4
package/dist/app.js
CHANGED
@@ -1,58 +1,89 @@
|
|
1
|
-
import {
|
2
|
-
import { useEffect, useState } from 'react'
|
3
|
-
import { createPortal } from 'react-dom';
|
4
|
-
import { Input, Button, Modal, message } from 'antd';
|
5
|
-
import Api from './resource.js'
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
+
// import { useEffect, useState } from 'react'
|
3
|
+
// import { createPortal } from 'react-dom';
|
4
|
+
// import { Input, Button, Modal, message } from 'antd';
|
5
|
+
// import Api from './resource.js'
|
6
6
|
import '@ant-design/v5-patch-for-react-19';
|
7
|
-
const App = (
|
8
|
-
const { mobile } = data || {};
|
9
|
-
const [countdown, setCountdown] = useState(3);
|
10
|
-
const [visible, setVisible] = useState(isShow || false);
|
11
|
-
const [captchaImage, setCaptchaImage] = useState('');
|
12
|
-
const [captchCode, setCaptchCode] = useState('');
|
13
|
-
const [captchaKey, setCaptchaKey] = useState('');
|
14
|
-
const getKey = async () => {
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
}
|
25
|
-
useEffect(() => {
|
26
|
-
|
27
|
-
}, [])
|
28
|
-
useEffect(() => {
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
7
|
+
const App = () => {
|
8
|
+
// const { mobile } = data || {};
|
9
|
+
// const [countdown, setCountdown] = useState(3);
|
10
|
+
// const [visible, setVisible] = useState(isShow || false);
|
11
|
+
// const [captchaImage, setCaptchaImage] = useState<string>('');
|
12
|
+
// const [captchCode, setCaptchCode] = useState<string>('');
|
13
|
+
// const [captchaKey, setCaptchaKey] = useState<string>('');
|
14
|
+
// const getKey = async () => {
|
15
|
+
// const res = await Api.getCaptchaKey();
|
16
|
+
// const { body: key } = res.data || {};
|
17
|
+
// setCaptchaKey(key);
|
18
|
+
// if(key) {
|
19
|
+
// console.log('res=>key', key);
|
20
|
+
// const image = Api.getCaptchaImgUrl(key) as unknown;
|
21
|
+
// console.log('image', image);
|
22
|
+
// setCaptchaImage(image as string);
|
23
|
+
// }
|
24
|
+
// }
|
25
|
+
// useEffect(() => {
|
26
|
+
// setVisible(true);
|
27
|
+
// }, [])
|
28
|
+
// useEffect(() => {
|
29
|
+
// let timer: number | null = null;
|
30
|
+
// if (visible && countdown > 0) {
|
31
|
+
// timer = setInterval(() => {
|
32
|
+
// setCountdown((prev) => prev - 1);
|
33
|
+
// }, 1000);
|
34
|
+
// }
|
35
|
+
// if (countdown === 0) {
|
36
|
+
// getKey();
|
37
|
+
// }
|
38
|
+
// return () => {
|
39
|
+
// if (timer) clearInterval(timer);
|
40
|
+
// };
|
41
|
+
// }, [visible, countdown]);
|
42
|
+
// const handleResend = async() => {
|
43
|
+
// setCountdown(60);
|
44
|
+
// const res = await Api.reSendCode({captchaKey, captcha: captchCode});
|
45
|
+
// console.log('handleResend=>res', res);
|
46
|
+
// // message.success('发送成功');
|
47
|
+
// }
|
48
|
+
// const renderModal = (
|
49
|
+
// <Modal
|
50
|
+
// open={visible}
|
51
|
+
// onClose={() => setVisible(false)}
|
52
|
+
// width={400}
|
53
|
+
// footer={
|
54
|
+
// <Button onClick={() => {/* 提交逻辑 */}}>
|
55
|
+
// 提交
|
56
|
+
// </Button>
|
57
|
+
// }
|
58
|
+
// >
|
59
|
+
// <div>已发送短信至您的手机:{mobile}</div>
|
60
|
+
// {countdown > 0 ? null : <div style={{ marginTop: 8, display: 'flex', alignItems: 'center', width: 300 }}>
|
61
|
+
// <Input onChange={(e) => {
|
62
|
+
// setCaptchCode(e.target.value as string)
|
63
|
+
// }} />
|
64
|
+
// {captchaImage && <img src={captchaImage} alt="验证码" style={{ width: 100, height: 30, marginLeft: 8 }} onClick={getKey} />}
|
65
|
+
// </div>}
|
66
|
+
// {countdown > 0 ? null : <div>请输入图形验证码后,重新发送验证码</div>}
|
67
|
+
// <div style={{ display: 'flex', alignItems: 'center', gap: 8, marginTop: 8 }}>
|
68
|
+
// <Input.OTP
|
69
|
+
// disabled={!captchCode}
|
70
|
+
// length={6}
|
71
|
+
// onChange={(val) => {console.log('change', val)}}
|
72
|
+
// />
|
73
|
+
// <Button
|
74
|
+
// disabled={countdown > 0 || !captchCode}
|
75
|
+
// onClick={handleResend}
|
76
|
+
// >
|
77
|
+
// {countdown > 0 ? `${countdown}秒` : '重新发送'}
|
78
|
+
// </Button>
|
79
|
+
// </div>
|
80
|
+
// </Modal>
|
81
|
+
// )
|
82
|
+
// console.log('captchCode', captchCode);
|
83
|
+
// if(isShow) {
|
84
|
+
// return createPortal(renderModal, document.body);
|
85
|
+
// }
|
86
|
+
// return null;
|
87
|
+
return _jsx("div", { children: "111" });
|
57
88
|
};
|
58
89
|
export default App;
|
package/dist/resource.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import { assign, axios as instance, customPost } from '@yqg/resource';
|
2
|
-
import { message } from 'antd';
|
2
|
+
// import { message } from 'antd';
|
3
3
|
import { YQG_SUCCESS } from './utils/status.js';
|
4
4
|
const urlPrefix = '/admin/';
|
5
5
|
// axios.defaults.headers.common['Access-Control-Allow-Origin'] = '*';
|
@@ -14,7 +14,7 @@ instance.interceptors.response.use((res) => {
|
|
14
14
|
reader.readAsText(res.data, 'utf-8');
|
15
15
|
reader.onload = () => {
|
16
16
|
const parsedObj = JSON.parse(reader.result);
|
17
|
-
message.info(parsedObj?.status?.detail);
|
17
|
+
// message.info(parsedObj?.status?.detail);
|
18
18
|
};
|
19
19
|
return Promise.reject();
|
20
20
|
}
|
@@ -29,13 +29,13 @@ instance.interceptors.response.use((res) => {
|
|
29
29
|
case YQG_SUCCESS:
|
30
30
|
return Promise.resolve(res);
|
31
31
|
default: {
|
32
|
-
message.error(detail);
|
32
|
+
// message.error(detail);
|
33
33
|
return Promise.reject(res);
|
34
34
|
}
|
35
35
|
}
|
36
36
|
}, (err) => {
|
37
37
|
const detail = err?.data?.status?.detail || 'Unknown error';
|
38
|
-
message.error(detail);
|
38
|
+
// message.error(detail);
|
39
39
|
return Promise.reject(err);
|
40
40
|
});
|
41
41
|
const api = {
|
package/package.json
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
{
|
2
2
|
"name": "message-verify",
|
3
|
-
"version": "0.0.
|
3
|
+
"version": "0.0.37-beta.0",
|
4
4
|
"type": "module",
|
5
5
|
"main": "dist/index.js",
|
6
6
|
"dependencies": {
|
7
7
|
"@ant-design/v5-patch-for-react-19": "^1.0.3",
|
8
8
|
"@fingerprintjs/fingerprintjs": "^4.6.2",
|
9
9
|
"@yqg/resource": "^1.3.8",
|
10
|
-
"antd": "^5.24.8",
|
11
10
|
"react": "^19.0.0",
|
12
11
|
"react-dom": "^19.0.0"
|
13
12
|
},
|
package/src/app.tsx
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
import { useEffect, useState } from 'react'
|
2
|
-
import { createPortal } from 'react-dom';
|
3
|
-
import { Input, Button, Modal, message } from 'antd';
|
4
|
-
import Api from './resource.js'
|
1
|
+
// import { useEffect, useState } from 'react'
|
2
|
+
// import { createPortal } from 'react-dom';
|
3
|
+
// import { Input, Button, Modal, message } from 'antd';
|
4
|
+
// import Api from './resource.js'
|
5
5
|
import '@ant-design/v5-patch-for-react-19';
|
6
6
|
|
7
7
|
interface Props {
|
@@ -13,92 +13,95 @@ interface Props {
|
|
13
13
|
refresh: () => void;
|
14
14
|
isShow: boolean;
|
15
15
|
}
|
16
|
-
const App: React.FC<Props> = (
|
17
|
-
const { mobile } = data || {};
|
18
|
-
const [countdown, setCountdown] = useState(3);
|
19
|
-
const [visible, setVisible] = useState(isShow || false);
|
20
|
-
const [captchaImage, setCaptchaImage] = useState<string>('');
|
21
|
-
const [captchCode, setCaptchCode] = useState<string>('');
|
22
|
-
const [captchaKey, setCaptchaKey] = useState<string>('');
|
16
|
+
const App: React.FC<Props> = () => {
|
17
|
+
// const { mobile } = data || {};
|
18
|
+
// const [countdown, setCountdown] = useState(3);
|
19
|
+
// const [visible, setVisible] = useState(isShow || false);
|
20
|
+
// const [captchaImage, setCaptchaImage] = useState<string>('');
|
21
|
+
// const [captchCode, setCaptchCode] = useState<string>('');
|
22
|
+
// const [captchaKey, setCaptchaKey] = useState<string>('');
|
23
23
|
|
24
|
-
const getKey = async () => {
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
}
|
24
|
+
// const getKey = async () => {
|
25
|
+
// const res = await Api.getCaptchaKey();
|
26
|
+
// const { body: key } = res.data || {};
|
27
|
+
// setCaptchaKey(key);
|
28
|
+
// if(key) {
|
29
|
+
// console.log('res=>key', key);
|
30
|
+
// const image = Api.getCaptchaImgUrl(key) as unknown;
|
31
|
+
// console.log('image', image);
|
32
|
+
// setCaptchaImage(image as string);
|
33
|
+
// }
|
34
|
+
// }
|
35
35
|
|
36
|
-
useEffect(() => {
|
37
|
-
|
38
|
-
}, [])
|
36
|
+
// useEffect(() => {
|
37
|
+
// setVisible(true);
|
38
|
+
// }, [])
|
39
39
|
|
40
|
-
useEffect(() => {
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
}, [visible, countdown]);
|
40
|
+
// useEffect(() => {
|
41
|
+
// let timer: number | null = null;
|
42
|
+
// if (visible && countdown > 0) {
|
43
|
+
// timer = setInterval(() => {
|
44
|
+
// setCountdown((prev) => prev - 1);
|
45
|
+
// }, 1000);
|
46
|
+
// }
|
47
|
+
// if (countdown === 0) {
|
48
|
+
// getKey();
|
49
|
+
// }
|
50
|
+
// return () => {
|
51
|
+
// if (timer) clearInterval(timer);
|
52
|
+
// };
|
53
|
+
// }, [visible, countdown]);
|
54
54
|
|
55
|
-
const handleResend = async() => {
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
}
|
55
|
+
// const handleResend = async() => {
|
56
|
+
// setCountdown(60);
|
57
|
+
// const res = await Api.reSendCode({captchaKey, captcha: captchCode});
|
58
|
+
// console.log('handleResend=>res', res);
|
59
|
+
// // message.success('发送成功');
|
60
|
+
// }
|
61
61
|
|
62
|
-
const renderModal = (
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
62
|
+
// const renderModal = (
|
63
|
+
// <Modal
|
64
|
+
// open={visible}
|
65
|
+
// onClose={() => setVisible(false)}
|
66
|
+
// width={400}
|
67
|
+
// footer={
|
68
|
+
// <Button onClick={() => {/* 提交逻辑 */}}>
|
69
|
+
// 提交
|
70
|
+
// </Button>
|
71
|
+
// }
|
72
|
+
// >
|
73
|
+
// <div>已发送短信至您的手机:{mobile}</div>
|
74
|
+
// {countdown > 0 ? null : <div style={{ marginTop: 8, display: 'flex', alignItems: 'center', width: 300 }}>
|
75
|
+
// <Input onChange={(e) => {
|
76
|
+
// setCaptchCode(e.target.value as string)
|
77
|
+
// }} />
|
77
78
|
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
79
|
+
// {captchaImage && <img src={captchaImage} alt="验证码" style={{ width: 100, height: 30, marginLeft: 8 }} onClick={getKey} />}
|
80
|
+
// </div>}
|
81
|
+
// {countdown > 0 ? null : <div>请输入图形验证码后,重新发送验证码</div>}
|
82
|
+
// <div style={{ display: 'flex', alignItems: 'center', gap: 8, marginTop: 8 }}>
|
83
|
+
// <Input.OTP
|
84
|
+
// disabled={!captchCode}
|
85
|
+
// length={6}
|
86
|
+
// onChange={(val) => {console.log('change', val)}}
|
87
|
+
// />
|
88
|
+
// <Button
|
89
|
+
// disabled={countdown > 0 || !captchCode}
|
90
|
+
// onClick={handleResend}
|
91
|
+
// >
|
92
|
+
// {countdown > 0 ? `${countdown}秒` : '重新发送'}
|
93
|
+
// </Button>
|
94
|
+
// </div>
|
95
|
+
// </Modal>
|
96
|
+
|
97
|
+
// )
|
96
98
|
|
97
|
-
console.log('captchCode', captchCode);
|
98
|
-
if(isShow) {
|
99
|
-
|
100
|
-
}
|
101
|
-
return null;
|
99
|
+
// console.log('captchCode', captchCode);
|
100
|
+
// if(isShow) {
|
101
|
+
// return createPortal(renderModal, document.body);
|
102
|
+
// }
|
103
|
+
// return null;
|
104
|
+
return <div>111</div>
|
102
105
|
}
|
103
106
|
|
104
107
|
export default App;
|
package/src/resource.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import { assign, axios as instance, customPost } from '@yqg/resource';
|
2
|
-
import { message } from 'antd';
|
2
|
+
// import { message } from 'antd';
|
3
3
|
import { YQG_SUCCESS } from './utils/status.js';
|
4
4
|
|
5
5
|
const urlPrefix = '/admin/';
|
@@ -16,7 +16,7 @@ instance.interceptors.response.use(
|
|
16
16
|
reader.readAsText(res.data, 'utf-8');
|
17
17
|
reader.onload = () => {
|
18
18
|
const parsedObj = JSON.parse(reader.result as string);
|
19
|
-
message.info(parsedObj?.status?.detail);
|
19
|
+
// message.info(parsedObj?.status?.detail);
|
20
20
|
};
|
21
21
|
|
22
22
|
return Promise.reject();
|
@@ -33,14 +33,14 @@ instance.interceptors.response.use(
|
|
33
33
|
case YQG_SUCCESS:
|
34
34
|
return Promise.resolve(res);
|
35
35
|
default: {
|
36
|
-
message.error(detail);
|
36
|
+
// message.error(detail);
|
37
37
|
return Promise.reject(res);
|
38
38
|
}
|
39
39
|
}
|
40
40
|
},
|
41
41
|
(err: {data: {status: {detail: string}}}) => {
|
42
42
|
const detail = err?.data?.status?.detail || 'Unknown error';
|
43
|
-
message.error(detail);
|
43
|
+
// message.error(detail);
|
44
44
|
|
45
45
|
return Promise.reject(err);
|
46
46
|
},
|