From 05a22b7e9c97ab7a15e8fd07301b68d5a57970f6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com>
Date: Fri, 21 Jun 2019 12:31:40 +0800
Subject: [PATCH] =?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/CommonWorkSetting.js | 2 +-
.../courses/coursesPublic/Associationmodel.js | 476 +++----
.../src/modules/courses/exercise/Exercise.js | 2 +-
.../graduation/tasks/GraduateTaskItem.js | 1 +
.../tasks/GraduationTaskssetting.js | 10 +-
.../tasks/GraduationTaskssettinglist.js | 15 +-
.../tasks/GraduationTaskssettingquestions.js | 2 +-
.../modules/courses/graduation/tasks/index.js | 2 +-
public/react/src/modules/courses/poll/Poll.js | 1240 ++++++++---------
.../poll/pollPublicBtn/ImmediatelyPublish.js | 562 ++++----
.../courses/shixunHomework/Listofworks.js | 2 +-
.../shixunHomework/ShixunStudentWork.js | 2 +-
.../shixunHomework/Trainingjobsetting.js | 2 +-
.../shixunHomework/Workquestionandanswer.js | 2 +-
.../courses/shixunHomework/shixunHomework.js | 4 +-
15 files changed, 1165 insertions(+), 1159 deletions(-)
diff --git a/public/react/src/modules/courses/busyWork/CommonWorkSetting.js b/public/react/src/modules/courses/busyWork/CommonWorkSetting.js
index 3ef242a44..5ce5a5df3 100644
--- a/public/react/src/modules/courses/busyWork/CommonWorkSetting.js
+++ b/public/react/src/modules/courses/busyWork/CommonWorkSetting.js
@@ -421,7 +421,7 @@ class CommonWorkSetting extends Component{
Topval:"本操作只对“未发布”的对象生效",
Botvalleft:"暂不发布",
Botval:"则通过后续手动设置,定时发布",
- starttime:starttime,
+ starttime:moment(moment(new Date())).format("YYYY-MM-DD HH:mm"),
endtime:endtime,
Cancelname:"暂不发布",
Savesname:"立即发布",
diff --git a/public/react/src/modules/courses/coursesPublic/Associationmodel.js b/public/react/src/modules/courses/coursesPublic/Associationmodel.js
index 48616ef1f..1f10caa5f 100644
--- a/public/react/src/modules/courses/coursesPublic/Associationmodel.js
+++ b/public/react/src/modules/courses/coursesPublic/Associationmodel.js
@@ -1,239 +1,239 @@
-import React,{ Component } from "react";
-import { Modal,Checkbox,Upload,Button,Icon,message,Input,Radio} from "antd";
-import axios from 'axios';
-import Modals from '../../modals/Modals';
-const RadioGroup = Radio.Group;
-const Search = Input.Search;
-
-class Associationmodel extends Component{
- constructor(props){
- super(props);
- this.state={
- group_ids:[],
- fileList:[],
- Modalstype:false,
- Modalstopval:"",
- ModalCancel:"",
- ModalSave:"",
- loadtype:false,
- search:undefined,
- page:1,
- limit:"",
- projects:undefined,
- projectvalue:undefined,
- projectvaluetype:false,
- }
- }
-
-
- componentDidMount() {
- this.searchValue();
- }
-
- searchValue=()=>{
- let {search}=this.state;
- let url="/users/search_user_projects.json";
- axios.get(url, {
- params: {
- search: search
- }
- }).then((result)=>{
- console.log(result)
- if(result.status===200){
- this.setState({
- projects:result.data.projects
- })
- }
-
- }).catch((error)=>{
- console.log(error)
- })
- }
-
- inputSearchValue=(e)=>{
- this.setState({
- search:e.target.value
- })
- }
-
-
- goback=()=>{
- this.props.funlist()
- this.props.Cancel()
- console.log(this.props)
- this.setState({
- Modalstype:false,
-
- })
- }
-
-
- setSaves=()=>{
- let {projectvalue}=this.state;
- let taskid=this.props.taskid;
- let url="/graduation_tasks/"+taskid+"/graduation_works/relate_project.json";
-
- axios.post(url, {
- project_id: projectvalue
- }).then((result)=>{
-
- if(result.status===200){
- if(result.data.status===0){
-
- this.setState({
- Modalstype:true,
- Modalstopval:result.data.message,
- ModalSave:this.goback,
- loadtype:true
- })
-
- }
-
- }
-
- }).catch((error)=>{
- console.log(error)
- })
- }
- Saves=()=>{
- let {projectvalue}=this.state;
- if(projectvalue===undefined||projectvalue===""){
- this.setState({
- projectvaluetype:true,
- })
- }else{
- this.setState({
- projectvaluetype:false,
- })
- }
- let taskid=this.props.taskid;
- console.log(this.props)
- let url="/graduation_tasks/"+taskid+"/graduation_works/check_project.json";
- axios.get(url, {
- params: {
- project_id: projectvalue
- }
- }).then((result)=>{
-
- if(result.status===200){
-
- if(result.data.is_relate===false){
-
- this.setSaves()
-
- }else{
-
- this.setState({
- Modalstype:true,
- Modalstopval:"该项目已被"+result.data.relate_user+"关联",
- ModalSave:this.ModalSave,
- loadtype:true
- })
-
- }
-
- }
-
- }).catch((error)=>{
- console.log(error)
- })
- }
-
- onChange = (e) => {
-
- this.setState({
- projectvalue: e.target.value,
- });
-
- }
-
- ModalSave=()=>{
- this.setState({
- Modalstype:false
- })
- }
-
- render(){
- let {
- Modalstype,
- Modalstopval,
- ModalCancel,
- ModalSave,
- loadtype,
- search,
- projects,
- projectvalue,
- projectvaluetype
- }=this.state;
-
-
-
- return(
-
- {/*提示*/}
-
-
-
-
-
-
-
-
-
-
-
-
-
- {projects&&projects.map((item,key)=>{
- return(
-
-
-
{item.project_name}
-
- )
- })}
-
-
-
-
-
- {projectvaluetype===true?
请先选择项目:""}
-
-
-
-
-
-
- )
- }
-}
+import React,{ Component } from "react";
+import { Modal,Checkbox,Upload,Button,Icon,message,Input,Radio} from "antd";
+import axios from 'axios';
+import Modals from '../../modals/Modals';
+const RadioGroup = Radio.Group;
+const Search = Input.Search;
+
+class Associationmodel extends Component{
+ constructor(props){
+ super(props);
+ this.state={
+ group_ids:[],
+ fileList:[],
+ Modalstype:false,
+ Modalstopval:"",
+ ModalCancel:"",
+ ModalSave:"",
+ loadtype:false,
+ search:undefined,
+ page:1,
+ limit:"",
+ projects:undefined,
+ projectvalue:undefined,
+ projectvaluetype:false,
+ }
+ }
+
+
+ componentDidMount() {
+ this.searchValue();
+ }
+
+ searchValue=()=>{
+ let {search}=this.state;
+ let url="/users/search_user_projects.json";
+ axios.get(url, {
+ params: {
+ search: search
+ }
+ }).then((result)=>{
+ console.log(result)
+ if(result.status===200){
+ this.setState({
+ projects:result.data.projects
+ })
+ }
+
+ }).catch((error)=>{
+ console.log(error)
+ })
+ }
+
+ inputSearchValue=(e)=>{
+ this.setState({
+ search:e.target.value
+ })
+ }
+
+
+ goback=()=>{
+ this.props.funlist()
+ this.props.Cancel()
+ console.log(this.props)
+ this.setState({
+ Modalstype:false,
+
+ })
+ }
+
+
+ setSaves=()=>{
+ let {projectvalue}=this.state;
+ let taskid=this.props.taskid;
+ let url="/graduation_tasks/"+taskid+"/graduation_works/relate_project.json";
+
+ axios.post(url, {
+ project_id: projectvalue
+ }).then((result)=>{
+
+ if(result.status===200){
+ if(result.data.status===0){
+
+ this.setState({
+ Modalstype:true,
+ Modalstopval:result.data.message,
+ ModalSave:this.goback,
+ loadtype:true
+ })
+ this.props.funlist()
+ }
+
+ }
+
+ }).catch((error)=>{
+ console.log(error)
+ })
+ }
+ Saves=()=>{
+ let {projectvalue}=this.state;
+ if(projectvalue===undefined||projectvalue===""){
+ this.setState({
+ projectvaluetype:true,
+ })
+ }else{
+ this.setState({
+ projectvaluetype:false,
+ })
+ }
+ let taskid=this.props.taskid;
+ console.log(this.props)
+ let url="/graduation_tasks/"+taskid+"/graduation_works/check_project.json";
+ axios.get(url, {
+ params: {
+ project_id: projectvalue
+ }
+ }).then((result)=>{
+
+ if(result.status===200){
+
+ if(result.data.is_relate===false){
+
+ this.setSaves()
+
+ }else{
+
+ this.setState({
+ Modalstype:true,
+ Modalstopval:"该项目已被"+result.data.relate_user+"关联",
+ ModalSave:this.ModalSave,
+ loadtype:true
+ })
+
+ }
+
+ }
+
+ }).catch((error)=>{
+ console.log(error)
+ })
+ }
+
+ onChange = (e) => {
+
+ this.setState({
+ projectvalue: e.target.value,
+ });
+
+ }
+
+ ModalSave=()=>{
+ this.setState({
+ Modalstype:false
+ })
+ }
+
+ render(){
+ let {
+ Modalstype,
+ Modalstopval,
+ ModalCancel,
+ ModalSave,
+ loadtype,
+ search,
+ projects,
+ projectvalue,
+ projectvaluetype
+ }=this.state;
+
+
+
+ return(
+
+ {/*提示*/}
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {projects&&projects.map((item,key)=>{
+ return(
+
+
+
{item.project_name}
+
+ )
+ })}
+
+
+
+
+
+ {projectvaluetype===true?
请先选择项目:""}
+
+
+
+
+
+
+ )
+ }
+}
export default Associationmodel;
\ No newline at end of file
diff --git a/public/react/src/modules/courses/exercise/Exercise.js b/public/react/src/modules/courses/exercise/Exercise.js
index 608bdf166..a6791fb54 100644
--- a/public/react/src/modules/courses/exercise/Exercise.js
+++ b/public/react/src/modules/courses/exercise/Exercise.js
@@ -213,7 +213,7 @@ class Exercise extends Component{
Topval:"本操作只对“未发布”的对象生效",
Botvalleft:"暂不发布",
Botval:"则通过后续手动设置,定时发布",
- starttime:"发布时间:"+this.props.getNowFormatDates(1),
+ starttime:"发布时间:"+moment(moment(new Date())).format("YYYY-MM-DD HH:mm"),
starttimes:this.props.getNowFormatDates(1),
endtime:"截止时间:"+this.props.getNowFormatDates(2),
Cancelname:"暂不发布",
diff --git a/public/react/src/modules/courses/graduation/tasks/GraduateTaskItem.js b/public/react/src/modules/courses/graduation/tasks/GraduateTaskItem.js
index 942fa96ca..4d6c6777b 100644
--- a/public/react/src/modules/courses/graduation/tasks/GraduateTaskItem.js
+++ b/public/react/src/modules/courses/graduation/tasks/GraduateTaskItem.js
@@ -65,6 +65,7 @@ class GraduateTaskItem extends Component{
cardsModalsavetype:this.cannerassocition,
loadtype:true
})
+ this.props.funlist()
}
}).catch((error)=>{
diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssetting.js b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssetting.js
index c74f8a1d7..dfa6879f5 100644
--- a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssetting.js
+++ b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssetting.js
@@ -415,7 +415,7 @@ class GraduationTaskssettingapp extends Component{
Topval:"发布设置均可修改",
Botvalleft:"点击修改",
Botval:"此设置将对所有分班生效",
- starttime:moment(moment(handleDateString(this.props.getNowFormatDates(1)))).format("YYYY-MM-DD HH:mm") ,
+ starttime:moment(moment(new Date())).format("YYYY-MM-DD HH:mm") ,
starttimes:this.props.getNowFormatDates(1),
typs:"start",
endtime:endtime,
@@ -1164,7 +1164,7 @@ class GraduationTaskssettingapp extends Component{
截止时间:
-
+
指导老师手动分配 (由指导老师在作品列表中,手动选择每个作品被分配的评阅老师)
- 答辩组间老师互评 (由系统按照设置在答辩组之间自动分配:
- 答辩组设置
+ 答辩组间老师互评 (由系统按照设置在答辩组之间自动分配:
+
+ 答辩组设置
+
diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js
index 7ef1f99c5..019b739c9 100644
--- a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js
+++ b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js
@@ -332,7 +332,7 @@ class GraduationTaskssettinglist extends Component{
Topval:"发布设置均可修改",
Botvalleft:"点击修改",
Botval:"此设置将对所有分班生效",
- starttime:moment(new Date()).format('YYYY-MM-DD 00:00'),
+ starttime:moment(moment(new Date())).format("YYYY-MM-DD HH:mm") ,
starttimes:this.props.getNowFormatDates(1),
typs:"start",
endtime:endtime,
@@ -544,6 +544,7 @@ class GraduationTaskssettinglist extends Component{
axios.get(url).then((result)=>{
if(result.data.status===0){
+ this.searchValue()
this.setState({
Modalstype:true,
Modalstopval:result.data.message,
@@ -730,7 +731,7 @@ class GraduationTaskssettinglist extends Component{
其它历史评分将全部失效:""}>
{tag.name==="评阅"?tag.status===0?"--":
- tag.name
+ {tag.name}
:
:""}>
{tag.name==="评阅"?tag.status===0?"--":
- tag.name
+ {tag.name}
:
调整学生最终成绩
其它历史评分将全部失效:""}>
{tag.name==="评阅"?tag.status===0?"--":
- tag.name
+ {tag.name}
+
:
this.showModulationtype(tag.id):tag.name==="分配"?()=>this.showAllocationModal(tag.id):""}
@@ -1145,7 +1147,7 @@ class GraduationTaskssettinglist extends Component{
调整学生最终成绩
其它历史评分将全部失效:""}>
{tag.name==="评阅"?tag.status===0?"--":
- tag.name
+ {tag.name}
:
:""}
{taskslistdata&&taskslistdata?
@@ -1551,7 +1554,7 @@ class GraduationTaskssettinglist extends Component{
to={"/courses/"+courseId+"/graduation_tasks/"+category_id+"/"+task_Id+"/setting"}>设置
- {taskslistdata.work_status===undefined?"":taskslistdata.work_status.map((item,key)=>{
+ {taskslistdata.work_status===undefined||taskslistdata.work_status===null||taskslistdata.work_status.length===0?"":taskslistdata.work_status.map((item,key)=>{
return(
{item==="提交作品"?提交作品:""}
diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettingquestions.js b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettingquestions.js
index 80055f5d3..997085d13 100644
--- a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettingquestions.js
+++ b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettingquestions.js
@@ -81,7 +81,7 @@ class GraduationTasksquestions extends Component{
Topval:"发布设置均可修改",
Botvalleft:"点击修改",
Botval:"此设置将对所有分班生效",
- starttime:moment(new Date()).format('YYYY-MM-DD 00:00'),
+ starttime:moment(moment(new Date())).format("YYYY-MM-DD HH:mm") ,
starttimes:this.props.getNowFormatDates(1),
typs:"start",
endtime:endtime,
diff --git a/public/react/src/modules/courses/graduation/tasks/index.js b/public/react/src/modules/courses/graduation/tasks/index.js
index fa86da93d..f2fc3845e 100644
--- a/public/react/src/modules/courses/graduation/tasks/index.js
+++ b/public/react/src/modules/courses/graduation/tasks/index.js
@@ -413,7 +413,7 @@ class GraduationTasks extends Component{
Topval:"本操作只对“未发布”的对象生效",
Botvalleft:"暂不发布",
Botval:"则通过后续手动设置,定时发布",
- starttime:"发布时间:"+starttime,
+ starttime:"发布时间:"+moment(moment(new Date())).format("YYYY-MM-DD HH:mm"),
starttimes:this.props.getNowFormatDates(1),
typs:"start",
endtime:"截止时间:"+endtime,
diff --git a/public/react/src/modules/courses/poll/Poll.js b/public/react/src/modules/courses/poll/Poll.js
index 2d0aedd7a..aa01bcf47 100644
--- a/public/react/src/modules/courses/poll/Poll.js
+++ b/public/react/src/modules/courses/poll/Poll.js
@@ -1,621 +1,621 @@
-import React,{ Component } from "react";
-import { Input,Checkbox,Table, Pagination, Modal,Menu, Tooltip ,Spin} from "antd";
-import CourseLayoutcomponent from '../common/CourseLayoutComponent';
-import HomeworkModal from "../coursesPublic/HomeworkModal";
-import ShixunModal from "../coursesPublic/ShixunModal";
-import PathModal from "../coursesPublic/PathModal";
-import AddcoursesNav from "../coursesPublic/AddcoursesNav";
-import ImmediatelyPublish from './pollPublicBtn/ImmediatelyPublish'
-import ImmediatelyEnd from './pollPublicBtn/ImmediatelyEnd'
-import PollListItem from './PollListItem'
-import NoneData from '../coursesPublic/NoneData'
-import UseBank from '../busyWork/UseBank'
-
-import _ from 'lodash';
-
-import '../css/members.css'
-import '../css/busyWork.css'
-
-
-import { WordsBtn } from 'educoder'
-import Modals from '../../modals/Modals'
-
-import axios from 'axios'
-
-const Search = Input.Search;
-
-
-class Poll extends Component{
- constructor(props){
- super(props);
- this.state={
- modalname:undefined,
- modaltype:undefined,
- visible:false,
- Topval:undefined,
- Topvalright:undefined,
- Botvalleft:undefined,
- Botval:undefined,
- starttime:undefined,
- endtime:undefined,
- Cancelname:undefined,
- Savesname:undefined,
- Cancel:undefined,
- Saves:undefined,
- StudentList_value:undefined,
- addname:undefined,
- addnametype:false,
- addnametab:undefined,
- addcanner:undefined,
- addsave:undefined,
- course_groups:[],
- chooseId:undefined,
- // 列表相关
- checkBoxValues:[],
- checkAllValue:false,
- pollsList:undefined,
- course_types:undefined,
- page:1,
- pageSize:15,
- type:0,
- polls_counts:undefined,
-
- //公用提示弹框相关
- modalsType:false,
- modalsTopval:"",
- modalsBottomval:"",
- loadtype:false,
- boxType:"delete",
- isSpin:false
- }
-
- }
-
- inputStudent=(e)=>{
- this.setState({
- StudentList_value:e.target.value
- })
- }
-
-
- // 题库选用
- selectBlank=(type)=>{
- if(type===2){
- this.setState({
- addname:"添加目录",
- addnametype:true,
- addnametab:type,
- addcanner:this.homeworkhide,
- addsave:undefined
- })
- }else if(type===4){
- this.setState({
- addname:"移动到目录",
- addnametype:true,
- addnametab:type,
- addcanner:this.homeworkhide,
- addsave:undefined
- })
- }
-
- }
- // 切换菜单选项
- changeType=(e)=>{
- this.setState({
- type:e.key,
- checkBoxValues:[],
- checkAllValue:false
- })
- let{StudentList_value,page}=this.state;
- this.InitList(e.key,StudentList_value,page);
- }
- // 获取列表数据
- InitList=(type,search,page)=>{
- this.setState({
- isSpin:true
- })
- let {pageSize}=this.state
- let coursesId=this.props.match.params.coursesId;
- let url='/courses/'+coursesId+'/polls.json?limit='+pageSize+'&page='+page
- if(type!="0"){
- url+="&type="+type
- }
- if(search!=""&&search!=undefined){
- url+="&search="+search
- }
- axios.get(url).then((result)=>{
- if(result){
- this.setState({
- pollsList:result.data.polls,
- course_types:result.data.course_types,
- polls_counts:result.data.polls_counts,
- isSpin:false,
- checkBoxValues:[]
- })
- }
- }).catch((error)=>{
- console.log(error);
- })
- }
- // 加载列表
- componentDidMount(){
- this.setState({
- isSpin:true
- })
- let{type,StudentList_value,page}=this.state
- this.InitList(type,StudentList_value,page);
- }
- //切换分页
- changePage=(pageNumber)=>{
-
- this.setState({
- page:pageNumber
- })
- let{type,StudentList_value}=this.state
- this.InitList(type,StudentList_value,pageNumber);
- }
- // 搜索
- searchInfo=()=>{
- this.setState({
- page:1
- })
- let{type,StudentList_value}=this.state;
- this.InitList(type,StudentList_value,1)
- }
- // checkbox
- onItemClick = (item) => {
- const checkBoxValues = this.state.checkBoxValues.slice(0);
- const index = checkBoxValues.indexOf(item.id);
- if (index != -1) {
- _.remove(checkBoxValues, (listItem)=> listItem === item.id)
- } else {
- checkBoxValues.push(item.id);
- }
- this.onCheckBoxChange(checkBoxValues)
- }
- // 全选or反选
- onCheckAll = (e) => {
- this.setState({
- checkAllValue: e.target.checked
- })
- const values = this.state.pollsList.map(item => {
- return item.id
- })
- if (e.target.checked) {
- const concated = this.state.checkBoxValues.concat(values);
- const uniq=_.uniq(concated)
- this.setState({
- checkBoxValues: uniq
- })
- } else {
- this.setState({
- checkBoxValues: _.difference(this.state.checkBoxValues, values)
- })
- }
- }
-
- onCheckBoxChange = (checkedValues) => {
- this.setState({
- checkBoxValues: checkedValues,
- checkAllValue: checkedValues.length == this.state.pollsList.length
- })
- }
-
- //删除或者设为公开
- ActionPoll=(value)=>{
- let CourseId=this.props.match.params.coursesId;
- //判断是否有选中数据
- if(this.state.checkBoxValues.length==0){
- this.props.showNotification("请先在列表中选择数据");
- // this.setState({
- // modalsType:true,
- // modalsTopval:"请先在列表中选择数据",
- // modalsBottomval:'',
- // loadtype:true
- // })
- }else{
- if(value != "bank"){
- this.setState({
- modalsType:true,
- modalsTopval:value=="delete"?"已提交作品将全部被删除,不可恢复":"公开后非课堂成员也可以访问查看",
- modalsBottomval:value=="delete"?"您确定要删除吗?":"是否确认公开?",
- loadtype:false,
- boxType:value
- })
- }else{
- //加入题库
- let url=`/courses/${CourseId}/polls/join_poll_banks.json`;
- axios.post((url), {
- check_ids: this.state.checkBoxValues
- })
- .then((result)=>{
- if(result){
- this.props.showNotification(`${result.data.message}`);
- this.setState({
- modalsType:false,
- modalsTopval:"",
- modalsBottomval:"",
- loadtype:false,
- checkBoxValues:[],
- checkAllValue:false
- })
- let{type,StudentList_value}=this.state
- this.InitList(type,StudentList_value,1);
- }
- }).catch((error)=>{
- console.log(error);
- })
- }
- }
- }
- //取消删除或者设为公开
- modalCancel=()=>{
- this.setState({
- modalsType:false,
- modalsTopval:"",
- modalsBottomval:"",
- loadtype:false
- })
- }
- //确定删除或者设为公开
- ModalAction=()=>{
- let CourseId=this.props.match.params.coursesId;
- if(this.state.checkBoxValues.length==0){
- this.setState({
- modalsType:false,
- modalsTopval:"",
- loadtype:false,
- checkBoxValues:[]
- })
- }else{
- if(this.state.boxType=="delete"){
- //删除
- let url=`/courses/${CourseId}/polls/destroys.json`;
- axios.post((url), {
- check_ids: this.state.checkBoxValues
- })
- .then((result)=>{
- if(result){
- this.props.showNotification(`${result.data.message}`);
- this.setState({
- modalsType:false,
- modalsTopval:"",
- modalsBottomval:"",
- loadtype:false,
- checkBoxValues:[]
- })
- let{type,StudentList_value}=this.state
- this.InitList(type,StudentList_value,1);
- }
- }).catch((error)=>{
- console.log(error);
- })
- }else if(this.state.boxType=="public"){
- //设为公开
- let url=`/courses/${CourseId}/polls/set_public.json`;
- axios.post((url), {
- check_ids: this.state.checkBoxValues
- })
- .then((result)=>{
- if(result){
- this.props.showNotification(`${result.data.message}`);
- this.setState({
- modalsType:false,
- modalsTopval:"",
- loadtype:false,
- checkBoxValues:[]
- })
- let{type,StudentList_value}=this.state
- this.InitList(type,StudentList_value,1);
- }
- }).catch((error)=>{
- console.log(error);
- })
- }
- }
- }
-
- successFun=()=>{
- let{type,StudentList_value,page}=this.state
- this.InitList(type,StudentList_value,page)
-
- }
- // 题库选用成功后,立即发布,刷新页面
- useBankSuccess=(checkValue,value)=>{
- // let{type,StudentList_value,page}=this.state
- // this.InitList(type,StudentList_value,page);
- this.setState({
- checkBoxValues:[]
- })
- let coursesId=this.props.match.params.coursesId;
- let url=`/courses/${coursesId}/polls/publish_modal.json`;
- axios.get(url,{
- params:{
- check_ids:value
- }
- }).then((response) => {
- if(response){
- let list=[];
- if(response.data.course_info){
- for(var i=0;i 0 ? 1 : 2,
- visible:true,
- Topval:"本操作只对“未发布”的对象生效",
- Botvalleft:"暂不发布",
- Botval:"则通过后续手动设置,定时发布",
- starttime:"发布时间:"+this.props.getNowFormatDates(1),
- starttimes:this.props.getNowFormatDates(1),
- endtime:"截止时间:"+this.props.getNowFormatDates(2),
- Cancelname:"暂不发布",
- Savesname:"立即发布",
- Cancel:this.homeworkhide,
- Saves:this.homeworkstartend,
- })
- }
- }).catch((error) => {
- console.log(error)
- });
- }
-
- getcourse_groupslist=(id)=>{
- this.setState({
- chooseId:id
- })
- }
-
- // 确定立即发布
- homeworkstartend=(value,endtime)=>{
-
- let {checkBoxValues}=this.state;
- let coursesId=this.props.match.params.coursesId;
-
- let url=`/courses/${coursesId}/polls/publish.json`
- axios.post(url,{
- check_ids:checkBoxValues,
- group_ids:value,
- end_time:endtime
- }).then((result)=>{
- if(result){
- let{type,StudentList_value,page}=this.state
- this.InitList(type,StudentList_value,page);
- this.props.showNotification(result.data.message);
- this.homeworkhide();
- }
- }).catch((error)=>{
- console.log(error);
- })
- }
-
- //暂不发布
- homeworkhide=()=>{
- this.setState({
- modalname:undefined,
- modaltype:undefined,
- visible:false,
- Topval:undefined,
- Topvalright:undefined,
- Botvalleft:undefined,
- Botval:undefined,
- starttime:undefined,
- endtime:undefined,
- Cancelname:undefined,
- Savesname:undefined,
- Cancel:undefined,
- Saves:undefined,
- StudentList_value:undefined,
- addname:undefined,
- addnametype:false,
- addnametab:undefined,
- checkBoxValues:[]
- })
- }
-
- render(){
- let {
- modalname,
- modaltype,
- visible,
- Topval,
- Topvalright,
- Botvalleft,
- Botval,
- starttime,
- endtime,
- Cancelname,
- Savesname,
- Cancel,
- Saves,
- StudentList_value,
- addname,
- addnametype,
- addnametab,
- addcanner,
- addsave,
- course_groups,
-
- checkAllValue,
- checkBoxValues,
- course_types,
- pollsList,
- page,
- pageSize,
- polls_counts,
-
- modalsType,
- modalsTopval,
- modalsBottomval,
- loadtype
- }=this.state;
- console.log(this.props);
- let {child}=this.props;
- let {coursesId,Id}=this.props.match.params
- const isAdmin = this.props.isAdmin()
- const isStudent=this.props.isStudent();
- // console.log(child)
- return(
-
-
- {visible===true?this.getcourse_groupslist(id)}
- />:""}
-
- {/*添加目录/选择目录*/}
-
-
- {/* 公用的提示弹框 */}
-
-
-
-
-
- {polls_counts&&polls_counts.left_banner_name}
- {
- isAdmin &&
-
-
- 新建
-
- }
-
-
-
- 共{polls_counts && polls_counts.polls_total_counts}个问卷
- 已发布:{polls_counts && polls_counts.polls_published_counts}个
- {
- isAdmin && 未发布:{polls_counts && polls_counts.polls_unpublish_counts}个
- }
-
-
-
-
-
-
-
-
-
-
- {
- pollsList && pollsList.length > 0 && isAdmin &&
-
-
-
已选 {checkBoxValues.length} 个
-
-
-
- }
-
- {
- pollsList && pollsList.length > 0 &&
-
-
-
- {
- pollsList && pollsList.map((item,key)=>{
- return(
-
this.onItemClick(item)}>}
- >
- )
- })
- }
-
-
- }
-
- {
- pollsList && pollsList.length==0 &&
- }
- {
- course_types && polls_counts.polls_all_counts > pageSize ?
-
- :
- ""
- }
-
-
-
- )
- }
-}
+import React,{ Component } from "react";
+import { Input,Checkbox,Table, Pagination, Modal,Menu, Tooltip ,Spin} from "antd";
+import CourseLayoutcomponent from '../common/CourseLayoutComponent';
+import HomeworkModal from "../coursesPublic/HomeworkModal";
+import ShixunModal from "../coursesPublic/ShixunModal";
+import PathModal from "../coursesPublic/PathModal";
+import AddcoursesNav from "../coursesPublic/AddcoursesNav";
+import ImmediatelyPublish from './pollPublicBtn/ImmediatelyPublish'
+import ImmediatelyEnd from './pollPublicBtn/ImmediatelyEnd'
+import PollListItem from './PollListItem'
+import NoneData from '../coursesPublic/NoneData'
+import UseBank from '../busyWork/UseBank'
+
+import _ from 'lodash';
+
+import '../css/members.css'
+import '../css/busyWork.css'
+
+
+import { WordsBtn } from 'educoder'
+import Modals from '../../modals/Modals'
+
+import axios from 'axios'
+
+const Search = Input.Search;
+
+
+class Poll extends Component{
+ constructor(props){
+ super(props);
+ this.state={
+ modalname:undefined,
+ modaltype:undefined,
+ visible:false,
+ Topval:undefined,
+ Topvalright:undefined,
+ Botvalleft:undefined,
+ Botval:undefined,
+ starttime:undefined,
+ endtime:undefined,
+ Cancelname:undefined,
+ Savesname:undefined,
+ Cancel:undefined,
+ Saves:undefined,
+ StudentList_value:undefined,
+ addname:undefined,
+ addnametype:false,
+ addnametab:undefined,
+ addcanner:undefined,
+ addsave:undefined,
+ course_groups:[],
+ chooseId:undefined,
+ // 列表相关
+ checkBoxValues:[],
+ checkAllValue:false,
+ pollsList:undefined,
+ course_types:undefined,
+ page:1,
+ pageSize:15,
+ type:0,
+ polls_counts:undefined,
+
+ //公用提示弹框相关
+ modalsType:false,
+ modalsTopval:"",
+ modalsBottomval:"",
+ loadtype:false,
+ boxType:"delete",
+ isSpin:false
+ }
+
+ }
+
+ inputStudent=(e)=>{
+ this.setState({
+ StudentList_value:e.target.value
+ })
+ }
+
+
+ // 题库选用
+ selectBlank=(type)=>{
+ if(type===2){
+ this.setState({
+ addname:"添加目录",
+ addnametype:true,
+ addnametab:type,
+ addcanner:this.homeworkhide,
+ addsave:undefined
+ })
+ }else if(type===4){
+ this.setState({
+ addname:"移动到目录",
+ addnametype:true,
+ addnametab:type,
+ addcanner:this.homeworkhide,
+ addsave:undefined
+ })
+ }
+
+ }
+ // 切换菜单选项
+ changeType=(e)=>{
+ this.setState({
+ type:e.key,
+ checkBoxValues:[],
+ checkAllValue:false
+ })
+ let{StudentList_value,page}=this.state;
+ this.InitList(e.key,StudentList_value,page);
+ }
+ // 获取列表数据
+ InitList=(type,search,page)=>{
+ this.setState({
+ isSpin:true
+ })
+ let {pageSize}=this.state
+ let coursesId=this.props.match.params.coursesId;
+ let url='/courses/'+coursesId+'/polls.json?limit='+pageSize+'&page='+page
+ if(type!="0"){
+ url+="&type="+type
+ }
+ if(search!=""&&search!=undefined){
+ url+="&search="+search
+ }
+ axios.get(url).then((result)=>{
+ if(result){
+ this.setState({
+ pollsList:result.data.polls,
+ course_types:result.data.course_types,
+ polls_counts:result.data.polls_counts,
+ isSpin:false,
+ checkBoxValues:[]
+ })
+ }
+ }).catch((error)=>{
+ console.log(error);
+ })
+ }
+ // 加载列表
+ componentDidMount(){
+ this.setState({
+ isSpin:true
+ })
+ let{type,StudentList_value,page}=this.state
+ this.InitList(type,StudentList_value,page);
+ }
+ //切换分页
+ changePage=(pageNumber)=>{
+
+ this.setState({
+ page:pageNumber
+ })
+ let{type,StudentList_value}=this.state
+ this.InitList(type,StudentList_value,pageNumber);
+ }
+ // 搜索
+ searchInfo=()=>{
+ this.setState({
+ page:1
+ })
+ let{type,StudentList_value}=this.state;
+ this.InitList(type,StudentList_value,1)
+ }
+ // checkbox
+ onItemClick = (item) => {
+ const checkBoxValues = this.state.checkBoxValues.slice(0);
+ const index = checkBoxValues.indexOf(item.id);
+ if (index != -1) {
+ _.remove(checkBoxValues, (listItem)=> listItem === item.id)
+ } else {
+ checkBoxValues.push(item.id);
+ }
+ this.onCheckBoxChange(checkBoxValues)
+ }
+ // 全选or反选
+ onCheckAll = (e) => {
+ this.setState({
+ checkAllValue: e.target.checked
+ })
+ const values = this.state.pollsList.map(item => {
+ return item.id
+ })
+ if (e.target.checked) {
+ const concated = this.state.checkBoxValues.concat(values);
+ const uniq=_.uniq(concated)
+ this.setState({
+ checkBoxValues: uniq
+ })
+ } else {
+ this.setState({
+ checkBoxValues: _.difference(this.state.checkBoxValues, values)
+ })
+ }
+ }
+
+ onCheckBoxChange = (checkedValues) => {
+ this.setState({
+ checkBoxValues: checkedValues,
+ checkAllValue: checkedValues.length == this.state.pollsList.length
+ })
+ }
+
+ //删除或者设为公开
+ ActionPoll=(value)=>{
+ let CourseId=this.props.match.params.coursesId;
+ //判断是否有选中数据
+ if(this.state.checkBoxValues.length==0){
+ this.props.showNotification("请先在列表中选择数据");
+ // this.setState({
+ // modalsType:true,
+ // modalsTopval:"请先在列表中选择数据",
+ // modalsBottomval:'',
+ // loadtype:true
+ // })
+ }else{
+ if(value != "bank"){
+ this.setState({
+ modalsType:true,
+ modalsTopval:value=="delete"?"已提交作品将全部被删除,不可恢复":"公开后非课堂成员也可以访问查看",
+ modalsBottomval:value=="delete"?"您确定要删除吗?":"是否确认公开?",
+ loadtype:false,
+ boxType:value
+ })
+ }else{
+ //加入题库
+ let url=`/courses/${CourseId}/polls/join_poll_banks.json`;
+ axios.post((url), {
+ check_ids: this.state.checkBoxValues
+ })
+ .then((result)=>{
+ if(result){
+ this.props.showNotification(`${result.data.message}`);
+ this.setState({
+ modalsType:false,
+ modalsTopval:"",
+ modalsBottomval:"",
+ loadtype:false,
+ checkBoxValues:[],
+ checkAllValue:false
+ })
+ let{type,StudentList_value}=this.state
+ this.InitList(type,StudentList_value,1);
+ }
+ }).catch((error)=>{
+ console.log(error);
+ })
+ }
+ }
+ }
+ //取消删除或者设为公开
+ modalCancel=()=>{
+ this.setState({
+ modalsType:false,
+ modalsTopval:"",
+ modalsBottomval:"",
+ loadtype:false
+ })
+ }
+ //确定删除或者设为公开
+ ModalAction=()=>{
+ let CourseId=this.props.match.params.coursesId;
+ if(this.state.checkBoxValues.length==0){
+ this.setState({
+ modalsType:false,
+ modalsTopval:"",
+ loadtype:false,
+ checkBoxValues:[]
+ })
+ }else{
+ if(this.state.boxType=="delete"){
+ //删除
+ let url=`/courses/${CourseId}/polls/destroys.json`;
+ axios.post((url), {
+ check_ids: this.state.checkBoxValues
+ })
+ .then((result)=>{
+ if(result){
+ this.props.showNotification(`${result.data.message}`);
+ this.setState({
+ modalsType:false,
+ modalsTopval:"",
+ modalsBottomval:"",
+ loadtype:false,
+ checkBoxValues:[]
+ })
+ let{type,StudentList_value}=this.state
+ this.InitList(type,StudentList_value,1);
+ }
+ }).catch((error)=>{
+ console.log(error);
+ })
+ }else if(this.state.boxType=="public"){
+ //设为公开
+ let url=`/courses/${CourseId}/polls/set_public.json`;
+ axios.post((url), {
+ check_ids: this.state.checkBoxValues
+ })
+ .then((result)=>{
+ if(result){
+ this.props.showNotification(`${result.data.message}`);
+ this.setState({
+ modalsType:false,
+ modalsTopval:"",
+ loadtype:false,
+ checkBoxValues:[]
+ })
+ let{type,StudentList_value}=this.state
+ this.InitList(type,StudentList_value,1);
+ }
+ }).catch((error)=>{
+ console.log(error);
+ })
+ }
+ }
+ }
+
+ successFun=()=>{
+ let{type,StudentList_value,page}=this.state
+ this.InitList(type,StudentList_value,page)
+
+ }
+ // 题库选用成功后,立即发布,刷新页面
+ useBankSuccess=(checkValue,value)=>{
+ // let{type,StudentList_value,page}=this.state
+ // this.InitList(type,StudentList_value,page);
+ this.setState({
+ checkBoxValues:[]
+ })
+ let coursesId=this.props.match.params.coursesId;
+ let url=`/courses/${coursesId}/polls/publish_modal.json`;
+ axios.get(url,{
+ params:{
+ check_ids:value
+ }
+ }).then((response) => {
+ if(response){
+ let list=[];
+ if(response.data.course_info){
+ for(var i=0;i 0 ? 1 : 2,
+ visible:true,
+ Topval:"本操作只对“未发布”的对象生效",
+ Botvalleft:"暂不发布",
+ Botval:"则通过后续手动设置,定时发布",
+ 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)
+ });
+ }
+
+ getcourse_groupslist=(id)=>{
+ this.setState({
+ chooseId:id
+ })
+ }
+
+ // 确定立即发布
+ homeworkstartend=(value,endtime)=>{
+
+ let {checkBoxValues}=this.state;
+ let coursesId=this.props.match.params.coursesId;
+
+ let url=`/courses/${coursesId}/polls/publish.json`
+ axios.post(url,{
+ check_ids:checkBoxValues,
+ group_ids:value,
+ end_time:endtime
+ }).then((result)=>{
+ if(result){
+ let{type,StudentList_value,page}=this.state
+ this.InitList(type,StudentList_value,page);
+ this.props.showNotification(result.data.message);
+ this.homeworkhide();
+ }
+ }).catch((error)=>{
+ console.log(error);
+ })
+ }
+
+ //暂不发布
+ homeworkhide=()=>{
+ this.setState({
+ modalname:undefined,
+ modaltype:undefined,
+ visible:false,
+ Topval:undefined,
+ Topvalright:undefined,
+ Botvalleft:undefined,
+ Botval:undefined,
+ starttime:undefined,
+ endtime:undefined,
+ Cancelname:undefined,
+ Savesname:undefined,
+ Cancel:undefined,
+ Saves:undefined,
+ StudentList_value:undefined,
+ addname:undefined,
+ addnametype:false,
+ addnametab:undefined,
+ checkBoxValues:[]
+ })
+ }
+
+ render(){
+ let {
+ modalname,
+ modaltype,
+ visible,
+ Topval,
+ Topvalright,
+ Botvalleft,
+ Botval,
+ starttime,
+ endtime,
+ Cancelname,
+ Savesname,
+ Cancel,
+ Saves,
+ StudentList_value,
+ addname,
+ addnametype,
+ addnametab,
+ addcanner,
+ addsave,
+ course_groups,
+
+ checkAllValue,
+ checkBoxValues,
+ course_types,
+ pollsList,
+ page,
+ pageSize,
+ polls_counts,
+
+ modalsType,
+ modalsTopval,
+ modalsBottomval,
+ loadtype
+ }=this.state;
+ console.log(this.props);
+ let {child}=this.props;
+ let {coursesId,Id}=this.props.match.params
+ const isAdmin = this.props.isAdmin()
+ const isStudent=this.props.isStudent();
+ // console.log(child)
+ return(
+
+
+ {visible===true?this.getcourse_groupslist(id)}
+ />:""}
+
+ {/*添加目录/选择目录*/}
+
+
+ {/* 公用的提示弹框 */}
+
+
+
+
+
+ {polls_counts&&polls_counts.left_banner_name}
+ {
+ isAdmin &&
+
+
+ 新建
+
+ }
+
+
+
+ 共{polls_counts && polls_counts.polls_total_counts}个问卷
+ 已发布:{polls_counts && polls_counts.polls_published_counts}个
+ {
+ isAdmin && 未发布:{polls_counts && polls_counts.polls_unpublish_counts}个
+ }
+
+
+
+
+
+
+
+
+
+
+ {
+ pollsList && pollsList.length > 0 && isAdmin &&
+
+
+
已选 {checkBoxValues.length} 个
+
+
+
+ }
+
+ {
+ pollsList && pollsList.length > 0 &&
+
+
+
+ {
+ pollsList && pollsList.map((item,key)=>{
+ return(
+
this.onItemClick(item)}>}
+ >
+ )
+ })
+ }
+
+
+ }
+
+ {
+ pollsList && pollsList.length==0 &&
+ }
+ {
+ course_types && polls_counts.polls_all_counts > pageSize ?
+
+ :
+ ""
+ }
+
+
+
+ )
+ }
+}
export default Poll;
\ No newline at end of file
diff --git a/public/react/src/modules/courses/poll/pollPublicBtn/ImmediatelyPublish.js b/public/react/src/modules/courses/poll/pollPublicBtn/ImmediatelyPublish.js
index e0424aa93..95e5ba2ad 100644
--- a/public/react/src/modules/courses/poll/pollPublicBtn/ImmediatelyPublish.js
+++ b/public/react/src/modules/courses/poll/pollPublicBtn/ImmediatelyPublish.js
@@ -1,282 +1,282 @@
-import React,{ Component } from "react";
-
-
-import Modals from '../../../modals/Modals'
-import { WordsBtn } from 'educoder'
-import HomeworkModal from "../../coursesPublic/HomeworkModal";
-
-import axios from 'axios'
-import moment from 'moment';
-
-
-
-
-class Immediatelypublish extends Component{
- constructor(props){
- super(props)
- this.state={
- modalname:undefined,
- modaltype:undefined,
- visible:false,
- Topval:undefined,
- Topvalright:undefined,
- Botvalleft:undefined,
- Botval:undefined,
- starttime:undefined,
- starttimes:undefined,
- endtime:undefined,
- Cancelname:undefined,
- Savesname:undefined,
- Cancel:undefined,
- Saves:undefined,
- course_groups:undefined,
-
- modalsType:false,
- modalsTopval:"",
- loadtype:false,
- chooseId:undefined
- }
- }
- //立即发布
- homeworkstart=()=>{
- let {checkBoxValues}=this.props
-
-
- // console.log(this.props.Exercisetype==="exercise")
-
-
- 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:"则通过后续手动设置,定时发布",
- starttime:"发布时间:"+this.props.getNowFormatDates(1),
- 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:"则通过后续手动设置,定时发布",
- starttime:"发布时间:"+this.props.getNowFormatDates(1),
- starttimes:this.props.getNowFormatDates(1),
- endtime:"截止时间:"+this.props.getNowFormatDates(2),
- Cancelname:"暂不发布",
- Savesname:"立即发布",
- Cancel:this.homeworkhide,
- Saves:this.homeworkstartend,
- })
- }
- }).catch((error) => {
- console.log(error)
- });
-
- }
-
- }
- }
-
- //取消提示弹框
- modalCancel=()=>{
- this.setState({
- modalsType:false,
- modalsTopval:"",
- loadtype:false
- })
- }
- //暂不发布
- homeworkhide=()=>{
- this.setState({
- modalname:undefined,
- modaltype:undefined,
- visible:false,
- Topval:undefined,
- Topvalright:undefined,
- Botvalleft:undefined,
- Botval:undefined,
- starttime:undefined,
- starttimes:undefined,
- endtime:undefined,
- Cancelname:undefined,
- Savesname:undefined,
- Cancel:undefined,
- Saves:undefined,
- StudentList_value:undefined,
- addname:undefined,
- addnametype:false,
- addnametab:undefined
- })
- }
- // 确定立即发布
- homeworkstartend=(ids,endtime)=>{
-
- let {checkBoxValues}=this.props
- let {chooseId}=this.state;
- let coursesId=this.props.match.params.coursesId;
-
- 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)=>{
- if(result){
- this.props.showNotification(result.data.message);
- this.homeworkhide();
-
- // 调用父级公共头部的接口刷新
- this.props.action()
- }
- }).catch((error)=>{
- console.log(error);
- })
-
- }else{
- let url=`/courses/${coursesId}/polls/publish.json`
- axios.post(url,{
- check_ids:checkBoxValues,
- group_ids:chooseId,
- end_time:endtime
- }).then((result)=>{
- if(result){
- this.props.showNotification(result.data.message);
- this.homeworkhide();
-
- // 调用父级公共头部的接口刷新
- this.props.action()
- }
- }).catch((error)=>{
- console.log(error);
- })
- }
-
- }
-
- getcourse_groupslist=(id)=>{
- this.setState({
- chooseId:id
- })
- }
-
- render(){
- let{
- modalname,
- modaltype,
- visible,
- Topval,
- Topvalright,
- Botvalleft,
- Botval,
- starttime,
- starttimes,
- endtime,
- Cancelname,
- Savesname,
- Cancel,
- Saves,
- course_groups,
-
- modalsType,
- modalsTopval,
- loadtype,
- }=this.state
- return(
-
- this.getcourse_groupslist(id)}
- />
- {/* 公用的提示弹框 */}
-
-
- 立即发布
-
- )
- }
-}
+import React,{ Component } from "react";
+
+
+import Modals from '../../../modals/Modals'
+import { WordsBtn } from 'educoder'
+import HomeworkModal from "../../coursesPublic/HomeworkModal";
+
+import axios from 'axios'
+import moment from 'moment';
+
+
+
+
+class Immediatelypublish extends Component{
+ constructor(props){
+ super(props)
+ this.state={
+ modalname:undefined,
+ modaltype:undefined,
+ visible:false,
+ Topval:undefined,
+ Topvalright:undefined,
+ Botvalleft:undefined,
+ Botval:undefined,
+ starttime:undefined,
+ starttimes:undefined,
+ endtime:undefined,
+ Cancelname:undefined,
+ Savesname:undefined,
+ Cancel:undefined,
+ Saves:undefined,
+ course_groups:undefined,
+
+ modalsType:false,
+ modalsTopval:"",
+ loadtype:false,
+ chooseId:undefined
+ }
+ }
+ //立即发布
+ homeworkstart=()=>{
+ let {checkBoxValues}=this.props
+
+
+ // console.log(this.props.Exercisetype==="exercise")
+
+
+ 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:"则通过后续手动设置,定时发布",
+ 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:"则通过后续手动设置,定时发布",
+ 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)
+ });
+
+ }
+
+ }
+ }
+
+ //取消提示弹框
+ modalCancel=()=>{
+ this.setState({
+ modalsType:false,
+ modalsTopval:"",
+ loadtype:false
+ })
+ }
+ //暂不发布
+ homeworkhide=()=>{
+ this.setState({
+ modalname:undefined,
+ modaltype:undefined,
+ visible:false,
+ Topval:undefined,
+ Topvalright:undefined,
+ Botvalleft:undefined,
+ Botval:undefined,
+ starttime:undefined,
+ starttimes:undefined,
+ endtime:undefined,
+ Cancelname:undefined,
+ Savesname:undefined,
+ Cancel:undefined,
+ Saves:undefined,
+ StudentList_value:undefined,
+ addname:undefined,
+ addnametype:false,
+ addnametab:undefined
+ })
+ }
+ // 确定立即发布
+ homeworkstartend=(ids,endtime)=>{
+
+ let {checkBoxValues}=this.props
+ let {chooseId}=this.state;
+ let coursesId=this.props.match.params.coursesId;
+
+ 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)=>{
+ if(result){
+ this.props.showNotification(result.data.message);
+ this.homeworkhide();
+
+ // 调用父级公共头部的接口刷新
+ this.props.action()
+ }
+ }).catch((error)=>{
+ console.log(error);
+ })
+
+ }else{
+ let url=`/courses/${coursesId}/polls/publish.json`
+ axios.post(url,{
+ check_ids:checkBoxValues,
+ group_ids:chooseId,
+ end_time:endtime
+ }).then((result)=>{
+ if(result){
+ this.props.showNotification(result.data.message);
+ this.homeworkhide();
+
+ // 调用父级公共头部的接口刷新
+ this.props.action()
+ }
+ }).catch((error)=>{
+ console.log(error);
+ })
+ }
+
+ }
+
+ getcourse_groupslist=(id)=>{
+ this.setState({
+ chooseId:id
+ })
+ }
+
+ render(){
+ let{
+ modalname,
+ modaltype,
+ visible,
+ Topval,
+ Topvalright,
+ Botvalleft,
+ Botval,
+ starttime,
+ starttimes,
+ endtime,
+ Cancelname,
+ Savesname,
+ Cancel,
+ Saves,
+ course_groups,
+
+ modalsType,
+ modalsTopval,
+ loadtype,
+ }=this.state
+ return(
+
+ this.getcourse_groupslist(id)}
+ />
+ {/* 公用的提示弹框 */}
+
+
+ 立即发布
+
+ )
+ }
+}
export default Immediatelypublish
\ No newline at end of file
diff --git a/public/react/src/modules/courses/shixunHomework/Listofworks.js b/public/react/src/modules/courses/shixunHomework/Listofworks.js
index e38a0c453..ba3c34c51 100644
--- a/public/react/src/modules/courses/shixunHomework/Listofworks.js
+++ b/public/react/src/modules/courses/shixunHomework/Listofworks.js
@@ -821,7 +821,7 @@ class Listofworks extends Component {
Topval: "本操作只对“未发布”的对象生效",
Botvalleft: "暂不发布",
Botval: "则通过后续手动设置,定时发布",
- starttime: "发布时间:" + starttime,
+ starttime: "发布时间:" + moment(moment(new Date())).format("YYYY-MM-DD HH:mm"),
endtime: "截止时间:" + endtime,
starttimes:starttime,
typs:"start",
diff --git a/public/react/src/modules/courses/shixunHomework/ShixunStudentWork.js b/public/react/src/modules/courses/shixunHomework/ShixunStudentWork.js
index 461c4d74d..a62e815ef 100644
--- a/public/react/src/modules/courses/shixunHomework/ShixunStudentWork.js
+++ b/public/react/src/modules/courses/shixunHomework/ShixunStudentWork.js
@@ -304,7 +304,7 @@ class ShixunStudentWork extends Component {
Topval:"本操作只对“未发布”的对象生效",
Botvalleft:"暂不发布",
Botval:"则通过后续手动设置,定时发布",
- starttime:"发布时间:"+starttime,
+ starttime:"发布时间:"+moment(moment(new Date())).format("YYYY-MM-DD HH:mm"),
endtime:"截止时间:"+endtime,
Cancelname:"暂不发布",
Savesname:"立即发布",
diff --git a/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js b/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js
index 919a744cf..108ab58f0 100644
--- a/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js
+++ b/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js
@@ -1237,7 +1237,7 @@ class Trainingjobsetting extends Component {
Topval: "本操作只对“未发布”的对象生效",
Botvalleft: "暂不发布",
Botval: "则通过后续手动设置,定时发布",
- starttime: "发布时间:" + starttime,
+ starttime: "发布时间:" + moment(moment(new Date())).format("YYYY-MM-DD HH:mm"),
starttimes:starttime,
typs:"start",
endtime: "截止时间:" + endtime,
diff --git a/public/react/src/modules/courses/shixunHomework/Workquestionandanswer.js b/public/react/src/modules/courses/shixunHomework/Workquestionandanswer.js
index a06a5be32..7808355e8 100644
--- a/public/react/src/modules/courses/shixunHomework/Workquestionandanswer.js
+++ b/public/react/src/modules/courses/shixunHomework/Workquestionandanswer.js
@@ -148,7 +148,7 @@ class Workquestionandanswer extends Component {
Topval: "本操作只对“未发布”的对象生效",
Botvalleft: "暂不发布",
Botval: "则通过后续手动设置,定时发布",
- starttime: "发布时间:" + starttime,
+ starttime: "发布时间:" + moment(moment(new Date())).format("YYYY-MM-DD HH:mm"),
endtime: "截止时间:" + endtime,
Cancelname: "暂不发布",
Savesname: "立即发布",
diff --git a/public/react/src/modules/courses/shixunHomework/shixunHomework.js b/public/react/src/modules/courses/shixunHomework/shixunHomework.js
index 9589d4515..5970a8907 100644
--- a/public/react/src/modules/courses/shixunHomework/shixunHomework.js
+++ b/public/react/src/modules/courses/shixunHomework/shixunHomework.js
@@ -209,7 +209,7 @@ class ShixunHomework extends Component{
Topval:"本操作只对“未发布”的对象生效",
Botvalleft:"暂不发布",
Botval:"则通过后续手动设置,定时发布",
- starttime:"发布时间:"+starttime,
+ starttime:"发布时间:"+moment(moment(new Date())).format("YYYY-MM-DD HH:mm"),
starttimes:starttime,
endtime:"截止时间:"+endtime,
Cancelname:"暂不发布",
@@ -403,7 +403,7 @@ class ShixunHomework extends Component{
Topval:"本操作只对“未发布”的对象生效",
Botvalleft:"暂不发布",
Botval:"则通过后续手动设置,定时发布",
- starttime:"发布时间:"+ starttime,
+ starttime:"发布时间:"+ moment(moment(new Date())).format("YYYY-MM-DD HH:mm"),
starttimes:starttime,
typs:"start",
endtime:"截止时间:"+ endtime,