Skip to content

Commit

Permalink
feat: 积分列表
Browse files Browse the repository at this point in the history
  • Loading branch information
klren0312 committed Dec 9, 2024
1 parent 19ad9c7 commit fb24cca
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 0 deletions.
8 changes: 8 additions & 0 deletions sui_activity_web/src/components/Layout/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,14 @@ export default function PageLayout() {
>
个人中心
</div>
<div
onClick={() => {setCurrentPath('/point'); router.navigate('/point')}}
className={`ml-5 text-white text-base cursor-pointer ${
currentPath === '/point' ? 'font-bold' : ''
}`}
>
积分
</div>
</div>
<div className="flex items-center justify-between">
<MemberInfo />
Expand Down
43 changes: 43 additions & 0 deletions sui_activity_web/src/pages/PointPage/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { useEffect } from 'react'
import supabase from '/@/utils/supabase'
import { useState } from 'react'
import { Table } from 'antd'
interface PointData {
point: number
address: string
}
export default function PointPage () {
const [pointData, setPointData] = useState<PointData[]>([])
const columns = [
{
title: 'Address',
dataIndex: 'address',
key: 'address',
},
{
title: '积分',
dataIndex: 'point',
key: 'point',
},
]
const getPointData = async () => {
let { data, error } = await supabase
.from('member')
.select('address, point')
.order('id', { ascending: false })
if (error) {
console.error(error)
return
}
console.log(data)
setPointData(data as PointData[])
}
useEffect(() => {
getPointData()
}, [])
return (
<div>
<Table bordered size="small" pagination={false} rowKey="address" columns={columns} dataSource={pointData} />
</div>
)
}
5 changes: 5 additions & 0 deletions sui_activity_web/src/routers/router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import HomePage from '../pages/HomePage'
import PersonCenter from '../pages/personCenter'
import ErrorPage from '../pages/ErrorPage'
import CheckinPage from '../pages/CheckinPage'
import PointPage from '../pages/PointPage'

const routes = [
{
Expand All @@ -19,6 +20,10 @@ const routes = [
path: '/checkin',
element: <CheckinPage />,
},
{
path: '/point',
element: <PointPage />,
},
{
path: '/errorNetwork',
element: <ErrorPage />,
Expand Down

0 comments on commit fb24cca

Please sign in to comment.