diff --git a/public/react/src/modules/courses/competitions/Competitimain/CompetitionsIndex.js b/public/react/src/modules/courses/competitions/Competitimain/CompetitionsIndex.js new file mode 100644 index 000000000..5a341726d --- /dev/null +++ b/public/react/src/modules/courses/competitions/Competitimain/CompetitionsIndex.js @@ -0,0 +1,225 @@ +import React, { Component } from 'react'; +import { Link } from 'react-router-dom'; +import { Menu, Icon, List, Avatar,Row, Col,Tag,Pagination,Alert} from 'antd'; +import {getImageUrl} from 'educoder'; +import axios from 'axios'; +import './Competitionsindex.css'; +import NoneData from "../../courses/coursesPublic/NoneData"; +import LoadingSpin from '../../../common/LoadingSpin'; + +class CompetitionsIndex extends Component{ + constructor(props) { + super(props) + this.state={ + current: 'all', + datas:undefined, + page:1, + category:undefined + + } + } + + componentDidMount(){ + window.document.title = '竞赛'; + let{category,page}=this.state; + this.getdata(category,page) + } + + getdata=(category,page)=>{ + const Url =`/competitions.json`; + axios.get(Url,{params:{ + category:category, + page:page, + per_page:15, + } + }).then((response) => { + if(response.status===200){ + this.setState({ + datas:response.data.competitions, + count:response.data.count, + }) + } + }) + .catch(function (error) { + console.log(error); + }); + } + + + handleClick = e => { + this.setState({ + current: e.key, + datas:undefined + }); + let{category,page}=this.state; + this.getdata(e.key,page) + }; + + PaginationCourse=(pageNumber)=>{ + let {category}=this.state; + this.setState({ + page: pageNumber, + }) + this.getdata(category,pageNumber); + } + + render() { + let {datas,page,count}=this.state; + + + return ( +
+
+
+
+ +
+
+
+
+
+ +
+
+ + + 全部 + + + 即将发布 + + + 进行中 + + + 往期比赛 + + +
+
+ +
+ + {datas===undefined?"":datas.length===0?"": ( + + +
+ {item.competition_status==="nearly_published"? + item.permission.editable==true?"":
即将发布 敬请期待
:""} + {/*
即将发布 敬请期待
*/} + {/*{item.description===null||item.description===undefined||item.description===""?:""}*/} + + 竞赛时间: {item.start_time}~{item.end_time}, + 报名截止时间:{item.enroll_end_time}, + ]} + extra={ +
+ + + +
奖金
+ + +
浏览数
+ + +
报名数
+ +
+ + + +
¥{item.bonus}
+ + +
{item.competition_status==="nearly_published"?"--":item.visits_count}
+ + +
{item.competition_status==="nearly_published"?"--":item.member_count}
+ +
+
+ } + > + +
{item.name}{item.sub_title===null?"":`——${item.sub_title}`} + {/*{item.sub_title===null?"":*/} + {/*{item.sub_title}}*/} + {/**/} + } + /> + {item.description} + +
+ + + ) + + } + />} + + {datas===undefined?"":count===undefined?"":count >15 ?
+ + + +
:""} + + { + datas===undefined?:datas && datas.length===0? :"" + } +
+ +
+ +
+
+
+ ) + } +} +export default CompetitionsIndex; diff --git a/public/react/src/modules/courses/competitions/Competitimain/Competitionsindex.css b/public/react/src/modules/courses/competitions/Competitimain/Competitionsindex.css new file mode 100644 index 000000000..cddb1492b --- /dev/null +++ b/public/react/src/modules/courses/competitions/Competitimain/Competitionsindex.css @@ -0,0 +1,163 @@ +.teamsLayout{background: transparent !important;} + +.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; +} +.CompetitionsList{ + position: relative; + /*max-height: 210px;*/ +} +.competitonimg{ + position: absolute; + right: -5px; + width: 80px; + top: 20px; +} + +.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; + text-align: center; +} + +.CompetitionsIndexbottomvalue{ + font-size: 24px; + font-family: ArialMT; + color: rgba(5,16,26,1); + text-align: center; +} + +.CompetitionsIndex .gutter-row{ + /*margin-right:20px;*/ + width: 33%; +} + +.pt50{ + padding-top: 50px; +} + +.competitionstitles{ + max-width: 789px; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + display: inline-block; + margin-right: 15px; + color:#000 !important; +} + +.competitionsrelative{ + position: absolute; + top: 28px; +} + +.CompetitionsList:hover{ + /*box-shadow: 0 2px 6px rgba(51,51,51,.09);*/ + box-shadow:3px 4px 10px 2px rgba(229,229,229,0.5); + opacity: 1; + border-radius: 2px; +} +.endedfont{ + color:#000 !important; +} +.CompetitionsListzhezhao{ + position: absolute; + top: 0px; + left: 0px; + width: 1206px; + height: 100%; + z-index: 10000; + display: none; + background: rgba(0,0,0,0.33); + text-align: center; + color: #fff; + font-size: 22px; + + align-items: center; + justify-content: space-around; + flex-direction: column; +} +.CompetitionsList:hover .CompetitionsListzhezhao{ + display: block; + display: flex; +} +.competitionstitlesshou:hover a{ + cursor: pointer; + color: #1c91e8 !important; +} + +.competitionstitlesshou{ + cursor: pointer; +} + + +.Competitionshead{ + background-color: #2d28ba !important; + background-position: center !important; + background-position: 50% !important; + background-repeat: no-repeat !important; +} + +.span666{ + color:#666666 !important; +} \ No newline at end of file diff --git a/public/react/src/modules/courses/competitions/Competition_teams/Competitionteams.css b/public/react/src/modules/courses/competitions/Competition_teams/Competitionteams.css new file mode 100644 index 000000000..af1f40aba --- /dev/null +++ b/public/react/src/modules/courses/competitions/Competition_teams/Competitionteams.css @@ -0,0 +1,53 @@ +.teamsLayout{background: transparent !important;} +.teamsLayout .teamsLayoutitle{ + font-size:18px; + font-family:PingFangSC-Semibold,PingFang SC; + font-weight:600; + color:rgba(5,16,26,1); + line-height:25px; + margin-top: 10px; + margin-bottom: 10px; +} +.teamsLayoutTable .ant-table-bordered .ant-table-thead > tr > th, .ant-table-bordered .ant-table-tbody > tr > td { + border-right: 1px solid transparent !important; +} + +.teamsLayoutTable .ant-table-body .ant-table-thead > tr> th:nth-last-child(1){ + border-right: 1px solid #e8e8e8 !important; +} + +.teamsLayoutTable .ant-table-body .ant-table-tbody > tr> td:nth-last-child(1){ + border-right: 1px solid #e8e8e8 !important; +} + +.teamsLayoutTable .ant-table-bordered .ant-table-thead > tr > th{ + background:#EEEEEE; + font-size: 14px; + font-family: PingFangSC-Regular,PingFang SC; + font-weight: 400; + color: rgba(102,102,102,1); + line-height: 20px; +} + +.teamsLayoutTable .ant-table-bordered .ant-table-tbody > tr > th{ + background:#EEEEEE; + font-size:14px; + font-family:PingFangSC-Regular,PingFang SC; + font-weight:400; + color:rgba(5,16,26,1); + line-height:20px; +} + +.teamsLayout .mt40{ + margin-top: 40px !important; +} + +.teamsLayoutheji{ + color: #878787; + font-size: 16px; +} + +.teamsLayoucolor-orange { + color: #ff6800!important; + font-size: 16px; +} \ No newline at end of file diff --git a/public/react/src/modules/courses/competitions/Competition_teams/Competitionteams.js b/public/react/src/modules/courses/competitions/Competition_teams/Competitionteams.js new file mode 100644 index 000000000..be6c2e68d --- /dev/null +++ b/public/react/src/modules/courses/competitions/Competition_teams/Competitionteams.js @@ -0,0 +1,267 @@ +import React, { Component } from 'react'; +import { Breadcrumb,Layout,Table, Divider, Tag,Badge,Tooltip} from 'antd'; +import { Link } from 'react-router-dom'; +import axios from 'axios'; + + +import './Competitionteams.css'; +const { Content } = Layout; + +class Competitionteams extends Component{ + constructor(props) { + super(props) + this.state={ + shixundata: undefined, + coursedata:undefined, + } + } + + componentDidMount(){ + window.document.title = '竞赛'; + if(this.props.match.params.identifier!=null){ + let url=`/competitions/${this.props.match.params.identifier}/common_header.json`; + axios.get(url).then((response) => { + if(response.status===200){ + this.setState({ + data:response.data, + }) + } + }).catch((error) => { + console.log(error) + }) + } + + this.getshixundata(); + this.getcoursedata(); + } + + getshixundata=()=>{ + + const Url =`/competitions/${this.props.match.params.identifier}/competition_teams/${this.props.match.params.competition_team_id}/shixun_detail.json`; + axios.get(Url).then((response) => { + if(response.status===200){ + // let data={ + // shixuns: [ + // { + // creator: "黄井泉", // 创建者 + // shixun_name: "单链表的学习与应用(I)", // 实训名称 + // shixun_identifier: "mnf6b7z3", + // forked: false, // false:原创 + // myshixuns_count: 179, // 学习人数 + // forked_myshixun_count: 0, // 被fork发布的学习人数 + // valid_count: 82, // 有效作品数 + // score: 1320 // 应用值 + // } + // ], + // shixun_count: 1, // 实训总计 + // total_myshixun_count: 179, // 学习人数总计 + // total_forked_myshixun_count: 0, // 被fork发布的学习人数总计 + // total_valid_count: 82, // 有效作品数总计 + // total_shixun_score: 1320 // 应用值总计 + // } + let data=response.data; + + let newarr=data.shixuns; + + let newobj={ + creator:"合计:", + shixun_name:data.shixun_count, + myshixuns_count:data.total_myshixun_count, + forked_myshixun_count:data.total_forked_myshixun_count, + valid_count:data.total_valid_count, + score:data.total_shixun_score + } + newarr.push(newobj) + + this.setState({ + shixundata:newarr + }) + + + } + }) + .catch(function (error) { + console.log(error); + }); + + + + + } + + getcoursedata=()=>{ + const Url =`/competitions/${this.props.match.params.identifier}/competition_teams/${this.props.match.params.competition_team_id}/course_detail.json`; + + axios.get(Url).then((response) => { + if(response.status===200){ + // let data={ + // courses: [ + // { + // creator: "周海芳", // 创建者 + // creator_login: "Nancy", // login + // course_name: "大学计算机基础2018年秋季", + // course_id: 1502, + // students_count: 122, // 学生数量 + // shixun_homework_count: 8, // 发布的实训作业数量 + // valid_count: 977, // 有效作品数 + // score: 29810 // 应用值 + // } + // ], + // total_course_count: 1, // 课堂总计 + // total_students_count: 122, // 学生数总计 + // total_shixun_homework_count: 8, // 实训作业数总计 + // total_valid_count: 977, // 有效作品数总计 + // total_course_score: 29810 // 应用值总计 + // } + + let data=response.data; + + let newarr=data.courses; + + let newobj={ + creator:"合计:", + course_name:data.total_course_count, + students_count:data.total_students_count, + shixun_homework_count:data.total_shixun_homework_count, + valid_count:data.total_valid_count, + score:data.total_course_score + } + newarr.push(newobj) + + this.setState({ + coursedata:newarr + }) + + } + }) + .catch(function (error) { + console.log(error); + }); + + + } + + render() { + let {data}=this.state; + const shixuncolumns = [ + { + title: '创建者', + dataIndex: 'creator', + key: 'creator', + render: (text, record) =>
{text}
, + }, + { + title: '名称', + dataIndex: 'shixun_name', + key: 'shixun_name', + render: (text, record) => +
{text}{record.forked===true?:""}
, + }, + { + title: '学习人数', + dataIndex: 'myshixuns_count', + key: 'myshixuns_count', + render: (text, record) =>
{text}
, + }, + { + title: '被fork发布的学习人数', + dataIndex: 'forked_myshixun_count', + key: 'forked_myshixun_count', + render: (text, record) => + +
{text}
+
, + }, + { + title: '有效作品数', + dataIndex: 'valid_count', + key: 'valid_count', + render: (text, record) => + +
{text}
+
, + }, + { + title: '应用值', + dataIndex: 'score', + key: 'score', + render: (text, record) =>
{text}
, + }, + ]; + + const coursecolumns = [ + { + title: '创建者', + dataIndex: 'creator', + key: 'creator', + render: (text, record) =>
{text}
, + }, + { + title: '名称', + dataIndex: 'course_name', + key: 'course_name', + render: (text, record) =>
{text}
, + }, + { + title: '学生数量', + dataIndex: 'students_count', + key: 'students_count', + render: (text, record) =>
{text}
, + }, + { + title: '发布的实训作业数量', + dataIndex: 'shixun_homework_count', + key: 'shixun_homework_count', + render: (text, record) => +
{text}
+ , + }, + { + title: '有效作品数', + dataIndex: 'valid_count', + key: 'valid_count', + render: (text, record) => + +
{text}
+
, + }, + { + title: '应用值', + dataIndex: 'score', + key: 'score', + render: (text, record) =>
{text}
, + }, + ]; + + + // console.log(this.state.shixundata) + return ( + +
+ + {data&&data.name} + 报名 + 战队详情 + + + + + 实训项目 + + + + 翻转课堂 + +
+ + + + + + + + + ) + } +} +export default Competitionteams; diff --git a/public/react/src/modules/courses/competitions/Competitioncommon/CompetitionCommon.css b/public/react/src/modules/courses/competitions/Competitioncommon/CompetitionCommon.css new file mode 100644 index 000000000..984498203 --- /dev/null +++ b/public/react/src/modules/courses/competitions/Competitioncommon/CompetitionCommon.css @@ -0,0 +1,438 @@ +.teamsLayout{background: transparent !important;} + +.teamsLayout .ant-layout-sider{ + background: transparent !important; + flex: 0 0 180px !important; + max-width: 180px !important; + min-width: 180px !important; + width: 180px !important; +} +.teamsLayout .teamsLayoutitle{ + font-size:18px; + font-family:PingFangSC-Semibold,PingFang SC; + font-weight:600; + color:rgba(5,16,26,1); + line-height:25px; + margin-top: 10px; + margin-bottom: 10px; +} +.teamsLayoutTable .ant-table-bordered .ant-table-thead > tr > th, .ant-table-bordered .ant-table-tbody > tr > td { + border-right: 1px solid transparent !important; +} + +.teamsLayoutTable .ant-table-body .ant-table-thead > tr> th:nth-last-child(1){ + border-right: 1px solid #e8e8e8 !important; +} + +.teamsLayoutTable .ant-table-body .ant-table-tbody > tr> td:nth-last-child(1){ + border-right: 1px solid #e8e8e8 !important; +} + +.teamsLayoutTable .ant-table-bordered .ant-table-thead > tr > th{ + background:#EEEEEE; + font-size: 14px; + font-family: PingFangSC-Regular,PingFang SC; + font-weight: 400; + color: rgba(102,102,102,1); + line-height: 20px; +} + +.teamsLayoutTable .ant-table-bordered .ant-table-tbody > tr > th{ + background:#EEEEEE; + font-size:14px; + font-family:PingFangSC-Regular,PingFang SC; + font-weight:400; + color:rgba(5,16,26,1); + line-height:20px; +} + +.teamsLayout .mt40{ + margin-top: 40px !important; +} + +.teamsLayoutheji{ + color: #878787; + font-size: 16px; +} + +.teamsLayoucolor-orange { + color: #ff6800 !important; + font-size: 16px; +} + +.CompetitionCommonbanner{ + padding: 20px; + background:rgba(255,255,255,1); + box-shadow:3px 2px 12px 2px rgba(0,0,0,0.05); + position: relative; +} + +.CompetitionCommonbannerfont{ + height:100%; + width: 365px !important; + line-height: 34px; +} + +.CompetitionCommonbannerfont .competitionbannerdiv:nth-child(1){ + max-height:100px; + font-size:25px; + font-weight:400; + color:rgba(5,16,26,1); + line-height: 30px; +} + +.CompetitionCommonbannerfont .competitionbannerdiv:nth-child(2){ + max-height: 70px; + font-size:16px; + font-weight:400; + /*color:rgba(155,155,155,1);*/ + color:#05101A; +} + +.CompetitionCommonbannerfont .competitionbannerdiv:nth-child(3){ + max-height: 70px; + font-size: 16px; + font-weight: 400; + /*color: rgba(155,155,155,1);*/ + color:#05101A; +} + + + +.Competitioncolor9b{ + color: #9B9B9B; +} + +.Competitioncolor77{ + color: #777777; + font-size: 14px; +} + +.Competitioncolor516{ + font-size:24px; + color:rgba(5,16,26,1); +} + +.Competitionfontsize22{ + font-size:22px; + font-weight:500; + color:rgba(255,255,255,1); +} + +.Competitionfontsize16{ + font-size: 16px; + font-weight: 400; + color: rgba(102,102,102,1); +} + +.ant-layout-sider { + position: relative; + min-width: 0; + background: #001529; + -webkit-transition: all 0.2s; + -o-transition: all 0.2s; + transition: all 0.2s; +} + +.CompetitionMenu .ant-menu-item::after { + left: 0px !important; + right: auto; + border-right: 5px solid #4CACFF; +} + +.CompetitionMenu .ant-menu-item{ + height: 30px; + line-height: 30px; + background:none; + color:#666; +} + +.ant-menu:not(.ant-menu-horizontal) .ant-menu-item-selected { + background-color: transparent; +} + +.CompetitionMenu .ant-menu-item:not(:last-child){ + margin-bottom: 40px; + background: transparent; + color:#666; +} + +.CompetitionMenu .ant-menu-item{ + font-size: 18px; +} + +.CompetitionMenu .ant-menu-item-selected { + color: rgba(76,172,255,1) !important; +} + +.CompetitionMenu{ + width: 145px; + background: #fff; + border: 1px solid rgba(239,239,239,1); + padding-top: 20px; + padding-bottom: 40px !important; +} + +.teamsLayoutleft{ + background: transparent !important; +} + +.Competitioncharts{ + font-size: 24px; + color: rgba(5,16,26,1); +} +.Competitionfirst{ + width:233px; + height:298px; + background:rgba(250,250,250,1); + box-shadow:0px 2px 8px 2px rgba(255,134,34,0.5); + border-radius:5px; +} +.Competitionsecondary{ + width:234px; + height:298px; + background:rgba(250,250,250,1); + box-shadow:0px 3px 5px 0px rgba(254,190,154,1); + border-radius:5px; +} + +.Competitionthird{ + width: 234px; + height: 298px; + background: rgba(250,250,250,1); + box-shadow: 0px 4px 5px 0px rgba(200,200,202,1); + border-radius: 5px; +} + +.Competition399{ + height:399px; +} + +.Competitiontransparent table{ + background: transparent; +} + +.Commonimg{ + position: absolute; + right: -5px; + width:93px; + top: 10px; +} + +.Competitionthirdbox{ + width:234px; + height:167px; + background:rgba(223,223,225,1); + position: relative; +} + +.Competitionfirstbox{ + width:233px; + height:167px; + background:rgba(255,231,160,1); + position: relative; +} + +.Competitionsecondarybox{ + width:234px; + height:167px; + background:rgba(253,230,217,1); + position: relative; +} + +.rankingimg{ + width: 60px; + height: 60px; + border-radius: 50% !important; + box-shadow: 0px 0px 12px rgba(0,0,0,0.2); + border: 2px solid #459BE5; +} + +.Competitioncenter{ + text-align: center; + padding-top: 20px; +} + + +.jinshaifont{ + font-size: 16px; + color: rgba(5,16,26,1); + margin-top: 13px !important; +} + +.Competitionthird .ant-card-body { + padding: 12px; + zoom: 1; +} + +/*.Competitionthird .ant-card-meta-title{*/ + /*margin-bottom: 0px !important;*/ +/*}*/ + +.Competitionfirst .ant-card-body { + padding: 12px; + zoom: 1; +} + +.Competitionsecondary .ant-card-body { + padding: 12px; + zoom: 1; +} + +.center{ + text-align: center; +} + +.rankfonttop{ + font-size:14px; + color:rgba(102,102,102,1); +} + +.rankfontmid{ + font-size:18px; + color:rgba(102,102,102,1); +} + +.rankfontbottom{ + font-size:26px; + color:rgba(165,91,41,1); + text-align: center; +} + +.rankfontbottoms{ + font-size:28px; + color:rgba(165,91,41,1); + text-align: center; +} + +.Competitionuserimg{ + width: 64px; + height: 63px; + border-radius: 50%; + border: 2px solid #459BE5; +} + +.CompetitionsListzhezhao{ + position: absolute; + top: 0px; + left: 0px; + width: 1206px; + height: 100%; + z-index: 10000; + display: none; + background: rgba(0,0,0,0.33); + text-align: center; + color: #fff; + font-size: 22px; + +} + +.relative{position: relative;} + +.relative:hover .CompetitionsListzhezhao{ + display: block; + display: flex; + align-items: center; + justify-content: space-around; + flex-direction: column; +} + +.image_urlbox{ + width: 790px; + height: 340px; +} + +.CompetitionContents{ + background: #fff !important; + padding: 40px; + box-shadow: 3px 2px 12px 2px rgba(0,0,0,0.05); + border: 1px solid rgba(239,239,239,1); +} + +.rankbeicenter{ + text-align: center; +} +.rankbei{ + font-size: 16px; + color: rgba(119,119,119,1); + +} + +.youranklist{ + background: rgba(226,241,255,1); + line-height: 50px; + text-align: center; + padding-left: 20px; +} + +.ranknames{ + font-size: 16px; + color: rgba(62,62,62,1); +} + +.ranknameslast{ + font-size:16px; + color:rgba(12,158,254,1); +} + +.textleft{ + text-align: left; +} + +.textright{ + text-align: right; +} + +.userranksclass{ + text-align: left; + width: 18%; + padding-left: 12px; + margin-right: 28px; +} + +.Commonimgbox{ + width: 800px !important; +} + +.CompetitionCommonbannerfont{ + width: 350px !important; + margin-left:10px; +} + +.color000{ + color: #000; +} + +.cursorpointer{ + cursor: pointer; +} + +.rankfonttop{ + overflow:hidden; + text-overflow:ellipsis; + white-space:nowrap +} + +.usernamebox{ + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + cursor: default; + max-width: 100px; + display: inherit; +} + +.competimgabsolute{ + position: absolute; + left: 72px; + bottom: -10px; +} +.competimgabsolute .ant-badge-count{ + box-shadow: none !important; +} + +.competimgabsoluteijmg{ + position: absolute; + left: -11px; + bottom: 0px; +} \ No newline at end of file diff --git a/public/react/src/modules/courses/competitions/Competitioncommon/CompetitionCommon.js b/public/react/src/modules/courses/competitions/Competitioncommon/CompetitionCommon.js new file mode 100755 index 000000000..b2ac34fe1 --- /dev/null +++ b/public/react/src/modules/courses/competitions/Competitioncommon/CompetitionCommon.js @@ -0,0 +1,548 @@ +import React, { Component } from 'react'; +import { Breadcrumb,Layout,Table, Divider, Tag,Badge,Row, Col,Button, Menu, Icon} from 'antd'; +import { Link } from 'react-router-dom'; +import axios from 'axios'; +import {markdownToHTML,getImageUrl} from 'educoder'; +import CompetitionContents from './CompetitionCommonChild/CompetitionContents'; +import CompetitionContentsChart from './CompetitionCommonChild/CompetitionContentsChart'; +import CompetitionContentsMd from './CompetitionCommonChild/CompetitionContentsMd'; +import CompetitionContentspdf from './CompetitionCommonChild/CompetitionContentspdf'; + +import './CompetitionCommon.css'; + +const {Sider } = Layout; + +class CompetitionCommon extends Component{ + constructor(props) { + super(props) + this.state={ + data: undefined, + bannerdata: undefined, + module_type: undefined, + mdContentdata: undefined, + chart_rules: undefined, + Competitionedittype: false, + chartdata: undefined, + has_url: false, + signupdata: undefined + } + } + + componentDidMount(){ + window.document.title = '竞赛'; + if(this.props.match.params.identifier!=null){ + this.getbannerdata(); + // this.setState({ + // thiskeys:this.props.location.search.replace('?menu=', '') + // }) + // 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) + // }) + } + } + + componentDidUpdate = (prevProps) => { + if (prevProps.user != this.props.user) { + + //console.log("componentDidUpdatess"); + //console.log(this.props.user); + if (this.props.user && this.props.user.login != "") { + const zul = `/competitions/${this.props.match.params.identifier}/competition_staff.json`; + axios.get((zul)).then((result) => { + if (result) { + if (result.data) { + this.setState({ + signupdata: result.data + }) + } + } + }).catch((error) => { + ////console.log(error); + }) + } + } + + } + //获取头部信息 + getbannerdata=()=>{ + // let menuid=this.props.location.search.replace('?menu=', ''); + let query=this.props.location&&this.props.location.search; + const types = query.split('&') + const menuid = types[0].split('?menu=') + let url=`/competitions/${this.props.match.params.identifier}/common_header.json`; + axios.get(url).then((response) => { + if(response.status===200){ + this.setState({ + data: response.data, + thiskeys: menuid[1] === undefined || menuid[1] === "" ? response.data.competition_modules[0].id : menuid[1], + mode: response.data.mode + }) + if(menuid[1]===undefined||menuid[1]===""){ + 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 + ) + }else{ + let newlist=response.data.competition_modules; + newlist.map((item,key)=>{ + if(`${item.id}`===`${menuid[1]}`){ + this.getrightdata( + item.id, + item.module_type, + item.module_url, + item.has_url + ) + } + }) + } + } + }).catch((error) => { + //console.log(error) + }) + + //this.props.user 有可能为空 + + if (this.props.user && this.props.user.login != "") { + const zul = `/competitions/${this.props.match.params.identifier}/competition_staff.json`; + axios.get((zul)).then((result) => { + if (result) { + if (result.data) { + this.setState({ + signupdata: result.data + }) + } + } + }).catch((error) => { + ////console.log(error); + }) + } + + } + + getrightdatas=(e)=>{ + let keys = parseInt(e.key); + this.getlistdata(keys) + this.props.history.replace(`?menu=${keys}`); + } + + getlistdata=(keys,listkey)=>{ + + let{data}=this.state; + this.setState({ + thiskeys:keys + }) + data&&data.competition_modules.map((item,key)=>{ + if(item.module_type!="enroll") { + if (keys === item.id) { + this.getrightdata(item.id, item.module_type, item.module_url, item.has_url, listkey) + return + } + } + }) + } + + getnewchartdata=(typeid,tabkey)=>{ + if(typeid==="chart"){ + let url=`/competitions/${this.props.match.params.identifier}/chart_rules.json`; + axios.get(url) + .then((response) => { + if(response.status===200){ + this.setState({ + chart_rules:response.data, + tabkey: tabkey === undefined ? response.data.stages[0].id === null ? "0" : `${response.data.stages[0].id}` : tabkey + }) + + + } + }).catch((error) => { + //console.log(error) + }) + } + } + + getrightdata=(id,typeid,module_url,has_url,listkey)=>{ + + // if(typeid==="enroll"){ + // this.props.history.replace(`/competitions/${this.props.match.params.identifier}/enroll`); + // return + // } + + this.getnewchartdata(typeid, listkey) + + if(has_url===false){ + let url=`${module_url}`; + axios.get(url).then((response) => { + if(response.status===200){ + + if(typeid==="chart"){ + this.setState({ + chartdata:response.data + }) + }else{ + this.setState({ + mdContentdata:response.data + }) + } + + } + }).catch((error) => { + //console.log(error) + }) + }else{ + if (module_url.substring(0, 7) == 'http://' || module_url.substring(0, 8) == 'https://') { + // window.location.href= module_url + window.open(module_url) + }else{ + window.open(`https://${module_url}`) + // window.location.href=; + } + return + } + + this.setState({ + module_id:id, + module_type:typeid, + has_url:has_url + }) + + } + + Competitionedit=()=>{ + this.setState({ + Competitionedittype: true + }) + } + + hideCompetitionedit=()=>{ + this.setState({ + Competitionedittype:false + }) + + } + newgotocourse=(url)=>{ + if(this.props.checkIfLogin()===false){ + this.props.showLoginDialog() + return + } + if(this.props.checkIfProfileCompleted()===false){ + this.props.showProfileCompleteDialog() + return + } + window.open(url); + + } + + gotocourse=(url)=>{ + if(this.props.checkIfLogin()===false){ + this.props.showLoginDialog() + return + } + if(this.props.checkIfProfileCompleted()===false){ + this.props.showProfileCompleteDialog() + return + } + + if(url===undefined){ + let {data,signupdata}=this.state; + // if(signupdata.enrolled===true){ + // this.props.history.replace(`/courses/${data.course_id}`); + // }else{ } + + if (data.member_of_course === true) { + // this.props.history.replace(`/courses/${data.course_id}`); + window.open(`/courses/${data.course_id}`) + } else { + // 以学生身份调用加入课堂 进入课堂首页 + let url = "/courses/apply_to_join_course.json" + axios.post(url, { + invite_code: data.invite_code, + student: 1 + } + ).then((response) => { + if (response.data.status === 0) { + // this.props.history.replace(); + this.getbannerdata() + window.open(`/courses/${data.course_id}`); + + } + }) + + } + + }else{ + + if (url === "personal") { + let urls = `/competitions/${this.props.match.params.identifier}/enroll`; + this.Personalregistration(urls) + } else { + window.open(url); + } + + } + } + + + Personalregistration = (urls) => { + + let {signupdata} = this.state; + + if (signupdata.enroll_ended === true) { + //已截止 + this.props.showNotification(`报名已截止`); + return; + } + if (signupdata.enrolled === true) { + 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.props.history.replace(urls); + this.getbannerdata() + window.open(urls) + } + } + }).catch((error) => { + + }); + } + + + Competitioncallback=(key)=>{ + this.setState({ + tabkey:key + }) + let url=`/competitions/${this.props.match.params.identifier}/charts.json`; + axios.get(url,{params:{ + stage_id:key===0||key===null?undefined:key + }}).then((response) => { + if(response.status===200){ + this.setState({ + chartdata:response.data + }) + } + }).catch((error) => { + //console.log(error) + }) + + } + + + render() { + let {data, module_type, Competitionedittype, signupdata} = this.state; + + return ( + data===undefined?"":
+ + + 在线竞赛 + {data && data.name} + + +
+ + + {data.competition_status === "nearly_published" ? + data && data.permission.editable === true ? "" : +
即将发布 敬请期待
: ""} + +
+ + + + + 15 ? "competitionbannerdiv mt30" : "competitionbannerdiv mt30"}>{data && data.name} + + + 竞赛时间:{data && data.start_time}~{data && data.end_time} + {/**/} + + + + + +
奖金
+ + +
浏览数
+ + +
报名数
+ + + + + +
¥{data && data.bonus}
+ + +
{data.competition_status === "nearly_published" ? "--" : data && data.visits_count}
+ + + + {data.competition_status === "ended" ? +
this.gotocourse(`/competitions/${this.props.match.params.identifier}/enroll`)} + onClick={ data.mode === 2 ?data.member_of_course==true?() => this.newgotocourse(`/courses/${data.course_id}`):"":() => this.newgotocourse(`/competitions/${this.props.match.params.identifier}/enroll`)} + >{data && data.member_count}
+ :data.competition_status === "nearly_published" ? +
this.gotocourse(`/competitions/${this.props.match.params.identifier}/enroll`)} + >{"--"}
: + data.competition_status === "progressing" ? + data.mode === 2 ? +
this.gotocourse()}>{data && data.member_count}
: signupdata && signupdata.personal === true ? +
this.gotocourse("personal")}>{data && data.member_count}
:
this.gotocourse(`/competitions/${this.props.match.params.identifier}/enroll`)}>{data && data.member_count}
+ :""} + + + + + + {data.competition_status === "ended" ? : } + + {data.competition_status === "ended" ? + : data.enroll_end === true ? + : + data.competition_status === "progressing" ? + :""} + + {data && data.enroll_end_time === null ? "" : `报名截止时间:${data && data.enroll_end_time}`} + + + + + + + this.getrightdatas(e)}> + {data && data.competition_modules.map((item, key) => { + if (item.module_type != "enroll") { + return ( + + {/*{item.has_url===false?this.getrightdata(item.id,item.module_type,item.module_url,item.has_url)}*/} + {/*>{item.name}:this.getrightdata(item.id,item.module_type)}*/} + {/*>{item.name}}*/} + {item.name} + + ) + } + })} + + + {/*this.isdownloadpdf(e)}>*/} + {/**/} + {/*证书下载*/} + {/**/} + {/**/} + + + {module_type === "certificate" ? "" : + {this.state.module_type === "chart" ? Competitionedittype === false ? this.Competitionedit()} + Competitioncallback={(e) => this.Competitioncallback(e)} + /> : "" : Competitionedittype === false ? this.Competitionedit()} + {...this.props} + {...this.state} + /> : ""} + {/**/} + {Competitionedittype === true ? this.hideCompetitionedit()} + getlistdata={(keys, listkey) => this.getlistdata(keys, listkey)} + Competitioncallback={(e) => this.Competitioncallback(e)} + {...this.props} + {...this.state} + /> : ""} + } + + {module_type === "certificate" ? + + : ""} + + + + + ) + } +} +export default CompetitionCommon; diff --git a/public/react/src/modules/courses/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContents.js b/public/react/src/modules/courses/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContents.js new file mode 100644 index 000000000..62c7140cd --- /dev/null +++ b/public/react/src/modules/courses/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContents.js @@ -0,0 +1,45 @@ +import React, { Component } from 'react'; +import {Button,Layout} from 'antd'; +import axios from 'axios'; +import {markdownToHTML,getImageUrl,AttachmentList} from 'educoder'; + + +const { Header, Footer, Sider, Content } = Layout; +class CompetitionContents extends Component{ + constructor(props) { + super(props) + this.state={ + hash:undefined + } + } + + componentDidMount(){ + window.document.title = '竞赛'; + this.props.MdifHasAnchorJustScorll(); + } + + render() { + let {mdContentdata, data} = this.props; + //mdhash滚动 + this.props.MdifHasAnchorJustScorll(); + return ( + +
+ {data && data.permission.editable === true ? this.props.Competitionedittype === false ? this.props.has_url === false ? + :"":"":""} +
+ + + +
+ +
+
+
+ + ) + } +} +export default CompetitionContents; diff --git a/public/react/src/modules/courses/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentsChart.js b/public/react/src/modules/courses/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentsChart.js new file mode 100644 index 000000000..420f83ff1 --- /dev/null +++ b/public/react/src/modules/courses/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentsChart.js @@ -0,0 +1,423 @@ +import React, { Component } from 'react'; +import {Button,Layout,Tabs,Icon, Card, Avatar, Row, Col ,Table,Badge} from 'antd'; +import {markdownToHTML,getImageUrl} from 'educoder'; +import axios from 'axios'; + +const { Content } = Layout; +const { TabPane } = Tabs; +const { Meta } = Card; + +class CompetitionContents extends Component{ + constructor(props) { + super(props) + this.state={ + personal:undefined + } + } + + componentDidMount(){ + window.document.title = '竞赛'; + let url=`/competitions/${this.props.match.params.identifier}/competition_staff.json`; + axios.get(url) + .then((response) => { + if(response.status===200){ + console.log(response) + this.setState({ + personal:response.data.personal + }) + } + }).catch((error) => { + console.log(error) + }) + this.props.MdifHasAnchorJustScorll(); + } + + derivefun=(url)=>{ + axios.get(url).then((response)=>{ + if(response === undefined){ + return + } + if(response.data.status&&response.data.status===-1){ + this.props.showNotification(response.data.message); + }else if(response.data.status&&response.data.status===-2){ + // if(response.data.message === "100"){ + // // 已超出文件导出的上限数量(100 ),建议: + // + // this.setState({ + // DownloadType:true, + // DownloadMessageval:100 + // }) + // }else { + // //因附件资料超过500M + // this.setState({ + // DownloadType:true, + // DownloadMessageval:500 + // }) + // } + this.props.showNotification(response.data.message); + }else { + // this.props.showNotification(`正在下载中`); + // window.open("/api"+url, '_blank'); + this.props.slowDownload(url); + } + }).catch((error) => { + console.log(error) + }); + } + render() { + this.props.MdifHasAnchorJustScorll(); + const operations =
+ + +
+ const columns = [ + { + title: 'usersum', + dataIndex: 'usersum', + key: 'name', + render: text => {text}, + }, + { + title: 'userimg', + dataIndex: 'userimg', + key: 'userimg', + render: (text, record) =>( + +
+ +
+
+
), + }, + { + title: 'username', + dataIndex: 'username', + key: 'username', + render: text => {text}, + }, + { + title: 'school', + dataIndex: 'school', + key: 'school', + render: text => {text}, + }, + { + title: 'spendtime', + dataIndex: 'spendtime', + key: 'spendtime', + render: text => {text}, + }, + { + title: 'score', + dataIndex: 'score', + key: 'score', + render: text => {text}, + }, + ]; + + const datas = []; + let {chart_rules, chartdata, data} = this.props; + let {personal}=this.state; + + if(this.props&&this.props.mode!=1){ + + columns.some((item,key)=> { + if (item.title === "spendtime") { + columns.splice(key, 1) + return true + } + } + ) + + } + + {chartdata===undefined?"":chartdata.teams.length===0?"":chartdata.teams.map((item,key)=>{ + let list={ + usersum:key+1, + userimg:item.user_image, + username:personal===undefined||personal===null?item.record_user_name:personal===true?item.record_user_name:item.team_name, + school:item.school_name, + spendtime:item.spend_time, + score:item.score<50?"< 50 分":item.score, + user_login:item.user_login, + competition_prize:item.competition_prize + } + datas.push(list) + })} + + // console.log(this.props&&this.props.mode) + // console.log(columns) + + return ( +
+ + {chart_rules === undefined ? "" : + this.props.Competitioncallback(e)} activeKey={this.props.tabkey} + tabBarExtraContent={data && data.permission.editable === true ? this.props.Competitionedittype === false ? this.props.has_url === false ? operations : "" : "" : ""}> + {chart_rules.stages.map((item,key)=>{ + return( + + {chart_rules.rule_contents.map((items,keys)=>{ + if(item.id===items.competition_stage_id){ + return( + + ) + }else if(item.id===null&&items.competition_stage_id===0){ + return( + + ) + } + })} + + ) + })} + } + + +
总排名 + {chartdata===undefined?"":chartdata.teams.length===0?+ +
要抓住一切机会,向所有人证明你自己,证明你能够迎接荣耀
+ :""} + + {chartdata===undefined?"":chartdata.teams.length===0?"":chartdata.teams.map((item,key)=>{ + + + if(key===1){ + return( + + +
  • + + +
  • + + } + > + +
    {item.school_name}
    + {this.props&&this.props.mode===1?
    {item.spend_time}
    :""} + } + description={ +
    {item.score<50?"< 50 分":item.score}分
    + } + /> +
    + + + ) + } + + })} + {chartdata===undefined?"":chartdata.teams.length===0?"":chartdata.teams.map((item,key)=>{ + if(key===0){ + return( + + +
  • + + +
  • + + } + > + +
    {item.school_name}
    + {this.props&&this.props.mode===1?
    {item.spend_time}
    :""} + } + description={ +
    {item.score<50?"< 50 分":item.score}分
    + } + + /> +
    + + + ) + } + })} + {chartdata===undefined?"":chartdata.teams.length===0?"":chartdata.teams.map((item,key)=>{ + if(key===2){ + return( + + +
  • + + +
  • + + } + > + +
    {item.school_name}
    + {this.props&&this.props.mode===1?
    {item.spend_time}
    :""} + } + description={ +
    {item.score<50?"< 50 分":item.score}分
    + } + + /> +
    + + ) + } + + + + })} + + + {chartdata===undefined?"":chartdata.user_ranks.length===0?"":
    + + {chartdata.user_ranks.map((item,key)=>{ + + return( + +
    + 您当前排名:{item.rank} + + + {personal===undefined||personal===null?item.record_user_name:personal===true?item.user_name:item.team_name} + + + {/*{item.team_name}*/} + + {item.cost_time=== "--"?+ {this.props&&this.props.mode===1?item.cost_time:""} + :+ {this.props&&this.props.mode===1?item.cost_time:""} + } + {item.cost_time=== "--"?+ {item.score<50?"< 50 分":item.score} + :+ {item.score<50?"< 50 分":item.score} + } + + ) + })} + } + + + {chartdata === undefined ? "" : chartdata.teams.length === 0 ? "" : +
    } + + + + + + ) + } +} +export default CompetitionContents; diff --git a/public/react/src/modules/courses/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentsMd.js b/public/react/src/modules/courses/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentsMd.js new file mode 100644 index 000000000..049f2bab1 --- /dev/null +++ b/public/react/src/modules/courses/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentsMd.js @@ -0,0 +1,232 @@ +import React, { Component } from 'react'; +import {Button, Card, Row, Col ,Upload,Icon,message,Tabs} from 'antd'; +import axios from 'axios'; +import {getImageUrl,getUrl,appendFileSizeToUploadFileAll,appendFileSizeToUploadFile} from 'educoder'; +import TPMMDEditor from '../../../tpm/challengesnew/TPMMDEditor'; +const { TabPane } = Tabs; +class CompetitionContentsMd extends Component{ + constructor(props) { + super(props) + this.contentMdRef = React.createRef(); + this.state={ + contentFileList:[], + chartmodule_id:undefined + } + } + componentDidUpdate =(prevState)=>{ + if(prevState!=this.props){ + this.getchartdata(); + } + } + componentDidMount(){ + window.document.title = '竞赛'; + + this.getchartdata() + } + + getchartdata=()=>{ + let {mdContentdata,chart_rules}=this.props; + + // is_pdf: false + if(this.props.module_type==="chart"){ + let type=true; + if(chart_rules===undefined){ + + }else{ + chart_rules.rule_contents.map((items,keys)=>{ + debugger + if(parseInt(this.props.tabkey)===items.competition_stage_id){ + console.log(items) + this.contentMdRef.current.setValue(items.content); + this.setState({ + contentFileList:undefined, + chartmodule_id:items.id + }) + type=false; + } + }) + + if(type===true){ + this.contentMdRef.current.setValue(""); + this.setState({ + contentFileList:undefined, + chartmodule_id:undefined + }) + + } + } + + + }else{ + let contentFileList = mdContentdata===undefined?[]:mdContentdata.attachments===undefined?[]:mdContentdata.attachments.map((item) => { + return { + id: item.id, + uid: item.id, + name: appendFileSizeToUploadFile(item), + url: item.url, + filesize: item.filesize, + status: 'done', + response:{id: item.id} + } + }) + this.setState({ + contentFileList:contentFileList + }) + this.contentMdRef.current.setValue(mdContentdata===undefined?"":mdContentdata.md_content===undefined?"":mdContentdata.md_content || '') + + } + } + + handleContentUploadChange = (info) => { + if (info.file.status === 'uploading' || info.file.status === 'done' || info.file.status === 'removed') { + let contentFileList = info.fileList; + this.setState({ contentFileList: appendFileSizeToUploadFileAll(contentFileList) }); + } + + } + + onAttachmentRemove = (file, stateName) => { + if(file.response!=undefined){ + this.props.confirm({ + content: '是否确认删除?', + + onOk: () => { + this.deleteAttachment(file, stateName) + }, + onCancel() { + console.log('Cancel'); + }, + }); + return false; + } + + } + deleteAttachment = (file, stateName) => { + // 初次上传不能直接取uid + const url = `/attachments/${file.response ? file.response.id : file.uid}.json` + axios.delete(url, { + }) + .then((response) => { + if (response.data) { + const { status } = response.data; + if (status == 0) { + console.log('--- success') + this.props.showNotification(response.data.message); + this.setState((state) => { + const index = state[stateName].indexOf(file); + const newFileList = state[stateName].slice(); + newFileList.splice(index, 1); + return { + [stateName]: newFileList, + }; + }); + } + } + }) + .catch(function (error) { + console.log(error); + }); + } + handleSubmit = () => { + let {contentFileList}=this.state; + const mdContnet = this.contentMdRef.current.getValue().trim(); + // if(mdContnet.length>10000){ + // this.props.showNotification("内容超过10000个字"); + // return + // } + let attachment_ids=undefined + if(contentFileList!=undefined){ + attachment_ids= contentFileList.map(item => { + return item.response ? item.response.id : item.id + }) + } + + let newstage_id=parseInt(this.props.tabkey)===0||null?undefined:parseInt(this.props.tabkey) + let data={} + if(this.props.module_type==="chart"){ + data={ + md_content_id:this.state.chartmodule_id, + competition_module_id:this.props.module_id, + stage_id:newstage_id, + content:mdContnet, + } + }else{ + data={ + md_content_id:this.props.mdContentdata.md_id, + competition_module_id:this.props.mdContentdata.id, + content:mdContnet, + attachment_ids:attachment_ids + } + } + + let url=`/competitions/${this.props.match.params.identifier}/update_md_content.json`; + axios.post(url,data + ).then((response) => { + if(response.data.status===0){ + this.props.showNotification(response.data.message); + this.props.getlistdata(this.props.thiskeys,this.props.tabkey); + this.props.hideCompetitionedit(); + }else{ + this.props.showNotification(response.data.message); + } + }).catch((error) => { + console.log(error) + }) + + } + render() { + let {contentFileList}=this.state; + let {chart_rules}=this.props; + const uploadProps = { + width: 600, + fileList: contentFileList, + multiple: true, + // https://github.com/ant-design/ant-design/issues/15505 + // showUploadList={false},然后外部拿到 fileList 数组自行渲染列表。 + // showUploadList: false, + action: `${getUrl()}/api/attachments.json`, + onChange: this.handleContentUploadChange, + onRemove: (file) => this.onAttachmentRemove(file, 'contentFileList'), + beforeUpload: (file) => { + console.log('beforeUpload', file.name); + const isLt150M = file.size / 1024 / 1024 < 150; + if (!isLt150M) { + this.props.showNotification("文件大小必须小于150MB"); + } + return isLt150M; + }, + }; + // console.log(this.props.tabkey) + // console.log(chart_rules) + console.log(this.props.mdContentdata) + return ( +
    + {chart_rules===undefined?"":this.props.module_type==="chart"?this.props.Competitioncallback(e)}> + + {chart_rules.stages.map((item,key)=>{ + return( + + ) + })} + + :""} + + {this.props.module_type==="chart"?"": + + (单个文件150M以内) + } + +
    + {/* htmlType="submit" */} + + this.props.hideCompetitionedit()}>取消 +
    +
    + + ) + } +} +export default CompetitionContentsMd; \ No newline at end of file diff --git a/public/react/src/modules/courses/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdf.js b/public/react/src/modules/courses/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdf.js new file mode 100644 index 000000000..218e8497f --- /dev/null +++ b/public/react/src/modules/courses/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdf.js @@ -0,0 +1,64 @@ +import React, { Component } from 'react'; +import {Tabs} from 'antd'; +import axios from 'axios'; +import {markdownToHTML,getImageUrl,AttachmentList} from 'educoder'; +import CompetitionContentspdfdownload from './CompetitionContentspdfChild/CompetitionContentspdfdownload'; +import CompetitionContentspdfpeopledata from './CompetitionContentspdfChild/CompetitionContentspdfpeopledata'; +// import NoneData from "../../../courses/shixunHomework/shixunHomework"; + +const { TabPane } = Tabs; +class CompetitionContentspdf extends Component{ + constructor(props) { + super(props) + this.state={ + Tabskey:"1" + } + } + + componentDidMount(){ + window.document.title = '竞赛'; + let query=this.props.location&&this.props.location.search; + const types = query.split('user_id=') + if(types[1]===undefined){ + }else{ + this.setState({ + Tabskey:"2" + }) + } + } + + Competitioncallback=(key)=>{ + this.setState({ + Tabskey:key + }) + } + + render() { + + + return ( + +
    +
    + this.Competitioncallback(e)} activeKey={this.state.Tabskey}> + + {this.state.Tabskey==="1"?this.Competitioncallback(e)} + />:""} + + + {this.state.Tabskey==="2"?:""} + + +
    +
    + + ) + } +} +export default CompetitionContentspdf; diff --git a/public/react/src/modules/courses/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/Bankcardnumberverification.js b/public/react/src/modules/courses/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/Bankcardnumberverification.js new file mode 100644 index 000000000..d48ea8fe2 --- /dev/null +++ b/public/react/src/modules/courses/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/Bankcardnumberverification.js @@ -0,0 +1,292 @@ +import React, {Component} from 'react'; +import {Button, Layout, Input, Form} from 'antd'; +import axios from 'axios'; +import {getImageUrl} from 'educoder'; +import mycompetotionchild from './mycompetotionchild.css'; +import {getHiddenName} from "../../../../user/account/AccountBasicEdit"; +import '../../../../courses/css/Courses.css' + +export const identityMap = {"teacher": "教师", "student": "学生", "professional": "专业人士"} + +class Bankcardnumberverification extends Component { + constructor(props) { + super(props) + this.state = { + basicInfo: {}, + updating: '', + secondsFlag: false, + seconds: 60, + phonebool: false, + emailbool: false, + formationdata: [], + bank_account_editable: false, + leader: false, + bank_account: undefined, + certification: 1 + } + } + + componentDidMount() { + window.document.title = '竞赛'; + // console.log("3获取用户信息"); + // console.log(this.props) + try { + this.props.triggerRef(this); + }catch (e) { + + } + console.log(this.props.bank_account); + + //初始化值 + if (this.props.bank_account) { + this.props.form.setFieldsValue({ + openingbank: this.props.bank_account.bank, + subbranch: this.props.bank_account.second_bank, + subbranchs: this.props.bank_account.card_no, + }) + this.setState({ + openingbank: this.props.bank_account.bank, + subbranch: this.props.bank_account.second_bank, + subbranchs: this.props.bank_account.card_no, + }) + } + + } + + setdata(bank,second_bank,card_no){ + this.props.form.setFieldsValue({ + openingbank: bank, + subbranch: second_bank, + subbranchs:card_no, + }) + } + componentDidUpdate = (prevProps) => { + if (prevProps.bank_account != this.props.bank_account) { + console.log("componentDidUpdate"); + console.log(this.props);//是新数据 + console.log(prevProps);//是老数据 + ////console.log("Registration"); + ////console.log("componentDidUpdate"); + ////console.log(this.props.user.admin); + try { + if(this.props.bank_account){ + this.props.form.setFieldsValue({ + openingbank: this.props.bank_account.bank, + subbranch: this.props.bank_account.second_bank, + subbranchs: this.props.bank_account.card_no, + }) + } + this.setState({ + openingbank: this.props.bank_account.bank, + subbranch: this.props.bank_account.second_bank, + subbranchs: this.props.bank_account.card_no, + }) + }catch (e) { + + } + } + + } + yhBankstrue = () => { + this.props.form.validateFieldsAndScroll((err, values) => { + if (!err) { + let url = `/competitions/${this.props.match.params.identifier}/prize_leader_account.json`; + axios.patch(url, { + user_id:this.props.userdata.id, + bank: values.openingbank, + second_bank: values.subbranch , + card_no: values.subbranchs + }) + .then((result) => { + try { + if (result.data.status === 0) { + try { + // console.log(values.openingbank); + // console.log(values.subbranch); + // console.log(values.subbranchs); + this.props.form.setFieldsValue({ + openingbank: values.openingbank, + subbranch: values.subbranch, + subbranchs: values.subbranchs, + }); + this.setState({ + openingbank: values.openingbank, + subbranch: values.subbranch, + subbranchs: values.subbranchs, + }) + }catch (e) { + + } + + try { + this.props.showNotification(`提交成功,等待审核!`); + + }catch (e) { + + } + try { + this.props.getdata(this.props.userdata.id); + }catch (e) { + + } + try { + this.props.GetawardinformationAPI(); + }catch (e) { + + } + } + } catch (e) { + + } + + }).catch((error) => { + console.log(error); + }) + } + }) + + } + + render() { + const {getFieldDecorator} = this.props.form; + const {updating, seconds, secondsFlag, basicInfo, phonebool, emailbool, certification, formationdata, bank_account_editable, leader, bank_account} = this.state + return ( +
    +
    +

    签/领/开户行及银行卡号

    +

    为保障奖金的及时发放,请队长如实填写你名下的银行卡信息

    +
    +
    + +
    + +
    + + {getFieldDecorator('openingbank', { + rules: [{ + initialValue:this.state.openingbank, + required: true, + message: '请输入开户行', + }], + })( + + )} + + + + {getFieldDecorator('subbranch', { + rules: [{ + initialValue: this.state.subbranch, + required: true, + message: '请输入支行', + }], + })( + + )} + + + + {getFieldDecorator('subbranchs', { + rules: [{ + initialValue: this.state.subbranchs, + required: true, + message: '请输入账号', + }], + })( + + )} + + +
    +

    +
    + {/*
    this.yhBanksfalse()}>

    取消

    */} + +
    +
    + + +
    +
    + +
    +
    + ) + } +} + +const Bankcardnumberverifications = Form.create({name: 'Bankcardnumberverification'})(Bankcardnumberverification); + +export default Bankcardnumberverifications; + diff --git a/public/react/src/modules/courses/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/CompetitionContentspdfdownload.css b/public/react/src/modules/courses/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/CompetitionContentspdfdownload.css new file mode 100644 index 000000000..726a02277 --- /dev/null +++ b/public/react/src/modules/courses/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/CompetitionContentspdfdownload.css @@ -0,0 +1,24 @@ +.pdfdownload { + max-width: 791px; + height: 40px; + background: rgba(249, 249, 249, 1); + line-height: 40px; + padding-left: 15px; +} + +.pdfpicture { + font-size: 16px; + color: rgba(0, 0, 0, 1); +} + +.pdfdownloadfont4CACFF { + color: #4CACFF !important; +} + +.pdfdownloadfont00CC5F { + color: #00CC5F; +} + +.pdfdownloadfontFF6602 { + color: #FF6602; +} diff --git a/public/react/src/modules/courses/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/CompetitionContentspdfdownload.js b/public/react/src/modules/courses/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/CompetitionContentspdfdownload.js new file mode 100644 index 000000000..eb304e007 --- /dev/null +++ b/public/react/src/modules/courses/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/CompetitionContentspdfdownload.js @@ -0,0 +1,215 @@ +import React, { Component } from 'react'; +import {Button,Layout,Row, Col,Divider,Table} from 'antd'; +import axios from 'axios'; +import {getImageUrl} from 'educoder'; +import './CompetitionContentspdfdownload.css'; +// import NoneData from "../../../courses/shixunHomework/shixunHomework"; + + +class CompetitionContentspdfdownload extends Component{ + constructor(props) { + super(props) + this.state={ + data:undefined, + teams:undefined + } + } + + componentDidMount(){ + window.document.title = '竞赛'; + let url=`/competitions/${this.props.match.params.identifier}/prize.json`; + let query=this.props.location&&this.props.location.search; + const types = query.split('user_id=') + let userid; + if(types[1]===undefined){ + userid=this.props.user&&this.props.user.user_id; + }else{ + userid=types[1]; + } + axios.get(url,{params:{ + user_id:userid, + } + }).then((response) => { + if(response.status===200){ + + let datas=response.data.teams; + if(datas.length>0){ + datas.map((item,key)=>{ + let lista=item.team_members; + if(lista.length>0){ + console.log(lista) + lista.map((i,k)=>{ + i["bank_account"]=item.bank_account; + }) + } + }) + } + this.setState({ + data:response.data, + teams:datas, + }) + } + }).catch((error) => { + console.log(error) + }) + } + + render() { + + + + let {data,teams}=this.state; + + const columns = [ + { + title: '角色', + dataIndex: 'type', + key: 'type', + render: (text, record) => ( + + {record.role} + + ), + }, + { + title: '姓名', + dataIndex: 'name', + key: 'name', + render: (text, record) => ( + + {record.name} + + ), + }, + { + title: '实名认证', + dataIndex: 'namecertify', + key: 'namecertify', + render: (text, record) => ( + + {record.real_name_auth==="authed"?已认证:record.real_name_auth==="authing"?待审核:record.real_name_auth==="not_authed"?未认证:""} + + ), + }, + { + title: '职业认证', + key: 'certify', + dataIndex: 'certify', + render: (text, record) => ( + + {record.professional_auth==="authed"?已认证:record.professional_auth==="authing"?待审核:record.professional_auth==="not_authed"?未认证:""} + + ), + }, + { + title: '手机绑定', + key: 'mobile', + dataIndex: 'mobile', + render: (text, record) => ( + + {record.phone_binded===true?已绑定:未绑定} + + ), + }, + { + title: '邮箱绑定', + key: 'mail', + dataIndex: 'mail', + render: (text, record) => ( + + {record.email_binded===true?已绑定:未绑定} + + ), + }, + { + title: '开户行及银行卡号信息(队长填写)', + key: 'idcard', + dataIndex: 'idcard', + render: (value, record, index) => { + if (index === 0&&record.bank_account!=null) { + return { + children: {record.bank_account.bank + record.bank_account.second_bank + record.bank_account.card_no}, + }; + } + + }, + }, + ]; + + + let people=[ { url: '/api/competitions/xxxxx/certificates/1/personal' }, + { url: '/api/competitions/xxxxx/certificates/2/personal' },] + return ( + + +
    温馨提示:填写的个人信息经审批后,将提供个人获奖证书下载;团队队员信息全部审批后,将提供团队获奖证书下载。 + + + + 证书情况 + + + + 个人证书:{data&&data.personal_certifications.length===0&&data&&data.all_certified===false? + 暂未生成 原因:还未认证个人信息,this.props.Competitioncallback("2")}>立即认证: + data&&data.personal_certifications.length===0&&data&&data.all_certified===true? + 暂未生成 原因:组委会未完成证书审批,请稍后: + data&&data.personal_certifications.map((item,key)=>{ + return( + + + 立即下载 + + ) + })} + + + + 团队证书: + {data&&data.team_certifications.length===0?暂未生成 + :data&&data.team_certifications.map((item,key)=>{ + return( + + + 立即下载 + + ) + })} + + + + + {teams&&teams.map((item,key)=>{ + return( + + {item.name}战队信息填报概况 + +
    + + ) + }) + } + + + + ) + } +} +export default CompetitionContentspdfdownload; \ No newline at end of file diff --git a/public/react/src/modules/courses/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/CompetitionContentspdfpeopledata.js b/public/react/src/modules/courses/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/CompetitionContentspdfpeopledata.js new file mode 100644 index 000000000..1afbf16a7 --- /dev/null +++ b/public/react/src/modules/courses/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/CompetitionContentspdfpeopledata.js @@ -0,0 +1,596 @@ +import React, {Component} from 'react'; +import {Button, Layout, Input, Form} from 'antd'; +import axios from 'axios'; +import {getImageUrl} from 'educoder'; +import mycompetotionchild from './mycompetotionchild.css'; +import {getHiddenName} from "../../../../user/account/AccountBasicEdit"; +import '../../../../courses/css/Courses.css' +import RealNameCertificationModal from "../../../../user/modal/RealNameCertificationModal"; +import Phonenumberverifications from './Phonenumberverification'; +import Mailboxvalidations from './Mailboxvalidation' +import Bankcardnumberverifications from './Bankcardnumberverification' +export const identityMap = {"teacher": "教师", "student": "学生", "professional": "专业人士"} + +class CompetitionContentspdfpeopledata extends Component { + constructor(props) { + super(props) + this.state = { + basicInfo: {}, + updating: '', + secondsFlag: false, + seconds: 60, + phonebool: false, + emailbool: false, + formationdata: [], + bank_account_editable: false, + leader: false, + bank_account: undefined, + certification: 1, + userdata:undefined + } + } + + componentDidMount() { + window.document.title = '竞赛'; + console.log("获取用户信息"); + console.log(this.props); + + this.GetawardinformationAPI(); + let query=this.props.location&&this.props.location.search; + const types = query.split('user_id=') + let userid; + if(types[1]===undefined){ + userid=this.props.user&&this.props.user.user_id; + }else{ + userid=types[1]; + } + this.getdata(userid); + this.GetuseridApi(userid); + + } + + GetuseridApi=(id)=>{ + //个人信息API 获取个人信息 + let url = `/users/accounts/${id}.json`; + axios.get(url).then((result) => { + if (result.data) { + console.log("GetuseridApi"); + console.log(result.data); + this.setState({ + userdata:result.data + }) + } + }).catch((error) => { + console.log(error); + }) + + } + + GetawardinformationAPI = () => { + let url = `/competitions/${this.props.match.params.identifier}/prize.json`; + let query=this.props.location&&this.props.location.search; + const types = query.split('user_id=') + let userid; + if(types[1]===undefined){ + userid=this.props.user&&this.props.user.user_id; + }else{ + userid=types[1]; + } + axios.get(url,{params:{ + user_id:userid, + } + }).then((result) => { + if (result.data) { + this.setState({ + formationdata: result.data.formationdata, + bank_account_editable: result.data.bank_account_editable, //队长是否可以编辑 + leader: result.data.leader, //是否是队长 + bank_account: result.data.bank_account, //队长银行卡号信息 + }) + } + }).catch((error) => { + console.log(error); + }) + } + + + getdata = (id) => { + this.setState({ + certification: 3 + }) + this.GetuseridApi(id); + }; + // 绑定手机 + onPhoneSubmit = () => { + this.props.form.validateFieldsAndScroll((err, values) => { + if (!err) { + let {id} =this.state.userdata; + let reg = /^1\d{10}$/; + if (reg.test(values.phone)) { + let url = `/users/accounts/${id}/phone_bind.json` + axios.post((url), { + phone: values.phone, + code: values.phoneValidateCode + }).then((result) => { + if (result) { + this.props.showNotification("手机号码绑定成功!"); + this.setState({ + phonebool: false + }) + this.getdata(this.state.userdata.id); + } + }).catch((error) => { + console.log(error); + }) + } else { + this.props.showNotification("请输入有效的11位手机号码"); + } + } + }) + } + // 绑定邮箱 + onEmailSubmit = () => { + this.props.form.validateFieldsAndScroll((err, values) => { + if (!err) { + let {id} =this.state.userdata; + let reg = /^[a-zA-Z0-9]+([.\-_\\]*[a-zA-Z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/; + if (reg.test(values.email)) { + let url = `/users/accounts/${id}/email_bind.json` + axios.post((url), { + email: values.email, + code: values.emailValidateCode + }).then((result) => { + if (result) { + this.props.showNotification("邮箱地址绑定成功!"); + this.setState({ + emailbool: false + }) + this.getdata(this.state.userdata.id); + } + }).catch((error) => { + console.log(error); + }) + } else { + this.props.showNotification("请输入正确的邮箱地址"); + } + } + }) + } + //取消编辑 + hideUpdating = (i) => { + if (i === 1) { + this.setState({ + phonebool: false + }) + } else if (i === 2) { + this.setState({ + emailbool: false + }) + + } else if (i === 3) { + + } + + } + + // 获取验证码 + getCode = (index) => { + let url = `/accounts/get_verification_code.json` + let login = ''; + let values = this.props.form.getFieldsValue(); + if (index == 3) { + //绑定手机号码 + login = values.phone; + let reg = /^1\d{10}$/; + if (reg.test(login) == false) { + this.props.showNotification(`请先输入正确的手机号码`); + return; + } + } else if (index == 4) { + // 绑定邮箱 + login = values.email; + let reg = /^[a-zA-Z0-9]+([.\-_\\]*[a-zA-Z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/; + if (reg.test(login) == false) { + this.props.showNotification(`请先输入正确的邮箱地址`); + return; + } + } + let type = index; + if (!login) { + this.props.showNotification(`请先输入${index == 3 ? "手机号码" : "邮箱地址"}`); + return; + } + axios.get((url), { + params: { + login, type + } + }).then((result) => { + if (result) { + // 倒计时 + this.setState({ + secondsFlag: true + }) + this.remainTime(); + } + }).catch((error) => { + console.log(error); + }) + } + + // 获取验证码倒计时 + remainTime = () => { + this.setState({ + seconds: 60 + }) + this.timer = setInterval(() => { + let {seconds} = this.state; + let s = parseInt(seconds) - 1; + if (s > -1) { + this.setState({ + seconds: s + }) + } else { + this.setState({ + secondsFlag: false + }) + clearInterval(this.timer); + } + }, 1000) + } + + phonebools = () => { + this.setState({ + phonebool: true + }) + } + + emailbools = () => { + console.log("点击了邮箱"); + this.setState({ + emailbool: true + }) + } + + //立即认证 + checkBasicInfo = (index) => { + if (this.state.userdata.base_info_completed == true) { + this.showRealNameCertificationModal(index) + } else { + try { + this.props.confirm({ + okText: `立即完善`, + content: `请先完善基本信息`, + onOk: () => { + this.props.history.push('/account/profile/edit') + } + }) + } catch (e) { + this.props.history.push(`/account/profile/edit`); + + } + } + + } + showRealNameCertificationModal = (index) => { + this.setState({ + certification: index, + }, () => { + if (index == 1) { + this.realNameCertificationModal1.setVisible(true) + } else if (index == 2) { + this.realNameCertificationModal2.setVisible(true) + } + }) + } + //绑定银行确认 + yhBankstrue = () => { + this.props.form.validateFieldsAndScroll((err, values) => { + if (!err) { + let url = `/competitions/${this.props.match.params.identifier}/prize_leader_account.json`; + axios.patch(url, { + user_id:this.state.userdata.id, + bank: values.openingbank, + second_bank: values.subbranchs, + card_no: values.subbranch + }) + .then((result) => { + try { + if (result.data.status == 0) { + // console.log(JSON.stringify(result)); + this.props.showNotification(`提交成功`); + this.getdata(this.state.userdata.id); + this.GetawardinformationAPI(); + } + } catch (e) { + + } + + }).catch((error) => { + console.log(error); + }) + } + }) + + } + + //取消认证弹框 + onCancel = () => { + this.getdata(this.state.userdata.id); + + } + + bindRef = ref => { this.child = ref } + //撤销认证 + Cancellationofapplication = (index) => { + let userid; + let query=this.props.location&&this.props.location.search; + const types = query.split('user_id=') + if(types[1]===undefined){ + userid=this.props.user&&this.props.user.user_id; + }else{ + userid=types[1]; + } + let url = "" + if (index === 1) { + url = `/users/accounts/${userid}/authentication_apply.json`; + } else if (index === 2) { + url = `/users/accounts/${userid}/professional_auth_apply.json`; + } + axios.delete(url) + .then((response) => { + try { + if (response.data.status == 0) { + if (index === 1) { + this.props.showNotification('撤销实名认证成功') + } else if (index === 2) { + this.props.showNotification('撤销职业认证成功') + } + try { + this.getdata(this.state.userdata.id); + }catch (e) { + + } + + } + } catch (e) { + + } + + }) + .catch(function (error) { + console.log(error); + }); + + } + + + render() { + const admins=this.props.user.admin; + if(admins===undefined||admins===null) { + admins === false; + } + const {updating, seconds, secondsFlag,userdata, basicInfo, phonebool, emailbool, certification, formationdata, bank_account_editable, leader, bank_account} = this.state + return ( +
    + {this.state.certification === 1 &&userdata? + + this.realNameCertificationModal1 = form} + certification={certification} + Getdata={(id) => this.getdata(id)} + onCancel={() => this.onCancel()} + > + + + : ""} + + {this.state.certification === 2 &&userdata ? + this.realNameCertificationModal2 = form} + certification={certification} + Getdata={(id) => this.getdata(id)} + onCancel={() => this.onCancel()} + + > : ""} +
    +

    *实名信息 +

    + {userdata && userdata.authentication == "uncertified" ? +

    通过实名认证后才能获得证书

    : "" + } + {userdata && userdata.authentication == "uncertified" ? +

    this.checkBasicInfo(1)}>立即认证

    : "" + } + +
    +
    +

    姓名:

    +

    {userdata && userdata.name} + + { + userdata && userdata.authentication == "uncertified" ? "" : + userdata && userdata.authentication == "applying" ? +

    待审核!

    this.Cancellationofapplication(1)}>撤销认证

    + : +

    +

    已认证

    +

    + } +

    +
    + +
    +

    性别:

    +

    {userdata && userdata.gender == 0 ? "男" : "女"}

    +
    + +
    +

    *职业信息 +

    + { + userdata && userdata.professional_certification == "uncertified" ? +

    通过职业认证后才能获得证书

    + + : ""} + { + userdata && userdata.professional_certification == "uncertified" ? +

    this.checkBasicInfo(2)}>立即认证

    + + : ""} +
    + +
    +

    职业:

    +

    {userdata && userdata.identity && identityMap[userdata.identity]} + { + userdata && userdata.professional_certification == "uncertified" ? + "" : + userdata && userdata.professional_certification == "applying" ? +

    +

    待审核!

    this.Cancellationofapplication(2)}>撤销认证

    +

    + : +

    +

    已认证

    +

    this.checkBasicInfo(2)}>重新认证

    + +

    + } +

    +
    +
    +

    {userdata && userdata.technical_title ? "职称:" : ""}{userdata && userdata.student_id ? "学号:" : ""}

    +

    {userdata && (userdata.technical_title || userdata.student_id)}

    +
    +
    +

    学校:

    +

    {userdata && userdata.school_name}

    +
    +
    +

    院系:

    +

    {userdata && userdata.department_name}

    +
    +
    +

    *联系方式 +

    +
    +
    +

    手机号:

    + { + userdata && userdata.phone ? +

    {userdata && userdata.phone}

    + : +

    未绑定

    + } +

    this.phonebools()}>{userdata && userdata.phone ? (phonebool === false ? "更换" : "") : (phonebool === false ? "立即绑定" : "")}

    +
    + {/*手机号绑定*/} + { + phonebool === true &&userdata ? + this.hideUpdating(i)} + getdata={(id) => this.getdata(id)}> + : "" + } + + +
    +

    Email:

    +

    {userdata && userdata.mail}

    +

    this.emailbools()}>{userdata && userdata.mail ? (emailbool === false ? "更换" : "") : (emailbool === false ? "立即绑定" : "")}

    +
    + { + emailbool === false ? "" : + ( + userdata? + this.hideUpdating(i)} + getdata={(id) => this.getdata(id)}> + :"" + ) + } + { + leader === true ? +
    + { + bank_account_editable === true ? + this.hideUpdating(i)} + getdata={(id) => this.getdata(id)} + GetawardinformationAPI={() => this.GetawardinformationAPI()} + bank_account={this.state.bank_account} + > + : + admins===true? + this.hideUpdating(i)} + getdata={(id) => this.getdata(id)} + GetawardinformationAPI={() => this.GetawardinformationAPI()} + bank_account={this.state.bank_account} + > + : +
    +
    +

    签/领/开户行及银行卡号

    +

    为保障奖金的及时发放,请队长如实填写你名下的银行卡信息

    +
    + { + bank_account && bank_account ? +
    +
    +

    开户行:

    +

    {bank_account && bank_account.bank}

    +
    +
    +

    支行:

    +

    {bank_account && bank_account.second_bank}

    +
    +
    +

    账号:

    +

    {bank_account && bank_account.card_no}

    +
    +
    + : + "" + } + +
    + } +
    + : +
    + { + admins===true? + this.hideUpdating(i)} + getdata={(id) => this.getdata(id)} + GetawardinformationAPI={() => this.GetawardinformationAPI()} + bank_account={this.state.bank_account} + > + :"" + } +
    + } + + +
    + ) + } +} + +export default CompetitionContentspdfpeopledata; + diff --git a/public/react/src/modules/courses/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/Mailboxvalidation.js b/public/react/src/modules/courses/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/Mailboxvalidation.js new file mode 100644 index 000000000..934369aac --- /dev/null +++ b/public/react/src/modules/courses/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/Mailboxvalidation.js @@ -0,0 +1,270 @@ +import React, {Component} from 'react'; +import {Button, Layout, Input, Form} from 'antd'; +import axios from 'axios'; +import {getImageUrl} from 'educoder'; +import mycompetotionchild from './mycompetotionchild.css'; +import {getHiddenName} from "../../../../user/account/AccountBasicEdit"; +import '../../../../courses/css/Courses.css' + +export const identityMap = {"teacher": "教师", "student": "学生", "professional": "专业人士"} + +class Mailboxvalidation extends Component { + constructor(props) { + super(props) + this.state = { + basicInfo: {}, + updating: '', + secondsFlag: false, + seconds: 60, + phonebool: false, + emailbool: false, + formationdata: [], + bank_account_editable: false, + leader: false, + bank_account: undefined, + certification: 1 + } + } + + componentDidMount() { + window.document.title = '竞赛'; + // console.log("3获取用户信息"); + // console.log(this.props); + } + + + // 绑定邮箱 + onEmailSubmit = () => { + this.props.form.validateFieldsAndScroll((err, values) => { + if (!err) { + let {id} = this.props.userdata; + let reg = /^[a-zA-Z0-9]+([.\-_\\]*[a-zA-Z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/; + if (reg.test(values.email)) { + let url = `/users/accounts/${id}/email_bind.json` + axios.post((url), { + email: values.email, + code: values.emailValidateCode + }).then((result) => { + if (result) { + this.props.showNotification("邮箱地址绑定成功!"); + this.hideUpdating(2); + this.props.getdata(id); + } + }).catch((error) => { + console.log(error); + }) + } else { + this.props.showNotification("请输入正确的邮箱地址"); + } + } + }) + } + //取消编辑 + hideUpdating = (i) => { + if (i === 1) { + this.props.hideUpdating(1); + } else if (i === 2) { + this.props.hideUpdating(2); + + + } else if (i === 3) { + + } + + } + + // 获取验证码 + getCode = (index) => { + let url = `/accounts/get_verification_code.json` + let login = ''; + let values = this.props.form.getFieldsValue(); + if (index == 3) { + //绑定手机号码 + login = values.phone; + let reg = /^1\d{10}$/; + if (reg.test(login) == false) { + this.props.showNotification(`请先输入正确的手机号码`); + return; + } + } else if (index == 4) { + // 绑定邮箱 + login = values.email; + let reg = /^[a-zA-Z0-9]+([.\-_\\]*[a-zA-Z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/; + if (reg.test(login) == false) { + this.props.showNotification(`请先输入正确的邮箱地址`); + return; + } + } + let type = index; + if (!login) { + this.props.showNotification(`请先输入${index == 3 ? "手机号码" : "邮箱地址"}`); + return; + } + axios.get((url), { + params: { + login, type + } + }).then((result) => { + if (result) { + // 倒计时 + this.setState({ + secondsFlag: true + }) + this.remainTime(); + } + }).catch((error) => { + console.log(error); + }) + } + + // 获取验证码倒计时 + remainTime = () => { + this.setState({ + seconds: 60 + }) + this.timer = setInterval(() => { + let {seconds} = this.state; + let s = parseInt(seconds) - 1; + if (s > -1) { + this.setState({ + seconds: s + }) + } else { + this.setState({ + secondsFlag: false + }) + clearInterval(this.timer); + } + }, 1000) + } + + phonebools = () => { + this.setState({ + phonebool: true + }) + } + + emailbools = () => { + console.log("点击了邮箱"); + this.setState({ + emailbool: true + }) + } + + + render() { + const {getFieldDecorator} = this.props.form; + const {updating, seconds, secondsFlag, basicInfo, phonebool, emailbool, certification, formationdata, bank_account_editable, leader, bank_account} = this.state + console.log(emailbool); + return ( +
    + +
    + +
    + + {getFieldDecorator('email', { + rules: [{ + // initialValue: this.state.cityDefaultValue, + required: true, + message: basicInfo && basicInfo.mail ? '请输入要更换的新邮箱地址' : '请输入邮箱地址', + }], + })( + + )} + + + + {getFieldDecorator('emailValidateCode', { + rules: [{ + // initialValue: this.state.cityDefaultValue, + required: true, + message: '请输入邮箱收到的验证码', + }], + })( + + )} + + + +
    + + +
    + +
    +
    +
    + ) + } +} + +const Mailboxvalidations = Form.create({name: 'Mailboxvalidation'})(Mailboxvalidation); + +export default Mailboxvalidations; + diff --git a/public/react/src/modules/courses/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/Phonenumberverification.js b/public/react/src/modules/courses/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/Phonenumberverification.js new file mode 100644 index 000000000..fa0b20b7a --- /dev/null +++ b/public/react/src/modules/courses/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/Phonenumberverification.js @@ -0,0 +1,262 @@ +import React, {Component} from 'react'; +import {Button, Layout, Input, Form} from 'antd'; +import axios from 'axios'; +import {getImageUrl} from 'educoder'; +import mycompetotionchild from './mycompetotionchild.css'; +import {getHiddenName} from "../../../../user/account/AccountBasicEdit"; +import '../../../../courses/css/Courses.css' +import RealNameCertificationModal from "../../../../user/modal/RealNameCertificationModal"; + +export const identityMap = {"teacher": "教师", "student": "学生", "professional": "专业人士"} + +class Phonenumberverification extends Component { + constructor(props) { + super(props) + this.state = { + updating: '', + secondsFlag: false, + seconds: 60, + phonebool: false, + emailbool: false, + formationdata: [], + bank_account_editable: false, + leader: false, + bank_account: undefined, + certification: 1 + } + } + + componentDidMount() { + window.document.title = '竞赛'; + // console.log("获取用户信息"); + // console.log(this.props); + } + + + // 绑定手机 + onPhoneSubmit = () => { + this.props.form.validateFieldsAndScroll((err, values) => { + if (!err) { + let {id} = this.props.userdata; + let reg = /^1\d{10}$/; + if (reg.test(values.phone)) { + let url = `/users/accounts/${id}/phone_bind.json` + axios.post((url), { + phone: values.phone, + code: values.phoneValidateCode + }).then((result) => { + if (result) { + this.props.showNotification("手机号码绑定成功!"); + this.props.hideUpdating(1) + this.props.getdata(id); + } + }).catch((error) => { + console.log(error); + }) + } else { + this.props.showNotification("请输入有效的11位手机号码"); + } + } + }) + } + //取消编辑 + hideUpdating = (i) => { + if (i === 1) { + this.props.hideUpdating(1); + } else if (i === 2) { + this.props.hideUpdating(2); + + } else if (i === 3) { + + } + + } + + // 获取验证码 + getCode = (index) => { + let url = `/accounts/get_verification_code.json` + let login = ''; + let values = this.props.form.getFieldsValue(); + if (index == 3) { + //绑定手机号码 + login = values.phone; + let reg = /^1\d{10}$/; + if (reg.test(login) == false) { + this.props.showNotification(`请先输入正确的手机号码`); + return; + } + } else if (index == 4) { + // 绑定邮箱 + login = values.email; + let reg = /^[a-zA-Z0-9]+([.\-_\\]*[a-zA-Z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/; + if (reg.test(login) == false) { + this.props.showNotification(`请先输入正确的邮箱地址`); + return; + } + } + let type = index; + if (!login) { + this.props.showNotification(`请先输入${index == 3 ? "手机号码" : "邮箱地址"}`); + return; + } + axios.get((url), { + params: { + login, type + } + }).then((result) => { + if (result) { + // 倒计时 + this.setState({ + secondsFlag: true + }) + this.remainTime(); + } + }).catch((error) => { + console.log(error); + }) + } + + // 获取验证码倒计时 + remainTime = () => { + this.setState({ + seconds: 60 + }) + this.timer = setInterval(() => { + let {seconds} = this.state; + let s = parseInt(seconds) - 1; + if (s > -1) { + this.setState({ + seconds: s + }) + } else { + this.setState({ + secondsFlag: false + }) + clearInterval(this.timer); + } + }, 1000) + } + + phonebools = () => { + this.setState({ + phonebool: true + }) + } + + + render() { + const {getFieldDecorator} = this.props.form; + const {updating, seconds, secondsFlag, phonebool, emailbool, certification, formationdata, bank_account_editable, leader, bank_account} = this.state + const {basicInfo} = this.props + console.log(emailbool); + return ( +
    + +
    + +
    + + {getFieldDecorator('phone', { + rules: [{ + // initialValue: this.state.cityDefaultValue, + required: true, + message: `请输入要${basicInfo.phone ? '更换' : '绑定'}的手机号码`, + }], + })( + + )} + + + + {getFieldDecorator('phoneValidateCode', { + rules: [{ + // initialValue: this.state.cityDefaultValue, + required: true, + message: '请输入手机获取的验证码', + }], + })( + + )} + + + +
    + + +
    + +
    +
    +
    + ) + } +} + +const Phonenumberverifications = Form.create({name: 'Phonenumberverification'})(Phonenumberverification); + +export default Phonenumberverifications; + diff --git a/public/react/src/modules/courses/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/mycompetotionchild.css b/public/react/src/modules/courses/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/mycompetotionchild.css new file mode 100644 index 000000000..fd85606e0 --- /dev/null +++ b/public/react/src/modules/courses/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/mycompetotionchild.css @@ -0,0 +1,314 @@ +/*垂直布局 + + 一 + 二 + 三 +*/ +.flexdirectionjust { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; +} + + +.directstwebkitflex { + display: flex; + display: -webkit-flex; + flex-direction: column; + align-items: center; +} + +.diredisplayitflex { + display: flex; + display: -webkit-flex; + align-items: center; +} + +/*垂直布局*/ +/*靠左侧 +一 二 三 四 五 六 七 八 +*/ +.flexdirection { + display: flex; + flex-direction: row; +} + +.flexdirections { + display: flex; + flex-direction: initial; +} + +/*靠左侧 +*/ + + +/*靠右侧八 七 六 五 四 三 二 一*/ +.flexdirectionss { + display: flex; + flex-direction: row-reverse; +} + + +/*垂直布局 +一 +二 +三 +四 +*/ +.flexdidirectionss { + display: flex; + flex-direction: column; +} + +/*垂直布局 +四 +三 +二 +一 +*/ +.flexdidireverses { + display: flex; + flex-direction: column-reverse; +} + +.fontcolorsysl { + color: #FF0000 +} + +.fontcolorsyslhei { + color: #000000 +} + +.fontcolorsyslhui { + color: #888888 +} + +.fontcolorsyslhui1 { + color: #666666; +} + +.fontcolorsysllan { + color: #4CACFF +} + +.fontcolorsysljin { + color: #DD7600 +} + +.w200 { + width: 200px; +} + +.w64 { + width: 64px; +} + +.w60 { + width: 60px; +} + +.w98 { + width: 98px; +} + +.myysllineheight { + line-height: 40px; +} + +.myyslminwidth { + min-width: 60px; +} + +.myyslminwidth276 { + width: 276px; +} + +.buttongo { + background: #E7E7E7; + border: 1px solid #E7E7E7; + width: 60px; + height: 30px; + border-radius: 4px; + color: #999999; + font-size: 16px; +} + +.buttongo2 { + background: #4CACFF; + border: 1px solid #4CACFF; + width: 64px; + height: 32px; + border-radius: 4px; + color: #FFFFFF; + font-size: 16px; +} + +.fontwenzi { + text-align: center; + line-height: 30px; +} + +.mt17 { + margin-top: 17px; +} + +.mt36 { + margin-top: 36px; +} + +.mt23 { + margin-top: 23px; +} + +.mt19 { + margin-top: 19px; +} + +.mt23 { + margin-top: 23px; +} + +.mt34 { + margin-top: 34px; +} + +.ml11 { + margin-left: 11px; +} + +.ml38 { + margin-left: 38px; +} + +.ml7 { + margin-left: 7px; +} + +.colorgreenlight { + color: #6EC76E +} + +.colorgreenorg { + color: #FF7300; +} + +.borcolors { + border: 1px solid #4CACFF; + + text-align: center; +} + +.mycompitcursor { + cursor: pointer; +} + +.basicForm { + background: #fff; + padding: 30px; + margin-bottom: 10px; + box-sizing: border-box; + width: 100%; + min-height: 390px; +} + +.basicForm .title { + font-size: 16px; + padding-left: 30px; + margin-bottom: 10px; +} + +.flexTable { + display: flex; + flex-direction: column; +} + +.flexRow { + display: flex; +} + +.mb15 { + margin-bottom: 15px !important; +} + +/* BUTTOn */ +.ant-btn { + border-radius: 2px; +} + +button.ant-btn.ant-btn-primary.grayBtn { + background: #CBCBCB; + border-color: #CBCBCB; +} + +.borderBottom { + border-bottom: 1px solid #4CACFF; +} + +/* form ---------------- START */ +.formItemInline { + display: flex; +} + +.formItemInline .ant-form-item-control-wrapper { + display: inline-block; +} + +.hideRequireTag .ant-form-item-required:before { + display: none; +} + + +/* .basicForm .ant-form-item-label { + width: 100px; + padding-right: 10px; +} + .basicForm .ant-form-item-label label { + color: #979797 + } */ + + +.courseNormalForm .ant-select-show-search { + height: 40px; +} + +.courseNormalForm .ant-select-auto-complete.ant-select .ant-input { + height: 40px; +} + +.courseNormalForm .ant-select-search__field__mirror { + height: 40px; +} + +.courseNormalForm .ant-input-lg { + height: 40px; +} + +.courseNormalForm .ant-select-selection--single { + height: 40px; +} + +.courseNormalForm .ant-select-auto-complete.ant-select .ant-select-selection--single { + height: 40px +} + +.courseNormalForm .ant-input-affix-wrapper { + height: 40px; +} + +/* 职业 */ +.courseNormalForm .ant-select-selection-selected-value { + line-height: 38px +} + +.courseNormalForm input { + height: 40px; +} + +.w300 { + width: 300px; +} + +.w56 { + width: 56px; +} diff --git a/public/react/src/modules/courses/competitions/Competitions.js b/public/react/src/modules/courses/competitions/Competitions.js new file mode 100644 index 000000000..704b85ef9 --- /dev/null +++ b/public/react/src/modules/courses/competitions/Competitions.js @@ -0,0 +1,92 @@ +import React, { Component } from 'react'; + +import { Redirect } from 'react-router'; + +import { Route, Link, Switch } from "react-router-dom"; + +import Loading from '../../Loading'; + +import Loadable from 'react-loadable'; +import { TPMIndexHOC } from '../tpm/TPMIndexHOC'; +import { CNotificationHOC } from '../courses/common/CNotificationHOC'; + +//新版竞赛首页 +const CompetitionsIndex = Loadable({ + loader: () => import('./Competitimain/CompetitionsIndex'), + loading: Loading, +}) + +//竞赛详情页 +const CompetitionCommon=Loadable({ + loader: () => import('./Competitioncommon/CompetitionCommon'), + loading: Loading, +}) + + +//战队详情 +const CompetitionTeams = Loadable({ + loader: () => import('./Competition_teams/Competitionteams'), + loading: Loading, +}) + +//团队竞赛报名 +const Registration = Loadable({ + loader: () => import('../competition/Registration'), + loading: Loading, +}); + +class Competitions extends Component { + constructor(props) { + super(props) + } + + componentDidMount(){ + + window.document.title = '竞赛'; + } + + render() { + + return ( +
    + + + + {/*新版竞赛战队详情*/} + () + } + > + + + {/*新版竞赛报名*/} + () + } + /> + + {/*新版竞赛详情页面*/} + () + } + > + + {/*新版竞赛首页*/} + () + } + > + + + +
    + ); + } +} + +export default CNotificationHOC() (TPMIndexHOC (Competitions)) ; \ No newline at end of file