get educoder code

This commit is contained in:
caishi 2022-05-07 09:21:19 +08:00
parent 7ed5aa376c
commit 35e25b8247
7 changed files with 138 additions and 21 deletions

View File

@ -44,8 +44,8 @@ const ShixunsListPage: FC<PageProps> = ({
},
beforeUpload: (file: any) => {
console.log(file);
if(file?.size>1024*1024*50){
message.info('文件超过50M不符合上传要求')
if(file?.size>1024*1024*500){
message.info('文件超过500M不符合上传要求')
return false
}
let filelist=[];

View File

@ -24,6 +24,7 @@ function Ranking({ChartRules,ItemData,getCharts,Selectkey,getChartRules,userinfo
const [defaultValue,setDefaultValue]=useState('');
const [ClickButton,setClickButton]=useState(true);
const [item,setItem]=useState<any>();
const [items,setItems]=useState<any>();
const { identifier } = useParams();
useEffect(()=>{
//进入初始化状态为第一个
@ -129,7 +130,7 @@ function Ranking({ChartRules,ItemData,getCharts,Selectkey,getChartRules,userinfo
}
},
{
title: HeaderDetail?.task==='mAP'?'mAP指标':'top1指标',
title: HeaderDetail?.task==='mAP'?'mAP指标':HeaderDetail?.task==='Jittor-3'?'总分':'top1指标',
dataIndex: 'score',
key: 'score',
render:(text:any)=>{
@ -151,8 +152,10 @@ function Ranking({ChartRules,ItemData,getCharts,Selectkey,getChartRules,userinfo
setIsupdate(false)
let data=ChartRules?.stages?.filter(item=>parseInt(e)===parseInt(item?.id))[0];
setItem(data);
let datas=data?.children?.[0];
setItems(datas);
setDefaultValue(ChartRules.rule_contents?.filter(item => parseInt(item.competition_stage_id) === parseInt(data?.id))?.[0]?.['content'] || '')
getCharts(e);
getCharts(datas?.id||e);
}}>
{ChartRules&&ChartRules.stages.map((item:any,index:any)=>{
return(
@ -178,6 +181,19 @@ function Ranking({ChartRules,ItemData,getCharts,Selectkey,getChartRules,userinfo
})}
</Tabs> }
{item?.children?.length>0&&<Tabs activeKey={items?.id+''} onChange={(e)=>{
let data=item?.children?.filter(item=>parseInt(e)===parseInt(item?.id))[0];
setItems(data);
getCharts(e);
//获取参数
}}>
{item?.children?.map((item:any,index:any)=>{
return <TabPane tab={item.name} key={item.id === null ? 0 : item.id}>
</TabPane>
})}
</Tabs>}
{isUpdate&& <div>
<MarkdownEditor defaultValue={defaultValue} onChange={(e:any)=>{
setDefaultValue(e);
@ -188,7 +204,7 @@ function Ranking({ChartRules,ItemData,getCharts,Selectkey,getChartRules,userinfo
</p>
</div>}
{ItemData?.teams?.length>0&&(HeaderDetail?.task==='mAP'||HeaderDetail?.task==='dog')?<Table
{ItemData?.teams?.length>0&&(HeaderDetail?.task==='mAP'||HeaderDetail?.task==='dog'||HeaderDetail?.task==='Jittor-3')?<Table
dataSource={ItemData?.teams}
columns={columns}
pagination={false}

View File

@ -93,13 +93,13 @@ function Ranking({ChartRules,ItemData,getCharts,Selectkey,HeaderDetail,getChartR
const columns = [
{
title: '序号',
dataIndex: 'name',
title: 'request_id',
dataIndex: 'request_id',
width:120,
align:'center',
key: 'name',
width:100,
render:(a,b,c)=>{
return <span>{c+1}</span>
return <span>{a}</span>
}
},
{
@ -116,7 +116,7 @@ function Ranking({ChartRules,ItemData,getCharts,Selectkey,HeaderDetail,getChartR
title: '提交人',
dataIndex: 'user_name',
key: 'user_name',
width:120,
width:100,
render:(text:any)=>{
return <span title={text}>{text&&text?.length>=6?text?.substr(0,6)+'...':text||'--'}</span>
}
@ -132,11 +132,12 @@ function Ranking({ChartRules,ItemData,getCharts,Selectkey,HeaderDetail,getChartR
title: '状态',
dataIndex: 'status',
key: 'status',
width:50,
render:(text:any)=>{
return <span>{text===1?'计算中':text===2?'完成':text===0?'待计算':text===3&&'错误'}</span>
}
},
{
(!item?.display_four_indicators&&item?.name==='计图挑战热身赛')&&{
title: '数据指标1',
dataIndex: 'data_ranking',
key: 'data_ranking',
@ -145,7 +146,7 @@ function Ranking({ChartRules,ItemData,getCharts,Selectkey,HeaderDetail,getChartR
return <span>{text||'--'}</span>
}
},
{
(!item?.display_four_indicators&&item?.name==='计图挑战热身赛')&&{
title: '数据指标2',
dataIndex: 'data_other',
key: 'data_other',
@ -153,22 +154,114 @@ function Ranking({ChartRules,ItemData,getCharts,Selectkey,HeaderDetail,getChartR
render:(text:any)=>{
if(text?.length>0){
return text?.map((item,index)=>{
return <span>{item.name}{item.value} <br/></span>
return <span>{item?.name}{item?.value} <br/></span>
})
}else{
return <span>--</span>
}
}
},
item?.display_four_indicators&&{
title: 'mask accuary',
dataIndex: 'data_ranking',
key: 'data_ranking',
align:'left',
render:(text:any)=>{
return <span>{text||'--'}</span>
}
},
item?.display_four_indicators&&{
title: '美学评分',
dataIndex: 'data_other',
key: 'data_other',
align:'left',
render:(text:any)=>{
return <span>{text?.find((item:any)=>item?.name==='score')?.value||'--'}</span>
}
},
item?.display_four_indicators&&{
title: 'FID',
dataIndex: 'data_other',
key: 'data_other',
align:'left',
render:(text:any)=>{
return <span>{text?.find((item:any)=>item?.name==='fid')?.value||'--'}</span>
}
},
item?.display_four_indicators&&{
title: '总分',
dataIndex: 'data_other',
key: 'data_other',
align:'left',
render:(text:any)=>{
return <span>{text?.find((item:any)=>item?.name==='total_score')?.value||'--'}</span>
}
},
(!item?.display_four_indicators&&item?.name.includes('可微渲染新视角生成赛题'))&&{
title: 'Car',
dataIndex: 'data_ranking',
key: 'data_ranking',
align:'center',
render:(text:any)=>{
return <span>{text||'--'}</span>
}
},
(!item?.display_four_indicators&&item?.name.includes('可微渲染新视角生成赛题'))&&{
title: 'Coffee',
dataIndex: 'data_other',
key: 'data_other',
align:'center',
render:(text:any)=>{
return <span>{text?.find((item:any)=>item?.name==='Coffee')?.value||'--'}</span>
}
},
(!item?.display_four_indicators&&item?.name.includes('可微渲染新视角生成赛题'))&&{
title: 'Easyship',
dataIndex: 'data_other',
key: 'data_other',
align:'center',
render:(text:any)=>{
return <span>{text?.find((item:any)=>item?.name==='Easyship')?.value||'--'}</span>
}
},
(!item?.display_four_indicators&&item?.name.includes('可微渲染新视角生成赛题'))&&{
title: 'Scar',
dataIndex: 'data_other',
key: 'data_other',
align:'center',
render:(text:any)=>{
return <span>{text?.find((item:any)=>item?.name==='Scar')?.value||'--'}</span>
}
},
(!item?.display_four_indicators&&item?.name.includes('可微渲染新视角生成赛题'))&&{
title: 'Scarf',
dataIndex: 'data_other',
key: 'data_other',
align:'center',
render:(text:any)=>{
return <span>{text?.find((item:any)=>item?.name==='Scarf')?.value||'--'}</span>
}
},
(!item?.display_four_indicators&&item?.name.includes('可微渲染新视角生成赛题'))&&{
title: '总分',
dataIndex: 'data_other',
key: 'data_other',
align:'center',
render:(text:any)=>{
return <span>{text?.find((item:any)=>item?.name==='Total')?.value||'--'}</span>
}
},
{
title: '操作',
dataIndex: 'result_url',
key: 'result_url',
width:50,
render:(text:any)=>{
return <a href={text} target="_blank" download="附件"></a>
}
},
];
].filter(item => !!item);
return(
<div>
@ -180,7 +273,7 @@ function Ranking({ChartRules,ItemData,getCharts,Selectkey,HeaderDetail,getChartR
</Button>
:
StaffDetail?.enrolled &&
(StaffDetail.enrolled&&item?.start_time&&item?.end_time)&&
<span>
{moment(item?.start_time).format("YYYY-MM-DD HH:mm:ss")}{moment(item?.end_time).format("YYYY-MM-DD HH:mm:ss")}
<Button style={{marginLeft:'20px'}} disabled={moment(item?.start_time).unix()>moment(moment().format('YYYY-MM-DD HH:mm:s')).unix()||moment(moment().format('YYYY-MM-DD HH:mm:s')).unix()>moment(item?.end_time).unix()} onClick={()=>{

View File

@ -70,7 +70,6 @@ function SeeItem({ItemData,setIssee,MenuItem,dispatch,identifier,ModelType,useri
return isLt150M;
},
};
console.log(uploadProps);
//修改内容回调接口
async function updateItem(){

View File

@ -367,7 +367,7 @@ const competitionDetails: FC<PageProps> = ({
}
gotocourse(e, HeaderDetail, HeaderDetail.mode === 2 ? 'ismodel' : HeaderDetail.personal ? 'personal' : `/competitions/index/${HeaderDetail.identifier}/enroll`)
}
}>{StaffDetail.enrolled ? HeaderDetail.need_attachment ? '上传作品' : '已报名' : '立即报名'}</Button> : null}
}>{StaffDetail.enrolled ? HeaderDetail.need_attachment ? '上传作品' : '已报名' : HeaderDetail?.enroll_url ? '前往大赛官网报名' : '立即报名'}</Button> : null}
{user.userInfo.real_name != "游客" && <span onClick={(e) => gotocourse(e, HeaderDetail, `/competitions/index/${HeaderDetail.identifier}/enroll`)} className={styles.myteam}>{isSuperAdmin() ? '参赛战队>>' : '我的战队>>'}</span>}
</div>
</div>

View File

@ -267,7 +267,10 @@ const competitionsPage: FC<PageProps> = ({
<div style={{ width: '20%', alignItems: 'flex-end', display: 'flex', flexDirection: 'column', justifyContent: 'space-around' }}>
<div style={{ textAlign: 'right' }}>
<p style={{ fontSize: '28px', color: '#1890FF', visibility: item && item.bonus ? 'visible' : 'hidden', marginBottom: '0px' }}><span style={{ fontSize: '20px' }}>¥</span>{parseInt(item.bonus).toLocaleString()}</p>
<p style={{ color: '#BBBBBB', fontSize: '14px' }}>{item.competition_status === "nearly_published" ? "0" : item.member_count}</p>
{item.member_count?
<p style={{ color: '#BBBBBB', fontSize: '14px' }}>{item.competition_status === "nearly_published" ? "0" : item.member_count}</p>
:""
}
</div>
{item && item.competition_status === 'ended' ? <span className={styles.Unpublishedtext} onClick={(e) => noclick(e)}></span> : null}
{item && item.competition_status === 'nearly_published' ? <span className={styles.Unpublishedtext} onClick={(e) => noclick(e)}></span> : null}

View File

@ -34,6 +34,8 @@ interface PageProps extends ConnectProps {
const Croppers=useRef(null);
const[updateimg,setupdateimg]=useState('')
const{ identifier,Teannameid }=useParams();
const[letimg,setletimg]=useState<any>('');
const history=useHistory();
useEffect(()=>{
async function init(){
@ -54,8 +56,12 @@ interface PageProps extends ConnectProps {
}
})
if(data){
setpersonname(data.data.name);
setupdateimg(`${env.IMG_SERVER}/${data.data.team_log}`)
// setpersonname(data.data.name);
// setupdateimg(`${env.IMG_SERVER}/${data.data.team_log}`)
setpersonname(data?.data?.name);
setupdateimg(`${env?.IMG_SERVER}/${data?.data?.team_log}`)
setletimg(data?.data?.team_log)
}
}
@ -82,7 +88,7 @@ interface PageProps extends ConnectProps {
identifier:identifier,
Teannameid:Teannameid,
name:personname,
image:updateimg?Croppers.current.getCroppedCanvas().toDataURL("image/jpeg"):undefined
image:letimg?Croppers.current.getCroppedCanvas().toDataURL("image/jpeg"):undefined
}
})
if(data?.status===0){