diff --git a/app/assets/javascripts/admins/competition_settings/index.js b/app/assets/javascripts/admins/competition_settings/index.js index 2dbd65299..e974d2550 100644 --- a/app/assets/javascripts/admins/competition_settings/index.js +++ b/app/assets/javascripts/admins/competition_settings/index.js @@ -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); } }); 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 = diff --git a/app/views/admins/competition_settings/index.html.erb b/app/views/admins/competition_settings/index.html.erb index 66904fc48..f59f659ee 100644 --- a/app/views/admins/competition_settings/index.html.erb +++ b/app/views/admins/competition_settings/index.html.erb @@ -97,13 +97,8 @@
主办方
-
- + - +
+ <%= select_tag :sponsor_ids, options_for_select([], nil), class: 'form-control sponsor-select' %>
@@ -111,13 +106,8 @@
开放范围
-
- + - +
+ <%= select_tag :allow_school_ids, options_for_select([], nil), class: 'form-control allow-school-select' %>
@@ -500,4 +490,4 @@ -<% end %> +<% end %> \ No newline at end of file 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.name === undefined || item.name === null || item.name === "" ? "--" : item.name}

+ >{item.name === undefined || item.name === null || item.name === "" ? "--" : item.name}
{ index === 0 ?

创建者

: -

{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) => - +

  • this.getdatacpersondiv1Items(item)} + onMouseDown={() => this.getdatacpersondiv1Items(item)} + > -

    {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.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} + } + + { + this.props.teamutiple_limited === undefined || this.props.teamutiple_limited === null ? +

    {""}

    + : + ( + this.props.teamutiple_limited === true ? +

    {item.enrollable === false ? "已加入其他战队" : ""}

    + : +

    {""}

    + ) + + } + + +
  • +
    ); } const cpersondiv1 = (
    -
    +
    { cpersondiv1Items.length === 0 ? @@ -778,48 +1073,115 @@ class PersonModal extends Component { var persondiv2Items = []; if (member_ids) { persondiv2Items = member_ids.map((item, index) => - + + +
  • this.getdatacpersondiv1Items2(item)} + onMouseDown={() => this.getdatacpersondiv1Items2(item)} > -

    {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.name === undefined || item.name === null || item.name === "" ? + -- + : + {item.name} + } + {item.student_id === undefined || item.student_id === null || item.student_id === "" ? +

    --

    + : + {"学号:" + 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 ? "已加入其他战队" : ""}

    + : +

    {""}

    + ) + + } + + +
  • +
    ); } const persondiv2 = (
    {/*this.state.loading2*/} -
    +
    { persondiv2Items.length === 0 ? @@ -857,16 +1219,16 @@ class PersonModal extends Component { width="620px" > - + {/**/}
    {/*队名*/} - {/* this.onSearch(value)}*/} - {/*/>*/} trigger.parentNode} visible={this.state.person2}> @@ -1021,6 +1379,7 @@ class PersonModal extends Component { placeholder="请输入想要队员姓名的任意关键字进行搜索" onPressEnter={this.startSearch2} onFocus={this.inputOnFocus2} + onBlur={this.inputOnBlur2} onChange={(e) => this.studentsonChange(e)} value={this.state.keywordstudents} suffix={ @@ -1114,8 +1473,21 @@ class PersonModal extends Component { ) : "" } + { + GetenrollmentAPI && GetenrollmentAPI.member_staff ? + ( + Thecurrentnumberboolstu === true ? +

    战队队员为{GetenrollmentAPI.member_staff.minimum}-{GetenrollmentAPI.member_staff.maximum}人,现在为{Thecurrentnumberstu}人

    - + : "" + ) : + "" + }
    { + 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`; axios.post(url, { invite_code: this.state.yslzxueshiskmcdm1 diff --git a/public/react/src/modules/competition/personal/PersonalCompetititem.js b/public/react/src/modules/competition/personal/PersonalCompetititem.js index bd6a092eb..32bd796fb 100644 --- a/public/react/src/modules/competition/personal/PersonalCompetititem.js +++ b/public/react/src/modules/competition/personal/PersonalCompetititem.js @@ -9,13 +9,21 @@ import moment from 'moment'; import {SnackbarHOC, WordsBtn, getImageUrl} from 'educoder'; import {TPMIndexHOC} from '../../tpm/TPMIndexHOC'; import competition from '../comcss/competition.css'; -import {Button, message} from 'antd'; +import {Button, message, Tooltip} from 'antd'; // 点击按钮复制功能 function jsCopy() { var e = document.getElementById("copy_invite_code"); e.select(); document.execCommand("Copy"); 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() { @@ -80,7 +88,7 @@ class PersonalCompetititem extends React.Component { marginTop: "29px", marginLeft: "37px" }}> -

    {data[0].name}

    -
    - { - data && data[0].team_members.map((item, index) => { - return ( + {this.props.type === 5 || this.props.type === 2 ? +
    + { + data && data[0].team_members.map((item, index) => { + return ( + + index === 0 ? + + + + : index === 1 ? + + + + : index === 2 ? + + + + : index === 3 ? +
    + + + - index === 0 ? - + + + +
    + : "" + ) + }) + } - - : index === 1 ? - +
    : +
    + { + data && data[0].team_members.map((item, index) => { + return ( - - : index === 2 ? - + index === 0 ? + - - : index === 3 ? + + : index === 1 ? - : index === 4 ? + : index === 2 ? - : index === 5 ? -
    + : index === 3 ? + : index === 4 ? + - + + : index === 5 ? +
    + - -
    - : "" - ) - }) - } + -
    -
    + + +
    + : "" + ) + }) + } + +
    + } +
    -
    +
    邀请码: {data[0].invite_code === null || data[0].invite_code === undefined ? "" : data[0].invite_code}
    @@ -166,27 +218,36 @@ class PersonalCompetititem extends React.Component { > : - { - jsCopy() - }} - > - - + + { + jsCopy() + }} + > + + } { this.props.type === 5 ? -
    -
    this.props.Exittheteamshow(data[0].id, true)}> -

    this.props.Exittheteamshow(data[0].id, true)}>删除战队

    + +
    this.props.Exittheteamshow(data[0].id, false)}> +

    this.props.Exittheteamshow(data[0].id, false)}>删除战队

    this.props.Createateamedit(data[0])}>

    this.props.Createateamedit(data[0])}>编辑战队

    @@ -194,12 +255,13 @@ class PersonalCompetititem extends React.Component {
    : this.props.type === 2 ? -
    -
    + + -
    this.props.Exittheteamshow(data[0].id, false)}> -

    this.props.Exittheteamshow(data[0].id, false)}>退出战队

    +
    this.props.Exittheteamshow(data[0].id, false)}> +

    this.props.Exittheteamshow(data[0].id, false)}>删除战队

    +
    +
    this.props.Createateamedit(data[0])}> +

    this.props.Createateamedit(data[0])}>编辑战队

    -
    : this.props.type === 3 ? diff --git a/public/react/src/modules/competitions/Competitimain/CompetitionsIndex.js b/public/react/src/modules/competitions/Competitimain/CompetitionsIndex.js index 61e6419b7..2009588b4 100644 --- a/public/react/src/modules/competitions/Competitimain/CompetitionsIndex.js +++ b/public/react/src/modules/competitions/Competitimain/CompetitionsIndex.js @@ -1,20 +1,11 @@ import React, { Component } from 'react'; 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 axios from 'axios'; import './Competitionsindex.css'; import NoneData from "../../courses/coursesPublic/NoneData"; -const { SubMenu } = Menu; - -const IconText = ({ type, text }) => ( - - - {text} - -); - class CompetitionsIndex extends Component{ constructor(props) { super(props) @@ -78,9 +69,8 @@ class CompetitionsIndex extends Component{ } render() { let {datas,page,count}=this.state; - admin: true - business: false - console.log(this.props.current_user&&this.props.current_user.business) + + return (
    @@ -133,7 +123,11 @@ class CompetitionsIndex extends Component{ dataSource={datas&&datas} renderItem={(item,key) => (
    +
    + {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?"":
    即将发布 敬请期待
    :""} + {/*
    即将发布 敬请期待
    */} {item.description===null||item.description===undefined||item.description===""? 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);