From 276eb9c4a72a200726405117354bbf29b3d8cc4c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com>
Date: Sat, 19 Oct 2019 15:37:33 +0800
Subject: [PATCH 1/4] =?UTF-8?q?=E5=AE=9E=E8=AE=AD=E4=BD=9C=E4=B8=9A?=
=?UTF-8?q?=E8=AF=A6=E6=83=85=E3=80=81=E6=99=AE=E9=80=9A=E4=BD=9C=E4=B8=9A?=
=?UTF-8?q?=E8=AF=A6=E6=83=85=E3=80=81=E5=88=86=E7=BB=84=E4=BD=9C=E4=B8=9A?=
=?UTF-8?q?=E8=AF=A6=E6=83=85tab=E7=9A=84=E7=AB=8B=E5=8D=B3=E5=8F=91?=
=?UTF-8?q?=E5=B8=83=E6=94=B9=E7=89=88?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../courses/busyWork/CommonWorkDetailIndex.js | 5 -
.../courses/busyWork/PublishRightnow.js | 53 +++++-
.../coursesPublic/OneSelfOrderModal.js | 178 +++++++++++++-----
.../graduation/tasks/GraduationTaskDetail.js | 36 +++-
.../shixunHomework/Listofworksstudentone.js | 104 +++++++---
.../shixunHomework/ShixunHomeworkPage.js | 41 +---
.../shixunHomework/ShixunStudentWork.js | 70 ++++++-
.../shixunHomework/Trainingjobsetting.js | 83 ++++++--
.../shixunHomework/Workquestionandanswer.js | 80 ++++++--
public/react/src/modules/home/shixunsHome.js | 2 +-
10 files changed, 491 insertions(+), 161 deletions(-)
diff --git a/public/react/src/modules/courses/busyWork/CommonWorkDetailIndex.js b/public/react/src/modules/courses/busyWork/CommonWorkDetailIndex.js
index 86b17e802..134be31c3 100644
--- a/public/react/src/modules/courses/busyWork/CommonWorkDetailIndex.js
+++ b/public/react/src/modules/courses/busyWork/CommonWorkDetailIndex.js
@@ -4,13 +4,8 @@ import {Link} from 'react-router-dom';
import {BrowserRouter as Router,Route,Switch} from 'react-router-dom';
import Loadable from 'react-loadable';
import Loading from '../../../Loading';
-import { CNotificationHOC } from '../common/CNotificationHOC'
-import { RouteHOC } from './common'
-
-import locale from 'antd/lib/date-picker/locale/zh_CN';
import { WordsBtn, MarkdownToHtml, trigger, queryString, downloadFile } from 'educoder';
import axios from 'axios';
-import Modals from '../../modals/Modals';
import CoursesListType from '../coursesPublic/CoursesListType';
import AccessoryModal from "../coursesPublic/AccessoryModal";
import PublishRightnow from './PublishRightnow'
diff --git a/public/react/src/modules/courses/busyWork/PublishRightnow.js b/public/react/src/modules/courses/busyWork/PublishRightnow.js
index da2054124..ff6a8855d 100644
--- a/public/react/src/modules/courses/busyWork/PublishRightnow.js
+++ b/public/react/src/modules/courses/busyWork/PublishRightnow.js
@@ -1,7 +1,8 @@
import React,{ Component } from "react";
import { Input,Checkbox,Menu,Pagination } from "antd";
-import HomeworkModal from '../coursesPublic/HomeworkModal'
+import HomeworkModal from '../coursesPublic/HomeworkModal';
+import OneSelfOrderModal from "../coursesPublic/OneSelfOrderModal";
import axios from 'axios'
import moment from 'moment'
import { getNextHalfHourOfMoment } from 'educoder'
@@ -51,7 +52,8 @@ class PublishRightnow extends Component{
this.setState({
modalname: isPublish ? "立即发布" : "立即截止",
modaltype:1,
- visible:true,
+ visible:isPublish?false:true,
+ OneSelftype:isPublish?true:false,
Topval: isPublish ? "学生将立即收到作业" : "学生将不能再提交作品",
// Botvalleft: isPublish ? "暂不发布" : "暂不截止",
Botval: this.props.fromListPage ? (isPublish ? "本操作只对“未发布”的分班有效" : "本操作只对“提交中”的分班有效") : '',
@@ -70,6 +72,7 @@ class PublishRightnow extends Component{
modalname:undefined,
modaltype:undefined,
visible:false,
+ OneSelftype:false,
Topval:undefined,
Topvalright:undefined,
Botvalleft:undefined,
@@ -106,18 +109,28 @@ class PublishRightnow extends Component{
this.props.showNotification('请至少选择一个分班');
return;
}
-
+
+ let data={}
+ if(arg_group_ids.length===0){
+ data = {
+ homework_ids: this.props.checkBoxValues,
+ end_time: endtime==="Invalid date"?undefined:endtime,
+ }
+ }else{
+ data={
+ homework_ids: this.props.checkBoxValues,
+ group_ids: group_ids,
+ group_end_times:endtime,
+ detail:true
+ }
+ }
let coursesId=this.props.match.params.coursesId;
const url = `/courses/${coursesId}/homework_commons/${isPublish ? "publish_homework" : "end_homework"}.json`
- axios.post(url, {
- group_ids,
- homework_ids: this.props.checkBoxValues,
- all_check: 0,
- end_time:endtime==="Invalid date"?undefined:endtime
- })
+ axios.post(url, data)
.then((response) => {
if (response.data.status == 0) {
+ this.homeworkhide()
this.props.showNotification(isPublish ? "立即发布成功" : "立即截止成功")
this.props.doWhenSuccess && this.props.doWhenSuccess()
this.setState({ visible : false })
@@ -153,6 +166,7 @@ class PublishRightnow extends Component{
this.showDialog()
this.setState({
course_groups: response.data.course_groups,
+ starttimesend:response.data.end_time===undefined||response.data.end_time===null||response.data.end_time===""?undefined:response.data.end_time,
})
})
.catch(function (error) {
@@ -184,6 +198,7 @@ class PublishRightnow extends Component{
const { showActionButton } = this.props
return(
)
diff --git a/public/react/src/modules/courses/coursesPublic/OneSelfOrderModal.js b/public/react/src/modules/courses/coursesPublic/OneSelfOrderModal.js
index d706bf2ee..6d4a307e5 100644
--- a/public/react/src/modules/courses/coursesPublic/OneSelfOrderModal.js
+++ b/public/react/src/modules/courses/coursesPublic/OneSelfOrderModal.js
@@ -33,52 +33,110 @@ class OneSelfOrderModal extends Component{
super(props);
this.state={
group_ids:[],
- endtime:""
+ endtime:"",
+ course_groups:undefined
}
}
componentDidMount() {
if(this.props.course_groups!=undefined&&this.props.course_groups.length!=0){
-
- let arr=this.props.course_groups.map(item => item.id);
- this.shixunhomeworkedit(arr);
+ if(this.props.course_groups!=undefined) {
+ let arr = this.props.course_groups.map(item => item.id);
+ let newarr = [];
+ let course_groups = this.props.course_groups;
+ course_groups.map((item, key) => {
+ if (item.end_time === null) {
+ if(this.props.starttimesend===undefined){
+ item.end_time = moment(moment(handleDateString(this.props.staytime)).add(1, 'week')).format("YYYY-MM-DD HH:mm");
+ }else{
+ item.end_time = moment(handleDateString(this.props.starttimesend)).format("YYYY-MM-DD HH:mm");
+ }
+ newarr.push(item)
+ } else {
+ newarr.push(item)
+ }
+ })
+ this.setState({
+ course_groups: newarr
+ })
+ this.shixunhomeworkedit(arr);
+ }
}
if(this.props.starttimes===undefined||this.props.starttimes===""||this.props.starttimes===null){
- this.setState({
- endtime:moment(moment(handleDateString(this.props.staytime)).add(1, 'months')).format("YYYY-MM-DD HH:mm")
- })
+ if(this.props.starttimesend===undefined){
+ this.setState({
+ endtime:moment(moment(handleDateString(this.props.staytime)).add(1, 'week')).format("YYYY-MM-DD HH:mm")
+ })
+ }else{
+ this.setState({
+ endtime:moment(handleDateString(this.props.starttimesend)).format("YYYY-MM-DD HH:mm")
+ })
+ }
+
}else{
- this.setState({
- endtime:moment(handleDateString(this.props.starttimes)).format("YYYY-MM-DD HH:mm")
- })
+ if(this.props.starttimesend===undefined){
+ this.setState({
+ endtime:moment(moment(handleDateString(this.props.staytime)).add(1, 'week')).format("YYYY-MM-DD HH:mm")
+ })
+ }else{
+ this.setState({
+ endtime:moment(handleDateString(this.props.starttimesend)).format("YYYY-MM-DD HH:mm")
+ })
+ }
}
}
componentDidUpdate=(prevProps)=>{
- // if(prevProps.visible!=this.props.visible){
- //
- // if(this.props.course_groups!=undefined){
- // let arr=this.props.course_groups.map(item => item.id);
- // this.shixunhomeworkedit(arr);
- // }
- // }
+
if(prevProps.course_groups!=this.props.course_groups){
- if(this.props.course_groups!=undefined){
- let arr=this.props.course_groups.map(item => item.id);
- this.shixunhomeworkedit(arr);
- }
+ if(this.props.course_groups!=undefined){
+ let arr=this.props.course_groups.map(item => item.id);
+ let newarr=[];
+ let course_groups=this.props.course_groups;
+ course_groups.map((item,key)=>{
+ if(item.end_time===null){
+ if(this.props.starttimesend===undefined){
+ item.end_time = moment(moment(handleDateString(this.props.staytime)).add(1, 'week')).format("YYYY-MM-DD HH:mm");
+ }else{
+ item.end_time = moment(handleDateString(this.props.starttimesend)).format("YYYY-MM-DD HH:mm");
+ }
+ newarr.push(item)
+ }else{
+ newarr.push(item)
+ }
+ })
+ this.setState({
+ course_groups:newarr
+ })
+ this.shixunhomeworkedit(arr);
+ }
}
+
+
if(prevProps.starttimes!=this.props.starttimes){
if(this.props.starttimes===undefined||this.props.starttimes===""||this.props.starttimes===null){
- this.setState({
- endtime:moment(moment(handleDateString(this.props.staytime)).add(1, 'months')).format("YYYY-MM-DD HH:mm")
- })
+ if(this.props.starttimesend===undefined){
+ this.setState({
+ endtime:moment(moment(handleDateString(this.props.staytime)).add(1, 'week')).format("YYYY-MM-DD HH:mm")
+ })
+ }else{
+ this.setState({
+ endtime:moment(handleDateString(this.props.starttimesend)).format("YYYY-MM-DD HH:mm")
+ })
+ }
+
}else{
- this.setState({
- endtime:moment(handleDateString(this.props.starttimes)).format("YYYY-MM-DD HH:mm")
- })
+ if(this.props.starttimesend===undefined){
+ this.setState({
+ endtime:moment(moment(handleDateString(this.props.staytime)).add(1, 'week')).format("YYYY-MM-DD HH:mm")
+ })
+ }else{
+ this.setState({
+ endtime:moment(handleDateString(this.props.starttimesend)).format("YYYY-MM-DD HH:mm")
+ })
+ }
}
}
}
@@ -101,22 +159,37 @@ class OneSelfOrderModal extends Component{
}
+ onChangeTimeendlist=(date, dateString,id)=>{
+ let {course_groups}=this.state;
+ let arr=course_groups;
+
+ arr.map((item,key)=>{
+ if(item.id===id){
+ item.end_time=dateString
+ }
+ })
+
+ this.setState({
+ course_groups:arr
+ })
+
+ }
+
propsSaves=(ds,endtime)=>{
+ let {course_groups}=this.state;
- if(ds.length ===0&&endtime === ""){
+ if(this.props.typs=="end"){
this.props.Saves()
}else{
if(this.props.typs!="end"){
- if(endtime === ""||endtime===undefined||endtime===null){
-
+ if(!endtime){
this.setState({
endtimetype:true,
endtimetypevalue:"截止时间不能为空"
})
return
}
-
- if(moment(endtime,"YYYY-MM-DD HH:mm") <= moment(this.props.starttimes,"YYYY-MM-DD HH:mm")){
+ if(moment(endtime,"YYYY-MM-DD HH:mm") <= moment(this.props.starttime,"YYYY-MM-DD HH:mm")){
this.setState({
endtimetype:true,
endtimetypevalue:"必须晚于发布时间"
@@ -124,22 +197,37 @@ class OneSelfOrderModal extends Component{
return
}
}
- this.props.Saves(ds,moment(handleDateString(endtime),"YYYY-MM-DD HH:mm").format("YYYY-MM-DD HH:mm"))
+
+ if(course_groups===undefined||course_groups.length===0){
+ this.props.Saves(ds,moment(handleDateString(endtime),"YYYY-MM-DD HH:mm").format("YYYY-MM-DD HH:mm"))
+ }else{
+ let arr=[]
+ ds.map((item,key)=>{
+ course_groups.map((items,key)=>{
+ if(item===items.id){
+ if(!items.end_time){
+ arr.push(moment(moment(handleDateString(this.props.staytime)).add(1, 'week')).format("YYYY-MM-DD HH:mm"))
+ }else{
+ arr.push(items.end_time)
+ }
+ }
+ })
+ })
+
+
+ this.props.Saves(ds,arr)
+ }
+
+
+
}
}
render(){
- let {group_ids,endtime}=this.state;
- let {course_groups}=this.props;
-
- // console.log(this.props.starttimes)
- // console.log(endtime)
- // console.log(this.props.starttimes)
- // console.log(this.state.endtime)
+ let {group_ids,endtime,course_groups}=this.state;
- // console.log(this.props.starttime,this.props.endtime)
// TODO course_groups为空时的处理
// let endtimelist=this.props.starttimes===undefined||this.props.starttimes===""?"":moment(handleDateString(endtime)).add(1,'months')
@@ -195,7 +283,7 @@ class OneSelfOrderModal extends Component{
{this.props.starttime===undefined||
this.props.starttime===""?""
- :
+ :
发布时间:
{this.props.starttime}
@@ -257,10 +345,10 @@ class OneSelfOrderModal extends Component{
{
{
- course_groups.map((item,key)=>{
+ course_groups===undefined?"":course_groups.map((item,key)=>{
return(
-
+
this.onChangeTimeendlist(e,data,item.id)}
className={ this.state.endtimetype===true?"noticeTip fr":"fr"}
/>
diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTaskDetail.js b/public/react/src/modules/courses/graduation/tasks/GraduationTaskDetail.js
index e7924f469..b54aad071 100644
--- a/public/react/src/modules/courses/graduation/tasks/GraduationTaskDetail.js
+++ b/public/react/src/modules/courses/graduation/tasks/GraduationTaskDetail.js
@@ -6,6 +6,7 @@ import Loadable from 'react-loadable';
import Loading from '../../../../Loading';
import {BrowserRouter as Router,Route,Switch} from 'react-router-dom';
import axios from 'axios';
+import OneSelfOrderModal from "../../coursesPublic/OneSelfOrderModal";
import HomeworkModal from "../../coursesPublic/HomeworkModal";
import AccessoryModal from "../../coursesPublic/AccessoryModal";
import Associationmodel from '../../coursesPublic/Associationmodel';
@@ -60,7 +61,8 @@ class GraduationTaskDetail extends Component{
Modalstopval:undefined,
ModalCancel:undefined,
ModalSave:undefined,
- acrossVisible:undefined
+ acrossVisible:undefined,
+ OneSelftype:false
}
}
componentDidMount(){
@@ -115,17 +117,20 @@ class GraduationTaskDetail extends Component{
}
//立即发布
publish=()=>{
+ let {questionslist}=this.state;
let starttime= this.props.getNowFormatDates(1,1);
let endtime=this.props.getNowFormatDates(2,1);
// this.homeworkstart()
this.setState({
modalname:"立即发布",
- visible:true,
+ // visible:true,
+ OneSelftype:true,
Topval:"学生将立即收到毕设任务",
// Botvalleft:"点击修改",
// Botval:`本操作只对"未发布"的分班有效`,
starttime:moment(moment(new Date())).format("YYYY-MM-DD HH:mm") ,
- starttimes:this.props.getNowFormatDates(1),
+ starttimes:questionslist.end_time,
+ staytime:this.props.getNowFormatDates(1),
typs:"start",
endtime:endtime,
Cancelname:"暂不发布",
@@ -169,7 +174,6 @@ class GraduationTaskDetail extends Component{
this.getdatas();
this.child && this.child.searchValue();
}
-
// 立即截止
end=()=>{
// this.homeworkstart()
@@ -212,6 +216,7 @@ class GraduationTaskDetail extends Component{
Modalstype:false,
Loadtype:false,
visible:false,
+ OneSelftype:false,
Modulationtype:false,
Allocationtype:false,
Modalstopval:"",
@@ -317,7 +322,7 @@ class GraduationTaskDetail extends Component{
getdatas:this.getdatas
}
- document.title=questionslist&&questionslist.course_name;
+
return(
{
@@ -342,6 +347,27 @@ class GraduationTaskDetail extends Component{
modaltype={this.state.modaltype}
getcourse_groupslist={(id) => this.getcourse_groupslist(id)}
/>
+
this.getcourse_groupslist(id)}
+ />
{/*关联项目*/}
{visibles===true?
{
- console.log("1197");
- console.log(this.props.isNotMember());
+ // console.log("1197");
+ // console.log(this.props.isNotMember());
let {page, limit,work_efficiency} = this.state;
let datalist = [];
let datalists = [];
@@ -1867,8 +1868,8 @@ class Listofworksstudentone extends Component {
}
// 设置数据
seacthdata = (teacherdata) => {
- console.log("1326");
- console.log(this.props.isNotMember());
+ // console.log("1326");
+ // console.log(this.props.isNotMember());
let datalist = [];
@@ -2344,8 +2345,8 @@ class Listofworksstudentone extends Component {
if (work_efficiency === false) {
if(JSON.stringify(course_group_info) === "[]"|| course_group_info === undefined||course_group_info === null){
//这里没有分班 没有 关卡得分 没有效率分
- console.log("1739");
- console.log(this.props.isNotMember());
+ // console.log("1739");
+ // console.log(this.props.isNotMember());
for(var i=0;i< this.state.columns.length;i++){
var item = this.state.columns[i];
@@ -2381,8 +2382,8 @@ class Listofworksstudentone extends Component {
}else{
- console.log("1767");
- console.log(this.props.isNotMember());
+ // console.log("1767");
+ // console.log(this.props.isNotMember());
if(course_group_info.length < 2){
for(var i=0;i< this.state.columns.length;i++){
var item = this.state.columns[i];
@@ -2419,8 +2420,8 @@ class Listofworksstudentone extends Component {
}
}else {
- console.log("1795");
- console.log(this.props.isNotMember());
+ // console.log("1795");
+ // console.log(this.props.isNotMember());
for(var i=0;i< this.state.columns.length;i++){
var item = this.state.columns[i];
@@ -2453,8 +2454,8 @@ class Listofworksstudentone extends Component {
}
}
}else {
- console.log("1821");
- console.log(this.props.isNotMember());
+ // console.log("1821");
+ // console.log(this.props.isNotMember());
if(JSON.stringify(course_group_info) === "[]"|| course_group_info === undefined || course_group_info === null){
@@ -2489,8 +2490,8 @@ class Listofworksstudentone extends Component {
}else {
- console.log("1849");
- console.log(this.props.isNotMember());
+ // console.log("1849");
+ // console.log(this.props.isNotMember());
if(course_group_info.length < 2) {
for(var i=0;i< this.state.columns.length;i++){
var item = this.state.columns[i];
@@ -2796,11 +2797,12 @@ class Listofworksstudentone extends Component {
this.setState({
modalname: "立即发布",
modaltype: response.data.course_groups === null || response.data.course_groups.length === 0 ? 2 : 1,
- svisible: true,
+ svisible: false,
+ OneSelftype:true,
Topval:"学生将立即收到作业",
// Botvalleft:"暂不发布",
Botval:`本操作只对"未发布"的分班有效`,
- starttime: "发布时间:" + moment(moment(new Date())).format("YYYY-MM-DD HH:mm"),
+ starttime: moment(moment(new Date())).format("YYYY-MM-DD HH:mm"),
endtime: "截止时间:" + endtime,
starttimes:starttime,
starttimesend:response.data.end_time===undefined||response.data.end_time===null||response.data.end_time===""?undefined:response.data.end_time,
@@ -2832,6 +2834,7 @@ class Listofworksstudentone extends Component {
modalname: "立即截止",
modaltype: response.data.course_groups === null || response.data.course_groups.length === 0 ? 2 : 1,
svisible: true,
+ OneSelftype:false,
Topval:"学生将不能再提交作业",
// Botvalleft:"暂不截止",
Botval:`本操作只对"提交中"的分班有效`,
@@ -2852,15 +2855,44 @@ class Listofworksstudentone extends Component {
// 立即发布
homeworkstartend = (ds,endtime) => {
var homeworkid = this.props.match.params.homeworkid;
- let {course_groupslist} = this.state;
+
+ let data={}
+ if(ds.length===0){
+ if(this.state.teacherdata.category.main===1){
+ data = {
+ homework_ids: [homeworkid],
+ end_time: endtime,
+ }
+ }else {
+ data = {
+ homework_ids: [homeworkid],
+ end_time: endtime,
+ category_id:this.state.teacherdata.category.category_id,
+ }
+ }
+ }else{
+ if(this.state.teacherdata.category.main===1){
+ data={
+ homework_ids: [homeworkid],
+ group_ids: ds,
+ group_end_times:endtime,
+ detail:true
+ }
+ }else{
+ data={
+ homework_ids: [homeworkid],
+ group_ids: ds,
+ group_end_times:endtime,
+ category_id:this.state.teacherdata.category.category_id,
+ detail:true
+ }
+ }
+
+ }
let coursesId = this.props.match.params.coursesId;
let url = "/courses/" + coursesId + "/homework_commons/publish_homework.json";
- axios.post(url, {
- homework_ids: [homeworkid],
- group_ids: course_groupslist,
- end_time:endtime,
- }).then((result) => {
+ axios.post(url, data).then((result) => {
if (result) {
if (result.data.status === 0) {
notification.open({
@@ -2935,6 +2967,7 @@ class Listofworksstudentone extends Component {
modalname: undefined,
modaltype: undefined,
svisible: false,
+ OneSelftype:false,
Topval: undefined,
Topvalright: undefined,
Botvalleft: undefined,
@@ -3155,12 +3188,33 @@ class Listofworksstudentone extends Component {
: ""
}
-
+ {/*立即截止*/}
+
this.getcourse_groupslist(id)}
+ starttimes={this.state.starttimes}
+ starttimesend={this.state.starttimesend}
+ typs={this.state.typs}
+
+ />
{/*立即发布*/}
- {
- console.log("ShixunHomeworkPage56");
- console.log(jobsettingsdata);
- console.log(teacherdata);
+ // console.log("ShixunHomeworkPage56");
+ // console.log(jobsettingsdata);
+ // console.log(teacherdata);
this.setState({
jobsettingsdatapage: jobsettingsdata.data.message===undefined?jobsettingsdata:undefined,
@@ -350,12 +350,7 @@ class ShixunHomeworkPage extends Component {
- {/**/}
+
{parseInt(tab) === 0 ? this.Getdataback(jobsettingsdata, teacherdata)}>:""}
{parseInt(tab) === 1 ? this.Getdataback(jobsettingsdata, teacherdata)} Showupdateinstructionsboolfalse={(i)=>this.Showupdateinstructionsboolfalse(i)}>:""}
{parseInt(tab) === 2 ? this.Getdataback(jobsettingsdata, teacherdata)}>:""}
@@ -369,31 +364,3 @@ class ShixunHomeworkPage extends Component {
export default ShixunHomeworkPage;
-//
-//
-//
-//
-// {this.props.isAdmin() === true ?
-//
-//
-// :
-//
-// }
-//
-//
-//
-{/*
*/
-}
-
-
-{/*
*/
-}
\ No newline at end of file
diff --git a/public/react/src/modules/courses/shixunHomework/ShixunStudentWork.js b/public/react/src/modules/courses/shixunHomework/ShixunStudentWork.js
index 95de82445..559cafd78 100644
--- a/public/react/src/modules/courses/shixunHomework/ShixunStudentWork.js
+++ b/public/react/src/modules/courses/shixunHomework/ShixunStudentWork.js
@@ -3,6 +3,7 @@ import CoursesListType from '../coursesPublic/CoursesListType';
import {WordsBtn,ActionBtn} from 'educoder';
import ShixunWorkModal from './Shixunworkdetails/ShixunWorkModal';
import HomeworkModal from "../coursesPublic/HomeworkModal";
+import OneSelfOrderModal from "../coursesPublic/OneSelfOrderModal";
import DownloadMessageysl from '../../modals/DownloadMessageysl';
import NoneData from '../coursesPublic/NoneData';
import {
@@ -422,7 +423,7 @@ class ShixunStudentWork extends Component {
this.setState({
modalname:"立即发布",
modaltype:response.data.course_groups===null||response.data.course_groups.length===0?2:1,
- visible:true,
+ OneSelftype:true,
Topval:"学生将立即收到作业",
// Botvalleft:"暂不发布",
Botval:`本操作只对"未发布"的分班有效`,
@@ -476,15 +477,44 @@ class ShixunStudentWork extends Component {
// 立即发布
homeworkstartend=(ds,endtime)=>{
var homeworkid = this.props.match.params.homeworkid;
- let {course_groupslist} = this.state;
+
+ let data={}
+ if(ds.length===0){
+ if(this.props.teacherdatapage.category.main===1){
+ data = {
+ homework_ids: [homeworkid],
+ end_time: endtime,
+ }
+ }else {
+ data = {
+ homework_ids: [homeworkid],
+ end_time: endtime,
+ category_id:this.props.teacherdatapage.category.category_id,
+ }
+ }
+ }else{
+ if(this.props.teacherdatapage.category.main===1){
+ data={
+ homework_ids: [homeworkid],
+ group_ids: ds,
+ group_end_times:endtime,
+ detail:true
+ }
+ }else{
+ data={
+ homework_ids: [homeworkid],
+ group_ids: ds,
+ group_end_times:endtime,
+ category_id:this.props.teacherdatapage.category.category_id,
+ detail:true
+ }
+ }
+
+ }
let coursesId=this.props.match.params.coursesId;
let url ="/courses/"+coursesId+"/homework_commons/publish_homework.json";
- axios.post(url,{
- homework_ids:[homeworkid],
- group_ids:course_groupslist,
- end_time:endtime,
- }).then((result)=>{
+ axios.post(url,data).then((result)=>{
if(result.status===200){
if(result.data.status===0){
notification.open({
@@ -538,6 +568,7 @@ class ShixunStudentWork extends Component {
modalname:undefined,
modaltype:undefined,
visible:false,
+ OneSelftype:false,
Topval:undefined,
Topvalright:undefined,
Botvalleft:undefined,
@@ -739,7 +770,7 @@ class ShixunStudentWork extends Component {
{/* {...this.props}*/}
{/* refs="DownloadMessage"*/}
{/*/>*/}
- {/*立即发布*/}
+ {/*立即截止*/}
+
+ {/*立即发布*/}
+ this.getcourse_groupslist(id)}
+ starttimes={this.state.starttimes}
+ starttimesend={this.state.starttimesend}
+ typs={this.state.typs}
+ />
+
diff --git a/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js b/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js
index ddda1f81f..3ba5703ef 100644
--- a/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js
+++ b/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js
@@ -17,17 +17,20 @@ import {
import {Link} from 'react-router-dom';
import locale from 'antd/lib/date-picker/locale/zh_CN';
import axios from 'axios';
+import moment from 'moment';
+import 'moment/locale/zh-cn';
+import Modals from "../../modals/Modals";
+import DownloadMessageysl from "../../modals/DownloadMessageysl";
+import OneSelfOrderModal from "../coursesPublic/OneSelfOrderModal";
import '../css/members.css';
import "../common/formCommon.css";
import '../css/Courses.css';
import './style.css';
import '../css/busyWork.css'
import '../poll/pollStyle.css'
-import moment from 'moment';
-import 'moment/locale/zh-cn';
-import Modals from "../../modals/Modals";
+
import Startshixuntask from "../coursesPublic/Startshixuntask";
-import DownloadMessageysl from "../../modals/DownloadMessageysl";
+
const RadioGroup = Radio.Group;
//GraduationTaskssetting.js
@@ -1531,7 +1534,7 @@ class Trainingjobsetting extends Component {
this.setState({
modalname: "立即发布",
modaltype: response.data.course_groups === null || response.data.course_groups.length === 0 ? 2 : 1,
- visible: true,
+ OneSelftype: true,
Topval:"学生将立即收到作业",
// Botvalleft:"暂不发布",
Botval:`本操作只对"未发布"的分班有效`,
@@ -1587,15 +1590,44 @@ class Trainingjobsetting extends Component {
// 立即发布
homeworkstartend = (ds,endtime) => {
var homeworkid = this.props.match.params.homeworkid;
- let {course_groupslist} = this.state;
+ console.log(this.props)
+ let data={}
+ if(ds.length===0){
+ if(this.props.teacherdatapage.category.main===1){
+ data = {
+ homework_ids: [homeworkid],
+ end_time: endtime,
+ }
+ }else {
+ data = {
+ homework_ids: [homeworkid],
+ end_time: endtime,
+ category_id:this.props.teacherdatapage.category.category_id,
+ }
+ }
+ }else{
+ if(this.props.teacherdatapage.category.main===1){
+ data={
+ homework_ids: [homeworkid],
+ group_ids: ds,
+ group_end_times:endtime,
+ detail:true
+ }
+ }else{
+ data={
+ homework_ids: [homeworkid],
+ group_ids: ds,
+ group_end_times:endtime,
+ category_id:this.props.teacherdatapage.category.category_id,
+ detail:true
+ }
+ }
+
+ }
let coursesId = this.props.match.params.coursesId;
let url = "/courses/" + coursesId + "/homework_commons/publish_homework.json";
- axios.post(url, {
- homework_ids: [homeworkid],
- group_ids: course_groupslist,
- end_time:endtime,
- }).then((result) => {
+ axios.post(url,data).then((result) => {
if (result.status === 200) {
if (result.data.status === 0) {
notification.open({
@@ -1654,6 +1686,7 @@ class Trainingjobsetting extends Component {
modalname: undefined,
modaltype: undefined,
visible: false,
+ OneSelftype:false,
Topval: undefined,
Topvalright: undefined,
Botvalleft: undefined,
@@ -1799,8 +1832,8 @@ class Trainingjobsetting extends Component {
};
//一进来就是老师要用的编辑页面
editSettings=(datas)=>{
- console.log("编辑页面");
- console.log(datas);
+ // console.log("编辑页面");
+ // console.log(datas);
try {
if (datas.data.is_end === true) {
this.setState({
@@ -2127,6 +2160,30 @@ class Trainingjobsetting extends Component {
starttimesend={this.state.starttimesend}
typs={this.state.typs}
/>
+
+
+ {/*立即发布*/}
+
this.getcourse_groupslist(id)}
+ starttimes={this.state.starttimes}
+ starttimesend={this.state.starttimesend}
+ typs={this.state.typs}
+ />
+
{
var homeworkid = this.props.match.params.homeworkid;
- let {course_groupslist} = this.state;
+ let data={}
+ if(ds.length===0){
+ if(this.state.category.main===1){
+ data = {
+ homework_ids: [homeworkid],
+ end_time: endtime,
+ }
+ }else {
+ data = {
+ homework_ids: [homeworkid],
+ end_time: endtime,
+ category_id:this.state.category.category_id,
+ }
+ }
+ }else{
+ if(this.state.category.main===1){
+ data={
+ homework_ids: [homeworkid],
+ group_ids: ds,
+ group_end_times:endtime,
+ detail:true
+ }
+ }else{
+ data={
+ homework_ids: [homeworkid],
+ group_ids: ds,
+ group_end_times:endtime,
+ category_id:this.state.category.category_id,
+ detail:true
+ }
+ }
+
+ }
let coursesId = this.props.match.params.coursesId;
let url = "/courses/" + coursesId + "/homework_commons/publish_homework.json";
- axios.post(url, {
- homework_ids: [homeworkid],
- group_ids: course_groupslist,
- end_time: endtime,
- }).then((result) => {
+ axios.post(url, data).then((result) => {
if (result.status === 200) {
if (result.data.status === 0) {
notification.open({
@@ -335,6 +366,7 @@ class Workquestionandanswer extends Component {
addnametab: undefined,
typs: undefined,
starttimes: undefined,
+ OneSelftype:false,
})
}
getcourse_groupslist = (id) => {
@@ -455,6 +487,28 @@ class Workquestionandanswer extends Component {
starttimesend={this.state.starttimesend}
typs={this.state.typs}
/>
+
+ {/*立即发布*/}
+ this.getcourse_groupslist(id)}
+ starttimes={this.state.starttimes}
+ starttimesend={this.state.starttimesend}
+ typs={this.state.typs}
+ />
diff --git a/public/react/src/modules/home/shixunsHome.js b/public/react/src/modules/home/shixunsHome.js
index bad776b89..4db39a310 100644
--- a/public/react/src/modules/home/shixunsHome.js
+++ b/public/react/src/modules/home/shixunsHome.js
@@ -111,7 +111,7 @@ class ShixunsHome extends Component {
}
const MyRate = ({ defaultValue, ...rest }) => {
let myValue = defaultValue;
- console.log(myValue-Math.floor(myValue))
+ // console.log(myValue-Math.floor(myValue))
// if (myValue < Math.ceil(myValue)) {
// myValue = Math.floor(myValue) + 0.5;
// }
From 0df28461cdd11c4f6bbd59a3006659726868f9d6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com>
Date: Sat, 19 Oct 2019 16:32:40 +0800
Subject: [PATCH 2/4] =?UTF-8?q?=E8=AF=95=E5=8D=B7=EF=BC=8C=E9=97=AE?=
=?UTF-8?q?=E5=8D=B7=E8=AF=A6=E6=83=85=E9=A1=B5=E7=AB=8B=E5=8D=B3=E5=8F=91?=
=?UTF-8?q?=E5=B8=83?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../coursesPublic/OneSelfOrderModal.js | 2 -
.../exercise/Testpapersettinghomepage.js | 3 +-
.../graduation/tasks/GraduationTaskDetail.js | 21 +-
.../tasks/GraduationTaskssetting.js | 1 +
.../tasks/GraduationTaskssettinglist.js | 2 +
.../tasks/GraduationTaskssettingquestions.js | 4 +-
.../modules/courses/poll/PollDetailIndex.js | 1 +
.../poll/pollPublicBtn/ImmediatelyPublish.js | 317 ++++++++++++------
.../shixunHomework/Trainingjobsetting.js | 2 +-
9 files changed, 241 insertions(+), 112 deletions(-)
diff --git a/public/react/src/modules/courses/coursesPublic/OneSelfOrderModal.js b/public/react/src/modules/courses/coursesPublic/OneSelfOrderModal.js
index 6d4a307e5..ef21f963c 100644
--- a/public/react/src/modules/courses/coursesPublic/OneSelfOrderModal.js
+++ b/public/react/src/modules/courses/coursesPublic/OneSelfOrderModal.js
@@ -229,8 +229,6 @@ class OneSelfOrderModal extends Component{
let {group_ids,endtime,course_groups}=this.state;
// TODO course_groups为空时的处理
-
- // let endtimelist=this.props.starttimes===undefined||this.props.starttimes===""?"":moment(handleDateString(endtime)).add(1,'months')
return(
{
diff --git a/public/react/src/modules/courses/exercise/Testpapersettinghomepage.js b/public/react/src/modules/courses/exercise/Testpapersettinghomepage.js
index ac2ea7be3..f05cbf967 100644
--- a/public/react/src/modules/courses/exercise/Testpapersettinghomepage.js
+++ b/public/react/src/modules/courses/exercise/Testpapersettinghomepage.js
@@ -430,7 +430,8 @@ class Testpapersettinghomepage extends Component{
className={"btn fr color-blue font-16 mt20 mr20"}
checkBoxValues={[parseInt(this.props.match.params.Id)]}
Exercisetype={"exercise"}
- action={this.Commonheadofthetestpaper}
+ pushtype={true}
+ action={this.Commonheadofthetestpaper}
single={true}
getsetdata={this.getsetdata}
>
diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTaskDetail.js b/public/react/src/modules/courses/graduation/tasks/GraduationTaskDetail.js
index b54aad071..fdd10db6a 100644
--- a/public/react/src/modules/courses/graduation/tasks/GraduationTaskDetail.js
+++ b/public/react/src/modules/courses/graduation/tasks/GraduationTaskDetail.js
@@ -115,12 +115,18 @@ class GraduationTaskDetail extends Component{
// this.props.history.goBack()
this.props.history.replace(`/courses/${this.state.questionslist.course_id}/graduation_tasks/${this.state.questionslist.graduation_id}`);
}
+
+ setend_time=(time)=>{
+ this.setState({
+ starttimesend:time===undefined||time===null||time===""?undefined:time,
+ })
+ }
//立即发布
publish=()=>{
let {questionslist}=this.state;
let starttime= this.props.getNowFormatDates(1,1);
let endtime=this.props.getNowFormatDates(2,1);
- // this.homeworkstart()
+ console.log(this.bindRef.end_time)
this.setState({
modalname:"立即发布",
// visible:true,
@@ -367,7 +373,14 @@ class GraduationTaskDetail extends Component{
course_groups={this.state.course_groups}
modaltype={this.state.modaltype}
getcourse_groupslist={(id) => this.getcourse_groupslist(id)}
+ starttimes={this.state.starttimes}
+ starttimesend={this.state.starttimesend}
+ typs={this.state.typs}
/>
+
+
+
+
{/*关联项目*/}
{visibles===true?
()
+ (props) => (this.setend_time(time)} tab={`list`}/>)
}
>
()
+ (props) => (this.setend_time(time)} tab={`setting`}/>)
}
>
()
+ (props) => (this.setend_time(time)} tab={`questions`}/>)
}>
diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssetting.js b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssetting.js
index bab853a13..365e53409 100644
--- a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssetting.js
+++ b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssetting.js
@@ -143,6 +143,7 @@ class GraduationTaskssettingapp extends Component{
commenttime:result.data.comment_time===null||result.data.comment_time=== ""?"":moment(moment(handleDateString(result.data.comment_time))).format("YYYY-MM-DD HH:mm"),
task_status: result.data.task_status
})
+ this.props.setend_time(result.data.end_time)
}
}).catch((error)=>{
diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js
index b3282d7dd..ebe931eb0 100644
--- a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js
+++ b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js
@@ -151,7 +151,9 @@ class GraduationTaskssettinglist extends Component{
taskslistdata: result.data,
data: datalist,
loadingstate: false,
+ end_time:result.data.end_time
})
+ this.props.setend_time(result.data.end_time)
}
}).catch((error)=>{
console.log(error)
diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettingquestions.js b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettingquestions.js
index 06ed1eaa1..f87b0a53d 100644
--- a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettingquestions.js
+++ b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettingquestions.js
@@ -54,8 +54,10 @@ class GraduationTasksquestions extends Component{
axios.get(url).then((result)=>{
if(result.status===200){
this.setState({
- questionslist:result.data
+ questionslist:result.data,
+ end_time:result.data.end_time
})
+ this.props.setend_time(result.data.end_time)
}
}).catch((error)=>{
console.log(error)
diff --git a/public/react/src/modules/courses/poll/PollDetailIndex.js b/public/react/src/modules/courses/poll/PollDetailIndex.js
index 69ea83d62..c91a6a493 100644
--- a/public/react/src/modules/courses/poll/PollDetailIndex.js
+++ b/public/react/src/modules/courses/poll/PollDetailIndex.js
@@ -185,6 +185,7 @@ class PollDetailIndex extends Component{
className={"font-16"}
checkBoxValues={[this.props.match.params.pollId]}
action={this.getPollInfo}
+ pushtype={true}
single={true}
>
diff --git a/public/react/src/modules/courses/poll/pollPublicBtn/ImmediatelyPublish.js b/public/react/src/modules/courses/poll/pollPublicBtn/ImmediatelyPublish.js
index 9644acfde..b35b500ac 100644
--- a/public/react/src/modules/courses/poll/pollPublicBtn/ImmediatelyPublish.js
+++ b/public/react/src/modules/courses/poll/pollPublicBtn/ImmediatelyPublish.js
@@ -4,13 +4,14 @@ import React,{ Component } from "react";
import Modals from '../../../modals/Modals'
import { WordsBtn } from 'educoder'
import HomeworkModal from "../../coursesPublic/HomeworkModal";
-
+import OneSelfOrderModal from "../../coursesPublic/OneSelfOrderModal";
import axios from 'axios'
import moment from 'moment';
+
class Immediatelypublish extends Component{
constructor(props){
super(props)
@@ -39,104 +40,170 @@ class Immediatelypublish extends Component{
}
//立即发布
homeworkstart=()=>{
- let {checkBoxValues}=this.props
+ let {checkBoxValues,pushtype}=this.props
- // console.log(this.props.Exercisetype==="exercise")
+ if(pushtype===true){
+ if(checkBoxValues.length==0){
+ this.props.showNotification("请先在列表中选择数据");
+ // this.setState({
+ // modalsType:true,
+ // modalsTopval:"请先在列表中选择数据",
+ // loadtype:true
+ // })
+ }else{
+ let coursesId=this.props.match.params.coursesId;
+ if(this.props.Exercisetype==="exercise"){
+ let url=`/exercises/${this.props.match.params.Id}/publish_groups.json`;
+ axios.get(url).then((response) => {
+ if(response.status===200){
+ this.setState({
+ modalname:"立即发布",
+ modaltype:response.data.course_groups===null||response.data.course_groups.length===0?2:1,
+ OneSelftype:true,
+ Topval:"学生将立即收到试卷",
+ // Botvalleft:"暂不发布",
+ Botval:this.props.single ? "":`本操作只对"未发布"的分班有效`,
+ starttime:moment(moment(new Date())).format("YYYY-MM-DD HH:mm"),
+ starttimes:this.props.getNowFormatDates(1),
+ endtime:"截止时间:"+this.props.getNowFormatDates(2),
+ Cancelname:"暂不发布",
+ Savesname:"立即发布",
+ Cancel:this.homeworkhide,
+ Saves:this.homeworkstartend,
+ course_groups:response.data.course_groups,
+ starttimesend:response.data.end_time===undefined||response.data.end_time===null||response.data.end_time===""?undefined:response.data.end_time,
+ })
+ }
+ }).catch((error) => {
+ console.log(error)
+ });
+ }else{
+ let url=`/polls/${this.props.match.params.pollId}/publish_groups.json`;
+ axios.get(url).then((response) => {
+ if(response){
- if(checkBoxValues.length==0){
- this.props.showNotification("请先在列表中选择数据");
- // this.setState({
- // modalsType:true,
- // modalsTopval:"请先在列表中选择数据",
- // loadtype:true
- // })
- }else{
- let coursesId=this.props.match.params.coursesId;
- if(this.props.Exercisetype==="exercise"){
- let url=`/courses/${coursesId}/exercises/publish_modal.json`;
- axios.get(url,{
- params:{
- check_ids:checkBoxValues
- }
- }).then((response) => {
- if(response.status===200){
- let list=[];
- if(response.data.course_info){
- for(var i=0;i 0 ? 1 : 2,
- visible:true,
- Topval:"学生将立即收到试卷",
- // Botvalleft:"暂不发布",
- Botval:this.props.single ? "":`本操作只对"未发布"的分班有效`,
- starttime:"发布时间:"+moment(moment(new Date())).format("YYYY-MM-DD HH:mm"),
- starttimes:this.props.getNowFormatDates(1),
- endtime:"截止时间:"+this.props.getNowFormatDates(2),
- Cancelname:"暂不发布",
- Savesname:"立即发布",
- Cancel:this.homeworkhide,
- Saves:this.homeworkstartend,
- })
+ this.setState({
+ modalname:"立即发布",
+ modaltype:response.data.course_groups===null||response.data.course_groups.length===0?2:1,
+ OneSelftype:true,
+ Topval:"学生将立即收到问卷",
+ // Botvalleft:"暂不发布",
+ Botval:this.props.single ? "":`本操作只对"未发布"的分班有效`,
+ starttime:"发布时间:"+moment(moment(new Date())).format("YYYY-MM-DD HH:mm"),
+ starttimes:this.props.getNowFormatDates(1),
+ endtime:"截止时间:"+this.props.getNowFormatDates(2),
+ Cancelname:"暂不发布",
+ Savesname:"立即发布",
+ Cancel:this.homeworkhide,
+ Saves:this.homeworkstartend,
+ course_groups:response.data.course_groups,
+ starttimesend:response.data.end_time===undefined||response.data.end_time===null||response.data.end_time===""?undefined:response.data.end_time,
+ })
+ }
+ }).catch((error) => {
+ console.log(error)
+ });
- }
- }).catch((error) => {
- console.log(error)
- });
- }else{
- let url=`/courses/${coursesId}/polls/publish_modal.json`;
- axios.get(url,{
- params:{
- check_ids:checkBoxValues
- }
- }).then((response) => {
- if(response){
- let list=[];
- if(response.data.course_info){
- for(var i=0;i 0 ? 1 : 2,
- visible:true,
- Topval:"学生将立即收到问卷",
- // Botvalleft:"暂不发布",
- Botval:this.props.single ? "":`本操作只对"未发布"的分班有效`,
- starttime:"发布时间:"+moment(moment(new Date())).format("YYYY-MM-DD HH:mm"),
- starttimes:this.props.getNowFormatDates(1),
- endtime:"截止时间:"+this.props.getNowFormatDates(2),
- Cancelname:"暂不发布",
- Savesname:"立即发布",
- Cancel:this.homeworkhide,
- Saves:this.homeworkstartend,
- })
- }
- }).catch((error) => {
- console.log(error)
- });
+ }
- }
+ }
+ }else{
+ if(checkBoxValues.length==0){
+ this.props.showNotification("请先在列表中选择数据");
+ // this.setState({
+ // modalsType:true,
+ // modalsTopval:"请先在列表中选择数据",
+ // loadtype:true
+ // })
+ }else{
+ let coursesId=this.props.match.params.coursesId;
+ if(this.props.Exercisetype==="exercise"){
+ let url=`/courses/${coursesId}/exercises/publish_modal.json`;
+ axios.get(url,{
+ params:{
+ check_ids:checkBoxValues
+ }
+ }).then((response) => {
+ if(response.status===200){
+ let list=[];
+ if(response.data.course_info){
+ for(var i=0;i 0 ? 1 : 2,
+ visible:true,
+ Topval:"学生将立即收到试卷",
+ // Botvalleft:"暂不发布",
+ Botval:this.props.single ? "":`本操作只对"未发布"的分班有效`,
+ starttime:"发布时间:"+moment(moment(new Date())).format("YYYY-MM-DD HH:mm"),
+ starttimes:this.props.getNowFormatDates(1),
+ endtime:"截止时间:"+this.props.getNowFormatDates(2),
+ Cancelname:"暂不发布",
+ Savesname:"立即发布",
+ Cancel:this.homeworkhide,
+ Saves:this.homeworkstartend,
+ })
+
+ }
+ }).catch((error) => {
+ console.log(error)
+ });
+ }else{
+ let url=`/courses/${coursesId}/polls/publish_modal.json`;
+ axios.get(url,{
+ params:{
+ check_ids:checkBoxValues
+ }
+ }).then((response) => {
+ if(response){
+ let list=[];
+ if(response.data.course_info){
+ for(var i=0;i 0 ? 1 : 2,
+ visible:true,
+ Topval:"学生将立即收到问卷",
+ // Botvalleft:"暂不发布",
+ Botval:this.props.single ? "":`本操作只对"未发布"的分班有效`,
+ starttime:"发布时间:"+moment(moment(new Date())).format("YYYY-MM-DD HH:mm"),
+ starttimes:this.props.getNowFormatDates(1),
+ endtime:"截止时间:"+this.props.getNowFormatDates(2),
+ Cancelname:"暂不发布",
+ Savesname:"立即发布",
+ Cancel:this.homeworkhide,
+ Saves:this.homeworkstartend,
+ })
+ }
+ }).catch((error) => {
+ console.log(error)
+ });
+
+ }
+
+ }
+ }
- }
}
@@ -154,6 +221,7 @@ class Immediatelypublish extends Component{
modalname:undefined,
modaltype:undefined,
visible:false,
+ OneSelftype:false,
Topval:undefined,
Topvalright:undefined,
Botvalleft:undefined,
@@ -174,18 +242,42 @@ class Immediatelypublish extends Component{
// 确定立即发布
homeworkstartend=(ids,endtime)=>{
- let {checkBoxValues}=this.props
+ let {checkBoxValues,pushtype}=this.props
let {chooseId}=this.state;
let coursesId=this.props.match.params.coursesId;
+ let data={};
+
+ if(pushtype===true){
+
+ if(ids.length===0){
+ data = {
+ check_ids:checkBoxValues,
+ end_time: endtime,
+ }
+ }else{
+ data={
+ check_ids: checkBoxValues,
+ group_ids: ids,
+ group_end_times:endtime,
+ detail:true
+ }
+
+ }
+ }else{
+
+ data={
+ check_ids:checkBoxValues,
+ group_ids:chooseId,
+ end_time:endtime
+ }
+ }
+
+
if(this.props.Exercisetype==="exercise"){
let url=`/courses/${coursesId}/exercises/publish.json`
- axios.post(url,{
- check_ids:checkBoxValues,
- group_ids:chooseId,
- end_time:endtime
- }).then((result)=>{
+ axios.post(url,data).then((result)=>{
if(result){
this.props.showNotification(result.data.message);
this.homeworkhide();
@@ -210,11 +302,7 @@ class Immediatelypublish extends Component{
}else{
let url=`/courses/${coursesId}/polls/publish.json`
- axios.post(url,{
- check_ids:checkBoxValues,
- group_ids:chooseId,
- end_time:endtime
- }).then((result)=>{
+ axios.post(url,data).then((result)=>{
if(result){
this.props.showNotification(result.data.message);
this.homeworkhide();
@@ -277,6 +365,29 @@ class Immediatelypublish extends Component{
course_groups={course_groups}
getcourse_groupslist={(id)=>this.getcourse_groupslist(id)}
/>
+
+ {/*立即发布*/}
+ this.getcourse_groupslist(id)}
+ starttimes={this.state.starttimes}
+ starttimesend={this.state.starttimesend}
+ typs={this.state.typs}
+ />
+
{/* 公用的提示弹框 */}
{
var homeworkid = this.props.match.params.homeworkid;
- console.log(this.props)
+
let data={}
if(ds.length===0){
if(this.props.teacherdatapage.category.main===1){
From 624738d8976bec25fa72a6a5a3b494440d4c5a1d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com>
Date: Sat, 19 Oct 2019 17:48:39 +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
---
.../src/modules/courses/coursesPublic/OneSelfOrderModal.js | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/public/react/src/modules/courses/coursesPublic/OneSelfOrderModal.js b/public/react/src/modules/courses/coursesPublic/OneSelfOrderModal.js
index ef21f963c..5d4b5c175 100644
--- a/public/react/src/modules/courses/coursesPublic/OneSelfOrderModal.js
+++ b/public/react/src/modules/courses/coursesPublic/OneSelfOrderModal.js
@@ -287,7 +287,7 @@ class OneSelfOrderModal extends Component{
{this.props.starttime}
{this.props.modaltype===undefined||this.props.modaltype===2?
{/*{this.props.endtime}*/}
- 截止时间:
+ 截止时间
{this.state.endtimetype===true?{this.state.endtimetypevalue}
:""}
+ (仅支持半点和整点)
:""}
}
{/* usingCheckBeforePost 为true的时候 全选所有分班 */}
@@ -331,7 +332,7 @@ class OneSelfOrderModal extends Component{
分班名称
- 截止时间
+ 截止时间(仅支持半点和整点)
}
{this.props.modaltype===undefined||this.props.modaltype===2
@@ -365,7 +366,6 @@ class OneSelfOrderModal extends Component{
locale={locale}
format={dateFormat}
placeholder="请选择截止时间"
- id={"endTime"}
width={"210px"}
value={item.end_time===null||item.end_time===""?"":moment(item.end_time, dateFormat)}
onChange={(e,data)=>this.onChangeTimeendlist(e,data,item.id)}
From 6d1b82eb6587ca5895ffc75075d003b013a89da5 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 11:28:42 +0800
Subject: [PATCH 4/4] =?UTF-8?q?=E7=AB=8B=E5=8D=B3=E5=8F=91=E5=B8=83?=
=?UTF-8?q?=E6=97=B6=E9=97=B4=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../coursesPublic/OneSelfOrderModal.js | 80 ++++++++++++++-----
1 file changed, 61 insertions(+), 19 deletions(-)
diff --git a/public/react/src/modules/courses/coursesPublic/OneSelfOrderModal.js b/public/react/src/modules/courses/coursesPublic/OneSelfOrderModal.js
index 5d4b5c175..87a43ca1b 100644
--- a/public/react/src/modules/courses/coursesPublic/OneSelfOrderModal.js
+++ b/public/react/src/modules/courses/coursesPublic/OneSelfOrderModal.js
@@ -34,7 +34,8 @@ class OneSelfOrderModal extends Component{
this.state={
group_ids:[],
endtime:"",
- course_groups:undefined
+ course_groups:undefined,
+ Checkboxtype:true
}
}
componentDidMount() {
@@ -165,7 +166,7 @@ class OneSelfOrderModal extends Component{
arr.map((item,key)=>{
if(item.id===id){
- item.end_time=dateString
+ item.end_time=date===null?"":moment(handleDateString(dateString)).format('YYYY-MM-DD HH:mm')
}
})
@@ -176,11 +177,12 @@ class OneSelfOrderModal extends Component{
}
propsSaves=(ds,endtime)=>{
- let {course_groups}=this.state;
+ let {course_groups}=this.state;
if(this.props.typs=="end"){
this.props.Saves()
}else{
+
if(this.props.typs!="end"){
if(!endtime){
this.setState({
@@ -198,6 +200,7 @@ class OneSelfOrderModal extends Component{
}
}
+ let type=false
if(course_groups===undefined||course_groups.length===0){
this.props.Saves(ds,moment(handleDateString(endtime),"YYYY-MM-DD HH:mm").format("YYYY-MM-DD HH:mm"))
}else{
@@ -206,7 +209,15 @@ class OneSelfOrderModal extends Component{
course_groups.map((items,key)=>{
if(item===items.id){
if(!items.end_time){
- arr.push(moment(moment(handleDateString(this.props.staytime)).add(1, 'week')).format("YYYY-MM-DD HH:mm"))
+ type=true
+ this.setState({
+ endtimetype:true,
+ endtimetypeid:items.id,
+ endtimetypevalue:"截止时间不能为空"
+ })
+ return
+
+ // arr.push(moment(moment(handleDateString(this.props.staytime)).add(1, 'week')).format("YYYY-MM-DD HH:mm"))
}else{
arr.push(items.end_time)
}
@@ -214,23 +225,53 @@ class OneSelfOrderModal extends Component{
})
})
+ if(type===false){
+ this.props.Saves(ds,arr)
+ }
- this.props.Saves(ds,arr)
}
-
}
+ }
+
+ Checkboxtype=(e)=>{
+ let {course_groups}=this.state;
+ let arr=[];
+ if(e.target.checked==true){
+ course_groups.map((item,key)=>{
+ arr.push(item.id)
+ })
+ }else{
+ arr=[]
+ }
+ this.setState({
+ Checkboxtype:e.target.checked,
+ group_ids:arr
+ })
}
render(){
let {group_ids,endtime,course_groups}=this.state;
-
+ // console.log(course_groups)
// TODO course_groups为空时的处理
return(
+
{
this.props.OneSelftype===true?