修改权限

This commit is contained in:
zzy 2022-10-10 16:19:45 +08:00
parent dd30202a7f
commit 0df3015576
24 changed files with 141 additions and 76 deletions

BIN
dist.zip

Binary file not shown.

View File

@ -10,18 +10,17 @@ export default function access(initialState: {
return { return {
canAdmin: currentUser && currentUser.access === 'admin', canAdmin: currentUser && currentUser.access === 'admin',
normalRouteFilter: (route: any) => { normalRouteFilter: (route: any) => {
// return true;
if (routeList == null || routeList == undefined || routeList.length == 0) { if (routeList == null || routeList == undefined || routeList.length == 0) {
return true; return true;
} }
return routeList.includes(route.name); return routeList.includes(route.code);
}, },
canShowButton: (buttonName) => { canShowButton: (buttonCode) => {
// return true; // return true;
if (routeList == null || routeList == undefined || routeList.length == 0) { if (routeList == null || routeList == undefined || routeList.length == 0) {
return true; return true;
} }
return routeList.includes(buttonName); return routeList.includes(buttonCode);
}, },
}; };
} }

View File

@ -114,7 +114,7 @@ const CoreData: React.FC = () => {
params.end_time = moment(params.select_time[1]).valueOf() / 1000; params.end_time = moment(params.select_time[1]).valueOf() / 1000;
} }
const data = await getCoreData({}); const data = await getCoreData({});
setCoreData(data); setCoreData(data as any);
const res = await fetchTableData(getListData, params); const res = await fetchTableData(getListData, params);
console.log('res', res); console.log('res', res);
for (const key in res.data) { for (const key in res.data) {
@ -126,7 +126,7 @@ const CoreData: React.FC = () => {
element.start_time != null element.start_time != null
) { ) {
element.start_time = moment(element.start_time * 1000).format( element.start_time = moment(element.start_time * 1000).format(
'YYYY-MM-DD hh:mm:ss', 'YYYY-MM-DD HH:mm:ss',
); );
} }
} }

View File

