mac
2 days ago
6 changed files with 184 additions and 1 deletions
-
15package-lock.json
-
1package.json
-
7src/api/index.ts
-
65src/pages/chat/group-list/index.tsx
-
87src/pages/wallet-user/index.tsx
-
10src/route/routes.ts
@ -0,0 +1,87 @@ |
|||||
|
import api from "@/api" |
||||
|
import MyTable from "@/components/MyTable" |
||||
|
import { Button, Drawer, Form, Input, notification } from "antd" |
||||
|
import React, { useRef, useState } from "react" |
||||
|
|
||||
|
const WalletUser = () => { |
||||
|
|
||||
|
const [visible, setVisible] = useState(false) |
||||
|
const [form] = Form.useForm() |
||||
|
const tableRef = useRef(null) |
||||
|
|
||||
|
const columns = [ |
||||
|
{ |
||||
|
title: '钱包地址', |
||||
|
dataIndex: 'address', |
||||
|
width: 200 |
||||
|
}, |
||||
|
{ |
||||
|
title: '邀请码', |
||||
|
dataIndex: 'inviti_code', |
||||
|
width: 200 |
||||
|
}, |
||||
|
{ |
||||
|
title: '邀请人的码', |
||||
|
dataIndex: 'inviti', |
||||
|
width: 200 |
||||
|
}, |
||||
|
{ |
||||
|
title: '邀请人数', |
||||
|
dataIndex: 'invite_number', |
||||
|
}, |
||||
|
] |
||||
|
|
||||
|
const searchConfigList = [ |
||||
|
{ |
||||
|
key: 'search', |
||||
|
slot: <Input placeholder="请输入" /> |
||||
|
} |
||||
|
] |
||||
|
|
||||
|
const onFinish = async (values) => { |
||||
|
try { |
||||
|
setVisible(false) |
||||
|
const res: any = await api.create_walletUser({ ...values }) |
||||
|
if (res.code === 0) { |
||||
|
tableRef.current.update() |
||||
|
notification.success({ |
||||
|
message: '新建成功' |
||||
|
}) |
||||
|
} |
||||
|
} catch (error) { |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
|
||||
|
return ( |
||||
|
<> |
||||
|
<MyTable |
||||
|
ref={tableRef} |
||||
|
header={ |
||||
|
<div> |
||||
|
<Button type="primary" onClick={() => setVisible(true)}>新建用户</Button> |
||||
|
</div> |
||||
|
} |
||||
|
searchConfigList={searchConfigList} |
||||
|
apiFun={api.get_walletUser} |
||||
|
columns={columns} |
||||
|
rowKey="id" |
||||
|
/> |
||||
|
<Drawer visible={visible} onClose={() => setVisible(false)} width={500} title="新建用户"> |
||||
|
<Form onFinish={onFinish} form={form} layout="vertical"> |
||||
|
<Form.Item label="钱包主地址" name="address" rules={[{ required: true, message: '请输入' }]}> |
||||
|
<Input /> |
||||
|
</Form.Item> |
||||
|
<Form.Item label="自定义推荐码" name="inviti_code" rules={[{ required: true, message: '请输入' }]}> |
||||
|
<Input /> |
||||
|
</Form.Item> |
||||
|
<Form.Item> |
||||
|
<Button htmlType="submit" type="primary">确认</Button> |
||||
|
</Form.Item> |
||||
|
</Form> |
||||
|
</Drawer> |
||||
|
</> |
||||
|
) |
||||
|
} |
||||
|
|
||||
|
export default WalletUser |
Write
Preview
Loading…
Cancel
Save
Reference in new issue