Merge branch 'dev_aliyun' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_aliyun

dev_sync_trustie
hjm 5 years ago
commit 1cb3fdd962

@ -107,6 +107,34 @@ $(document).on('turbolinks:load', function(){
} }
}); });
}); });
var selectOptions = {
theme: 'bootstrap4',
placeholder: '请输入要添加的单位名称',
multiple: true,
minimumInputLength: 1,
ajax: {
delay: 500,
url: '/api/schools/for_option.json',
dataType: 'json',
data: function(params){
return { keyword: params.term };
},
processResults: function(data){
return { results: data.schools }
}
},
templateResult: function (item) {
if(!item.id || item.id === '') return item.text;
return item.name || item.text;
},
templateSelection: function(item){
return item.name || item.text;
}
}
$('.sponsor-select').select2(selectOptions);
$('.allow-school-select').select2(selectOptions);
} }
}); });
@ -291,7 +319,7 @@ $(function () {
} }
}); });
$('form.stage-update-form').on('click', ".update-stage", function () { $('.competition-chart-setting').on('click', ".update-stage", function () {
var updateForm = $(this).parents("form"); var updateForm = $(this).parents("form");
$(this).attr('disabled', 'disabled'); $(this).attr('disabled', 'disabled');
updateForm.find('.error').html(''); updateForm.find('.error').html('');
@ -450,9 +478,13 @@ function Del_tab(item) {
$(item).parents(".large_panel_part").remove(); $(item).parents(".large_panel_part").remove();
} }
//新增tab //新增tab
function addNewTab() { function addNewTab(competition_id) {
if($(".new-stage-form").length > 0){
alert("请先保存上一个tab");
} else {
var count = parseInt($("#large_panel").find(".large_panel_part").length)+1; var count = parseInt($("#large_panel").find(".large_panel_part").length)+1;
var html = '<div class="large_panel_part" attr_line="'+count+'"><div class="row d-flex mt-3">\n' + var html = '<form class="stage-update-form new-stage-form flex-1" action="/admins/competitions/'+competition_id+'/competition_stages" accept-charset="UTF-8" data-remote="true" method="post">' +
'<div class="large_panel_part" attr_line="'+count+'"><div class="row d-flex mt-3">\n' +
' <span class="col-1 mt-2">tab标题</span>\n' + ' <span class="col-1 mt-2">tab标题</span>\n' +
' <div class="col-2 no_padding">\n' + ' <div class="col-2 no_padding">\n' +
' <input type="text" class="form-control" name="stage_name"/>\n' + ' <input type="text" class="form-control" name="stage_name"/>\n' +
@ -465,9 +497,64 @@ function addNewTab() {
' <a href="javascript:void(0)"class="btn btn-outline-primary export-action ml20 add_task_sub" onclick="add_task_sub(this)">新增子阶段</a>\n' + ' <a href="javascript:void(0)"class="btn btn-outline-primary export-action ml20 add_task_sub" onclick="add_task_sub(this)">新增子阶段</a>\n' +
' </div>\n' + ' </div>\n' +
' <a href="javascript:void(0)" class="btn btn-default ml20" onclick="Del_tab(this)">删除</a>\n' + ' <a href="javascript:void(0)" class="btn btn-default ml20" onclick="Del_tab(this)">删除</a>\n' +
' <a href="javascript:void(0)" class="btn btn-outline-primary export-action ml20">保存</a>\n' + ' <a href="javascript:void(0)" class="btn btn-outline-primary update-stage export-action ml20">保存</a>\n' +
' </div>\n' +
' <div id="small_panel_'+count+'" class="small_panel">\n' +
' <div class="row d-flex small_panel_item" attr_line="sub_new_new" count="1">\n' +
' <span class="col-1 mt-2 subName">第1阶段</span>\n' +
' <div class="flex-1">\n' +
' <div class="row">\n' +
' <span class="mt-2 ml20">有效时间:</span>\n' +
' <div class="col-2 no_padding input_middle">\n' +
' <input type="text" name="stage[][start_time]" id="stage__start_time" value="" autocomplete="off" class="section-start-time form-control" placeholder="有效开始时间">\n' +
' </div>\n' +
' <span class="mt-2">~</span>\n' +
' <div class="col-2 no_padding input_middle">\n' +
' <input type="text" name="stage[][end_time]" id="stage__end_time" value="" autocomplete="off" class="section-end-time form-control" placeholder="有效结束时间">\n' +
' </div>\n' +
' <span class="col-2 text-right mt-2 no_padding">任务完成要求:</span>\n' +
' <div class="col-1 no_padding input_small">\n' +
' <input type="number" class="form-control" name="stage[][mission_count]" value="1">\n' +
' </div>\n' +
' <span class="mt-2 ml10 mr10">/</span>\n' +
' <div class="col-1 no_padding input_small">\n' +
' <input type="number" class="form-control task_all" onchange="change_total(this)" value="3" name="stage[][entry]">\n' +
' </div>\n' +
' <span class=" mt-2">(总任务)</span>\n' +
' <span class="col-1 text-right mt-2 no_padding">成绩来源:</span>\n' +
' <div class="col-2 no_padding input_middle">\n' +
' <select class="form-control" name="stage[][score_source]">\n' +
' <option value="0">经验值</option>\n' +
' <option value="1">预测准确率</option>\n' +
' </select>\n' +
' </div>\n' +
' </div>\n' +
' <div class="row mt-2" id="task_Input_sub_new_new">\n' +
' <div class="col-4 row task_Input_div">\n' +
' <span class="col-3 text-center mt-3">任务1</span>\n' +
' <div class="col-8">\n' +
' <input type="text" class="form-control mt-2" name="stage[][identifiers][]" placeholder="请填写实训ID">\n' +
' </div>\n' +
' </div>\n' +
' <div class="col-4 row task_Input_div">\n' +
' <span class="col-3 text-center mt-3">任务2</span>\n' +
' <div class="col-8">\n' +
' <input type="text" class="form-control mt-2" name="stage[][identifiers][]" placeholder="请填写实训ID">\n' +
' </div>\n' + ' </div>\n' +
' <div id="small_panel_'+count+'" class="small_panel"></div></div>'; ' </div>\n' +
' <div class="col-4 row task_Input_div">\n' +
' <span class="col-3 text-center mt-3">任务3</span>\n' +
' <div class="col-8">\n' +
' <input type="text" class="form-control mt-2" name="stage[][identifiers][]" placeholder="请填写实训ID">\n' +
' </div>\n' +
' </div>\n' +
' </div>\n' +
' </div>\n' +
' <span>\n' +
' <a href="javascript:void(0)" class="btn btn-default ml20 small_panel_item_del">删除</a>\n' +
' </span>\n' +
' </div>\n' +
'</div></div></form>';
$("#large_panel").append(html); $("#large_panel").append(html);
}
} }

@ -1,14 +1,8 @@
class Admins::CompetitionStagesController < Admins::BaseController class Admins::CompetitionStagesController < Admins::BaseController
def create def create
Admins::CompetitionStageUpdateService.call(current_competition, update_form_params) Admins::CompetitionStageCreateService.call(current_competition, update_form_params)
render_ok render_ok
if current_competition.competition_stages.exists?(name: params[:stage_name])
render_error "已存在同名的阶段"
else
current_competition.competition_stages << CompetitionStage.new(name: params[:stage_name])
render_ok
end
end end
def update def update

@ -30,6 +30,8 @@ class Competitions::CompetitionsController < Competitions::BaseController
def show def show
@competition = current_competition @competition = current_competition
current_competition.increment(:visits)
end end
def update def update

@ -1436,7 +1436,7 @@ class PollsController < ApplicationController
if poll_un_anony if poll_un_anony
user_login = u_user.login user_login = u_user.login
user_name = u_user.real_name.present? ? u_user.real_name : "--" user_name = u_user.real_name.present? ? u_user.real_name : "--"
user_class = poll.course.user_group_name user_class = poll.course.user_group_name(u_user.id)
user_student_id = u_user.student_id.present? ? u_user.student_id : "--" user_student_id = u_user.student_id.present? ? u_user.student_id : "--"
user_school_name = u_user.school_name.present? ? u_user.school_name : "--" user_school_name = u_user.school_name.present? ? u_user.school_name : "--"
user_cell += [user_login,user_name, user_class, u_user.mail, user_student_id, user_school_name] user_cell += [user_login,user_name, user_class, u_user.mail, user_student_id, user_school_name]

@ -10,8 +10,6 @@ class Admins::CompetitionStageCreateService < ApplicationService
ActiveRecord::Base.transaction do ActiveRecord::Base.transaction do
stage = CompetitionStage.create!(competition_id: competition.id, name: params[:stage_name], score_rate: (params[:score_rate].to_i / 100).round(2)) stage = CompetitionStage.create!(competition_id: competition.id, name: params[:stage_name], score_rate: (params[:score_rate].to_i / 100).round(2))
stage.competition_stage_sections.destroy_all
params[:stage].each do |section| params[:stage].each do |section|
stage_section = CompetitionStageSection.create!(competition_id: competition.id, competition_stage_id: stage.id, stage_section = CompetitionStageSection.create!(competition_id: competition.id, competition_stage_id: stage.id,
start_time: section["start_time"], end_time: section["end_time"], start_time: section["start_time"], end_time: section["end_time"],

@ -97,13 +97,8 @@
<div class="col-1 text-right"> <div class="col-1 text-right">
主办方 主办方
</div> </div>
<div class="flex-1 text-left sponsorPanel"> <div class="col-5 text-left sponsorPanel">
<a href="javascript:void(0)" class="btn btn-white fl ml10" onclick="addSponsor(this)">+</a> <%= select_tag :sponsor_schools, options_for_select([], @competition.sponsor_schools), class: 'form-control sponsor-select' %>
<div class="sponsor_label">
<input type="hidden" value="school_id" />
<span>caicai</span>
<a href="javascript:void(0)" onclick="del_sponsor(this)">×</a>
</div>
</div> </div>
</div> </div>
@ -111,13 +106,8 @@
<div class="col-1 text-right"> <div class="col-1 text-right">
开放范围 开放范围
</div> </div>
<div class="flex-1 text-left sponsorPanel"> <div class="col-5 text-left sponsorPanel">
<a href="javascript:void(0)" class="btn btn-white fl ml10" onclick="addSponsor(this)">+</a> <%= select_tag :region_schools, options_for_select([], @competition.region_schools), class: 'form-control allow-school-select' %>
<div class="sponsor_label">
<input type="hidden" value="school_id" />
<span>caicai</span>
<a href="javascript:void(0)" onclick="del_sponsor(this)">×</a>
</div>
</div> </div>
</div> </div>
@ -333,7 +323,7 @@
<div class="card mb-5"> <div class="card mb-5">
<div class="card-header d-flex justify-content-between align-items-center"> <div class="card-header d-flex justify-content-between align-items-center">
<span>排行榜设置</span> <span>排行榜设置</span>
<a href="javascript:void(0)" class="btn btn-primary btn-custom waves-effect waves-light ml20" onclick="addNewTab();">+ 新增tab</a> <a href="javascript:void(0)" class="btn btn-primary btn-custom waves-effect waves-light ml20" onclick="addNewTab(<%= @competition.id %>);">+ 新增tab</a>
<span class="flex-1 text-right color-orange">实训ID填写示例实训地址为https://www.educoder.net/shixuns/u5plmgka/challenges则填写“u5plmgka”</span> <span class="flex-1 text-right color-orange">实训ID填写示例实训地址为https://www.educoder.net/shixuns/u5plmgka/challenges则填写“u5plmgka”</span>
</div> </div>
@ -430,7 +420,7 @@
<a href="javascript:void(0)"class="btn btn-outline-primary export-action ml20 add_task_sub" onclick="add_task_sub(this)">新增子阶段</a> <a href="javascript:void(0)"class="btn btn-outline-primary export-action ml20 add_task_sub" onclick="add_task_sub(this)">新增子阶段</a>
</div> </div>
<a href="javascript:void(0)" class="btn btn-default ml20" onclick="Del_tab(this)">删除</a> <a href="javascript:void(0)" class="btn btn-default ml20" onclick="Del_tab(this)">删除</a>
<a href="javascript:void(0)" class="btn btn-outline-primary export-action ml20">保存</a> <a href="javascript:void(0)" class="btn btn-outline-primary update-stage export-action ml20">保存</a>
</div> </div>
<div id="small_panel_1" class="small_panel"> <div id="small_panel_1" class="small_panel">
<div class="row d-flex small_panel_item" attr_line="sub_new_new" count="1"> <div class="row d-flex small_panel_item" attr_line="sub_new_new" count="1">
@ -462,7 +452,26 @@
</select> </select>
</div> </div>
</div> </div>
<div class="row mt-2" id="task_Input_sub_new_new"></div> <div class="row mt-2" id="task_Input_sub_new_new">
<div class="col-4 row task_Input_div">
<span class="col-3 text-center mt-3">任务1</span>
<div class="col-8">
<input type="text" class="form-control mt-2" name="stage[][identifiers][]" placeholder="请填写实训ID">
</div>
</div>
<div class="col-4 row task_Input_div">
<span class="col-3 text-center mt-3">任务2</span>
<div class="col-8">
<input type="text" class="form-control mt-2" name="stage[][identifiers][]" placeholder="请填写实训ID">
</div>
</div>
<div class="col-4 row task_Input_div">
<span class="col-3 text-center mt-3">任务3</span>
<div class="col-8">
<input type="text" class="form-control mt-2" name="stage[][identifiers][]" placeholder="请填写实训ID">
</div>
</div>
</div>
</div> </div>
<span> <span>
<a href="javascript:void(0)" class="btn btn-default ml20 small_panel_item_del">删除</a> <a href="javascript:void(0)" class="btn btn-default ml20 small_panel_item_del">删除</a>

@ -321,7 +321,7 @@ module.exports = {
}, },
compress: { compress: {
drop_debugger: true, drop_debugger: true,
drop_console: true drop_console: false
} }
} }
}), }),

