diff --git a/src/api/index.ts b/src/api/index.ts
index 9114cd5..983d9c1 100644
--- a/src/api/index.ts
+++ b/src/api/index.ts
@@ -57,5 +57,20 @@ export default {
},
get_visa_list(params: object) {
return $axios.post('/admin/visaList', params)
+ },
+ get_lotteryTime() {
+ return $axios.post('/admin/getLotterySetting')
+ },
+ set_lotteryTime(params: object) {
+ return $axios.post('/admin/setLotterySetting', params)
+ },
+ get_walletVersion() {
+ return $axios.post('/admin/getVersion')
+ },
+ set_walletVersion(params: object) {
+ return $axios.post('/admin/setVersion', params)
+ },
+ get_lotteryList(params) {
+ return $axios.post('/admin/lotteryList', params)
}
}
diff --git a/src/pages/lotteryTime/index.tsx b/src/pages/lotteryTime/index.tsx
new file mode 100644
index 0000000..9a8edc4
--- /dev/null
+++ b/src/pages/lotteryTime/index.tsx
@@ -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) => (
+
{getTime(time * 1000)}
+ )
+ },
+ ]
+
+
+ const searchConfigList = [
+ {
+ key: 'search',
+ slot: ,
+ }
+ ]
+
+ return (
+
+
+
+ {startTime > 0 && endTime > 0 && 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())
+ }}
+ />}
+
+
+
+
+
+
+
+
+
+
+
+
+
+ )
+}
+
+export default LotteryTime
\ No newline at end of file
diff --git a/src/pages/walletVersion/index.tsx b/src/pages/walletVersion/index.tsx
new file mode 100644
index 0000000..2e3eca7
--- /dev/null
+++ b/src/pages/walletVersion/index.tsx
@@ -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 (
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ )
+}
+
+export default WalletVersion
\ No newline at end of file
diff --git a/src/route/routes.ts b/src/route/routes.ts
index f57f20e..30f77f0 100644
--- a/src/route/routes.ts
+++ b/src/route/routes.ts
@@ -4,6 +4,8 @@ import System from "@/pages/notify/system"
import { HomeOutlined, SolutionOutlined } from "@ant-design/icons"
import BUZZUPNews from "@/pages/notify/news"
import Visa from "@/pages/visa"
+import LotteryTime from "@/pages/lotteryTime"
+import WalletVersion from "@/pages/walletVersion"
const routes = [
{
@@ -51,6 +53,24 @@ const routes = [
component: Visa,
routes: []
},
+ {
+ path: '/walletVersion',
+ name: '钱包版本管理',
+ exact: true,
+ key: 'walletVersion',
+ icon: SolutionOutlined,
+ component: WalletVersion,
+ routes: []
+ },
+ {
+ path: '/lotteryTime',
+ name: '抽奖设置',
+ exact: true,
+ key: 'lotteryTime',
+ icon: SolutionOutlined,
+ component: LotteryTime,
+ routes: []
+ }
]
diff --git a/src/utils/index.ts b/src/utils/index.ts
index f024041..9bad655 100644
--- a/src/utils/index.ts
+++ b/src/utils/index.ts
@@ -1,5 +1,7 @@
import { notification } from 'antd';
import './axios'
+import { getBaseUrl } from './axios';
+import { store } from '@/store';
export const splitAddress = (address: string, index?: number) => {
try {
@@ -46,4 +48,18 @@ export function copy(value: string) {
notification.success({
message: '复制成功'
})
+}
+
+export const exprotExcel = async () => {
+ const { token = '' } = store.getState().storeData.userInfo || {}
+ const base_url = `${getBaseUrl()}/admin/lotteryExcel`;
+ const res = await fetch(base_url, {
+ headers: {
+ Token: token
+ },
+ method: 'get',
+ })
+ const blob = await res.blob()
+ const url = window.URL.createObjectURL(blob)
+ window.open(url)
}
\ No newline at end of file