修改权限
This commit is contained in:
parent
dd30202a7f
commit
0df3015576
|
|
@ -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);
|
||||
},
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<void> {
|
||||
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,
|
||||
]);
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ const Address: React.FC = () => {
|
|||
{
|
||||
type: 'add',
|
||||
text: '添加NFT',
|
||||
permission: '添加NFT',
|
||||
permission: 'nft_add',
|
||||
onConfirm: () => {
|
||||
setVisible(true);
|
||||
},
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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) => [
|
||||
<Access accessible={access.canShowButton('代币编辑')}>
|
||||
<Access accessible={access.canShowButton('coin_type_edit')}>
|
||||
<a
|
||||
key="edit"
|
||||
onClick={() => {
|
||||
|
|
@ -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<void> {
|
||||
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,
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ const AddCoinTypeModal = ({ onOk, onCancel, ...rest }: AddCoinTypeModalPropsType
|
|||
<SchemaField>
|
||||
<SchemaField.String
|
||||
name="name"
|
||||
title="货币名称"
|
||||
title="游戏币名称"
|
||||
required
|
||||
x-decorator="FormItem"
|
||||
x-component="Input"
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ const EditCoinTypeModal = ({
|
|||
};
|
||||
|
||||
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}>
|
||||
<SchemaField>
|
||||
<SchemaField.String
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ const RecordList = () => {
|
|||
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;
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ const CollectionAddressList = () => {
|
|||
valueType: 'option',
|
||||
width: 150,
|
||||
render: (_, row) => [
|
||||
<Access accessible={access.canShowButton('收款地址编辑')}>
|
||||
<Access accessible={access.canShowButton('wallet_edit')}>
|
||||
<a
|
||||
key="edit"
|
||||
onClick={() => {
|
||||
|
|
@ -60,7 +60,7 @@ const CollectionAddressList = () => {
|
|||
编辑
|
||||
</a>
|
||||
</Access>,
|
||||
<Access accessible={access.canShowButton('收款地址删除')}>
|
||||
<Access accessible={access.canShowButton('wallet_delete')}>
|
||||
<DeleteButton
|
||||
key="delete"
|
||||
onDelete={() => {
|
||||
|
|
@ -80,7 +80,7 @@ const CollectionAddressList = () => {
|
|||
toolBarActions={[
|
||||
{
|
||||
type: 'add',
|
||||
permission: '收款地址添加',
|
||||
permission: 'wallet_add',
|
||||
onConfirm: () => {
|
||||
setIsModalVisible(true);
|
||||
},
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ const WithdrawList = () => {
|
|||
width: 150,
|
||||
render: (_, row) => [
|
||||
row.status === 30000 ? (
|
||||
<Access accessible={access.canShowButton('提现通过')}>
|
||||
<Access accessible={access.canShowButton('withdraw_pass')}>
|
||||
<ConfirmButton
|
||||
key="confirm"
|
||||
title="确认通过提现?"
|
||||
|
|
@ -95,7 +95,7 @@ const WithdrawList = () => {
|
|||
</Access>
|
||||
) : null,
|
||||
row.status === 30000 ? (
|
||||
<Access accessible={access.canShowButton('提现拒绝')}>
|
||||
<Access accessible={access.canShowButton('withdraw_refuse')}>
|
||||
<RejectButton
|
||||
key="confirm"
|
||||
title="确认拒绝提现?"
|
||||
|
|
@ -120,7 +120,7 @@ const WithdrawList = () => {
|
|||
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;
|
||||
|
|
|
|||
|
|
@ -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) => [
|
||||
<Access accessible={access.canShowButton('账号编辑')}>
|
||||
<Access accessible={access.canShowButton('account_edit')}>
|
||||
<a
|
||||
key="edit"
|
||||
placeholder=""
|
||||
|
|
@ -67,7 +67,7 @@ const AccountManageList = () => {
|
|||
编辑
|
||||
</a>
|
||||
</Access>,
|
||||
<Access accessible={access.canShowButton('账号启用禁用')}>
|
||||
<Access accessible={access.canShowButton('account_disabled')}>
|
||||
<Popover
|
||||
content={
|
||||
<div>
|
||||
|
|
@ -85,7 +85,7 @@ const AccountManageList = () => {
|
|||
/>
|
||||
</Popover>
|
||||
</Access>,
|
||||
<Access accessible={access.canShowButton('账号删除')}>
|
||||
<Access accessible={access.canShowButton('account_delete')}>
|
||||
<DeleteButton
|
||||
key="delete"
|
||||
onDelete={() => {
|
||||
|
|
@ -106,7 +106,7 @@ const AccountManageList = () => {
|
|||
toolBarActions={[
|
||||
{
|
||||
type: 'add',
|
||||
permission: '账号添加',
|
||||
permission: 'account_add',
|
||||
onConfirm: () => {
|
||||
setIsModalVisible(true);
|
||||
},
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ const NoticeList = () => {
|
|||
valueType: 'option',
|
||||
width: 180,
|
||||
render: (_, row) => [
|
||||
<Access accessible={access.canShowButton('通知编辑')}>
|
||||
<Access accessible={access.canShowButton('notice_edit')}>
|
||||
<a
|
||||
key="edit"
|
||||
onClick={() => {
|
||||
|
|
@ -84,7 +84,7 @@ const NoticeList = () => {
|
|||
编辑
|
||||
</a>
|
||||
</Access>,
|
||||
<Access accessible={access.canShowButton('通知启用禁用')}>
|
||||
<Access accessible={access.canShowButton('notice_disabled')}>
|
||||
<Popover
|
||||
content={
|
||||
<div>
|
||||
|
|
@ -104,7 +104,7 @@ const NoticeList = () => {
|
|||
,
|
||||
</Popover>
|
||||
</Access>,
|
||||
<Access accessible={access.canShowButton('通知删除')}>
|
||||
<Access accessible={access.canShowButton('notice_delete')}>
|
||||
<DeleteButton
|
||||
key="delete"
|
||||
onDelete={() => {
|
||||
|
|
@ -124,7 +124,7 @@ const NoticeList = () => {
|
|||
toolBarActions={[
|
||||
{
|
||||
type: 'add',
|
||||
permission: '通知添加',
|
||||
permission: 'notice_add',
|
||||
onConfirm: () => {
|
||||
setIsModalVisible(true);
|
||||
},
|
||||
|
|
|
|||
|
|
@ -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
|
|||
<Modal title="修改通知" onOk={handleOk} onCancel={handleCancel} width={800} {...rest}>
|
||||
<Form form={form} labelCol={4} wrapperCol={18}>
|
||||
<SchemaField>
|
||||
<SchemaField.String
|
||||
<SchemaField.Number
|
||||
name="code"
|
||||
title="通知码"
|
||||
x-disabled
|
||||
required
|
||||
x-component-props={{
|
||||
options: noticeTypeList,
|
||||
}}
|
||||
x-decorator="FormItem"
|
||||
x-component="Input"
|
||||
x-component="Select"
|
||||
x-disabled
|
||||
/>
|
||||
<SchemaField.String
|
||||
name="addr"
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ const PermissionsList = () => {
|
|||
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<ActionType>();
|
||||
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) => [
|
||||
<Access accessible={access.canShowButton('权限添加')}>
|
||||
<Access accessible={access.canShowButton('permission_add')}>
|
||||
<a
|
||||
key="add"
|
||||
onClick={() => {
|
||||
|
|
@ -125,7 +125,7 @@ const PermissionsList = () => {
|
|||
添加
|
||||
</a>
|
||||
</Access>,
|
||||
<Access accessible={access.canShowButton('权限编辑')}>
|
||||
<Access accessible={access.canShowButton('permission_edit')}>
|
||||
<a
|
||||
key="edit"
|
||||
onClick={() => {
|
||||
|
|
@ -137,7 +137,7 @@ const PermissionsList = () => {
|
|||
</a>
|
||||
</Access>,
|
||||
Object.prototype.hasOwnProperty.call(row, 'children') ? null : (
|
||||
<Access accessible={access.canShowButton('权限删除')}>
|
||||
<Access accessible={access.canShowButton('permission_delete')}>
|
||||
<DeleteButton
|
||||
key="delete"
|
||||
onDelete={() => {
|
||||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -42,6 +42,13 @@ const AddPermissionModal = ({ onOk, onCancel, ...rest }: AddPermissionModalProps
|
|||
x-decorator="FormItem"
|
||||
x-component="Input"
|
||||
/>
|
||||
<SchemaField.String
|
||||
name="code"
|
||||
title="权限码"
|
||||
required
|
||||
x-decorator="FormItem"
|
||||
x-component="Input"
|
||||
/>
|
||||
</SchemaField>
|
||||
</Form>
|
||||
</Modal>
|
||||
|
|
|
|||
|
|
@ -52,6 +52,13 @@ const EditPermissionModal = ({
|
|||
x-decorator="FormItem"
|
||||
x-component="Input"
|
||||
/>
|
||||
<SchemaField.String
|
||||
name="code"
|
||||
title="权限码"
|
||||
required
|
||||
x-decorator="FormItem"
|
||||
x-component="Input"
|
||||
/>
|
||||
</SchemaField>
|
||||
</Form>
|
||||
</Modal>
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ const RoleList = () => {
|
|||
valueType: 'option',
|
||||
width: 180,
|
||||
render: (_, row) => [
|
||||
<Access accessible={access.canShowButton('角色编辑')}>
|
||||
<Access accessible={access.canShowButton('role_edit')}>
|
||||
<a
|
||||
key="edit"
|
||||
onClick={() => {
|
||||
|
|
@ -59,7 +59,7 @@ const RoleList = () => {
|
|||
编辑
|
||||
</a>
|
||||
</Access>,
|
||||
<Access accessible={access.canShowButton('角色授权')}>
|
||||
<Access accessible={access.canShowButton('role_authorization')}>
|
||||
<a
|
||||
key="auth"
|
||||
onClick={() => {
|
||||
|
|
@ -69,7 +69,7 @@ const RoleList = () => {
|
|||
授权
|
||||
</a>
|
||||
</Access>,
|
||||
<Access accessible={access.canShowButton('角色删除')}>
|
||||
<Access accessible={access.canShowButton('role_delete')}>
|
||||
<DeleteButton
|
||||
key="delete"
|
||||
onDelete={() => {
|
||||
|
|
@ -90,7 +90,7 @@ const RoleList = () => {
|
|||
toolBarActions={[
|
||||
{
|
||||
type: 'add',
|
||||
permission: '角色添加',
|
||||
permission: 'role_add',
|
||||
onConfirm: () => {
|
||||
setIsModalVisible(true);
|
||||
},
|
||||
|
|
|
|||
|
|
@ -26,21 +26,22 @@ const columnsPermissions: ProColumns<any>[] = [
|
|||
|
||||
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<DataType> = {
|
||||
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 = ({
|
|||
>
|
||||
<Table
|
||||
columns={columnsPermissions}
|
||||
rowKey="name"
|
||||
key="name"
|
||||
rowKey="code"
|
||||
key="code"
|
||||
search={false}
|
||||
pagination={false}
|
||||
rowSelection={{
|
||||
|
|
@ -144,7 +150,7 @@ const AuthPermissionsDrawer = ({
|
|||
}}
|
||||
actionRef={tableRef}
|
||||
request={async (params) => {
|
||||
const res = await getPermission({});
|
||||
const res = (await getPermission({})) as any;
|
||||
const treeData = JSON.parse(res.items);
|
||||
loops(treeData, null);
|
||||
setTempValue(valueMap);
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ const SecretKey: React.FC = () => {
|
|||
|
||||
return (
|
||||
<div className={styles.container}>
|
||||
<Access accessible={access.canShowButton('创建密钥')}>
|
||||
<Access accessible={access.canShowButton('secret_create')}>
|
||||
<Popconfirm title="确定创建密钥?" onConfirm={create} okText="确定" cancelText="取消">
|
||||
<Button className={styles.button} type="primary">
|
||||
创建密钥
|
||||
|
|
@ -63,7 +63,7 @@ const SecretKey: React.FC = () => {
|
|||
}}
|
||||
placeholder="请输入AppID"
|
||||
/>
|
||||
<Access accessible={access.canShowButton('创建AppID')}>
|
||||
<Access accessible={access.canShowButton('AppID_create')}>
|
||||
<Popconfirm
|
||||
title="确定创建AppID?"
|
||||
onConfirm={appIDCreate}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ const UserManageList = () => {
|
|||
element.create_time != null
|
||||
) {
|
||||
element.create_time = moment(element.create_time * 1000).format(
|
||||
'YYYY-MM-DD hh:mm:ss',
|
||||
'YYYY-MM-DD HH:mm:ss',
|
||||
);
|
||||
}
|
||||
if (
|
||||
|
|
@ -50,7 +50,7 @@ const UserManageList = () => {
|
|||
element.last_time != undefined &&
|
||||
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');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ export default [
|
|||
{
|
||||
name: '充值系统',
|
||||
path: RoutePath.RECHARGE,
|
||||
code: 'recharge_system',
|
||||
access: 'normalRouteFilter',
|
||||
routes: [
|
||||
{
|
||||
|
|
@ -23,24 +24,28 @@ export default [
|
|||
{
|
||||
name: '充值订单',
|
||||
path: RoutePath.RECORD.LIST,
|
||||
code: 'recharge_record',
|
||||
access: 'normalRouteFilter',
|
||||
component: './Recharge/Record/List',
|
||||
},
|
||||
{
|
||||
name: '收款地址',
|
||||
path: RoutePath.WALLET.LIST,
|
||||
code: 'wallet_address',
|
||||
access: 'normalRouteFilter',
|
||||
component: './Recharge/Wallet/List',
|
||||
},
|
||||
{
|
||||
name: '代币种类',
|
||||
path: RoutePath.COIN_TYPE.LIST,
|
||||
code: 'coin_type',
|
||||
access: 'normalRouteFilter',
|
||||
component: './Recharge/CoinType/List',
|
||||
},
|
||||
{
|
||||
name: '提现管理',
|
||||
path: RoutePath.WITHDRAW.LIST,
|
||||
code: 'withdraw_manage',
|
||||
access: 'normalRouteFilter',
|
||||
component: './Recharge/Withdraw/List',
|
||||
},
|
||||
|
|
@ -49,6 +54,7 @@ export default [
|
|||
{
|
||||
name: '用户账号',
|
||||
path: RoutePath.USER,
|
||||
code: 'user_account',
|
||||
access: 'normalRouteFilter',
|
||||
routes: [
|
||||
{
|
||||
|
|
@ -59,6 +65,7 @@ export default [
|
|||
{
|
||||
name: '用户账号管理',
|
||||
path: RoutePath.USER_LIST.LIST,
|
||||
code: 'user_account_manage',
|
||||
access: 'normalRouteFilter',
|
||||
component: './User/List',
|
||||
},
|
||||
|
|
@ -67,6 +74,7 @@ export default [
|
|||
{
|
||||
name: '系统设置',
|
||||
path: RoutePath.SYSTEM,
|
||||
code: 'system_setting',
|
||||
access: 'normalRouteFilter',
|
||||
routes: [
|
||||
{
|
||||
|
|
@ -77,30 +85,35 @@ export default [
|
|||
{
|
||||
name: '账号管理',
|
||||
path: RoutePath.ACCOUNT.LIST,
|
||||
code: 'account_manage',
|
||||
access: 'normalRouteFilter',
|
||||
component: './System/Account/List',
|
||||
},
|
||||
{
|
||||
name: '角色管理',
|
||||
path: RoutePath.ROLE.LIST,
|
||||
code: 'role_manage',
|
||||
access: 'normalRouteFilter',
|
||||
component: './System/Role/List',
|
||||
},
|
||||
{
|
||||
name: '权限管理',
|
||||
path: RoutePath.PERMISSIONS.LIST,
|
||||
code: 'permission_manage',
|
||||
access: 'normalRouteFilter',
|
||||
component: './System/Permissions/List',
|
||||
},
|
||||
{
|
||||
name: '通知管理',
|
||||
path: RoutePath.NOTICE.LIST,
|
||||
code: 'notice_manage',
|
||||
access: 'normalRouteFilter',
|
||||
component: './System/Notice/List',
|
||||
},
|
||||
{
|
||||
name: '密钥管理',
|
||||
path: RoutePath.SECRET_KEY,
|
||||
code: 'secret_manage',
|
||||
access: 'normalRouteFilter',
|
||||
component: './System/SecretKey',
|
||||
},
|
||||
|
|
@ -109,6 +122,7 @@ export default [
|
|||
{
|
||||
name: '数据看板',
|
||||
access: 'normalRouteFilter',
|
||||
code: 'data_board',
|
||||
path: RoutePath.DATABOARD,
|
||||
routes: [
|
||||
{
|
||||
|
|
@ -119,6 +133,7 @@ export default [
|
|||
{
|
||||
name: '核心看板',
|
||||
path: RoutePath.COREDATA.LIST,
|
||||
code: 'core_ata_board',
|
||||
access: 'normalRouteFilter',
|
||||
component: './DataBoard/CoreData/List',
|
||||
},
|
||||
|
|
@ -127,6 +142,7 @@ export default [
|
|||
{
|
||||
name: 'NFT',
|
||||
path: RoutePath.NFT,
|
||||
code: 'nft',
|
||||
access: 'normalRouteFilter',
|
||||
routes: [
|
||||
{
|
||||
|
|
@ -137,18 +153,21 @@ export default [
|
|||
{
|
||||
name: 'NFT合约管理',
|
||||
path: RoutePath.NFTCONTRACT.LIST,
|
||||
code: 'nft_contract_manage',
|
||||
access: 'normalRouteFilter',
|
||||
component: './NFT/NftContract/List',
|
||||
},
|
||||
{
|
||||
name: 'NFT管理',
|
||||
path: RoutePath.NFTTOKEN.LIST,
|
||||
code: 'nft_manage',
|
||||
access: 'normalRouteFilter',
|
||||
component: './NFT/NftToken/List',
|
||||
},
|
||||
{
|
||||
name: 'NFT交易',
|
||||
path: RoutePath.NFTTRADE.LIST,
|
||||
code: 'nft_trade_manage',
|
||||
access: 'normalRouteFilter',
|
||||
component: './NFT/NftTrade/List',
|
||||
},
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ let provider: any;
|
|||
|
||||
export const web3 = new Web3();
|
||||
if (typeof window.ethereum !== 'undefined') {
|
||||
web3.eth.defaultAccount = window.ethereum.selectedAddress;
|
||||
web3.eth.defaultAccount = (window.ethereum as any).selectedAddress;
|
||||
}
|
||||
|
||||
export async function initWeb3() {
|
||||
|
|
@ -56,7 +56,7 @@ export async function deployContract(abi: string, bin: string, params) {
|
|||
arguments: params,
|
||||
})
|
||||
.send({ from: web3.eth.defaultAccount + '', gas: 3000000 }, async function (e, contract) {});
|
||||
return result._address;
|
||||
return (result as any)._address;
|
||||
}
|
||||
|
||||
// 代币转账
|
||||
|
|
|
|||
Loading…
Reference in New Issue