竞赛调整

dev_auth
杨树明 5 years ago
parent 11885a70a0
commit 50052d34f2

@ -56,7 +56,8 @@ class CompetitionsIndex extends Component{
setcompetitonurl=(url)=>{ setcompetitonurl=(url)=>{
if(url!=null){ if(url!=null){
this.props.history.replace(url); // this.props.history.push(url);
window.location.href=url;
} }
} }
@ -145,8 +146,8 @@ class CompetitionsIndex extends Component{
<List.Item <List.Item
key={key} key={key}
actions={[ actions={[
<span>竞赛时间: 2019-08-07 24: 002019-09-10 24: 00</span>, <span>竞赛时间: {item.start_time}{item.end_time}</span>,
<span>报名截止时间2019-08-07 08:10</span>, <span>报名截止时间{item.enroll_end_time}</span>,
]} ]}
extra={ extra={
<div className={"pt50"} style={{"width":'305px'}}> <div className={"pt50"} style={{"width":'305px'}}>
@ -181,9 +182,10 @@ class CompetitionsIndex extends Component{
this.props.current_user&&this.props.current_user.admin===true?"competitionstitlesshou":this.props.current_user&&this.props.current_user.business===true?"competitionstitlesshou":"endedfont":"competitionstitlesshou"}> this.props.current_user&&this.props.current_user.admin===true?"competitionstitlesshou":this.props.current_user&&this.props.current_user.business===true?"competitionstitlesshou":"endedfont":"competitionstitlesshou"}>
<span className={"competitionstitles"} <span className={"competitionstitles"}
onClick={()=>this.setcompetitonurl(item.competition_status==="ended"?`/newcompetitions/${item.identifier}/common_header`:item.competition_status==="nearly_published"? this.props.current_user&&this.props.current_user.business===true?`/newcompetitions/${item.identifier}/common_header`:this.props.current_user&&this.props.current_user.admin===true?`/newcompetitions/${item.identifier}/common_header`:null:item.competition_status==="progressing"?`/newcompetitions/${item.identifier}/common_header`:null)} onClick={()=>this.setcompetitonurl(item.competition_status==="ended"?`/newcompetitions/${item.identifier}/common_header`:item.competition_status==="nearly_published"? this.props.current_user&&this.props.current_user.business===true?`/newcompetitions/${item.identifier}/common_header`:this.props.current_user&&this.props.current_user.admin===true?`/newcompetitions/${item.identifier}/common_header`:null:item.competition_status==="progressing"?`/newcompetitions/${item.identifier}/common_header`:null)}
>{item.name}</span><span>{item.sub_title===null?"":<Tag className="competitionsrelative" color="#87d068">{ >{item.name}{item.sub_title===null?"":`——${item.sub_title}`}</span>
item.sub_title {/*<span>{item.sub_title===null?"":*/}
}</Tag>}</span> {/*<Tag className="competitionsrelative" color="#87d068">{item.sub_title}</Tag>}*/}
{/*</span>*/}
</a>} </a>}
/> />
{item.description} {item.description}

@ -77,13 +77,14 @@
font-weight: 400; font-weight: 400;
color: #777777; color: #777777;
margin-bottom: 14px; margin-bottom: 14px;
margin-right: 20px; text-align: center;
} }
.CompetitionsIndexbottomvalue{ .CompetitionsIndexbottomvalue{
font-size: 24px; font-size: 24px;
font-family: ArialMT; font-family: ArialMT;
color: rgba(5,16,26,1); color: rgba(5,16,26,1);
text-align: center;
} }
.CompetitionsIndex .gutter-row{ .CompetitionsIndex .gutter-row{
@ -127,9 +128,12 @@
display: none; display: none;
background: rgba(0,0,0,0.33); background: rgba(0,0,0,0.33);
text-align: center; text-align: center;
line-height: 170px;
color: #fff; color: #fff;
font-size: 50px; font-size: 22px;
display: flex;
align-items: center;
justify-content: space-around;
flex-direction: column;
} }
.CompetitionsList:hover .CompetitionsListzhezhao{ .CompetitionsList:hover .CompetitionsListzhezhao{
display: block; display: block;

@ -331,9 +331,12 @@
display: none; display: none;
background: rgba(0,0,0,0.33); background: rgba(0,0,0,0.33);
text-align: center; text-align: center;
line-height: 416px;
color: #fff; color: #fff;
font-size: 50px; font-size: 22px;
display: flex;
align-items: center;
justify-content: space-around;
flex-direction: column;
} }
.relative{position: relative;} .relative{position: relative;}

