diff --git a/public/react/src/modules/competitions/Competitimain/courses.jpg b/public/images/educoder/competitions/courses.jpg similarity index 100% rename from public/react/src/modules/competitions/Competitimain/courses.jpg rename to public/images/educoder/competitions/courses.jpg diff --git a/public/react/src/modules/competitions/Competitimain/groups1.png b/public/images/educoder/competitions/groups1.png similarity index 100% rename from public/react/src/modules/competitions/Competitimain/groups1.png rename to public/images/educoder/competitions/groups1.png diff --git a/public/react/src/modules/competitions/Competitimain/groups2.png b/public/images/educoder/competitions/groups2.png similarity index 100% rename from public/react/src/modules/competitions/Competitimain/groups2.png rename to public/images/educoder/competitions/groups2.png diff --git a/public/react/src/modules/competitions/Competitimain/groups3.png b/public/images/educoder/competitions/groups3.png similarity index 100% rename from public/react/src/modules/competitions/Competitimain/groups3.png rename to public/images/educoder/competitions/groups3.png diff --git a/public/react/src/App.js b/public/react/src/App.js index 43dc585d4..5988d3532 100644 --- a/public/react/src/App.js +++ b/public/react/src/App.js @@ -285,16 +285,12 @@ const Ecs = Loadable({ loading: Loading, }) -//团队竞赛报名 -const Registration = Loadable({ - loader: () => import('./modules/competition/Registration'), - loading: Loading, -}); -//个人竞赛报名 -const PersonalCompetit = Loadable({ - loader: () => import('./modules/competition/personal/PersonalCompetit.js'), - loading: Loading, -}); + +// //个人竞赛报名 +// const PersonalCompetit = Loadable({ +// loader: () => import('./modules/competition/personal/PersonalCompetit.js'), +// loading: Loading, +// }); class App extends Component { constructor(props) { super(props) @@ -490,7 +486,14 @@ class App extends Component { {/*/!*众包创新*!/*/} {/**/} {/*竞赛*/} - + { + + return () + } + }> + {/*认证*/} @@ -541,12 +544,12 @@ class App extends Component { return () } }> - () - } - /> + {/* ()*/} + {/*}*/} + {/*/>*/} */} {/**/} {/**/} - () - } - /> + {/* ()*/} + {/*}*/} + {/*/>*/} { if (prevProps.GetenrollmentAPI != this.props.GetenrollmentAPI) { - // console.log("团队竞赛报名大图componentDidUpdate"); - // console.log(this.props); - // console.log(this.props.GetenrollmentAPI); + // ////console.log("团队竞赛报名大图componentDidUpdate"); + // ////console.log(this.props); + // ////console.log(this.props.GetenrollmentAPI); this.setState({ GetenrollmentAPI: this.props.GetenrollmentAPI, }) @@ -29,6 +29,13 @@ class CompetitionMaxImg extends React.Component { let {type, pint} = this.props; return (
+ { type === 1 || type === 2 ?
@@ -83,8 +90,8 @@ class CompetitionMaxImg extends React.Component {
{ pint === 1 ? -
-

立即报名

+
this.props.Personalregistration()}> +

this.props.Personalregistration()}>立即报名

: pint === 2 ?
@@ -99,7 +106,8 @@ class CompetitionMaxImg extends React.Component {
: - "" +
+
} diff --git a/public/react/src/modules/competition/RegisListview.js b/public/react/src/modules/competition/RegisListview.js index c2d725661..73f94592c 100644 --- a/public/react/src/modules/competition/RegisListview.js +++ b/public/react/src/modules/competition/RegisListview.js @@ -30,15 +30,15 @@ class RegisListview extends React.Component { backgroundPosition: "center", backgroundSize: "110% 100%", }}> -

创建者

-

战队名称

-

战队成员

-

学校

-

时间

diff --git a/public/react/src/modules/competition/RegisListviewdata.js b/public/react/src/modules/competition/RegisListviewdata.js index 8e381568e..3bd8fe0b2 100644 --- a/public/react/src/modules/competition/RegisListviewdata.js +++ b/public/react/src/modules/competition/RegisListviewdata.js @@ -6,95 +6,134 @@ import { } from 'react-router-dom'; import axios from 'axios'; import moment from 'moment'; -import {SnackbarHOC, WordsBtn} from 'educoder'; +import {SnackbarHOC, WordsBtn, getImageUrl} from 'educoder'; import {TPMIndexHOC} from '../tpm/TPMIndexHOC'; import competition from './comcss/competition.css'; +import pexjiazai from './pexjiazai.png' import {Button} from 'antd'; // 团队竞赛报名无报名子组件团队 竞赛报名-已创建战队 class RegisListviewdata extends React.Component { constructor(props) { super(props) - + this.state = { + item: undefined + } } + componentDidMount() { + ////console.log("RegisListviewdata"); + ////console.log(this.props.item) + this.setState({ + item: this.props.item + }) + } render() { + const {item} = this.props; return ( -
-
-
- -
-

小猫头像

-
-
-

重庆邮电大学

-
-
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
-
-

重庆邮电大学

-
-
-

2019-09-07 08:33

