diff --git a/dist.zip b/dist.zip deleted file mode 100644 index 4dba4f3..0000000 Binary files a/dist.zip and /dev/null differ diff --git a/src/access.ts b/src/access.ts index dbb9d5c..a4287cd 100644 --- a/src/access.ts +++ b/src/access.ts @@ -10,18 +10,17 @@ export default function access(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); + return routeList.includes(route.code); }, - canShowButton: (buttonName) => { + canShowButton: (buttonCode) => { // return true; if (routeList == null || routeList == undefined || routeList.length == 0) { return true; } - return routeList.includes(buttonName); + return routeList.includes(buttonCode); }, }; } diff --git a/src/pages/DataBoard/CoreData/List/index.tsx b/src/pages/DataBoard/CoreData/List/index.tsx index 660ab42..1a89f76 100644 --- a/src/pages/DataBoard/CoreData/List/index.tsx +++ b/src/pages/DataBoard/CoreData/List/index.tsx @@ -114,7 +114,7 @@ const CoreData: React.FC = () => { params.end_time = moment(params.select_time[1]).valueOf() / 1000; } const data = await getCoreData({}); - setCoreData(data); + setCoreData(data as any); const res = await fetchTableData(getListData, params); console.log('res', res); for (const key in res.data) { @@ -126,7 +126,7 @@ const CoreData: React.FC = () => { element.start_time != null ) { element.start_time = moment(element.start_time * 1000).format( - 'YYYY-MM-DD hh:mm:ss', + 'YYYY-MM-DD HH:mm:ss', ); } } diff --git a/src/pages/Nft/NftContract/List/index.tsx b/src/pages/Nft/NftContract/List/index.tsx index 5803d28..87dc418 100644 --- a/src/pages/Nft/NftContract/List/index.tsx +++ b/src/pages/Nft/NftContract/List/index.tsx @@ -51,10 +51,10 @@ const Address: React.FC = () => { { type: 'add', text: '新建NFT合约', - permission: '新建NFT合约', + permission: 'nft_contract_create', onConfirm: async () => { const res = await getContractInfo({ erc: ContractType.NFT721 }); - if (res.bin != '') { + if ((res as any).bin != '') { setContractData(res); setVisible(true); } else { @@ -79,7 +79,7 @@ const Address: React.FC = () => { onOk={async function (val: any): Promise { try { await initWeb3(); - const res = await deployContract(contractData.abi, contractData.bin, [ + const res = await deployContract((contractData as any).abi, (contractData as any).bin, [ val.token_name, val.token_symbol, ]); diff --git a/src/pages/Nft/NftToken/List/index.tsx b/src/pages/Nft/NftToken/List/index.tsx index 7990c32..f88122b 100644 --- a/src/pages/Nft/NftToken/List/index.tsx +++ b/src/pages/Nft/NftToken/List/index.tsx @@ -50,7 +50,7 @@ const Address: React.FC = () => { { type: 'add', text: '添加NFT', - permission: '添加NFT', + permission: 'nft_add', onConfirm: () => { setVisible(true); }, diff --git a/src/pages/Nft/NftTrade/List/index.tsx b/src/pages/Nft/NftTrade/List/index.tsx index 0f1fae2..229154e 100644 --- a/src/pages/Nft/NftTrade/List/index.tsx +++ b/src/pages/Nft/NftTrade/List/index.tsx @@ -68,7 +68,7 @@ const NFTTradeList = () => { 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'); + element.time = moment(element.time * 1000).format('YYYY-MM-DD HH:mm:ss'); } } return res; diff --git a/src/pages/Recharge/CoinType/List/index.tsx b/src/pages/Recharge/CoinType/List/index.tsx index 27011b2..4a4dcb9 100644 --- a/src/pages/Recharge/CoinType/List/index.tsx +++ b/src/pages/Recharge/CoinType/List/index.tsx @@ -44,7 +44,7 @@ const CoinTypeList = () => { width: 100, }, { - title: '地址', + title: '合约地址', dataIndex: 'address', hideInSearch: true, ellipsis: true, @@ -60,7 +60,7 @@ const CoinTypeList = () => { valueType: 'option', width: 150, render: (_, row) => [ - + { @@ -82,7 +82,7 @@ const CoinTypeList = () => { toolBarActions={[ { type: 'add', - permission: '代币添加', + permission: 'coin_type_add', onConfirm: () => { setIsModalVisible(true); }, @@ -102,7 +102,7 @@ const CoinTypeList = () => { onOk={async function (val: any): Promise { const res = await getContractInfo({ erc: ContractType.ERC20 }); await initWeb3(); - const result = await deployContract(res.abi, res.bin, [ + const result = await deployContract((res as any).abi, (res as any).bin, [ val.num, val.tokenName, val.tokenSymbol, diff --git a/src/pages/Recharge/CoinType/components/AddCoinTypeModal.tsx b/src/pages/Recharge/CoinType/components/AddCoinTypeModal.tsx index deebe59..66ba6f4 100644 --- a/src/pages/Recharge/CoinType/components/AddCoinTypeModal.tsx +++ b/src/pages/Recharge/CoinType/components/AddCoinTypeModal.tsx @@ -38,7 +38,7 @@ const AddCoinTypeModal = ({ onOk, onCancel, ...rest }: AddCoinTypeModalPropsType +
{ 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'); + element.time = moment(element.time * 1000).format('YYYY-MM-DD HH:mm:ss'); } } return res; diff --git a/src/pages/Recharge/Wallet/List/index.tsx b/src/pages/Recharge/Wallet/List/index.tsx index b28b40e..1f84509 100644 --- a/src/pages/Recharge/Wallet/List/index.tsx +++ b/src/pages/Recharge/Wallet/List/index.tsx @@ -50,7 +50,7 @@ const CollectionAddressList = () => { valueType: 'option', width: 150, render: (_, row) => [ - + { @@ -60,7 +60,7 @@ const CollectionAddressList = () => { 编辑 , - + { @@ -80,7 +80,7 @@ const CollectionAddressList = () => { toolBarActions={[ { type: 'add', - permission: '收款地址添加', + permission: 'wallet_add', onConfirm: () => { setIsModalVisible(true); }, diff --git a/src/pages/Recharge/Withdraw/List/index.tsx b/src/pages/Recharge/Withdraw/List/index.tsx index ac5a929..bb9126a 100644 --- a/src/pages/Recharge/Withdraw/List/index.tsx +++ b/src/pages/Recharge/Withdraw/List/index.tsx @@ -83,7 +83,7 @@ const WithdrawList = () => { width: 150, render: (_, row) => [ row.status === 30000 ? ( - + { ) : null, row.status === 30000 ? ( - + { 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'); + element.time = moment(element.time * 1000).format('YYYY-MM-DD HH:mm:ss'); } } return res; diff --git a/src/pages/System/Account/List/index.tsx b/src/pages/System/Account/List/index.tsx index f098360..043ba99 100644 --- a/src/pages/System/Account/List/index.tsx +++ b/src/pages/System/Account/List/index.tsx @@ -45,7 +45,7 @@ const AccountManageList = () => { request: async () => { const res = await getRoleList({ page: 1, size: 10 }); const options = new Array(); - res.items.forEach((element) => { + (res as any).items.forEach((element) => { options.push({ label: element.role_name, value: element.id }); }); return options; @@ -56,7 +56,7 @@ const AccountManageList = () => { valueType: 'option', width: 180, render: (_, row) => [ - + { 编辑 , - + @@ -85,7 +85,7 @@ const AccountManageList = () => { /> , - + { @@ -106,7 +106,7 @@ const AccountManageList = () => { toolBarActions={[ { type: 'add', - permission: '账号添加', + permission: 'account_add', onConfirm: () => { setIsModalVisible(true); }, diff --git a/src/pages/System/Notice/List/index.tsx b/src/pages/System/Notice/List/index.tsx index 8acbbc1..f7204f5 100644 --- a/src/pages/System/Notice/List/index.tsx +++ b/src/pages/System/Notice/List/index.tsx @@ -74,7 +74,7 @@ const NoticeList = () => { valueType: 'option', width: 180, render: (_, row) => [ - + { @@ -84,7 +84,7 @@ const NoticeList = () => { 编辑 , - + @@ -104,7 +104,7 @@ const NoticeList = () => { , , - + { @@ -124,7 +124,7 @@ const NoticeList = () => { toolBarActions={[ { type: 'add', - permission: '通知添加', + permission: 'notice_add', onConfirm: () => { setIsModalVisible(true); }, diff --git a/src/pages/System/Notice/components/EditNoticeModal.tsx b/src/pages/System/Notice/components/EditNoticeModal.tsx index f4d05c5..c49736d 100644 --- a/src/pages/System/Notice/components/EditNoticeModal.tsx +++ b/src/pages/System/Notice/components/EditNoticeModal.tsx @@ -4,6 +4,7 @@ import { createForm } from '@formily/core'; import { createSchemaField } from '@formily/react'; import Modal, { ModalProps } from '@/components/Modal'; import { Form, FormItem, Input, Select } from '@formily/antd'; +import { NoticeType } from '@/constants/enum/notice'; interface EditNoticeModalPropsType extends ModalProps { editModalData: any; @@ -11,6 +12,29 @@ interface EditNoticeModalPropsType extends ModalProps { onCancel: () => void; } +const noticeTypeList = [ + { + label: '充值', + value: NoticeType.RECHARGE, + }, + { + label: '提现', + value: NoticeType.WITHDRAW, + }, + { + label: 'NFT创建', + value: NoticeType.NFTCREATE, + }, + { + label: 'NFT转移', + value: NoticeType.NFTTRANSFER, + }, + { + label: 'NFT销毁', + value: NoticeType.NFTTDISPOSE, + }, +]; + const SchemaField = createSchemaField({ components: { FormItem, @@ -41,13 +65,16 @@ const EditNoticeModal = ({ onOk, onCancel, editModalData, ...rest }: EditNoticeM - { const [permissionsData, setPermissionsData] = useState(Array); const [isAddFirst, setIsAddFirst] = useState(false); const [modalData, setModalData] = useState({}); - const [rowData, setRowData] = useState({}); + const [rowData, setRowData] = useState({} as any); const tableRef = useRef(); const access = useAccess(); @@ -32,7 +32,7 @@ const PermissionsList = () => { const deleteLoopChildren = (rowData, children) => { for (let index = 0; index < children.length; index++) { const childrenElement = children[index]; - if (rowData.name == childrenElement.name) { + if (rowData.code == childrenElement.code) { if (children.length == 1) { return 1; } @@ -54,11 +54,11 @@ const PermissionsList = () => { const handleDelete = async (row: any) => { for (let index = 0; index < permissionsData.length; index++) { const element = permissionsData[index]; - if (row.name == element.name) { + if (row.code == (element as any).code) { permissionsData.splice(index, 1); break; } else { - const result = deleteLoopChildren(row, element.children); + const result = deleteLoopChildren(row, (element as any).children); if (result) { break; } @@ -72,7 +72,7 @@ const PermissionsList = () => { const addLoopChildren = (rowData, children) => { for (let index = 0; index < children.length; index++) { let childrenElement = children[index]; - if (rowData.name == childrenElement.name) { + if (rowData.code == childrenElement.code) { if (Object.prototype.hasOwnProperty.call(childrenElement, 'children')) { childrenElement = rowData; } else { @@ -91,8 +91,8 @@ const PermissionsList = () => { const editLoopChildren = (val, rowData, children) => { for (let index = 0; index < children.length; index++) { const childrenElement = children[index]; - if (rowData.name == childrenElement.name) { - childrenElement.name = val.name; + if (rowData.code == childrenElement.code) { + childrenElement.code = val.code; return true; } else { if (Object.prototype.hasOwnProperty.call(childrenElement, 'children')) { @@ -114,7 +114,7 @@ const PermissionsList = () => { valueType: 'option', width: 180, render: (_, row) => [ - + { @@ -125,7 +125,7 @@ const PermissionsList = () => { 添加 , - + { @@ -137,7 +137,7 @@ const PermissionsList = () => { , Object.prototype.hasOwnProperty.call(row, 'children') ? null : ( - + { @@ -160,7 +160,7 @@ const PermissionsList = () => { toolBarActions={[ { type: 'add', - permission: '权限添加', + permission: 'permission_add', onConfirm: () => { setIsAddFirst(true); setIsModalVisible(true); @@ -169,7 +169,7 @@ const PermissionsList = () => { ]} request={async (params) => { const res = await getPermission({}); - const data = JSON.parse(res.items); + const data = JSON.parse((res as any).items); setPermissionsData(data); return { data: data }; }} @@ -185,7 +185,7 @@ const PermissionsList = () => { } else { if (Object.prototype.hasOwnProperty.call(rowData, 'children')) { const result = rowData.children.find(function (value, index, arr) { - return value.name === val.name; + return value.code === val.code; }); if (!result) { rowData.children.push(val); @@ -196,8 +196,8 @@ const PermissionsList = () => { rowData.children = [val]; } for (let index = 0; index < permissionsData.length; index++) { - const element = permissionsData[index]; - if (rowData.name == element.name) { + const element = permissionsData[index] as any; + if (rowData.code == element.code) { permissionsData[index] = rowData; break; } else { @@ -222,9 +222,9 @@ const PermissionsList = () => { }} onOk={async function (val) { for (let index = 0; index < permissionsData.length; index++) { - const element = permissionsData[index]; - if (rowData.name == element.name) { - permissionsData[index].name = val.name; + const element = permissionsData[index] as any; + if (rowData.code == element.code) { + (permissionsData[index] as any).code = val.code; break; } else { const result = editLoopChildren(val, rowData, element.children); diff --git a/src/pages/System/Permissions/components/AddPermissionModal.tsx b/src/pages/System/Permissions/components/AddPermissionModal.tsx index 3dc54f7..cefa133 100644 --- a/src/pages/System/Permissions/components/AddPermissionModal.tsx +++ b/src/pages/System/Permissions/components/AddPermissionModal.tsx @@ -42,6 +42,13 @@ const AddPermissionModal = ({ onOk, onCancel, ...rest }: AddPermissionModalProps x-decorator="FormItem" x-component="Input" /> + diff --git a/src/pages/System/Permissions/components/EditPermissionModal.tsx b/src/pages/System/Permissions/components/EditPermissionModal.tsx index 12a8f56..d215e1b 100644 --- a/src/pages/System/Permissions/components/EditPermissionModal.tsx +++ b/src/pages/System/Permissions/components/EditPermissionModal.tsx @@ -52,6 +52,13 @@ const EditPermissionModal = ({ x-decorator="FormItem" x-component="Input" /> + diff --git a/src/pages/System/Role/List/index.tsx b/src/pages/System/Role/List/index.tsx index 21b4ae0..3954e09 100644 --- a/src/pages/System/Role/List/index.tsx +++ b/src/pages/System/Role/List/index.tsx @@ -49,7 +49,7 @@ const RoleList = () => { valueType: 'option', width: 180, render: (_, row) => [ - + { @@ -59,7 +59,7 @@ const RoleList = () => { 编辑 , - + { @@ -69,7 +69,7 @@ const RoleList = () => { 授权 , - + { @@ -90,7 +90,7 @@ const RoleList = () => { toolBarActions={[ { type: 'add', - permission: '角色添加', + permission: 'role_add', onConfirm: () => { setIsModalVisible(true); }, diff --git a/src/pages/System/Role/components/AuthPermissionsDrawer.tsx b/src/pages/System/Role/components/AuthPermissionsDrawer.tsx index 7bf4a24..a518472 100644 --- a/src/pages/System/Role/components/AuthPermissionsDrawer.tsx +++ b/src/pages/System/Role/components/AuthPermissionsDrawer.tsx @@ -26,21 +26,22 @@ const columnsPermissions: ProColumns[] = [ const valueMap = new Map(); const loops = (list, parent) => { - return (list || []).map(({ children, name }) => { - const node = (valueMap[name] = { + return (list || []).map(({ children, name, code }) => { + const node = (valueMap[code] = { parent, name, - }); + code, + }) as any; node.children = loops(children, node); return node; }); }; -const getPath = (name) => { - const path = []; - let current = valueMap[name]; +const getPath = (code) => { + const path = [] as any; + let current = valueMap[code]; while (current) { - path.unshift(current.name); + path.unshift(current.code); current = current.parent; } return path; @@ -78,6 +79,7 @@ const AuthPermissionsDrawer = ({ const rowSelection: TableRowSelection = { onChange: (selectedRowKeys, selectedRows) => { + console.log('selectedRowKeys = ', selectedRowKeys); setSelectedKeys(selectedRowKeys); }, }; @@ -105,11 +107,15 @@ const AuthPermissionsDrawer = ({ if (Object.prototype.hasOwnProperty.call(tempValue, key)) { const element = tempValue[key]; if (element.children.length != 0) { - parentArray.push(element.name); + parentArray.push(element.code); } } } - if (rowData.permission != undefined && rowData.permission != [] && rowData.permission != null) { + if ( + rowData.permission != undefined && + rowData.permission.length != 0 && + rowData.permission != null + ) { newPermission = rowData.permission.filter((item) => !parentArray.includes(item)); } setSelectedKeys(newPermission); @@ -132,8 +138,8 @@ const AuthPermissionsDrawer = ({ > { - const res = await getPermission({}); + const res = (await getPermission({})) as any; const treeData = JSON.parse(res.items); loops(treeData, null); setTempValue(valueMap); diff --git a/src/pages/System/SecretKey/index.tsx b/src/pages/System/SecretKey/index.tsx index a176ee0..cbf9387 100644 --- a/src/pages/System/SecretKey/index.tsx +++ b/src/pages/System/SecretKey/index.tsx @@ -43,7 +43,7 @@ const SecretKey: React.FC = () => { return (
- +