diff --git a/public/react/src/modules/courses/Index.js b/public/react/src/modules/courses/Index.js index 1b1c523c0..f2ba8371d 100644 --- a/public/react/src/modules/courses/Index.js +++ b/public/react/src/modules/courses/Index.js @@ -283,6 +283,14 @@ const Completetaskpage =Loadable({ loader: () => import('../../modules/courses/completetaskdetails/Completetaskpage'), loading: Loading, }); + + +//排序 +const Ordering=Loadable({ + loader: () => import('../../modules/courses/ordering/Ordering'), + loading: Loading, +}); + class CoursesIndex extends Component{ constructor(props) { super(props) @@ -461,6 +469,13 @@ class CoursesIndex extends Component{ // console.log(commons) return ( + {/*排序*/} + () + } + > + {/*毕设任务题库详情*/} .ant-menu-item:hover{ - border-bottom:2px solid transparent; -} -.task_menu_ul .ant-menu-horizontal > .ant-menu-item-selected{ - border-bottom: 2px solid #4CACFF !important; -} - -.sourceTag a{ - display: block; - float: left; - background-color:#E5F3FF; - padding: 0px 10px; - height: 24px; - line-height: 24px; - color: #4E7A9B; - margin:5px 0px 5px 10px; -} -.sourceTag a.active{ - color: #FFFFFF;background-color:#4CACFF; + +.polllisthover:hover { + box-shadow: 0px 2px 6px rgba(51,51,51,0.09); + opacity: 1; + border-radius: 2px; +} + +.workList_Item{ + /* padding:20px 30px; */ + display: flex; + background-color: #fff; + margin-bottom: 20px; + padding-top: 10px; +} +p span{ + cursor: default; +} +.mt-5{ margin-top:-5px;} + + +/* ���ѡ��tab */ +.bankNav li{ + float: left; + margin-right: 20px; +} +.bankNav li:last-child{ + margin-right: 0px; +} +.bankNav li.active a{ + color: #fff!important; + background-color: #4CACFF; +} +.bankNav li a{ + display: block; + padding:0px 10px; + height: 28px; + line-height: 28px; + background-color: #F5F5F5; + border-radius: 36px; + color: #666666!important; +} + + + +.task_menu_ul{ + width: 600px; +} + +.task_menu_ul .ant-menu-item,.task_menu_ul .ant-menu-submenu-title{ + padding:0px; + margin-right: 30px; + line-height: 68px; + font-size: 16px; +} +.ant-menu{ + color: #05101a; +} +.task_menu_ul .ant-menu-horizontal{ + border-bottom: none; +} +.task_menu_ul .ant-menu-horizontal > .ant-menu-item:hover{ + border-bottom:2px solid transparent; +} +.task_menu_ul .ant-menu-horizontal > .ant-menu-item-selected{ + border-bottom: 2px solid #4CACFF !important; +} + +.sourceTag a{ + display: block; + float: left; + background-color:#E5F3FF; + padding: 0px 10px; + height: 24px; + line-height: 24px; + color: #4E7A9B; + margin:5px 0px 5px 10px; +} +.sourceTag a.active{ + color: #FFFFFF;background-color:#4CACFF; +} + +.color4CACFF{ + color: #4CACFF !important; } \ No newline at end of file diff --git a/public/react/src/modules/courses/ordering/Ordering.js b/public/react/src/modules/courses/ordering/Ordering.js new file mode 100644 index 000000000..a0d99130f --- /dev/null +++ b/public/react/src/modules/courses/ordering/Ordering.js @@ -0,0 +1,681 @@ +import React,{ Component } from "react"; +import { Input,Checkbox,Table, Pagination, Modal,Menu, Tooltip,Spin } from "antd"; +import { WordsBtn,on, off, trigger } from 'educoder'; +import axios from'axios'; +import Modals from '../../modals/Modals'; +import moment from 'moment'; +import '../css/members.css'; +import '../css/busyWork.css' +import NoneData from "../coursesPublic/NoneData"; +class Ordering 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, + datas:undefined, + page:1, + Coursename:"", + order:"", + shixunmodal:false, + shixunmodallist:undefined, + hometypepvisible:false, + newshixunmodallist:undefined, + category_id:undefined, + homework_ids:undefined, + patheditarry:[], + course_groups:undefined, + course_groupslist:[], + checkedtype:false, + checkBoxValues:[], + isSpin:false, + antIcon:false + } + } + updateNavSuccess=()=>{ + this.setState({ + isSpin:true + }) + if(this.props.match.params.main_id){ + this.setState({ + isSpin:true + }) + this.seactall(); + if(this.props.isAdmin()===true){ + this.updadatalist() + } + + }else if(this.props.match.params.category_id){ + this.setState({ + isSpin:true + }) + this.seactall(parseInt(this.props.match.params.category_id)) + if(this.props.isAdmin()===true){ + this.updadatalist() + } + } + } + componentDidMount() { + this.setState({ + isSpin:true + }) + if(this.props.match.params.main_id){ + this.setState({ + isSpin:true + }) + this.seactall(); + if(this.props.isAdmin()===true){ + this.updadatalist() + } + + }else if(this.props.match.params.category_id){ + this.setState({ + isSpin:true + }) + this.seactall(parseInt(this.props.match.params.category_id)) + if(this.props.isAdmin()===true){ + this.updadatalist() + } + } + on('updateNavSuccess', this.updateNavSuccess) + } + seactall=(id)=>{ + this.setState({ + isSpin:true + }) + let coursesId=this.props.match.params.coursesId; + let url="/courses/"+coursesId+"/homework_commons.json?type=4"; + + axios.get(url,{ + params: { + search:undefined, + page:1, + order:undefined, + category:id + } + }).then((result)=>{ + this.setState({ + isSpin:false, + datas:result.data, + }) + }).catch((error)=>{ + console.log(error); + }) + } + + componentDidUpdate = (prevProps) => { + + if(prevProps.match.params.main_id != this.props.match.params.main_id){ + if(this.props.match.params.main_id!=undefined){ + this.seactall(); + } + } + if(prevProps.match.params.category_id != this.props.match.params.category_id){ + if(this.props.match.params.category_id!=undefined){ + this.seactall(parseInt(this.props.match.params.category_id)) + } + } + + } + + homeworkupdatalist=(search,page,order)=>{ + let {datas}=this.state; + + let coursesId=this.props.match.params.coursesId; + let category_id=this.props.match.params.category_id + let url="/courses/"+coursesId+"/homework_commons.json?type=4"; + let neworder=order; + if(order==="null"){ + neworder="" + } + + axios.get(url, { + params: { + search: search, + page:page, + order:neworder, + category: category_id===undefined?undefined:category_id + } + }).then((result)=>{ + if(result.status===200){ + + this.setState({ + datas:result.data, + isSpin:false + }) + + + } + }).catch((error)=>{ + console.log(error); + }) + } + + homeworkhide=()=>{ + let {Coursename,page,order}=this.state; + 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, + typs:undefined, + starttimes:undefined, + }) + this.props.updataleftNavfun() + this.homeworkupdatalist(Coursename,page,order); + this.cancelmodel() + } + + + //立即发布 + homeworkstart=()=>{ + let selectnum= this.testonSelect(); + if(selectnum===true){ + this.noSelect(); + return + } + let coursesId=this.props.match.params.coursesId; + let url="/courses/"+coursesId+"/all_course_groups.json"; + + axios.get(url).then((response) => { + + if(response.status===200){ + let starttime= this.props.getNowFormatDates(1); + let endtime=this.props.getNowFormatDates(2); + this.setState({ + modalname:"立即发布", + modaltype:response.data.course_groups===null||response.data.course_groups.length===0?2:1, + visible:true, + typs:"start", + Topval:"学生将立即收到作业", + // Botvalleft:"暂不发布", + Botval:`本操作只对"未发布"的分班有效`, + starttime:"发布时间:"+moment(moment(new Date())).format("YYYY-MM-DD HH:mm"), + starttimes:starttime, + endtime:"截止时间:"+endtime, + Cancelname:"暂不发布", + Savesname:"立即发布", + Cancel:this.homeworkhide, + Saves:this.homeworkstartend, + course_groups:response.data.course_groups, + }) + } + }).catch((error) => { + console.log(error) + }); + + } + cancelmodels=()=>{ + this.setState({ + Modalstype:false, + Loadtype:false, + Modalstopval:"" + }) + } + // 立即发布 + homeworkstartend=(ds,endtime)=>{ + let {Coursename,page,order,checkBoxValues,course_groupslist,datas,course_groups}=this.state; + let category_id=this.props.match.params.category_id; + if(course_groups.length>0){ + if(course_groupslist.length===0){ + this.setState({ + Modalstype:true, + Loadtype:true, + Modalstopval:"请先选择分班", + ModalSave:this.cancelmodels, + }) + return + } + + } + + let coursesId=this.props.match.params.coursesId; + let url ="/courses/"+coursesId+"/homework_commons/publish_homework.json"; + axios.post(url,{ + category_id:category_id===undefined?undefined:category_id, + homework_ids:checkBoxValues, + group_ids:course_groupslist, + end_time:endtime, + }).then((result)=>{ + if(result.status===200){ + if(result.data.status===0){ + this.setState({ + Modalstype:false, + // Modalstopval:result.data.message, + Loadtype:false, + visible:false, + course_groups:[], + ModalSave:this.cancelmodel, + }) + } + + this.props.showNotification(result.data.message) + this.props.updataleftNavfun() + this.homeworkupdatalist(Coursename,page,order); + this.cancelmodel() + } + }).catch((error)=>{ + console.log(error); + }) + } + + + homeworkends=()=>{ + + + let selectnum= this.testonSelect(); + if(selectnum===true){ + this.noSelect(); + return + } + + let coursesId=this.props.match.params.coursesId; + let url="/courses/"+coursesId+"/all_course_groups.json"; + + axios.get(url).then((response) => { + + if(response.status===200){ + this.setState({ + + }) + this.setState({ + modalname:"立即截止", + modaltype:response.data.course_groups===null||response.data.course_groups.length===0?2:1, + visible:true, + Topval:"学生将不能再提交作业", + // Botvalleft:"暂不截止", + Botval:`本操作只对"提交中"的分班有效`, + Cancelname:"暂不截止", + Savesname:"立即截止", + Cancel:this.homeworkhide, + Saves:this.coursetaskend, + starttime:undefined, + endtime:undefined, + typs:"end", + course_groups:response.data.course_groups, + }) + } + }).catch((error) => { + console.log(error) + }); + + + } + + getcourse_groupslist=(id)=>{ + this.setState({ + course_groupslist:id + }) + } + + //立即截止确定按钮 + coursetaskend=()=>{ + let {Coursename,page,order,datas,checkBoxValues,course_groupslist,course_groups}=this.state; + this.setState({ + Modalstype:false, + }) + + let category_id=this.props.match.params.category_id; + + if(course_groups.length>0){ + if(course_groupslist.length===0){ + this.setState({ + Modalstype:true, + Loadtype:true, + Modalstopval:"请先选择分班", + ModalSave:this.cancelmodels, + }) + return + } + + } + + const cid = this.props.match.params.coursesId; + let url="/courses/"+cid+"/homework_commons/end_homework.json"; + axios.post(url, { + category_id:category_id===undefined?undefined:category_id, + group_ids:course_groupslist, + homework_ids: checkBoxValues, + }) + .then((response) => { + if (response.data.status == 0) { + this.setState({ + Modalstype:false, + Modalstopval:"", + ModalsBottomval:"", + ModalSave:this.cancelmodel, + Loadtype:false, + course_groups:[] + }) + + this.props.showNotification(response.data.message) + this.props.updataleftNavfun() + this.homeworkupdatalist(Coursename,page,order); + this.cancelmodel() + } + }) + .catch(function (error) { + console.log(error); + }); + } + + //发布实训,立即发布回调 + newhomeworkstart=(category_id,homework_ids)=>{ + + this.setState({ + category_id:category_id, + checkBoxValues:homework_ids, + shixunmodal:false + }) + + let starttime= this.props.getNowFormatDates(1); + let endtime=this.props.getNowFormatDates(2); + let coursesId=this.props.match.params.coursesId; + let url="/courses/"+coursesId+"/all_course_groups.json"; + + axios.get(url).then((response) => { + if(response.status===200){ + + this.setState({ + modalname:"立即发布", + course_groups:response.data.course_groups, + modaltype:response.data.course_groups===null||response.data.course_groups.length===0?2:1, + visible:true, + Topval:"学生将立即收到作业", + // Botvalleft:"暂不发布", + Botval:`本操作只对"未发布"的分班有效`, + starttime:"发布时间:"+ moment(moment(new Date())).format("YYYY-MM-DD HH:mm"), + starttimes:starttime, + typs:"start", + endtime:"截止时间:"+ endtime, + Cancelname:"暂不发布", + Savesname:"立即发布", + Cancel:this.homeworkhide, + Saves:this.homeworkstartend, + }) + + } + }).catch((error) => { + console.log(error) + }); + + } + + + + hidecouseShixunModal=()=>{ + this.setState({ + shixunmodal:false, + shixunpath:false, + shixunpathlist:[], + newshixunpathlist:[], + }) + } + + + + funpatheditarry=(list)=>{ + this.setState({ + patheditarry:list + }) + } + + + onselectfifteen = () => { + this.setState({ + Modalstype:true, + Modalstopval:"选择条数不能大于15条", + ModalSave:this.cancelmodel, + Loadtype:true + }) + } + + onCheckBoxChange=(checkedValues)=>{ + // debugger + let {checkBoxValues,tasks} =this.state; + + console.log(checkBoxValues) + let type=false; + if(checkBoxValues15||checkedValues.length>15){ + this.onselectfifteen() + return + } + this.setState({ + checkBoxValues: checkedValues, + checkAllValue:type + }) + + } + + + savedelete=()=>{ + this.setState({ + antIcon:true + }) + let {Coursename,page,order,checkBoxValues,datas}=this.state; + let category_id=this.props.match.params.category_id; + const cid = this.props.match.params.coursesId + const url = `/courses/`+cid+`/homework_commons/multi_destroy.json`; + axios.post(url, { + category_id:category_id===undefined?undefined:category_id, + homework_ids: checkBoxValues, + }) + .then((response) => { + if (response.data.status === 0) { + + this.setState({ + Modalstype:false, + Modalstopval:"", + ModalsBottomval:"", + ModalSave:this.cancelmodel, + Loadtype:false, + checkBoxValues:[], + checkedtype:false, + antIcon:false + }) + this.props.showNotification(response.data.message) + this.homeworkupdatalist(Coursename,page,order); + this.props.updataleftNavfun() + }else{ + this.setState({ + antIcon:false + }) + this.props.showNotification(response.data.message) + } + }) + .catch(function (error) { + console.log(error); + }); + } + + testonSelect=()=>{ + + let {checkBoxValues,checkedtype}=this.state; + + if(checkedtype===false){ + if(checkBoxValues.length===0){ + return true + } + } + + } + onDelete = () => { + + let selectnum= this.testonSelect(); + if(selectnum===true){ + this.noSelect(); + return + } + + this.setState({ + Modalstype:true, + Modalstopval:"已提交作品将全部被删除,不可恢复", + ModalsBottomval:"是否确认删除?", + ModalCancel:this.cancelmodel, + ModalSave:this.savedelete, + }) + + } + + noSelect=()=>{ + + this.props.showNotification("请选择你要操作的任务"); + + } + + cancelmodel=()=>{ + + this.setState({ + Modalstype:false, + Loadtype:false, + visible:false, + Modalstopval:"", + ModalCancel:"", + ModalSave:"", + checkBoxValues:[], + checkedtype:false + }) + + } + + + updadatalist=(id)=>{ + // this.seactall(id) + let coursesId=this.props.match.params.coursesId; + let url="/courses/"+coursesId+"/homework_commons/choose_category.json"; + axios.get(url, { + }).then((response) => { + if(response!=undefined){ + if(response.data&&response.data){ + this.setState({ + course_modules:response.data, + homework_categorys:response.data.homework_category + }) + } + } + + }) + } + + + render(){ + let { + datas, + page, + Coursename, + Modalstype, + order, + }=this.state; + + let main_id=this.props.match.params.main_id; + let category_id=this.props.match.params.category_id; + + console.log(this.props) + return( + +
+ {/*提示*/} + {Modalstype&&Modalstype===true?:""} + + +
+ +

