Skip to content

Commit

Permalink
feat: 增加 AI算法赛 排行榜
Browse files Browse the repository at this point in the history
  • Loading branch information
yulitao-byte committed Sep 6, 2024
1 parent 4434441 commit de2575b
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 3 deletions.
63 changes: 60 additions & 3 deletions src/ActivityHelp/TabSort.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,78 @@
import { Tabs } from "@arco-design/web-react";
import { Message, Table, Tabs } from "@arco-design/web-react";
import { useEffect, useState } from "react";
import { getTosFile } from "../util";

export default function TabSort() {
return (
<>
<div className="font-medium text-lg mb-6">🎉 排行榜</div>

<Tabs type="card-gutter">
<Tabs type="card-gutter" destroyOnHide>
<Tabs.TabPane key="1" title="论文挑战赛">
敬请期待
</Tabs.TabPane>
<Tabs.TabPane key="2" title="任务挑战赛">
敬请期待
</Tabs.TabPane>
<Tabs.TabPane key="3" title="AI算法赛">
敬请期待
<Tabs type="capsule" className="rankTabs">
<Tabs.TabPane title="赛题一" key="1">
<TableRank url="https://2ndbioos-competition-data.tos-cn-beijing.volces.com/bioos-web-config/rank-ai-1.json" />
</Tabs.TabPane>
<Tabs.TabPane title="赛题二" key="2">
<TableRank url="https://2ndbioos-competition-data.tos-cn-beijing.volces.com/bioos-web-config/rank-ai-2.json" />
</Tabs.TabPane>
</Tabs>
</Tabs.TabPane>
</Tabs>
</>
);
}

interface RankItem {
rank: number;
team: string;
score: number;
time: string;
}

function TableRank({ url }: { url: string }) {
const [data, setData] = useState<RankItem[]>();

useEffect(() => {
getTosFile(url, { type: "json" }).then((result) => {
if (result.status === "ok") {
setData(result.content);
} else {
Message.error(`获取数据失败:${result.content}`);
}
});
}, []);

return (
<Table
loading={!data}
rowKey="team"
columns={[
{
title: "排名",
dataIndex: "rank",
},
{
title: "参赛团队",
dataIndex: "team",
},
{
title: "分数",
dataIndex: "score",
},
{
title: "更新时间",
dataIndex: "time",
},
]}
data={data}
pagination={false}
/>
);
}
8 changes: 8 additions & 0 deletions src/ActivityHelp/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,11 @@
.arco-form-item-symbol {
display: inline-block;
}

.rankTabs .arco-tabs-content {
height: unset;
}

.rankTabs .arco-tabs-header-wrapper {
justify-content: left !important;
}

0 comments on commit de2575b

Please sign in to comment.