diff --git a/src/pages/Recharge/Address/List/index.tsx b/src/pages/Recharge/Address/List/index.tsx index 2aaedbb..604c984 100644 --- a/src/pages/Recharge/Address/List/index.tsx +++ b/src/pages/Recharge/Address/List/index.tsx @@ -1,6 +1,11 @@ import React, { useState, useRef } from 'react'; import Table, { ProColumns, ActionType } from '@/components/Table'; -import { getAddressList, deleteAddress, createAddress, modifyAddress } from '@/services/address'; +import { + getAddressList, + deleteAddress, + createAddress, + modifyAddress, +} from '@/services/Recharge/address'; import { fetchTableData } from '@/utils/table'; import DeleteButton from '@/components/Table/DeleteButton'; import AddAddressModal from './components/addAddressModal'; diff --git a/src/pages/Recharge/CoinType/List/index.tsx b/src/pages/Recharge/CoinType/List/index.tsx index 9dbd9b9..ca85730 100644 --- a/src/pages/Recharge/CoinType/List/index.tsx +++ b/src/pages/Recharge/CoinType/List/index.tsx @@ -1,6 +1,6 @@ import React, { useState, useRef } from 'react'; import Table, { ProColumns, ActionType } from '@/components/Table'; -import { addCoinType, getCoinTypeList, modifyCoinType } from '@/services/coinType'; +import { addCoinType, getCoinTypeList, modifyCoinType } from '@/services/Recharge/coinType'; import { fetchTableData } from '@/utils/table'; import AddCoinTypeModal from './components/addCoinTypeModal'; import EditCoinTypeModal from './components/editCoinTypeModal'; diff --git a/src/pages/Recharge/Record/List/index.tsx b/src/pages/Recharge/Record/List/index.tsx index 7a21d08..c5b6b65 100644 --- a/src/pages/Recharge/Record/List/index.tsx +++ b/src/pages/Recharge/Record/List/index.tsx @@ -1,6 +1,6 @@ import React, { useRef } from 'react'; import Table, { ProColumns, ActionType } from '@/components/Table'; -import { getRecordList } from '@/services/record'; +import { getRecordList } from '@/services/Recharge/record'; import { fetchTableData } from '@/utils/table'; import { getBalanceAmount } from '@/utils/formatBalance'; import BigNumber from 'bignumber.js'; diff --git a/src/pages/Recharge/Withdraw/List/index.tsx b/src/pages/Recharge/Withdraw/List/index.tsx index e6e6298..8ba1df3 100644 --- a/src/pages/Recharge/Withdraw/List/index.tsx +++ b/src/pages/Recharge/Withdraw/List/index.tsx @@ -1,6 +1,6 @@ import React, { useRef } from 'react'; import Table, { ProColumns, ActionType } from '@/components/Table'; -import { getWithdrawList, solveWithdraw } from '@/services/withdraw'; +import { getWithdrawList, solveWithdraw } from '@/services/Recharge/withdraw'; import { fetchTableData } from '@/utils/table'; import { getBalanceAmount } from '@/utils/formatBalance'; import BigNumber from 'bignumber.js'; diff --git a/src/pages/System/Account/List/index.tsx b/src/pages/System/Account/List/index.tsx new file mode 100644 index 0000000..bf36d4c --- /dev/null +++ b/src/pages/System/Account/List/index.tsx @@ -0,0 +1,79 @@ +import React, { useState, useRef } from 'react'; +import Table, { ProColumns, ActionType } from '@/components/Table'; +import { getAccountList, deleteUser } from '@/services/System/accountManage'; +import { fetchTableData } from '@/utils/table'; +import DeleteButton from '@/components/Table/DeleteButton'; +import { Switch } from 'antd'; + +const AccountManageList = () => { + const handleEdit = (row: any) => {}; + + const handleDelete = async (name: any) => { + await deleteUser({ name: name }); + }; + const onChange = (checked: boolean) => {}; + const tableRef = useRef(); + const columns: ProColumns[] = [ + { + title: '账号', + dataIndex: 'name', + hideInSearch: true, + ellipsis: true, + }, + { + title: '角色', + dataIndex: 'role', + hideInSearch: true, + ellipsis: true, + }, + { + title: '用户状态', + dataIndex: 'status', + hideInSearch: true, + ellipsis: true, + }, + { + title: '操作', + valueType: 'option', + width: 180, + render: (_, row) => [ + { + handleEdit(row); + }} + > + 编辑 + , + , + { + handleDelete(row.name); + }} + />, + ], + }, + ]; + return ( +
+ {}, + }, + ]} + actionRef={tableRef} + request={async (params) => { + const res = await fetchTableData(getAccountList, params); + return res; + }} + /> + + ); +}; + +export default AccountManageList; diff --git a/src/pages/System/Permissions/List/index.tsx b/src/pages/System/Permissions/List/index.tsx new file mode 100644 index 0000000..0e90276 --- /dev/null +++ b/src/pages/System/Permissions/List/index.tsx @@ -0,0 +1,66 @@ +import React, { useState, useRef } from 'react'; +import Table, { ProColumns, ActionType } from '@/components/Table'; +import { fetchTableData } from '@/utils/table'; +import DeleteButton from '@/components/Table/DeleteButton'; + +const PermissionsList = () => { + const handleEdit = (row: any) => {}; + + const handleDelete = async (name: any) => {}; + const tableRef = useRef(); + const columns: ProColumns[] = [ + { + title: '收款地址', + dataIndex: 'address', + hideInSearch: true, + ellipsis: true, + }, + { + title: '收款游戏币类型', + dataIndex: 'bc_type', + hideInSearch: true, + ellipsis: true, + }, + { + title: '操作', + valueType: 'option', + width: 150, + render: (_, row) => [ + { + handleEdit(row); + }} + > + 编辑 + , + { + handleDelete(row.name); + }} + />, + ], + }, + ]; + return ( +
+
{}, + }, + ]} + actionRef={tableRef} + request={async (params) => { + return {}; + }} + /> + + ); +}; + +export default PermissionsList; diff --git a/src/pages/System/Role/List/index.tsx b/src/pages/System/Role/List/index.tsx new file mode 100644 index 0000000..a717771 --- /dev/null +++ b/src/pages/System/Role/List/index.tsx @@ -0,0 +1,78 @@ +import React, { useRef } from 'react'; +import Table, { ProColumns, ActionType } from '@/components/Table'; +import { getRoleList, deleteRole } from '@/services/System/role'; +import { fetchTableData } from '@/utils/table'; +import DeleteButton from '@/components/Table/DeleteButton'; + +const RoleList = () => { + const handleEdit = (row: any) => {}; + const handleAuth = (row: any) => {}; + const handleDelete = async (role: any) => { + await deleteRole({ role: role }); + }; + const tableRef = useRef(); + const columns: ProColumns[] = [ + { + title: '角色名称', + dataIndex: 'role_name', + hideInSearch: true, + ellipsis: true, + }, + { + title: '用户类型', + dataIndex: 'role', + hideInSearch: true, + ellipsis: true, + }, + { + title: '操作', + valueType: 'option', + width: 180, + render: (_, row) => [ + { + handleEdit(row); + }} + > + 编辑 + , + { + handleAuth(row); + }} + > + 授权 + , + { + handleDelete(row.role); + }} + />, + ], + }, + ]; + return ( +
+
{}, + }, + ]} + actionRef={tableRef} + request={async (params) => { + const res = await fetchTableData(getRoleList, params); + return res; + }} + /> + + ); +}; + +export default RoleList; diff --git a/src/pages/User/List/index.tsx b/src/pages/User/List/index.tsx new file mode 100644 index 0000000..e10cc1f --- /dev/null +++ b/src/pages/User/List/index.tsx @@ -0,0 +1,48 @@ +import React, { useState, useRef } from 'react'; +import Table, { ProColumns, ActionType } from '@/components/Table'; +import { getUserList } from '@/services/User/user'; +import { fetchTableData } from '@/utils/table'; + +const UserManageList = () => { + const tableRef = useRef(); + const columns: ProColumns[] = [ + { + title: '用户钱包地址', + dataIndex: 'address', + ellipsis: true, + }, + { + title: '登陆时间', + dataIndex: 'last_time', + hideInSearch: true, + ellipsis: true, + }, + { + title: '注册时间', + dataIndex: 'first_time', + hideInSearch: true, + ellipsis: true, + }, + ]; + return ( +
+
{}, + }, + ]} + actionRef={tableRef} + request={async (params) => { + const res = await fetchTableData(getUserList, params); + return res; + }} + /> + + ); +}; + +export default UserManageList; diff --git a/src/routes/index.ts b/src/routes/index.ts index b5847cb..9fc3acb 100644 --- a/src/routes/index.ts +++ b/src/routes/index.ts @@ -41,6 +41,32 @@ export default [ }, ], }, + { + name: '系统设置', + path: RoutePath.SYSTEM, + routes: [ + { + path: RoutePath.SYSTEM, + redirect: RoutePath.ACCOUNT.LIST, + hideInMenu: true, + }, + { + name: '账号管理', + path: RoutePath.ACCOUNT.LIST, + component: './System/Account/List', + }, + { + name: '角色管理', + path: RoutePath.ROLE.LIST, + component: './System/Role/List', + }, + { + name: '权限管理', + path: RoutePath.PERMISSIONS.LIST, + component: './System/Permissions/List', + }, + ], + }, { name: '设置', path: RoutePath.SETTING, diff --git a/src/routes/routePath.ts b/src/routes/routePath.ts index 38a00ed..43be27e 100644 --- a/src/routes/routePath.ts +++ b/src/routes/routePath.ts @@ -1,5 +1,6 @@ const SETTING = '/setting'; const RECHARGE = '/recharge'; +const SYSTEM = '/system'; const RoutePath = { LOGIN: '/login', RECHARGE: RECHARGE, @@ -15,6 +16,16 @@ const RoutePath = { WITHDRAW: { LIST: `${RECHARGE}/withdraw`, }, + SYSTEM: SYSTEM, + ACCOUNT: { + LIST: `${SYSTEM}/account`, + }, + ROLE: { + LIST: `${SYSTEM}/role`, + }, + PERMISSIONS: { + LIST: `${SYSTEM}/permissions`, + }, SETTING: SETTING, WORK: { LIST: `${SETTING}/work`, diff --git a/src/services/address.ts b/src/services/Recharge/address.ts similarity index 100% rename from src/services/address.ts rename to src/services/Recharge/address.ts diff --git a/src/services/coinType.ts b/src/services/Recharge/coinType.ts similarity index 100% rename from src/services/coinType.ts rename to src/services/Recharge/coinType.ts diff --git a/src/services/record.ts b/src/services/Recharge/record.ts similarity index 100% rename from src/services/record.ts rename to src/services/Recharge/record.ts diff --git a/src/services/withdraw.ts b/src/services/Recharge/withdraw.ts similarity index 100% rename from src/services/withdraw.ts rename to src/services/Recharge/withdraw.ts diff --git a/src/services/System/accountManage.ts b/src/services/System/accountManage.ts new file mode 100644 index 0000000..140812a --- /dev/null +++ b/src/services/System/accountManage.ts @@ -0,0 +1,28 @@ +import request from '@/utils/request'; + +/** + * 获取后台用户列表 + * @param {object} params + * @returns {array} data + */ +export const getAccountList = (params) => { + return request.request({ + url: '/tgb/api/v1/user/get', + method: 'get', + params, + }); +}; + +/** + * 删除后台用户 + * @param {object} data + * name 用户名 + * @returns {array} data + */ +export const deleteUser = (data) => { + return request.request({ + url: '/tgb/api/v1/user/get', + method: 'post', + data, + }); +}; diff --git a/src/services/System/role.ts b/src/services/System/role.ts new file mode 100644 index 0000000..b07ea73 --- /dev/null +++ b/src/services/System/role.ts @@ -0,0 +1,30 @@ +import request from '@/utils/request'; + +/** + * 获取后台角色列表 + * @param {object} params + * @returns {array} data + * role_name 角色名称 + * role 角色类型 + */ +export const getRoleList = (params) => { + return request.request({ + url: '/tgb/api/v1/user/role', + method: 'get', + params, + }); +}; + +/** + * 删除后台角色 + * @param {object} params + * role 角色类型 + * @returns {array} data + */ +export const deleteRole = (data) => { + return request.request({ + url: '/tgb/api/v1/user/role/delete', + method: 'post', + data, + }); +}; diff --git a/src/services/User/user.ts b/src/services/User/user.ts new file mode 100644 index 0000000..769f116 --- /dev/null +++ b/src/services/User/user.ts @@ -0,0 +1,16 @@ +import request from '@/utils/request'; + +/** + * 获取后台角色列表 + * @param {object} params + * @returns {array} data + * role_name 角色名称 + * role 角色类型 + */ +export const getUserList = (params) => { + return request.request({ + url: '/tgb/api/v1/account/get', + method: 'get', + params, + }); +};