-
- - +
+ { + item !== undefined ? +
+
+ +
+ + + +

{item.creator.name}

+
+
+

{item.name}

+
+
+ + { + item && item.team_members.map((item, index) => { + return ( + + index === 0 ? + + + + : index === 1 ? + + + + : index === 2 ? + + + + : index === 3 ? + + + + : index === 4 ? + + + + : index === 5 ? +
+ + + + + + +
+ : "" + + ) + }) + } +
+
+

{item.school_name}

+
+
+

{item.created_at}

+
+
+
+ : "" + }
diff --git a/public/react/src/modules/competition/Registration.js b/public/react/src/modules/competition/Registration.js index 60512a893..38a270843 100644 --- a/public/react/src/modules/competition/Registration.js +++ b/public/react/src/modules/competition/Registration.js @@ -9,7 +9,7 @@ import moment from 'moment'; import {SnackbarHOC, WordsBtn} from 'educoder'; import {TPMIndexHOC} from '../tpm/TPMIndexHOC'; import competition from './comcss/competition.css'; -import {Button, Pagination, message} from 'antd'; +import {Button, Pagination, message, Spin, Breadcrumb} from 'antd'; import Registrationitem from './Registrationitem'; import RegisNodata from './RegisNodata'; import CompetitionMaxImg from './CompetitionMaxImg'; @@ -19,7 +19,10 @@ import RegisListviewdata from './RegisListviewdata'; import PersonModal from './competmodal/PersonModal'; import MessagePersonModal from './competmodal/MessagePersonModal'; import PersonalModalteam from './competmodal/PersonalModalteam'; -import PersonalCompetititem from './personal/PersonalCompetititem' +import PersonalCompetititem from './personal/PersonalCompetititem'; +import ExittheteamModel from './competmodal/ExittheteamModel'; +import pexjiazai from "./pexjiazai.png"; + // 团队竞赛报名无报名 class Registration extends React.Component { /*** @@ -28,15 +31,15 @@ class Registration extends React.Component { *"enrolled: false, // 是否已经报名 *"teacher_staff": { // 为空表示不支持老师报名 *"member_staff": { // 为空表示不支持学生报名 + * personal// 是否是个人赛 * **/ constructor(props) { super(props) this.state = { - test: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], loadingstate: false, pages: 1, limit: 20, - type: 1, + type: 7, tmodalsType: false, tmodalsTypes: false, Newtit: true, @@ -44,6 +47,7 @@ class Registration extends React.Component { page: 1, per_page: 20, data: [], + competition_teams: [], count: 0, GetenrollmentAPI: undefined, personal: false, @@ -53,29 +57,58 @@ class Registration extends React.Component { member_staff: null, messagePer: "提示", messagePerbool: false, - intpermessages: "确认" + intpermessages: "确认", + messageexit: "提示", + messageexitol: false, + exitintpermessages: "是否确认退出战队?", + itemid: undefined, + itemiddata: [], + pint: 0, + } } componentDidMount() { - //console.log("componentDidMount Registration"); - // ////console.log("调用子组件 "); - //console.log(this.props.isAdmin()); - // ////console.log(this.props.isAdmin()) - const {keyword, page, per_page} = this.state; - this.Getdata(keyword, page, per_page); - this.GetenrollmentAPI(); + console.log(this.props); + + // //////console.log("componentDidMount Registration"); + // //// //////console.log("调用子组件 "); + // //////console.log(this.props.isAdmin()); + // //// //////console.log(this.props.isAdmin()) + try { + const {keyword, page, per_page} = this.state; + this.Getdata(keyword, page, per_page, this.props.user.admin); + this.GetenrollmentAPI(); + } catch (e) { + // const {keyword, page, per_page} = this.state; + // this.Getdata(keyword, page, per_page, this.props.isAdmin()); + // this.GetenrollmentAPI(); + } + } + + componentDidUpdate = (prevProps) => { + if (prevProps.user != this.props.user) { + console.log("componentDidUpdate"); + console.log(this.props); + ////console.log("Registration"); + ////console.log("componentDidUpdate"); + ////console.log(this.props.user.admin); + const {keyword, page, per_page} = this.state; + this.Getdata(keyword, page, per_page, this.props.user.admin); + this.GetenrollmentAPI(); + } + } //获取报名配置API GetenrollmentAPI = () => { - const url = `/competitions/${"gcc-course-2019"}/competition_staff.json`; + const url = `/competitions/${this.props.match.params.identifier}/competition_staff.json`; axios.get((url)).then((result) => { if (result) { if (result.data) { - ////console.log("获取报名配置API"); - ////console.log(result); + //// //////console.log("获取报名配置API"); + //// //////console.log(result); this.setState({ GetenrollmentAPI: result.data, personal: result.data.personal, @@ -84,14 +117,27 @@ class Registration extends React.Component { teacher_staff: result.data.teacher_staff, member_staff: result.data.member_staff, }) + if (result.data.enroll_ended === true) { + this.setState({ + pint: 0 + }) + } else if (result.data.enrolled === true) { + this.setState({ + pint: 2 + }) + } else if (result.data.enrolled === false) { + this.setState({ + pint: 1 + }) + } } } }).catch((error) => { - ////console.log(error); + //// //////console.log(error); }) } - Getdata = (keyword, page, per_page) => { + Getdata = (keyword, page, per_page, admin) => { //搜索关键字 keyword //页数 page //分页 per_page @@ -100,66 +146,234 @@ class Registration extends React.Component { page: page, per_page: per_page, }; - let url = `/competitions/${"gcc-course-2019"}/competition_teams.json`; + let url = `/competitions/${this.props.match.params.identifier}/competition_teams.json`; axios.get((url), {params: datas}).then((result) => { if (result) { if (result.data) { - ////console.log(result); - if (result.data.count === 0) { - // 没有创建数据的 - if (this.props.isAdmin() === true) { - //管理员 - this.setState({ - type: 4, - count: result.data.count, - }) + //// //////console.log(result);\ + if (result.data.personal === false) { + //不是个人赛 + if (result.data.my_teams.length === 0) { + // 没有创建数据的 + if (admin === true) { + //管理员 + this.setState({ + type: 4, + count: result.data.count, + data: result.data.my_teams, + competition_teams: result.data.competition_teams, + personal: result.data.personal, + }) + } else { + //普通账号 + this.setState({ + type: 1, + count: result.data.count, + data: result.data.my_teams, + competition_teams: result.data.competition_teams, + personal: result.data.personal, + }) + } } else { - //普通人 - this.setState({ - type: 1, - count: result.data.count, - }) + //有数据的 + + if (admin === true) { + if (result.data.my_teams[0].manage_permission === true) { + this.setState({ + type: 5, + data: result.data.my_teams, + count: result.data.count, + competition_teams: result.data.competition_teams, + personal: result.data.personal, + + }) + } else { + this.setState({ + type: 4, + data: result.data.my_teams, + count: result.data.count, + competition_teams: result.data.competition_teams, + personal: result.data.personal, + + }) + } + } else { + if (result.data.my_teams[0].manage_permission === true) { + //普通账号true 为创建了竞赛 + this.setState({ + type: 2, + data: result.data.my_teams, + count: result.data.count, + personal: result.data.personal, + + }) + } else { + //普通账号true 加入了竞赛 + this.setState({ + type: 3, + data: result.data.my_teams, + count: result.data.count, + personal: result.data.personal, + + }) + } + } + } + } else { + this.setState({ + type: 6, + data: result.data.my_teams, + count: result.data.count, + competition_teams: result.data.competition_teams, + personal: result.data.personal, + + }) + + } + } + } + this.setState({ + loadingstate: false, + }) + }).catch((error) => { + if (admin === true) { + //管理员 + this.setState({ + type: 4, + count: 0, + competition_teams: [], + data: [], + loadingstate: false, + }) + } else { + //普通账号 + this.setState({ + type: 1, + count: 0, + competition_teams: [], + data: [], + loadingstate: false, + }) + } + }) + + } + + Getdatatype5 = (keyword, page, per_page, admin) => { + //搜索关键字 keyword + //页数 page + //分页 per_page + const datas = { + keyword: keyword, + page: page, + per_page: per_page, + }; + let url = `/competitions/${this.props.match.params.identifier}/competition_teams.json`; + axios.get((url), {params: datas}).then((result) => { + this.setState({ + loadingstate: false, + }) + if (result) { + if (result.data) { + //// //////console.log(result); + if (result.data.personal === false) { + //不是个人赛 + ////console.log("Getdatatype5"); + ////console.log(result.data.my_teams.length); + if (result.data.my_teams.length === 0) { + // 没有创建数据的 + //管理员 + ////console.log("a"); + ////console.log(this.state.competition_teams); + ////console.log(result.data.competition_teams); + this.setState({ + type: 4, + count: result.data.count, + competition_teams: result.data.competition_teams, + data: result.data.my_teams, + personal: result.data.personal, + + }) } else { //有数据的 - if (this.props.isAdmin() === true) { + ////console.log("b"); + + if (result.data.my_teams[0].manage_permission === true) { this.setState({ type: 5, - data: result.data.competition_teams, + data: result.data.my_teams, count: result.data.count, + competition_teams: result.data.competition_teams, + personal: result.data.personal, + + }) } else { - if (result.data.competition_teams[0].manage_permission === true) { - //学生true 为创建了竞赛 - this.setState({ - type: 2, - data: result.data.competition_teams, - count: result.data.count, - }) - } else { - //学生true 加入了竞赛 + ////console.log("c"); + this.setState({ - type: 3, - data: result.data.competition_teams, - count: result.data.count, - }) - } + type: 4, + data: result.data.my_teams, + count: result.data.count, + competition_teams: result.data.competition_teams, + personal: result.data.personal, + + }) } + } + } else { + //团队赛 + //////console.log("d"); + this.setState({ + type: 6, + data: result.data.my_teams, + count: result.data.count, + competition_teams: result.data.competition_teams, + personal: result.data.personal, + + }) } } - } + }).catch((error) => { + ////console.log("k"); + ////console.log(error); + ////console.log("报错了"); + if (admin === true) { + //管理员 + this.setState({ + count: 0, + competition_teams: [], + data: [], + loadingstate: false, + }) + } else { + //普通账号 + this.setState({ + count: 0, + competition_teams: [], + data: [], + loadingstate: false, + }) + } }) } + + + //团队竞赛翻页 paginationonChangestwo = (pageNumber) => { this.setState({ pages: pageNumber, loadingstate: true, }) + const {keyword, per_page} = this.state; + this.Getdatatype5(keyword, pageNumber, per_page, this.props.user.admin); + }; /** * 加入战队 @@ -181,7 +395,7 @@ class Registration extends React.Component { }) return } - if (this.props.isAdmin() === true) { + if (this.props.user.admin === true) { //老师 if (this.state.teacher_staff === null) { //禁止老师 @@ -235,7 +449,7 @@ class Registration extends React.Component { }) return } - if (this.props.isAdmin() === true) { + if (this.props.user.admin === true) { //老师 if (this.state.teacher_staff === null) { //禁止老师 @@ -246,7 +460,8 @@ class Registration extends React.Component { return; } this.setState({ - tmodalsType: true + tmodalsType: true, + Newtit: true, }) } else { //学生 @@ -259,16 +474,20 @@ class Registration extends React.Component { return; } this.setState({ - tmodalsType: true + tmodalsType: true, + Newtit: true, }) } - - // this.setState({ - // tmodalsType: true - // }) } - + //编辑战队 + Createateamedit = (data) => { + this.setState({ + tmodalsType: true, + Newtit: false, + itemiddata: data + }) + } Tmoconfirm = (bool) => { //boolfalse 取消 true 确认 this.setState({ @@ -285,7 +504,7 @@ class Registration extends React.Component { } } - + //创建战队确认 Tmoconfirm1 = (bool) => { //boolfalse 取消 true 确认 this.setState({ @@ -293,8 +512,7 @@ class Registration extends React.Component { }) if (bool) { //确认 - - + this.Refreshteam(); } else { //取消 @@ -308,12 +526,136 @@ class Registration extends React.Component { messagePerbool: false }) } + //显示退出战队弹框 + Exittheteamshow = (itemid, bool) => { + if (bool === true) { + this.setState({ + messageexitol: true, + itemid: itemid, + exitintpermessages: "是否确认删除战队", + }) + } else { + this.setState({ + messageexitol: true, + itemid: itemid, + exitintpermessages: "是否确认退出战队", + }) + } + + + }; + //刷新战队 + Refreshteam = () => { + + const {keyword, page, per_page} = this.state; + this.Getdata(keyword, page, per_page, this.props.user.admin); + this.GetenrollmentAPI(); + } + //退出战队 + Exittheteam = (bool) => { + // //////console.log(this.state.itemid); + if (bool) { + this.setState({ + messageexitol: true + }) + + let url = `/competitions/${"gcc-task-2020"}/competition_teams/${this.state.itemid}/leave.json`; + axios.post(url).then((response) => { + if (response) { + if (response.data) { + //////console.log("退出战队"); + //////console.log(response); + this.Refreshteam(); + this.setState({ + messageexitol: false + }) + + } + } + }).catch((error) => { + //////console.log(error) + }); + + } else { + this.setState({ + messageexitol: false + }) + } + } + //搜索战队 + RegistrationSearchvalue = (value) => { + ////console.log("RegistrationSearchvalue"); + ////console.log(this.props.user.admin); + this.setState({ + pages: 1, + limit: 20, + }) + this.Getdatatype5(value, 1, 20, this.props.user.admin); + } + + //个人竞赛 +// /competitions/:identifier/competition_teams.json + Personalregistration = () => { + let {teacher_staff, member_staff, data, enroll_ended} = this.state; + if (enroll_ended === true) { + //已截止 + this.props.showNotification(`报名已截止`); + + return; + } + if (teacher_staff) { + if (teacher_staff.mutiple_limited) { + if (teacher_staff.mutiple_limited === true) { + if (data) { + if (data.length > teacher_staff.maximum) { + this.props.showNotification(`你已经报名,不能重复报名!`); + return + } + } + } + } + + + } + if (member_staff) { + if (member_staff.mutiple_limited) { + if (member_staff.mutiple_limited === true) { + if (data) { + if (data.length > member_staff.maximum) { + this.props.showNotification(`你已经报名,不能重复报名!`); + + return; + } + } + } + } + } + const url = `/competitions/${this.props.match.params.identifier}/competition_teams.json`; + axios.post(url).then((response) => { + if (response) { + if (response.data) { + this.props.showNotification(`报名成功,预祝您夺得桂冠!`); + this.Refreshteam(); + + } + } + }).catch((error) => { + + }); + } render() { - const {test, page, pages, limit, type, tmodalsType, tmodalsTypes, data} = this.state; - const listItems = test.map((item, index) => - - ); + const {page, pages, limit, type, tmodalsType, tmodalsTypes, data, count, competition_teams, Newtit, itemiddata, messagePerbool, messageexitol, GetenrollmentAPI, loadingstate, pint} = this.state; + // var listItems = ""; + + // if (competition_teams) { + // listItems = competition_teams.map((item, index) => + // + // ); + // } + // const listItemss = test.map((item, index) => + // + // ); return (
@@ -329,43 +671,112 @@ class Registration extends React.Component { ` } - this.messagePerboolbuton()}> - this.Tmoconfirm1(bool)}> - this.Tmoconfirm(bool)}> -
-

- 在线竞赛 - > - 全国高校计算机大赛-项目挑战 - > - 报名 -

+ { + messagePerbool === true ? + this.messagePerboolbuton()} + GetenrollmentAPI={GetenrollmentAPI}> + : "" + } + {/*编辑创建战队*/} + { + tmodalsType === true ? + this.Tmoconfirm1(bool)}> + : + "" + } + { + tmodalsTypes === true ? + this.Tmoconfirm(bool)}> + : "" + } + { + messageexitol === true ? + this.Exittheteam(bool)}> + : "" + } + + {/*
*/} + {/*

*/} + {/* 在线竞赛*/} + {/* >*/} + {/* 全国高校计算机大赛-项目挑战*/} + {/* >*/} + {/* 报名*/} + {/*

*/} + {/*
*/} +
+ + 在线竞赛 + 全国高校计算机大赛 + 报名 +
{/*大图*/} this.Jointheteam()} + pint={pint} {...this.props} {...this.state} - Createateam={() => this.Createateam()}> + Createateam={() => this.Createateam()} + Personalregistration={() => this.Personalregistration()} + > {/*大图结尾*/} {/*没数据*/} + { + pint === 1 || pint === 3 ? +
+

参赛总人数:{data === null || data === undefined ? 0 : data.length} +

+
+ : ""} + {/*列表*/} + { + type === 6 ? +
+ + { + data && data.map((item, index) => { + return ( + + ) + }) + } + + + +
+ : ""} { type === 1 ? : "" } + {/*普通账号出现单人 战队弹框*/} { type === 2 || type === 3 || type === 5 ? - + this.Exittheteamshow(itemid)} + Createateamedit={(itemid) => this.Createateamedit(itemid)}> : "" } { type === 4 || type === 5 ? - + this.RegistrationSearchvalue(value)}> : "" } {/**/} @@ -378,19 +789,38 @@ class Registration extends React.Component { {type === 4 || type === 5 ? - listItems + + { + competition_teams && competition_teams.map((item, index) => { + return ( + + ) + }) + } + + : "" } { type === 4 || type === 5 ? -
- -
- : "" + ( + count < 20 ?
: +
+ +
+ ) + + :
}
@@ -401,4 +831,4 @@ class Registration extends React.Component { } -export default SnackbarHOC()(TPMIndexHOC(Registration)); +export default Registration; diff --git a/public/react/src/modules/competition/RegistrationSearch.js b/public/react/src/modules/competition/RegistrationSearch.js index ed7e326ba..122366e0d 100644 --- a/public/react/src/modules/competition/RegistrationSearch.js +++ b/public/react/src/modules/competition/RegistrationSearch.js @@ -24,15 +24,22 @@ class RegistrationSearch extends React.Component { this.setState({ keywords: e.target.value }) + }; setdatafuns = (value) => { - console.log("点击了搜索"); + //console.log("setdatafuns点击了搜索"); + //console.log(value); this.setState({ keywords: value }) - + this.props.RegistrationSearchvalue(value); }; + myonPressEnter = (e) => { + //console.log("点击了回车setdatafunsval点击了搜索"); + //console.log(e.target.value); + this.props.RegistrationSearchvalue(e.target.value); + } render() { return (
@@ -42,10 +49,21 @@ class RegistrationSearch extends React.Component { value={this.state.keywords} enterButton={搜索} onInput={(e) => this.setdatafunsval(e)} - onSearch={(value) => this.setdatafuns(value)}/> + onSearch={(value) => this.setdatafuns(value)} + onPressEnter={(e) => this.myonPressEnter(e)} + /> -

战队总数:271

+

战队总数:{this.props.count}

) } diff --git a/public/react/src/modules/competition/Registrationitem.js b/public/react/src/modules/competition/Registrationitem.js index 6bcd18534..d252dc30d 100644 --- a/public/react/src/modules/competition/Registrationitem.js +++ b/public/react/src/modules/competition/Registrationitem.js @@ -6,7 +6,7 @@ import { } from 'react-router-dom'; import axios from 'axios'; import moment from 'moment'; -import {SnackbarHOC, WordsBtn} from 'educoder'; +import {SnackbarHOC, WordsBtn, getImageUrl} from 'educoder'; import {TPMIndexHOC} from '../tpm/TPMIndexHOC'; import competition from './comcss/competition.css'; import {Button} from 'antd'; @@ -22,14 +22,16 @@ class Registrationitem extends React.Component { render() { - + let {item} = this.props; return ( - +
+ { + item !== undefined ?
-
+ -
+
小猫头像

+ }}>{item.creator.name}

+ { + item.manage_permission === true ? +

已报名

+ : + "" + } -

已报名

2019-09-07 08:33

+ }}>{item.created_at}

- - + : "" + } +
) } diff --git a/public/react/src/modules/competition/comcss/competition.css b/public/react/src/modules/competition/comcss/competition.css index 40e732139..102f2492d 100644 --- a/public/react/src/modules/competition/comcss/competition.css +++ b/public/react/src/modules/competition/comcss/competition.css @@ -8,16 +8,17 @@ } /*All*/ /*Registration.js*/ -.registrationback { - height: 368px; - width: 1200px; - border: 0.5px solid; - display: flex; - display: -webkit-flex; - flex-direction: column; - align-items: center; - background: #0dcecb; -} +/*.registrationback {*/ +/* height: 368px;*/ +/* width: 1200px;*/ +/* border: 0.5px solid;*/ +/* display: flex;*/ +/* display: -webkit-flex;*/ +/* flex-direction: column;*/ +/* align-items: center;*/ +/* background:url(../../../../../images/regis/tipregistit.jpg)*/ + +/*}*/ .registrationbackcenter { display: flex; @@ -26,14 +27,14 @@ align-items: center; } -.registrationback1 { - height: 368px; - width: 1200px; - border: 0.5px solid; - display: flex; - flex-direction: column; - background: #0dcecb; -} +/*.registrationback1 {*/ +/* height: 368px;*/ +/* width: 1200px;*/ +/* border: 0.5px solid;*/ +/* display: flex;*/ +/* flex-direction: column;*/ +/* background:url(../../../../../images/regis/tipregistit.jpg)*/ +/*}*/ .registrationbackp1 { color: #ffffff; @@ -301,14 +302,42 @@ .regitem { display: flex; flex-direction: initial; - border-bottom: 1px solid #EDEDED; margin-top: 44px; } -.regitem2 { +.regitem22 { display: flex; flex-direction: initial; + margin-top: 27px; + margin-bottom: 19px; +} + +.yslborderbottom { border-bottom: 1px solid #EDEDED; +} + +.registrationback { + height: 368px; + width: 1200px; + display: flex; + display: -webkit-flex; + flex-direction: column; + align-items: center; + background-image: url(./tipregistit.jpg); +} + +.registrationback1 { + height: 368px; + width: 1200px; + display: flex; + flex-direction: column; + background-image: url(./tipregistit.jpg); +} + +.regitem2 { + display: flex; + flex-direction: initial; + padding-bottom: 18px; margin-top: 19px; } @@ -328,18 +357,21 @@ align-items: center; justify-content: center; margin-left: 26px; - padding-bottom: 18px; + } .regitemimg2 { height: 78px; width: 78px; + background-color: transparent; + margin-bottom: 9px; + border-radius: 50%; } .personregitemimg { - border: 0.5px solid; height: 64px; width: 64px; + border-radius: 50%; } @@ -353,6 +385,8 @@ width: 69px; height: 69px; margin-top: 3px; + background-color: transparent; + border-radius: 50%; } @@ -360,7 +394,9 @@ margin-top: 16px; width: 49px; height: 51px; - margin-left: 25px + margin-left: 25px; + border-radius: 50%; + } .regitemimgs22 { @@ -368,6 +404,8 @@ width: 28px; height: 28px; margin-left: 20px; + border-radius: 50%; + } .regitemimgs3 { @@ -375,7 +413,7 @@ height: 22px; width: 22px; font-size: 21px !important; - margin-top: 22px; + margin-top: 21px; color: #1C91E8; } diff --git a/public/react/src/modules/competition/comcss/tipregistit.jpg b/public/react/src/modules/competition/comcss/tipregistit.jpg new file mode 100644 index 000000000..8aae50232 Binary files /dev/null and b/public/react/src/modules/competition/comcss/tipregistit.jpg differ diff --git a/public/react/src/modules/competition/competmodal/ExittheteamModel.js b/public/react/src/modules/competition/competmodal/ExittheteamModel.js new file mode 100644 index 000000000..29eab7b50 --- /dev/null +++ b/public/react/src/modules/competition/competmodal/ExittheteamModel.js @@ -0,0 +1,59 @@ +import React, {Component} from 'react'; +import {getImageUrl} from 'educoder'; +import {Modal, Input, Spin, Tooltip, Icon, Dropdown, Button} from 'antd'; +import axios from 'axios'; +import competition from '../comcss/competition.css'; +import Registrationitem from "../Registrationitem"; +import InfiniteScroll from 'react-infinite-scroller'; +// import PersonModaltion from "./PersonModaltion"; +const {Search} = Input; + +//退出战队 +class ExittheteamModel extends React.Component { + + constructor(props) { + super(props); + this.state = {} + } + + + render() { + const { + addonAfter, test, test3, Numberofteammentors, Thecurrentnumber, person1, person2 + } = this.state; + //Modal + //keyboard是否支持键盘 esc 关闭 + //closable 是否显示右上角的关闭按钮 + //底部内容,当不需要默认底部按钮时,可以设为 footer={null} + //destroyOnClose 关闭时销毁 Modal 里的子元素 + //centered 垂直居中展示 Modal + //visible 弹出框是否显示 + + return ( + + + +
+
{this.props.exitintpermessages}
+
+ + +
+ ) + } +} + +export default ExittheteamModel; diff --git a/public/react/src/modules/competition/competmodal/PersonModal.js b/public/react/src/modules/competition/competmodal/PersonModal.js index 0b4e988a0..ffa924900 100644 --- a/public/react/src/modules/competition/competmodal/PersonModal.js +++ b/public/react/src/modules/competition/competmodal/PersonModal.js @@ -56,14 +56,64 @@ class PersonModal extends Component { } } componentDidMount() { + var data = []; + var polls_nametests = ""; + var datas = { + enrollable: false, + id: this.props.user.user_id, + name: this.props.user.real_name, + school_name: this.props.user.user_school, + student_id: null, + identity: this.props.user.user_identity, + type: "创建者", + }; + data.push(datas); + + console.log("itemiddata"); + console.log("编辑战队") + console.log(this.props.itemiddata); + try { + if (this.props.Newtit === false) { + for (var i = 0; i < this.props.itemiddata.team_members.length; i++) { + if (i === 0) { + ///因为第一个位置是创建者 所以要过滤掉 + } else { + var datasy = { + enrollable: false, + id: this.props.itemiddata.team_members[i].user_id, + name: this.props.itemiddata.team_members[i].name, + school_name: this.props.itemiddata.team_members[i].school_name, + student_id: null, + identity: this.props.itemiddata.team_members[i].identity, + type: this.props.itemiddata.team_members[i].role === "teacher" ? "导师" : "队员", + }; + data.push(datasy); + } + } + if (this.props.itemiddata) { + polls_nametests = this.props.itemiddata.name; + } + } + } catch (e) { + + } + + this.setState({ + myuser: this.props.user, + mydatas: data, + polls_nametest: polls_nametests + }) + this.setState({ + GetenrollmentAPI: this.props.GetenrollmentAPI, + }) } componentDidUpdate = (prevProps) => { if (prevProps.user != this.props.user) { - console.log("Registration.js componentDidUpdate"); - console.log(this.props); - //console.log(prevProps); + ////console.log("Registration.js componentDidUpdate"); + ////console.log(this.props); + // ////console.log(prevProps); //identity职场称 //user_school学校 //real_name姓名 @@ -86,8 +136,8 @@ class PersonModal extends Component { } if (prevProps.GetenrollmentAPI != this.props.GetenrollmentAPI) { - console.log("Registration.js GetenrollmentAPIcomponentDidUpdate"); - console.log(this.props); + ////console.log("Registration.js GetenrollmentAPIcomponentDidUpdate"); + ////console.log(this.props); this.setState({ GetenrollmentAPI: this.props.GetenrollmentAPI, }) @@ -95,6 +145,8 @@ class PersonModal extends Component { }; //创建战队 Createateam = () => { + + const {polls_nametest, mydatas, GetenrollmentAPI} = this.state; var myteaherdata = []; var myshtudentdata = []; @@ -102,85 +154,93 @@ class PersonModal extends Component { for (var a = 0; a < mydatas.length; a++) { if (mydatas[a].type === "导师") { i++; - var objectt = { - enrollable: mydatas[a].enrollable, - id: mydatas[a].id, - identity: mydatas[a].identity, - name: mydatas[a].name, - school_name: mydatas[a].school_name, - } - myteaherdata.push(objectt); + // var objectt = { + // enrollable: mydatas[a].enrollable, + // id: mydatas[a].id, + // identity: mydatas[a].identity, + // name: mydatas[a].name, + // school_name: mydatas[a].school_name, + // } + myteaherdata.push(mydatas[a].id); } else if (mydatas[a].type === "队员") { - var objectts = { - enrollable: mydatas[a].enrollable, - id: mydatas[a].id, - name: mydatas[a].name, - school_name: mydatas[a].school_name, - student_id: mydatas[a].student_id, - } - myshtudentdata.push(objectts); + // var objectts = { + // enrollable: mydatas[a].enrollable, + // id: mydatas[a].id, + // name: mydatas[a].name, + // school_name: mydatas[a].school_name, + // student_id: mydatas[a].student_id, + // } + myshtudentdata.push(mydatas[a].id); } } - if (GetenrollmentAPI !== undefined || GetenrollmentAPI !== null) { - if (GetenrollmentAPI.teacher_staff !== undefined || GetenrollmentAPI.teacher_staff !== null) { - if (GetenrollmentAPI.teacher_staff.minimum > i) { - this.setState({ - Thecurrentnumberbool: true, - Thecurrentnumber: i, - booltech: false, - boolstud: false - }) - return - } else if (GetenrollmentAPI.teacher_staff.maximum < i) { - this.setState({ - Thecurrentnumberbool: true, - Thecurrentnumber: i, - booltech: false, - boolstud: false - }) - return - } - } - } - // Thecurrentnumber - let url = `/competitions/${"gcc-course-2019"}/competition_teams.json`; - axios.post(url, { - name: polls_nametest, - teacher_ids: myteaherdata, - member_ids: myshtudentdata, - }).then((result) => { - //console.log("获取到创建战队的数据"); - //console.log(result); - if (result) { - if (result.data) { - this.props.Tmoconfirm1(true); + try { + if (GetenrollmentAPI) { + if (GetenrollmentAPI.teacher_staff) { + if (GetenrollmentAPI.teacher_staff.minimum > i) { + this.setState({ + Thecurrentnumberbool: true, + Thecurrentnumber: i, + booltech: false, + boolstud: false + }) + return + } else if (GetenrollmentAPI.teacher_staff.maximum < i) { + this.setState({ + Thecurrentnumberbool: true, + Thecurrentnumber: i, + booltech: false, + boolstud: false + }) + return + } + } } - }).catch((error) => { - //console.log(error) - }); - - } - creident = (name, teacher_ids, member_ids) => { - let collaborators = `/competitions/${"gcc-course-2019"}/competition_teams.json`; - axios.post(collaborators, { - name: name, - teacher_ids: teacher_ids, - member_ids: member_ids, - }).then((result) => { - if (result) { - if (result.data) { + } catch (e) { + } + // Thecurrentnumber + if (this.props.Newtit === true) { + //创建新的战队 + let url = `/competitions/${this.props.match.params.identifier}/competition_teams.json`; + axios.post(url, { + name: polls_nametest, + teacher_ids: myteaherdata, + member_ids: myshtudentdata, + }).then((result) => { + // ////console.log("获取到创建战队的数据"); + // ////console.log(result); + if (result) { + if (result.data) { + this.props.Tmoconfirm1(true); + } } - } - }).catch((error) => { - //console.log(error) - }); + }).catch((error) => { + // ////console.log(error) + }); + } else { + //编辑战队 + let url = `/competitions/${this.props.match.params.identifier}/competition_teams/${this.props.itemiddata.id}.json`; + axios.put(url, { + name: polls_nametest, + teacher_ids: myteaherdata, + member_ids: myshtudentdata, + }).then((result) => { + // ////console.log("获取到编辑战队的数据"); + // ////console.log(result); + if (result) { + if (result.data) { + this.props.Tmoconfirm1(true); + } + } + }).catch((error) => { + // ////console.log(error) + }); + } } - Getteacherdata = (keywordteachers, team_idteachers, teacher_ids) => { this.setState({ person1: true, @@ -189,24 +249,24 @@ class PersonModal extends Component { //老师姓名 keyword //当前战队ID team_id //当前老师ID数组 teacher_ids - //console.log("搜索的老师"); + // ////console.log("搜索的老师"); const datas = { keyword: keywordteachers, team_id: team_idteachers, teacher_ids: teacher_ids, }; - let url = `/competitions/${"gcc-course-2019"}/teachers.json`; + let url = `/competitions/${this.props.match.params.identifier}/teachers.json`; axios.get((url), {params: datas}).then((result) => { if (result) { if (result.data) { - //console.log(result); + // ////console.log(result); this.setState({ teacher_ids: result.data.teachers }) } } }).catch((error) => { - //console.log(error); + // ////console.log(error); }) }; Getstudentsdata = (keywordstudents, team_idstudents, student_ids) => { @@ -217,17 +277,17 @@ class PersonModal extends Component { //学生姓名 keyword //当前战队ID team_id //当前队员ID数组 student_ids - //console.log("搜索的学生"); + // ////console.log("搜索的学生"); const datas = { keyword: keywordstudents, team_id: team_idstudents, student_ids: student_ids, }; - let url = `/competitions/${"gcc-course-2019"}/students.json`; + let url = `/competitions/${this.props.match.params.identifier}/students.json`; axios.get((url), {params: datas}).then((result) => { if (result) { if (result.data) { - //console.log(result); + // ////console.log(result); this.setState({ member_ids: result.data.teachers }) @@ -235,14 +295,14 @@ class PersonModal extends Component { } } }).catch((error) => { - //console.log(error); + // ////console.log(error); }) }; //老师输入框事件 teacheronChange = (e) => { - //console.log(e.target.value); - //console.log("老师输入框事件|||||||||||123123123"); + // ////console.log(e.target.value); + // ////console.log("老师输入框事件|||||||||||123123123"); this.setState({ keywordteachers: e.target.value, booltech: false, @@ -280,8 +340,8 @@ class PersonModal extends Component { //学生输入框事件 studentsonChange = (e) => { - //console.log("学生输入框事件"); - //console.log(e); + // ////console.log("学生输入框事件"); + // ////console.log(e); this.setState({ keywordstudents: e.target.value, boolstud: false, @@ -331,9 +391,9 @@ class PersonModal extends Component { }; var fordabool = false; var forda = this.state.mydatas; - //console.log("点击获取老师数据"); - //console.log(object); - //console.log(forda); + // ////console.log("点击获取老师数据"); + // ////console.log(object); + // ////console.log(forda); for (var i = 0; i < forda.length; i++) { if (forda[i].id) { if (forda[i].id === object.id) { @@ -372,14 +432,14 @@ class PersonModal extends Component { }; var fordabool = false; var forda = this.state.mydatas; - //console.log("点击获取学生数据2"); - //console.log(object); - //console.log(forda); + // ////console.log("点击获取学生数据2"); + // ////console.log(object); + // ////console.log(forda); for (var i = 0; i < forda.length; i++) { if (forda[i].id) { - // //console.log(true); - // //console.log(forda[i].id); - // //console.log(object.id); + // // ////console.log(true); + // // ////console.log(forda[i].id); + // // ////console.log(object.id); if (forda[i].id === object.id) { fordabool = true; break @@ -407,7 +467,7 @@ class PersonModal extends Component { } //输入框事件 changeTopicName = (e) => { - // //console.log("调用了changeTopicName"); + // // ////console.log("调用了changeTopicName"); let num = parseInt(e.target.value.length); if (num > 60) { return; @@ -422,7 +482,7 @@ class PersonModal extends Component { //onSearchsou onSearch = (value) => { - //console.log("搜索的数据" + value); + // ////console.log("搜索的数据" + value); }; handleInfiniteOnLoad = () => { // this.setState({ @@ -442,12 +502,12 @@ class PersonModal extends Component { } handleInfiniteOnLoad1 = () => { - // //console.log("调用了方法1111"); + // // ////console.log("调用了方法1111"); // this.setState({ // loading1: true, // }) // setTimeout(() => { - // //console.log("调用了方法11112"); + // // ////console.log("调用了方法11112"); // this.setState({ // loading1: false, // hasMore: true, @@ -456,13 +516,13 @@ class PersonModal extends Component { } handleInfiniteOnLoad2 = () => { - // //console.log("调用了方法1111"); + // // ////console.log("调用了方法1111"); // this.setState({ // loading2: true, // // }) // setTimeout(() => { - // //console.log("调用了方法11113"); + // // ////console.log("调用了方法11113"); // this.setState({ // hasMore: true, // loading2: false, @@ -471,23 +531,23 @@ class PersonModal extends Component { } inputOnBlur = (e) => { - //console.log("inputOnBlur"); - //console.log(e); + // ////console.log("inputOnBlur"); + // ////console.log(e); this.setState({ person1: false }) } inputOnBlur2 = (e) => { - //console.log("inputOnBlur"); - //console.log(e); + // ////console.log("inputOnBlur"); + // ////console.log(e); this.setState({ person2: false }) } startSearch = (e) => { - //console.log("startSearch"); - //console.log(e); + // ////console.log("startSearch"); + // ////console.log(e); this.setState({ person1: true, person2: false, @@ -497,8 +557,8 @@ class PersonModal extends Component { } startSearch2 = (e) => { - //console.log("startSearch2"); - //console.log(e); + // ////console.log("startSearch2"); + // ////console.log(e); this.setState({ person1: false, person2: true, @@ -508,8 +568,8 @@ class PersonModal extends Component { } inputOnFocus = (e) => { - //console.log("inputOnFocus"); - //console.log(e); + // ////console.log("inputOnFocus"); + // ////console.log(e); try { if (this.state.keywordteachers && this.state.keywordteachers.length > 0) { this.setState({ @@ -533,8 +593,8 @@ class PersonModal extends Component { } inputOnFocus2 = (e) => { - //console.log("inputOnFocus2"); - //console.log(e); + // ////console.log("inputOnFocus2"); + // ////console.log(e); try { if (this.state.keywordstudents && this.state.keywordstudents.length > 0) { this.setState({ @@ -559,8 +619,8 @@ class PersonModal extends Component { } inputOnFocus3 = (e) => { - //console.log("inputOnFocus3"); - //console.log(e); + // ////console.log("inputOnFocus3"); + // ////console.log(e); this.setState({ person2: false, person1: false, @@ -570,13 +630,13 @@ class PersonModal extends Component { var {mydatas} = this.state; if (item) { var pos = mydatas.indexOf(item); - // console.log("deletedata"); - // console.log(pos); + // ////console.log("deletedata"); + // ////console.log(pos); var removedItem = mydatas.splice(pos, 1); - // console.log("deletedata22222"); - // console.log(removedItem) + // ////console.log("deletedata22222"); + // ////console.log(removedItem) //removedItem 是被删除的元素 - // console.log(mydatas) + // ////console.log(mydatas) this.setState({ mydatas: mydatas, }) @@ -764,6 +824,8 @@ class PersonModal extends Component {
); + //console.log("PersonModal"); + //console.log(this.props); return ( { ` - .reglistviewdivss2 a:hover + a:hover { background-color:#F6F4F4; } @@ -841,6 +903,7 @@ class PersonModal extends Component {

diff --git a/public/react/src/modules/competition/competmodal/PersonalModalteam.js b/public/react/src/modules/competition/competmodal/PersonalModalteam.js index acba9c1b8..f86668f34 100644 --- a/public/react/src/modules/competition/competmodal/PersonalModalteam.js +++ b/public/react/src/modules/competition/competmodal/PersonalModalteam.js @@ -20,7 +20,7 @@ class PersonalModalteam extends Component { Tmoconfirmto = () => { - let url = `/competitions/${"gcc-course-2019"}/competition_teams/join.json`; + let url = `/competitions/${this.props.match.params.identifier}/competition_teams/join.json`; axios.post(url, { invite_code: this.state.yslzxueshiskmcdm1 }).then((result) => { diff --git a/public/react/src/modules/competition/personal/PersonalCompetit.js b/public/react/src/modules/competition/personal/PersonalCompetit.js index b14ad4d36..d740e416a 100644 --- a/public/react/src/modules/competition/personal/PersonalCompetit.js +++ b/public/react/src/modules/competition/personal/PersonalCompetit.js @@ -58,7 +58,7 @@ class PersonalCompetit extends React.Component {
-

参赛总人数:132

+

参赛总人数:132

: ""} diff --git a/public/react/src/modules/competition/personal/PersonalCompetititem.js b/public/react/src/modules/competition/personal/PersonalCompetititem.js index ed4b76628..0b888431c 100644 --- a/public/react/src/modules/competition/personal/PersonalCompetititem.js +++ b/public/react/src/modules/competition/personal/PersonalCompetititem.js @@ -9,8 +9,20 @@ import moment from 'moment'; import {SnackbarHOC, WordsBtn, getImageUrl} from 'educoder'; import {TPMIndexHOC} from '../../tpm/TPMIndexHOC'; import competition from '../comcss/competition.css'; -import {Button} from 'antd'; +import {Button, message} from 'antd'; +import pexjiazai from '../pexjiazai.png' + +// 点击按钮复制功能 +function jsCopy() { + var e = document.getElementById("copy_invite_code"); + e.select(); + document.execCommand("Copy"); + codesuccess() +} +function codesuccess() { + message.success('复制成功'); +}; // 团队竞赛报名无报名子组件团队 竞赛报名-已创建战队 class PersonalCompetititem extends React.Component { constructor(props) { @@ -22,7 +34,7 @@ class PersonalCompetititem extends React.Component { } componentDidMount() { - // //console.log(this.props.data) + // // ////console.log(this.props.data) this.setState({ data: this.props.data, }) @@ -37,21 +49,24 @@ class PersonalCompetititem extends React.Component { } render() { - const {data} = this.state; - //console.log("PersonalCompetititem"); - //console.log(data); - //console.log(data[0]); - //console.log(data&&data[0].creator.image_url); + const {data} = this.props; + // ////console.log("PersonalCompetititem"); + // ////console.log(data); + // ////console.log(data[0]); + // ////console.log(data&&data[0].creator.image_url); // const listItems = mydatas.map((item, index) => // // ); + console.log("PersonalCompetititem"); + console.log(data); return (
{ - data && data[0] ?
-
+
+
@@ -61,7 +76,7 @@ class PersonalCompetititem extends React.Component { width: "78px", textAlign: "center" - }}>{data && data[0].name}

+ }}>{data[0].creator.name}

{data && data[0].school_name}

+ }}>{data[0].name}

: index === 1 ? -
+ -
+ : index === 2 ? -
+ -
+ : index === 3 ? -
+ -
+ : index === 4 ? -
+ -
+ : index === 5 ? +
+ -
+ -
- : -
+ +
+ : "" ) }) } @@ -122,19 +139,46 @@ class PersonalCompetititem extends React.Component {
-

+ 邀请码: + 邀请码:yngh5

+ }}>{data[0].invite_code === null || data[0].invite_code === undefined ? "" : data[0].invite_code} +
+
+ +
- - + {data[0].invite_code === null || data[0].invite_code === undefined ? + + + : + { + jsCopy() + }} + > + + + } + { this.props.type === 5 ?
-
-

删除战队

+
this.props.Exittheteamshow(data[0].id, true)}> +

