message-verify 0.0.33-beta.0 → 0.0.34-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/index.d.ts CHANGED
@@ -1,7 +1,9 @@
1
1
  export type ModalConfig = {
2
- content: React.ReactNode;
3
- title?: string;
4
- width?: number;
2
+ data: {
3
+ mobile: string;
4
+ verifyCodeKey: string;
5
+ sendSuccess: boolean;
6
+ };
5
7
  onClose?: () => void;
6
8
  };
7
- export declare const showModal: (config: ModalConfig) => void;
9
+ export declare const createMessageVerifyModal: (config: ModalConfig) => void;
package/dist/index.js CHANGED
@@ -1,54 +1,27 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- // import App from './app.js';
3
- // import { createRoot } from 'react-dom/client';
4
- // interface Props {
5
- // data: {
6
- // mobile: string;
7
- // verifyCodeKey: string;
8
- // sendSuccess: boolean;
9
- // };
10
- // refresh: () => void;
11
- // isShow: boolean;
12
- // }
13
- // function createMessageVerify(props: Props) {
14
- // // 创建一个挂载点
15
- // const container = document.createElement('div');
16
- // document.body.appendChild(container);
17
- // // 渲染弹窗
18
- // const root = createRoot(container);
19
- // // 这里 isShow 直接传 true,弹窗立即显示
20
- // root.render(<App {...props} isShow={true} />);
21
- // // 可选:返回关闭方法
22
- // return {
23
- // destroy: () => {
24
- // root.unmount();
25
- // document.body.removeChild(container);
26
- // }
27
- // };
28
- // }
29
- // export { createMessageVerify };
30
- // export default createMessageVerify;
31
- // src/modal.tsx
32
- // src/modal.tsx
1
+ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
33
2
  import Modal from './compoments/modal.js';
34
3
  import ReactDOM from 'react-dom/client';
35
- import { useState } from 'react';
4
+ import { useEffect, useState } from 'react';
36
5
  let modalRoot = null;
37
- // ... existing code ...
38
- const AntdModal = ({ config }) => {
6
+ const ModalDom = ({ config }) => {
39
7
  const [visible, setVisible] = useState(true);
8
+ const { data } = config || {};
9
+ const { mobile } = data || {};
10
+ useEffect(() => {
11
+ console.log('mobile', mobile);
12
+ }, []);
40
13
  return (_jsx(Modal, { visible: visible, onClose: () => {
41
14
  setVisible(false);
42
15
  config.onClose?.();
43
- }, children: config.content }));
16
+ }, children: _jsxs("div", { children: ["\u5DF2\u53D1\u9001\u77ED\u4FE1\u81F3\u60A8\u7684\u624B\u673A\uFF1A", mobile] }) }));
44
17
  };
45
18
  // ... existing code ...
