You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
230 lines
5.1 KiB
230 lines
5.1 KiB
import React, {Component} from 'react';
|
|
import {
|
|
BrowserRouter as Router,
|
|
Route,
|
|
Switch
|
|
} from 'react-router-dom';
|
|
import axios from 'axios';
|
|
import moment from 'moment';
|
|
import {SnackbarHOC, WordsBtn} from 'educoder';
|
|
import {TPMIndexHOC} from '../tpm/TPMIndexHOC';
|
|
import competition from './comcss/competition.css';
|
|
import {Button, Pagination,} from 'antd';
|
|
import Registrationitem from './Registrationitem';
|
|
import RegisNodata from './RegisNodata';
|
|
import CompetitionMaxImg from './CompetitionMaxImg';
|
|
import RegistrationSearch from './RegistrationSearch';
|
|
import RegisListview from './RegisListview';
|
|
import RegisListviewdata from './RegisListviewdata';
|
|
import PersonModal from './competmodal/PersonModal';
|
|
import PersonalModalteam from './competmodal/PersonalModalteam';
|
|
// 团队竞赛报名无报名
|
|
class Registration extends React.Component {
|
|
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,
|
|
tmodalsType: false,
|
|
tmodalsTypes: false,
|
|
Newtit: true,
|
|
keyword: "",
|
|
page: 1,
|
|
per_page: 20,
|
|
data: [],
|
|
count: 0,
|
|
}
|
|
}
|
|
|
|
componentDidMount() {
|
|
// console.log("componentDidMount ");
|
|
// console.log("调用子组件 ");
|
|
// console.log(this.props);
|
|
// console.log(this.props.isAdmin())
|
|
const {keyword, page, per_page} = this.state;
|
|
this.Getdata(keyword, page, per_page);
|
|
}
|
|
|
|
Getdata = (keyword, page, per_page) => {
|
|
//搜索关键字 keyword
|
|
//页数 page
|
|
//分页 per_page
|
|
const datas = {
|
|
keyword: keyword,
|
|
page: page,
|
|
per_page: per_page,
|
|
};
|
|
let url = `/competitions/${"gcc-course-2019"}/competition_teams.json`;
|
|
axios.get((url), {params: datas}).then((result) => {
|
|
if (result) {
|
|
if (result.data) {
|
|
console.log(result);
|
|
if (result.data.count === 0) {
|
|
this.setState({
|
|
type: 1,
|
|
count: result.data.count,
|
|
})
|
|
} else {
|
|
this.setState({
|
|
data: result.data.competition_teams,
|
|
count: result.data.count,
|
|
})
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
}).catch((error) => {
|
|
console.log(error);
|
|
})
|
|
}
|
|
paginationonChangestwo = (pageNumber) => {
|
|
this.setState({
|
|
pages: pageNumber,
|
|
loadingstate: true,
|
|
})
|
|
};
|
|
/**
|
|
* 加入战队
|
|
* */
|
|
Jointheteam = () => {
|
|
this.setState({
|
|
tmodalsTypes: true
|
|
})
|
|
}
|
|
|
|
/**
|
|
* 创建战队
|
|
**/
|
|
Createateam = () => {
|
|
this.setState({
|
|
tmodalsType: true
|
|
})
|
|
}
|
|
|
|
|
|
Tmoconfirm = (bool) => {
|
|
//boolfalse 取消 true 确认
|
|
this.setState({
|
|
tmodalsTypes: false
|
|
})
|
|
if (bool) {
|
|
//确认
|
|
|
|
|
|
} else {
|
|
//取消
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
Tmoconfirm1 = (bool) => {
|
|
//boolfalse 取消 true 确认
|
|
this.setState({
|
|
tmodalsType: false
|
|
})
|
|
if (bool) {
|
|
//确认
|
|
|
|
|
|
} else {
|
|
//取消
|
|
|
|
|
|
}
|
|
}
|
|
|
|
render() {
|
|
const {test, page, pages, limit, type, tmodalsType, tmodalsTypes} = this.state;
|
|
const listItems = test.map((item, index) =>
|
|
<RegisListviewdata></RegisListviewdata>
|
|
);
|
|
return (
|
|
<div className="newMain clearfix ">
|
|
|
|
<div className={"educontent mb20 persmstyle"} style={{width: "1200px", marginTop: "26px"}}>
|
|
<style>
|
|
{
|
|
`
|
|
html, body{
|
|
overflow: hidden;
|
|
height: 100%;
|
|
}
|
|
`
|
|
}
|
|
</style>
|
|
<PersonModal modalsType={tmodalsType} {...this.props} {...this.state} Newtit={true}
|
|
Tmoconfirm1={(bool) => this.Tmoconfirm1(bool)}></PersonModal>
|
|
<PersonalModalteam tmodalsTypes={tmodalsTypes} {...this.props} {...this.state}
|
|
Tmoconfirm={(bool) => this.Tmoconfirm(bool)}></PersonalModalteam>
|
|
<div className="educontent mb20 ">
|
|
<p className="clearfix mb20 mt10">
|
|
<a className="btn colorgrey fl hovercolorblue ">在线竞赛</a>
|
|
<span className="color-grey-9 fl ml3 mr3">></span>
|
|
<a
|
|
className=" btn colorgrey fl hovercolorblue ">全国高校计算机大赛-项目挑战</a>
|
|
<span className="color-grey-9 fl ml3 mr3">></span>
|
|
<WordsBtn className="fl">报名</WordsBtn>
|
|
</p>
|
|
</div>
|
|
{/*大图*/}
|
|
<CompetitionMaxImg type={type} Jointheteam={() => this.Jointheteam()}
|
|
Createateam={() => this.Createateam()}></CompetitionMaxImg>
|
|
{/*大图结尾*/}
|
|
{/*没数据*/}
|
|
{
|
|
type === 1 ?
|
|
<RegisNodata></RegisNodata>
|
|
:
|
|
""
|
|
}
|
|
{
|
|
type === 2 || type === 3 || type === 5 ?
|
|
<Registrationitem type={type}></Registrationitem>
|
|
: ""
|
|
}
|
|
|
|
{
|
|
type === 4 || type === 5 ?
|
|
<RegistrationSearch></RegistrationSearch>
|
|
: ""
|
|
}
|
|
{
|
|
type === 4 || type === 5 ?
|
|
<RegisListview></RegisListview>
|
|
:
|
|
""
|
|
}
|
|
|
|
|
|
{type === 4 || type === 5 ?
|
|
listItems
|
|
:
|
|
""
|
|
}
|
|
|
|
{
|
|
type === 4 || type === 5 ?
|
|
<div className="edu-txt-center ysyslxh mt56 " style={{marginBottom: "192px",}}>
|
|
<Pagination showQuickJumper current={pages}
|
|
onChange={this.paginationonChangestwo} pageSize={limit}
|
|
total={30}></Pagination>
|
|
</div>
|
|
: ""
|
|
}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
)
|
|
}
|
|
|
|
}
|
|
|
|
export default SnackbarHOC()(TPMIndexHOC(Registration));
|