mac
2 weeks ago
5 changed files with 230 additions and 0 deletions
-
15src/api/index.ts
-
119src/pages/lotteryTime/index.tsx
-
60src/pages/walletVersion/index.tsx
-
20src/route/routes.ts
-
16src/utils/index.ts
@ -0,0 +1,119 @@ |
|||
import React, { useEffect, useRef, useState } from 'react'; |
|||
import { Button, DatePicker, Input, notification, Space } from 'antd'; |
|||
import { exprotExcel, getTime } from '@/utils'; |
|||
import api from '@/api'; |
|||
import moment from 'moment'; |
|||
import MyTable from '@/components/MyTable'; |
|||
|
|||
const { RangePicker } = DatePicker; |
|||
|
|||
const LotteryTime = () => { |
|||
|
|||
const [startTime, setStartTime] = useState(0) |
|||
const [endTime, setEndTime] = useState(0) |
|||
const RangeRefs = useRef(null) |
|||
|
|||
const saveTime = async () => { |
|||
try { |
|||
const start_time = Math.floor(startTime / 1000) |
|||
const end_time = Math.floor(endTime / 1000) |
|||
const res: any = await api.set_lotteryTime({ |
|||
start_time, |
|||
end_time |
|||
}) |
|||
|
|||
if (res.code === 0) { |
|||
notification.success({ |
|||
message: '保存成功' |
|||
}) |
|||
} |
|||
} catch (error) { |
|||
|
|||
} |
|||
|
|||
} |
|||
|
|||
const getData = async () => { |
|||
try { |
|||
const res: any = await api.get_lotteryTime() |
|||
if (res.code === 0) { |
|||
setStartTime(res.data.start_time) |
|||
setEndTime(res.data.end_time) |
|||
} |
|||
} catch (error) { |
|||
|
|||
} |
|||
} |
|||
|
|||
useEffect(() => { |
|||
getData() |
|||
}, []) |
|||
|
|||
const columns = [ |
|||
{ |
|||
title: 'ID', |
|||
width: 100, |
|||
dataIndex: "id", |
|||
}, |
|||
{ |
|||
title: '钱包地址', |
|||
width: 300, |
|||
dataIndex: "address", |
|||
}, |
|||
{ |
|||
title: 'BuzzUp DID', |
|||
width: 300, |
|||
dataIndex: "public_key_min", |
|||
}, |
|||
{ |
|||
title: '时间', |
|||
dataIndex: 'time', |
|||
render: (time) => ( |
|||
<div>{getTime(time * 1000)}</div> |
|||
) |
|||
}, |
|||
] |
|||
|
|||
|
|||
const searchConfigList = [ |
|||
{ |
|||
key: 'search', |
|||
slot: <Input placeholder='请输入要搜索的内容' style={{ width: 200 }} />, |
|||
} |
|||
] |
|||
|
|||
return ( |
|||
<div style={{ marginTop: 20, marginBottom: 50 }}> |
|||
<div style={{ display: 'flex', justifyContent: 'space-between' }}> |
|||
<div> |
|||
{startTime > 0 && endTime > 0 && <RangePicker |
|||
ref={RangeRefs} |
|||
defaultValue={startTime > 0 && [moment(startTime * 1000), moment(endTime * 1000)]} |
|||
showTime={{ format: 'HH:mm' }} |
|||
format="YYYY-MM-DD HH:mm" |
|||
onChange={(value, dateString) => { |
|||
setStartTime(new Date(dateString[0]).getTime()) |
|||
setEndTime(new Date(dateString[1]).getTime()) |
|||
}} |
|||
/>} |
|||
|
|||
<Button style={{ marginLeft: 10 }} type='primary' onClick={saveTime}>保存</Button> |
|||
</div> |
|||
|
|||
<Button style={{ marginLeft: 10 }} type='primary' onClick={() => exprotExcel()}>导出excel</Button> |
|||
</div> |
|||
|
|||
<div style={{ border: '1px solid #333', marginTop: 20 }}></div> |
|||
|
|||
<div style={{ marginTop: 20 }}> |
|||
<MyTable |
|||
apiFun={api.get_lotteryList} |
|||
columns={columns} |
|||
searchConfigList={searchConfigList} |
|||
/> |
|||
</div> |
|||
</div> |
|||
) |
|||
} |
|||
|
|||
export default LotteryTime |
@ -0,0 +1,60 @@ |
|||
import api from "@/api"; |
|||
import { Button, Form, Input, notification, Switch } from "antd" |
|||
import React, { useEffect, useState } from "react" |
|||
|
|||
const WalletVersion = () => { |
|||
|
|||
const [formWallet] = Form.useForm(); |
|||
|
|||
const onFinish = async (values) => { |
|||
try { |
|||
const res: any = await api.set_walletVersion(values) |
|||
if (res.code === 0) { |
|||
notification.success({ |
|||
message: '设置成功' |
|||
}) |
|||
} |
|||
} catch (error) { |
|||
|
|||
} |
|||
} |
|||
|
|||
const getData = async () => { |
|||
try { |
|||
const res: any = await api.get_walletVersion() |
|||
if (res.code === 0) { |
|||
formWallet.setFieldsValue(res.data) |
|||
} |
|||
} catch (error) { |
|||
|
|||
} |
|||
} |
|||
|
|||
useEffect(() => { |
|||
getData() |
|||
}, []) |
|||
|
|||
return ( |
|||
<div style={{ marginTop: 20, marginBottom: 40 }}> |
|||
<Form form={formWallet} onFinish={onFinish}> |
|||
<Form.Item label="Android 版本" name="version_android" > |
|||
<Input style={{ maxWidth: 300 }} /> |
|||
</Form.Item> |
|||
<Form.Item label="Android 强制升级" name="must_upgrade_android" valuePropName="checked"> |
|||
<Switch /> |
|||
</Form.Item> |
|||
<Form.Item label="iOS 版本" name="version_ios"> |
|||
<Input style={{ maxWidth: 300 }} /> |
|||
</Form.Item> |
|||
<Form.Item label="iOS 强制升级" name="must_upgrade_ios" valuePropName="checked"> |
|||
<Switch /> |
|||
</Form.Item> |
|||
<div> |
|||
<Button type="primary" htmlType="submit">提交</Button> |
|||
</div> |
|||
</Form > |
|||
</div > |
|||
) |
|||
} |
|||
|
|||
export default WalletVersion |
Write
Preview
Loading…
Cancel
Save
Reference in new issue