|
|
|
@ -19,19 +19,30 @@ class NewShixunModel extends Component{
|
|
|
|
|
order:'desc',
|
|
|
|
|
diff:0,
|
|
|
|
|
limit:15,
|
|
|
|
|
sort:"myshixuns_count"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
componentDidMount() {
|
|
|
|
|
let{page,type,keyword,order,diff,limit,status}=this.state;
|
|
|
|
|
this.getdatalist(page,type,status,keyword,order,diff,limit)
|
|
|
|
|
let{page,type,keyword,order,diff,limit,status,sort}=this.state;
|
|
|
|
|
if(this.props.type==='shixuns'){
|
|
|
|
|
this.getdatalist(page,type,status,keyword,order,diff,limit)
|
|
|
|
|
}else{
|
|
|
|
|
this.getdatalist(page,type,undefined,keyword,order,undefined,limit,undefined,sort);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getdatalist=(page,type,newstatus,keyword,order,diff,limit,pagetype)=>{
|
|
|
|
|
getdatalist=(page,type,newstatus,keyword,order,diff,limit,pagetype,sort)=>{
|
|
|
|
|
this.setState({
|
|
|
|
|
isspinning:true
|
|
|
|
|
})
|
|
|
|
|
let status=this.props.statustype===undefined?newstatus:'published';
|
|
|
|
|
let url="/shixun_lists.json"
|
|
|
|
|
let url;
|
|
|
|
|
if(this.props.type==='shixuns'){
|
|
|
|
|
url="/shixun_lists.json";
|
|
|
|
|
}else{
|
|
|
|
|
url="/subject_lists.json";
|
|
|
|
|
}
|
|
|
|
|
axios.get(url,{params:{
|
|
|
|
|
page,
|
|
|
|
|
type,
|
|
|
|
@ -39,20 +50,21 @@ class NewShixunModel extends Component{
|
|
|
|
|
keyword,
|
|
|
|
|
order,
|
|
|
|
|
diff,
|
|
|
|
|
limit
|
|
|
|
|
limit,
|
|
|
|
|
sort
|
|
|
|
|
}}).then((response) => {
|
|
|
|
|
if(response.data){
|
|
|
|
|
if(pagetype===undefined){
|
|
|
|
|
this.setState({
|
|
|
|
|
shixun_list:response.data.shixun_list,
|
|
|
|
|
shixuns_count:response.data.shixuns_count,
|
|
|
|
|
shixun_list:response.data.shixun_list===undefined?response.data.subject_list:response.data.shixun_list,
|
|
|
|
|
shixuns_count:response.data.shixuns_count===undefined?response.data.subjects_count:response.data.shixuns_count,
|
|
|
|
|
Grouplist:[],
|
|
|
|
|
isspinning:false
|
|
|
|
|
})
|
|
|
|
|
}else if(pagetype==="pagetype"){
|
|
|
|
|
this.setState({
|
|
|
|
|
shixun_list:response.data.shixun_list,
|
|
|
|
|
shixuns_count:response.data.shixuns_count,
|
|
|
|
|
shixun_list:response.data.shixun_list===undefined?response.data.subject_list:response.data.shixun_list,
|
|
|
|
|
shixuns_count:response.data.shixuns_count===undefined?response.data.subjects_count:response.data.shixuns_count,
|
|
|
|
|
isspinning:false
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
@ -127,8 +139,13 @@ class NewShixunModel extends Component{
|
|
|
|
|
newallGrouplist.push({page:pageNumber,list:[]})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let{type,status,keyword,order,diff,limit}=this.state;
|
|
|
|
|
this.getdatalist(pageNumber,type,status,keyword,order,diff,limit,"pagetype")
|
|
|
|
|
let{type,status,keyword,order,diff,limit,sort}=this.state;
|
|
|
|
|
if(this.props.type==='shixuns'){
|
|
|
|
|
this.getdatalist(pageNumber,type,status,keyword,order,diff,limit,"pagetype")
|
|
|
|
|
}else{
|
|
|
|
|
this.getdatalist(pageNumber,type,undefined,keyword,order,undefined,limit,"pagetype",sort);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
|
page:pageNumber,
|
|
|
|
|
allGrouplist:newallGrouplist
|
|
|
|
@ -142,8 +159,14 @@ class NewShixunModel extends Component{
|
|
|
|
|
keyword:undefined,
|
|
|
|
|
page:1
|
|
|
|
|
})
|
|
|
|
|
let{status,order,diff,limit}=this.state;
|
|
|
|
|
this.getdatalist(1,value,status,undefined,order,diff,limit)
|
|
|
|
|
let{status,order,diff,limit,sort}=this.state;
|
|
|
|
|
if(this.props.type==='shixuns'){
|
|
|
|
|
this.getdatalist(1,value,status,undefined,order,diff,limit)
|
|
|
|
|
}else{
|
|
|
|
|
this.getdatalist(1,value,undefined,undefined,order,undefined,limit,undefined,sort)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
updatedlist=(order)=>{
|
|
|
|
@ -205,7 +228,7 @@ class NewShixunModel extends Component{
|
|
|
|
|
this.setState({
|
|
|
|
|
hometypepvisible:false
|
|
|
|
|
})
|
|
|
|
|
this.showNotification("请先选择实训")
|
|
|
|
|
this.showNotification(this.props.type==='shixuns'?"请先选择实训":"请先选择课程")
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -231,33 +254,64 @@ class NewShixunModel extends Component{
|
|
|
|
|
this.props.pathShixun(Grouplist)
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
let url="/courses/"+coursesId+"/homework_commons/create_shixun_homework.json";
|
|
|
|
|
axios.post(url, {
|
|
|
|
|
category_id:this.props.category_id===null||this.props.category_id===undefined?undefined:parseInt(this.props.category_id),
|
|
|
|
|
shixun_ids:Grouplist,
|
|
|
|
|
}
|
|
|
|
|
).then((response) => {
|
|
|
|
|
if(response.data.status===-1){
|
|
|
|
|
// this.props.showNotification(response.data.message)
|
|
|
|
|
if(this.props.type==='shixuns'){
|
|
|
|
|
let url="/courses/"+coursesId+"/homework_commons/create_shixun_homework.json";
|
|
|
|
|
axios.post(url, {
|
|
|
|
|
category_id:this.props.category_id===null||this.props.category_id===undefined?undefined:parseInt(this.props.category_id),
|
|
|
|
|
shixun_ids:Grouplist,
|
|
|
|
|
}
|
|
|
|
|
).then((response) => {
|
|
|
|
|
if(response.data.status===-1){
|
|
|
|
|
// this.props.showNotification(response.data.message)
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
// this.props.courseshomeworkstart(response.data.category_id,response.data.homework_ids)
|
|
|
|
|
this.showNotification("操作成功")
|
|
|
|
|
this.props.homeworkupdatalists(this.props.Coursename,this.props.page,this.props.order);
|
|
|
|
|
this.props.hideNewShixunModelType()
|
|
|
|
|
}else{
|
|
|
|
|
// this.props.courseshomeworkstart(response.data.category_id,response.data.homework_ids)
|
|
|
|
|
this.showNotification("操作成功")
|
|
|
|
|
this.props.homeworkupdatalists(this.props.Coursename,this.props.page,this.props.order);
|
|
|
|
|
this.props.hideNewShixunModelType()
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
this.setState({
|
|
|
|
|
hometypepvisible:false
|
|
|
|
|
}
|
|
|
|
|
this.setState({
|
|
|
|
|
hometypepvisible:false
|
|
|
|
|
})
|
|
|
|
|
// category_id: 3
|
|
|
|
|
// homework_ids: (5) [9171, 9172, 9173, 9174, 9175]
|
|
|
|
|
}).catch((error) => {
|
|
|
|
|
console.log(error)
|
|
|
|
|
this.setState({
|
|
|
|
|
hometypepvisible:false
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
// category_id: 3
|
|
|
|
|
// homework_ids: (5) [9171, 9172, 9173, 9174, 9175]
|
|
|
|
|
}).catch((error) => {
|
|
|
|
|
console.log(error)
|
|
|
|
|
this.setState({
|
|
|
|
|
hometypepvisible:false
|
|
|
|
|
}else{
|
|
|
|
|
let url="/courses/"+coursesId+"/homework_commons/create_subject_homework.json";
|
|
|
|
|
axios.post(url, {
|
|
|
|
|
category_id:this.props.category_id===null||this.props.category_id===undefined?undefined:parseInt(this.props.category_id),
|
|
|
|
|
subject_ids:Grouplist,
|
|
|
|
|
}
|
|
|
|
|
).then((response) => {
|
|
|
|
|
if(response.data.status===-1){
|
|
|
|
|
// this.props.showNotification(response.data.message)
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
// this.props.courseshomeworkstart(response.data.category_id,response.data.homework_ids)
|
|
|
|
|
this.showNotification("操作成功")
|
|
|
|
|
this.props.homeworkupdatalists(this.props.Coursename,this.props.page,this.props.order);
|
|
|
|
|
this.props.hideNewShixunModelType()
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
this.setState({
|
|
|
|
|
hometypepvisible:false
|
|
|
|
|
})
|
|
|
|
|
// category_id: 3
|
|
|
|
|
// homework_ids: (5) [9171, 9172, 9173, 9174, 9175]
|
|
|
|
|
}).catch((error) => {
|
|
|
|
|
console.log(error)
|
|
|
|
|
this.setState({
|
|
|
|
|
hometypepvisible:false
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
poststatus=(status)=>{
|
|
|
|
@ -268,9 +322,37 @@ class NewShixunModel extends Component{
|
|
|
|
|
this.getdatalist(page,type,status,keyword,order,diff,limit)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
updatepathlist=(sorts,orders)=>{
|
|
|
|
|
let{page,type,keyword,order,diff,limit,status,sort}=this.state;
|
|
|
|
|
let seartorders;
|
|
|
|
|
if(sort===sorts){
|
|
|
|
|
if(orders==="desc"){
|
|
|
|
|
this.setState({
|
|
|
|
|
sort:sorts,
|
|
|
|
|
order:"asc"
|
|
|
|
|
})
|
|
|
|
|
seartorders="asc"
|
|
|
|
|
}else{
|
|
|
|
|
this.setState({
|
|
|
|
|
sort:sorts,
|
|
|
|
|
order:"desc"
|
|
|
|
|
})
|
|
|
|
|
seartorders="desc"
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
this.setState({
|
|
|
|
|
sort:sorts,
|
|
|
|
|
order:"desc"
|
|
|
|
|
})
|
|
|
|
|
seartorders=orders
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.getdatalist(page,type,undefined,keyword,seartorders,undefined,limit,undefined,sorts)
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
render() {
|
|
|
|
|
|
|
|
|
|
let {diff,Grouplist,status,shixun_list,shixuns_count,page,type,order}=this.state;
|
|
|
|
|
let {diff,Grouplist,status,shixun_list,shixuns_count,page,type,order,sort}=this.state;
|
|
|
|
|
// let {visible,patheditarry}=this.props;
|
|
|
|
|
// console.log(Grouplist)
|
|
|
|
|
// console.log(allGrouplist)
|
|
|
|
@ -331,7 +413,7 @@ class NewShixunModel extends Component{
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
console.log(shixun_list)
|
|
|
|
|
return(
|
|
|
|
|
|
|
|
|
|
<div>
|
|
|
|
@ -355,7 +437,7 @@ class NewShixunModel extends Component{
|
|
|
|
|
closable={true}
|
|
|
|
|
destroyOnClose={true}
|
|
|
|
|
onClose={()=>this.props.hideNewShixunModelType()}
|
|
|
|
|
visible={this.props.NewShixunModelType}
|
|
|
|
|
visible={this.props.type==='shixuns'?this.props.NewShixunModelType:this.props.shixunpath}
|
|
|
|
|
height={'100%'}
|
|
|
|
|
>
|
|
|
|
|
<Spin spinning={this.state.isspinning}>
|
|
|
|
@ -380,7 +462,7 @@ class NewShixunModel extends Component{
|
|
|
|
|
<Search
|
|
|
|
|
style={{ width: "780px"}}
|
|
|
|
|
className="packinput"
|
|
|
|
|
placeholder="实训信息 / 院校名称 / 创建者"
|
|
|
|
|
placeholder={this.props.type==='shixuns'?"实训信息 / 院校名称 / 创建者":"课程名称 / 院校名称 / 创建者"}
|
|
|
|
|
value={this.state.keyword}
|
|
|
|
|
enterButton={<span>搜索</span>}
|
|
|
|
|
onInput={(e)=>this.setdatafunsval(e)}
|
|
|
|
@ -391,34 +473,50 @@ class NewShixunModel extends Component{
|
|
|
|
|
|
|
|
|
|
<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"}>{shixuns_count===undefined?"":shixuns_count}</span> 个实训</span>
|
|
|
|
|
<span className="fl color-grey-9 mr20">已选 <span className={"color-blue"}>{Grouplist.length}</span> 个{this.props.type==='shixuns'?'实训':'课程'}</span>
|
|
|
|
|
<span className="fl color-grey-9 mr20">共 <span className={"color-blue"}>{shixuns_count===undefined?"":shixuns_count}</span> 个{this.props.type==='shixuns'?'实训':'课程'}</span>
|
|
|
|
|
|
|
|
|
|
<span className="fl color-grey-9 pointer mr30">
|
|
|
|
|
{this.props.type==='shixuns'?"":<span className="fl color-grey-9 pointer mr30">
|
|
|
|
|
<a className={" color-grey-6"} onClick={()=>this.updatepathlist("shixuns_count",order)}>实训数</a>
|
|
|
|
|
<sapn className="relativef ml5 " >
|
|
|
|
|
<i className={order==="asc"&&sort==="shixuns_count"?"iconfont icon-sanjiaoxing-up font-12 ntopsj color-grey-9 color-blue":"iconfont icon-sanjiaoxing-up font-12 ntopsj color-grey-9"}></i>
|
|
|
|
|
<i className={order==="desc"&&sort==="shixuns_count"?"iconfont icon-sanjiaoxing-down font-12 nyslbottomsj color-grey-9 color-blue":"iconfont icon-sanjiaoxing-down font-12 nyslbottomsj color-grey-9"}></i>
|
|
|
|
|
</sapn>
|
|
|
|
|
</span>}
|
|
|
|
|
|
|
|
|
|
{this.props.type==='shixuns'?"":<span className="fl color-grey-9 pointer mr30">
|
|
|
|
|
<a className={" color-grey-6"} onClick={()=>this.updatepathlist("myshixuns_count",order)}>使用人数</a>
|
|
|
|
|
<sapn className="relativef ml5 " >
|
|
|
|
|
<i className={order==="asc"&&sort==="myshixuns_count"?"iconfont icon-sanjiaoxing-up font-12 ntopsj color-grey-9 color-blue":"iconfont icon-sanjiaoxing-up font-12 ntopsj color-grey-9"}></i>
|
|
|
|
|
<i className={order==="desc"&&sort==="myshixuns_count"?"iconfont icon-sanjiaoxing-down font-12 nyslbottomsj color-grey-9 color-blue":"iconfont icon-sanjiaoxing-down font-12 nyslbottomsj color-grey-9"}></i>
|
|
|
|
|
</sapn>
|
|
|
|
|
</span>}
|
|
|
|
|
|
|
|
|
|
{this.props.type==='shixuns'?<span className="fl color-grey-9 pointer mr30">
|
|
|
|
|
<a className={" color-grey-6"} onClick={()=>this.updatedlist(order)}>学习人数</a>
|
|
|
|
|
<sapn className="relativef ml5 " >
|
|
|
|
|
<i className={order==="asc"?"iconfont icon-sanjiaoxing-up font-12 ntopsj color-grey-9 color-blue":"iconfont icon-sanjiaoxing-up font-12 ntopsj color-grey-9"}></i>
|
|
|
|
|
<i className={order==="desc"?"iconfont icon-sanjiaoxing-down font-12 nyslbottomsj color-grey-9 color-blue":"iconfont icon-sanjiaoxing-down font-12 nyslbottomsj color-grey-9"}></i>
|
|
|
|
|
</sapn>
|
|
|
|
|
</span>
|
|
|
|
|
</span>:""}
|
|
|
|
|
|
|
|
|
|
{this.props.statustype===undefined?<Dropdown overlay={statusmenus}>
|
|
|
|
|
{this.props.type==='shixuns'?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>:"":""}
|
|
|
|
|
|
|
|
|
|
<Dropdown overlay={menus}>
|
|
|
|
|
{this.props.type==='shixuns'? <Dropdown overlay={menus}>
|
|
|
|
|
<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"}/>
|
|
|
|
|
</a>
|
|
|
|
|
</Dropdown>
|
|
|
|
|
</Dropdown>:""}
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div className="font-12 alltopiscright ml25 fr">
|
|
|
|
|
{/*<span className={"fr pointer color-grey-3"} onClick={()=>this.props.hideNewShixunModelType()}>返回</span>*/}
|
|
|
|
|
<span className={type==="mine"?"fr topcsactive pointer color-grey-3 color-blue":"fr pointer color-grey-3"} onClick={()=>this.belongto("mine")}>我的实训</span>
|
|
|
|
|
<span className={type==="all"?"fr mr30 topcsactive pointer color-grey-3 color-blue":"fr mr30 pointer color-grey-3"} onClick={()=>this.belongto("all")}>全部实训</span>
|
|
|
|
|
<span className={type==="mine"?"fr topcsactive pointer color-grey-3 color-blue":"fr pointer color-grey-3"} onClick={()=>this.belongto("mine")}>我的{this.props.type==='shixuns'?'实训':"课程"}</span>
|
|
|
|
|
<span className={type==="all"?"fr mr30 topcsactive pointer color-grey-3 color-blue":"fr mr30 pointer color-grey-3"} onClick={()=>this.belongto("all")}>全部{this.props.type==='shixuns'?'实训':"课程"}</span>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
@ -461,7 +559,7 @@ class NewShixunModel extends Component{
|
|
|
|
|
{JSON.stringify(item.description) == "{}"?"":<div className="newshixunmodelmidfont newradioStyles" dangerouslySetInnerHTML={{__html: item.description}}>
|
|
|
|
|
</div>}
|
|
|
|
|
|
|
|
|
|
{item.challenge_names.length===0?"":<div className="newshixunmodelbotfont">
|
|
|
|
|
{item.challenge_names===undefined?"":item.challenge_names.length===0?"":<div className="newshixunmodelbotfont">
|
|
|
|
|
{item.challenge_names.map((item,key)=>{
|
|
|
|
|
return(
|
|
|
|
|
<span>第{key+1}关:{item}</span>
|
|
|
|
@ -498,7 +596,7 @@ class NewShixunModel extends Component{
|
|
|
|
|
</Breadcrumb>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
{item.subjects.length===0?"":<Dropdown overlay={()=>this.ItsCourse(item.subjects)}>
|
|
|
|
|
{item.subjects===undefined?"":item.subjects.length===0?"":<Dropdown overlay={()=>this.ItsCourse(item.subjects)}>
|
|
|
|
|
<a className="ant-dropdown-link fl ml30 newshixunfont12 color-blue" >
|
|
|
|
|
所属课程<Icon className={"color-blue"} type="down" />
|
|
|
|
|
</a>
|
|
|
|
|