dev_aliyun_beta
杨树明 5 years ago
parent 6af98b311f
commit e6c8cb285f

@ -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 (
<Switch {...this.props}>
{/*排序*/}
<Route path="/courses/:coursesId/ordering/:orderingtype"
render={
(props) => (<Ordering {...this.props} {...props} {...this.state} />)
}
></Route>
{/*毕设任务题库详情*/}
<Route path="/banks/gtopic_topics/:workid"
render={

@ -1,80 +1,84 @@
.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;}
/* <20><><EFBFBD>ѡ<EFBFBD><D1A1>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;
.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;}
/* <20><><EFBFBD>ѡ<EFBFBD><D1A1>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;
}

@ -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(checkBoxValues<tasks){
type=false
}else if(checkBoxValues<tasks){
type=true
}
if(checkBoxValues.length>15||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(
<React.Fragment >
<div>
{/*提示*/}
{Modalstype&&Modalstype===true?<Modals
modalsType={this.state.Modalstype}
modalsTopval={this.state.Modalstopval}
modalCancel={this.state.ModalCancel}
modalSave={this.state.ModalSave}
modalsBottomval={this.state.ModalsBottomval}
loadtype={this.state.Loadtype}
antIcon={this.state.antIcon}
/>:""}
<div className="edu-back-white">
<p className="clearfix padding30 bor-bottom-greyE">
</p>
<div className="clearfix pl30 pr30">
</div>
</div>
<Spin size="large" spinning={this.state.isSpin}>
<style>{`
.padding02010{
padding: 10px 30px 0px 30px;
cursor: pointer;
}
.ant-checkbox-group > div .boardsList {
border-top: 1px solid transparent;
padding: 10px 0px 20px!important;
}
.padding02010:hover{
box-shadow: 0px 2px 6px rgba(51,51,51,0.09);
opacity: 1;
border-radius: 2px;
}
`}</style>
{datas===undefined?"": <Checkbox.Group style={{ width: '100%' }} onChange={this.onCheckBoxChange} value={this.state.checkBoxValues}>
{ datas.homeworks && datas.homeworks.map((item, index) => {
return (
<div className="mt20 edu-back-white padding02010" key={index} >
<div className="clearfix">
</div>
</div>
)
})
}
</Checkbox.Group>
}
{
datas===undefined?"":datas.homeworks && datas.homeworks.length===0? <NoneData></NoneData>:""
}
</Spin>
</div>
</React.Fragment>
)
}
}
export default Ordering;

@ -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{
{/*<span className="font-18 fl color-dark-21">{datas&&datas.category_name===undefined||datas&&datas.category_name===null?datas&&datas.main_category_name:datas&&datas.category_name+" 作业列表"}</span>*/}
<span className="font-18 fl color-dark-21">实训作业</span>
<li className="fr">
{this.props.isAdmin()===true?datas&&datas.category_name===undefined||datas&&datas.category_name===null?
<span>
<WordsBtn style="blue" className={"mr30 font-16"}>
<Link className="color4CACFF" to={`/courses/${this.props.match.params.coursesId}/ordering/shixun_homework`}>调整排序</Link>
</WordsBtn>
</span>:"":""}
{this.props.isAdmin()===true?datas&&datas.category_name===undefined||datas&&datas.category_name===null?
<span>
<WordsBtn style="blue" onClick={()=>this.addDir()} className={"mr30 font-16"}>添加目录</WordsBtn>

Loading…
Cancel
Save