this.props.Exittheteamshow(data[0].id, true)}>删除战队

-
-

编辑战队

+
this.props.Createateamedit(data[0])}> +

this.props.Createateamedit(data[0])}>编辑战队

: this.props.type === 2 ? -
-

战队详情

+ 战队详情
-
-

退出战队

+
this.props.Exittheteamshow(data[0].id, false)}> +

this.props.Exittheteamshow(data[0].id, false)}>退出战队

@@ -172,8 +221,8 @@ class PersonalCompetititem extends React.Component { }} > -
-

退出战队

+
this.props.Exittheteamshow(data[0].id, false)}> +

this.props.Exittheteamshow(data[0].id, false)}>退出战队

@@ -182,6 +231,7 @@ class PersonalCompetititem extends React.Component { }
+
: "" }
diff --git a/public/react/src/modules/competition/pexjiazai.png b/public/react/src/modules/competition/pexjiazai.png new file mode 100644 index 000000000..78f56b82a Binary files /dev/null and b/public/react/src/modules/competition/pexjiazai.png differ diff --git a/public/react/src/modules/competitions/Competitimain/CompetitionsIndex.js b/public/react/src/modules/competitions/Competitimain/CompetitionsIndex.js index 7f3b4bfce..1a43bbe4c 100644 --- a/public/react/src/modules/competitions/Competitimain/CompetitionsIndex.js +++ b/public/react/src/modules/competitions/Competitimain/CompetitionsIndex.js @@ -1,14 +1,10 @@ import React, { Component } from 'react'; import { Link } from 'react-router-dom'; import { Menu, Icon, List, Avatar,Row, Col,Tag,Pagination} from 'antd'; +import {getImageUrl} from 'educoder'; import axios from 'axios'; import './Competitionsindex.css'; -import NoneData from "../../courses/shixunHomework/shixunHomework"; -import groups1 from './groups1.png'; -import groups2 from './groups2.png'; -import groups3 from './groups3.png'; - - +import NoneData from "../../courses/coursesPublic/NoneData"; const { SubMenu } = Menu; @@ -42,7 +38,7 @@ class CompetitionsIndex extends Component{ axios.get(Url,{params:{ category:category, page:page, - per_page:6, + per_page:15, } }).then((response) => { if(response.status===200){ @@ -66,6 +62,20 @@ class CompetitionsIndex extends Component{ this.getdata(e.key,page) }; + setcompetitonurl=(url)=>{ + + if(url!=null){ + this.props.history.replace(url); + } + } + + PaginationCourse=(pageNumber)=>{ + let {category}=this.state; + this.setState({ + page: pageNumber, + }) + this.getdata(category,pageNumber); + } render() { let {datas,page,count}=this.state; @@ -76,6 +86,21 @@ class CompetitionsIndex extends Component{
+
@@ -118,12 +143,12 @@ class CompetitionsIndex extends Component{ ` } - ( - +
{item.description===null||item.description===undefined||item.description===""?:""} + src={item.competition_status==="ended"?getImageUrl(`images/educoder/competitions/groups1.png`):item.competition_status==="nearly_published"?getImageUrl(`images/educoder/competitions/groups2.png`):item.competition_status==="progressing"?getImageUrl(`images/educoder/competitions/groups3.png`):""} /> ¥{item.bonus}
-
{item.visits_count}
+
{item.competition_status==="nearly_published"?"--":item.visits_count}
-
{item.member_count}
+
{item.competition_status==="nearly_published"?"--":item.member_count}
} > {item.name}{item.sub_title===null?"":{ + title={ + this.setcompetitonurl(item.competition_status==="ended"?null:item.competition_status==="nearly_published"?`/newcompetitions/${item.identifier}/common_header`:item.competition_status==="progressing"?`/newcompetitions/${item.identifier}/common_header`:null)} + >{item.name}{item.sub_title===null?"":{ item.sub_title }} } @@ -179,20 +207,20 @@ class CompetitionsIndex extends Component{ {item.description}
- +
) } - /> + />} - {datas===undefined?'none':datas.task_count >6 ?
20 ?
{ + if(response.status===200){ + this.setState({ + bannerdata:response.data + }) + } + }).catch((error) => { + console.log(error) + }) } getbannerdata=()=>{ @@ -35,21 +49,27 @@ class CompetitionCommon extends Component{ } + getrightdata=(id,typeid)=>{ +debugger + } + render() { - let {data}=this.state; - console.log(data) + let {data,bannerdata}=this.state; + // console.log(bannerdata) return ( data===undefined?"":
在线竞赛 - 全国高校计算机大赛 + {data&&data.name}
- banner - + + + + {data&&data.name} @@ -86,10 +106,10 @@ class CompetitionCommon extends Component{ - {data&&data.enroll_end_time===null?"":"报名截止时间:"+data&&data.enroll_end_time} + {data&&data.enroll_end_time===null?"":`报名截止时间:${data&&data.enroll_end_time}`}
@@ -101,7 +121,11 @@ class CompetitionCommon extends Component{ {data&&data.competition_modules.map((item,key)=>{ return( - {item.name} + {item.module_url===null?this.getrightdata(item.id,item.module_type)}>{item.name}:this.getrightdata(item.id,item.module_type)} + >{item.name}} ) })} @@ -110,10 +134,8 @@ class CompetitionCommon extends Component{ - - - - + + diff --git a/public/react/src/modules/competitions/Competitioncommon/CompetitionContents.js b/public/react/src/modules/competitions/Competitioncommon/CompetitionContents.js new file mode 100644 index 000000000..5ba381b24 --- /dev/null +++ b/public/react/src/modules/competitions/Competitioncommon/CompetitionContents.js @@ -0,0 +1,38 @@ +import React, { Component } from 'react'; +import {Button,Layout} from 'antd'; +import axios from 'axios'; +import {markdownToHTML,getImageUrl} from 'educoder'; +import NoneData from "../../courses/shixunHomework/shixunHomework"; + +const { Header, Footer, Sider, Content } = Layout; +class CompetitionContents extends Component{ + constructor(props) { + super(props) + this.state={ + + } + } + + componentDidMount(){ + window.document.title = '竞赛'; + + } + + + + render() { + + return ( + +
+ + + +
+ + ) + } +} +export default CompetitionContents; \ No newline at end of file diff --git a/public/react/src/modules/competitions/Competitioncommon/CompetitionContentsChart.js b/public/react/src/modules/competitions/Competitioncommon/CompetitionContentsChart.js new file mode 100644 index 000000000..9d7a10f18 --- /dev/null +++ b/public/react/src/modules/competitions/Competitioncommon/CompetitionContentsChart.js @@ -0,0 +1,189 @@ +import React, { Component } from 'react'; +import {Button,Layout,Tabs,Icon, Card, Avatar, Row, Col ,Table} from 'antd'; +import axios from 'axios'; +import {markdownToHTML,getImageUrl} from 'educoder'; +import NoneData from "../../courses/shixunHomework/shixunHomework"; + +const { Header, Footer, Sider, Content } = Layout; +const { TabPane } = Tabs; +const { Meta } = Card; + +class CompetitionContents extends Component{ + constructor(props) { + super(props) + this.state={ + + } + } + + componentDidMount(){ + window.document.title = '竞赛'; + + } + + + + render() { + const operations = ; + const columns = [ + { + title: 'Name', + dataIndex: 'name', + key: 'name', + render: text => {text}, + }, + { + title: 'Age', + dataIndex: 'age', + key: 'age', + }, + { + title: 'Address', + dataIndex: 'address', + key: 'address', + }, + { + title: 'Tags', + key: 'tags', + dataIndex: 'tags', + render: tags => ( + + 123123 + + ), + }, + { + title: 'Action', + key: 'action', + render: (text, record) => ( + + Invite {record.name} + Delete + + ), + }, + { + title: 'Values', + key: 'values', + dataIndex: 'values', + render: tags => ( + + 123123 + + ), + }, + ]; + + const data = [ + { + key: '1', + name: 'John Brown', + age: 32, + address: 'New York No. 1 Lake Park', + tags: ['nice', 'developer'], + values:123 + }, + { + key: '2', + name: 'Jim Green', + age: 42, + address: 'London No. 1 Lake Park', + tags: ['loser'], + values:123 + }, + { + key: '3', + name: 'Joe Black', + age: 32, + address: 'Sidney No. 1 Lake Park', + tags: ['cool', 'teacher'], + values:123 + }, + ]; + + + return ( +
+ + + + + + + + + + + + + + + + + + 总排名 + + + + + + } + > + + + + + + } + > + + + + + + + } + > + + + + + + + + + + + + + ) + } +} +export default CompetitionContents; \ No newline at end of file diff --git a/public/react/src/modules/competitions/Competitions.js b/public/react/src/modules/competitions/Competitions.js index 3d5bcd920..1b8da55d7 100644 --- a/public/react/src/modules/competitions/Competitions.js +++ b/public/react/src/modules/competitions/Competitions.js @@ -29,6 +29,11 @@ const CompetitionTeams = Loadable({ loading: Loading, }) +//团队竞赛报名 +const Registration = Loadable({ + loader: () => import('../competition/Registration'), + loading: Loading, +}); class Competitions extends Component { constructor(props) { @@ -36,6 +41,8 @@ class Competitions extends Component { } componentDidMount(){ + console.log("Competitions竞赛"); + console.log(this.props); window.document.title = '竞赛'; } @@ -53,6 +60,15 @@ class Competitions extends Component { } > + + {/*新版竞赛报名*/} + () + } + /> + {/*新版竞赛详情页面*/}