WIP: user-zzy-dev #1

Closed
Ghost wants to merge 12 commits from user-zzy-dev into master
17 changed files with 391 additions and 4 deletions
Showing only changes of commit 3d6c3b873c - Show all commits

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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<ActionType>();
const columns: ProColumns<any>[] = [
{
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) => [
<a
key="edit"
onClick={() => {
handleEdit(row);
}}
>
</a>,
<Switch key="switch" defaultChecked={row.status} size="small" onChange={onChange} />,
<DeleteButton
key="delete"
onDelete={() => {
handleDelete(row.name);
}}
/>,
],
},
];
return (
<div>
<Table
columns={columns}
rowKey="id"
toolBarActions={[
{
type: 'add',
onConfirm: () => {},
},
]}
actionRef={tableRef}
request={async (params) => {
const res = await fetchTableData(getAccountList, params);
return res;
}}
/>
</div>
);
};
export default AccountManageList;

View File

@ -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<ActionType>();
const columns: ProColumns<any>[] = [
{
title: '收款地址',
dataIndex: 'address',
hideInSearch: true,
ellipsis: true,
},
{
title: '收款游戏币类型',
dataIndex: 'bc_type',
hideInSearch: true,
ellipsis: true,
},
{
title: '操作',
valueType: 'option',
width: 150,
render: (_, row) => [
<a
key="edit"
onClick={() => {
handleEdit(row);
}}
>
</a>,
<DeleteButton
key="delete"
onDelete={() => {
handleDelete(row.name);
}}
/>,
],
},
];
return (
<div>
<Table
columns={columns}
rowKey="id"
toolBarActions={[
{
type: 'add',
onConfirm: () => {},
},
]}
actionRef={tableRef}
request={async (params) => {
return {};
}}
/>
</div>
);
};
export default PermissionsList;

View File

@ -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<ActionType>();
const columns: ProColumns<any>[] = [
{
title: '角色名称',
dataIndex: 'role_name',
hideInSearch: true,
ellipsis: true,
},
{
title: '用户类型',
dataIndex: 'role',
hideInSearch: true,
ellipsis: true,
},
{
title: '操作',
valueType: 'option',
width: 180,
render: (_, row) => [
<a
key="edit"
onClick={() => {
handleEdit(row);
}}
>
</a>,
<a
key="auth"
onClick={() => {
handleAuth(row);
}}
>
</a>,
<DeleteButton
key="delete"
onDelete={() => {
handleDelete(row.role);
}}
/>,
],
},
];
return (
<div>
<Table
columns={columns}
rowKey="id"
toolBarActions={[
{
type: 'add',
onConfirm: () => {},
},
]}
actionRef={tableRef}
request={async (params) => {
const res = await fetchTableData(getRoleList, params);
return res;
}}
/>
</div>
);
};
export default RoleList;

View File

@ -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<ActionType>();
const columns: ProColumns<any>[] = [
{
title: '用户钱包地址',
dataIndex: 'address',
ellipsis: true,
},
{
title: '登陆时间',
dataIndex: 'last_time',
hideInSearch: true,
ellipsis: true,
},
{
title: '注册时间',
dataIndex: 'first_time',
hideInSearch: true,
ellipsis: true,
},
];
return (
<div>
<Table
columns={columns}
rowKey="id"
toolBarActions={[
{
type: 'add',
onConfirm: () => {},
},
]}
actionRef={tableRef}
request={async (params) => {
const res = await fetchTableData(getUserList, params);
return res;
}}
/>
</div>
);
};
export default UserManageList;

View File

@ -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,

View File

@ -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`,

View File

@ -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,
});
};

View File

@ -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,
});
};

16
src/services/User/user.ts Normal file
View File

@ -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,
});
};