@ -51,10 +51,10 @@ const Address: React.FC = () => {
{ {
type: 'add', type: 'add',
text: '新建NFT合约', text: '新建NFT合约',
permission: '新建NFT合约', permission: 'nft_contract_create',
onConfirm: async () => { onConfirm: async () => {
const res = await getContractInfo({ erc: ContractType.NFT721 }); const res = await getContractInfo({ erc: ContractType.NFT721 });
if (res.bin != '') { if ((res as any).bin != '') {
setContractData(res); setContractData(res);
setVisible(true); setVisible(true);
} else { } else {
@ -79,7 +79,7 @@ const Address: React.FC = () => {
onOk={async function (val: any): Promise<void> { onOk={async function (val: any): Promise<void> {
try { try {
await initWeb3(); 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_name,
val.token_symbol, val.token_symbol,
]); ]);

View File

@ -50,7 +50,7 @@ const Address: React.FC = () => {
{ {
type: 'add', type: 'add',
text: '添加NFT', text: '添加NFT',
permission: '添加NFT', permission: 'nft_add',
onConfirm: () => { onConfirm: () => {
setVisible(true); setVisible(true);
}, },

View File

@ -68,7 +68,7 @@ const NFTTradeList = () => {
for (const key in res.data) { for (const key in res.data) {
if (Object.prototype.hasOwnProperty.call(res.data, key)) { if (Object.prototype.hasOwnProperty.call(res.data, key)) {
const element = 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; return res;

View File

@ -44,7 +44,7 @@ const CoinTypeList = () => {
width: 100, width: 100,
}, },
{ {
title: '地址', title: '合约地址',
dataIndex: 'address', dataIndex: 'address',
hideInSearch: true, hideInSearch: true,
ellipsis: true, ellipsis: true,
@ -60,7 +60,7 @@ const CoinTypeList = () => {
valueType: 'option', valueType: 'option',
width: 150, width: 150,
render: (_, row) => [ render: (_, row) => [
<Access accessible={access.canShowButton('代币编辑')}> <Access accessible={access.canShowButton('coin_type_edit')}>
<a <a
key="edit" key="edit"
onClick={() => { onClick={() => {
@ -82,7 +82,7 @@ const CoinTypeList = () => {
toolBarActions={[ toolBarActions={[
{ {
type: 'add', type: 'add',
permission: '代币添加', permission: 'coin_type_add',
onConfirm: () => { onConfirm: () => {
setIsModalVisible(true); setIsModalVisible(true);
}, },
@ -102,7 +102,7 @@ const CoinTypeList = () => {
onOk={async function (val: any): Promise<void> { onOk={async function (val: any): Promise<void> {
const res = await getContractInfo({ erc: ContractType.ERC20 }); const res = await getContractInfo({ erc: ContractType.ERC20 });
await initWeb3(); 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.num,
val.tokenName, val.tokenName,
val.tokenSymbol, val.tokenSymbol,

View File

@ -38,7 +38,7 @@ const AddCoinTypeModal = ({ onOk, onCancel, ...rest }: AddCoinTypeModalPropsType
<SchemaField> <SchemaField>
<SchemaField.String <SchemaField.String
name="name" name="name"
title="币名称" title="游戏币名称"
required required
x-decorator="FormItem" x-decorator="FormItem"
x-component="Input" x-component="Input"

View File

@ -43,7 +43,7 @@ const EditCoinTypeModal = ({
}; };
return ( return (
<Modal title="修改代币类型" onOk={handleOk} onCancel={handleCancel} width={800} {...rest}> <Modal title="修改代币信息" onOk={handleOk} onCancel={handleCancel} width={800} {...rest}>
<Form form={form} labelCol={4} wrapperCol={18}> <Form form={form} labelCol={4} wrapperCol={18}>
<SchemaField> <SchemaField>
<SchemaField.String <SchemaField.String

View File

@ -69,7 +69,7 @@ const RecordList = () => {
for (const key in res.data) { for (const key in res.data) {
if (Object.prototype.hasOwnProperty.call(res.data, key)) { if (Object.prototype.hasOwnProperty.call(res.data, key)) {
const element = 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; return res;

View File

@ -50,7 +50,7 @@ const CollectionAddressList = () => {
valueType: 'option', valueType: 'option',
width: 150, width: 150,
render: (_, row) => [ render: (_, row) => [
<Access accessible={access.canShowButton('收款地址编辑')}> <Access accessible={access.canShowButton('wallet_edit')}>
<a <a
key="edit" key="edit"
onClick={() => { onClick={() => {
@ -60,7 +60,7 @@ const CollectionAddressList = () => {
</a> </a>
</Access>, </Access>,
<Access accessible={access.canShowButton('收款地址删除')}> <Access accessible={access.canShowButton('wallet_delete')}>
<DeleteButton <DeleteButton
key="delete" key="delete"
onDelete={() => { onDelete={() => {
@ -80,7 +80,7 @@ const CollectionAddressList = () => {
toolBarActions={[ toolBarActions={[
{ {
type: 'add', type: 'add',
permission: '收款地址添加', permission: 'wallet_add',
onConfirm: () => { onConfirm: () => {
setIsModalVisible(true); setIsModalVisible(true);
}, },

View File

@ -83,7 +83,7 @@ const WithdrawList = () => {
width: 150, width: 150,
render: (_, row) => [ render: (_, row) => [
row.status === 30000 ? ( row.status === 30000 ? (
<Access accessible={access.canShowButton('提现通过')}> <Access accessible={access.canShowButton('withdraw_pass')}>
<ConfirmButton <ConfirmButton
key="confirm" key="confirm"
title="确认通过提现?" title="确认通过提现?"
@ -95,7 +95,7 @@ const WithdrawList = () => {
</Access> </Access>
) : null, ) : null,
row.status === 30000 ? ( row.status === 30000 ? (
<Access accessible={access.canShowButton('提现拒绝')}> <Access accessible={access.canShowButton('withdraw_refuse')}>
<RejectButton <RejectButton
key="confirm" key="confirm"
title="确认拒绝提现?" title="确认拒绝提现?"
@ -120,7 +120,7 @@ const WithdrawList = () => {
for (const key in res.data) { for (const key in res.data) {
if (Object.prototype.hasOwnProperty.call(res.data, key)) { if (Object.prototype.hasOwnProperty.call(res.data, key)) {
const element = 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; return res;

View File

@ -45,7 +45,7 @@ const AccountManageList = () => {
request: async () => { request: async () => {
const res = await getRoleList({ page: 1, size: 10 }); const res = await getRoleList({ page: 1, size: 10 });
const options = new Array(); const options = new Array();
res.items.forEach((element) => { (res as any).items.forEach((element) => {
options.push({ label: element.role_name, value: element.id }); options.push({ label: element.role_name, value: element.id });
}); });
return options; return options;
@ -56,7 +56,7 @@ const AccountManageList = () => {
valueType: 'option', valueType: 'option',
width: 180, width: 180,
render: (_, row) => [ render: (_, row) => [
<Access accessible={access.canShowButton('账号编辑')}> <Access accessible={access.canShowButton('account_edit')}>
<a <a
key="edit" key="edit"
placeholder="" placeholder=""
@ -67,7 +67,7 @@ const AccountManageList = () => {
</a> </a>
</Access>, </Access>,
<Access accessible={access.canShowButton('账号启用禁用')}> <Access accessible={access.canShowButton('account_disabled')}>
<Popover <Popover
content={ content={
<div> <div>
@ -85,7 +85,7 @@ const AccountManageList = () => {
/> />
</Popover> </Popover>
</Access>, </Access>,
<Access accessible={access.canShowButton('账号删除')}> <Access accessible={access.canShowButton('account_delete')}>
<DeleteButton <DeleteButton
key="delete" key="delete"
onDelete={() => { onDelete={() => {
@ -106,7 +106,7 @@ const AccountManageList = () => {
toolBarActions={[ toolBarActions={[
{ {
type: 'add', type: 'add',
permission: '账号添加', permission: 'account_add',
onConfirm: () => { onConfirm: () => {
setIsModalVisible(true); setIsModalVisible(true);
}, },

View File

@ -74,7 +74,7 @@ const NoticeList = () => {
valueType: 'option', valueType: 'option',
width: 180, width: 180,
render: (_, row) => [ render: (_, row) => [
<Access accessible={access.canShowButton('通知编辑')}> <Access accessible={access.canShowButton('notice_edit')}>
<a <a
key="edit" key="edit"
onClick={() => { onClick={() => {
@ -84,7 +84,7 @@ const NoticeList = () => {
</a> </a>
</Access>, </Access>,
<Access accessible={access.canShowButton('通知启用禁用')}> <Access accessible={access.canShowButton('notice_disabled')}>
<Popover <Popover
content={ content={
<div> <div>
@ -104,7 +104,7 @@ const NoticeList = () => {
, ,
</Popover> </Popover>
</Access>, </Access>,
<Access accessible={access.canShowButton('通知删除')}> <Access accessible={access.canShowButton('notice_delete')}>
<DeleteButton <DeleteButton
key="delete" key="delete"
onDelete={() => { onDelete={() => {
@ -124,7 +124,7 @@ const NoticeList = () => {
toolBarActions={[ toolBarActions={[
{ {
type: 'add', type: 'add',
permission: '通知添加', permission: 'notice_add',
onConfirm: () => { onConfirm: () => {
setIsModalVisible(true); setIsModalVisible(true);
}, },

View File

@ -4,6 +4,7 @@ import { createForm } from '@formily/core';
import { createSchemaField } from '@formily/react'; import { createSchemaField } from '@formily/react';
import Modal, { ModalProps } from '@/components/Modal'; import Modal, { ModalProps } from '@/components/Modal';
import { Form, FormItem, Input, Select } from '@formily/antd'; import { Form, FormItem, Input, Select } from '@formily/antd';
import { NoticeType } from '@/constants/enum/notice';
interface EditNoticeModalPropsType extends ModalProps { interface EditNoticeModalPropsType extends ModalProps {
editModalData: any; editModalData: any;
@ -11,6 +12,29 @@ interface EditNoticeModalPropsType extends ModalProps {
onCancel: () => void; 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({ const SchemaField = createSchemaField({
components: { components: {
FormItem, FormItem,
@ -41,13 +65,16 @@ const EditNoticeModal = ({ onOk, onCancel, editModalData, ...rest }: EditNoticeM
<Modal title="修改通知" onOk={handleOk} onCancel={handleCancel} width={800} {...rest}> <Modal title="修改通知" onOk={handleOk} onCancel={handleCancel} width={800} {...rest}>
<Form form={form} labelCol={4} wrapperCol={18}> <Form form={form} labelCol={4} wrapperCol={18}>
<SchemaField> <SchemaField>
<SchemaField.String <SchemaField.Number
name="code" name="code"
title="通知码" title="通知码"
x-disabled
required required
x-component-props={{
options: noticeTypeList,
}}
x-decorator="FormItem" x-decorator="FormItem"
x-component="Input" x-component="Select"
x-disabled
/> />
<SchemaField.String <SchemaField.String
name="addr" name="addr"

View File

@ -15,7 +15,7 @@ const PermissionsList = () => {
const [permissionsData, setPermissionsData] = useState(Array); const [permissionsData, setPermissionsData] = useState(Array);
const [isAddFirst, setIsAddFirst] = useState(false); const [isAddFirst, setIsAddFirst] = useState(false);
const [modalData, setModalData] = useState({}); const [modalData, setModalData] = useState({});
const [rowData, setRowData] = useState({}); const [rowData, setRowData] = useState({} as any);
const tableRef = useRef<ActionType>(); const tableRef = useRef<ActionType>();
const access = useAccess(); const access = useAccess();
@ -32,7 +32,7 @@ const PermissionsList = () => {
const deleteLoopChildren = (rowData, children) => { const deleteLoopChildren = (rowData, children) => {
for (let index = 0; index < children.length; index++) { for (let index = 0; index < children.length; index++) {
const childrenElement = children[index]; const childrenElement = children[index];
if (rowData.name == childrenElement.name) { if (rowData.code == childrenElement.code) {
if (children.length == 1) { if (children.length == 1) {
return 1; return 1;
} }
@ -54,11 +54,11 @@ const PermissionsList = () => {
const handleDelete = async (row: any) => { const handleDelete = async (row: any) => {
for (let index = 0; index < permissionsData.length; index++) { for (let index = 0; index < permissionsData.length; index++) {
const element = permissionsData[index]; const element = permissionsData[index];
if (row.name == element.name) { if (row.code == (element as any).code) {
permissionsData.splice(index, 1); permissionsData.splice(index, 1);
break; break;
} else { } else {
const result = deleteLoopChildren(row, element.children); const result = deleteLoopChildren(row, (element as any).children);
if (result) { if (result) {
break; break;
} }
@ -72,7 +72,7 @@ const PermissionsList = () => {
const addLoopChildren = (rowData, children) => { const addLoopChildren = (rowData, children) => {
for (let index = 0; index < children.length; index++) { for (let index = 0; index < children.length; index++) {
let childrenElement = children[index]; let childrenElement = children[index];
if (rowData.name == childrenElement.name) { if (rowData.code == childrenElement.code) {
if (Object.prototype.hasOwnProperty.call(childrenElement, 'children')) { if (Object.prototype.hasOwnProperty.call(childrenElement, 'children')) {
childrenElement = rowData; childrenElement = rowData;
} else { } else {
@ -91,8 +91,8 @@ const PermissionsList = () => {
const editLoopChildren = (val, rowData, children) => { const editLoopChildren = (val, rowData, children) => {
for (let index = 0; index < children.length; index++) { for (let index = 0; index < children.length; index++) {
const childrenElement = children[index]; const childrenElement = children[index];
if (rowData.name == childrenElement.name) { if (rowData.code == childrenElement.code) {
childrenElement.name = val.name; childrenElement.code = val.code;
return true; return true;
} else { } else {
if (Object.prototype.hasOwnProperty.call(childrenElement, 'children')) { if (Object.prototype.hasOwnProperty.call(childrenElement, 'children')) {
@ -114,7 +114,7 @@ const PermissionsList = () => {
valueType: 'option', valueType: 'option',
width: 180, width: 180,
render: (_, row) => [ render: (_, row) => [
<Access accessible={access.canShowButton('权限添加')}> <Access accessible={access.canShowButton('permission_add')}>
<a <a
key="add" key="add"
onClick={() => { onClick={() => {
@ -125,7 +125,7 @@ const PermissionsList = () => {
</a> </a>
</Access>, </Access>,
<Access accessible={access.canShowButton('权限编辑')}> <Access accessible={access.canShowButton('permission_edit')}>
<a <a
key="edit" key="edit"
onClick={() => { onClick={() => {
@ -137,7 +137,7 @@ const PermissionsList = () => {
</a> </a>
</Access>, </Access>,
Object.prototype.hasOwnProperty.call(row, 'children') ? null : ( Object.prototype.hasOwnProperty.call(row, 'children') ? null : (
<Access accessible={access.canShowButton('权限删除')}> <Access accessible={access.canShowButton('permission_delete')}>
<DeleteButton <DeleteButton
key="delete" key="delete"
onDelete={() => { onDelete={() => {
@ -160,7 +160,7 @@ const PermissionsList = () => {
toolBarActions={[ toolBarActions={[
{ {
type: 'add', type: 'add',
permission: '权限添加', permission: 'permission_add',
onConfirm: () => { onConfirm: () => {
setIsAddFirst(true); setIsAddFirst(true);
setIsModalVisible(true); setIsModalVisible(true);
@ -169,7 +169,7 @@ const PermissionsList = () => {
]} ]}
request={async (params) => { request={async (params) => {
const res = await getPermission({}); const res = await getPermission({});
const data = JSON.parse(res.items); const data = JSON.parse((res as any).items);
setPermissionsData(data); setPermissionsData(data);
return { data: data }; return { data: data };
}} }}
@ -185,7 +185,7 @@ const PermissionsList = () => {
} else { } else {
if (Object.prototype.hasOwnProperty.call(rowData, 'children')) { if (Object.prototype.hasOwnProperty.call(rowData, 'children')) {
const result = rowData.children.find(function (value, index, arr) { const result = rowData.children.find(function (value, index, arr) {
return value.name === val.name; return value.code === val.code;
}); });
if (!result) { if (!result) {
rowData.children.push(val); rowData.children.push(val);
@ -196,8 +196,8 @@ const PermissionsList = () => {
rowData.children = [val]; rowData.children = [val];
} }
for (let index = 0; index < permissionsData.length; index++) { for (let index = 0; index < permissionsData.length; index++) {
const element = permissionsData[index]; const element = permissionsData[index] as any;
if (rowData.name == element.name) { if (rowData.code == element.code) {
permissionsData[index] = rowData; permissionsData[index] = rowData;
break; break;
} else { } else {
@ -222,9 +222,9 @@ const PermissionsList = () => {
}} }}
onOk={async function (val) { onOk={async function (val) {
for (let index = 0; index < permissionsData.length; index++) { for (let index = 0; index < permissionsData.length; index++) {
const element = permissionsData[index]; const element = permissionsData[index] as any;
if (rowData.name == element.name) { if (rowData.code == element.code) {
permissionsData[index].name = val.name; (permissionsData[index] as any).code = val.code;
break; break;
} else { } else {
const result = editLoopChildren(val, rowData, element.children); const result = editLoopChildren(val, rowData, element.children);

View File

@ -42,6 +42,13 @@ const AddPermissionModal = ({ onOk, onCancel, ...rest }: AddPermissionModalProps
x-decorator="FormItem" x-decorator="FormItem"
x-component="Input" x-component="Input"
/> />
<SchemaField.String
name="code"
title="权限码"
required
x-decorator="FormItem"
x-component="Input"
/>
</SchemaField> </SchemaField>
</Form> </Form>
</Modal> </Modal>

View File

@ -52,6 +52,13 @@ const EditPermissionModal = ({
x-decorator="FormItem" x-decorator="FormItem"
x-component="Input" x-component="Input"
/> />
<SchemaField.String
name="code"
title="权限码"
required
x-decorator="FormItem"
x-component="Input"
/>
</SchemaField> </SchemaField>
</Form> </Form>
</Modal> </Modal>

View File

@ -49,7 +49,7 @@ const RoleList = () => {
valueType: 'option', valueType: 'option',
width: 180, width: 180,
render: (_, row) => [ render: (_, row) => [
<Access accessible={access.canShowButton('角色编辑')}> <Access accessible={access.canShowButton('role_edit')}>
<a <a
key="edit" key="edit"
onClick={() => { onClick={() => {
@ -59,7 +59,7 @@ const RoleList = () => {
</a> </a>
</Access>, </Access>,
<Access accessible={access.canShowButton('角色授权')}> <Access accessible={access.canShowButton('role_authorization')}>
<a <a
key="auth" key="auth"
onClick={() => { onClick={() => {
@ -69,7 +69,7 @@ const RoleList = () => {
</a> </a>
</Access>, </Access>,
<Access accessible={access.canShowButton('角色删除')}> <Access accessible={access.canShowButton('role_delete')}>
<DeleteButton <DeleteButton
key="delete" key="delete"
onDelete={() => { onDelete={() => {
@ -90,7 +90,7 @@ const RoleList = () => {
toolBarActions={[ toolBarActions={[
{ {
type: 'add', type: 'add',
permission: '角色添加', permission: 'role_add',
onConfirm: () => { onConfirm: () => {
setIsModalVisible(true); setIsModalVisible(true);
}, },

View File

@ -26,21 +26,22 @@ const columnsPermissions: ProColumns<any>[] = [
const valueMap = new Map(); const valueMap = new Map();
const loops = (list, parent) => { const loops = (list, parent) => {
return (list || []).map(({ children, name }) => { return (list || []).map(({ children, name, code }) => {
const node = (valueMap[name] = { const node = (valueMap[code] = {
parent, parent,
name, name,
}); code,
}) as any;
node.children = loops(children, node); node.children = loops(children, node);
return node; return node;
}); });
}; };
const getPath = (name) => { const getPath = (code) => {
const path = []; const path = [] as any;
let current = valueMap[name]; let current = valueMap[code];
while (current) { while (current) {
path.unshift(current.name); path.unshift(current.code);
current = current.parent; current = current.parent;
} }
return path; return path;
@ -78,6 +79,7 @@ const AuthPermissionsDrawer = ({
const rowSelection: TableRowSelection<DataType> = { const rowSelection: TableRowSelection<DataType> = {
onChange: (selectedRowKeys, selectedRows) => { onChange: (selectedRowKeys, selectedRows) => {
console.log('selectedRowKeys = ', selectedRowKeys);
setSelectedKeys(selectedRowKeys); setSelectedKeys(selectedRowKeys);
}, },
}; };
@ -105,11 +107,15 @@ const AuthPermissionsDrawer = ({
if (Object.prototype.hasOwnProperty.call(tempValue, key)) { if (Object.prototype.hasOwnProperty.call(tempValue, key)) {
const element = tempValue[key]; const element = tempValue[key];
if (element.children.length != 0) { 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)); newPermission = rowData.permission.filter((item) => !parentArray.includes(item));
} }
setSelectedKeys(newPermission); setSelectedKeys(newPermission);
@ -132,8 +138,8 @@ const AuthPermissionsDrawer = ({
> >
<Table <Table
columns={columnsPermissions} columns={columnsPermissions}
rowKey="name" rowKey="code"
key="name" key="code"
search={false} search={false}
pagination={false} pagination={false}
rowSelection={{ rowSelection={{
@ -144,7 +150,7 @@ const AuthPermissionsDrawer = ({
}} }}
actionRef={tableRef} actionRef={tableRef}
request={async (params) => { request={async (params) => {
const res = await getPermission({}); const res = (await getPermission({})) as any;
const treeData = JSON.parse(res.items); const treeData = JSON.parse(res.items);
loops(treeData, null); loops(treeData, null);
setTempValue(valueMap); setTempValue(valueMap);

View File

@ -43,7 +43,7 @@ const SecretKey: React.FC = () => {
return ( return (
<div className={styles.container}> <div className={styles.container}>
<Access accessible={access.canShowButton('创建密钥')}> <Access accessible={access.canShowButton('secret_create')}>
<Popconfirm title="确定创建密钥?" onConfirm={create} okText="确定" cancelText="取消"> <Popconfirm title="确定创建密钥?" onConfirm={create} okText="确定" cancelText="取消">
<Button className={styles.button} type="primary"> <Button className={styles.button} type="primary">
@ -63,7 +63,7 @@ const SecretKey: React.FC = () => {
}} }}
placeholder="请输入AppID" placeholder="请输入AppID"
/> />
<Access accessible={access.canShowButton('创建AppID')}> <Access accessible={access.canShowButton('AppID_create')}>
<Popconfirm <Popconfirm
title="确定创建AppID?" title="确定创建AppID?"
onConfirm={appIDCreate} onConfirm={appIDCreate}

View File

@ -42,7 +42,7 @@ const UserManageList = () => {
element.create_time != null element.create_time != null
) { ) {
element.create_time = moment(element.create_time * 1000).format( element.create_time = moment(element.create_time * 1000).format(
'YYYY-MM-DD hh:mm:ss', 'YYYY-MM-DD HH:mm:ss',
); );
} }
if ( if (
@ -50,7 +50,7 @@ const UserManageList = () => {
element.last_time != undefined && element.last_time != undefined &&
element.last_time != null element.last_time != null
) { ) {
element.last_time = moment(element.last_time * 1000).format('YYYY-MM-DD hh:mm:ss'); element.last_time = moment(element.last_time * 1000).format('YYYY-MM-DD HH:mm:ss');
} }
} }
} }

View File

@ -13,6 +13,7 @@ export default [
{ {
name: '充值系统', name: '充值系统',
path: RoutePath.RECHARGE, path: RoutePath.RECHARGE,
code: 'recharge_system',
access: 'normalRouteFilter', access: 'normalRouteFilter',
routes: [ routes: [
{ {
@ -23,24 +24,28 @@ export default [
{ {
name: '充值订单', name: '充值订单',
path: RoutePath.RECORD.LIST, path: RoutePath.RECORD.LIST,
code: 'recharge_record',
access: 'normalRouteFilter', access: 'normalRouteFilter',
component: './Recharge/Record/List', component: './Recharge/Record/List',
}, },
{ {
name: '收款地址', name: '收款地址',
path: RoutePath.WALLET.LIST, path: RoutePath.WALLET.LIST,
code: 'wallet_address',
access: 'normalRouteFilter', access: 'normalRouteFilter',
component: './Recharge/Wallet/List', component: './Recharge/Wallet/List',
}, },
{ {
name: '代币种类', name: '代币种类',
path: RoutePath.COIN_TYPE.LIST, path: RoutePath.COIN_TYPE.LIST,
code: 'coin_type',
access: 'normalRouteFilter', access: 'normalRouteFilter',
component: './Recharge/CoinType/List', component: './Recharge/CoinType/List',
}, },
{ {
name: '提现管理', name: '提现管理',
path: RoutePath.WITHDRAW.LIST, path: RoutePath.WITHDRAW.LIST,
code: 'withdraw_manage',
access: 'normalRouteFilter', access: 'normalRouteFilter',
component: './Recharge/Withdraw/List', component: './Recharge/Withdraw/List',
}, },
@ -49,6 +54,7 @@ export default [
{ {
name: '用户账号', name: '用户账号',
path: RoutePath.USER, path: RoutePath.USER,
code: 'user_account',
access: 'normalRouteFilter', access: 'normalRouteFilter',
routes: [ routes: [
{ {
@ -59,6 +65,7 @@ export default [
{ {
name: '用户账号管理', name: '用户账号管理',
path: RoutePath.USER_LIST.LIST, path: RoutePath.USER_LIST.LIST,
code: 'user_account_manage',
access: 'normalRouteFilter', access: 'normalRouteFilter',
component: './User/List', component: './User/List',
}, },
@ -67,6 +74,7 @@ export default [
{ {
name: '系统设置', name: '系统设置',
path: RoutePath.SYSTEM, path: RoutePath.SYSTEM,
code: 'system_setting',
access: 'normalRouteFilter', access: 'normalRouteFilter',
routes: [ routes: [
{ {
@ -77,30 +85,35 @@ export default [
{ {
name: '账号管理', name: '账号管理',
path: RoutePath.ACCOUNT.LIST, path: RoutePath.ACCOUNT.LIST,
code: 'account_manage',
access: 'normalRouteFilter', access: 'normalRouteFilter',
component: './System/Account/List', component: './System/Account/List',
}, },
{ {
name: '角色管理', name: '角色管理',
path: RoutePath.ROLE.LIST, path: RoutePath.ROLE.LIST,
code: 'role_manage',
access: 'normalRouteFilter', access: 'normalRouteFilter',
component: './System/Role/List', component: './System/Role/List',
}, },
{ {
name: '权限管理', name: '权限管理',
path: RoutePath.PERMISSIONS.LIST, path: RoutePath.PERMISSIONS.LIST,
code: 'permission_manage',
access: 'normalRouteFilter', access: 'normalRouteFilter',
component: './System/Permissions/List', component: './System/Permissions/List',
}, },
{ {
name: '通知管理', name: '通知管理',
path: RoutePath.NOTICE.LIST, path: RoutePath.NOTICE.LIST,
code: 'notice_manage',
access: 'normalRouteFilter', access: 'normalRouteFilter',
component: './System/Notice/List', component: './System/Notice/List',
}, },
{ {
name: '密钥管理', name: '密钥管理',
path: RoutePath.SECRET_KEY, path: RoutePath.SECRET_KEY,
code: 'secret_manage',
access: 'normalRouteFilter', access: 'normalRouteFilter',
component: './System/SecretKey', component: './System/SecretKey',
}, },
@ -109,6 +122,7 @@ export default [
{ {
name: '数据看板', name: '数据看板',
access: 'normalRouteFilter', access: 'normalRouteFilter',
code: 'data_board',
path: RoutePath.DATABOARD, path: RoutePath.DATABOARD,
routes: [ routes: [
{ {
@ -119,6 +133,7 @@ export default [
{ {
name: '核心看板', name: '核心看板',
path: RoutePath.COREDATA.LIST, path: RoutePath.COREDATA.LIST,
code: 'core_ata_board',
access: 'normalRouteFilter', access: 'normalRouteFilter',
component: './DataBoard/CoreData/List', component: './DataBoard/CoreData/List',
}, },
@ -127,6 +142,7 @@ export default [
{ {
name: 'NFT', name: 'NFT',
path: RoutePath.NFT, path: RoutePath.NFT,
code: 'nft',
access: 'normalRouteFilter', access: 'normalRouteFilter',
routes: [ routes: [
{ {
@ -137,18 +153,21 @@ export default [
{ {
name: 'NFT合约管理', name: 'NFT合约管理',
path: RoutePath.NFTCONTRACT.LIST, path: RoutePath.NFTCONTRACT.LIST,
code: 'nft_contract_manage',
access: 'normalRouteFilter', access: 'normalRouteFilter',
component: './NFT/NftContract/List', component: './NFT/NftContract/List',
}, },
{ {
name: 'NFT管理', name: 'NFT管理',
path: RoutePath.NFTTOKEN.LIST, path: RoutePath.NFTTOKEN.LIST,
code: 'nft_manage',
access: 'normalRouteFilter', access: 'normalRouteFilter',
component: './NFT/NftToken/List', component: './NFT/NftToken/List',
}, },
{ {
name: 'NFT交易', name: 'NFT交易',
path: RoutePath.NFTTRADE.LIST, path: RoutePath.NFTTRADE.LIST,
code: 'nft_trade_manage',
access: 'normalRouteFilter', access: 'normalRouteFilter',
component: './NFT/NftTrade/List', component: './NFT/NftTrade/List',
}, },

View File

@ -7,7 +7,7 @@ let provider: any;
export const web3 = new Web3(); export const web3 = new Web3();
if (typeof window.ethereum !== 'undefined') { if (typeof window.ethereum !== 'undefined') {
web3.eth.defaultAccount = window.ethereum.selectedAddress; web3.eth.defaultAccount = (window.ethereum as any).selectedAddress;
} }
export async function initWeb3() { export async function initWeb3() {
@ -56,7 +56,7 @@ export async function deployContract(abi: string, bin: string, params) {
arguments: params, arguments: params,
}) })
.send({ from: web3.eth.defaultAccount + '', gas: 3000000 }, async function (e, contract) {}); .send({ from: web3.eth.defaultAccount + '', gas: 3000000 }, async function (e, contract) {});
return result._address; return (result as any)._address;
} }
// 代币转账 // 代币转账