diff --git a/config/proxy.ts b/config/proxy.ts
index 36d50fc..03d511e 100644
--- a/config/proxy.ts
+++ b/config/proxy.ts
@@ -11,7 +11,7 @@ export default {
// localhost:8000/api/** -> https://preview.pro.ant.design/api/**
'/tbg/api/v1': {
// 要代理的地址
- target: 'http://192.168.2.11:9999',
+ target: 'http://192.168.88.238:9999',
// 配置了这个可以从 http 代理到 https
// 依赖 origin 的功能可能需要这个,比如 cookie
changeOrigin: true,
diff --git a/dist.zip b/dist.zip
new file mode 100644
index 0000000..a1429ac
Binary files /dev/null and b/dist.zip differ
diff --git a/package.json b/package.json
index 14d9265..fc3d41c 100644
--- a/package.json
+++ b/package.json
@@ -77,7 +77,9 @@
"react-helmet-async": "^1.0.4",
"umi": "^3.5.0",
"umi-serve": "^1.9.10",
- "web3": "^1.7.5"
+ "web3": "^1.7.5",
+ "@metamask/detect-provider": "^1.2.0"
+
},
"devDependencies": {
"@ant-design/pro-cli": "^2.0.2",
diff --git a/src/access.ts b/src/access.ts
index 2ec89bd..774d6c6 100644
--- a/src/access.ts
+++ b/src/access.ts
@@ -1,9 +1,20 @@
/**
* @see https://umijs.org/zh-CN/plugins/plugin-access
* */
-export default function access(initialState: { currentUser?: API.CurrentUser | undefined }) {
- const { currentUser } = initialState || {};
+
+export default function access(initialState: {
+ currentUser?: API.CurrentUser | undefined;
+ routeList: any;
+}) {
+ const { currentUser, routeList } = initialState || {};
return {
canAdmin: currentUser && currentUser.access === 'admin',
+ normalRouteFilter: (route: any) => {
+ return true;
+ // if (routeList == null || routeList == undefined || routeList.length == 0) {
+ // return true;
+ // }
+ // return routeList.includes(route.name);
+ },
};
}
diff --git a/src/app.tsx b/src/app.tsx
index c667cc9..812ea93 100644
--- a/src/app.tsx
+++ b/src/app.tsx
@@ -4,8 +4,19 @@ import { history } from 'umi';
import RightContent from '@/components/RightContent';
import RoutePath from '@/routes/routePath';
import { CACHE_TOKEN } from '@/constants/cacheKey';
+// import { getRoleList } from './services/system/role';
// ProLayout 支持的api https://procomponents.ant.design/components/layout
+
+// export async function getInitialState() {
+// if (localStorage.getItem(CACHE_TOKEN)) {
+// const res = await getRoleList({});
+// return {
+// routeList: res,
+// };
+// }
+// }
+
export const layout: RunTimeLayoutConfig = ({ initialState }) => {
return {
rightContentRender: () => ,
diff --git a/src/constants/abi/erc20.json b/src/constants/abi/erc20.json
new file mode 100644
index 0000000..8da19b3
--- /dev/null
+++ b/src/constants/abi/erc20.json
@@ -0,0 +1,196 @@
+[
+ {
+ "inputs": [
+ { "internalType": "uint256", "name": "initialSupply", "type": "uint256" },
+ { "internalType": "uint8", "name": "initialDecimals", "type": "uint8" },
+ { "internalType": "string", "name": "tokenName", "type": "string" },
+ { "internalType": "string", "name": "tokenSymbol", "type": "string" }
+ ],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "constructor"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ { "indexed": true, "internalType": "address", "name": "sender", "type": "address" },
+ { "indexed": true, "internalType": "address", "name": "spender", "type": "address" },
+ { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" }
+ ],
+ "name": "Approval",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ { "indexed": true, "internalType": "address", "name": "from", "type": "address" },
+ { "indexed": true, "internalType": "address", "name": "to", "type": "address" },
+ { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" }
+ ],
+ "name": "Transfer",
+ "type": "event"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ { "internalType": "address", "name": "owner", "type": "address" },
+ { "internalType": "address", "name": "spender", "type": "address" }
+ ],
+ "name": "allowance",
+ "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ { "internalType": "address", "name": "", "type": "address" },
+ { "internalType": "address", "name": "", "type": "address" }
+ ],
+ "name": "allowed",
+ "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ { "internalType": "address", "name": "spender", "type": "address" },
+ { "internalType": "uint256", "name": "amount", "type": "uint256" }
+ ],
+ "name": "approve",
+ "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [{ "internalType": "address", "name": "account", "type": "address" }],
+ "name": "balanceOf",
+ "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [{ "internalType": "address", "name": "", "type": "address" }],
+ "name": "balances",
+ "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "decimals",
+ "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "name",
+ "outputs": [{ "internalType": "string", "name": "", "type": "string" }],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ { "internalType": "uint256", "name": "a", "type": "uint256" },
+ { "internalType": "uint256", "name": "b", "type": "uint256" }
+ ],
+ "name": "safeAdd",
+ "outputs": [{ "internalType": "uint256", "name": "c", "type": "uint256" }],
+ "payable": false,
+ "stateMutability": "pure",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ { "internalType": "uint256", "name": "a", "type": "uint256" },
+ { "internalType": "uint256", "name": "b", "type": "uint256" }
+ ],
+ "name": "safeDiv",
+ "outputs": [{ "internalType": "uint256", "name": "c", "type": "uint256" }],
+ "payable": false,
+ "stateMutability": "pure",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ { "internalType": "uint256", "name": "a", "type": "uint256" },
+ { "internalType": "uint256", "name": "b", "type": "uint256" }
+ ],
+ "name": "safeMul",
+ "outputs": [{ "internalType": "uint256", "name": "c", "type": "uint256" }],
+ "payable": false,
+ "stateMutability": "pure",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ { "internalType": "uint256", "name": "a", "type": "uint256" },
+ { "internalType": "uint256", "name": "b", "type": "uint256" }
+ ],
+ "name": "safeSub",
+ "outputs": [{ "internalType": "uint256", "name": "c", "type": "uint256" }],
+ "payable": false,
+ "stateMutability": "pure",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "symbol",
+ "outputs": [{ "internalType": "string", "name": "", "type": "string" }],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "totalSupply",
+ "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ { "internalType": "address", "name": "to", "type": "address" },
+ { "internalType": "uint256", "name": "amount", "type": "uint256" }
+ ],
+ "name": "transfer",
+ "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ { "internalType": "address", "name": "from", "type": "address" },
+ { "internalType": "address", "name": "to", "type": "address" },
+ { "internalType": "uint256", "name": "amount", "type": "uint256" }
+ ],
+ "name": "transferFrom",
+ "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ }
+]
diff --git a/src/constants/enum/contract.ts b/src/constants/enum/contract.ts
new file mode 100644
index 0000000..e0cb7f9
--- /dev/null
+++ b/src/constants/enum/contract.ts
@@ -0,0 +1,4 @@
+export enum ContractType {
+ ERC20 = '20',
+ NFT721 = '721',
+}
diff --git a/src/constants/enum/notice.ts b/src/constants/enum/notice.ts
new file mode 100644
index 0000000..f87bf01
--- /dev/null
+++ b/src/constants/enum/notice.ts
@@ -0,0 +1,7 @@
+export enum NoticeType {
+ RECHARGE = 10000,
+ WITHDRAW = 20000,
+ NFTCREATE = 30000,
+ NFTTRANSFER = 30010,
+ NFTTDISPOSE = 30020,
+}
diff --git a/src/constants/enum/withdraw.ts b/src/constants/enum/withdraw.ts
new file mode 100644
index 0000000..12464c1
--- /dev/null
+++ b/src/constants/enum/withdraw.ts
@@ -0,0 +1,5 @@
+export enum WithdrawType {
+ SUCCESS = 10000,
+ FAILED = 20000,
+ PENDDING = 30000,
+}
diff --git a/src/pages/Login/index.tsx b/src/pages/Login/index.tsx
index f876e6e..5152408 100644
--- a/src/pages/Login/index.tsx
+++ b/src/pages/Login/index.tsx
@@ -6,10 +6,11 @@ import { login } from '@/services/login';
import defaultSettings from '../../../config/defaultSettings';
import styles from './index.less';
import { CACHE_TOKEN } from '@/constants/cacheKey';
+import access from '@/access';
const Login: React.FC = () => {
const intl = useIntl();
-
+ const { initialState, refresh } = useModel('@@initialState');
const handleSubmit = async (values: API.LoginParams) => {
// 登录
const res: any = await login({ ...values });
@@ -19,6 +20,8 @@ const Login: React.FC = () => {
const { query } = history.location;
const { redirect } = query as { redirect: string };
history.push(redirect || '/');
+ refresh();
+ access(initialState);
};
return (
diff --git a/src/pages/Nft/NftContract/List/components/AddNftContract.tsx b/src/pages/Nft/NftContract/List/components/AddNftContract.tsx
index 473de75..2367fd2 100644
--- a/src/pages/Nft/NftContract/List/components/AddNftContract.tsx
+++ b/src/pages/Nft/NftContract/List/components/AddNftContract.tsx
@@ -22,8 +22,10 @@ const form = createForm({});
const AddNftContractModal = ({ onOk, onCancel, ...rest }: AddNftContractModalPropsType) => {
const handleOk = () => {
- const formState = form.getFormState();
- onOk(formState.values);
+ form.submit(async () => {
+ const formState = form.getFormState();
+ onOk(formState.values);
+ });
};
const handleCancel = () => {
onCancel();
@@ -34,25 +36,25 @@ const AddNftContractModal = ({ onOk, onCancel, ...rest }: AddNftContractModalPro
diff --git a/src/pages/Nft/NftContract/List/index.tsx b/src/pages/Nft/NftContract/List/index.tsx
index 7f8ec80..db26c55 100644
--- a/src/pages/Nft/NftContract/List/index.tsx
+++ b/src/pages/Nft/NftContract/List/index.tsx
@@ -1,32 +1,42 @@
-import React, { useRef, useState } from 'react';
+import React, { useEffect, useRef, useState } from 'react';
import Table, { ProColumns, ActionType } from '@/components/Table';
import { message } from 'antd';
-// import { fetchTableData } from '@/utils/table';
import AddNftContractModal from './components/AddNftContract';
+import { getContractInfo } from '@/services/contract';
+import { ContractType } from '@/constants/enum/contract';
+import { deployContract, initWeb3 } from '@/utils/web3';
+import { createNFTContract, getNFTContractList } from '@/services/nft';
+import { fetchTableData } from '@/utils/table';
const Address: React.FC = () => {
const tableRef = useRef();
- const [NftModal, setNftModal] = useState(false);
const [visible, setVisible] = useState(false);
+ const [contractData, setContractData] = useState({});
const columns: ProColumns[] = [
{
title: '合约名称',
- dataIndex: 'time',
- width: '10%',
+ dataIndex: 'token_name',
+ width: '15%',
+ hideInSearch: true,
+ },
+ {
+ title: '合约单位',
+ dataIndex: 'token_symbol',
+ width: '15%',
hideInSearch: true,
},
{
title: '合约地址',
dataIndex: 'address',
hideInSearch: true,
- width: '20%',
+ width: '50%',
},
{
- title: 'NFT数量',
- dataIndex: 'nft_num',
- width: 150,
+ title: '描述',
+ dataIndex: 'description',
hideInSearch: true,
+ ellipsis: true,
},
];
@@ -35,30 +45,44 @@ const Address: React.FC = () => {
{
- setVisible(true);
+ onConfirm: async () => {
+ const res = await getContractInfo({ erc: ContractType.NFT721 });
+ if (res.bin != '') {
+ setContractData(res);
+ setVisible(true);
+ } else {
+ message.success('已有NFT合约');
+ }
},
},
]}
- // request={async (params) => {
- // // return fetchTableData(, params);
- // }}
+ request={async (params) => {
+ const res = await fetchTableData(getNFTContractList, params);
+ return res;
+ }}
/>
{
try {
- const params = { ...val };
- // await creatNftAddress(params);
+ await initWeb3();
+ const res = await deployContract(contractData.abi, contractData.bin, [
+ val.token_name,
+ val.token_symbol,
+ ]);
+ val.address = res;
+ await createNFTContract(val);
message.success('添加成功');
+ setVisible(false);
} catch (e) {
console.log(e);
message.success('发生错误');
diff --git a/src/pages/Nft/NftToken/List/components/AddNftModel.tsx b/src/pages/Nft/NftToken/List/components/AddNftModel.tsx
index f9b0cdd..6b3a054 100644
--- a/src/pages/Nft/NftToken/List/components/AddNftModel.tsx
+++ b/src/pages/Nft/NftToken/List/components/AddNftModel.tsx
@@ -22,8 +22,10 @@ const form = createForm({});
const AddNftModal = ({ onOk, onCancel, ...rest }: AddNftModalPropsType) => {
const handleOk = () => {
- const formState = form.getFormState();
- onOk(formState.values);
+ form.submit(() => {
+ const formState = form.getFormState();
+ onOk(formState.values);
+ });
};
const handleCancel = () => {
onCancel();
@@ -33,33 +35,45 @@ const AddNftModal = ({ onOk, onCancel, ...rest }: AddNftModalPropsType) => {
diff --git a/src/pages/Nft/NftToken/List/components/TransferNFTModel.tsx b/src/pages/Nft/NftToken/List/components/TransferNFTModel.tsx
new file mode 100644
index 0000000..df4d708
--- /dev/null
+++ b/src/pages/Nft/NftToken/List/components/TransferNFTModel.tsx
@@ -0,0 +1,58 @@
+import React, { useRef } from 'react';
+import { createForm } from '@formily/core';
+import { createSchemaField } from '@formily/react';
+import Modal, { ModalProps } from '@/components/Modal';
+// import { fetchTableData } from '@/utils/table';
+import { Form, FormItem, Input, NumberPicker } from '@formily/antd';
+
+interface TransferNFTModelPropsType extends ModalProps {
+ onOk: (val: any) => void;
+ onCancel: () => void;
+}
+
+const SchemaField = createSchemaField({
+ components: {
+ FormItem,
+ Input,
+ NumberPicker,
+ },
+});
+
+const form = createForm({});
+
+const TransferNFTModel = ({ onOk, onCancel, ...rest }: TransferNFTModelPropsType) => {
+ const handleOk = async () => {
+ form.submit(async () => {
+ const formState = form.getFormState();
+ onOk(formState.values);
+ });
+ };
+ const handleCancel = () => {
+ onCancel();
+ };
+
+ return (
+
+
+
+ );
+};
+
+export default TransferNFTModel;
diff --git a/src/pages/Nft/NftToken/List/index.tsx b/src/pages/Nft/NftToken/List/index.tsx
index 47dfe66..e3724dd 100644
--- a/src/pages/Nft/NftToken/List/index.tsx
+++ b/src/pages/Nft/NftToken/List/index.tsx
@@ -1,34 +1,49 @@
import React, { useRef, useState } from 'react';
import Table, { ProColumns, ActionType } from '@/components/Table';
import { message } from 'antd';
-// import { fetchTableData } from '@/utils/table';
-
+import { fetchTableData } from '@/utils/table';
import AddNftModal from './components/AddNftModel';
-import PaySelectModal from '@/widget/PaySelectModal';
+import { initWeb3, NFTMint } from '@/utils/web3';
+import { getContractInfo } from '@/services/contract';
+import { ContractType } from '@/constants/enum/contract';
+import { checkTokenId, getNFTContractList, getNFTList, mintNFT } from '@/services/nft';
const Address: React.FC = () => {
const tableRef = useRef();
- const [NftModal, setNftModal] = useState(false);
const [visible, setVisible] = useState(false);
- const [payVisible, setPayVisible] = useState(false);
const columns: ProColumns[] = [
{
- title: '合约名称',
- dataIndex: 'time',
+ title: 'TokenId',
+ dataIndex: 'token_id',
width: '10%',
hideInSearch: true,
},
{
- title: 'NFT名称',
+ title: '所有者地址',
dataIndex: 'address',
hideInSearch: true,
- width: '20%',
},
{
- title: 'TokenId',
- dataIndex: 'token_id',
- width: 150,
+ title: 'NFT名称',
+ dataIndex: 'name',
+ hideInSearch: true,
+ },
+ {
+ title: '图片',
+ dataIndex: 'image',
+ hideInSearch: true,
+ ellipsis: true,
+ },
+ {
+ title: '缩略图',
+ dataIndex: 'avatar',
+ hideInSearch: true,
+ ellipsis: true,
+ },
+ {
+ title: '描述',
+ dataIndex: 'description',
hideInSearch: true,
},
];
@@ -38,6 +53,7 @@ const Address: React.FC = () => {
{
setVisible(true);
},
},
- {
- type: 'add',
- text: '分发NFT',
- onConfirm: () => {
- setNftModal(true);
- },
- },
]}
- // request={async (params) => {
- // // return fetchTableData(, params);
- // }}
+ request={async (params) => {
+ const res = await fetchTableData(getNFTList, params);
+ return res;
+ }}
/>
{
setVisible(false);
}}
onOk={async function (val: any): Promise {
- try {
- const params = { ...val };
- // await creatNftAddress(params);
- message.success('添加成功');
- } catch (e) {
- console.log(e);
- message.success('发生错误');
- setVisible(false);
- }
- }}
- />
- {
- try {
- const params = { ...val };
- // await creatNftAddress(params);
- console.log(params);
- message.success('添加成功');
- } catch (e) {
- console.log(e);
- message.success('发生错误');
- setVisible(false);
- }
- }}
/>
);
diff --git a/src/pages/Nft/NftTrade/List/index.tsx b/src/pages/Nft/NftTrade/List/index.tsx
new file mode 100644
index 0000000..c619fde
--- /dev/null
+++ b/src/pages/Nft/NftTrade/List/index.tsx
@@ -0,0 +1,81 @@
+import React, { useRef } from 'react';
+import Table, { ProColumns, ActionType } from '@/components/Table';
+import { getRecordList } from '@/services/recharge/record';
+import { fetchTableData } from '@/utils/table';
+import moment from 'moment';
+import { ContractType } from '@/constants/enum/contract';
+
+const NFTTradeList = () => {
+ const tableRef = useRef();
+ const columns: ProColumns[] = [
+ {
+ title: '时间',
+ dataIndex: 'time',
+ hideInTable: true,
+ valueType: 'dateRange',
+ ellipsis: true,
+ },
+ {
+ title: '交易哈希',
+ dataIndex: 'tx_hash',
+ hideInSearch: true,
+ ellipsis: true,
+ },
+ {
+ title: 'TokenID',
+ dataIndex: 'token_id',
+ width: '10%',
+ hideInSearch: true,
+ },
+ {
+ title: '块编号',
+ dataIndex: 'block_number',
+ hideInSearch: true,
+ },
+ {
+ title: '发送地址',
+ dataIndex: 'from_address',
+ hideInSearch: true,
+ ellipsis: true,
+ },
+ {
+ title: '接受地址',
+ dataIndex: 'to_address',
+ hideInSearch: true,
+ ellipsis: true,
+ },
+ {
+ title: '充值时间',
+ dataIndex: 'time',
+ hideInSearch: true,
+ ellipsis: true,
+ },
+ ];
+ return (
+ {
+ console.log('params = ', params);
+ if ((params.time ?? '') !== '') {
+ const start = Date.parse(params.time[0] + ' 00:00:00');
+ const end = Date.parse(params.time[1] + ' 23:59:59');
+ params.start_time = start / 1000;
+ params.end_time = end / 1000;
+ }
+ params.erc = ContractType.NFT721;
+ const res = await fetchTableData(getRecordList, params);
+ for (const key in res.data) {
+ if (Object.prototype.hasOwnProperty.call(res.data, key)) {
+ const element = res.data[key];
+ element.time = moment(element.time * 1000).format('YYYY-MM-DD hh:mm:ss');
+ }
+ }
+ return res;
+ }}
+ />
+ );
+};
+
+export default NFTTradeList;
diff --git a/src/pages/Recharge/CoinType/List/index.tsx b/src/pages/Recharge/CoinType/List/index.tsx
index c860f7b..625b07f 100644
--- a/src/pages/Recharge/CoinType/List/index.tsx
+++ b/src/pages/Recharge/CoinType/List/index.tsx
@@ -1,9 +1,12 @@
import React, { useState, useRef } from 'react';
import Table, { ProColumns, ActionType } from '@/components/Table';
import { addCoinType, getCoinTypeList, modifyCoinType } from '@/services/recharge/coinType';
+import { getContractInfo } from '@/services/contract';
import { fetchTableData } from '@/utils/table';
import AddCoinTypeModal from '../components/AddCoinTypeModal';
import EditCoinTypeModal from '../components/EditCoinTypeModal';
+import { initWeb3, deployContract, transfer } from '@/utils/web3';
+import { ContractType } from '@/constants/enum/contract';
const CoinTypeList = () => {
const tableRef = useRef();
@@ -39,7 +42,7 @@ const CoinTypeList = () => {
},
{
title: '代币发行总量',
- dataIndex: 'num',
+ dataIndex: 'total',
hideInSearch: true,
ellipsis: true,
},
@@ -64,6 +67,7 @@ const CoinTypeList = () => {
{
setIsModalVisible(false);
}}
onOk={async function (val: any): Promise {
+ const res = await getContractInfo({ erc: ContractType.ERC20 });
+ await initWeb3();
+ const result = await deployContract(res.abi, res.bin, [
+ val.num,
+ val.tokenName,
+ val.tokenSymbol,
+ ]);
+ val.address = result;
await addCoinType(val);
setIsModalVisible(false);
tableRef.current?.reload();
diff --git a/src/pages/Recharge/CoinType/components/AddCoinTypeModal.tsx b/src/pages/Recharge/CoinType/components/AddCoinTypeModal.tsx
index 8891508..deebe59 100644
--- a/src/pages/Recharge/CoinType/components/AddCoinTypeModal.tsx
+++ b/src/pages/Recharge/CoinType/components/AddCoinTypeModal.tsx
@@ -21,9 +21,11 @@ const SchemaField = createSchemaField({
const form = createForm({});
const AddCoinTypeModal = ({ onOk, onCancel, ...rest }: AddCoinTypeModalPropsType) => {
- const handleOk = () => {
- const formState = form.getFormState();
- onOk(formState.values);
+ const handleOk = async () => {
+ form.submit(async () => {
+ const formState = form.getFormState();
+ onOk(formState.values);
+ });
};
const handleCancel = () => {
@@ -36,21 +38,35 @@ const AddCoinTypeModal = ({ onOk, onCancel, ...rest }: AddCoinTypeModalPropsType
+
+
+
- {
- const formState = form.getFormState();
- onOk(formState.values);
+ form.submit(async () => {
+ const formState = form.getFormState();
+ onOk(formState.values);
+ });
};
const handleCancel = () => {
@@ -51,17 +53,17 @@ const EditCoinTypeModal = ({
x-decorator="FormItem"
x-component="Input"
/>
-
-
diff --git a/src/pages/Recharge/Record/List/index.tsx b/src/pages/Recharge/Record/List/index.tsx
index 64449c3..a0210e2 100644
--- a/src/pages/Recharge/Record/List/index.tsx
+++ b/src/pages/Recharge/Record/List/index.tsx
@@ -2,9 +2,8 @@ import React, { useRef } from 'react';
import Table, { ProColumns, ActionType } from '@/components/Table';
import { getRecordList } from '@/services/recharge/record';
import { fetchTableData } from '@/utils/table';
-import { getBalanceAmount } from '@/utils/formatBalance';
-import BigNumber from 'bignumber.js';
import moment from 'moment';
+import { ContractType } from '@/constants/enum/contract';
const RecordList = () => {
const tableRef = useRef();
@@ -28,12 +27,6 @@ const RecordList = () => {
width: '10%',
hideInSearch: true,
},
- {
- title: '位数',
- dataIndex: 'decimals',
- width: '10%',
- hideInSearch: true,
- },
{
title: '游戏币类型',
dataIndex: 'name',
@@ -62,25 +55,20 @@ const RecordList = () => {
return (
{
- console.log('params = ', params);
if ((params.time ?? '') !== '') {
const start = Date.parse(params.time[0] + ' 00:00:00');
const end = Date.parse(params.time[1] + ' 23:59:59');
params.start_time = start / 1000;
params.end_time = end / 1000;
}
+ params.erc = ContractType.ERC20;
const res = await fetchTableData(getRecordList, params);
- console.log('res = ', res);
for (const key in res.data) {
if (Object.prototype.hasOwnProperty.call(res.data, key)) {
const element = res.data[key];
- element.price = getBalanceAmount(
- new BigNumber(element.price),
- element.decimals,
- ).toNumber();
element.time = moment(element.time * 1000).format('YYYY-MM-DD hh:mm:ss');
}
}
diff --git a/src/pages/Recharge/Wallet/List/index.tsx b/src/pages/Recharge/Wallet/List/index.tsx
index 5a5177d..57ac079 100644
--- a/src/pages/Recharge/Wallet/List/index.tsx
+++ b/src/pages/Recharge/Wallet/List/index.tsx
@@ -41,7 +41,6 @@ const CollectionAddressList = () => {
title: '收款游戏币名称',
dataIndex: 'name',
hideInSearch: true,
- ellipsis: true,
},
{
title: '操作',
diff --git a/src/pages/Recharge/Wallet/components/AddWalletModal.tsx b/src/pages/Recharge/Wallet/components/AddWalletModal.tsx
index c043339..76d06c0 100644
--- a/src/pages/Recharge/Wallet/components/AddWalletModal.tsx
+++ b/src/pages/Recharge/Wallet/components/AddWalletModal.tsx
@@ -37,7 +37,7 @@ 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 list = await getCoinTypeList({ page: 1, size: 10 });
const option = [];
for (let index = 0; index < list.items.length; index++) {
const element = list.items[index];
@@ -54,8 +54,10 @@ const form = createForm({
const AddWalletModal = ({ onOk, onCancel, ...rest }: AddWalletModalPropsType) => {
const handleOk = () => {
- const formState = form.getFormState();
- onOk(formState.values);
+ form.submit(async () => {
+ const formState = form.getFormState();
+ onOk(formState.values);
+ });
};
const handleCancel = () => {
diff --git a/src/pages/Recharge/Wallet/components/EditWalletModal.tsx b/src/pages/Recharge/Wallet/components/EditWalletModal.tsx
index 11632bd..9477457 100644
--- a/src/pages/Recharge/Wallet/components/EditWalletModal.tsx
+++ b/src/pages/Recharge/Wallet/components/EditWalletModal.tsx
@@ -39,7 +39,7 @@ const EditWalletModal = ({ onOk, onCancel, editModalData, ...rest }: EditWalletM
effects: () => {
// eslint-disable-next-line react-hooks/rules-of-hooks
useAsyncDataSource('name', async (field) => {
- const list = await getCoinTypeList({ page: 1, page_size: 10 });
+ const list = await getCoinTypeList({ page: 1, size: 10 });
const option = [];
for (let index = 0; index < list.items.length; index++) {
const element = list.items[index];
@@ -59,8 +59,10 @@ const EditWalletModal = ({ onOk, onCancel, editModalData, ...rest }: EditWalletM
});
const handleOk = () => {
- const formState = form.getFormState();
- onOk(formState.values);
+ form.submit(async () => {
+ const formState = form.getFormState();
+ onOk(formState.values);
+ });
};
const handleCancel = () => {
diff --git a/src/pages/Recharge/Withdraw/List/index.tsx b/src/pages/Recharge/Withdraw/List/index.tsx
index 79dfe61..e76a2d2 100644
--- a/src/pages/Recharge/Withdraw/List/index.tsx
+++ b/src/pages/Recharge/Withdraw/List/index.tsx
@@ -2,16 +2,33 @@ import React, { useRef } from 'react';
import Table, { ProColumns, ActionType } from '@/components/Table';
import { getWithdrawList, solveWithdraw } from '@/services/recharge/withdraw';
import { fetchTableData } from '@/utils/table';
-import { getBalanceAmount } from '@/utils/formatBalance';
-import BigNumber from 'bignumber.js';
import ConfirmButton from '@/components/Table/ConfirmButton';
import moment from 'moment';
+import { WithdrawType } from '@/constants/enum/withdraw';
const WithdrawList = () => {
const handleConfirm = async (uuid) => {
await solveWithdraw({ uuid: uuid });
};
+ const WithdrawTypeList = [
+ {
+ label: '成功',
+ value: WithdrawType.SUCCESS,
+ status: 'Success',
+ },
+ {
+ label: '失败',
+ value: WithdrawType.FAILED,
+ status: 'Error',
+ },
+ {
+ label: '待处理',
+ value: WithdrawType.PENDDING,
+ status: 'Warning',
+ },
+ ];
+
const tableRef = useRef();
const columns: ProColumns[] = [
{
@@ -36,6 +53,18 @@ const WithdrawList = () => {
dataIndex: 'type',
width: '10%',
},
+ {
+ title: '状态',
+ dataIndex: 'status',
+ width: '10%',
+ valueEnum: () => {
+ const options = {};
+ WithdrawTypeList.forEach((item) => {
+ options[item.value] = { text: item.label, status: item.status };
+ });
+ return options;
+ },
+ },
{
title: '时间',
dataIndex: 'time',
@@ -69,10 +98,6 @@ const WithdrawList = () => {
for (const key in res.data) {
if (Object.prototype.hasOwnProperty.call(res.data, key)) {
const element = res.data[key];
- element.price = getBalanceAmount(
- new BigNumber(element.price),
- element.decimals,
- ).toNumber();
element.time = moment(element.time * 1000).format('YYYY-MM-DD hh:mm:ss');
}
}
diff --git a/src/pages/System/Account/List/index.tsx b/src/pages/System/Account/List/index.tsx
index b6e98c7..8776c1e 100644
--- a/src/pages/System/Account/List/index.tsx
+++ b/src/pages/System/Account/List/index.tsx
@@ -74,7 +74,8 @@ const AccountManageList = () => {
void;
@@ -15,13 +16,15 @@ const SchemaField = createSchemaField({
components: {
FormItem,
Input,
- Select,
+ TreeSelect,
},
});
const form = createForm({});
const AddAccountModal = ({ onOk, onCancel, ...rest }: AddAccountModalPropsType) => {
+ const [treeData, setTreeData] = useState({});
+
const handleOk = async () => {
form.submit(async () => {
onOk();
@@ -35,6 +38,30 @@ const AddAccountModal = ({ onOk, onCancel, ...rest }: AddAccountModalPropsType)
onCancel();
};
+ const onChange = (newValue: string[]) => {};
+
+ useEffect(() => {
+ const array = routes;
+ array.forEach((item: any, index) => {
+ if (item.name == '' || item.name == null || item.name == undefined) {
+ array.splice(index, 1);
+ console.log('array.splice(index, 1);');
+ }
+ item.key = index + 1;
+ if (Object.prototype.hasOwnProperty.call(item, 'routes')) {
+ item.routes?.forEach((item2: any, index2: number) => {
+ if (item2.name == '' || item2.name == null || item2.name == undefined) {
+ item.routes.splice(index2, 1);
+ console.log('item.routes.splice(index2, 1);');
+ }
+ item2.key = parseInt(index + 1 + '' + index2);
+ });
+ }
+ });
+ console.log('array = ', array);
+ setTreeData(array);
+ }, []);
+
return (