+ + +

+ +
+ +
+ +
+ + + + {datas===undefined?"": + { datas.homeworks && datas.homeworks.map((item, index) => { + return ( +
+
+ +
+
+ ) + + }) + } +
+ } + + + + { + datas===undefined?"":datas.homeworks && datas.homeworks.length===0? :"" + } + +
+ +
+
+ ) + } +} +export default Ordering; diff --git a/public/react/src/modules/courses/shixunHomework/shixunHomework.js b/public/react/src/modules/courses/shixunHomework/shixunHomework.js index dd694828a..589c881a1 100644 --- a/public/react/src/modules/courses/shixunHomework/shixunHomework.js +++ b/public/react/src/modules/courses/shixunHomework/shixunHomework.js @@ -1,7 +1,7 @@ import React,{ Component } from "react"; import { Input,Checkbox,Table, Pagination, Modal,Menu, Tooltip,Spin } from "antd"; import { WordsBtn,on, off, trigger } from 'educoder'; -import CourseLayoutcomponent from '../common/CourseLayoutComponent'; +import {BrowserRouter as Router,Route,Switch,Link} from 'react-router-dom'; import axios from'axios'; import HomeworkModal from "../coursesPublic/HomeworkModal"; import ShixunModal from "../coursesPublic/ShixunModal"; @@ -1036,6 +1036,13 @@ class ShixunHomework extends Component{ {/*{datas&&datas.category_name===undefined||datas&&datas.category_name===null?datas&&datas.main_category_name:datas&&datas.category_name+" 作业列表"}*/} 实训作业
  • + {this.props.isAdmin()===true?datas&&datas.category_name===undefined||datas&&datas.category_name===null? + + + 调整排序 + + :"":""} + {this.props.isAdmin()===true?datas&&datas.category_name===undefined||datas&&datas.category_name===null? this.addDir()} className={"mr30 font-16"}>添加目录