From 46567871bd1b4f2eefe3fd776941ac6197565ce7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Thu, 24 Oct 2019 12:32:04 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Competitimain/CompetitionsIndex.js | 13 ++++++---- .../Competitimain/Competitionsindex.css | 24 ++++++++++++------- .../Competition_teams/Competitionteams.js | 22 +++++++++++++---- 3 files changed, 40 insertions(+), 19 deletions(-) diff --git a/public/react/src/modules/competitions/Competitimain/CompetitionsIndex.js b/public/react/src/modules/competitions/Competitimain/CompetitionsIndex.js index 61e6419b7..b0a9ff4c9 100644 --- a/public/react/src/modules/competitions/Competitimain/CompetitionsIndex.js +++ b/public/react/src/modules/competitions/Competitimain/CompetitionsIndex.js @@ -1,6 +1,6 @@ import React, { Component } from 'react'; import { Link } from 'react-router-dom'; -import { Menu, Icon, List, Avatar,Row, Col,Tag,Pagination} from 'antd'; +import { Menu, Icon, List, Avatar,Row, Col,Tag,Pagination,Alert} from 'antd'; import {getImageUrl} from 'educoder'; import axios from 'axios'; import './Competitionsindex.css'; @@ -78,8 +78,7 @@ class CompetitionsIndex extends Component{ } render() { let {datas,page,count}=this.state; - admin: true - business: false + console.log(this.props.current_user&&this.props.current_user.business) return ( <div> @@ -133,7 +132,11 @@ class CompetitionsIndex extends Component{ dataSource={datas&&datas} renderItem={(item,key) => ( <div> + <div className={"CompetitionsList"} > + {item.competition_status==="nearly_published"? + this.props.current_user&&this.props.current_user.admin===true?"":this.props.current_user&&this.props.current_user.business===true?"":<div className={"CompetitionsListzhezhao"}>即将发布 敬请期待</div>:""} + {/*<div className={"CompetitionsListzhezhao"}>即将发布 敬请期待</div>*/} {item.description===null||item.description===undefined||item.description===""?<style> { ` @@ -181,7 +184,7 @@ class CompetitionsIndex extends Component{ > <List.Item.Meta title={<a className={item.competition_status==="ended"?"endedfont":item.competition_status==="nearly_published"? - this.props.current_user&&this.props.current_user.business===true?"":this.props.current_user&&this.props.current_user.admin===true?"":"endedfont":""}> + this.props.current_user&&this.props.current_user.admin===true?"":this.props.current_user&&this.props.current_user.business===true?"":"endedfont":""}> <span className={"competitionstitles"} onClick={()=>this.setcompetitonurl(item.competition_status==="ended"?null: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">{ @@ -199,7 +202,7 @@ class CompetitionsIndex extends Component{ } />} - {datas===undefined?'none':datas.task_count >20 ?<div className="mb40 edu-txt-center padding20-30" + {datas===undefined?"":datas.task_count >20 ?<div className="mb40 edu-txt-center padding20-30" > <Pagination diff --git a/public/react/src/modules/competitions/Competitimain/Competitionsindex.css b/public/react/src/modules/competitions/Competitimain/Competitionsindex.css index c711859c9..e6754d3e1 100644 --- a/public/react/src/modules/competitions/Competitimain/Competitionsindex.css +++ b/public/react/src/modules/competitions/Competitimain/Competitionsindex.css @@ -117,14 +117,20 @@ .endedfont{ color:#000 !important; } -.zhezhaos{ - - height: 200px; - overflow: hidden; - position: relative; - border: 1px solid rgb(235, 237, 240); - border-radius: 2px; - padding: 48px; +.CompetitionsListzhezhao{ + position: absolute; + top: 0px; + left: 0px; + width: 1206px; + height: 100%; + z-index: 10000; + display: none; + background: rgba(51, 51, 51,0.7); text-align: center; - background: rgb(250, 250, 250); + line-height: 170px; + color: #fff; + font-size: 50px; +} +.CompetitionsList:hover .CompetitionsListzhezhao{ + display: block; } \ No newline at end of file diff --git a/public/react/src/modules/competitions/Competition_teams/Competitionteams.js b/public/react/src/modules/competitions/Competition_teams/Competitionteams.js index 34b1d97fc..46302b5ab 100644 --- a/public/react/src/modules/competitions/Competition_teams/Competitionteams.js +++ b/public/react/src/modules/competitions/Competition_teams/Competitionteams.js @@ -1,5 +1,5 @@ import React, { Component } from 'react'; -import { Breadcrumb,Layout,Table, Divider, Tag,Badge} from 'antd'; +import { Breadcrumb,Layout,Table, Divider, Tag,Badge,Tooltip} from 'antd'; import axios from 'axios'; @@ -156,13 +156,19 @@ class Competitionteams extends Component{ title: '被fork发布的学习人数', dataIndex: 'forked_myshixun_count', key: 'forked_myshixun_count', - render: (text, record) => <div className={record.creator==="合计:"?"teamsLayoucolor-orange":""}>{text}</div>, + render: (text, record) => + <Tooltip placement="bottom" title={"fork该实训产生的新实训,学习总人数"}> + <div className={record.creator==="合计:"?"teamsLayoucolor-orange":""}>{text}</div> + </Tooltip>, }, { title: '有效作品数', dataIndex: 'valid_count', key: 'valid_count', - render: (text, record) => <div className={record.creator==="合计:"?"teamsLayoucolor-orange":""}>{text}</div>, + render: (text, record) => + <Tooltip placement="bottom" title={"至少完成了1个关卡"}> + <div className={record.creator==="合计:"?"teamsLayoucolor-orange":""}>{text}</div> + </Tooltip>, }, { title: '应用值', @@ -195,13 +201,19 @@ class Competitionteams extends Component{ title: '被fork发布的学习人数', dataIndex: 'shixun_homework_count', key: 'shixun_homework_count', - render: (text, record) => <div className={record.creator==="合计:"?"teamsLayoucolor-orange":""}>{text}</div>, + render: (text, record) => + <Tooltip placement="bottom" title={"fork该实训产生的新实训,学习总人数"}> + <div className={record.creator==="合计:"?"teamsLayoucolor-orange":""}>{text}</div> + </Tooltip>, }, { title: '有效作品数', dataIndex: 'valid_count', key: 'valid_count', - render: (text, record) => <div className={record.creator==="合计:"?"teamsLayoucolor-orange":""}>{text}</div>, + render: (text, record) => + <Tooltip placement="bottom" title={"至少完成了1个关卡"}> + <div className={record.creator==="合计:"?"teamsLayoucolor-orange":""}>{text}</div> + </Tooltip>, }, { title: '应用值', From d01ba557043e7775f67c442206700a4e3f018434 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Thu, 24 Oct 2019 12:54:24 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/competitions/Competitimain/CompetitionsIndex.js | 6 +++--- .../competitions/Competitimain/Competitionsindex.css | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/public/react/src/modules/competitions/Competitimain/CompetitionsIndex.js b/public/react/src/modules/competitions/Competitimain/CompetitionsIndex.js index b0a9ff4c9..f84260496 100644 --- a/public/react/src/modules/competitions/Competitimain/CompetitionsIndex.js +++ b/public/react/src/modules/competitions/Competitimain/CompetitionsIndex.js @@ -183,14 +183,14 @@ class CompetitionsIndex extends Component{ } > <List.Item.Meta - title={<a className={item.competition_status==="ended"?"endedfont":item.competition_status==="nearly_published"? - this.props.current_user&&this.props.current_user.admin===true?"":this.props.current_user&&this.props.current_user.business===true?"":"endedfont":""}> + title={<div className={item.competition_status==="ended"?"endedfont":item.competition_status==="nearly_published"? + 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"} onClick={()=>this.setcompetitonurl(item.competition_status==="ended"?null: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.sub_title }</Tag>}</span> - </a>} + </div>} /> {item.description} </List.Item> diff --git a/public/react/src/modules/competitions/Competitimain/Competitionsindex.css b/public/react/src/modules/competitions/Competitimain/Competitionsindex.css index e6754d3e1..6ac46f1eb 100644 --- a/public/react/src/modules/competitions/Competitimain/Competitionsindex.css +++ b/public/react/src/modules/competitions/Competitimain/Competitionsindex.css @@ -133,4 +133,8 @@ } .CompetitionsList:hover .CompetitionsListzhezhao{ display: block; +} +.competitionstitlesshou:hover{ + cursor: pointer; + color: #1c91e8 !important; } \ No newline at end of file From 0bab45a6f5772940501f1ca44230082263a66252 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Thu, 24 Oct 2019 14:39:36 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Competitioncommon/CompetitionCommon.js | 66 +++++++++++++------ .../Competitioncommon/CompetitionContents.js | 2 +- 2 files changed, 48 insertions(+), 20 deletions(-) diff --git a/public/react/src/modules/competitions/Competitioncommon/CompetitionCommon.js b/public/react/src/modules/competitions/Competitioncommon/CompetitionCommon.js index f3177cece..96600534c 100644 --- a/public/react/src/modules/competitions/Competitioncommon/CompetitionCommon.js +++ b/public/react/src/modules/competitions/Competitioncommon/CompetitionCommon.js @@ -16,46 +16,69 @@ class CompetitionCommon extends Component{ super(props) this.state={ data:undefined, - bannerdata:undefined + bannerdata:undefined, + module_type:undefined } } componentDidMount(){ window.document.title = '竞赛'; - this.getbannerdata(); - let url=`/competitions/${this.props.match.params.identifier}.json`; + if(this.props.match.params.identifier!=null){ + this.getbannerdata(); + let url=`/competitions/${this.props.match.params.identifier}.json`; + axios.get(url).then((response) => { + if(response.status===200){ + this.setState({ + bannerdata:response.data + }) + } + }).catch((error) => { + console.log(error) + }) + } + + } + + getbannerdata=()=>{ + let url=`/competitions/${this.props.match.params.identifier}/common_header.json`; axios.get(url).then((response) => { if(response.status===200){ this.setState({ - bannerdata:response.data + data:response.data, }) + this.getrightdata( + response.data.competition_modules[0].id, + response.data.competition_modules[0].module_type, + response.data.competition_modules[0].module_url, + response.data.competition_modules[0].has_url + ) } }).catch((error) => { console.log(error) }) } - getbannerdata=()=>{ - let url=`/competitions/${this.props.match.params.identifier}/common_header.json`; + getrightdata=(id,typeid,module_url,has_url)=>{ + console.log(id,typeid,module_url,has_url) + this.setState({ + module_id:id, + module_type:typeid + }) + let url=`${module_url}.json`; axios.get(url).then((response) => { if(response.status===200){ - this.setState({ - data:response.data - }) + this.setState({ + mdContent:response.data + }) } }).catch((error) => { console.log(error) }) - - } - - getrightdata=(id,typeid)=>{ -debugger } render() { - let {data,bannerdata}=this.state; - // console.log(bannerdata) + let {data,bannerdata,module_type,module_id,mdContent}=this.state; + console.log(module_type) return ( data===undefined?"":<div className={"educontent clearfix mt20 "}> @@ -147,7 +170,7 @@ debugger {data&&data.competition_modules.map((item,key)=>{ return( <Menu.Item key={item.position}> - {item.has_url===false?<span onClick={()=>this.getrightdata(item.id,item.module_type)}>{item.name}</span>:<a + {item.has_url===false?<span onClick={()=>this.getrightdata(item.id,item.module_type,item.module_url,item.has_url)}>{item.name}</span>:<a // target="_blank" href={item.module_url} // onClick={()=>this.getrightdata(item.id,item.module_type)} @@ -160,8 +183,13 @@ debugger </Sider> <Layout className={"teamsLayoutleft"}> - <CompetitionContents/> - <CompetitionContentsChart/> + {this.state.module_type==="chart"?<CompetitionContentsChart + {...this.props} + {...this.state} + />:<CompetitionContents + {...this.props} + {...this.state} + />} </Layout> </Layout> diff --git a/public/react/src/modules/competitions/Competitioncommon/CompetitionContents.js b/public/react/src/modules/competitions/Competitioncommon/CompetitionContents.js index 5ba381b24..767e6b956 100644 --- a/public/react/src/modules/competitions/Competitioncommon/CompetitionContents.js +++ b/public/react/src/modules/competitions/Competitioncommon/CompetitionContents.js @@ -21,7 +21,7 @@ class CompetitionContents extends Component{ render() { - + let{mdContent}=this.props; return ( <div className={"fr"}>