|
|
@ -1,6 +1,7 @@
|
|
|
|
import React,{Component} from 'react';
|
|
|
|
import React,{Component} from 'react';
|
|
|
|
import { Modal,Checkbox,Select,Input,Tooltip,Spin,Icon,Drawer,Dropdown,Menu,Breadcrumb,Pagination,Button} from "antd";
|
|
|
|
import { Modal,Checkbox,Select,Input,Tooltip,Spin,Icon,Drawer,Dropdown,Menu,Breadcrumb,Pagination,Button,notification} from "antd";
|
|
|
|
import axios from'axios';
|
|
|
|
import axios from'axios';
|
|
|
|
|
|
|
|
import NoneData from "../coursesPublic/NoneData";
|
|
|
|
import './Newshixunmodel.css';
|
|
|
|
import './Newshixunmodel.css';
|
|
|
|
const Search = Input.Search;
|
|
|
|
const Search = Input.Search;
|
|
|
|
class NewShixunModel extends Component{
|
|
|
|
class NewShixunModel extends Component{
|
|
|
@ -10,6 +11,7 @@ class NewShixunModel extends Component{
|
|
|
|
shixun_list:undefined,
|
|
|
|
shixun_list:undefined,
|
|
|
|
shixuns_count:undefined,
|
|
|
|
shixuns_count:undefined,
|
|
|
|
Grouplist:[],
|
|
|
|
Grouplist:[],
|
|
|
|
|
|
|
|
allGrouplist:[{page:1,list:[]}],
|
|
|
|
page:1,
|
|
|
|
page:1,
|
|
|
|
type:'all',
|
|
|
|
type:'all',
|
|
|
|
status:'all',
|
|
|
|
status:'all',
|
|
|
@ -20,11 +22,18 @@ class NewShixunModel extends Component{
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
componentDidMount() {
|
|
|
|
componentDidMount() {
|
|
|
|
let{page,type,status,search,order,diff,limit}=this.state;
|
|
|
|
let{page,type,search,order,diff,limit}=this.state;
|
|
|
|
|
|
|
|
let status=this.props.statustype===undefined?'all':'published';
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
|
|
|
|
status:status
|
|
|
|
|
|
|
|
})
|
|
|
|
this.getdatalist(page,type,status,search,order,diff,limit)
|
|
|
|
this.getdatalist(page,type,status,search,order,diff,limit)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
getdatalist=(page,type,status,search,order,diff,limit)=>{
|
|
|
|
getdatalist=(page,type,status,search,order,diff,limit)=>{
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
|
|
|
|
isspinning:true
|
|
|
|
|
|
|
|
})
|
|
|
|
let url="/shixuns/shixun_list.json"
|
|
|
|
let url="/shixuns/shixun_list.json"
|
|
|
|
axios.get(url,{params:{
|
|
|
|
axios.get(url,{params:{
|
|
|
|
page,
|
|
|
|
page,
|
|
|
@ -39,9 +48,13 @@ class NewShixunModel extends Component{
|
|
|
|
this.setState({
|
|
|
|
this.setState({
|
|
|
|
shixun_list:response.data.shixun_list,
|
|
|
|
shixun_list:response.data.shixun_list,
|
|
|
|
shixuns_count:response.data.shixuns_count,
|
|
|
|
shixuns_count:response.data.shixuns_count,
|
|
|
|
|
|
|
|
isspinning:false
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}).catch((error) => {
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
|
|
|
|
isspinning:false
|
|
|
|
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -66,17 +79,54 @@ class NewShixunModel extends Component{
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
getGrouplist=(Grouplist)=>{
|
|
|
|
getGrouplist=(Grouplist)=>{
|
|
|
|
|
|
|
|
let {page,allGrouplist}=this.state;
|
|
|
|
|
|
|
|
let newallGrouplist=allGrouplist;
|
|
|
|
|
|
|
|
var a=newallGrouplist.find((value,index,arr)=>{
|
|
|
|
|
|
|
|
return value.page==page
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(a!=undefined){
|
|
|
|
|
|
|
|
newallGrouplist.map((item,key)=>{
|
|
|
|
|
|
|
|
if(item.page===page){
|
|
|
|
|
|
|
|
item.list=Grouplist
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let newGrouplist=[];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
newallGrouplist.map((item,key)=>{
|
|
|
|
|
|
|
|
item.list.map((items,ke)=>{
|
|
|
|
|
|
|
|
newGrouplist.push(items)
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
this.setState({
|
|
|
|
Grouplist: Grouplist,
|
|
|
|
Grouplist: newGrouplist,
|
|
|
|
|
|
|
|
allGrouplist:newallGrouplist
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
PaginationCourse=(pageNumber)=>{
|
|
|
|
PaginationCourse=(pageNumber)=>{
|
|
|
|
this.setState({
|
|
|
|
let {allGrouplist}=this.state;
|
|
|
|
page:pageNumber
|
|
|
|
let newallGrouplist=allGrouplist;
|
|
|
|
})
|
|
|
|
var v=newallGrouplist.find((value,index,arr)=>{
|
|
|
|
|
|
|
|
return value.page==pageNumber
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(v===undefined){
|
|
|
|
|
|
|
|
newallGrouplist.push({page:pageNumber,list:[]})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
let{type,status,search,order,diff,limit}=this.state;
|
|
|
|
let{type,status,search,order,diff,limit}=this.state;
|
|
|
|
this.getdatalist(pageNumber,type,status,search,order,diff,limit)
|
|
|
|
this.getdatalist(pageNumber,type,status,search,order,diff,limit)
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
|
|
|
|
page:pageNumber,
|
|
|
|
|
|
|
|
allGrouplist:newallGrouplist
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
belongto=(value)=>{
|
|
|
|
belongto=(value)=>{
|
|
|
@ -117,7 +167,16 @@ class NewShixunModel extends Component{
|
|
|
|
let{type,page,status,diff,order,limit}=this.state;
|
|
|
|
let{type,page,status,diff,order,limit}=this.state;
|
|
|
|
this.getdatalist(page,type,status,value,order,diff,limit)
|
|
|
|
this.getdatalist(page,type,status,value,order,diff,limit)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
showNotification = (description, message = "提示", icon) => {
|
|
|
|
|
|
|
|
const data = {
|
|
|
|
|
|
|
|
message,
|
|
|
|
|
|
|
|
description
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (icon) {
|
|
|
|
|
|
|
|
data.icon = icon;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
notification.open(data);
|
|
|
|
|
|
|
|
}
|
|
|
|
savecouseShixunModal=()=>{
|
|
|
|
savecouseShixunModal=()=>{
|
|
|
|
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
this.setState({
|
|
|
@ -129,11 +188,32 @@ class NewShixunModel extends Component{
|
|
|
|
this.setState({
|
|
|
|
this.setState({
|
|
|
|
hometypepvisible:false
|
|
|
|
hometypepvisible:false
|
|
|
|
})
|
|
|
|
})
|
|
|
|
this.props.showNotification("请先选择实训")
|
|
|
|
this.showNotification("请先选择实训")
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (this.props.chooseShixun) {
|
|
|
|
|
|
|
|
if(Grouplist.length>1){
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
|
|
|
|
hometypepvisible:false
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
this.showNotification("试卷选择的实训数不能大于1")
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
this.props.chooseShixun(Grouplist)
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
|
|
|
|
hometypepvisible:false
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (this.props.pathShixun) {
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
|
|
|
|
hometypepvisible:false
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
this.props.pathShixun(Grouplist)
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
let url="/courses/"+coursesId+"/homework_commons/create_shixun_homework.json";
|
|
|
|
let url="/courses/"+coursesId+"/homework_commons/create_shixun_homework.json";
|
|
|
|
axios.post(url, {
|
|
|
|
axios.post(url, {
|
|
|
|
category_id:this.props.category_id===null||this.props.category_id===undefined?undefined:parseInt(this.props.category_id),
|
|
|
|
category_id:this.props.category_id===null||this.props.category_id===undefined?undefined:parseInt(this.props.category_id),
|
|
|
@ -145,7 +225,7 @@ class NewShixunModel extends Component{
|
|
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
}else{
|
|
|
|
// this.props.courseshomeworkstart(response.data.category_id,response.data.homework_ids)
|
|
|
|
// this.props.courseshomeworkstart(response.data.category_id,response.data.homework_ids)
|
|
|
|
this.props.showNotification("选择成功")
|
|
|
|
this.showNotification("操作成功")
|
|
|
|
this.props.homeworkupdatalists(this.props.Coursename,this.props.page,this.props.order);
|
|
|
|
this.props.homeworkupdatalists(this.props.Coursename,this.props.page,this.props.order);
|
|
|
|
this.props.hideNewShixunModelType()
|
|
|
|
this.props.hideNewShixunModelType()
|
|
|
|
|
|
|
|
|
|
|
@ -157,14 +237,48 @@ class NewShixunModel extends Component{
|
|
|
|
// homework_ids: (5) [9171, 9172, 9173, 9174, 9175]
|
|
|
|
// homework_ids: (5) [9171, 9172, 9173, 9174, 9175]
|
|
|
|
}).catch((error) => {
|
|
|
|
}).catch((error) => {
|
|
|
|
console.log(error)
|
|
|
|
console.log(error)
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
|
|
|
|
hometypepvisible:false
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
poststatus=(status)=>{
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
|
|
|
|
status:status
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
let{page,type,search,order,diff,limit}=this.state;
|
|
|
|
|
|
|
|
this.getdatalist(page,type,status,search,order,diff,limit)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
render() {
|
|
|
|
render() {
|
|
|
|
|
|
|
|
|
|
|
|
let {diff,Grouplist,shixun_list,shixuns_count,page,type,order}=this.state;
|
|
|
|
let {diff,Grouplist,status,shixun_list,shixuns_count,page,type,order}=this.state;
|
|
|
|
// let {visible,patheditarry}=this.props;
|
|
|
|
// let {visible,patheditarry}=this.props;
|
|
|
|
|
|
|
|
// console.log(Grouplist)
|
|
|
|
|
|
|
|
// console.log(allGrouplist)
|
|
|
|
|
|
|
|
const statusmenus=(
|
|
|
|
|
|
|
|
<Menu className="menus">
|
|
|
|
|
|
|
|
<Menu.Item>
|
|
|
|
|
|
|
|
<a className={status==="all"?"color-blue":""} onClick={()=>this.poststatus("all")}>
|
|
|
|
|
|
|
|
所有
|
|
|
|
|
|
|
|
</a>
|
|
|
|
|
|
|
|
</Menu.Item>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<Menu.Item >
|
|
|
|
|
|
|
|
<a className={status==="published"?"color-blue":""} onClick={()=>this.poststatus("published")} >
|
|
|
|
|
|
|
|
已发布
|
|
|
|
|
|
|
|
</a>
|
|
|
|
|
|
|
|
</Menu.Item>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<Menu.Item>
|
|
|
|
|
|
|
|
<a className={status==="unpublished"?"color-blue":""} onClick={()=>this.poststatus("unpublished")}>
|
|
|
|
|
|
|
|
未发布
|
|
|
|
|
|
|
|
</a>
|
|
|
|
|
|
|
|
</Menu.Item>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</Menu>
|
|
|
|
|
|
|
|
);
|
|
|
|
const menus = (
|
|
|
|
const menus = (
|
|
|
|
<Menu className="menus">
|
|
|
|
<Menu className="menus">
|
|
|
|
<Menu.Item>
|
|
|
|
<Menu.Item>
|
|
|
@ -202,6 +316,7 @@ class NewShixunModel extends Component{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return(
|
|
|
|
return(
|
|
|
|
|
|
|
|
|
|
|
|
<div>
|
|
|
|
<div>
|
|
|
|
<style>
|
|
|
|
<style>
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -219,6 +334,7 @@ class NewShixunModel extends Component{
|
|
|
|
visible={this.props.NewShixunModelType}
|
|
|
|
visible={this.props.NewShixunModelType}
|
|
|
|
height={'100%'}
|
|
|
|
height={'100%'}
|
|
|
|
>
|
|
|
|
>
|
|
|
|
|
|
|
|
<Spin spinning={this.state.isspinning}>
|
|
|
|
<div className={"clearfix educontent pr"}>
|
|
|
|
<div className={"clearfix educontent pr"}>
|
|
|
|
|
|
|
|
|
|
|
|
<div className={"square-list clearfix"}>
|
|
|
|
<div className={"square-list clearfix"}>
|
|
|
@ -237,7 +353,7 @@ class NewShixunModel extends Component{
|
|
|
|
|
|
|
|
|
|
|
|
<div className="clearfix font-12 mt30">
|
|
|
|
<div className="clearfix font-12 mt30">
|
|
|
|
|
|
|
|
|
|
|
|
<p className="font-12 ml5 fl">
|
|
|
|
<div className="font-12 ml5 fl">
|
|
|
|
|
|
|
|
|
|
|
|
<span className="fl color-grey-9 mr20">已选 <span className={"color-blue"}>{Grouplist.length}</span> 个实训</span>
|
|
|
|
<span className="fl color-grey-9 mr20">已选 <span className={"color-blue"}>{Grouplist.length}</span> 个实训</span>
|
|
|
|
<span className="fl color-grey-9 mr20">共 <span className={"color-blue"}>{shixuns_count===undefined?"":shixuns_count}</span> 个实训</span>
|
|
|
|
<span className="fl color-grey-9 mr20">共 <span className={"color-blue"}>{shixuns_count===undefined?"":shixuns_count}</span> 个实训</span>
|
|
|
@ -250,22 +366,28 @@ class NewShixunModel extends Component{
|
|
|
|
</sapn>
|
|
|
|
</sapn>
|
|
|
|
</span>
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{this.props.statustype===undefined?<Dropdown overlay={statusmenus}>
|
|
|
|
|
|
|
|
<a className="ant-dropdown-link color-grey-6 mr20">
|
|
|
|
|
|
|
|
{status==='all'?"发布状态":status==='published'?"已发布":status==="unpublished"?"未发布":""}<Icon type="down" className={"color-grey-6"}/>
|
|
|
|
|
|
|
|
</a>
|
|
|
|
|
|
|
|
</Dropdown>:""}
|
|
|
|
|
|
|
|
|
|
|
|
<Dropdown overlay={menus}>
|
|
|
|
<Dropdown overlay={menus}>
|
|
|
|
<a className="ant-dropdown-link color-grey-6">
|
|
|
|
<a className="ant-dropdown-link color-grey-6">
|
|
|
|
{diff===0?"所有":diff===1?"初级":diff===2?"中级":diff===3?"高级":diff===4?"顶级":""}<Icon type="down" className={"color-grey-6"}/>
|
|
|
|
{diff===0?"难度":diff===1?"初级":diff===2?"中级":diff===3?"高级":diff===4?"顶级":""}<Icon type="down" className={"color-grey-6"}/>
|
|
|
|
</a>
|
|
|
|
</a>
|
|
|
|
</Dropdown>
|
|
|
|
</Dropdown>
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<p className="font-12 alltopiscright ml25 fr">
|
|
|
|
<div className="font-12 alltopiscright ml25 fr">
|
|
|
|
<span className={"fr topcsactive pointer color-grey-3"} onClick={()=>this.props.hideNewShixunModelType()}>返回</span>
|
|
|
|
<span className={"fr topcsactive pointer color-grey-3"} onClick={()=>this.props.hideNewShixunModelType()}>返回</span>
|
|
|
|
<span className={type==="mine"?"fr mr30 topcsactive pointer color-grey-3 color-blue":"fr mr30 topcsactive pointer color-grey-3"} onClick={()=>this.belongto("mine")}>我的实训</span>
|
|
|
|
<span className={type==="mine"?"fr mr30 topcsactive pointer color-grey-3 color-blue":"fr mr30 topcsactive pointer color-grey-3"} onClick={()=>this.belongto("mine")}>我的实训</span>
|
|
|
|
<span className={type==="all"?"fr mr30 topcsactive pointer color-grey-3 color-blue":"fr mr30 topcsactive pointer color-grey-3"} onClick={()=>this.belongto("all")}>全部实训</span>
|
|
|
|
<span className={type==="all"?"fr mr30 topcsactive pointer color-grey-3 color-blue":"fr mr30 topcsactive pointer color-grey-3"} onClick={()=>this.belongto("all")}>全部实训</span>
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<Checkbox.Group onChange={this.getGrouplist} value={Grouplist}>
|
|
|
|
<Checkbox.Group onChange={this.getGrouplist} value={Grouplist} >
|
|
|
|
|
|
|
|
|
|
|
|
{shixun_list===undefined?"":shixun_list.length===0?"":shixun_list.map((item,key)=>{
|
|
|
|
{shixun_list===undefined?"":shixun_list.length===0?"":shixun_list.map((item,key)=>{
|
|
|
|
|
|
|
|
|
|
|
@ -350,16 +472,23 @@ class NewShixunModel extends Component{
|
|
|
|
onChange={this.PaginationCourse}
|
|
|
|
onChange={this.PaginationCourse}
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
</div>:""}
|
|
|
|
</div>:""}
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
shixun_list===undefined?
|
|
|
|
|
|
|
|
<div className={"minhegiht300"}>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
:shixun_list.length===0? <NoneData></NoneData>:""
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
<div className={" edu-txt-center padding20-30"}>
|
|
|
|
<div className={" edu-txt-center padding20-30"}>
|
|
|
|
<Button className={"mr20 newshixunmode"} onClick={()=>this.props.hideNewShixunModelType()}>取消</Button>
|
|
|
|
<Button className={"mr20 newshixunmode"} onClick={()=>this.props.hideNewShixunModelType()}>取消</Button>
|
|
|
|
<Button className={"newshixunmode"} type="primary" onClick={()=>this.savecouseShixunModal()}>确定</Button>
|
|
|
|
<Button className={"newshixunmode"} type="primary" onClick={()=>this.savecouseShixunModal()} loading={this.state.hometypepvisible}>确定</Button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</Spin>
|
|
|
|
</Drawer>
|
|
|
|
</Drawer>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|