46
- export const showModal = (config) => {
19
+ export const createMessageVerifyModal = (config) => {
47
20
  const container = document.createElement('div');
48
21
  container.id = 'antd-modal-container';
49
22
  document.body.appendChild(container);
50
23
  modalRoot = ReactDOM.createRoot(container);
51
- modalRoot.render(_jsx(AntdModal, { config: {
24
+ modalRoot.render(_jsx(ModalDom, { config: {
52
25
  ...config,
53
26
  onClose: () => {
54
27
  config.onClose?.();
package/dist/main.js CHANGED
@@ -1,4 +1,9 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { createRoot } from 'react-dom/client';
3
- import { showModal } from './index.js'; // 或 './index'
4
- createRoot(document.getElementById('root')).render(_jsx("button", { onClick: () => showModal({ content: 'React Content' }), children: "Show Modal" }));
3
+ import { createMessageVerifyModal } from './index.js'; // 或 './index'
4
+ const data = {
5
+ mobile: '185****7760',
6
+ verifyCodeKey: 'e381c5f9-c7f4-4bf1-a948-744334fb0203',
7
+ sendSuccess: true
8
+ };
9
+ createRoot(document.getElementById('root')).render(_jsx("button", { onClick: () => createMessageVerifyModal({ data }), children: "Show Modal" }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "message-verify",
3
- "version": "0.0.33-beta.0",
3
+ "version": "0.0.34-beta.0",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "dependencies": {
package/src/index.tsx CHANGED
@@ -1,55 +1,26 @@
1
- // import App from './app.js';
2
- // import { createRoot } from 'react-dom/client';
3
-
4
- // interface Props {
5
- // data: {
6
- // mobile: string;
7
- // verifyCodeKey: string;
8
- // sendSuccess: boolean;
9
- // };
10
- // refresh: () => void;
11
- // isShow: boolean;
12
- // }
13
-
14
- // function createMessageVerify(props: Props) {
15
- // // 创建一个挂载点
16
- // const container = document.createElement('div');
17
- // document.body.appendChild(container);
18
-
19
- // // 渲染弹窗
20
- // const root = createRoot(container);
21
- // // 这里 isShow 直接传 true,弹窗立即显示
22
- // root.render(<App {...props} isShow={true} />);
23
-
24
- // // 可选:返回关闭方法
25
- // return {
26
- // destroy: () => {
27
- // root.unmount();
28
- // document.body.removeChild(container);
29
- // }
30
- // };
31
- // }
32
-
33
- // export { createMessageVerify };
34
- // export default createMessageVerify;
35
- // src/modal.tsx
36
- // src/modal.tsx
37
1
  import Modal from './compoments/modal.js'
38
2
  import ReactDOM from 'react-dom/client'
39
- import { useState } from'react'
3
+ import { useEffect, useState } from'react'
40
4
 
41
5
  export type ModalConfig = {
42
- content: React.ReactNode
43
- title?: string
44
- width?: number
6
+ data: {
7
+ mobile: string;
8
+ verifyCodeKey: string;
9
+ sendSuccess: boolean;
10
+ };
45
11
  onClose?: () => void
46
12
  }
47
13
 
48
14
  let modalRoot: ReactDOM.Root | null = null
49
15
 
50
- // ... existing code ...
51
- const AntdModal = ({ config }: { config: ModalConfig }) => {
16
+ const ModalDom = ({ config }: { config: ModalConfig }) => {
52
17
  const [visible, setVisible] = useState(true);
18
+ const { data } = config || {};
19
+ const { mobile } = data || {};
20
+
21
+ useEffect(() => {
22
+ console.log('mobile', mobile);
23
+ }, [])
53
24
 
54
25
  return (
55
26
  <Modal
@@ -59,20 +30,20 @@ const AntdModal = ({ config }: { config: ModalConfig }) => {
59
30
  config.onClose?.();
60
31
  }}
61
32
  >
62
- {config.content}
33
+ <div>已发送短信至您的手机:{mobile}</div>
63
34
  </Modal>
64
35
  );
65
36
  };
66
37
  // ... existing code ...
67
38
 
68
- export const showModal = (config: ModalConfig) => {
39
+ export const createMessageVerifyModal = (config: ModalConfig) => {
69
40
  const container = document.createElement('div')
70
41
  container.id = 'antd-modal-container'
71
42
  document.body.appendChild(container)
72
43
 
73
44
  modalRoot = ReactDOM.createRoot(container)
74
45
  modalRoot.render(
75
- <AntdModal
46
+ <ModalDom
76
47
  config={{
77
48
  ...config,
78
49
  onClose: () => {
package/src/main.tsx CHANGED
@@ -1,7 +1,13 @@
1
1
  import { createRoot } from 'react-dom/client';
2
- import { showModal } from './index.js'; // 或 './index'
2
+ import { createMessageVerifyModal } from './index.js'; // 或 './index'
3
+
4
+ const data = {
5
+ mobile: '185****7760',
6
+ verifyCodeKey: 'e381c5f9-c7f4-4bf1-a948-744334fb0203',
7
+ sendSuccess: true
8
+ }
3
9
 
4
10
  createRoot(document.getElementById('root')!).render(
5
- <button onClick={() => showModal({ content: 'React Content' })}>
11
+ <button onClick={() => createMessageVerifyModal({ data })}>
6
12
  Show Modal
7
13
  </button>);