From 9b71639ff99c1462fe21597b1987e65af09bdc07 Mon Sep 17 00:00:00 2001 From: zzy Date: Wed, 24 Aug 2022 16:35:43 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=A7=84=E8=8C=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/Recharge/CoinType/List/index.tsx | 4 +- .../Record/components/AddWalletModal.tsx | 97 ----------------- .../Record/components/EditWalletModal.tsx | 101 ------------------ src/pages/Recharge/Wallet/List/index.tsx | 4 +- src/pages/System/Account/List/index.tsx | 4 +- src/pages/System/Notice/List/index.tsx | 4 +- 6 files changed, 8 insertions(+), 206 deletions(-) delete mode 100644 src/pages/Recharge/Record/components/AddWalletModal.tsx delete mode 100644 src/pages/Recharge/Record/components/EditWalletModal.tsx diff --git a/src/pages/Recharge/CoinType/List/index.tsx b/src/pages/Recharge/CoinType/List/index.tsx index e5b3715..c860f7b 100644 --- a/src/pages/Recharge/CoinType/List/index.tsx +++ b/src/pages/Recharge/CoinType/List/index.tsx @@ -2,8 +2,8 @@ import React, { useState, useRef } from 'react'; import Table, { ProColumns, ActionType } from '@/components/Table'; import { addCoinType, getCoinTypeList, modifyCoinType } from '@/services/recharge/coinType'; import { fetchTableData } from '@/utils/table'; -import AddCoinTypeModal from '../Components/AddCoinTypeModal'; -import EditCoinTypeModal from '../Components/EditCoinTypeModal'; +import AddCoinTypeModal from '../components/AddCoinTypeModal'; +import EditCoinTypeModal from '../components/EditCoinTypeModal'; const CoinTypeList = () => { const tableRef = useRef(); diff --git a/src/pages/Recharge/Record/components/AddWalletModal.tsx b/src/pages/Recharge/Record/components/AddWalletModal.tsx deleted file mode 100644 index c043339..0000000 --- a/src/pages/Recharge/Record/components/AddWalletModal.tsx +++ /dev/null @@ -1,97 +0,0 @@ -// 创建弹窗 -import React, { useRef } from 'react'; -import { createForm, onFieldReact, FormPathPattern, Field } from '@formily/core'; -import { FormProvider, createSchemaField } from '@formily/react'; -import { getCoinTypeList } from '@/services/recharge/coinType'; -import Modal, { ModalProps } from '@/components/Modal'; -import { Form, FormItem, Input, Select } from '@formily/antd'; -import { action } from '@formily/reactive'; - -interface AddWalletModalPropsType extends ModalProps { - onOk: (val: any) => void; - onCancel: () => void; -} - -const SchemaField = createSchemaField({ - components: { - FormItem, - Input, - Select, - }, -}); - -const useAsyncDataSource = ( - pattern: FormPathPattern, - service: (field: Field) => Promise<{ label: string; value: any }[]>, -) => { - onFieldReact(pattern, (field) => { - service(field).then( - action.bound((data) => { - field.dataSource = data; - }), - ); - }); -}; - -const form = createForm({ - effects: () => { - // eslint-disable-next-line react-hooks/rules-of-hooks - useAsyncDataSource('name', async (field) => { - const list = await getCoinTypeList({ page: 1, page_size: 10 }); - const option = []; - for (let index = 0; index < list.items.length; index++) { - const element = list.items[index]; - const item = { - label: element.name, - value: element.name, - }; - option.push(item); - } - return option; - }); - }, -}); - -const AddWalletModal = ({ onOk, onCancel, ...rest }: AddWalletModalPropsType) => { - const handleOk = () => { - const formState = form.getFormState(); - onOk(formState.values); - }; - - const handleCancel = () => { - onCancel(); - }; - - return ( - - - - - - - - {/*
*/} - - {/*
*/} -
- ); -}; - -export default AddWalletModal; diff --git a/src/pages/Recharge/Record/components/EditWalletModal.tsx b/src/pages/Recharge/Record/components/EditWalletModal.tsx deleted file mode 100644 index 11632bd..0000000 --- a/src/pages/Recharge/Record/components/EditWalletModal.tsx +++ /dev/null @@ -1,101 +0,0 @@ -// 修改弹窗 -import React, { useRef, useEffect } from 'react'; -import { createForm, onFieldReact, FormPathPattern, Field } from '@formily/core'; -import { getCoinTypeList } from '@/services/recharge/coinType'; -import { FormProvider, createSchemaField } from '@formily/react'; -import Modal, { ModalProps } from '@/components/Modal'; -import { Form, FormItem, Input, Select } from '@formily/antd'; -import { action } from '@formily/reactive'; - -interface EditWalletModalPropsType extends ModalProps { - editModalData: any; - onOk: (val: any) => void; - onCancel: () => void; -} - -const SchemaField = createSchemaField({ - components: { - FormItem, - Input, - Select, - }, -}); - -const EditWalletModal = ({ onOk, onCancel, editModalData, ...rest }: EditWalletModalPropsType) => { - const useAsyncDataSource = ( - pattern: FormPathPattern, - service: (field: Field) => Promise<{ label: string; value: any }[]>, - ) => { - onFieldReact(pattern, (field) => { - service(field).then( - action.bound((data) => { - field.dataSource = data; - }), - ); - }); - }; - - const form = createForm({ - effects: () => { - // eslint-disable-next-line react-hooks/rules-of-hooks - useAsyncDataSource('name', async (field) => { - const list = await getCoinTypeList({ page: 1, page_size: 10 }); - const option = []; - for (let index = 0; index < list.items.length; index++) { - const element = list.items[index]; - const item = { - label: element.name, - value: element.name, - }; - option.push(item); - } - return option; - }); - }, - }); - - useEffect(() => { - form.setInitialValues(editModalData); - }); - - const handleOk = () => { - const formState = form.getFormState(); - onOk(formState.values); - }; - - const handleCancel = () => { - onCancel(); - }; - - return ( - -
- - - - - -
-
- ); -}; - -export default EditWalletModal; diff --git a/src/pages/Recharge/Wallet/List/index.tsx b/src/pages/Recharge/Wallet/List/index.tsx index 683ddca..5a5177d 100644 --- a/src/pages/Recharge/Wallet/List/index.tsx +++ b/src/pages/Recharge/Wallet/List/index.tsx @@ -9,8 +9,8 @@ import { import { fetchTableData } from '@/utils/table'; import DeleteButton from '@/components/Table/DeleteButton'; -import AddWalletModal from '../Components/AddWalletModal'; -import EditWalletModal from '../Components/EditWalletModal'; +import AddWalletModal from '../components/AddWalletModal'; +import EditWalletModal from '../components/EditWalletModal'; const CollectionAddressList = () => { const tableRef = useRef(); diff --git a/src/pages/System/Account/List/index.tsx b/src/pages/System/Account/List/index.tsx index 537d19d..b6e98c7 100644 --- a/src/pages/System/Account/List/index.tsx +++ b/src/pages/System/Account/List/index.tsx @@ -9,8 +9,8 @@ import { import { fetchTableData } from '@/utils/table'; import DeleteButton from '@/components/Table/DeleteButton'; import { Switch } from 'antd'; -import AddAccountModal from '../Components/AddAccountModal'; -import EditAccountModal from '../Components/EditAccountModal'; +import AddAccountModal from '../components/AddAccountModal'; +import EditAccountModal from '../components/EditAccountModal'; const AccountManageList = () => { const [isModalVisible, setIsModalVisible] = useState(false); diff --git a/src/pages/System/Notice/List/index.tsx b/src/pages/System/Notice/List/index.tsx index 593fec3..46b3abf 100644 --- a/src/pages/System/Notice/List/index.tsx +++ b/src/pages/System/Notice/List/index.tsx @@ -2,10 +2,10 @@ import React, { useState, useRef } from 'react'; import Table, { ProColumns, ActionType } from '@/components/Table'; import { getNoticeList, createNotice, updateNotice, deleteNotice } from '@/services/system/notice'; import { fetchTableData } from '@/utils/table'; -import AddNoticeModal from '../Components/AddNoticeModal'; import DeleteButton from '@/components/Table/DeleteButton'; import { Switch } from 'antd'; -import EditNoticeModal from '../Components/EditNoticeModal'; +import AddNoticeModal from '../components/AddNoticeModal'; +import EditNoticeModal from '../components/EditNoticeModal'; const NoticeList = () => { const tableRef = useRef();