From 94d83f82d7c1858f9535c99e0d36d5fa345125c8 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Fri, 25 Oct 2019 15:11:28 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E5=AF=BC=E5=87=BA=E9=97=AE=E5=8D=B7?= =?UTF-8?q?=E5=8A=A0=E5=85=A5=E5=88=86=E7=8F=AD=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/polls_controller.rb | 5 +++-- app/helpers/export_helper.rb | 3 +-- app/models/course.rb | 4 ++++ 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/app/controllers/polls_controller.rb b/app/controllers/polls_controller.rb index bbd2a06fa..039d5e5c8 100644 --- a/app/controllers/polls_controller.rb +++ b/app/controllers/polls_controller.rb @@ -1363,7 +1363,7 @@ class PollsController < ApplicationController poll_ques_titles = poll_questions.pluck(:question_title).map {|k| ActionController::Base.helpers.strip_tags(k) if k.present?} poll_un_anony = poll.un_anonymous if poll_un_anony #是否匿名,默认为false - user_info = %w(登陆名 真实姓名 邮箱 学号 学员单位) + user_info = %w(登陆名 真实姓名 分班 邮箱 学号 学员单位) else user_info = [] end @@ -1436,9 +1436,10 @@ class PollsController < ApplicationController if poll_un_anony user_login = u_user.login user_name = u_user.real_name.present? ? u_user.real_name : "--" + user_class = poll.course.user_group_name 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_cell += [user_login,user_name, 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] end all_user_cell = user_cell + user_answer_array user_commit.push(all_user_cell) diff --git a/app/helpers/export_helper.rb b/app/helpers/export_helper.rb index 534a78dc1..1274e07c7 100644 --- a/app/helpers/export_helper.rb +++ b/app/helpers/export_helper.rb @@ -300,8 +300,7 @@ module ExportHelper export_ex_users.includes(user: :user_extension).each_with_index do |e_user,index| user_info = e_user.user - member = course.students.find_by_user_id(e_user.user_id) - user_course = member.try(:course_group_name) + user_course = course.user_group_name(e_user.user_id) user_obj_score = e_user.objective_score < 0.0 ? 0.0 : e_user.objective_score.round(1).to_s user_suj_score = e_user.subjective_score < 0.0 ? 0.0 : e_user.subjective_score.round(1).to_s user_score = e_user.score.present? ? e_user.score.round(1).to_s : 0.0 diff --git a/app/models/course.rb b/app/models/course.rb index 6dd361733..01eed30db 100644 --- a/app/models/course.rb +++ b/app/models/course.rb @@ -130,6 +130,10 @@ class Course < ApplicationRecord course_members.find_by(user_id: user_id, role: %i(STUDENT)) end + def user_group_name(user_id) + students.find_by(user_id: user_id)&.course_group_name + end + def teacher_group(user_id) data = From a6ad7db235b51440dd29f4f04fa003e6c2855904 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Fri, 25 Oct 2019 15:33:17 +0800 Subject: [PATCH 2/4] insertSpaces --- public/react/src/modules/page/MainContentContainer.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/public/react/src/modules/page/MainContentContainer.js b/public/react/src/modules/page/MainContentContainer.js index 96bf095f0..0620e19d7 100644 --- a/public/react/src/modules/page/MainContentContainer.js +++ b/public/react/src/modules/page/MainContentContainer.js @@ -369,6 +369,11 @@ class MainContentContainer extends Component { // 异常 直接重试 this.fetchRepositoryCode(props, null, null, true) } else{ + if (path && path.endsWith('.py')) { + editor_monaco.getModel().updateOptions({insertSpaces: true}) + } else { + editor_monaco.getModel().updateOptions({insertSpaces: false}) + } this.setState({ isEditablePath, currentPath: path }); this.oldRepositoryCode = ((fetchRepositoryCodeResponse.data.content === true || !fetchRepositoryCodeResponse.data.content) ? '' : fetchRepositoryCodeResponse.data.content); From e7dad06de2731afb5216ebce16ba412e4500b344 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Fri, 25 Oct 2019 15:39:02 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E5=90=88=E5=B9=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/config/webpack.config.prod.js | 2 +- .../modules/competition/CompetitionMaxImg.js | 3 - .../src/modules/competition/Registration.js | 353 +++++----- .../competition/comcss/competition.css | 88 ++- .../competition/competmodal/PersonModal.js | 616 ++++++++++++++---- .../competmodal/PersonalModalteam.js | 13 + .../personal/PersonalCompetititem.js | 176 +++-- .../Competitimain/CompetitionsIndex.js | 28 +- .../Competitimain/Competitionsindex.css | 28 +- .../Competition_teams/Competitionteams.js | 48 +- .../Competitioncommon/CompetitionCommon.css | 125 +++- .../Competitioncommon/CompetitionCommon.js | 240 ++++++- .../Competitioncommon/CompetitionContents.js | 19 +- .../CompetitionContentsChart.js | 319 +++++---- .../CompetitionContentsMd.js | 225 +++++++ .../src/modules/competitions/Competitions.js | 9 +- .../courses/coursesDetail/CoursesBanner.js | 6 +- .../graduation/tasks/GraduationTasksedit.js | 15 +- 18 files changed, 1755 insertions(+), 558 deletions(-) create mode 100644 public/react/src/modules/competitions/Competitioncommon/CompetitionContentsMd.js diff --git a/public/react/config/webpack.config.prod.js b/public/react/config/webpack.config.prod.js index 886d97313..1cc105517 100644 --- a/public/react/config/webpack.config.prod.js +++ b/public/react/config/webpack.config.prod.js @@ -321,7 +321,7 @@ module.exports = { }, compress: { drop_debugger: true, - drop_console: true + drop_console: false } } }), diff --git a/public/react/src/modules/competition/CompetitionMaxImg.js b/public/react/src/modules/competition/CompetitionMaxImg.js index c5d99a88b..ce12ade1c 100644 --- a/public/react/src/modules/competition/CompetitionMaxImg.js +++ b/public/react/src/modules/competition/CompetitionMaxImg.js @@ -16,9 +16,6 @@ class CompetitionMaxImg extends React.Component { componentDidUpdate = (prevProps) => { if (prevProps.GetenrollmentAPI != this.props.GetenrollmentAPI) { - // ////console.log("团队竞赛报名大图componentDidUpdate"); - // ////console.log(this.props); - // ////console.log(this.props.GetenrollmentAPI); this.setState({ GetenrollmentAPI: this.props.GetenrollmentAPI, }) diff --git a/public/react/src/modules/competition/Registration.js b/public/react/src/modules/competition/Registration.js index 9bffc492c..76fc40ba8 100644 --- a/public/react/src/modules/competition/Registration.js +++ b/public/react/src/modules/competition/Registration.js @@ -2,7 +2,8 @@ import React, {Component} from 'react'; import { BrowserRouter as Router, Route, - Switch + Switch, + Link } from 'react-router-dom'; import axios from 'axios'; import moment from 'moment'; @@ -62,13 +63,16 @@ class Registration extends React.Component { itemid: undefined, itemiddata: [], pint: 0, - + competition_name: undefined, + mutiple_limited: false, + teamutiple_limited: false, + members_count: 0, } } componentDidMount() { - console.log(this.props); + // console.log(this.props); // //////console.log("componentDidMount Registration"); // //// //////console.log("调用子组件 "); @@ -87,8 +91,8 @@ class Registration extends React.Component { componentDidUpdate = (prevProps) => { if (prevProps.user != this.props.user) { - console.log("componentDidUpdate"); - console.log(this.props); + // console.log("componentDidUpdate"); + // console.log(this.props); ////console.log("Registration"); ////console.log("componentDidUpdate"); ////console.log(this.props.user.admin); @@ -101,6 +105,7 @@ class Registration extends React.Component { //获取报名配置API GetenrollmentAPI = () => { + // console.log("调用了GetenrollmentAPI"); const url = `/competitions/${this.props.match.params.identifier}/competition_staff.json`; axios.get((url)).then((result) => { if (result) { @@ -112,26 +117,56 @@ class Registration extends React.Component { personal: result.data.personal, enroll_ended: result.data.enroll_ended, enrolled: result.data.enrolled, - teacher_staff: result.data.teacher_staff, - member_staff: result.data.member_staff, + teacher_staff: result.data.teacher_staff === undefined || result.data.teacher_staff === null ? undefined : result.data.teacher_staff, + member_staff: result.data.member_staff === undefined || result.data.member_staff === null ? undefined : result.data.member_staff, + }) - if (result.data.enroll_ended === true) { - this.setState({ - pint: 0 - }) - } else if (result.data.enrolled === true) { - this.setState({ - pint: 2 - }) - } else if (result.data.enrolled === false) { - this.setState({ - pint: 1 - }) + + 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) { + this.setState({ + pint: 0 + }) + } else if (result.data.enrolled === true) { + this.setState({ + pint: 2 + }) + } else if (result.data.enrolled === false) { + this.setState({ + pint: 1 + }) + } + } + } } }).catch((error) => { - //// //////console.log(error); + console.log("GetenrollmentAPI"); + console.log(error); }) } @@ -161,6 +196,8 @@ class Registration extends React.Component { data: result.data.my_teams, competition_teams: result.data.competition_teams, personal: result.data.personal, + competition_name: result.data.competition_name, + members_count: result.data.members_count }) } else { //普通账号 @@ -170,6 +207,8 @@ class Registration extends React.Component { data: result.data.my_teams, competition_teams: result.data.competition_teams, personal: result.data.personal, + competition_name: result.data.competition_name, + members_count: result.data.members_count }) } } else { @@ -183,6 +222,9 @@ class Registration extends React.Component { count: result.data.count, competition_teams: result.data.competition_teams, personal: result.data.personal, + competition_name: result.data.competition_name, + members_count: result.data.members_count + }) } else { @@ -192,6 +234,9 @@ class Registration extends React.Component { count: result.data.count, competition_teams: result.data.competition_teams, 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, count: result.data.count, personal: result.data.personal, + competition_name: result.data.competition_name, + members_count: result.data.members_count + }) } else { @@ -212,6 +260,9 @@ class Registration extends React.Component { data: result.data.my_teams, count: result.data.count, 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, competition_teams: result.data.competition_teams, 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) => { - //搜索关键字 keyword - //页数 page - //分页 per_page - const datas = { - keyword: keyword, - page: page, - per_page: per_page, - }; - let url = `/competitions/${this.props.match.params.identifier}/competition_teams.json`; - axios.get((url), {params: datas}).then((result) => { - this.setState({ - loadingstate: false, - }) - if (result) { - if (result.data) { - //// //////console.log(result); - if (result.data.personal === false) { - //不是个人赛 - ////console.log("Getdatatype5"); - ////console.log(result.data.my_teams.length); - if (result.data.my_teams.length === 0) { - // 没有创建数据的 - //管理员 - ////console.log("a"); - ////console.log(this.state.competition_teams); - ////console.log(result.data.competition_teams); - this.setState({ - type: 4, - count: result.data.count, - competition_teams: result.data.competition_teams, - data: result.data.my_teams, - personal: result.data.personal, - - }) - } else { - //有数据的 - ////console.log("b"); - - if (result.data.my_teams[0].manage_permission === true) { - this.setState({ - type: 5, - data: result.data.my_teams, - count: result.data.count, - competition_teams: result.data.competition_teams, - personal: result.data.personal, - - - }) - } else { - ////console.log("c"); - - this.setState({ - type: 4, - data: result.data.my_teams, - count: result.data.count, - competition_teams: result.data.competition_teams, - personal: result.data.personal, - - }) - } - } - } else { - //团队赛 - //////console.log("d"); - - this.setState({ - type: 6, - data: result.data.my_teams, - count: result.data.count, - competition_teams: result.data.competition_teams, - personal: result.data.personal, - - }) - } - - } - } - - }).catch((error) => { - ////console.log("k"); - - ////console.log(error); - ////console.log("报错了"); - if (admin === true) { - //管理员 - this.setState({ - count: 0, - competition_teams: [], - data: [], - loadingstate: false, - }) - } else { - //普通账号 - this.setState({ - count: 0, - competition_teams: [], - data: [], - loadingstate: false, - }) - } - }) - } + // Getdatatype5 = (keyword, page, per_page, admin) => { + // //搜索关键字 keyword + // //页数 page + // //分页 per_page + // const datas = { + // keyword: keyword, + // page: page, + // per_page: per_page, + // }; + // let url = `/competitions/${this.props.match.params.identifier}/competition_teams.json`; + // axios.get((url), {params: datas}).then((result) => { + // this.setState({ + // loadingstate: false, + // }) + // if (result) { + // if (result.data) { + // //// //////console.log(result); + // if (result.data.personal === false) { + // //不是个人赛 + // ////console.log("Getdatatype5"); + // ////console.log(result.data.my_teams.length); + // if (result.data.my_teams.length === 0) { + // // 没有创建数据的 + // //管理员 + // ////console.log("a"); + // ////console.log(this.state.competition_teams); + // ////console.log(result.data.competition_teams); + // this.setState({ + // type: 4, + // count: result.data.count, + // competition_teams: result.data.competition_teams, + // data: result.data.my_teams, + // personal: result.data.personal, + // competition_name: result.data.competition_name, + // members_count:result.data.members_count + // + // + // }) + // } else { + // //有数据的 + // ////console.log("b"); + // + // if (result.data.my_teams[0].manage_permission === true) { + // this.setState({ + // type: 5, + // data: result.data.my_teams, + // count: result.data.count, + // competition_teams: result.data.competition_teams, + // personal: result.data.personal, + // competition_name: result.data.competition_name, + // members_count:result.data.members_count + // + // + // }) + // } else { + // ////console.log("c"); + // + // this.setState({ + // type: 4, + // data: result.data.my_teams, + // count: result.data.count, + // competition_teams: result.data.competition_teams, + // personal: result.data.personal, + // competition_name: result.data.competition_name, + // members_count:result.data.members_count + // + // + // }) + // } + // } + // } else { + // //团队赛 + // //////console.log("d"); + // + // this.setState({ + // type: 6, + // data: result.data.my_teams, + // count: result.data.count, + // competition_teams: result.data.competition_teams, + // personal: result.data.personal, + // competition_name: result.data.competition_name, + // members_count:result.data.members_count + // + // + // }) + // } + // + // } + // } + // + // }).catch((error) => { + // ////console.log("k"); + // + // ////console.log(error); + // ////console.log("报错了"); + // if (admin === true) { + // //管理员 + // this.setState({ + // count: 0, + // competition_teams: [], + // data: [], + // loadingstate: false, + // }) + // } else { + // //普通账号 + // this.setState({ + // count: 0, + // competition_teams: [], + // data: [], + // loadingstate: false, + // }) + // } + // }) + // } //团队竞赛翻页 @@ -370,7 +435,7 @@ class Registration extends React.Component { loadingstate: true, }) 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({ messagePerbool: true, - intpermessages: "您已报名,无需重复报" + intpermessages: "你已经报名,不能重复报名" }) return; } @@ -493,7 +558,7 @@ class Registration extends React.Component { }) if (bool) { //确认 - + this.Refreshteam(); } else { //取消 @@ -556,7 +621,7 @@ class Registration extends React.Component { 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) => { if (response) { if (response.data) { @@ -587,7 +652,7 @@ class Registration extends React.Component { pages: 1, 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() { - 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 ( -
创建者
: -{item.type === undefined || item.type === null || item.type === "" ? "--" : item.type}
+ >{item.type === undefined || item.type === null || item.type === "" ? "--" : item.type} } -{item.school_name === undefined || item.school_name === null || item.school_name === "" ? "--" : item.school_name}
-{item.school_name === undefined || item.school_name === null || item.school_name === "" ? "--" : item.school_name} + {item.identity === undefined || item.identity === null || item.identity === "" ? "--" : item.identity}
+ >{item.identity === undefined || item.identity === null || item.identity === "" ? "--" : item.identity} { index === 0 ? - : -
);
var cpersondiv1Items = [];
+ // console.log("this.props.teamutiple_limited ");
+ // console.log(this.props.teamutiple_limited );
if (teacher_ids) {
cpersondiv1Items = teacher_ids.map((item, index) =>
-
+ {item.name === undefined || item.name === null || item.name === "" ? "--" : item.name} {item.identity === undefined || item.identity === null || item.identity === "" ? "--" : item.identity} {item.school_name === undefined || item.school_name === null || item.school_name === "" ? "--" : item.school_name}
--
+ : + {item.identity}} + {item.school_name === undefined || item.school_name === null || item.school_name === "" ? + +--
+ : + {item.school_name} + } + + { + this.props.teamutiple_limited === undefined || this.props.teamutiple_limited === null ? +{""}
+ : + ( + this.props.teamutiple_limited === true ? +{item.enrollable === false ? "已加入其他战队" : ""}
+ : +{""}
+ ) + + } + + + +{item.name === undefined || item.name === null || item.name === "" ? "--" : item.name}
-{item.identity === undefined || item.identity === null || item.identity === "" ? "--" : item.identity}
-{item.school_name === undefined || item.school_name === null || item.school_name === "" ? "--" : item.school_name}
-{item.enrollable === false ? "" : "已加入其他战队"}
---
+ : + {"学号:" + item.student_id}} + {item.school_name === undefined || item.school_name === null || item.school_name === "" ? + +--
+ : + {item.school_name} + } + + { + this.props.mutiple_limited === undefined || this.props.mutiple_limited === null ? +{""}
+ : + ( + this.props.mutiple_limited === true ? +{item.enrollable === false ? "已加入其他战队" : ""}
+ : +{""}
+ ) + + } + + + +战队队员为{GetenrollmentAPI.member_staff.minimum}-{GetenrollmentAPI.member_staff.maximum}人,现在为{Thecurrentnumberstu}人
- + : "" + ) : + "" + }{data[0].name}
+
+
+
+
+ : index === 5 ?
+ this.props.Exittheteamshow(data[0].id, true)}>删除战队
+this.props.Exittheteamshow(data[0].id, false)}>删除战队
this.props.Createateamedit(data[0])}>编辑战队
@@ -194,12 +255,13 @@ class PersonalCompetititem extends React.Component {this.props.Exittheteamshow(data[0].id, false)}>退出战队
+this.props.Exittheteamshow(data[0].id, false)}>删除战队
+this.props.Createateamedit(data[0])}>编辑战队