message-verify 1.0.0-beta.4 → 1.0.0-beta.6
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/index.js +1 -1
- package/dist/main.js +3 -1
- package/dist/utils/type.d.ts +1 -0
- package/dist/verify-modal.js +3 -2
- package/package.json +1 -1
- package/src/index.tsx +1 -1
- package/src/main.tsx +4 -1
- package/src/utils/type.ts +1 -0
- package/src/verify-modal.tsx +3 -2
package/dist/index.js
CHANGED
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import ReactDOM from 'react-dom/client';
|
3
3
|
import VerifyModal from './verify-modal.js';
|
4
4
|
import Fingerprint2 from 'fingerprintjs2';
|
5
|
-
export const initFingerprint = () => {
|
5
|
+
export const initFingerprint = async () => {
|
6
6
|
return new Promise((resolve) => {
|
7
7
|
Fingerprint2.get(function (components) {
|
8
8
|
const includeKeys = ['userAgent', 'deviceMemory', 'cpuClass', 'hardwareConcurrency', 'platform'];
|
package/dist/main.js
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
2
2
|
import { createRoot } from 'react-dom/client';
|
3
|
-
import { createMessageVerifyModal } from './index.js'; // 或 './index'
|
3
|
+
import { createMessageVerifyModal, initFingerprint } from './index.js'; // 或 './index'
|
4
4
|
import { axios } from '@yqg/resource';
|
5
5
|
const data = "{\"mobile\":\"188****4035\",\"verifyCodeKey\":\"3f025b33-988e-47c0-950d-6beb776d043f\",\"needValid\":true,\"step\":2,\"message\":\"需要填写验证码\"}";
|
6
|
+
const fp = await initFingerprint();
|
7
|
+
console.log(fp);
|
6
8
|
createRoot(document.getElementById('root')).render(_jsx("button", { onClick: () => createMessageVerifyModal({
|
7
9
|
data,
|
8
10
|
config: { headers: {} },
|
package/dist/utils/type.d.ts
CHANGED
package/dist/verify-modal.js
CHANGED
@@ -3,6 +3,7 @@ import { useEffect, useState } from 'react';
|
|
3
3
|
import { Modal, Input, Button, message } from './compoments/index.js';
|
4
4
|
import Api from './resource.js';
|
5
5
|
import t from './utils/i18n.js';
|
6
|
+
import { axios } from '@yqg/resource';
|
6
7
|
const CreateMessageVerifyModal = ({ props }) => {
|
7
8
|
const [visible, setVisible] = useState(true);
|
8
9
|
const [countdown, setCountdown] = useState(60);
|
@@ -10,7 +11,7 @@ const CreateMessageVerifyModal = ({ props }) => {
|
|
10
11
|
const [captchaImage, setCaptchaImage] = useState('');
|
11
12
|
const [captchCode, setCaptchCode] = useState('');
|
12
13
|
const [captchaKey, setCaptchaKey] = useState('');
|
13
|
-
const { data, config, http, lang } = props || {};
|
14
|
+
const { data, config, http, lang, api = '/admin/sms/send' } = props || {};
|
14
15
|
const dataObj = JSON.parse(data || '{}');
|
15
16
|
const { mobile, verifyCodeKey } = dataObj || {};
|
16
17
|
const getKey = async () => {
|
@@ -51,7 +52,7 @@ const CreateMessageVerifyModal = ({ props }) => {
|
|
51
52
|
formData.append('captchaKey', captchaKey);
|
52
53
|
formData.append('captcha', captchCode);
|
53
54
|
// 重新发送验证码
|
54
|
-
await
|
55
|
+
await axios.post(api, formData);
|
55
56
|
message.success(t('sendSuccess', lang));
|
56
57
|
};
|
57
58
|
return (_jsxs(Modal, { width: 420, visible: visible, onClose: () => {
|
package/package.json
CHANGED
package/src/index.tsx
CHANGED
@@ -3,7 +3,7 @@ import VerifyModal from './verify-modal.js'
|
|
3
3
|
import Fingerprint2 from 'fingerprintjs2';
|
4
4
|
import { ModalConfig } from './utils/type.js';
|
5
5
|
|
6
|
-
export const initFingerprint = (): Promise<string> => {
|
6
|
+
export const initFingerprint = async (): Promise<string> => {
|
7
7
|
return new Promise((resolve) => {
|
8
8
|
Fingerprint2.get(function (components) {
|
9
9
|
const includeKeys = ['userAgent', 'deviceMemory', 'cpuClass', 'hardwareConcurrency', 'platform'];
|
package/src/main.tsx
CHANGED
@@ -1,9 +1,12 @@
|
|
1
1
|
import { createRoot } from 'react-dom/client';
|
2
|
-
import { createMessageVerifyModal } from './index.js'; // 或 './index'
|
2
|
+
import { createMessageVerifyModal, initFingerprint } from './index.js'; // 或 './index'
|
3
3
|
import { axios } from '@yqg/resource';
|
4
4
|
|
5
5
|
const data = "{\"mobile\":\"188****4035\",\"verifyCodeKey\":\"3f025b33-988e-47c0-950d-6beb776d043f\",\"needValid\":true,\"step\":2,\"message\":\"需要填写验证码\"}";
|
6
6
|
|
7
|
+
const fp = await initFingerprint();
|
8
|
+
console.log(fp);
|
9
|
+
|
7
10
|
createRoot(document.getElementById('root')!).render(
|
8
11
|
<button onClick={() => createMessageVerifyModal({
|
9
12
|
data,
|
package/src/utils/type.ts
CHANGED
package/src/verify-modal.tsx
CHANGED
@@ -3,6 +3,7 @@ import { Modal, Input, Button, message } from './compoments/index.js'
|
|
3
3
|
import Api from './resource.js'
|
4
4
|
import t from './utils/i18n.js'
|
5
5
|
import { ModalConfig } from './utils/type.js';
|
6
|
+
import { axios } from '@yqg/resource';
|
6
7
|
|
7
8
|
const CreateMessageVerifyModal = ({ props }: { props: ModalConfig }) => {
|
8
9
|
const [visible, setVisible] = useState(true);
|
@@ -11,7 +12,7 @@ const CreateMessageVerifyModal = ({ props }: { props: ModalConfig }) => {
|
|
11
12
|
const [captchaImage, setCaptchaImage] = useState<string>('');
|
12
13
|
const [captchCode, setCaptchCode] = useState<string>('');
|
13
14
|
const [captchaKey, setCaptchaKey] = useState<string>('');
|
14
|
-
const { data, config, http, lang } = props || {};
|
15
|
+
const { data, config, http, lang, api='/admin/sms/send' } = props || {};
|
15
16
|
const dataObj = JSON.parse(data || '{}');
|
16
17
|
const { mobile, verifyCodeKey } = dataObj || {};
|
17
18
|
|
@@ -53,7 +54,7 @@ const CreateMessageVerifyModal = ({ props }: { props: ModalConfig }) => {
|
|
53
54
|
formData.append('captchaKey', captchaKey);
|
54
55
|
formData.append('captcha', captchCode);
|
55
56
|
// 重新发送验证码
|
56
|
-
await
|
57
|
+
await axios.post(api, formData);
|
57
58
|
message.success(t('sendSuccess', lang));
|
58
59
|
}
|
59
60
|
|