竞赛start

competitions
杨树明 5 years ago
parent 3f8ccccdfe
commit 79df257216

@ -259,6 +259,12 @@ const ProjectPackages=Loadable({
loading: Loading,
})
//竞赛
const NewCompetitions=Loadable({
loader: () => import('./modules/competitions/Competitions'),
loading: Loading,
})
const Messagerouting= Loadable({
loader: () => import('./modules/message/js/Messagerouting'),
loading: Loading,
@ -473,6 +479,8 @@ class App extends Component {
}></Route>
{/*众包创新*/}
<Route path={"/crowdsourcing"} component={ProjectPackages}/>
{/*竞赛*/}
<Route path={"/newcompetitions"} component={NewCompetitions}/>
{/*认证*/}
<Route path="/account" component={AccountPage}/>

@ -0,0 +1,49 @@
import React, { Component } from 'react';
import { Redirect } from 'react-router';
import { BrowserRouter as Router, Route, Link, Switch } from "react-router-dom";
import Loading from '../../Loading'
import Loadable from 'react-loadable';
import { TPMIndexHOC } from '../tpm/TPMIndexHOC'
import { SnackbarHOC } from 'educoder'
//新版竞赛首页
const CompetitionsIndex = Loadable({
loader: () => import('./competitimain/CompetitionsIndex'),
loading: Loading,
})
class Competitions extends Component {
constructor(props) {
super(props)
}
componentDidMount(){
window.document.title = '竞赛'
}
render() {
return (
<div className="newMain clearfix">
<Switch>
{/*新版竞赛首页*/}
<Route path="/newcompetitions"
render={
(props) => (<CompetitionsIndex {...this.props} {...props} {...this.state} />)
}
></Route>
</Switch>
</div>
);
}
}
export default SnackbarHOC() (TPMIndexHOC (Competitions)) ;

@ -0,0 +1,191 @@
import React, { Component } from 'react';
import {BrowserRouter as Router,Route,Switch} from 'react-router-dom';
import { Menu, Icon, List, Avatar,Row, Col,Tag,Pagination} from 'antd';
import axios from 'axios';
import './Competitionsindex.css';
import NoneData from "../../courses/shixunHomework/shixunHomework";
const { SubMenu } = Menu;
const IconText = ({ type, text }) => (
<span>
<Icon type={type} style={{ marginRight: 8 }} />
{text}
</span>
);
class CompetitionsIndex extends Component{
constructor(props) {
super(props)
this.state={
current: 'all',
datas:undefined,
page:1
}
}
componentDidMount(){
window.document.title = '竞赛';
let{page}=this.state;
const Url =`/competitions.json`;
axios.get(Url,{params:{
page:page
}
}).then((response) => {
if(response.status===200){
this.setState({
datas:response.data.competitions,
count:response.data.count,
})
}
})
.catch(function (error) {
console.log(error);
});
}
handleClick = e => {
console.log('click ', e);
this.setState({
current: e.key,
});
};
render() {
let {datas,page,count}=this.state;
// bonus: 0
// current_stage: {name: "正赛 第一阶段", start_time: "2019-10-11 00:00:00", end_time: "2019-11-01 00:00:00"}
// description: null
// end_time: "2019-11-01 00:00:00"
// enroll_end_time: "2019-10-31 00:00:00"
// id: 7
// identifier: "gcc-annotation-2019"
// image: null
// member_count: 540
// name: "第二届全国绿色计算系列大赛"
// nearly_published: false
// published: true
// single_stage: false
// start_time: "2019-07-01 00:00:00"
// sub_title: "代码标注组"
// visits_count: 10181
return (
<div>
<div className="clearfix">
<div>
<div className="newMain clearfix">
<div className="courses-head pr">
<div className="edu-txt-center pathNavLine">
<div className="inline path-nav"></div>
</div>
</div>
<div className="competitionstitle mb20">
<div className="competitionstitle2">
<Menu onClick={this.handleClick} selectedKeys={[this.state.current]} mode="horizontal">
<Menu.Item key="all" className={"competitionmr50"}>
<span className={"competitionsvalue"}>全部</span>
</Menu.Item>
<Menu.Item key="nearly_published" className={"competitionmr50"}>
<span className={"competitionsvalue"}>即将发布</span>
</Menu.Item>
<Menu.Item key="progressing" className={"competitionmr50"}>
<span className={"competitionsvalue"}>进行中</span>
</Menu.Item>
<Menu.Item key="ended" className={"competitionmr50"}>
<span className={"competitionsvalue"}>往期比赛</span>
</Menu.Item>
</Menu>
</div>
</div>
<div className={"educontent clearfix mtf10 CompetitionsIndex "}>
<List
itemLayout="vertical"
size="large"
dataSource={datas&&datas}
renderItem={(item,key) => (
<List.Item
key={key}
actions={[
<span>竞赛时间: 2019-08-07 24: 002019-09-10 24: 00</span>,
<span>报名截止时间2019-08-07 08:10</span>,
]}
extra={
<div className={"pt50"} style={{"width":'305px'}}>
<Row gutter={16}>
<Col className="gutter-row" span={6}>
<div className="gutter-box CompetitionsIndexdadels">奖金</div>
</Col>
<Col className="gutter-row" span={6}>
<div className="gutter-box CompetitionsIndexdadels">浏览数</div>
</Col>
<Col className="gutter-row" span={6}>
<div className="gutter-box CompetitionsIndexdadels">报名数</div>
</Col>
</Row>
<Row gutter={16}>
<Col className="gutter-row" span={6}>
<div className="gutter-box CompetitionsIndexbottomvalue">¥4500</div>
</Col>
<Col className="gutter-row" span={6}>
<div className="gutter-box CompetitionsIndexbottomvalue">351</div>
</Col>
<Col className="gutter-row" span={6}>
<div className="gutter-box CompetitionsIndexbottomvalue">351</div>
</Col>
</Row>
</div>
}
>
<List.Item.Meta
title={<a><span className={"competitionstitles"}>{item.name}</span><span>{item.sub_title===null?"":<Tag className="competitionsrelative" color="#87d068">{
item.sub_title
}</Tag>}</span>
</a>}
/>
{item.description}
</List.Item>
)}
/>
<div className="mb40 edu-txt-center padding20-30"
// style={
// // {
// // display: datas===undefined?'none':datas.task_count >15 ? 'block':'none'
// // }
// }
>
<Pagination
showQuickJumper
defaultCurrent={1}
pageSize={8}
total={count===undefined?"":count}
current={page}
onChange={this.PaginationCourse}
/>
</div>
{
datas===undefined?"":datas && datas.length===0? <NoneData></NoneData>:""
}
</div>
</div>
</div>
</div>
</div>
)
}
}
export default CompetitionsIndex;

@ -0,0 +1,109 @@
.courses-head{
width: 100%;
height: 300px;
background-image: url(./courses.jpg);
background-color: #081C4B;
background-size: cover;
background-position: center;
background-repeat: no-repeat;
}
.competitionstitle{
height:50px !important;
border-radius: 6px;
background: #fff;
display: flex;
justify-content: center;
}
.competitionstitle2{
height:50px !important;
margin-left: 30px !important;
background: #fff;
width: 1200px;
}
.ant-menu-horizontal {
border-bottom:none !important;
}
.competitionsvalue{
font-size: 16px;
font-family: PingFangSC-Medium,PingFangSC;
font-weight: 500;
}
.competitionmr50 {
margin-right: 50px !important;
}
.CompetitionsIndex .ant-list-item{
background: #fff !important;
margin-top: 20px;
border: none !important;
}
.CompetitionsIndex .ant-list-item{
padding:25px;
}
.CompetitionsIndex .ant-list-item-meta-title{
height:28px;
font-size:28px;
font-family:PingFangSC-Regular,PingFangSC;
font-weight:400;
color:rgba(5,16,26,1);
line-height:28px;
}
.CompetitionsIndex .ant-list-vertical .ant-list-item-meta{
margin-bottom: 20px !important;
}
.CompetitionsIndex .ant-list-vertical .ant-list-item-action {
margin-top: 20px;
margin-left: auto;
}
.CompetitionsIndex .ant-list-item-action-split{
display: none !important;
}
.CompetitionsIndexdadels{
font-family: PingFangSC-Regular,PingFangSC;
font-weight: 400;
color: #777777;
margin-bottom: 14px;
margin-right: 20px;
}
.CompetitionsIndexbottomvalue{
font-size: 24px;
font-family: ArialMT;
color: rgba(5,16,26,1);
}
.CompetitionsIndex .gutter-row{
margin-right:20px;
}
.pt50{
padding-top: 50px;
}
.competitionstitles{
max-width: 789px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
display: inline-block;
margin-right: 15px;
}
.competitionsrelative{
position: absolute;
/*top: 28px;*/
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 169 KiB

@ -36,8 +36,7 @@ class ProjectPackageIndex extends Component {
}
render() {
console.log(this.props)
console.log(this.state)
return (
<div className="newMain clearfix">

Loading…
Cancel
Save