@ -16,9 +16,6 @@ class CompetitionMaxImg extends React.Component {
componentDidUpdate = (prevProps) => { componentDidUpdate = (prevProps) => {
if (prevProps.GetenrollmentAPI != this.props.GetenrollmentAPI) { if (prevProps.GetenrollmentAPI != this.props.GetenrollmentAPI) {
// ////console.log("团队竞赛报名大图componentDidUpdate");
// ////console.log(this.props);
// ////console.log(this.props.GetenrollmentAPI);
this.setState({ this.setState({
GetenrollmentAPI: this.props.GetenrollmentAPI, GetenrollmentAPI: this.props.GetenrollmentAPI,
}) })

@ -2,7 +2,8 @@ import React, {Component} from 'react';
import { import {
BrowserRouter as Router, BrowserRouter as Router,
Route, Route,
Switch Switch,
Link
} from 'react-router-dom'; } from 'react-router-dom';
import axios from 'axios'; import axios from 'axios';
import moment from 'moment'; import moment from 'moment';
@ -62,13 +63,16 @@ class Registration extends React.Component {
itemid: undefined, itemid: undefined,
itemiddata: [], itemiddata: [],
pint: 0, pint: 0,
competition_name: undefined,
mutiple_limited: false,
teamutiple_limited: false,
members_count: 0,
} }
} }
componentDidMount() { componentDidMount() {
console.log(this.props); // console.log(this.props);
// //////console.log("componentDidMount Registration"); // //////console.log("componentDidMount Registration");
// //// //////console.log("调用子组件 "); // //// //////console.log("调用子组件 ");
@ -87,8 +91,8 @@ class Registration extends React.Component {
componentDidUpdate = (prevProps) => { componentDidUpdate = (prevProps) => {
if (prevProps.user != this.props.user) { if (prevProps.user != this.props.user) {
console.log("componentDidUpdate"); // console.log("componentDidUpdate");
console.log(this.props); // console.log(this.props);
////console.log("Registration"); ////console.log("Registration");
////console.log("componentDidUpdate"); ////console.log("componentDidUpdate");
////console.log(this.props.user.admin); ////console.log(this.props.user.admin);
@ -101,6 +105,7 @@ class Registration extends React.Component {
//获取报名配置API //获取报名配置API
GetenrollmentAPI = () => { GetenrollmentAPI = () => {
// console.log("调用了GetenrollmentAPI");
const url = `/competitions/${this.props.match.params.identifier}/competition_staff.json`; const url = `/competitions/${this.props.match.params.identifier}/competition_staff.json`;
axios.get((url)).then((result) => { axios.get((url)).then((result) => {
if (result) { if (result) {
@ -112,9 +117,36 @@ class Registration extends React.Component {
personal: result.data.personal, personal: result.data.personal,
enroll_ended: result.data.enroll_ended, enroll_ended: result.data.enroll_ended,
enrolled: result.data.enrolled, enrolled: result.data.enrolled,
teacher_staff: result.data.teacher_staff, teacher_staff: result.data.teacher_staff === undefined || result.data.teacher_staff === null ? undefined : result.data.teacher_staff,
member_staff: result.data.member_staff, member_staff: result.data.member_staff === undefined || result.data.member_staff === null ? undefined : result.data.member_staff,
})
try {
if (result.data.member_staff) {
this.setState({
mutiple_limited: result.data.member_staff.mutiple_limited,
})
}
} catch (e) {
}
try {
if (result.data.teacher_staff) {
this.setState({
teamutiple_limited: result.data.teacher_staff.mutiple_limited
}) })
}
} catch (e) {
}
if (result.data.personal === true) {
if (result.data.enroll_ended === true) { if (result.data.enroll_ended === true) {
this.setState({ this.setState({
pint: 0 pint: 0
@ -129,9 +161,12 @@ class Registration extends React.Component {
}) })
} }
} }
}
} }
}).catch((error) => { }).catch((error) => {
//// //////console.log(error); console.log("GetenrollmentAPI");
console.log(error);
}) })
} }
@ -161,6 +196,8 @@ class Registration extends React.Component {
data: result.data.my_teams, data: result.data.my_teams,
competition_teams: result.data.competition_teams, competition_teams: result.data.competition_teams,
personal: result.data.personal, personal: result.data.personal,
competition_name: result.data.competition_name,
members_count: result.data.members_count
}) })
} else { } else {
//普通账号 //普通账号
@ -170,6 +207,8 @@ class Registration extends React.Component {
data: result.data.my_teams, data: result.data.my_teams,
competition_teams: result.data.competition_teams, competition_teams: result.data.competition_teams,
personal: result.data.personal, personal: result.data.personal,
competition_name: result.data.competition_name,
members_count: result.data.members_count
}) })
} }
} else { } else {
@ -183,6 +222,9 @@ class Registration extends React.Component {
count: result.data.count, count: result.data.count,
competition_teams: result.data.competition_teams, competition_teams: result.data.competition_teams,
personal: result.data.personal, personal: result.data.personal,
competition_name: result.data.competition_name,
members_count: result.data.members_count
}) })
} else { } else {
@ -192,6 +234,9 @@ class Registration extends React.Component {
count: result.data.count, count: result.data.count,
competition_teams: result.data.competition_teams, competition_teams: result.data.competition_teams,
personal: result.data.personal, personal: result.data.personal,
competition_name: result.data.competition_name,
members_count: result.data.members_count
}) })
} }
@ -203,6 +248,9 @@ class Registration extends React.Component {
data: result.data.my_teams, data: result.data.my_teams,
count: result.data.count, count: result.data.count,
personal: result.data.personal, personal: result.data.personal,
competition_name: result.data.competition_name,
members_count: result.data.members_count
}) })
} else { } else {
@ -212,6 +260,9 @@ class Registration extends React.Component {
data: result.data.my_teams, data: result.data.my_teams,
count: result.data.count, count: result.data.count,
personal: result.data.personal, personal: result.data.personal,
competition_name: result.data.competition_name,
members_count: result.data.members_count
}) })
} }
@ -225,6 +276,9 @@ class Registration extends React.Component {
count: result.data.count, count: result.data.count,
competition_teams: result.data.competition_teams, competition_teams: result.data.competition_teams,
personal: result.data.personal, personal: result.data.personal,
competition_name: result.data.competition_name,
members_count: result.data.members_count
}) })
@ -258,109 +312,120 @@ class Registration extends React.Component {
} }
Getdatatype5 = (keyword, page, per_page, admin) => { // Getdatatype5 = (keyword, page, per_page, admin) => {
//搜索关键字 keyword // //搜索关键字 keyword
//页数 page // //页数 page
//分页 per_page // //分页 per_page
const datas = { // const datas = {
keyword: keyword, // keyword: keyword,
page: page, // page: page,
per_page: per_page, // per_page: per_page,
}; // };
let url = `/competitions/${this.props.match.params.identifier}/competition_teams.json`; // let url = `/competitions/${this.props.match.params.identifier}/competition_teams.json`;
axios.get((url), {params: datas}).then((result) => { // axios.get((url), {params: datas}).then((result) => {
this.setState({ // this.setState({
loadingstate: false, // loadingstate: false,
}) // })
if (result) { // if (result) {
if (result.data) { // if (result.data) {
//// //////console.log(result); // //// //////console.log(result);
if (result.data.personal === false) { // if (result.data.personal === false) {
//不是个人赛 // //不是个人赛
////console.log("Getdatatype5"); // ////console.log("Getdatatype5");
////console.log(result.data.my_teams.length); // ////console.log(result.data.my_teams.length);
if (result.data.my_teams.length === 0) { // if (result.data.my_teams.length === 0) {
// 没有创建数据的 // // 没有创建数据的
//管理员 // //管理员
////console.log("a"); // ////console.log("a");
////console.log(this.state.competition_teams); // ////console.log(this.state.competition_teams);
////console.log(result.data.competition_teams); // ////console.log(result.data.competition_teams);
this.setState({ // this.setState({
type: 4, // type: 4,
count: result.data.count, // count: result.data.count,
competition_teams: result.data.competition_teams, // competition_teams: result.data.competition_teams,
data: result.data.my_teams, // data: result.data.my_teams,
personal: result.data.personal, // personal: result.data.personal,
// competition_name: result.data.competition_name,
}) // members_count:result.data.members_count
} else { //
//有数据的 //
////console.log("b"); // })
// } else {
if (result.data.my_teams[0].manage_permission === true) { // //有数据的
this.setState({ // ////console.log("b");
type: 5, //
data: result.data.my_teams, // if (result.data.my_teams[0].manage_permission === true) {
count: result.data.count, // this.setState({
competition_teams: result.data.competition_teams, // type: 5,
personal: result.data.personal, // data: result.data.my_teams,
// count: result.data.count,
// competition_teams: result.data.competition_teams,
}) // personal: result.data.personal,
} else { // competition_name: result.data.competition_name,
////console.log("c"); // members_count:result.data.members_count
//
this.setState({ //
type: 4, // })
data: result.data.my_teams, // } else {
count: result.data.count, // ////console.log("c");
competition_teams: result.data.competition_teams, //
personal: result.data.personal, // this.setState({
// type: 4,
}) // data: result.data.my_teams,
} // count: result.data.count,
} // competition_teams: result.data.competition_teams,
} else { // personal: result.data.personal,
//团队赛 // competition_name: result.data.competition_name,
//////console.log("d"); // members_count:result.data.members_count
//
this.setState({ //
type: 6, // })
data: result.data.my_teams, // }
count: result.data.count, // }
competition_teams: result.data.competition_teams, // } else {
personal: result.data.personal, // //团队赛
// //////console.log("d");
}) //
} // this.setState({
// type: 6,
} // data: result.data.my_teams,
} // count: result.data.count,
// competition_teams: result.data.competition_teams,
}).catch((error) => { // personal: result.data.personal,
////console.log("k"); // competition_name: result.data.competition_name,
// members_count:result.data.members_count
////console.log(error); //
////console.log("报错了"); //
if (admin === true) { // })
//管理员 // }
this.setState({ //
count: 0, // }
competition_teams: [], // }
data: [], //
loadingstate: false, // }).catch((error) => {
}) // ////console.log("k");
} else { //
//普通账号 // ////console.log(error);
this.setState({ // ////console.log("报错了");
count: 0, // if (admin === true) {
competition_teams: [], // //管理员
data: [], // this.setState({
loadingstate: false, // count: 0,
}) // competition_teams: [],
} // data: [],
}) // loadingstate: false,
} // })
// } else {
// //普通账号
// this.setState({
// count: 0,
// competition_teams: [],
// data: [],
// loadingstate: false,
// })
// }
// })
// }
//团队竞赛翻页 //团队竞赛翻页
@ -370,7 +435,7 @@ class Registration extends React.Component {
loadingstate: true, loadingstate: true,
}) })
const {keyword, per_page} = this.state; const {keyword, per_page} = this.state;
this.Getdatatype5(keyword, pageNumber, per_page, this.props.user.admin); this.Getdata(keyword, pageNumber, per_page, this.props.user.admin);
}; };
/** /**
@ -381,7 +446,7 @@ class Registration extends React.Component {
//已经报名 //已经报名
this.setState({ this.setState({
messagePerbool: true, messagePerbool: true,
intpermessages: "您已报名,无需重复报" intpermessages: "你已经报名,不能重复报名"
}) })
return; return;
} }
@ -393,7 +458,7 @@ class Registration extends React.Component {
}) })
return return
} }
if (this.props.user.admin === true) { if (this.props.user.is_teacher === true) {
//老师 //老师
if (this.state.teacher_staff === null) { if (this.state.teacher_staff === null) {
//禁止老师 //禁止老师
@ -447,7 +512,7 @@ class Registration extends React.Component {
}) })
return return
} }
if (this.props.user.admin === true) { if (this.props.user.is_teacher === true) {
//老师 //老师
if (this.state.teacher_staff === null) { if (this.state.teacher_staff === null) {
//禁止老师 //禁止老师
@ -493,7 +558,7 @@ class Registration extends React.Component {
}) })
if (bool) { if (bool) {
//确认 //确认
this.Refreshteam();
} else { } else {
//取消 //取消
@ -556,7 +621,7 @@ class Registration extends React.Component {
messageexitol: true messageexitol: true
}) })
let url = `/competitions/${"gcc-task-2020"}/competition_teams/${this.state.itemid}/leave.json`; let url = `/competitions/${this.props.match.params.identifier}/competition_teams/${this.state.itemid}/leave.json`;
axios.post(url).then((response) => { axios.post(url).then((response) => {
if (response) { if (response) {
if (response.data) { if (response.data) {
@ -587,7 +652,7 @@ class Registration extends React.Component {
pages: 1, pages: 1,
limit: 20, limit: 20,
}) })
this.Getdatatype5(value, 1, 20, this.props.user.admin); this.Getdata(value, 1, 20, this.props.user.admin);
} }
//个人竞赛 //个人竞赛
@ -618,10 +683,10 @@ class Registration extends React.Component {
render() { render() {
const {page, pages, limit, type, tmodalsType, tmodalsTypes, data, count, competition_teams, Newtit, itemiddata, messagePerbool, messageexitol, GetenrollmentAPI, loadingstate, pint} = this.state; const {page, pages, limit, type, tmodalsType, tmodalsTypes, data, count, competition_teams, Newtit, itemiddata, messagePerbool, messageexitol, GetenrollmentAPI, loadingstate, pint, competition_name, mutiple_limited, teamutiple_limited, members_count} = this.state;
return ( return (
<div className="newMain clearfix "> <div className="newMain clearfix newMainybot">
<div className={"educontent mb20 persmstyle"} style={{width: "1200px", marginTop: "26px"}}> <div className={"educontent mb20 persmstyle"} style={{width: "1200px", marginTop: "26px"}}>
<style> <style>
@ -645,8 +710,12 @@ class Registration extends React.Component {
{ {
tmodalsType === true ? tmodalsType === true ?
<PersonModal modalsType={tmodalsType} {...this.props} {...this.state} Newtit={Newtit} <PersonModal modalsType={tmodalsType} {...this.props} {...this.state} Newtit={Newtit}
mutiple_limited={mutiple_limited}
teamutiple_limited={teamutiple_limited}
itemiddata={itemiddata} GetenrollmentAPI={GetenrollmentAPI} itemiddata={itemiddata} GetenrollmentAPI={GetenrollmentAPI}
Tmoconfirm1={(bool) => this.Tmoconfirm1(bool)}></PersonModal> Tmoconfirm1={(bool) => this.Tmoconfirm1(bool)}
GetenrollmentAPIopens={() => this.GetenrollmentAPI()}
></PersonModal>
: :
"" ""
} }
@ -664,21 +733,15 @@ class Registration extends React.Component {
: "" : ""
} }
{/*<div className="educontent mb20 ">*/}
{/* <p className="clearfix mb20 mt10">*/}
{/* <a className="btn colorgrey fl hovercolorblue ">在线竞赛</a>*/}
{/* <span className="color-grey-9 fl ml3 mr3">&gt;</span>*/}
{/* <a*/}
{/* className=" btn colorgrey fl hovercolorblue ">全国高校计算机大赛-项目挑战</a>*/}
{/* <span className="color-grey-9 fl ml3 mr3">&gt;</span>*/}
{/* <WordsBtn className="fl">报名</WordsBtn>*/}
{/* </p>*/}
{/*</div>*/}
<div style={{marginBottom: '12px'}}> <div style={{marginBottom: '12px'}}>
<Breadcrumb separator=">"> <Breadcrumb separator=">">
<Breadcrumb.Item href="/newcompetitions">在线竞赛</Breadcrumb.Item> <Breadcrumb.Item><Link to={"/newcompetitions"}>在线竞赛</Link></Breadcrumb.Item>
<Breadcrumb.Item href="">全国高校计算机大赛</Breadcrumb.Item> <Breadcrumb.Item><Link
<Breadcrumb.Item href="">报名</Breadcrumb.Item> to={`/newcompetitions/${this.props.match.params.identifier}/common_header`}>{competition_name === undefined || competition_name === null || competition_name === "" ? "全国高校计算机大赛" : competition_name}</Link></Breadcrumb.Item>
{/*<Breadcrumb.Item*/}
{/* href={`/newcompetitions/${this.props.match.params.identifier}/common_header`}></Breadcrumb.Item>*/}
<Breadcrumb.Item>报名</Breadcrumb.Item>
</Breadcrumb> </Breadcrumb>
</div> </div>
{/*大图*/} {/*大图*/}
@ -695,7 +758,7 @@ class Registration extends React.Component {
<div style={{ <div style={{
marginTop: "22px" marginTop: "22px"
}}> }}>
<p>参赛总人数<span style={{color: "#459BE5"}}>{data === null || data === undefined ? 0 : data.length}</span><span <p>参赛总人数<span style={{color: "#459BE5"}}>{members_count}</span><span
style={{marginLeft: "5px"}}></span> style={{marginLeft: "5px"}}></span>
</p> </p>
</div> </div>
@ -730,9 +793,16 @@ class Registration extends React.Component {
{/*普通账号出现单人 战队弹框*/} {/*普通账号出现单人 战队弹框*/}
{ {
type === 2 || type === 3 || type === 5 ? type === 2 || type === 3 || type === 5 ?
<PersonalCompetititem type={type} data={data} (
data && data.map((item, index) => {
return (
<PersonalCompetititem key={index} type={type} item={item}
Exittheteamshow={(itemid) => this.Exittheteamshow(itemid)} Exittheteamshow={(itemid) => this.Exittheteamshow(itemid)}
Createateamedit={(itemid) => this.Createateamedit(itemid)}></PersonalCompetititem> Createateamedit={(itemid) => this.Createateamedit(itemid)}></PersonalCompetititem>
)
})
)
: "" : ""
} }

@ -6,6 +6,10 @@
.borders2 { .borders2 {
border: 1px solid #D9D9D9; border: 1px solid #D9D9D9;
} }
.newMainybot {
padding-bottom: 0px !important;
}
/*All*/ /*All*/
/*Registration.js*/ /*Registration.js*/
/*.registrationback {*/ /*.registrationback {*/
@ -305,6 +309,13 @@
margin-top: 44px; margin-top: 44px;
} }
.myregitem11 {
display: flex;
flex-direction: initial;
margin-top: 20px;
}
.regitem22 { .regitem22 {
display: flex; display: flex;
flex-direction: initial; flex-direction: initial;
@ -406,12 +417,21 @@
} }
.regitemimgs222 {
margin-top: 12px;
width: 28px;
height: 28px;
margin-left: 20px;
border-radius: 50%;
}
.regitemimgs3 { .regitemimgs3 {
/* border: 0.5px solid; */ /* border: 0.5px solid; */
height: 22px; height: 22px;
width: 22px; width: 22px;
font-size: 21px !important; font-size: 21px !important;
margin-top: 21px; margin-top: 19px;
color: #1C91E8; color: #1C91E8;
} }
@ -422,6 +442,11 @@
margin-top: 18px; margin-top: 18px;
} }
.regitemimgs444 {
display: flex;
flex-direction: row-reverse;
margin-top: 18px;
}
.regitemimgs5 { .regitemimgs5 {
margin-left: 10px; margin-left: 10px;
text-align: center; text-align: center;
@ -438,6 +463,23 @@
cursor: pointer cursor: pointer
} }
.regitemimgs555 {
margin-left: 33px;
text-align: center;
background: #ffffff;
height: 40px;
width: 72px;
color: #459be5;
border-radius: 4px;
display: flex;
align-items: center;
justify-content: center;
border: 1px;
border-style: solid;
border-color: #459BE5;
cursor: pointer
}
.regitemimgs6 { .regitemimgs6 {
text-align: center; text-align: center;
background: #ffffff; background: #ffffff;
@ -478,6 +520,7 @@
.packinputs button { .packinputs button {
background: #459BE5; background: #459BE5;
width: 100% !important;
} }
.packinputs { .packinputs {
@ -510,6 +553,13 @@
flex-direction: initial; flex-direction: initial;
} }
.reglistviewdivss2c {
display: flex;
flex-direction: initial;
cursor: not-allowed;
}
.reglistviewdivss2p { .reglistviewdivss2p {
width: 90px; width: 90px;
font-size: 12px; font-size: 12px;
@ -542,6 +592,13 @@
} }
.reglistviewdivss333p {
width: 31px;
font-size: 12px;
color: #666666;
text-align: center;
}
.reglistviewdivss3p { .reglistviewdivss3p {
width: 31px; width: 31px;
font-size: 12px; font-size: 12px;
@ -577,6 +634,17 @@ reglistviewdivs2 {
/*PersonModal.js*/ /*PersonModal.js*/
.yslanswerList {
}
.yslanswerList li {
}
.yslanswerList li:hover {
background-color: #F6F4F4;
}
.permaindiv { .permaindiv {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@ -762,6 +830,31 @@ reglistviewdivs2 {
cursor: default; cursor: default;
} }
.maxnamewidth85 {
max-width: 85px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
cursor: default;
}
.maxnamewidth90 {
max-width: 90px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
cursor: default;
}
.maxnamewidth110 {
max-width: 110px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
cursor: default;
}
.maxnamewidth160 { .maxnamewidth160 {
max-width: 160px; max-width: 160px;
overflow: hidden; overflow: hidden;

@ -10,6 +10,8 @@ import NoneData from '../../../modules/courses/coursesPublic/NoneData'
const {Search} = Input; const {Search} = Input;
//创建战队 //创建战队
var myabool = true;
var myabool2 = true;
class PersonModal extends Component { class PersonModal extends Component {
//导师是搜索 和学生搜索都会添加到下面框中 //导师是搜索 和学生搜索都会添加到下面框中
/** /**
@ -50,7 +52,8 @@ class PersonModal extends Component {
myteaherdata: [], myteaherdata: [],
myshtudentdata: [], myshtudentdata: [],
Thecurrentnumberbool: false, Thecurrentnumberbool: false,
Thecurrentnumberboolstu: false,
Thecurrentnumberstu: "",
} }
@ -65,7 +68,7 @@ class PersonModal extends Component {
school_name: this.props.user.user_school, school_name: this.props.user.user_school,
student_id: null, student_id: null,
identity: this.props.user.user_identity, identity: this.props.user.user_identity,
type: "导师", type: this.props.user.is_teacher === true ? "导师" : "队员",
}; };
data.push(datas); data.push(datas);
@ -110,30 +113,30 @@ class PersonModal extends Component {
} }
componentDidUpdate = (prevProps) => { componentDidUpdate = (prevProps) => {
if (prevProps.user != this.props.user) { // if (prevProps.user != this.props.user) {
////console.log("Registration.js componentDidUpdate"); // ////console.log("Registration.js componentDidUpdate");
////console.log(this.props); // ////console.log(this.props);
// ////console.log(prevProps); // // ////console.log(prevProps);
//identity职场称 // //identity职场称
//user_school学校 // //user_school学校
//real_name姓名 // //real_name姓名
//type 类型 // //type 类型
var data = []; // var data = [];
var datas = { // var datas = {
enrollable: false, // enrollable: false,
id: undefined, // id: undefined,
name: this.props.user.real_name, // name: this.props.user.real_name,
school_name: this.props.user.user_school, // school_name: this.props.user.user_school,
student_id: null, // student_id: null,
identity: this.props.user.user_identity, // identity: this.props.user.user_identity,
type: "导师", // type: "导师",
}; // };
data.push(datas); // data.push(datas);
this.setState({ // this.setState({
myuser: this.props.user, // myuser: this.props.user,
mydatas: data, // mydatas: data,
}) // })
} // }
if (prevProps.GetenrollmentAPI != this.props.GetenrollmentAPI) { if (prevProps.GetenrollmentAPI != this.props.GetenrollmentAPI) {
////console.log("Registration.js GetenrollmentAPIcomponentDidUpdate"); ////console.log("Registration.js GetenrollmentAPIcomponentDidUpdate");
@ -145,12 +148,23 @@ class PersonModal extends Component {
}; };
//创建战队 //创建战队
Createateam = () => { Createateam = () => {
debugger
try {
if (this.state.polls_nametest.length === 0) {
this.props.showNotification(`请输入您的战队名称最多不超过60个字符`);
return
}
} catch (e) {
}
const {polls_nametest, mydatas, GetenrollmentAPI} = this.state; const {polls_nametest, mydatas, GetenrollmentAPI} = this.state;
var myteaherdata = []; var myteaherdata = [];
var myshtudentdata = []; var myshtudentdata = [];
var i = 0; var i = 0;
var s = 0;
for (var a = 0; a < mydatas.length; a++) { for (var a = 0; a < mydatas.length; a++) {
if (mydatas[a].type === "导师") { if (mydatas[a].type === "导师") {
i++; i++;
@ -163,6 +177,7 @@ class PersonModal extends Component {
// } // }
myteaherdata.push(mydatas[a].id); myteaherdata.push(mydatas[a].id);
} else if (mydatas[a].type === "队员") { } else if (mydatas[a].type === "队员") {
s++;
// var objectts = { // var objectts = {
// enrollable: mydatas[a].enrollable, // enrollable: mydatas[a].enrollable,
// id: mydatas[a].id, // id: mydatas[a].id,
@ -174,7 +189,26 @@ class PersonModal extends Component {
} }
} }
// try {
// if (i === 0) {
// this.props.showNotification(`请添加导师`);
// return;
// }
// } catch (e) {
//
// }
//
// try {
// if (s === 0) {
// this.props.showNotification(`请添加队员`);
// return;
// }
// } catch (e) {
//
// }
//确认的时候 去确认老师人数是否符合
try { try {
if (GetenrollmentAPI) { if (GetenrollmentAPI) {
if (GetenrollmentAPI.teacher_staff) { if (GetenrollmentAPI.teacher_staff) {
@ -195,13 +229,52 @@ class PersonModal extends Component {
}) })
return return
} }
this.setState({
Thecurrentnumberbool: false,
Thecurrentnumber: i,
booltech: false,
boolstud: false
})
}
}
} catch (e) {
}
//确认的时候 去确认学生人数是否符合
try {
if (GetenrollmentAPI) {
if (GetenrollmentAPI.member_staff) {
if (GetenrollmentAPI.member_staff.minimum > s) {
this.setState({
Thecurrentnumberboolstu: true,
Thecurrentnumberstu: s,
booltech: false,
boolstud: false
})
return
} else if (GetenrollmentAPI.member_staff.maximum < s) {
this.setState({
Thecurrentnumberboolstu: true,
Thecurrentnumberstu: s,
booltech: false,
boolstud: false
})
return
}
this.setState({
Thecurrentnumberboolstu: false,
Thecurrentnumberstu: s,
booltech: false,
boolstud: false
})
} }
} }
} catch (e) { } catch (e) {
} }
// Thecurrentnumber // Thecurrentnumber
if (this.props.Newtit === true) { if (this.props.Newtit === true) {
//创建新的战队 //创建新的战队
@ -252,8 +325,8 @@ class PersonModal extends Component {
// ////console.log("搜索的老师"); // ////console.log("搜索的老师");
const datas = { const datas = {
keyword: keywordteachers, keyword: keywordteachers,
team_id: team_idteachers, team_id: null,
teacher_ids: teacher_ids, teacher_ids: null,
}; };
let url = `/competitions/${this.props.match.params.identifier}/teachers.json`; let url = `/competitions/${this.props.match.params.identifier}/teachers.json`;
axios.get((url), {params: datas}).then((result) => { axios.get((url), {params: datas}).then((result) => {
@ -280,8 +353,8 @@ class PersonModal extends Component {
// ////console.log("搜索的学生"); // ////console.log("搜索的学生");
const datas = { const datas = {
keyword: keywordstudents, keyword: keywordstudents,
team_id: team_idstudents, team_id: null,
student_ids: student_ids, student_ids: null,
}; };
let url = `/competitions/${this.props.match.params.identifier}/students.json`; let url = `/competitions/${this.props.match.params.identifier}/students.json`;
axios.get((url), {params: datas}).then((result) => { axios.get((url), {params: datas}).then((result) => {
@ -306,7 +379,8 @@ class PersonModal extends Component {
this.setState({ this.setState({
keywordteachers: e.target.value, keywordteachers: e.target.value,
booltech: false, booltech: false,
Thecurrentnumberbool: false Thecurrentnumberbool: false,
Thecurrentnumberboolstu: false,
}) })
// try { // try {
// if (e.target.value.length > 0) { // if (e.target.value.length > 0) {
@ -345,8 +419,10 @@ class PersonModal extends Component {
this.setState({ this.setState({
keywordstudents: e.target.value, keywordstudents: e.target.value,
boolstud: false, boolstud: false,
Thecurrentnumberbool: false Thecurrentnumberbool: false,
Thecurrentnumberboolstu: false,
}); });
// try { // try {
// if (e.target.value.length > 0) { // if (e.target.value.length > 0) {
// this.setState({ // this.setState({
@ -379,7 +455,18 @@ class PersonModal extends Component {
//点击获取老师数据 //点击获取老师数据
getdatacpersondiv1Items = (object) => { getdatacpersondiv1Items = (object) => {
try {
if (this.props.teamutiple_limited === true) {
if (object.enrollable === false) {
myabool = false;
return
}
}
} catch (e) {
myabool = true;
}
myabool = true;
var datas = { var datas = {
enrollable: object.enrollable, enrollable: object.enrollable,
id: object.id, id: object.id,
@ -421,6 +508,19 @@ class PersonModal extends Component {
} }
//点击获取学生数据2 //点击获取学生数据2
getdatacpersondiv1Items2 = (object) => { getdatacpersondiv1Items2 = (object) => {
//
try {
if (this.props.GetenrollmentAPI.teacher_staff.mutiple_limited === true) {
if (object.enrollable === false) {
myabool2 = false;
return
}
}
} catch (e) {
myabool2 = true;
}
myabool2 = true;
var datas = { var datas = {
enrollable: object.enrollable, enrollable: object.enrollable,
id: object.id, id: object.id,
@ -531,20 +631,28 @@ class PersonModal extends Component {
} }
inputOnBlur = (e) => { inputOnBlur = (e) => {
// ////console.log("inputOnBlur"); console.log("inputOnBlur");
// ////console.log(e); console.log(e);
if (myabool === true) {
this.setState({ this.setState({
person1: false person1: false,
person2: false
}) })
} }
}
inputOnBlur2 = (e) => { inputOnBlur2 = (e) => {
// ////console.log("inputOnBlur"); // ////console.log("inputOnBlur");
// ////console.log(e); // ////console.log(e);
if (myabool2 === true) {
this.setState({ this.setState({
person1: false,
person2: false person2: false
}) })
} }
}
startSearch = (e) => { startSearch = (e) => {
// ////console.log("startSearch"); // ////console.log("startSearch");
// ////console.log(e); // ////console.log(e);
@ -627,7 +735,7 @@ class PersonModal extends Component {
}) })
} }
deletedata = (item) => { deletedata = (item) => {
var {mydatas} = this.state; var {mydatas, GetenrollmentAPI} = this.state;
if (item) { if (item) {
var pos = mydatas.indexOf(item); var pos = mydatas.indexOf(item);
// ////console.log("deletedata"); // ////console.log("deletedata");
@ -641,14 +749,118 @@ class PersonModal extends Component {
mydatas: mydatas, mydatas: mydatas,
}) })
} }
var myteaherdata = [];
var myshtudentdata = [];
var i = 0;
var s = 0;
try {
for (var a = 0; a < mydatas.length; a++) {
if (mydatas[a].type === "导师") {
i = i + 1;
// var objectt = {
// enrollable: mydatas[a].enrollable,
// id: mydatas[a].id,
// identity: mydatas[a].identity,
// name: mydatas[a].name,
// school_name: mydatas[a].school_name,
// }
myteaherdata.push(mydatas[a].id);
} else if (mydatas[a].type === "队员") {
s = s + 1;
// var objectts = {
// enrollable: mydatas[a].enrollable,
// id: mydatas[a].id,
// name: mydatas[a].name,
// school_name: mydatas[a].school_name,
// student_id: mydatas[a].student_id,
// }
myshtudentdata.push(mydatas[a].id);
}
}
} catch (e) {
}
// console.log("deletedata");
// console.log(i);
//删除老师的时候判断是否符合人数
try {
if (GetenrollmentAPI) {
if (GetenrollmentAPI.teacher_staff) {
if (GetenrollmentAPI.teacher_staff.minimum > i) {
this.setState({
Thecurrentnumberbool: true,
Thecurrentnumber: i,
booltech: false,
boolstud: false
})
return
} else if (GetenrollmentAPI.teacher_staff.maximum < i) {
this.setState({
Thecurrentnumberbool: true,
Thecurrentnumber: i,
booltech: false,
boolstud: false
})
return
}
this.setState({
Thecurrentnumberbool: false,
Thecurrentnumber: i,
})
}
}
} catch (e) {
}
// debugger
//删除学生的时候判断是否符合人数
try {
if (GetenrollmentAPI) {
if (GetenrollmentAPI.member_staff) {
if (GetenrollmentAPI.member_staff.minimum > s) {
this.setState({
Thecurrentnumberboolstu: true,
Thecurrentnumberstu: s,
booltech: false,
boolstud: false
})
return
} else if (GetenrollmentAPI.member_staff.maximum < s) {
this.setState({
Thecurrentnumberboolstu: true,
Thecurrentnumberstu: s,
booltech: false,
boolstud: false
})
return
}
this.setState({
Thecurrentnumberboolstu: false,
Thecurrentnumberstu: s,
})
}
}
} catch (e) {
}
} }
render() { render() {
// console.log('Registration.js');
// console.log(this.props.mutiple_limited);
const { const {
addonAfter, Numberofteammentors, Thecurrentnumber, person1, person2, addonAfter, Numberofteammentors, Thecurrentnumber, person1, person2,
keywordteachers, team_idteachers, teacher_ids, keywordteachers, team_idteachers, teacher_ids,
keywordstudents, team_idstudents, student_ids, keywordstudents, team_idstudents, student_ids,
member_ids, mydatas, booltech, boolstud, GetenrollmentAPI, Thecurrentnumberbool member_ids, mydatas, booltech, boolstud, GetenrollmentAPI, Thecurrentnumberbool,
Thecurrentnumberboolstu, Thecurrentnumberstu
} = this.state; } = this.state;
//Modal //Modal
//keyboard是否支持键盘 esc 关闭 //keyboard是否支持键盘 esc 关闭
@ -665,11 +877,21 @@ class PersonModal extends Component {
alignItems: "center", alignItems: "center",
height: "40px", height: "40px",
}}> }}>
<p className=" reglistviewdivss4p" <style>
{
`
a:hover
{
color: #05101A;
}
`
}
</style>
<a title={item.name} className=" reglistviewdivss4p maxnamewidth90"
style={{ style={{
textAlign: "center", textAlign: "center",
}} }}
>{item.name === undefined || item.name === null || item.name === "" ? "--" : item.name}</p> >{item.name === undefined || item.name === null || item.name === "" ? "--" : item.name}</a>
{ {
index === 0 ? index === 0 ?
<p className=" reglistviewdivss4p" <p className=" reglistviewdivss4p"
@ -678,32 +900,32 @@ class PersonModal extends Component {
}} }}
>创建者</p> >创建者</p>
: :
<p className=" reglistviewdivss4p" <a title={item.type} className=" reglistviewdivss4p maxnamewidth90"
style={{ style={{
textAlign: "center", textAlign: "center",
}} }}
>{item.type === undefined || item.type === null || item.type === "" ? "--" : item.type}</p> >{item.type === undefined || item.type === null || item.type === "" ? "--" : item.type}</a>
} }
<p className=" reglistviewdivss5p" <a title={item.school_name} className=" reglistviewdivss5p maxnamewidth110"
style={{ style={{
textAlign: "center", textAlign: "center",
}} }}
>{item.school_name === undefined || item.school_name === null || item.school_name === "" ? "--" : item.school_name}</p> >{item.school_name === undefined || item.school_name === null || item.school_name === "" ? "--" : item.school_name}</a>
<p className=" reglistviewdivss2p" <a title={item.identity} className=" reglistviewdivss2p maxnamewidth90"
style={{ style={{
textAlign: "center", textAlign: "center",
}} }}
>{item.identity === undefined || item.identity === null || item.identity === "" ? "--" : item.identity}</p> >{item.identity === undefined || item.identity === null || item.identity === "" ? "--" : item.identity}</a>
{ {
index === 0 ? index === 0 ?
<p className=" reglistviewdivss33p" <p className=" reglistviewdivss333p"
style={{ style={{
textAlign: "center", textAlign: "center",
}} }}
></p> ></p>
: :
<p className=" reglistviewdivss33p" <p className=" reglistviewdivss333p"
style={{ style={{
textAlign: "center", textAlign: "center",
}} }}
@ -712,46 +934,119 @@ class PersonModal extends Component {
</div> </div>
); );
var cpersondiv1Items = []; var cpersondiv1Items = [];
// console.log("this.props.teamutiple_limited ");
// console.log(this.props.teamutiple_limited );
if (teacher_ids) { if (teacher_ids) {
cpersondiv1Items = teacher_ids.map((item, index) => cpersondiv1Items = teacher_ids.map((item, index) =>
<a className="reglistviewdivss2" key={index} style={{ <div className={"yslanswerList"}>
<li
className={this.props.teamutiple_limited === undefined || this.props.teamutiple_limited === null ? "reglistviewdivss2 " : (this.props.teamutiple_limited === true && item.enrollable === false ? "reglistviewdivss2c" : "reglistviewdivss2 ")}
key={index} style={{
width: "100%", width: "100%",
display: "flex", display: "flex",
justifyContent: " space-around", justifyContent: " space-around",
alignItems: "center", alignItems: "center",
height: "40px", height: "40px",
}} }}
onClick={() => this.getdatacpersondiv1Items(item)} onMouseDown={() => this.getdatacpersondiv1Items(item)}
> >
<p className=" cpersondiv1Items" <style>
{
`
a:hover
{
color: #05101A;
}
`
}
</style>
{item.name === undefined || item.name === null || item.name === "" ?
<a className=" cpersondiv1Items"
style={{
textAlign: "center",
width: "90px"
}}
>--</a>
:
<a title={item.name} className=" cpersondiv1Items maxnamewidth90"
style={{
textAlign: "center",
width: "90px"
}}
>{item.name}</a>
}
{item.identity === undefined || item.identity === null || item.identity === "" ?
<p className=" cpersondiv1Items maxnamewidth85"
style={{
textAlign: "center",
width: "85px"
}}
>--</p>
:
<a title={item.identity} className=" cpersondiv1Items maxnamewidth85"
style={{ style={{
textAlign: "center", textAlign: "center",
width: "100px" width: "85px"
}} }}
>{item.name === undefined || item.name === null || item.name === "" ? "--" : item.name}</p> >{item.identity}</a>}
{item.school_name === undefined || item.school_name === null || item.school_name === "" ?
<p className=" cpersondiv1Items" <p className=" cpersondiv1Items"
style={{ style={{
textAlign: "center", textAlign: "center",
width: "100px" width: "110px"
}}
>--</p>
:
<a title={item.school_name} className=" cpersondiv1Items maxnamewidth110"
style={{
textAlign: "center",
width: "110px"
}}
>{item.school_name}</a>
}
{
this.props.teamutiple_limited === undefined || this.props.teamutiple_limited === null ?
<p className=" cpersondiv1Items"
style={{
textAlign: "center",
width: "87px"
}} }}
> {item.identity === undefined || item.identity === null || item.identity === "" ? "--" : item.identity}</p> >{""}</p>
:
(
this.props.teamutiple_limited === true ?
<p className=" cpersondiv1Items" <p className=" cpersondiv1Items"
style={{ style={{
textAlign: "center", textAlign: "center",
width: "120px" color: "#FF6800",
width: "87px"
}}
>{item.enrollable === false ? "已加入其他战队" : ""}</p>
:
<p className=" cpersondiv1Items"
style={{
textAlign: "center",
width: "87px"
}} }}
>{item.school_name === undefined || item.school_name === null || item.school_name === "" ? "--" : item.school_name}</p> >{""}</p>
</a> )
}
</li>
</div>
); );
} }
const cpersondiv1 = ( const cpersondiv1 = (
<div className={" backgroundspersondiv cpersondiv1 borders2"}> <div className={" backgroundspersondiv cpersondiv1 borders2"}>
<Spin spinning={false}> <Spin spinning={false}>
<div className={cpersondiv1Items.length === 0 ? "demo-infinite-container33" : "demo-infinite-container2"}> <div
className={cpersondiv1Items.length === 0 ? "demo-infinite-container33 yslanswerList" : "demo-infinite-container2 yslanswerList"}>
{ {
cpersondiv1Items.length === 0 ? cpersondiv1Items.length === 0 ?
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE}/> <Empty image={Empty.PRESENTED_IMAGE_SIMPLE}/>
@ -778,48 +1073,115 @@ class PersonModal extends Component {
var persondiv2Items = []; var persondiv2Items = [];
if (member_ids) { if (member_ids) {
persondiv2Items = member_ids.map((item, index) => persondiv2Items = member_ids.map((item, index) =>
<a className="reglistviewdivss2 " key={index} style={{ <div className={"yslanswerList"}>
<li
className={this.props.mutiple_limited === undefined || this.props.mutiple_limited === null ? "reglistviewdivss2 " : (this.props.mutiple_limited === true && item.enrollable === false ? "reglistviewdivss2c" : "reglistviewdivss2 ")}
key={index} style={{
width: "100%", width: "100%",
display: "flex", display: "flex",
justifyContent: " space-around", justifyContent: " space-around",
alignItems: "center", alignItems: "center",
height: "40px", height: "40px",
}} }}
onClick={() => this.getdatacpersondiv1Items2(item)} onMouseDown={() => this.getdatacpersondiv1Items2(item)}
> >
<p className=" cpersondiv1Items" <style>
{
`
a:hover
{
color: #05101A;
}
`
}
</style>
{item.name === undefined || item.name === null || item.name === "" ?
<a className=" cpersondiv1Items"
style={{ style={{
textAlign: "center", textAlign: "center",
width: "90px" width: "90px"
}} }}
>{item.name === undefined || item.name === null || item.name === "" ? "--" : item.name}</p> >--</a>
<p className=" cpersondiv1Items" :
<a title={item.name} className=" cpersondiv1Items maxnamewidth90"
style={{
textAlign: "center",
width: "90px"
}}
>{item.name}</a>
}
{item.student_id === undefined || item.student_id === null || item.student_id === "" ?
<p className=" cpersondiv1Items maxnamewidth85"
style={{
textAlign: "center",
width: "85px"
}}
>--</p>
:
<a title={"学号:" + item.student_id} className=" cpersondiv1Items maxnamewidth85"
style={{ style={{
textAlign: "center", textAlign: "center",
width: "85px" width: "85px"
}} }}
>{item.identity === undefined || item.identity === null || item.identity === "" ? "--" : item.identity}</p> >{"学号:" + item.student_id}</a>}
{item.school_name === undefined || item.school_name === null || item.school_name === "" ?
<p className=" cpersondiv1Items" <p className=" cpersondiv1Items"
style={{ style={{
textAlign: "center", textAlign: "center",
width: "110px" width: "110px"
}} }}
>{item.school_name === undefined || item.school_name === null || item.school_name === "" ? "--" : item.school_name}</p> >--</p>
:
<a title={item.school_name} className=" cpersondiv1Items maxnamewidth110"
style={{
textAlign: "center",
width: "110px"
}}
>{item.school_name}</a>
}
{
this.props.mutiple_limited === undefined || this.props.mutiple_limited === null ?
<p className=" cpersondiv1Items"
style={{
textAlign: "center",
width: "87px"
}}
>{""}</p>
:
(
this.props.mutiple_limited === true ?
<p className=" cpersondiv1Items" <p className=" cpersondiv1Items"
style={{ style={{
textAlign: "center", textAlign: "center",
color: "#FF6800", color: "#FF6800",
width: "87px" width: "87px"
}} }}
>{item.enrollable === false ? "" : "已加入其他战队"}</p> >{item.enrollable === false ? "已加入其他战队" : ""}</p>
</a> :
<p className=" cpersondiv1Items"
style={{
textAlign: "center",
width: "87px"
}}
>{""}</p>
)
}
</li>
</div>
); );
} }
const persondiv2 = ( const persondiv2 = (
<div className={" backgroundspersondiv cpersondiv1 borders2"}> <div className={" backgroundspersondiv cpersondiv1 borders2"}>
{/*this.state.loading2*/} {/*this.state.loading2*/}
<Spin spinning={false}> <Spin spinning={false}>
<div className={persondiv2Items.length === 0 ? "demo-infinite-container33" : "demo-infinite-container2"}> <div className={persondiv2Items.length === 0 ? "demo-infinite-container33 " : "demo-infinite-container2 "}>
{ {
persondiv2Items.length === 0 ? persondiv2Items.length === 0 ?
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE}/> <Empty image={Empty.PRESENTED_IMAGE_SIMPLE}/>
@ -857,16 +1219,16 @@ class PersonModal extends Component {
width="620px" width="620px"
> >
<style> {/*<style>*/}
{ {/* {*/}
` {/* `*/}
a:hover {/* a:hover*/}
{ {/* {*/}
background-color:#F6F4F4; {/* background-color:#F6F4F4;*/}
} {/* }*/}
` {/* `*/}
} {/* }*/}
</style> {/*</style>*/}
<div className="permaindiv"> <div className="permaindiv">
{/*队名*/} {/*队名*/}
<style>{ <style>{
@ -963,6 +1325,7 @@ class PersonModal extends Component {
placeholder="请输入老师姓名的任意关键字进行搜索,可以后续在添加" placeholder="请输入老师姓名的任意关键字进行搜索,可以后续在添加"
onPressEnter={this.startSearch} onPressEnter={this.startSearch}
onFocus={this.inputOnFocus} onFocus={this.inputOnFocus}
onBlur={this.inputOnBlur}
onChange={(e) => this.teacheronChange(e)} onChange={(e) => this.teacheronChange(e)}
value={this.state.keywordteachers} value={this.state.keywordteachers}
suffix={ suffix={
@ -1008,11 +1371,6 @@ class PersonModal extends Component {
` `
} }
</style> </style>
{/*<Search*/}
{/* */}
{/* placeholder="请输入想要队员姓名的任意关键字进行搜索"*/}
{/* onSearch={(value) => this.onSearch(value)}*/}
{/*/>*/}
<Dropdown overlay={persondiv2} getPopupContainer={trigger => trigger.parentNode} <Dropdown overlay={persondiv2} getPopupContainer={trigger => trigger.parentNode}
visible={this.state.person2}> visible={this.state.person2}>
@ -1021,6 +1379,7 @@ class PersonModal extends Component {
placeholder="请输入想要队员姓名的任意关键字进行搜索" placeholder="请输入想要队员姓名的任意关键字进行搜索"
onPressEnter={this.startSearch2} onPressEnter={this.startSearch2}
onFocus={this.inputOnFocus2} onFocus={this.inputOnFocus2}
onBlur={this.inputOnBlur2}
onChange={(e) => this.studentsonChange(e)} onChange={(e) => this.studentsonChange(e)}
value={this.state.keywordstudents} value={this.state.keywordstudents}
suffix={ suffix={
@ -1114,8 +1473,21 @@ class PersonModal extends Component {
) : ) :
"" ""
} }
{
GetenrollmentAPI && GetenrollmentAPI.member_staff ?
(
Thecurrentnumberboolstu === true ?
<p style={{
marginLeft: "53px",
color: "#D0021B",
fontSize: "12px",
marginTop: "9px"
}}>战队队员为{GetenrollmentAPI.member_staff.minimum}-{GetenrollmentAPI.member_staff.maximum},现在为{Thecurrentnumberstu}</p>
: ""
) :
""
}
<div style={{ <div style={{
marginTop: "24px", marginTop: "24px",

@ -20,6 +20,19 @@ class PersonalModalteam extends Component {
Tmoconfirmto = () => { Tmoconfirmto = () => {
try {
if (this.state.yslzxueshiskmcdm1) {
if (this.state.yslzxueshiskmcdm1.length === 0) {
this.props.showNotification(`请输入您的邀请码`);
return
}
}
} catch (e) {
}
let url = `/competitions/${this.props.match.params.identifier}/competition_teams/join.json`; let url = `/competitions/${this.props.match.params.identifier}/competition_teams/join.json`;
axios.post(url, { axios.post(url, {
invite_code: this.state.yslzxueshiskmcdm1 invite_code: this.state.yslzxueshiskmcdm1

@ -9,13 +9,21 @@ import moment from 'moment';
import {SnackbarHOC, WordsBtn, getImageUrl} from 'educoder'; import {SnackbarHOC, WordsBtn, getImageUrl} from 'educoder';
import {TPMIndexHOC} from '../../tpm/TPMIndexHOC'; import {TPMIndexHOC} from '../../tpm/TPMIndexHOC';
import competition from '../comcss/competition.css'; import competition from '../comcss/competition.css';
import {Button, message} from 'antd'; import {Button, message, Tooltip} from 'antd';
// 点击按钮复制功能 // 点击按钮复制功能
function jsCopy() { function jsCopy() {
var e = document.getElementById("copy_invite_code"); var e = document.getElementById("copy_invite_code");
e.select(); e.select();
document.execCommand("Copy"); document.execCommand("Copy");
codesuccess() codesuccess()
// const range=document.createRange();
// window.getSelection().removeAllRanges();
// range.selectNode(e.target);
// window.getSelection().addRange(range);
// const successful =document.execCommand('copy');
// if(successful){
// codesuccess()
// }
} }
function codesuccess() { function codesuccess() {
@ -25,17 +33,13 @@ function codesuccess() {
class PersonalCompetititem extends React.Component { class PersonalCompetititem extends React.Component {
constructor(props) { constructor(props) {
super(props) super(props)
this.state = {
data: ""
}
} }
componentDidMount() { componentDidMount() {
// // ////console.log(this.props.data) // // ////console.log(this.props.data)
this.setState({
data: this.props.data,
})
} }
@ -47,7 +51,7 @@ class PersonalCompetititem extends React.Component {
} }
render() { render() {
const {data} = this.props; const {key, item} = this.props;
// ////console.log("PersonalCompetititem"); // ////console.log("PersonalCompetititem");
// ////console.log(data); // ////console.log(data);
// ////console.log(data[0]); // ////console.log(data[0]);
@ -60,12 +64,14 @@ class PersonalCompetititem extends React.Component {
return ( return (
<div> <div>
{ {
data && data[0] ? <div className={"yslborderbottom"}> item !== undefined || item !== null ? <div className={"yslborderbottom"}>
<div className="regitem" style={{ <div
className={this.props.key === undefined || this.props.key === null ? "myregitem11" : this.props.key === 0 ? "regitem" : "myregitem11"}
style={{
marginBottom: "19px", marginBottom: "19px",
}}> }}>
<div className="regitemimg1 "> <div className="regitemimg1 ">
<img className="regitemimg2" src={getImageUrl("images/" + data[0].creator.image_url)}> <img className="regitemimg2" src={getImageUrl("images/" + item.creator.image_url)}>
</img> </img>
<p className="" style={{ <p className="" style={{
@ -74,20 +80,60 @@ class PersonalCompetititem extends React.Component {
width: "78px", width: "78px",
textAlign: "center" textAlign: "center"
}}>{data[0].creator.name}</p> }}>{item.creator.name}</p>
</div> </div>
<div className=" " style={{ <div className=" " style={{
marginTop: "29px", marginTop: "29px",
marginLeft: "37px" marginLeft: "37px"
}}> }}>
<p style={{ <p className="maxnamewidth160" style={{
color: "#05101A", color: "#05101A",
fontSize: "16px", fontSize: "16px",
width: "160px", width: "160px",
textAlign: "center" textAlign: "center"
}}>{data[0].name}</p> }}>{item.name}</p>
</div> </div>
{this.props.type === 5 || this.props.type === 2 ?
<div className=" " style={{
marginLeft: "37px",
display: "flex",
flexDirection: "initial",
width: "357px"
}}>
{
item && item.team_members.map((item, index) => {
return (
index === 0 ?
<img className="regitemimgs" src={getImageUrl("images/" + item.image_url)}>
</img>
: index === 1 ?
<img className="regitemimgs2" src={getImageUrl("images/" + item.image_url)}>
</img>
: index === 2 ?
<img className="regitemimgs2" src={getImageUrl("images/" + item.image_url)}>
</img>
: index === 3 ?
<div>
<img className="regitemimgs2" src={getImageUrl("images/" + item.image_url)}>
</img>
<img className="regitemimgs222"
src={getImageUrl(`images/educoder/competitions/pexjiazai.png`)}>
</img>
</div>
: ""
)
})
}
</div> :
<div className=" " style={{ <div className=" " style={{
marginLeft: "37px", marginLeft: "37px",
display: "flex", display: "flex",
@ -95,7 +141,7 @@ class PersonalCompetititem extends React.Component {
width: "487px" width: "487px"
}}> }}>
{ {
data && data[0].team_members.map((item, index) => { item && item.team_members.map((item, index) => {
return ( return (
index === 0 ? index === 0 ?
@ -135,30 +181,34 @@ class PersonalCompetititem extends React.Component {
} }
</div> </div>
<div className=" " style={{ }
<div className=" " style={this.props.type === 5 || this.props.type === 2 ? {
marginLeft: "20px",
} : {
marginLeft: "37px", marginLeft: "37px",
}}> }}>
<div style={{marginTop: "23px",}}> <div style={{marginTop: "23px", width: '140px'}}>
<span style={{ <span style={{
color: "#05101A", color: "#05101A",
fontSize: "16px", fontSize: "16px",
}}>邀请码</span> }}>邀请码</span>
<span <span
style={{ style={{
color: "#05101A", color: "#05101A",
fontSize: "16px", fontSize: "16px",
}}>{data[0].invite_code === null || data[0].invite_code === undefined ? "" : data[0].invite_code}</span> }}>{item.invite_code === null || item.invite_code === undefined ? "" : item.invite_code}</span>
</div> </div>
<div style={{ <div style={{
overflow: 'hidden', overflow: 'hidden',
height: "0px", height: "1px",
width: "0px" width: "1px"
}}> }}>
<input id="copy_invite_code" <input id="copy_invite_code"
value={data[0].invite_code === null || data[0].invite_code === undefined ? "" : data[0].invite_code}/> value={item.invite_code === null || item.invite_code === undefined ? "" : item.invite_code}/>
</div> </div>
</div> </div>
{data[0].invite_code === null || data[0].invite_code === undefined ? {item.invite_code === null || item.invite_code === undefined ?
<i className="regitemimgs3 iconfont icon-fuzhi1 font-14 font-n" <i className="regitemimgs3 iconfont icon-fuzhi1 font-14 font-n"
style={{ style={{
marginLeft: "18px", marginLeft: "18px",
@ -166,6 +216,7 @@ class PersonalCompetititem extends React.Component {
> >
</i> </i>
: :
<Tooltip placement="bottom" title={"复制邀请码"}>
<i className="regitemimgs3 iconfont icon-fuzhi1 font-14 font-n" <i className="regitemimgs3 iconfont icon-fuzhi1 font-14 font-n"
style={{ style={{
marginLeft: "18px", marginLeft: "18px",
@ -175,42 +226,53 @@ class PersonalCompetititem extends React.Component {
}} }}
> >
</i> </i>
</Tooltip>
} }
{ {
this.props.type === 5 ? this.props.type === 5 ?
<div className="regitemimgs4" <div className="regitemimgs444"
style={{ style={{
marginLeft: "32px", marginLeft: "32px",
}} }}
> >
<div className="regitemimgs5" onClick={() => this.props.Exittheteamshow(data[0].id, true)}> <div className="regitemimgs555">
<p onClick={() => this.props.Exittheteamshow(data[0].id, true)}>删除战队</p> <a href={`/newcompetitions/${"gcc-course-2019"}/competition_teams/${item.id}`} style={{
color: "#459be5",
width: "100%",
height: "100%",
lineHeight: "39px",
}}>战队详情</a>
</div>
<div className="regitemimgs555" onClick={() => this.props.Exittheteamshow(item.id, false)}>
<p onClick={() => this.props.Exittheteamshow(item.id, false)}>删除战队</p>
</div> </div>
<div className="regitemimgs6" onClick={() => this.props.Createateamedit(data[0])}> <div className="regitemimgs6" onClick={() => this.props.Createateamedit(item)}>
<p onClick={() => this.props.Createateamedit(data[0])}>编辑战队</p> <p onClick={() => this.props.Createateamedit(item)}>编辑战队</p>
</div> </div>
</div> </div>
: this.props.type === 2 ? : this.props.type === 2 ?
<div className="regitemimgs4 " <div className="regitemimgs444 "
style={{ style={{
marginLeft: "32px", marginLeft: "32px",
}} }}
> >
<div className="regitemimgs5">
<a href={`/newcompetitions/${"gcc-course-2019"}/competition_teams/${data[0].id}`} style={{ <div className="regitemimgs555">
<a href={`/newcompetitions/${"gcc-course-2019"}/competition_teams/${item.id}`} style={{
color: "#459be5", color: "#459be5",
width: "100%", width: "100%",
height: "100%", height: "100%",
lineHeight: "39px", lineHeight: "39px",
}}>战队详情</a> }}>战队详情</a>
</div> </div>
<div className="regitemimgs6" onClick={() => this.props.Exittheteamshow(data[0].id, false)}> <div className="regitemimgs555" onClick={() => this.props.Exittheteamshow(item.id, false)}>
<p onClick={() => this.props.Exittheteamshow(data[0].id, false)}>退出战队</p> <p onClick={() => this.props.Exittheteamshow(item.id, false)}>删除战队</p>
</div>
<div className="regitemimgs6" onClick={() => this.props.Createateamedit(item)}>
<p onClick={() => this.props.Createateamedit(item)}>编辑战队</p>
</div> </div>
</div> </div>
: :
this.props.type === 3 ? this.props.type === 3 ?
@ -220,8 +282,8 @@ class PersonalCompetititem extends React.Component {
}} }}
> >
<div className="regitemimgs6" onClick={() => this.props.Exittheteamshow(data[0].id, false)}> <div className="regitemimgs6" onClick={() => this.props.Exittheteamshow(item.id, false)}>
<p onClick={() => this.props.Exittheteamshow(data[0].id, false)}>退出战队</p> <p onClick={() => this.props.Exittheteamshow(item.id, false)}>退出战队</p>
</div> </div>
</div> </div>

@ -1,20 +1,11 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import { Menu, Icon, List, Avatar,Row, Col,Tag,Pagination} from 'antd'; import { Menu, Icon, List, Avatar,Row, Col,Tag,Pagination,Alert} from 'antd';
import {getImageUrl} from 'educoder'; import {getImageUrl} from 'educoder';
import axios from 'axios'; import axios from 'axios';
import './Competitionsindex.css'; import './Competitionsindex.css';
import NoneData from "../../courses/coursesPublic/NoneData"; import NoneData from "../../courses/coursesPublic/NoneData";
const { SubMenu } = Menu;
const IconText = ({ type, text }) => (
<span>
<Icon type={type} style={{ marginRight: 8 }} />
{text}
</span>
);
class CompetitionsIndex extends Component{ class CompetitionsIndex extends Component{
constructor(props) { constructor(props) {
super(props) super(props)
@ -78,9 +69,8 @@ class CompetitionsIndex extends Component{
} }
render() { render() {
let {datas,page,count}=this.state; let {datas,page,count}=this.state;
admin: true
business: false
console.log(this.props.current_user&&this.props.current_user.business)
return ( return (
<div> <div>
<div className="clearfix"> <div className="clearfix">
@ -133,7 +123,11 @@ class CompetitionsIndex extends Component{
dataSource={datas&&datas} dataSource={datas&&datas}
renderItem={(item,key) => ( renderItem={(item,key) => (
<div> <div>
<div className={"CompetitionsList"} > <div className={"CompetitionsList"} >
{item.competition_status==="nearly_published"?
this.props.current_user&&this.props.current_user.admin===true?"":this.props.current_user&&this.props.current_user.business===true?"":<div className={"CompetitionsListzhezhao"}>即将发布 敬请期待</div>:""}
{/*<div className={"CompetitionsListzhezhao"}>即将发布 敬请期待</div>*/}
{item.description===null||item.description===undefined||item.description===""?<style> {item.description===null||item.description===undefined||item.description===""?<style>
{ {
` `
@ -180,14 +174,14 @@ class CompetitionsIndex extends Component{
} }
> >
<List.Item.Meta <List.Item.Meta
title={<a className={item.competition_status==="ended"?"endedfont":item.competition_status==="nearly_published"? title={<div className={item.competition_status==="ended"?"endedfont":item.competition_status==="nearly_published"?
this.props.current_user&&this.props.current_user.business===true?"":this.props.current_user&&this.props.current_user.admin===true?"":"endedfont":""}> this.props.current_user&&this.props.current_user.admin===true?"competitionstitlesshou":this.props.current_user&&this.props.current_user.business===true?"competitionstitlesshou":"endedfont":"competitionstitlesshou"}>
<span className={"competitionstitles"} <span className={"competitionstitles"}
onClick={()=>this.setcompetitonurl(item.competition_status==="ended"?null:item.competition_status==="nearly_published"? this.props.current_user&&this.props.current_user.business===true?`/newcompetitions/${item.identifier}/common_header`:this.props.current_user&&this.props.current_user.admin===true?`/newcompetitions/${item.identifier}/common_header`:null:item.competition_status==="progressing"?`/newcompetitions/${item.identifier}/common_header`:null)} onClick={()=>this.setcompetitonurl(item.competition_status==="ended"?null:item.competition_status==="nearly_published"? this.props.current_user&&this.props.current_user.business===true?`/newcompetitions/${item.identifier}/common_header`:this.props.current_user&&this.props.current_user.admin===true?`/newcompetitions/${item.identifier}/common_header`:null:item.competition_status==="progressing"?`/newcompetitions/${item.identifier}/common_header`:null)}
>{item.name}</span><span>{item.sub_title===null?"":<Tag className="competitionsrelative" color="#87d068">{ >{item.name}</span><span>{item.sub_title===null?"":<Tag className="competitionsrelative" color="#87d068">{
item.sub_title item.sub_title
}</Tag>}</span> }</Tag>}</span>
</a>} </div>}
/> />
{item.description} {item.description}
</List.Item> </List.Item>
@ -199,7 +193,7 @@ class CompetitionsIndex extends Component{
} }
/>} />}
{datas===undefined?'none':datas.task_count >20 ?<div className="mb40 edu-txt-center padding20-30" {datas===undefined?"":datas.task_count >20 ?<div className="mb40 edu-txt-center padding20-30"
> >
<Pagination <Pagination

@ -117,14 +117,24 @@
.endedfont{ .endedfont{
color:#000 !important; color:#000 !important;
} }
.zhezhaos{ .CompetitionsListzhezhao{
position: absolute;
height: 200px; top: 0px;
overflow: hidden; left: 0px;
position: relative; width: 1206px;
border: 1px solid rgb(235, 237, 240); height: 100%;
border-radius: 2px; z-index: 10000;
padding: 48px; display: none;
background: rgba(51, 51, 51,0.7);
text-align: center; text-align: center;
background: rgb(250, 250, 250); line-height: 170px;
color: #fff;
font-size: 50px;
}
.CompetitionsList:hover .CompetitionsListzhezhao{
display: block;
}
.competitionstitlesshou:hover{
cursor: pointer;
color: #1c91e8 !important;
} }

@ -1,12 +1,12 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import { Breadcrumb,Layout,Table, Divider, Tag,Badge} from 'antd'; import { Breadcrumb,Layout,Table, Divider, Tag,Badge,Tooltip} from 'antd';
import { Link } from 'react-router-dom';
import axios from 'axios'; import axios from 'axios';
import NoneData from "../../courses/shixunHomework/shixunHomework"; import NoneData from "../../courses/shixunHomework/shixunHomework";
import './Competitionteams.css'; import './Competitionteams.css';
const { Header, Footer, Sider, Content } = Layout; const { Content } = Layout;
class Competitionteams extends Component{ class Competitionteams extends Component{
constructor(props) { constructor(props) {
@ -19,6 +19,18 @@ class Competitionteams extends Component{
componentDidMount(){ componentDidMount(){
window.document.title = '竞赛'; 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.getshixundata();
this.getcoursedata(); this.getcoursedata();
@ -131,7 +143,7 @@ class Competitionteams extends Component{
} }
render() { render() {
let {data}=this.state;
const shixuncolumns = [ const shixuncolumns = [
{ {
title: '创建者', title: '创建者',
@ -156,13 +168,19 @@ class Competitionteams extends Component{
title: '被fork发布的学习人数', title: '被fork发布的学习人数',
dataIndex: 'forked_myshixun_count', dataIndex: 'forked_myshixun_count',
key: 'forked_myshixun_count', key: 'forked_myshixun_count',
render: (text, record) => <div className={record.creator==="合计:"?"teamsLayoucolor-orange":""}>{text}</div>, render: (text, record) =>
<Tooltip placement="bottom" title={"fork该实训产生的新实训学习总人数"}>
<div className={record.creator==="合计:"?"teamsLayoucolor-orange":""}>{text}</div>
</Tooltip>,
}, },
{ {
title: '有效作品数', title: '有效作品数',
dataIndex: 'valid_count', dataIndex: 'valid_count',
key: 'valid_count', key: 'valid_count',
render: (text, record) => <div className={record.creator==="合计:"?"teamsLayoucolor-orange":""}>{text}</div>, render: (text, record) =>
<Tooltip placement="bottom" title={"至少完成了1个关卡"}>
<div className={record.creator==="合计:"?"teamsLayoucolor-orange":""}>{text}</div>
</Tooltip>,
}, },
{ {
title: '应用值', title: '应用值',
@ -195,13 +213,19 @@ class Competitionteams extends Component{
title: '被fork发布的学习人数', title: '被fork发布的学习人数',
dataIndex: 'shixun_homework_count', dataIndex: 'shixun_homework_count',
key: 'shixun_homework_count', key: 'shixun_homework_count',
render: (text, record) => <div className={record.creator==="合计:"?"teamsLayoucolor-orange":""}>{text}</div>, render: (text, record) =>
<Tooltip placement="bottom" title={"fork该实训产生的新实训学习总人数"}>
<div className={record.creator==="合计:"?"teamsLayoucolor-orange":""}>{text}</div>
</Tooltip>,
}, },
{ {
title: '有效作品数', title: '有效作品数',
dataIndex: 'valid_count', dataIndex: 'valid_count',
key: 'valid_count', key: 'valid_count',
render: (text, record) => <div className={record.creator==="合计:"?"teamsLayoucolor-orange":""}>{text}</div>, render: (text, record) =>
<Tooltip placement="bottom" title={"至少完成了1个关卡"}>
<div className={record.creator==="合计:"?"teamsLayoucolor-orange":""}>{text}</div>
</Tooltip>,
}, },
{ {
title: '应用值', title: '应用值',
@ -212,14 +236,14 @@ class Competitionteams extends Component{
]; ];
console.log(this.state.shixundata) // console.log(this.state.shixundata)
return ( return (
<div className={"educontent clearfix mt20 "}> <div className={"educontent clearfix mt20 "}>
<Breadcrumb separator=">"> <Breadcrumb separator=">">
<Breadcrumb.Item>全国高校计算机大赛战</Breadcrumb.Item> <Breadcrumb.Item><Link to={"/newcompetitions"}>{data&&data.name}</Link></Breadcrumb.Item>
<Breadcrumb.Item href="">报名</Breadcrumb.Item> <Breadcrumb.Item><Link to={`/newcompetitions/${this.props.match.params.identifier}/enroll`}>报名</Link></Breadcrumb.Item>
<Breadcrumb.Item href="">战队详情</Breadcrumb.Item> <Breadcrumb.Item>战队详情</Breadcrumb.Item>
</Breadcrumb> </Breadcrumb>
<Layout className={"teamsLayout"}> <Layout className={"teamsLayout"}>

@ -1,4 +1,5 @@
.teamsLayout{background: transparent !important;} .teamsLayout{background: transparent !important;}
.teamsLayout .ant-layout-sider{ .teamsLayout .ant-layout-sider{
background: transparent !important; background: transparent !important;
flex: 0 0 180px !important; flex: 0 0 180px !important;
@ -214,3 +215,125 @@
width:93px; width:93px;
top: 20px; top: 20px;
} }
.Competitionthirdbox{
width:234px;
height:163px;
background:rgba(223,223,225,1);
}
.Competitionthirdbox{
width:234px;
height:163px;
background:rgba(223,223,225,1);
}
.Competitionthirdbox{
width:234px;
height:163px;
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:155px;
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);
}
.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%;
}
.CompetitionsListzhezhao{
position: absolute;
top: 0px;
left: 0px;
width: 1206px;
height: 100%;
z-index: 10000;
display: none;
background: rgba(51, 51, 51,0.7);
text-align: center;
line-height: 416px;
color: #fff;
font-size: 50px;
}
.relative{position: relative;}
.relative:hover .CompetitionsListzhezhao{ display: block;}

@ -5,23 +5,30 @@ import axios from 'axios';
import {markdownToHTML,getImageUrl} from 'educoder'; import {markdownToHTML,getImageUrl} from 'educoder';
import CompetitionContents from './CompetitionContents'; import CompetitionContents from './CompetitionContents';
import CompetitionContentsChart from './CompetitionContentsChart'; import CompetitionContentsChart from './CompetitionContentsChart';
import CompetitionContentsMd from './CompetitionContentsMd';
import NoneData from "../../courses/shixunHomework/shixunHomework"; import NoneData from "../../courses/shixunHomework/shixunHomework";
import './CompetitionCommon.css'; import './CompetitionCommon.css';
const { Header, Footer, Sider, Content } = Layout; const {Sider } = Layout;
class CompetitionCommon extends Component{ class CompetitionCommon extends Component{
constructor(props) { constructor(props) {
super(props) super(props)
this.state={ this.state={
data:undefined, data:undefined,
bannerdata:undefined bannerdata:undefined,
module_type:undefined,
mdContentdata:undefined,
chart_rules:undefined,
Competitionedittype:false,
chartdata:undefined
} }
} }
componentDidMount(){ componentDidMount(){
window.document.title = '竞赛'; window.document.title = '竞赛';
if(this.props.match.params.identifier!=null){
this.getbannerdata(); this.getbannerdata();
let url=`/competitions/${this.props.match.params.identifier}.json`; let url=`/competitions/${this.props.match.params.identifier}.json`;
axios.get(url).then((response) => { axios.get(url).then((response) => {
@ -34,38 +41,190 @@ class CompetitionCommon extends Component{
console.log(error) console.log(error)
}) })
} }
}
getbannerdata=()=>{ getbannerdata=()=>{
let url=`/competitions/${this.props.match.params.identifier}/common_header.json`; let url=`/competitions/${this.props.match.params.identifier}/common_header.json`;
axios.get(url).then((response) => { axios.get(url).then((response) => {
if(response.status===200){ if(response.status===200){
this.setState({ this.setState({
data:response.data data:response.data,
thiskeys:response.data.competition_modules[0].position
})
this.getrightdata(
response.data.competition_modules[0].id,
response.data.competition_modules[0].module_type,
response.data.competition_modules[0].module_url,
response.data.competition_modules[0].has_url
)
}
}).catch((error) => {
console.log(error)
})
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)
}
getlistdata=(keys,listkey)=>{
let{data}=this.state;
this.setState({
thiskeys:keys
})
data&&data.competition_modules.map((item,key)=>{
if(keys===item.position){
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(`/newcompetitions/${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) => { }).catch((error) => {
console.log(error) console.log(error)
}) })
}else{
this.props.history.replace(module_url);
return
}
this.setState({
module_id:id,
module_type:typeid
})
} }
getrightdata=(id,typeid)=>{ Competitionedit=()=>{
debugger this.setState({
Competitionedittype:true
})
}
hideCompetitionedit=()=>{
this.setState({
Competitionedittype:false
})
}
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}`);
}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(`/courses/${data.course_id}`);
}
})
}
}
}else{
this.props.history.replace(url);
}
}
Competitioncallback=(key)=>{
this.setState({
tabkey:key
})
} }
render() { render() {
let {data,bannerdata}=this.state; let {data,bannerdata,module_type,Competitionedittype,mdContentdata}=this.state;
// console.log(bannerdata)
return ( return (
data===undefined?"":<div className={"educontent clearfix mt20 "}> data===undefined?"":<div className={"educontent clearfix mt20 "}>
<Breadcrumb separator=">"> <Breadcrumb separator=">">
<Breadcrumb.Item href="">在线竞赛</Breadcrumb.Item> <Breadcrumb.Item><Link to={"/newcompetitions"}>在线竞赛</Link></Breadcrumb.Item>
<Breadcrumb.Item href="">{data&&data.name}</Breadcrumb.Item> <Breadcrumb.Item>{data&&data.name}</Breadcrumb.Item>
</Breadcrumb> </Breadcrumb>
<div className={"mt10"}> <div className={"mt10 relative"}>
<Row className={"CompetitionCommonbanner"}> <Row className={"CompetitionCommonbanner"}>
{data.competition_status==="nearly_published"?
this.props.current_user&&this.props.current_user.admin===true?"":this.props.current_user&&this.props.current_user.business===true?"":<div className={"CompetitionsListzhezhao"}>即将发布 敬请期待</div>:""}
<img className={"Commonimg"} <img className={"Commonimg"}
src={data.competition_status==="ended"?getImageUrl(`images/educoder/competitions/groups1.png`):data.competition_status==="nearly_published"?getImageUrl(`images/educoder/competitions/groups2.png`):data.competition_status==="progressing"?getImageUrl(`images/educoder/competitions/groups3.png`):""} /> src={data.competition_status==="ended"?getImageUrl(`images/educoder/competitions/groups1.png`):data.competition_status==="nearly_published"?getImageUrl(`images/educoder/competitions/groups2.png`):data.competition_status==="progressing"?getImageUrl(`images/educoder/competitions/groups3.png`):""} />
<Col span={15}> <Col span={15}>
@ -101,7 +260,7 @@ debugger
<div className="gutter-box CompetitionsIndexbottomvalue Competitioncolor516">{data.competition_status==="nearly_published"?"--":data&&data.visits_count}</div> <div className="gutter-box CompetitionsIndexbottomvalue Competitioncolor516">{data.competition_status==="nearly_published"?"--":data&&data.visits_count}</div>
</Col> </Col>
<Col className="gutter-row" span={6}> <Col className="gutter-row" span={6}>
<div className="gutter-box CompetitionsIndexbottomvalue Competitioncolor516">{data.competition_status==="nearly_published"?"--":data&&data.member_count}</div> <div className="gutter-box CompetitionsIndexbottomvalue Competitioncolor516" onClick={data.competition_status==="nearly_published"?"":()=>this.gotocourse(`/newcompetitions/${this.props.match.params.identifier}/enroll`)}>{data.competition_status==="nearly_published"?"--":data&&data.member_count}</div>
</Col> </Col>
</Row> </Row>
</Col> </Col>
@ -131,9 +290,9 @@ debugger
<Button type="primary" block className={"Competitionfontsize22"} disabled={true}> <Button type="primary" block className={"Competitionfontsize22"} disabled={true}>
已结束 已结束
</Button>: </Button>:
<Button type="primary" block className={"Competitionfontsize22"}> data.competition_status==="progressing"?<Button type="primary" block className={"Competitionfontsize22"}>
<Link to={`/newcompetitions/${this.props.match.params.identifier}/enroll`}>立即报名</Link> {data.mode===2?<a onClick={()=>this.gotocourse()}>立即报名</a>:<a onClick={()=>this.gotocourse(`/newcompetitions/${this.props.match.params.identifier}/enroll`)}></a>}
</Button>} </Button>:""}
</Col> </Col>
<Col className={"mt10 Competitionfontsize16"}>{data&&data.enroll_end_time===null?"":`报名截止时间:${data&&data.enroll_end_time}`}</Col> <Col className={"mt10 Competitionfontsize16"}>{data&&data.enroll_end_time===null?"":`报名截止时间:${data&&data.enroll_end_time}`}</Col>
</Col> </Col>
@ -142,12 +301,13 @@ debugger
<Layout className={'teamsLayout mt40'}> <Layout className={'teamsLayout mt40'}>
<Sider> <Sider>
<Menu mode="inline" className="CompetitionMenu" defaultSelectedKeys={['1']}> <Menu mode="inline" className="CompetitionMenu" defaultSelectedKeys={['1']} onClick={(e)=>this.getrightdatas(e)}>
{data&&data.competition_modules.map((item,key)=>{ {data&&data.competition_modules.map((item,key)=>{
return( return(
<Menu.Item key={item.position}> <Menu.Item key={item.position}>
{item.has_url===false?<span onClick={()=>this.getrightdata(item.id,item.module_type)}>{item.name}</span>:<a {item.has_url===false?<span
// onClick={()=>this.getrightdata(item.id,item.module_type,item.module_url,item.has_url)}
>{item.name}</span>:<a
// target="_blank" // target="_blank"
href={item.module_url} href={item.module_url}
// onClick={()=>this.getrightdata(item.id,item.module_type)} // onClick={()=>this.getrightdata(item.id,item.module_type)}
@ -155,13 +315,31 @@ debugger
</Menu.Item> </Menu.Item>
) )
})} })}
</Menu> </Menu>
</Sider> </Sider>
<Layout className={"teamsLayoutleft"}> <Layout className={"teamsLayoutleft"}>
<CompetitionContents/> {this.state.module_type==="chart"?Competitionedittype===false?<CompetitionContentsChart
<CompetitionContentsChart/> {...this.props}
{...this.state}
Competitionedit={()=>this.Competitionedit()}
Competitioncallback={(e)=>this.Competitioncallback(e)}
/>:"":Competitionedittype===false?<CompetitionContents
Competitionedit={()=>this.Competitionedit()}
{...this.props}
{...this.state}
/>:""}
{/*<CompetitionContentsChart*/}
{/*{...this.props}*/}
{/*{...this.state}*/}
{/*/>*/}
{Competitionedittype===true?<CompetitionContentsMd
hideCompetitionedit={()=>this.hideCompetitionedit()}
getlistdata={(keys,listkey)=>this.getlistdata(keys,listkey)}
Competitioncallback={(e)=>this.Competitioncallback(e)}
{...this.props}
{...this.state}
/>:""}
</Layout> </Layout>
</Layout> </Layout>

@ -1,7 +1,7 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import {Button,Layout} from 'antd'; import {Button,Layout} from 'antd';
import axios from 'axios'; import axios from 'axios';
import {markdownToHTML,getImageUrl} from 'educoder'; import {markdownToHTML,getImageUrl,AttachmentList} from 'educoder';
import NoneData from "../../courses/shixunHomework/shixunHomework"; import NoneData from "../../courses/shixunHomework/shixunHomework";
const { Header, Footer, Sider, Content } = Layout; const { Header, Footer, Sider, Content } = Layout;
@ -21,15 +21,22 @@ class CompetitionContents extends Component{
render() { render() {
let{mdContentdata}=this.props;
//
return ( return (
<div className={"fr"}> <div className={"fr"}>
<Button className={"fr"} type="primary" ghost> {this.props.current_user&&this.props.current_user.admin===true||this.props.current_user&&this.props.current_user.business===true?this.props.Competitionedittype===false?<Button className={"fr"} type="primary" ghost onClick={()=>this.props.Competitionedit()}>
编辑 编辑
</Button> </Button>:"":""}
<Content className={"markdown-body"} dangerouslySetInnerHTML={{__html: markdownToHTML("").replace(/▁/g, "▁▁▁")}}> <div className={this.props.current_user&&this.props.current_user.admin===true||this.props.current_user&&this.props.current_user.business===true?"mt50 mb100":"mb100"}>
<Content className={"markdown-body"} dangerouslySetInnerHTML={{__html: markdownToHTML(mdContentdata===undefined?"":mdContentdata.md_content===undefined?"":mdContentdata.md_content).replace(/▁/g, "▁▁▁")}}>
</Content> </Content>
<div className={"mt30"}>
<AttachmentList {...this.props} {...this.state} attachments={mdContentdata===undefined?[]:mdContentdata.attachments===undefined?[]:mdContentdata.attachments}></AttachmentList>
</div>
</div>
</div> </div>
) )

@ -1,10 +1,9 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import {Button,Layout,Tabs,Icon, Card, Avatar, Row, Col ,Table} from 'antd'; import {Button,Layout,Tabs,Icon, Card, Avatar, Row, Col ,Table} from 'antd';
import axios from 'axios';
import {markdownToHTML,getImageUrl} from 'educoder'; import {markdownToHTML,getImageUrl} from 'educoder';
import NoneData from "../../courses/shixunHomework/shixunHomework"; import NoneData from "../../courses/shixunHomework/shixunHomework";
const { Header, Footer, Sider, Content } = Layout; const { Content } = Layout;
const { TabPane } = Tabs; const { TabPane } = Tabs;
const { Meta } = Card; const { Meta } = Card;
@ -18,166 +17,212 @@ class CompetitionContents extends Component{
componentDidMount(){ componentDidMount(){
window.document.title = '竞赛'; window.document.title = '竞赛';
} }
render() { render() {
const operations = <Icon type="form" />; const operations =
<div>
<Button className={"fr"} type="primary" ghost onClick={()=>this.props.Competitionedit()}>编辑</Button>
<Button className={"fr mr20"} type="primary" ghost>
<a href={`/competitions/${this.props.match.params.identifier}/charts.xlsx`}>导出</a>
</Button>
</div>
const columns = [ const columns = [
{ {
title: 'Name', title: 'usersum',
dataIndex: 'name', dataIndex: 'usersum',
key: 'name', key: 'name',
render: text => <a>{text}</a>, render: text => <a className={"color-blue"}>{text}</a>,
}, },
{ {
title: 'Age', title: 'userimg',
dataIndex: 'age', dataIndex: 'userimg',
key: 'age', key: 'userimg',
render: text => <img className={"Competitionuserimg"} src={getImageUrl("images/avatars/User/60969?t=1569488691")}/>,
}, },
{ {
title: 'Address', title: 'username',
dataIndex: 'address', dataIndex: 'username',
key: 'address', key: 'username',
render: text => <a>{text}</a>,
}, },
{ {
title: 'Tags', title: 'school',
key: 'tags', dataIndex: 'school',
dataIndex: 'tags', key: 'school',
render: tags => ( render: text => <a>{text}</a>,
<span>
123123
</span>
),
}, },
{ {
title: 'Action', title: 'spendtime',
key: 'action', dataIndex: 'spendtime',
render: (text, record) => ( key: 'spendtime',
<span> render: text => <a>{text}</a>,
<a>Invite {record.name}</a>
<a>Delete</a>
</span>
),
}, },
{ {
title: 'Values', title: 'score',
key: 'values', dataIndex: 'score',
dataIndex: 'values', key: 'score',
render: tags => ( render: text => <a className={"color-blue"}>{text}</a>,
<span>
123123
</span>
),
}, },
]; ];
const data = [ const data = [];
{ let {chart_rules,chartdata}=this.props;
key: '1', chartdata===undefined?"":chartdata.teams.length===0?"":chartdata.teams.map((item,key)=>{
name: 'John Brown', if(key>3){
age: 32, let list={
address: 'New York No. 1 Lake Park', usersum:key,
tags: ['nice', 'developer'], userimg:item.user_image,
values:123 username:item.record_user_name,
}, school:item.school_name,
{ spendtime:item.spend_time,
key: '2', score:item.score,
name: 'Jim Green', user_login:item.user_login
age: 42, }
address: 'London No. 1 Lake Park', data.push(list)
tags: ['loser'], }
values:123 })
},
{
key: '3',
name: 'Joe Black',
age: 32,
address: 'Sidney No. 1 Lake Park',
tags: ['cool', 'teacher'],
values:123
},
];
//
// console.log(this.props.chartdata&&this.props.chartdata.user_ranks)
return ( return (
<div> <div>
<Tabs tabBarExtraContent={operations}> {chart_rules===undefined?"":<Tabs onChange={(e)=>this.props.Competitioncallback(e)} activeKey={this.props.tabkey} tabBarExtraContent={this.props.current_user&&this.props.current_user.admin===true||this.props.current_user&&this.props.current_user.business===true?this.props.Competitionedittype===false?operations:"":""}>
<TabPane tab="总排行榜" key="1"> {chart_rules.stages.map((item,key)=>{
<Content className={"markdown-body"} dangerouslySetInnerHTML={{__html: markdownToHTML("Content of tab 1").replace(/▁/g, "▁▁▁")}}> return(
</Content> <TabPane tab={item.name} key={item.id===null?0:item.id}>
</TabPane> {chart_rules.rule_contents.map((items,keys)=>{
<TabPane tab="决赛排行榜" key="2"> if(item.id===items.competition_stage_id){
<Content className={"markdown-body"} dangerouslySetInnerHTML={{__html: markdownToHTML("Content of tab 2").replace(/▁/g, "▁▁▁")}}> return(
</Content> <Content key={keys} className={"markdown-body"} dangerouslySetInnerHTML={{__html: markdownToHTML(items.content).replace(/▁/g, "▁▁▁")}}></Content>
</TabPane> )
<TabPane tab="预赛排行榜" key="3"> }else if(item.id===null&&items.competition_stage_id===0){
<Content className={"markdown-body"} dangerouslySetInnerHTML={{__html: markdownToHTML("Content of tab 3").replace(/▁/g, "▁▁▁")}}> return(
</Content> <Content key={keys} className={"markdown-body"} dangerouslySetInnerHTML={{__html: markdownToHTML(items.content).replace(/▁/g, "▁▁▁")}}></Content>
)
}
})}
</TabPane> </TabPane>
</Tabs> )
})}
</Tabs>}
<Col className="gutter-row Competitioncharts mt30 mb30"> {chartdata===undefined?"":chartdata.teams.length===0?"":<Col className="gutter-row Competitioncharts mt30 mb30">总排名</Col>}
总排名
</Col>
<Row calssName={"Competition399"}> <Row calssName={"Competition399"}>
<Col className="mt40" xs={{ span: 5, offset: 1 }} lg={{ span: 6, offset: 2 }}> {chartdata===undefined?"":chartdata.teams.length===0?"":chartdata.teams.map((item,key)=>{
if(key===1){
return(
<Col xs={{ span: 11, offset: 1 }} lg={{ span: 6, offset: 1 }}>
<Card <Card
className={"Competitionthird"} className={"Competitionfirst"}
cover={ cover={
<img <div className={"Competitionfirstbox center"}>
alt="example" <li className="pr Competitioncenter">
src="https://gw.alipayobjects.com/zos/rmsportal/JiqGstEfoWAOHiTxclqi.png" <img src={getImageUrl("images/educoder/huangguan.png")}/>
/> <div className={"mt10"}>
<a href={`/users/${item.user_login}`} className="color-dark">
<img className={"rankingimg"} src={getImageUrl(item.user_image)} />
<p className="task-hide rankName mt5 jinshaifont">{item.record_user_name}</p>
</a>
</div>
</li>
</div>
} }
> >
<Meta <Meta
title="Card title" title={<div className={"center"}>
description="This is the description" <div className={"rankfonttop"}>{item.school_name}</div>
<div className={"rankfontmid"}>{item.spend_time}</div>
</div>}
description={
<div className={"rankfontbottoms"}>{item.score}</div>
}
/> />
</Card> </Card>
</Col> </Col>
<Col xs={{ span: 11, offset: 1 }} lg={{ span: 6, offset: 1 }}> )
}
if(key===2){
return(
<Col className="mt30" xs={{ span: 5, offset: 1 }} lg={{ span: 6, offset: 1 }}>
<Card <Card
className={"Competitionfirst"} className={"Competitionsecondary "}
cover={ cover={
<img <div className={"Competitionsecondarybox center"}>
alt="example" <li className=" pr Competitioncenter ">
src="https://gw.alipayobjects.com/zos/rmsportal/JiqGstEfoWAOHiTxclqi.png" <img src={getImageUrl("images/educoder/huangguan-three.png")}/>
/> <div className={"mt10"}>
<a href={`/users/${item.user_login}`} className="color-dark">
<img className={"rankingimg"} src={getImageUrl(item.user_image)} />
<p className="task-hide rankName mt5 jinshaifont">{item.record_user_name}</p>
</a>
</div>
</li>
</div>
} }
> >
<Meta <Meta
title="Card title" title={<div className={"center"}>
description="This is the description" <div className={"rankfonttop"}>{item.school_name}</div>
<div className={"rankfontmid"}>{item.spend_time}</div>
</div>}
description={
<div className={"rankfontbottom"}>{item.score}</div>
}
/> />
</Card> </Card>
</Col> </Col>
<Col className="mt30" xs={{ span: 5, offset: 1 }} lg={{ span: 6, offset: 1 }}> )
}
if(key===3){
return(
<Col className="mt40" xs={{ span: 5, offset: 1 }} lg={{ span: 6, offset: 2 }}>
<Card <Card
className={"Competitionsecondary"} className={"Competitionthird"}
cover={ cover={
<img <div className={"Competitionthirdbox center"}>
alt="example" <li className="pr Competitioncenter">
src="https://gw.alipayobjects.com/zos/rmsportal/JiqGstEfoWAOHiTxclqi.png" <img src={getImageUrl("images/educoder/huangguan-two.png")}/>
/> <div className={"mt10"}>
<a href={`/users/${item.user_login}`} className="color-dark">
<img className={"rankingimg"} src={getImageUrl(item.user_image)} />
<p className="task-hide rankName mt5 jinshaifont">{item.user_name}</p>
</a>
</div>
</li>
</div>
} }
> >
<Meta <Meta
title="Card title" title={<div className={"center"}>
description="This is the description" <div className={"rankfonttop"}>{item.school_name}</div>
<div className={"rankfontmid"}>{item.spend_time}</div>
</div>}
description={
<div className={"rankfontbottom"}>{item.score}</div>
}
/> />
</Card> </Card>
</Col> </Col>
)
}
})}
</Row> </Row>
<Row className={"mt80 mb80"}> <Row className={"mt80 mb80"}>
<Table className="Competitiontransparent" columns={columns} dataSource={data} showHeader={false} pagination={false}/> {chartdata===undefined?"":chartdata.teams.length===0?"":<Table className="Competitiontransparent" columns={columns} dataSource={data} showHeader={false} pagination={false}/>}
</Row> </Row>

@ -0,0 +1,225 @@
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) => {
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();
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) {
message.error('文件大小必须小于150MB!');
}
return isLt150M;
},
};
// console.log(this.props.tabkey)
// console.log(chart_rules)
console.log(this.props.mdContentdata)
return (
<div>
{chart_rules===undefined?"":this.props.module_type==="chart"?<Tabs activeKey={this.props.tabkey} onChange={(e)=>this.props.Competitioncallback(e)}>
{chart_rules.stages.map((item,key)=>{
return(
<TabPane tab={item.name} key={item.id===null?0:item.id}></TabPane>
)
})}
</Tabs>:""}
<TPMMDEditor ref={this.contentMdRef} placeholder="请输入任务内容说明最大限制5000个字符" mdID={'courseContentMD'} refreshTimeout={1500}
className="courseMessageMD" initValue={this.state.description}></TPMMDEditor>
{this.props.module_type==="chart"?"":<Upload {...uploadProps} className="upload_1 newWorkUpload">
<Button className="uploadBtn">
<Icon type="upload" /> 上传附件
</Button>
(单个文件150M以内)
</Upload>}
<div className="clearfix mt30 mb30">
{/* htmlType="submit" */}
<Button type="primary" onClick={this.handleSubmit} className="defalutSubmitbtn fl mr20">提交</Button>
<a className="defalutCancelbtn fl" onClick={() => this.props.hideCompetitionedit()}>取消</ a>
</div>
</div>
)
}
}
export default CompetitionContentsMd;

@ -2,13 +2,13 @@ import React, { Component } from 'react';
import { Redirect } from 'react-router'; import { Redirect } from 'react-router';
import { BrowserRouter as Router, Route, Link, Switch } from "react-router-dom"; import { Route, Link, Switch } from "react-router-dom";
import Loading from '../../Loading'; import Loading from '../../Loading';
import Loadable from 'react-loadable'; import Loadable from 'react-loadable';
import { TPMIndexHOC } from '../tpm/TPMIndexHOC'; import { TPMIndexHOC } from '../tpm/TPMIndexHOC';
import { SnackbarHOC } from 'educoder'; import { CNotificationHOC } from '../courses/common/CNotificationHOC';
//新版竞赛首页 //新版竞赛首页
const CompetitionsIndex = Loadable({ const CompetitionsIndex = Loadable({
@ -41,8 +41,7 @@ class Competitions extends Component {
} }
componentDidMount(){ componentDidMount(){
console.log("Competitions竞赛");
console.log(this.props);
window.document.title = '竞赛'; window.document.title = '竞赛';
} }
@ -90,4 +89,4 @@ class Competitions extends Component {
} }
} }
export default SnackbarHOC() (TPMIndexHOC (Competitions)) ; export default CNotificationHOC() (TPMIndexHOC (Competitions)) ;

@ -481,9 +481,9 @@ class CoursesBanner extends Component {
document.title=coursedata===undefined || coursedata.status===401 || coursedata.status===407?"":coursedata.name; document.title=coursedata===undefined || coursedata.status===401 || coursedata.status===407?"":coursedata.name;
return ( return (
<div> <div>
{ {/*{*/}
is_guide && <Guide></Guide> {/* is_guide && <Guide></Guide>*/}
} {/*}*/}
{AccountProfiletype===true?<AccountProfile {AccountProfiletype===true?<AccountProfile
hideAccountProfile={()=>this.hideAccountProfile()} hideAccountProfile={()=>this.hideAccountProfile()}

@ -385,10 +385,7 @@ class GraduationTasksedit extends Component{
{description===undefined?"": {description===undefined?"":
<div> <div>
{/*<Form >*/}
{/* <Form >*/}
{/*内容*/}
<div className="stud-class-set bor-bottom-greyE pt20 pl20 pr20 pb0 edu-back-white"> <div className="stud-class-set bor-bottom-greyE pt20 pl20 pr20 pb0 edu-back-white">
<Form.Item label="类型"> <Form.Item label="类型">

Loading…
Cancel
Save