From 6e105509ed76593886983fdab23c2f4717ba88ba Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Tue, 22 Oct 2019 15:31:59 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E7=AB=9E=E8=B5=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/admins/competition_settings_controller.rb | 2 +- .../competition_settings/{show.html.erb => index.html.erb} | 0 config/routes.rb | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) rename app/views/admins/competition_settings/{show.html.erb => index.html.erb} (100%) diff --git a/app/controllers/admins/competition_settings_controller.rb b/app/controllers/admins/competition_settings_controller.rb index 390ad17e8..25d590cc1 100644 --- a/app/controllers/admins/competition_settings_controller.rb +++ b/app/controllers/admins/competition_settings_controller.rb @@ -1,5 +1,5 @@ class Admins::CompetitionSettingsController < Admins::BaseController - def show + def index @competition = current_competition end diff --git a/app/views/admins/competition_settings/show.html.erb b/app/views/admins/competition_settings/index.html.erb similarity index 100% rename from app/views/admins/competition_settings/show.html.erb rename to app/views/admins/competition_settings/index.html.erb diff --git a/config/routes.rb b/config/routes.rb index 63450239c..9be68d174 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -787,7 +787,7 @@ Rails.application.routes.draw do resources :competitions, only: [:index, :show, :update] do resources :competition_modules, only: [:index, :show, :update] resource :competition_staff - resources :competition_teams, only: [:index, :show] do + resources :competition_teams, only: [:index, :show, :create, :update] do post :join, on: :collection post :leave, on: :member get :course_detail, on: :member From 9f5c54a063c00b81d696f929055feb8bdfad49a0 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Tue, 22 Oct 2019 15:35:56 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E7=AB=9E=E8=B5=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/competitions/create_personal_team_service.rb | 2 +- app/views/admins/competition_settings/index.html.erb | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/services/competitions/create_personal_team_service.rb b/app/services/competitions/create_personal_team_service.rb index 12b595cae..7f2123ce7 100644 --- a/app/services/competitions/create_personal_team_service.rb +++ b/app/services/competitions/create_personal_team_service.rb @@ -20,7 +20,7 @@ class Competitions::CreatePersonalTeamService < ApplicationService raise Error, '您已报名该竞赛' if enrolled && multiple_limited ActiveRecord::Base.transaction do - team = competition.competition_teams.create!(name: user.show_name, user_id: user.id) + team = competition.competition_teams.create!(name: user.real_name, user_id: user.id) team.team_members.create!(competition_id: competition, user_id: user.id, role: 1, is_teacher: is_teacher) end end diff --git a/app/views/admins/competition_settings/index.html.erb b/app/views/admins/competition_settings/index.html.erb index 6272687e4..4f53cb5d3 100644 --- a/app/views/admins/competition_settings/index.html.erb +++ b/app/views/admins/competition_settings/index.html.erb @@ -10,7 +10,9 @@ 基础设置
+
+
From 64d0280e73e0dbe59737c6dc7117f8923be1ad4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Tue, 22 Oct 2019 15:57:29 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../courses/busyWork/PublishRightnow.js | 48 +++++++++++-------- .../modules/courses/busyWork/commonWork.js | 2 +- .../coursesPublic/OneSelfOrderModal.js | 37 +++++++++++--- 3 files changed, 59 insertions(+), 28 deletions(-) diff --git a/public/react/src/modules/courses/busyWork/PublishRightnow.js b/public/react/src/modules/courses/busyWork/PublishRightnow.js index ff6a8855d..5d201fac2 100644 --- a/public/react/src/modules/courses/busyWork/PublishRightnow.js +++ b/public/react/src/modules/courses/busyWork/PublishRightnow.js @@ -33,9 +33,11 @@ class PublishRightnow extends Component{ } homeworkstart=()=>{ - const isPublish = this.props.isPublish; + const isPublish = this.props.isPublish; + let showdatatypes=isPublish===true||isPublish===1; + if (!this.props.checkBoxValues || this.props.checkBoxValues.length == 0) { - this.props.showNotification(`请先选择要立即${isPublish ? "发布" : "截止"}的作业`) + this.props.showNotification(`请先选择要立即${showdatatypes? "发布" : "截止"}的作业`) return; } @@ -46,25 +48,26 @@ class PublishRightnow extends Component{ showDialog = () => { const isPublish = this.props.isPublish; const dateFormat = 'YYYY-MM-DD HH:mm'; - - // getNextHalfHourOfMoment + let showdatatype=isPublish===true&&isPublish!=1; + let showdatatypes=isPublish===true||isPublish===1; + // getNextHalfHourOfMoment const startMoment = (moment()); this.setState({ - modalname: isPublish ? "立即发布" : "立即截止", + modalname: showdatatypes ? "立即发布" : "立即截止", modaltype:1, - visible:isPublish?false:true, - OneSelftype:isPublish?true:false, - Topval: isPublish ? "学生将立即收到作业" : "学生将不能再提交作品", + visible:showdatatype?false:true, + OneSelftype:showdatatype?true:false, + Topval:showdatatypes ? "学生将立即收到作业" : "学生将不能再提交作品", // Botvalleft: isPublish ? "暂不发布" : "暂不截止", - Botval: this.props.fromListPage ? (isPublish ? "本操作只对“未发布”的分班有效" : "本操作只对“提交中”的分班有效") : '', - starttime: isPublish ? `发布时间:${startMoment.format(dateFormat)}` : '', - starttimes:isPublish ? `${startMoment.format(dateFormat)}` : '', - endtime: isPublish ? `截止时间:${startMoment.add(1, 'months').add(1, 'hours').minutes(0).format(dateFormat)}` : '', - Cancelname:isPublish ? "暂不发布" : "暂不截止", - Savesname:isPublish ? "立即发布" : "立即截止", + Botval: this.props.fromListPage ? (showdatatypes ? "本操作只对“未发布”的分班有效" : "本操作只对“提交中”的分班有效") : '', + starttime: showdatatypes? `发布时间:${startMoment.format(dateFormat)}` : '', + starttimes:showdatatypes? `${startMoment.format(dateFormat)}` : '', + endtime:showdatatypes ? `截止时间:${startMoment.add(1, 'months').add(1, 'hours').minutes(0).format(dateFormat)}` : '', + Cancelname:showdatatypes ? "暂不发布" : "暂不截止", + Savesname:showdatatypes ? "立即发布" : "立即截止", Cancel:this.homeworkhide, Saves:this.homeworkstartend, - typs:isPublish ? "start" : "end", + typs:showdatatypes ? "start" : "end", }) } homeworkhide=()=>{ @@ -124,14 +127,15 @@ class PublishRightnow extends Component{ detail:true } } - + + let showdatatypes=isPublish===true||isPublish===1; let coursesId=this.props.match.params.coursesId; - const url = `/courses/${coursesId}/homework_commons/${isPublish ? "publish_homework" : "end_homework"}.json` + const url = `/courses/${coursesId}/homework_commons/${showdatatypes ? "publish_homework" : "end_homework"}.json` axios.post(url, data) .then((response) => { if (response.data.status == 0) { this.homeworkhide() - this.props.showNotification(isPublish ? "立即发布成功" : "立即截止成功") + this.props.showNotification(showdatatypes ? "立即发布成功" : "立即截止成功") this.props.doWhenSuccess && this.props.doWhenSuccess() this.setState({ visible : false }) this.props.action && this.props.action() @@ -147,13 +151,15 @@ class PublishRightnow extends Component{ // } // } fetchCourseGroups = () => { + const isPublish = this.props.isPublish; + let showdatatypes=isPublish===true||isPublish===1; let coursesId=this.props.match.params.coursesId; // TODO 这里要改成单选作业,接口使用这个 https://www.showdoc.cc/127895880302646?page_id=2035541497546668 // /homework_commons/:id/publish_groups.json let url = `/courses/${coursesId}/all_course_groups.json` if (this.props.checkBoxValues.length == 1) { const isPublish = this.props.isPublish; - url = `/homework_commons/${this.props.checkBoxValues[0]}/${ isPublish ? 'publish_groups' : 'end_groups'}.json` + url = `/homework_commons/${this.props.checkBoxValues[0]}/${ showdatatypes ? 'publish_groups' : 'end_groups'}.json` } axios.get(url, { @@ -176,7 +182,7 @@ class PublishRightnow extends Component{ render(){ const isPublish = this.props.isPublish; - + let showdatatypes=isPublish===true||isPublish===1; let{ Topvalright, modalname, @@ -239,7 +245,7 @@ class PublishRightnow extends Component{ starttimesend={this.state.starttimesend} typs={this.state.typs} /> - { showActionButton && { isPublish ? "立即发布" : "立即截止" } } + { showActionButton && { showdatatypes ? "立即发布" : "立即截止" } } ) } diff --git a/public/react/src/modules/courses/busyWork/commonWork.js b/public/react/src/modules/courses/busyWork/commonWork.js index f6a989354..bf54e130c 100644 --- a/public/react/src/modules/courses/busyWork/commonWork.js +++ b/public/react/src/modules/courses/busyWork/commonWork.js @@ -431,7 +431,7 @@ class commonWork extends Component{ > + isPublish={1} doWhenSuccess={this.doWhenSuccess} fromListPage={true}> { mainList && mainList.course_identity < 5 && mainList.homeworks.length>0 &&
diff --git a/public/react/src/modules/courses/coursesPublic/OneSelfOrderModal.js b/public/react/src/modules/courses/coursesPublic/OneSelfOrderModal.js index 87a43ca1b..a07347b40 100644 --- a/public/react/src/modules/courses/coursesPublic/OneSelfOrderModal.js +++ b/public/react/src/modules/courses/coursesPublic/OneSelfOrderModal.js @@ -161,7 +161,21 @@ class OneSelfOrderModal extends Component{ } onChangeTimeendlist=(date, dateString,id)=>{ - let {course_groups}=this.state; + let {course_groups,endtimetypeid}=this.state; + if(endtimetypeid===id){ + if(date!=null){ + this.setState({ + endtimetypeid:undefined + }) + } + if(moment(items.end_time,"YYYY-MM-DD HH:mm") <= moment(this.props.starttime,"YYYY-MM-DD HH:mm")){}else{ + if(date!=null){ + this.setState({ + endtimetypeid:undefined + }) + } + } + } let arr=course_groups; arr.map((item,key)=>{ @@ -219,6 +233,13 @@ class OneSelfOrderModal extends Component{ // arr.push(moment(moment(handleDateString(this.props.staytime)).add(1, 'week')).format("YYYY-MM-DD HH:mm")) }else{ + if(moment(items.end_time,"YYYY-MM-DD HH:mm") <= moment(this.props.starttime,"YYYY-MM-DD HH:mm")){ + this.setState({ + endtimetype:true, + endtimetypevalue:"必须晚于发布时间" + }) + return + } arr.push(items.end_time) } } @@ -256,6 +277,7 @@ class OneSelfOrderModal extends Component{ render(){ let {group_ids,endtime,course_groups}=this.state; // console.log(course_groups) + let course_groupstype=course_groups===undefined||course_groups.length===0; // TODO course_groups为空时的处理 return(
@@ -377,7 +399,7 @@ class OneSelfOrderModal extends Component{
} {this.props.modaltype===undefined||this.props.modaltype===2 - || this.props.usingCheckBeforePost ?"":
:""} From 5d5be45eeecf97a4a41ee0479360d9bb48b68868 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Tue, 22 Oct 2019 16:08:04 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../courses/busyWork/PublishRightnow.js | 19 ++++++++++++------- .../modules/courses/busyWork/commonWork.js | 4 +++- .../coursesPublic/OneSelfOrderModal.js | 2 +- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/public/react/src/modules/courses/busyWork/PublishRightnow.js b/public/react/src/modules/courses/busyWork/PublishRightnow.js index 5d201fac2..5b31986ee 100644 --- a/public/react/src/modules/courses/busyWork/PublishRightnow.js +++ b/public/react/src/modules/courses/busyWork/PublishRightnow.js @@ -34,7 +34,8 @@ class PublishRightnow extends Component{ homeworkstart=()=>{ const isPublish = this.props.isPublish; - let showdatatypes=isPublish===true||isPublish===1; + const isPublishtype = this.props.isPublishtype; + let showdatatypes=isPublish===true||isPublishtype===1; if (!this.props.checkBoxValues || this.props.checkBoxValues.length == 0) { this.props.showNotification(`请先选择要立即${showdatatypes? "发布" : "截止"}的作业`) @@ -47,9 +48,10 @@ class PublishRightnow extends Component{ } showDialog = () => { const isPublish = this.props.isPublish; + const isPublishtype = this.props.isPublishtype; const dateFormat = 'YYYY-MM-DD HH:mm'; - let showdatatype=isPublish===true&&isPublish!=1; - let showdatatypes=isPublish===true||isPublish===1; + let showdatatype=isPublish===false||isPublishtype===undefined; + let showdatatypes=isPublish===true||isPublishtype===1; // getNextHalfHourOfMoment const startMoment = (moment()); this.setState({ @@ -127,8 +129,8 @@ class PublishRightnow extends Component{ detail:true } } - - let showdatatypes=isPublish===true||isPublish===1; + const isPublishtype = this.props.isPublishtype; + let showdatatypes=isPublish===true||isPublishtype===1; let coursesId=this.props.match.params.coursesId; const url = `/courses/${coursesId}/homework_commons/${showdatatypes ? "publish_homework" : "end_homework"}.json` axios.post(url, data) @@ -152,7 +154,8 @@ class PublishRightnow extends Component{ // } fetchCourseGroups = () => { const isPublish = this.props.isPublish; - let showdatatypes=isPublish===true||isPublish===1; + const isPublishtype = this.props.isPublishtype; + let showdatatypes=isPublish===true||isPublishtype===1; let coursesId=this.props.match.params.coursesId; // TODO 这里要改成单选作业,接口使用这个 https://www.showdoc.cc/127895880302646?page_id=2035541497546668 // /homework_commons/:id/publish_groups.json @@ -182,7 +185,9 @@ class PublishRightnow extends Component{ render(){ const isPublish = this.props.isPublish; - let showdatatypes=isPublish===true||isPublish===1; + const isPublishtype = this.props.isPublishtype; + let showdatatypes=isPublish===true||isPublishtype===1; + let{ Topvalright, modalname, diff --git a/public/react/src/modules/courses/busyWork/commonWork.js b/public/react/src/modules/courses/busyWork/commonWork.js index bf54e130c..d07513c50 100644 --- a/public/react/src/modules/courses/busyWork/commonWork.js +++ b/public/react/src/modules/courses/busyWork/commonWork.js @@ -431,7 +431,9 @@ class commonWork extends Component{ > + isPublish={true} + isPublishtype={1} + doWhenSuccess={this.doWhenSuccess} fromListPage={true}> { mainList && mainList.course_identity < 5 && mainList.homeworks.length>0 &&
diff --git a/public/react/src/modules/courses/coursesPublic/OneSelfOrderModal.js b/public/react/src/modules/courses/coursesPublic/OneSelfOrderModal.js index a07347b40..d10c8e87f 100644 --- a/public/react/src/modules/courses/coursesPublic/OneSelfOrderModal.js +++ b/public/react/src/modules/courses/coursesPublic/OneSelfOrderModal.js @@ -168,7 +168,7 @@ class OneSelfOrderModal extends Component{ endtimetypeid:undefined }) } - if(moment(items.end_time,"YYYY-MM-DD HH:mm") <= moment(this.props.starttime,"YYYY-MM-DD HH:mm")){}else{ + if(moment(dateString,"YYYY-MM-DD HH:mm") <= moment(this.props.starttime,"YYYY-MM-DD HH:mm")){}else{ if(date!=null){ this.setState({ endtimetypeid:undefined