@ -30,16 +30,16 @@ class CompetitionCommon extends Component{
window.document.title = '竞赛'; window.document.title = '竞赛';
if(this.props.match.params.identifier!=null){ if(this.props.match.params.identifier!=null){
this.getbannerdata(); this.getbannerdata();
let url=`/competitions/${this.props.match.params.identifier}.json`; // let url=`/competitions/${this.props.match.params.identifier}.json`;
axios.get(url).then((response) => { // axios.get(url).then((response) => {
if(response.status===200){ // if(response.status===200){
this.setState({ // this.setState({
bannerdata:response.data // bannerdata:response.data
}) // })
} // }
}).catch((error) => { // }).catch((error) => {
console.log(error) // console.log(error)
}) // })
} }
} }
@ -85,14 +85,17 @@ class CompetitionCommon extends Component{
} }
getlistdata=(keys,listkey)=>{ getlistdata=(keys,listkey)=>{
let{data}=this.state; let{data}=this.state;
this.setState({ this.setState({
thiskeys:keys thiskeys:keys
}) })
data&&data.competition_modules.map((item,key)=>{ data&&data.competition_modules.map((item,key)=>{
if(keys===item.position){ if(item.module_type!="enroll") {
this.getrightdata(item.id,item.module_type,item.module_url,item.has_url,listkey) if (keys === item.position) {
return this.getrightdata(item.id, item.module_type, item.module_url, item.has_url, listkey)
return
}
} }
}) })
} }
@ -117,10 +120,10 @@ class CompetitionCommon extends Component{
} }
getrightdata=(id,typeid,module_url,has_url,listkey)=>{ getrightdata=(id,typeid,module_url,has_url,listkey)=>{
if(typeid==="enroll"){ // if(typeid==="enroll"){
this.props.history.replace(`/newcompetitions/${this.props.match.params.identifier}/enroll`); // this.props.history.replace(`/newcompetitions/${this.props.match.params.identifier}/enroll`);
return // return
} // }
this.getnewchartdata(typeid,listkey) this.getnewchartdata(typeid,listkey)
@ -232,7 +235,7 @@ class CompetitionCommon extends Component{
<img className={"Commonimg"} <img className={"Commonimg"}
src={data.competition_status==="ended"?getImageUrl(`images/educoder/competitions/groups1.png`):data.competition_status==="nearly_published"?getImageUrl(`images/educoder/competitions/groups2.png`):data.competition_status==="progressing"?getImageUrl(`images/educoder/competitions/groups3.png`):""} /> src={data.competition_status==="ended"?getImageUrl(`images/educoder/competitions/groups1.png`):data.competition_status==="nearly_published"?getImageUrl(`images/educoder/competitions/groups2.png`):data.competition_status==="progressing"?getImageUrl(`images/educoder/competitions/groups3.png`):""} />
<Col span={15}> <Col span={15}>
<img className={"image_urlbox"} src={getImageUrl(`images/educoder/competitions/mainbanner.jpg`)}/> <img className={"image_urlbox"} src={data===undefined?getImageUrl(`images/educoder/competitions/mainbanner.jpg`):data.avatar_url===null?getImageUrl(`images/educoder/competitions/mainbanner.jpg`):getImageUrl(data.avatar_url)}/>
</Col> </Col>
<Col className={"CompetitionCommonbannerfont"} span={9}> <Col className={"CompetitionCommonbannerfont"} span={9}>
@ -293,7 +296,9 @@ class CompetitionCommon extends Component{
{data.competition_status==="ended"? {data.competition_status==="ended"?
<Button type="primary" block className={"Competitionfontsize22"} disabled={true}> <Button type="primary" block className={"Competitionfontsize22"} disabled={true}>
已结束 已结束
</Button>: </Button>:data.enroll_end===true?<Button type="primary" block className={"Competitionfontsize22"} disabled={true}>
报名截止
</Button>:
data.competition_status==="progressing"?<Button type="primary" block className={"Competitionfontsize22"}> data.competition_status==="progressing"?<Button type="primary" block className={"Competitionfontsize22"}>
{data.mode===2?<a onClick={()=>this.gotocourse()}>立即报名</a>:<a onClick={()=>this.gotocourse(`/newcompetitions/${this.props.match.params.identifier}/enroll`)}></a>} {data.mode===2?<a onClick={()=>this.gotocourse()}>立即报名</a>:<a onClick={()=>this.gotocourse(`/newcompetitions/${this.props.match.params.identifier}/enroll`)}></a>}
</Button>:""} </Button>:""}

@ -40,7 +40,7 @@ class CompetitionContents extends Component{
key: 'userimg', key: 'userimg',
render: (text, record) =>( render: (text, record) =>(
<a href={`/users/${record.user_login}`} className="color-dark"> <a href={`/users/${record.user_login}`} className="color-dark">
<img className={"Competitionuserimg"} src={getImageUrl(record.userimg)}/> <img className={"Competitionuserimg"} src={getImageUrl(`images/${record.userimg===null?`avatars/User/0?1442652658`:record.userimg}`)}/>
</a>), </a>),
}, },
{ {
@ -71,8 +71,9 @@ class CompetitionContents extends Component{
const data = []; const data = [];
let {chart_rules,chartdata}=this.props; let {chart_rules,chartdata}=this.props;
chartdata===undefined?"":chartdata.teams.length===0?"":chartdata.teams.map((item,key)=>{ chartdata===undefined?"":chartdata.teams.length===0||chartdata.teams.length<3?"":chartdata.teams.map((item,key)=>{
if(key>3){
if(key>2){
let list={ let list={
usersum:key, usersum:key,
userimg:item.user_image, userimg:item.user_image,
@ -120,19 +121,20 @@ class CompetitionContents extends Component{
<Row calssName={"Competition399"}> <Row calssName={"Competition399"}>
{chartdata===undefined?"":chartdata.teams.length===0?"":chartdata.teams.map((item,key)=>{ {chartdata===undefined?"":chartdata.teams.length===0?"":chartdata.teams.map((item,key)=>{
if(key===1){
if(key===3){
return( return(
<Col xs={{ span: 11, offset: 1 }} lg={{ span: 6, offset: 1 }}> <Col className="mt40" xs={{ span: 5, offset: 1 }} lg={{ span: 6, offset: 2 }}>
<Card <Card
className={"Competitionfirst"} className={"Competitionthird"}
cover={ cover={
<div className={"Competitionfirstbox center"}> <div className={"Competitionthirdbox center"}>
<li className="pr Competitioncenter"> <li className="pr Competitioncenter">
<img src={getImageUrl("images/educoder/huangguan.png")}/> <img src={getImageUrl("images/educoder/huangguan-two.png")}/>
<div className={"mt10"}> <div className={"mt10"}>
<a href={`/users/${item.user_login}`} className="color-dark"> <a href={`/users/${item.user_login}`} className="color-dark">
<img className={"rankingimg"} src={getImageUrl(item.user_image)} /> <img className={"rankingimg"} src={getImageUrl(`images/${item.user_image===null?`avatars/User/0?1442652658`:item.user_image}`)} />
<p className="task-hide rankName mt5 jinshaifont">{item.record_user_name}</p> <p className="task-hide rankName mt5 jinshaifont">{item.user_name}</p>
</a> </a>
</div> </div>
</li> </li>
@ -145,28 +147,29 @@ class CompetitionContents extends Component{
<div className={"rankfontmid"}>{item.spend_time}</div> <div className={"rankfontmid"}>{item.spend_time}</div>
</div>} </div>}
description={ description={
<div className={"rankfontbottoms"}>{item.score}</div> <div className={"rankfontbottom"}>{item.score}</div>
} }
/> />
</Card> </Card>
</Col> </Col>
) )
} }
if(key===2){ })}
{chartdata===undefined?"":chartdata.teams.length===0?"":chartdata.teams.map((item,key)=>{
if(key===1){
return( return(
<Col className="mt30" xs={{ span: 5, offset: 1 }} lg={{ span: 6, offset: 1 }}> <Col xs={{ span: 11, offset: 1 }} lg={{ span: 6, offset: 1 }}>
<Card <Card
className={"Competitionsecondary "} className={"Competitionfirst"}
cover={ cover={
<div className={"Competitionsecondarybox center"}> <div className={"Competitionfirstbox center"}>
<li className=" pr Competitioncenter "> <li className="pr Competitioncenter">
<img src={getImageUrl("images/educoder/huangguan-three.png")}/> <img src={getImageUrl("images/educoder/huangguan.png")}/>
<div className={"mt10"}> <div className={"mt10"}>
<a href={`/users/${item.user_login}`} className="color-dark"> <a href={`/users/${item.user_login}`} className="color-dark">
<img className={"rankingimg"} src={getImageUrl(item.user_image)} /> <img className={"rankingimg"} src={getImageUrl(`images/${item.user_image===null?`avatars/User/0?1442652658`:item.user_image}`)} />
<p className="task-hide rankName mt5 jinshaifont">{item.record_user_name}</p> <p className="task-hide rankName mt5 jinshaifont">{item.record_user_name}</p>
</a> </a>
</div> </div>
@ -180,28 +183,30 @@ class CompetitionContents extends Component{
<div className={"rankfontmid"}>{item.spend_time}</div> <div className={"rankfontmid"}>{item.spend_time}</div>
</div>} </div>}
description={ description={
<div className={"rankfontbottom"}>{item.score}</div> <div className={"rankfontbottoms"}>{item.score}</div>
} }
/> />
</Card> </Card>
</Col> </Col>
) )
} }
})}
if(key===3){ {chartdata===undefined?"":chartdata.teams.length===0?"":chartdata.teams.map((item,key)=>{
if(key===2){
return( return(
<Col className="mt40" xs={{ span: 5, offset: 1 }} lg={{ span: 6, offset: 2 }}> <Col className="mt30" xs={{ span: 5, offset: 1 }} lg={{ span: 6, offset: 1 }}>
<Card <Card
className={"Competitionthird"} className={"Competitionsecondary "}
cover={ cover={
<div className={"Competitionthirdbox center"}> <div className={"Competitionsecondarybox center"}>
<li className="pr Competitioncenter"> <li className=" pr Competitioncenter ">
<img src={getImageUrl("images/educoder/huangguan-two.png")}/> <img src={getImageUrl("images/educoder/huangguan-three.png")}/>
<div className={"mt10"}> <div className={"mt10"}>
<a href={`/users/${item.user_login}`} className="color-dark"> <a href={`/users/${item.user_login}`} className="color-dark">
<img className={"rankingimg"} src={getImageUrl(item.user_image)} /> <img className={"rankingimg"} src={getImageUrl(`images/${item.user_image===null?`avatars/User/0?1442652658`:item.user_image}`)} />
<p className="task-hide rankName mt5 jinshaifont">{item.user_name}</p> <p className="task-hide rankName mt5 jinshaifont">{item.record_user_name}</p>
</a> </a>
</div> </div>
</li> </li>
@ -216,17 +221,19 @@ class CompetitionContents extends Component{
description={ description={
<div className={"rankfontbottom"}>{item.score}</div> <div className={"rankfontbottom"}>{item.score}</div>
} }
/> />
</Card> </Card>
</Col> </Col>
) )
} }
})} })}
</Row> </Row>
{chartdata===undefined?"":chartdata.user_ranks.length===0?"":<div className={"youranklist"}> {chartdata===undefined?"":chartdata.user_ranks.length===0?"":<div className={"youranklist mt50"}>
<style> <style>
{ {
` `
@ -261,7 +268,7 @@ class CompetitionContents extends Component{
})} })}
</div>} </div>}
<Row className={"mt80 mb80"}> <Row className={"mt80 mb80"}>
{chartdata===undefined?"":chartdata.teams.length===0?"":<Table className="Competitiontransparent" columns={columns} dataSource={data} showHeader={false} pagination={false}/>} {chartdata===undefined?"":chartdata.teams.length===0||chartdata.teams.length<3?"":<Table className="Competitiontransparent" columns={columns} dataSource={data} showHeader={false} pagination={false}/>}
</Row> </Row>

Loading…
Cancel
Save