File tree Expand file tree Collapse file tree 2 files changed +68
-3
lines changed
Expand file tree Collapse file tree 2 files changed +68
-3
lines changed Original file line number Diff line number Diff line change 1- import { Tabs } from "@arco-design/web-react" ;
1+ import { Message , Table , Tabs } from "@arco-design/web-react" ;
2+ import { useEffect , useState } from "react" ;
3+ import { getTosFile } from "../util" ;
24
35export default function TabSort ( ) {
46 return (
57 < >
68 < div className = "font-medium text-lg mb-6" > 🎉 排行榜</ div >
79
8- < Tabs type = "card-gutter" >
10+ < Tabs type = "card-gutter" destroyOnHide >
911 < Tabs . TabPane key = "1" title = "论文挑战赛" >
1012 敬请期待
1113 </ Tabs . TabPane >
1214 < Tabs . TabPane key = "2" title = "任务挑战赛" >
1315 敬请期待
1416 </ Tabs . TabPane >
1517 < Tabs . TabPane key = "3" title = "AI算法赛" >
16- 敬请期待
18+ < Tabs type = "capsule" className = "rankTabs" >
19+ < Tabs . TabPane title = "赛题一" key = "1" >
20+ < TableRank url = "https://2ndbioos-competition-data.tos-cn-beijing.volces.com/bioos-web-config/rank-ai-1.json" />
21+ </ Tabs . TabPane >
22+ < Tabs . TabPane title = "赛题二" key = "2" >
23+ < TableRank url = "https://2ndbioos-competition-data.tos-cn-beijing.volces.com/bioos-web-config/rank-ai-2.json" />
24+ </ Tabs . TabPane >
25+ </ Tabs >
1726 </ Tabs . TabPane >
1827 </ Tabs >
1928 </ >
2029 ) ;
2130}
31+
32+ interface RankItem {
33+ rank : number ;
34+ team : string ;
35+ score : number ;
36+ time : string ;
37+ }
38+
39+ function TableRank ( { url } : { url : string } ) {
40+ const [ data , setData ] = useState < RankItem [ ] > ( ) ;
41+
42+ useEffect ( ( ) => {
43+ getTosFile ( url , { type : "json" } ) . then ( ( result ) => {
44+ if ( result . status === "ok" ) {
45+ setData ( result . content ) ;
46+ } else {
47+ Message . error ( `获取数据失败:${ result . content } ` ) ;
48+ }
49+ } ) ;
50+ } , [ ] ) ;
51+
52+ return (
53+ < Table
54+ loading = { ! data }
55+ rowKey = "team"
56+ columns = { [
57+ {
58+ title : "排名" ,
59+ dataIndex : "rank" ,
60+ } ,
61+ {
62+ title : "参赛团队" ,
63+ dataIndex : "team" ,
64+ } ,
65+ {
66+ title : "分数" ,
67+ dataIndex : "score" ,
68+ } ,
69+ {
70+ title : "更新时间" ,
71+ dataIndex : "time" ,
72+ } ,
73+ ] }
74+ data = { data }
75+ pagination = { false }
76+ />
77+ ) ;
78+ }
Original file line number Diff line number Diff line change 77.arco-form-item-symbol {
88 display : inline-block ;
99}
10+
11+ .rankTabs .arco-tabs-content {
12+ height : unset ;
13+ }
14+
15+ .rankTabs .arco-tabs-header-wrapper {
16+ justify-content : left !important ;
17+ }
You can’t perform that action at this time.
0 commit comments