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/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/show.html.erb b/app/views/admins/competition_settings/index.html.erb
similarity index 90%
rename from app/views/admins/competition_settings/show.html.erb
rename to app/views/admins/competition_settings/index.html.erb
index 6272687e4..4f53cb5d3 100644
--- a/app/views/admins/competition_settings/show.html.erb
+++ b/app/views/admins/competition_settings/index.html.erb
@@ -10,7 +10,9 @@
基础设置
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
diff --git a/public/react/src/modules/courses/busyWork/PublishRightnow.js b/public/react/src/modules/courses/busyWork/PublishRightnow.js
index ff6a8855d..5b31986ee 100644
--- a/public/react/src/modules/courses/busyWork/PublishRightnow.js
+++ b/public/react/src/modules/courses/busyWork/PublishRightnow.js
@@ -33,9 +33,12 @@ class PublishRightnow extends Component{
}
homeworkstart=()=>{
- const isPublish = this.props.isPublish;
+ const isPublish = this.props.isPublish;
+ const isPublishtype = this.props.isPublishtype;
+ let showdatatypes=isPublish===true||isPublishtype===1;
+
if (!this.props.checkBoxValues || this.props.checkBoxValues.length == 0) {
- this.props.showNotification(`请先选择要立即${isPublish ? "发布" : "截止"}的作业`)
+ this.props.showNotification(`请先选择要立即${showdatatypes? "发布" : "截止"}的作业`)
return;
}
@@ -45,26 +48,28 @@ class PublishRightnow extends Component{
}
showDialog = () => {
const isPublish = this.props.isPublish;
+ const isPublishtype = this.props.isPublishtype;
const dateFormat = 'YYYY-MM-DD HH:mm';
-
- // getNextHalfHourOfMoment
+ let showdatatype=isPublish===false||isPublishtype===undefined;
+ let showdatatypes=isPublish===true||isPublishtype===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 +129,15 @@ class PublishRightnow extends Component{
detail:true
}
}
-
+ const isPublishtype = this.props.isPublishtype;
+ let showdatatypes=isPublish===true||isPublishtype===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 +153,16 @@ class PublishRightnow extends Component{
// }
// }
fetchCourseGroups = () => {
+ const isPublish = this.props.isPublish;
+ 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
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,6 +185,8 @@ class PublishRightnow extends Component{
render(){
const isPublish = this.props.isPublish;
+ const isPublishtype = this.props.isPublishtype;
+ let showdatatypes=isPublish===true||isPublishtype===1;
let{
Topvalright,
@@ -239,7 +250,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..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 87a43ca1b..d10c8e87f 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(dateString,"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 ?"":
}
-
-
-
全选
+ {this.state.endtimetypeid!=undefined&&this.state.endtimetype===true?
{this.state.endtimetypevalue}
:""}
+ {course_groupstype===true?
+
:}
:""}