课程 实训 试卷 选用实训over

dev_cs
杨树明 6 years ago
parent 4946fb3045
commit d9badc2d95

@ -1,6 +1,7 @@
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 NoneData from "../coursesPublic/NoneData";
import './Newshixunmodel.css';
const Search = Input.Search;
class NewShixunModel extends Component{
@ -10,6 +11,7 @@ class NewShixunModel extends Component{
shixun_list:undefined,
shixuns_count:undefined,
Grouplist:[],
allGrouplist:[{page:1,list:[]}],
page:1,
type:'all',
status:'all',
@ -20,11 +22,18 @@ class NewShixunModel extends Component{
}
}
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)
}
getdatalist=(page,type,status,search,order,diff,limit)=>{
this.setState({
isspinning:true
})
let url="/shixuns/shixun_list.json"
axios.get(url,{params:{
page,
@ -39,9 +48,13 @@ class NewShixunModel extends Component{
this.setState({
shixun_list:response.data.shixun_list,
shixuns_count:response.data.shixuns_count,
isspinning:false
})
}
}).catch((error) => {
this.setState({
isspinning:false
})
})
}
@ -66,17 +79,54 @@ class NewShixunModel extends Component{
}
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({
Grouplist: Grouplist,
Grouplist: newGrouplist,
allGrouplist:newallGrouplist
})
}
PaginationCourse=(pageNumber)=>{
this.setState({
page:pageNumber
})
let {allGrouplist}=this.state;
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;
this.getdatalist(pageNumber,type,status,search,order,diff,limit)
this.setState({
page:pageNumber,
allGrouplist:newallGrouplist
})
}
belongto=(value)=>{
@ -117,7 +167,16 @@ class NewShixunModel extends Component{
let{type,page,status,diff,order,limit}=this.state;
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=()=>{
this.setState({
@ -129,11 +188,32 @@ class NewShixunModel extends Component{
this.setState({
hometypepvisible:false
})
this.props.showNotification("请先选择实训")
this.showNotification("请先选择实训")
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";
axios.post(url, {
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{
// 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.hideNewShixunModelType()
@ -157,14 +237,48 @@ class NewShixunModel extends Component{
// homework_ids: (5) [9171, 9172, 9173, 9174, 9175]
}).catch((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() {
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;
// 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 = (
<Menu className="menus">
<Menu.Item>
@ -202,6 +316,7 @@ class NewShixunModel extends Component{
return(
<div>
<style>
{
@ -219,6 +334,7 @@ class NewShixunModel extends Component{
visible={this.props.NewShixunModelType}
height={'100%'}
>
<Spin spinning={this.state.isspinning}>
<div className={"clearfix educontent pr"}>
<div className={"square-list clearfix"}>
@ -237,7 +353,7 @@ class NewShixunModel extends Component{
<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"}>{shixuns_count===undefined?"":shixuns_count}</span> </span>
@ -250,22 +366,28 @@ class NewShixunModel extends Component{
</sapn>
</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}>
<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>
</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={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>
</p>
</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)=>{
@ -350,16 +472,23 @@ class NewShixunModel extends Component{
onChange={this.PaginationCourse}
/>
</div>:""}
{
shixun_list===undefined?
<div className={"minhegiht300"}>
</div>
:shixun_list.length===0? <NoneData></NoneData>:""
}
<div className={" edu-txt-center padding20-30"}>
<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>
</Spin>
</Drawer>
</div>

@ -214,4 +214,14 @@
.newshixunmodelbotfont span{
display: inline-block;
margin-right: 34px;
}
.minhegiht300{
min-height: 300px;
}
.newshixunlist:hover{
box-shadow: 1px 6px 16px rgba(156,156,156,0.16);
opacity: 1;
border-radius: 2px;
}

@ -1,120 +1,122 @@
import React,{ Component } from "react";
import { Modal,Checkbox,Select,Input,Tooltip} from "antd";
import axios from'axios';
import ShixunModal from './ShixunModal'
const Option = Select.Option;
const Search = Input.Search;
class ShixunChooseModal extends Component{
constructor(props){
super(props);
this.state={
shixunmodal: false,
hometypepvisible: false,
}
}
setVisible = (visible) => {
if (visible) {
this.createCommonWork()
} else {
this.setState({ shixunmodal: visible })
}
}
hidecouseShixunModal = () => {
this.setVisible(false)
}
componentDidMount() {
}
funshixunmodallist=(search,type,loading,page)=>{
let{newshixunmodallist}=this.state;
let newshixunmodallists=[]
if(page>1){
newshixunmodallists=newshixunmodallist;
}
this.setState({
hometypepvisible:loading
})
let coursesId=this.props.match.params.coursesId;
let url = this.props.shixunsUrl || "/courses/"+coursesId+"/homework_commons/shixuns.json";
axios.get(url, {
params: {
search: search,
type:type,
page:page
}
}).then((result)=>{
if(result.status===200){
let shixun_list=result.data.shixun_list;
for(var i=0; i<shixun_list.length;i++){
newshixunmodallists.push(shixun_list[i])
}
this.setState({
shixunmodal:true,
shixunmodallist:result.data,
newshixunmodallist:newshixunmodallists,
hometypepvisible:false
})
}
}).catch((error)=>{
console.log(error);
})
}
funpatheditarry=(list)=>{
this.setState({
patheditarry:list
})
}
createCommonWork=()=>{
this.setState({
hometypepvisible:true,
patheditarry:[]
})
let coursesId=this.props.match.params.coursesId;
let url = this.props.shixunsUrl || "/courses/"+coursesId+"/homework_commons/shixuns.json";
axios.get(url).then((result)=>{
if(result.status===200){
this.setState({
shixunmodal:true,
shixunmodallist:result.data,
hometypepvisible:false,
newshixunmodallist:result.data.shixun_list,
})
}
}).catch((error)=>{
console.log(error);
})
}
render(){
let {Searchvalue,type,category_id, datas, shixunmodal, shixunmodallist
, hometypepvisible, newshixunmodallist, patheditarry }=this.state;
let {visible}=this.props;
// console.log(patheditarry)
return(
<ShixunModal
datas={datas}
category_id={this.props.match.params.category_id}
visible={shixunmodal}
shixunmodallist={shixunmodallist}
funshixunmodallist={(search,type,loading,page)=>this.funshixunmodallist(search,type,loading,page)}
hometypepvisible={hometypepvisible}
hidecouseShixunModal={this.hidecouseShixunModal}
newshixunmodallist={newshixunmodallist}
coursesId={this.props.match.params.coursesId}
courseshomeworkstart={(category_id,homework_ids)=> this.props.newhomeworkstart
&& this.props.newhomeworkstart(category_id,homework_ids)}
funpatheditarry={(patheditarry)=>this.funpatheditarry(patheditarry)}
patheditarry={patheditarry}
{...this.props}
></ShixunModal>
)
}
}
import React,{ Component } from "react";
import { Modal,Checkbox,Select,Input,Tooltip} from "antd";
import axios from'axios';
import NewShixunModel from '../coursesPublic/NewShixunModel';
const Option = Select.Option;
const Search = Input.Search;
class ShixunChooseModal extends Component{
constructor(props){
super(props);
this.state={
shixunmodal: false,
hometypepvisible: false,
}
}
setVisible = (visible) => {
// if (visible) {
// this.createCommonWork()
// } else {
//
// }
this.setState({ shixunmodal: visible })
}
hidecouseShixunModal = () => {
this.setVisible(false)
}
componentDidMount() {
}
funshixunmodallist=(search,type,loading,page)=>{
let{newshixunmodallist}=this.state;
let newshixunmodallists=[]
if(page>1){
newshixunmodallists=newshixunmodallist;
}
this.setState({
hometypepvisible:loading
})
let coursesId=this.props.match.params.coursesId;
let url = this.props.shixunsUrl || "/courses/"+coursesId+"/homework_commons/shixuns.json";
axios.get(url, {
params: {
search: search,
type:type,
page:page
}
}).then((result)=>{
if(result.status===200){
let shixun_list=result.data.shixun_list;
for(var i=0; i<shixun_list.length;i++){
newshixunmodallists.push(shixun_list[i])
}
this.setState({
shixunmodal:true,
shixunmodallist:result.data,
newshixunmodallist:newshixunmodallists,
hometypepvisible:false
})
}
}).catch((error)=>{
console.log(error);
})
}
funpatheditarry=(list)=>{
this.setState({
patheditarry:list
})
}
createCommonWork=()=>{
this.setState({
hometypepvisible:true,
patheditarry:[]
})
let coursesId=this.props.match.params.coursesId;
let url = this.props.shixunsUrl || "/courses/"+coursesId+"/homework_commons/shixuns.json";
axios.get(url).then((result)=>{
if(result.status===200){
this.setState({
shixunmodal:true,
shixunmodallist:result.data,
hometypepvisible:false,
newshixunmodallist:result.data.shixun_list,
})
}
}).catch((error)=>{
console.log(error);
})
}
render(){
let {Searchvalue,type,category_id, datas, shixunmodal, shixunmodallist
, hometypepvisible, newshixunmodallist, patheditarry }=this.state;
let {visible}=this.props;
// console.log(patheditarry)
return(
shixunmodal===true?<NewShixunModel
statustype={'published'}
datas={datas}
category_id={this.props.match.params.category_id}
NewShixunModelType={shixunmodal}
shixunmodallist={shixunmodallist}
funshixunmodallist={(search,type,loading,page)=>this.funshixunmodallist(search,type,loading,page)}
hometypepvisible={hometypepvisible}
hideNewShixunModelType={this.hidecouseShixunModal}
newshixunmodallist={newshixunmodallist}
coursesId={this.props.match.params.coursesId}
courseshomeworkstart={(category_id,homework_ids)=> this.props.newhomeworkstart
&& this.props.newhomeworkstart(category_id,homework_ids)}
funpatheditarry={(patheditarry)=>this.funpatheditarry(patheditarry)}
patheditarry={patheditarry}
{...this.props}
></NewShixunModel>:""
)
}
}
export default ShixunChooseModal;

@ -966,6 +966,7 @@ class ShixunHomework extends Component{
Coursename={Coursename}
page={page}
order={order}
statustype={'published'}
/>:""}
@ -1002,23 +1003,23 @@ class ShixunHomework extends Component{
getcourse_groupslist={(id)=>this.getcourse_groupslist(id)}
/>:""}
{/*选择实训*/}
{shixunmodal===true?<ShixunModal
{...this.props}
{...this.state}
datas={datas}
category_id={this.props.match.params.category_id}
visible={shixunmodal}
shixunmodallist={shixunmodallist}
homeworkupdatalists={(Coursename,page,order)=>this.homeworkupdatalist(Coursename,page,order)}
hometypepvisible={hometypepvisible}
hidecouseShixunModal={this.hidecouseShixunModal}
newshixunmodallist={newshixunmodallist}
coursesId={this.props.match.params.coursesId}
courseshomeworkstart={(category_id,homework_ids)=>this.newhomeworkstart(category_id,homework_ids)}
funpatheditarry={(patheditarry)=>this.funpatheditarry(patheditarry)}
patheditarry={patheditarry}
/>:""}
{/*/!*选择实训*!/*/}
{/*{shixunmodal===true?<ShixunModal*/}
{/*{...this.props}*/}
{/*{...this.state}*/}
{/*datas={datas}*/}
{/*category_id={this.props.match.params.category_id}*/}
{/*visible={shixunmodal}*/}
{/*shixunmodallist={shixunmodallist}*/}
{/*homeworkupdatalists={(Coursename,page,order)=>this.homeworkupdatalist(Coursename,page,order)}*/}
{/*hometypepvisible={hometypepvisible}*/}
{/*hidecouseShixunModal={this.hidecouseShixunModal}*/}
{/*newshixunmodallist={newshixunmodallist}*/}
{/*coursesId={this.props.match.params.coursesId}*/}
{/*courseshomeworkstart={(category_id,homework_ids)=>this.newhomeworkstart(category_id,homework_ids)}*/}
{/*funpatheditarry={(patheditarry)=>this.funpatheditarry(patheditarry)}*/}
{/*patheditarry={patheditarry}*/}
{/*/>:""}*/}
{shixunmodal===true||shixunpath===true?<style>
{

@ -1,10 +1,11 @@
import React, { Component } from 'react';
import {getImageUrl} from 'educoder';
import {Modal,Input,Checkbox,Tooltip,Spin} from "antd";
import {Modal,Input,Checkbox,Tooltip,Spin,notification} from "antd";
import { DragDropContext , Draggable, Droppable} from 'react-beautiful-dnd';
import Modals from '../../modals/Modals';
import '../ShixunPaths.css';
import axios from 'axios';
import NewShixunModel from '../../courses/coursesPublic/NewShixunModel';
const $ = window.$;
const Search = Input.Search;
@ -60,36 +61,34 @@ class DetailCardsEditAndAdd extends Component{
this.setState({
selectShixun:true,
patheditarry:[],
page:1
})
this.changeTag(0,"");
// this.changeTag(0,"");
}
//关闭选择实训弹框
cloasShixunBox =()=>{
this.setState({
selectShixun:false,
page:1,
patheditarry:[]
})
}
clickShixunchoose=()=>{
let{patheditarry,shixuns_listeditlist,shixuns_listedit}=this.state
showNotification = (description, message = "提示", icon) => {
const data = {
message,
description
}
if (icon) {
data.icon = icon;
}
notification.open(data);
}
clickShixunchoose=(patheditarry)=>{
let{shixuns_listeditlist,shixuns_listedit}=this.state
let newshixuns_listedit=shixuns_listedit;
let list=shixuns_listeditlist
if(patheditarry.length===0){
this.setState({
Modalstype:true,
Modalstopval:'请选择实训',
cardsModalsave:this.cardsModalsave
})
return
}
let url='/paths/append_to_stage.json'
axios.post(url,{
shixun_id:patheditarry
@ -98,6 +97,19 @@ class DetailCardsEditAndAdd extends Component{
if(response.data){
let newshixun_lists=response.data.shixun_lists;
for(var j=0; j<newshixuns_listedit.length; j++){
for(var a=0; a<newshixun_lists.length; a++){
if(newshixuns_listedit[j].shixun_id===newshixun_lists[a].shixun_id){
// this.setState({
// Modalstype:true,
// Modalstopval:'请勿重复选择'+newshixun_lists[a].shixun_name+'实训',
// })
this.showNotification('请勿重复选择:'+newshixun_lists[a].shixun_name+'实训')
return
}
}
}
for(var z=0; z<newshixun_lists.length; z++){
newshixuns_listedit.push(newshixun_lists[z]);
}
@ -147,38 +159,7 @@ class DetailCardsEditAndAdd extends Component{
})
}
//打开选择实训弹框初始化tag标签和列表
changeTag=(id,search)=>{
this.setState({
ChooseShixunListshixun_list:[],
page:1,
hometypepvisible:true,
})
let pathId=this.props.pathid;
let url='/paths/'+pathId+'/choose_subject_shixun.json?page='+1
if(search!="" && search!=undefined){
url+="&search="+search;
}
if(id!=0){
url+="&type="+id;
}
axios.get(encodeURI(url)).then((result)=>{
if(result.status===200){
this.setState({
ChooseShixunList:result.data,
hometypepvisible:false,
type:id,
ChooseShixunListshixun_list:result.data.shixun_list
})
}
}).catch((error)=>{
console.log(error);
})
}
//勾选实训
shixunhomeworkedit=(list)=>{
@ -307,57 +288,7 @@ class DetailCardsEditAndAdd extends Component{
}
contentViewScrolladd=(e)=>{
const {ChooseShixunList}=this.state;
//滑动到底判断
let newscrollTop=parseInt(e.currentTarget.scrollTop);
let allclientHeight=e.currentTarget.clientHeight+newscrollTop;
if(e.currentTarget.scrollHeight-allclientHeight===0||e.currentTarget.scrollHeight-allclientHeight===1||e.currentTarget.scrollHeight-allclientHeight===-1){
if(ChooseShixunList.shixun_list.length===0){
return
}else{
// console.log("到达底部");
this.setState({
hometypepvisible:true
})
let pathId=this.props.pathid;
let {search,page,type,ChooseShixunListshixun_list}=this.state;
let newpage=page+1;
let newChooseShixunListshixun_list=ChooseShixunListshixun_list;
let url='/paths/'+pathId+'/choose_subject_shixun.json?page='+newpage
if(search!="" && search!=undefined){
url+="&search="+search;
}
if(type!=0){
url+="&type="+type;
}
axios.get(encodeURI(url)).then((result)=>{
if(result.status===200){
let list =result.data.shixun_list;
for(var i=0; i<list.length; i++){
newChooseShixunListshixun_list.push(list[i])
}
this.setState({
ChooseShixunList:result.data,
hometypepvisible:false,
type:type,
search:search,
page:newpage,
ChooseShixunListshixun_list:newChooseShixunListshixun_list
})
}
}).catch((error)=>{
console.log(error);
})
}
}
}
onDragEnd (result) {
let {shixuns_listedit,shixuns_listeditlist} =this.state;
@ -456,99 +387,13 @@ class DetailCardsEditAndAdd extends Component{
`
}
</style>:""}
{selectShixun===true?<NewShixunModel
NewShixunModelType={selectShixun}
hideNewShixunModelType={this.cloasShixunBox}
pathShixun={this.clickShixunchoose}
{...this.props}
></NewShixunModel>:""}
<Modal
keyboard={false}
title="选择实训"
visible={selectShixun}
closable={false}
footer={null}
width="840px"
destroyOnClose={true}
>
<Spin spinning={hometypepvisible} size="large" style={{marginTop:'15%'}}>
<div className="newupload_conbox">
<div className="clearfix mb20 shixun_work_div newshixun_tab_div cdefault" style={{"marginRight":"4px"}} id="shixun_tab_div">
<li className="fl mr5 mt5"> <a onClick={()=>this.changeTag(0,`${search}`)} className={ parseInt(type)===0 ? "active edu-filter-cir-grey font-12":"edu-filter-cir-grey font-12"}>全部</a></li>
{
ChooseShixunList && ChooseShixunList.tags.map((item,key)=>{
return(
<li className="fl mr5 mt5" key={key}>
<a onClick={()=>this.changeTag(`${item.tag_id}`,`${search}`)} className={ parseInt(type) === parseInt(item.tag_id) ? "active edu-filter-cir-grey font-12":"edu-filter-cir-grey font-12"}>{item.tag_name}</a>
</li>
)
})
}
</div>
<div className="clearfix mb20" id="shixun_search_form_div">
<span className="fl color-grey-9 font-16 mt3">
<span></span>
<span className="color-orange-tip">{ChooseShixunList && ChooseShixunList.shixuns_count}</span>
<span>个实训</span>
</span>
<div className="fr search-new mb0">
<Search
placeholder="请输入创建者或者实训名称进行搜索"
onInput={this.searchNameInput}
onSearch={()=>this.changeTag(`${type}`,`${search}`)}
style={{width: '115%'}}
></Search>
</div>
</div>
<ul className="clearfix greybackHead edu-txt-center" style={{marginBottom: '0px'}}>
<li className="fl with40 paddingleft22">实训名称</li>
<li className="fl with30 edu-txt-left">使用院校</li>
<li className="fl with10">使用人数</li>
<li className="fl with10">评价等级</li>
<li className="fl with10"></li>
</ul>
<style>
{
`
.over180{min-height: 180px;max-height: 180px;overflow-y: auto}
`
}
</style>
{ChooseShixunListshixun_list && ChooseShixunListshixun_list.length===0?"": <div className="over180 pl20 pr20"
onScroll={this.contentViewScrolladd}
>
<Checkbox.Group style={{ width: '100%' }} onChange={this.shixunhomeworkedit}>
{
ChooseShixunListshixun_list && ChooseShixunListshixun_list.map((item,key)=>{
return(
<div className="clearfix edu-txt-center lineh-40 bor-bottom-greyE" key={key}>
<li className="fl with40">
<Checkbox
id={"shixun_input_"+item.shixun_id}
value={item.shixun_id}
key={item.shixun_id}
className="fl task-hide edu-txt-left"
style={{"width":"298px"}}
name="shixun_homework[]"
>
<label style={{"textAlign":"left","color":"#05101A"}} className="task-hide color-grey-name" title={item.shixun_name}>{item.shixun_name}</label>
</Checkbox>
</li>
<li className="fl with30 edu-txt-left task-hide paddingl5">{item.school_users}</li>
<li className="fl with10 paddingl10">{item.myshixuns_count}</li>
<li className="fl with10 color-orange-tip paddingl10">{item.preference}</li>
<li className="fl with10"><a className="color-blue" href={"/shixuns/"+item.identifier+"/challenges"} target="_blank">详情</a></li>
</div>
)
})
}
</Checkbox.Group>
</div>}
<div className="mt20 marginauto clearfix edu-txt-center">
<a className="pop_close task-btn mr30 margin-tp26" onClick={this.cloasShixunBox}>取消</a>
<a className="task-btn task-btn-orange margin-tp26" id="submit_send_shixun" onClick={this.clickShixunchoose}>确定</a>
</div>
</div>
</Spin>
</Modal>
</div>
{/* 可拖拽选择实训列表*/}
@ -650,4 +495,185 @@ class DetailCardsEditAndAdd extends Component{
)
}
}
export default DetailCardsEditAndAdd;
export default DetailCardsEditAndAdd;
//
// <Modal
// keyboard={false}
// title="选择实训"
// visible={selectShixun}
// closable={false}
// footer={null}
// width="840px"
// destroyOnClose={true}
// >
// <Spin spinning={hometypepvisible} size="large" style={{marginTop:'15%'}}>
// <div className="newupload_conbox">
// <div className="clearfix mb20 shixun_work_div newshixun_tab_div cdefault" style={{"marginRight":"4px"}} id="shixun_tab_div">
// <li className="fl mr5 mt5"> <a onClick={()=>this.changeTag(0,`${search}`)} className={ parseInt(type)===0 ? "active edu-filter-cir-grey font-12":"edu-filter-cir-grey font-12"}>全部</a></li>
// {
// ChooseShixunList && ChooseShixunList.tags.map((item,key)=>{
// return(
// <li className="fl mr5 mt5" key={key}>
// <a onClick={()=>this.changeTag(`${item.tag_id}`,`${search}`)} className={ parseInt(type) === parseInt(item.tag_id) ? "active edu-filter-cir-grey font-12":"edu-filter-cir-grey font-12"}>{item.tag_name}</a>
// </li>
// )
// })
// }
//
//
// </div>
// <div className="clearfix mb20" id="shixun_search_form_div">
// <span className="fl color-grey-9 font-16 mt3">
// <span>共</span>
// <span className="color-orange-tip">{ChooseShixunList && ChooseShixunList.shixuns_count}</span>
// <span>个实训</span>
// </span>
// <div className="fr search-new mb0">
// <Search
// placeholder="请输入创建者或者实训名称进行搜索"
// onInput={this.searchNameInput}
// onSearch={()=>this.changeTag(`${type}`,`${search}`)}
// style={{width: '115%'}}
// ></Search>
// </div>
// </div>
// <ul className="clearfix greybackHead edu-txt-center" style={{marginBottom: '0px'}}>
// <li className="fl with40 paddingleft22">实训名称</li>
// <li className="fl with30 edu-txt-left">使用院校</li>
// <li className="fl with10">使用人数</li>
// <li className="fl with10">评价等级</li>
// <li className="fl with10"></li>
// </ul>
//
// <style>
// {
// `
// .over180{min-height: 180px;max-height: 180px;overflow-y: auto}
// `
// }
// </style>
// {ChooseShixunListshixun_list && ChooseShixunListshixun_list.length===0?"": <div className="over180 pl20 pr20"
// onScroll={this.contentViewScrolladd}
// >
// <Checkbox.Group style={{ width: '100%' }} onChange={this.shixunhomeworkedit}>
// {
// ChooseShixunListshixun_list && ChooseShixunListshixun_list.map((item,key)=>{
// return(
// <div className="clearfix edu-txt-center lineh-40 bor-bottom-greyE" key={key}>
// <li className="fl with40">
// <Checkbox
// id={"shixun_input_"+item.shixun_id}
// value={item.shixun_id}
// key={item.shixun_id}
// className="fl task-hide edu-txt-left"
// style={{"width":"298px"}}
// name="shixun_homework[]"
// >
// <label style={{"textAlign":"left","color":"#05101A"}} className="task-hide color-grey-name" title={item.shixun_name}>{item.shixun_name}</label>
// </Checkbox>
// </li>
// <li className="fl with30 edu-txt-left task-hide paddingl5">{item.school_users}</li>
// <li className="fl with10 paddingl10">{item.myshixuns_count}</li>
// <li className="fl with10 color-orange-tip paddingl10">{item.preference}</li>
// <li className="fl with10"><a className="color-blue" href={"/shixuns/"+item.identifier+"/challenges"} target="_blank">详情</a></li>
// </div>
// )
// })
// }
// </Checkbox.Group>
// </div>}
// <div className="mt20 marginauto clearfix edu-txt-center">
// <a className="pop_close task-btn mr30 margin-tp26" onClick={this.cloasShixunBox}>取消</a>
// <a className="task-btn task-btn-orange margin-tp26" id="submit_send_shixun" onClick={this.clickShixunchoose}>确定</a>
// </div>
// </div>
// </Spin>
// </Modal>
// contentViewScrolladd=(e)=>{
// const {ChooseShixunList}=this.state;
// //滑动到底判断
// let newscrollTop=parseInt(e.currentTarget.scrollTop);
// let allclientHeight=e.currentTarget.clientHeight+newscrollTop;
//
// if(e.currentTarget.scrollHeight-allclientHeight===0||e.currentTarget.scrollHeight-allclientHeight===1||e.currentTarget.scrollHeight-allclientHeight===-1){
//
// if(ChooseShixunList.shixun_list.length===0){
// return
// }else{
// // console.log("到达底部");
// this.setState({
// hometypepvisible:true
// })
// let pathId=this.props.pathid;
// let {search,page,type,ChooseShixunListshixun_list}=this.state;
// let newpage=page+1;
// let newChooseShixunListshixun_list=ChooseShixunListshixun_list;
// let url='/paths/'+pathId+'/choose_subject_shixun.json?page='+newpage
// if(search!="" && search!=undefined){
// url+="&search="+search;
// }
// if(type!=0){
// url+="&type="+type;
// }
// axios.get(encodeURI(url)).then((result)=>{
// if(result.status===200){
// let list =result.data.shixun_list;
//
// for(var i=0; i<list.length; i++){
// newChooseShixunListshixun_list.push(list[i])
// }
// this.setState({
// ChooseShixunList:result.data,
// hometypepvisible:false,
// type:type,
// search:search,
// page:newpage,
// ChooseShixunListshixun_list:newChooseShixunListshixun_list
// })
// }
// }).catch((error)=>{
// console.log(error);
// })
//
// }
//
// }
//
// }
//
// //打开选择实训弹框初始化tag标签和列表
// changeTag=(id,search)=>{
//
// this.setState({
// ChooseShixunListshixun_list:[],
// page:1,
// hometypepvisible:true,
// })
//
// let pathId=this.props.pathid;
//
// let url='/paths/'+pathId+'/choose_subject_shixun.json?page='+1
// if(search!="" && search!=undefined){
// url+="&search="+search;
// }
// if(id!=0){
// url+="&type="+id;
// }
//
// axios.get(encodeURI(url)).then((result)=>{
// if(result.status===200){
// this.setState({
// ChooseShixunList:result.data,
// hometypepvisible:false,
// type:id,
// ChooseShixunListshixun_list:result.data.shixun_list
// })
// }
// }).catch((error)=>{
// console.log(error);
// })
// }

@ -1,8 +1,9 @@
import React, { Component } from 'react';
import {getImageUrl} from 'educoder';
import {Modal,Input,Checkbox,Tooltip,Spin} from "antd";
import {Modal,Input,Checkbox,Tooltip,Spin,notification} from "antd";
import { DragDropContext,Draggable, Droppable} from 'react-beautiful-dnd';
import Modals from '../../modals/Modals';
import NewShixunModel from '../../courses/coursesPublic/NewShixunModel';
import '../ShixunPaths.css';
import axios from 'axios';
const $ = window.$;
@ -63,7 +64,7 @@ class DetailCardsEditAndEdit extends Component{
selectShixun:true,
patheditarry:[]
})
this.changeTag(0,"");
// this.changeTag(0,"");
}
//关闭选择实训弹框
cloasShixunBox =()=>{
@ -79,36 +80,7 @@ class DetailCardsEditAndEdit extends Component{
})
}
//打开选择实训弹框初始化tag标签和列表
changeTag(id,search){
this.setState({
ChooseShixunListshixun_list:[],
page:1,
hometypepvisible:true
})
let pathId=this.props.pathid;
let url='/paths/'+pathId+'/choose_subject_shixun.json?page='+1
if(search!="" && search!=undefined){
url+="&search="+search;
}
if(id!=0){
url+="&type="+id;
}
axios.get(encodeURI(url)).then((result)=>{
if(result.status===200){
this.setState({
ChooseShixunList:result.data,
hometypepvisible:false,
type:id,
search:search,
ChooseShixunListshixun_list:result.data.shixun_list
})
}
}).catch((error)=>{
console.log(error);
})
}
shixunhomeworkedit=(list)=>{
@ -158,22 +130,12 @@ class DetailCardsEditAndEdit extends Component{
}
clickShixunchoose=()=>{
clickShixunchoose=(patheditarry)=>{
let{patheditarry,shixuns_listedit,shixuns_listeditlist}=this.state
let{shixuns_listedit,shixuns_listeditlist}=this.state
let newshixuns_listedit=shixuns_listedit;
let list=shixuns_listeditlist
if(patheditarry.length===0){
this.setState({
Modalstype:true,
Modalstopval:'请选择实训',
})
return
}
let url='/paths/append_to_stage.json'
axios.post(url,{
shixun_id:patheditarry
@ -184,10 +146,11 @@ class DetailCardsEditAndEdit extends Component{
for(var j=0; j<newshixuns_listedit.length; j++){
for(var a=0; a<newshixun_lists.length; a++){
if(newshixuns_listedit[j].shixun_id===newshixun_lists[a].shixun_id){
this.setState({
Modalstype:true,
Modalstopval:'请勿重复选择'+newshixun_lists[a].shixun_name+'实训',
})
// this.setState({
// Modalstype:true,
// Modalstopval:'请勿重复选择'+newshixun_lists[a].shixun_name+'实训',
// })
this.showNotification('请勿重复选择:'+newshixun_lists[a].shixun_name+'实训')
return
}
}
@ -338,69 +301,16 @@ class DetailCardsEditAndEdit extends Component{
})
}
contentViewScrolledit=(e)=>{
//滑动到底判断
const {ChooseShixunList}=this.state;
let newscrollTop=parseInt(e.currentTarget.scrollTop);
let allclientHeight=e.currentTarget.clientHeight+newscrollTop;
if(e.currentTarget.scrollHeight-allclientHeight===0||e.currentTarget.scrollHeight-allclientHeight===1||e.currentTarget.scrollHeight-allclientHeight===-1){
if(ChooseShixunList.shixun_list.length===0){
return
}else{
this.setState({
hometypepvisible:true
})
// console.log("到达底部");
let {page,type,search,ChooseShixunListshixun_list}=this.state;
let newpage=page+1;
let pathId=this.props.pathid;
let newChooseShixunListshixun_list=ChooseShixunListshixun_list;
let url='/paths/'+pathId+'/choose_subject_shixun.json?page='+newpage
if(search!="" && search!=undefined){
url+="&search="+search;
}
if(type!=0){
url+="&type="+type;
}
axios.get(encodeURI(url)).then((result)=>{
if(result.status===200){
let list =result.data.shixun_list;
for(var i=0; i<list.length; i++){
newChooseShixunListshixun_list.push(list[i])
}
this.setState({
ChooseShixunList:result.data,
hometypepvisible:false,
type:type,
page:newpage,
search:search,
ChooseShixunListshixun_list:newChooseShixunListshixun_list
})
}
}).catch((error)=>{
console.log(error);
})
}
}
}
showNotification = (description, message = "提示", icon) => {
const data = {
message,
description
}
if (icon) {
data.icon = icon;
}
notification.open(data);
}
render(){
let {selectShixun,
@ -483,99 +393,13 @@ class DetailCardsEditAndEdit extends Component{
}
</style>:""}
{selectShixun===true?<NewShixunModel
NewShixunModelType={selectShixun}
hideNewShixunModelType={this.cloasShixunBox}
pathShixun={this.clickShixunchoose}
{...this.props}
></NewShixunModel>:""}
<Modal
keyboard={false}
title="选择实训"
visible={selectShixun}
closable={false}
footer={null}
width="840px"
destroyOnClose={true}
>
<Spin spinning={hometypepvisible} size="large" style={{marginTop:'15%'}}>
<div className="newupload_conbox">
<div className="clearfix mb20 shixun_work_div newshixun_tab_div cdefault" style={{"marginRight":"4px"}} id="shixun_tab_div">
<li className="fl mr5 mt5"> <a onClick={()=>this.changeTag(0,`${search}`)} className={ parseInt(type)===0 ? "active edu-filter-cir-grey font-12":"edu-filter-cir-grey font-12"}>全部</a></li>
{
ChooseShixunList && ChooseShixunList.tags.map((item,key)=>{
return(
<li className="fl mr5 mt5" key={key}>
<a onClick={()=>this.changeTag(`${item.tag_id}`,`${search}`)} className={ parseInt(type) === parseInt(item.tag_id) ? "active edu-filter-cir-grey font-12":"edu-filter-cir-grey font-12"}>{item.tag_name}</a>
</li>
)
})
}
</div>
<div className="clearfix mb20" id="shixun_search_form_div">
<span className="fl color-grey-9 font-16 mt3">
<span></span>
<span className="color-orange-tip">{ChooseShixunList && ChooseShixunList.shixuns_count}</span>
<span>个实训</span>
</span>
<div className="fr search-new mb0">
<Search
placeholder="请输入创建者或者实训名称进行搜索"
onInput={this.searchNameInput}
onSearch={()=>this.changeTag(`${type}`,`${search}`)}
style={{width: '115%'}}
></Search>
</div>
</div>
<ul className="clearfix greybackHead edu-txt-center" style={{marginBottom: '0px'}}>
<li className="fl with40 paddingleft22">实训名称</li>
<li className="fl with30 edu-txt-left">使用院校</li>
<li className="fl with10">使用人数</li>
<li className="fl with10">评价等级</li>
<li className="fl with10"></li>
</ul>
<style>
{
`
.over180{min-height: 180px;max-height: 180px;overflow-y: auto}
`
}
</style>
{ChooseShixunListshixun_list && ChooseShixunListshixun_list.length===0?"":<div className="over180 pl20 pr20"
onScroll={this.contentViewScrolledit}
>
<Checkbox.Group style={{ width: '100%' }} onChange={this.shixunhomeworkedit}>
{
ChooseShixunListshixun_list && ChooseShixunListshixun_list.map((item,key)=>{
return(
<div className="clearfix edu-txt-center lineh-40 bor-bottom-greyE" key={key}>
<li className="fl with40">
<Checkbox
id={"shixun_input_"+item.shixun_id}
value={item.shixun_id}
key={item.shixun_id}
className="fl task-hide edu-txt-left"
style={{"width":"298px"}}
name="shixun_homework[]"
>
<label style={{"textAlign":"left","color":"#05101A"}} className="task-hide color-grey-name" title={item.shixun_name}>{item.shixun_name}</label>
</Checkbox>
</li>
<li className="fl with30 edu-txt-left task-hide paddingl5">{item.school_users}</li>
<li className="fl with10 paddingl10">{item.myshixuns_count}</li>
<li className="fl with10 color-orange-tip paddingl10">{item.preference}</li>
<li className="fl with10"><a className="color-blue" href={"/shixuns/"+item.identifier+"/challenges"} target="_blank">详情</a></li>
</div>
)
})
}
</Checkbox.Group>
</div>}
<div className="mt20 marginauto clearfix edu-txt-center">
<a className="pop_close task-btn mr30 margin-tp26" onClick={this.cloasShixunBox}>取消</a>
<a className="task-btn task-btn-orange margin-tp26" id="submit_send_shixun" onClick={this.clickShixunchoose}>确定</a>
</div>
</div>
</Spin>
</Modal>
</div>
{/* 可拖拽选择实训列表*/}
@ -716,4 +540,191 @@ export default DetailCardsEditAndEdit;
// </div>
// )
// })
// }
// }
// <Modal
// keyboard={false}
// title="选择实训"
// visible={selectShixun}
// closable={false}
// footer={null}
// width="840px"
// destroyOnClose={true}
// >
// <Spin spinning={hometypepvisible} size="large" style={{marginTop:'15%'}}>
// <div className="newupload_conbox">
// <div className="clearfix mb20 shixun_work_div newshixun_tab_div cdefault" style={{"marginRight":"4px"}} id="shixun_tab_div">
// <li className="fl mr5 mt5"> <a onClick={()=>this.changeTag(0,`${search}`)} className={ parseInt(type)===0 ? "active edu-filter-cir-grey font-12":"edu-filter-cir-grey font-12"}>全部</a></li>
// {
// ChooseShixunList && ChooseShixunList.tags.map((item,key)=>{
// return(
// <li className="fl mr5 mt5" key={key}>
// <a onClick={()=>this.changeTag(`${item.tag_id}`,`${search}`)} className={ parseInt(type) === parseInt(item.tag_id) ? "active edu-filter-cir-grey font-12":"edu-filter-cir-grey font-12"}>{item.tag_name}</a>
// </li>
// )
// })
// }
//
//
// </div>
// <div className="clearfix mb20" id="shixun_search_form_div">
// <span className="fl color-grey-9 font-16 mt3">
// <span>共</span>
// <span className="color-orange-tip">{ChooseShixunList && ChooseShixunList.shixuns_count}</span>
// <span>个实训</span>
// </span>
// <div className="fr search-new mb0">
// <Search
// placeholder="请输入创建者或者实训名称进行搜索"
// onInput={this.searchNameInput}
// onSearch={()=>this.changeTag(`${type}`,`${search}`)}
// style={{width: '115%'}}
// ></Search>
// </div>
// </div>
// <ul className="clearfix greybackHead edu-txt-center" style={{marginBottom: '0px'}}>
// <li className="fl with40 paddingleft22">实训名称</li>
// <li className="fl with30 edu-txt-left">使用院校</li>
// <li className="fl with10">使用人数</li>
// <li className="fl with10">评价等级</li>
// <li className="fl with10"></li>
// </ul>
//
// <style>
// {
// `
// .over180{min-height: 180px;max-height: 180px;overflow-y: auto}
// `
// }
// </style>
// {ChooseShixunListshixun_list && ChooseShixunListshixun_list.length===0?"":<div className="over180 pl20 pr20"
// onScroll={this.contentViewScrolledit}
// >
// <Checkbox.Group style={{ width: '100%' }} onChange={this.shixunhomeworkedit}>
// {
// ChooseShixunListshixun_list && ChooseShixunListshixun_list.map((item,key)=>{
// return(
// <div className="clearfix edu-txt-center lineh-40 bor-bottom-greyE" key={key}>
// <li className="fl with40">
// <Checkbox
// id={"shixun_input_"+item.shixun_id}
// value={item.shixun_id}
// key={item.shixun_id}
// className="fl task-hide edu-txt-left"
// style={{"width":"298px"}}
// name="shixun_homework[]"
// >
// <label style={{"textAlign":"left","color":"#05101A"}} className="task-hide color-grey-name" title={item.shixun_name}>{item.shixun_name}</label>
// </Checkbox>
// </li>
// <li className="fl with30 edu-txt-left task-hide paddingl5">{item.school_users}</li>
// <li className="fl with10 paddingl10">{item.myshixuns_count}</li>
// <li className="fl with10 color-orange-tip paddingl10">{item.preference}</li>
// <li className="fl with10"><a className="color-blue" href={"/shixuns/"+item.identifier+"/challenges"} target="_blank">详情</a></li>
// </div>
// )
// })
// }
// </Checkbox.Group>
// </div>}
// <div className="mt20 marginauto clearfix edu-txt-center">
// <a className="pop_close task-btn mr30 margin-tp26" onClick={this.cloasShixunBox}>取消</a>
// <a className="task-btn task-btn-orange margin-tp26" id="submit_send_shixun" onClick={this.clickShixunchoose}>确定</a>
// </div>
// </div>
// </Spin>
// </Modal>
// //打开选择实训弹框初始化tag标签和列表
// changeTag(id,search){
//
// this.setState({
// ChooseShixunListshixun_list:[],
// page:1,
// hometypepvisible:true
// })
// let pathId=this.props.pathid;
// let url='/paths/'+pathId+'/choose_subject_shixun.json?page='+1
// if(search!="" && search!=undefined){
// url+="&search="+search;
// }
// if(id!=0){
// url+="&type="+id;
// }
// axios.get(encodeURI(url)).then((result)=>{
// if(result.status===200){
// this.setState({
// ChooseShixunList:result.data,
// hometypepvisible:false,
// type:id,
// search:search,
// ChooseShixunListshixun_list:result.data.shixun_list
// })
// }
// }).catch((error)=>{
// console.log(error);
// })
// }
// contentViewScrolledit=(e)=>{
// //滑动到底判断
// const {ChooseShixunList}=this.state;
// let newscrollTop=parseInt(e.currentTarget.scrollTop);
// let allclientHeight=e.currentTarget.clientHeight+newscrollTop;
//
// if(e.currentTarget.scrollHeight-allclientHeight===0||e.currentTarget.scrollHeight-allclientHeight===1||e.currentTarget.scrollHeight-allclientHeight===-1){
//
// if(ChooseShixunList.shixun_list.length===0){
// return
// }else{
// this.setState({
// hometypepvisible:true
// })
// // console.log("到达底部");
//
// let {page,type,search,ChooseShixunListshixun_list}=this.state;
//
// let newpage=page+1;
//
// let pathId=this.props.pathid;
//
// let newChooseShixunListshixun_list=ChooseShixunListshixun_list;
//
// let url='/paths/'+pathId+'/choose_subject_shixun.json?page='+newpage
//
// if(search!="" && search!=undefined){
// url+="&search="+search;
// }
//
// if(type!=0){
// url+="&type="+type;
// }
// axios.get(encodeURI(url)).then((result)=>{
// if(result.status===200){
//
// let list =result.data.shixun_list;
//
// for(var i=0; i<list.length; i++){
// newChooseShixunListshixun_list.push(list[i])
// }
// this.setState({
// ChooseShixunList:result.data,
// hometypepvisible:false,
// type:type,
// page:newpage,
// search:search,
// ChooseShixunListshixun_list:newChooseShixunListshixun_list
// })
// }
// }).catch((error)=>{
// console.log(error);
// })
//
//
// }
//
//
//
// }
//
// }
Loading…
Cancel
Save