diff --git a/src/api/index.ts b/src/api/index.ts
index 983d9c1..aa6b769 100644
--- a/src/api/index.ts
+++ b/src/api/index.ts
@@ -72,5 +72,31 @@ export default {
},
get_lotteryList(params) {
return $axios.post('/admin/lotteryList', params)
- }
+ },
+ // coin 推荐
+ get_buzzTokens(params) {
+ return $axios.post('/admin/getBuzzSymbol', params)
+ },
+ create_buzzTokens(params) {
+ return $axios.post('/admin/newBuzzSymbol', params)
+ },
+ update_buzzTokens(params) {
+ return $axios.post('/admin/updBuzzSymbol', params)
+ },
+ delete_buzzTokens(params) {
+ return $axios.post('/admin/delBuzzSymbol', params)
+ },
+ // coin 默认
+ get_buzzDefaultTokens(params) {
+ return $axios.post('/admin/getBuzzSymbolCreate', params)
+ },
+ create_buzzDefaultTokens(params) {
+ return $axios.post('/admin/newBuzzSymbolCreate', params)
+ },
+ update_buzzDefaultTokens(params) {
+ return $axios.post('/admin/updBuzzSymbolCreate', params)
+ },
+ delete_buzzDefaultTokens(params) {
+ return $axios.post('/admin/delBuzzSymbolCreate', params)
+ },
}
diff --git a/src/pages/chat/group-list/index.tsx b/src/pages/chat/group-list/index.tsx
index 52f29b4..ccdd41c 100644
--- a/src/pages/chat/group-list/index.tsx
+++ b/src/pages/chat/group-list/index.tsx
@@ -350,7 +350,7 @@ const ChatGroupList = () => {
/>
}
- {
+ {visible && {
setVisible(false)
form.resetFields()
}}>
@@ -438,7 +438,7 @@ const ChatGroupList = () => {
-
+ }
>
)
}
diff --git a/src/pages/coin/default-list.tsx b/src/pages/coin/default-list.tsx
new file mode 100644
index 0000000..c9fb4c9
--- /dev/null
+++ b/src/pages/coin/default-list.tsx
@@ -0,0 +1,180 @@
+import api from "@/api"
+import MyTable from "@/components/MyTable"
+import { Button, Drawer, Form, Input, notification, Popconfirm } from "antd"
+import React, { useRef, useState } from "react"
+
+const chaindNames = {
+ 1: 'Ethereum Mainnet',
+ 56: 'BNB Smart Chain Mainnet',
+ 42161: 'Arbitrum One',
+ 10: 'OP Mainnet',
+ 97: 'BSC Testnet',
+ 11155111: 'Ethereum Sepolia',
+ 11155420: 'Optimism Sepolia Testnet Archival',
+ 421614: 'Arbitrum Sepolia Testnet Archival',
+}
+
+const TokenList = () => {
+
+ const [visible, setVisible] = useState(false)
+ const operateType = useRef('' as 'c' | 'u')
+ const [form] = Form.useForm()
+ const tableRef = useRef(null)
+ const currentItem = useRef({} as any)
+
+ const columns = [
+ {
+ title: '地址',
+ dataIndex: 'address',
+ width: 300
+ },
+ {
+ title: '币种名称',
+ dataIndex: 'name',
+ width: 200
+ },
+ {
+ title: '币种符号',
+ dataIndex: 'symbol',
+ width: 200
+ },
+ {
+ title: 'chainId',
+ dataIndex: 'chain_id',
+ width: 200,
+ render: (id) =>
{id} ({chaindNames[id]})
+ },
+ {
+ title: '精度',
+ dataIndex: 'decimals',
+ },
+ {
+ title: '操作',
+ dataIndex: '',
+ fixed: 'right',
+ width: 150,
+ render: (row) => (
+
+
{
+ operateType.current = 'u';
+ form.setFieldsValue(row)
+ currentItem.current = row
+ setVisible(true)
+ }}>修改
+
delToken(row)}>
+ 删除
+
+
+ )
+ },
+ ]
+
+ const delToken = async (item) => {
+ try {
+ const res: any = await api.delete_buzzDefaultTokens({ id: item.id })
+ if (res.code === 0) {
+ notification.success({
+ message: '删除成功'
+ });
+ tableRef.current.update()
+ }
+ } catch (error) {
+
+ }
+ }
+
+ const changeToken = async (values) => {
+ let params = { ...values }
+ Object.keys(params).map(key => {
+ params[key] = typeof params[key] == 'string' ? params[key].trim() : params[key]
+ })
+ const res: any = await api.update_buzzDefaultTokens({
+ ...params,
+ chain_id: Number(params.chain_id),
+ id: currentItem.current.id
+ })
+ if (res.code === 0) {
+ tableRef.current.update()
+ notification.success({
+ message: '修改成功'
+ })
+ }
+ }
+
+ const createToken = async (values) => {
+ let params = { ...values }
+ Object.keys(params).map(key => {
+ params[key] = params[key].trim()
+ })
+ const res: any = await api.create_buzzDefaultTokens({
+ ...params,
+ chain_id: Number(params.chain_id)
+ })
+ if (res.code === 0) {
+ tableRef.current.update()
+ notification.success({
+ message: '创建成功'
+ })
+ }
+ }
+
+ const onFinish = (values) => {
+ close()
+ if (operateType.current === 'c') {
+ createToken(values)
+ } else {
+ changeToken(values)
+ }
+ }
+
+ const close = () => {
+ setVisible(false)
+ form.resetFields()
+ }
+
+ return (
+ <>
+
+
+
+ }
+ apiFun={api.get_buzzDefaultTokens}
+ columns={columns}
+ rowKey="id"
+ />
+ {visible && (
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ )
+ }
+ >
+ )
+}
+
+export default TokenList
\ No newline at end of file
diff --git a/src/pages/coin/token-list.tsx b/src/pages/coin/token-list.tsx
new file mode 100644
index 0000000..820d6b1
--- /dev/null
+++ b/src/pages/coin/token-list.tsx
@@ -0,0 +1,180 @@
+import api from "@/api"
+import MyTable from "@/components/MyTable"
+import { Button, Drawer, Form, Input, notification, Popconfirm } from "antd"
+import React, { useRef, useState } from "react"
+
+const chaindNames = {
+ 1: 'Ethereum Mainnet',
+ 56: 'BNB Smart Chain Mainnet',
+ 42161: 'Arbitrum One',
+ 10: 'OP Mainnet',
+ 97: 'BSC Testnet',
+ 11155111: 'Ethereum Sepolia',
+ 11155420: 'Optimism Sepolia Testnet Archival',
+ 421614: 'Arbitrum Sepolia Testnet Archival',
+}
+
+const TokenList = () => {
+
+ const [visible, setVisible] = useState(false)
+ const operateType = useRef('' as 'c' | 'u')
+ const [form] = Form.useForm()
+ const tableRef = useRef(null)
+ const currentItem = useRef({} as any)
+
+ const columns = [
+ {
+ title: '地址',
+ dataIndex: 'address',
+ width: 300
+ },
+ {
+ title: '币种名称',
+ dataIndex: 'name',
+ width: 200
+ },
+ {
+ title: '币种符号',
+ dataIndex: 'symbol',
+ width: 200
+ },
+ {
+ title: 'chainId',
+ dataIndex: 'chain_id',
+ width: 200,
+ render: (id) => {id} ({chaindNames[id]})
+ },
+ {
+ title: '精度',
+ dataIndex: 'decimals',
+ },
+ {
+ title: '操作',
+ dataIndex: '',
+ fixed: 'right',
+ width: 150,
+ render: (row) => (
+
+
{
+ operateType.current = 'u';
+ form.setFieldsValue(row)
+ currentItem.current = row
+ setVisible(true)
+ }}>修改
+
delToken(row)}>
+ 删除
+
+
+ )
+ },
+ ]
+
+ const delToken = async (item) => {
+ try {
+ const res: any = await api.delete_buzzTokens({ id: item.id })
+ if (res.code === 0) {
+ notification.success({
+ message: '删除成功'
+ });
+ tableRef.current.update()
+ }
+ } catch (error) {
+
+ }
+ }
+
+ const changeToken = async (values) => {
+ let params = { ...values }
+ Object.keys(params).map(key => {
+ params[key] = typeof params[key] == 'string' ? params[key].trim() : params[key]
+ })
+ const res: any = await api.update_buzzTokens({
+ ...params,
+ chain_id: Number(params.chain_id),
+ id: currentItem.current.id
+ })
+ if (res.code === 0) {
+ tableRef.current.update()
+ notification.success({
+ message: '修改成功'
+ })
+ }
+ }
+
+ const createToken = async (values) => {
+ let params = { ...values }
+ Object.keys(params).map(key => {
+ params[key] = params[key].trim()
+ })
+ const res: any = await api.create_buzzTokens({
+ ...params,
+ chain_id: Number(params.chain_id)
+ })
+ if (res.code === 0) {
+ tableRef.current.update()
+ notification.success({
+ message: '创建成功'
+ })
+ }
+ }
+
+ const onFinish = (values) => {
+ close()
+ if (operateType.current === 'c') {
+ createToken(values)
+ } else {
+ changeToken(values)
+ }
+ }
+
+ const close = () => {
+ setVisible(false)
+ form.resetFields()
+ }
+
+ return (
+ <>
+
+
+
+ }
+ apiFun={api.get_buzzTokens}
+ columns={columns}
+ rowKey="id"
+ />
+ {visible && (
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ )
+ }
+ >
+ )
+}
+
+export default TokenList
\ No newline at end of file
diff --git a/src/pages/login/index.tsx b/src/pages/login/index.tsx
index 766ff23..fdd8313 100644
--- a/src/pages/login/index.tsx
+++ b/src/pages/login/index.tsx
@@ -87,7 +87,7 @@ const LoginForm: FC = ({
/>
-
React Antd Admin
+
BuzzUp Admin
{FormView}
diff --git a/src/route/routes.ts b/src/route/routes.ts
index 2263471..1734dcb 100644
--- a/src/route/routes.ts
+++ b/src/route/routes.ts
@@ -9,6 +9,8 @@ import WalletVersion from "@/pages/walletVersion"
import ChatUserList from "@/pages/chat/user-list"
import ChatGroupList from "@/pages/chat/group-list"
import GroupMember from "@/pages/chat/group-member"
+import TokenList from "@/pages/coin/token-list"
+import DefaultList from "@/pages/coin/default-list"
const routes = [
{
@@ -56,6 +58,32 @@ const routes = [
}
]
},
+ {
+ path: '/coin',
+ name: '币种管理',
+ exact: true,
+ type: 'subMenu',
+ key: 'coin',
+ icon: SolutionOutlined,
+ routes: [
+ {
+ path: '/token-list',
+ name: '推荐币种',
+ exact: true,
+ key: 'token-list',
+ component: TokenList,
+ routes: []
+ },
+ {
+ path: '/default-list',
+ name: '默认币种',
+ exact: true,
+ key: 'default-list',
+ component: DefaultList,
+ routes: []
+ },
+ ]
+ },
{
path: '/swiper',
name: 'DAPP',