From d9badc2d958f7dea9ad39df7b0989d68a73ca57c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Thu, 12 Sep 2019 01:26:35 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=20=E5=AE=9E=E8=AE=AD=20?= =?UTF-8?q?=E8=AF=95=E5=8D=B7=20=20=E9=80=89=E7=94=A8=E5=AE=9E=E8=AE=ADove?= =?UTF-8?q?r?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../courses/coursesPublic/NewShixunModel.js | 167 ++++++- .../courses/coursesPublic/Newshixunmodel.css | 10 + .../coursesPublic/ShixunChooseModal.js | 240 +++++----- .../courses/shixunHomework/shixunHomework.js | 35 +- .../paths/PathDetail/DetailCardsEditAndAdd.js | 408 +++++++++-------- .../PathDetail/DetailCardsEditAndEdit.js | 417 +++++++++--------- 6 files changed, 728 insertions(+), 549 deletions(-) diff --git a/public/react/src/modules/courses/coursesPublic/NewShixunModel.js b/public/react/src/modules/courses/coursesPublic/NewShixunModel.js index 3c64cbab1..393d714b3 100644 --- a/public/react/src/modules/courses/coursesPublic/NewShixunModel.js +++ b/public/react/src/modules/courses/coursesPublic/NewShixunModel.js @@ -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=( + + + this.poststatus("all")}> + 所有 + + + + + this.poststatus("published")} > + 已发布 + + + + + this.poststatus("unpublished")}> + 未发布 + + + + ); const menus = ( @@ -202,6 +316,7 @@ class NewShixunModel extends Component{ return( +
:""} + {selectShixun===true?:""} - - -
- -
- - - {ChooseShixunList && ChooseShixunList.shixuns_count} - 个实训 - -
- this.changeTag(`${type}`,`${search}`)} - style={{width: '115%'}} - > -
-
-
    -
  • 实训名称
  • -
  • 使用院校
  • -
  • 使用人数
  • -
  • 评价等级
  • -
  • -
- - - {ChooseShixunListshixun_list && ChooseShixunListshixun_list.length===0?"":
- - { - ChooseShixunListshixun_list && ChooseShixunListshixun_list.map((item,key)=>{ - return( -
-
  • - - - -
  • -
  • {item.school_users}
  • -
  • {item.myshixuns_count}
  • -
  • {item.preference}
  • -
  • 详情
  • -
    - ) - }) - } -
    -
    } -
    - 取消 - 确定 -
    -
    -
    -
    {/* 可拖拽选择实训列表*/} @@ -650,4 +495,185 @@ class DetailCardsEditAndAdd extends Component{ ) } } -export default DetailCardsEditAndAdd; \ No newline at end of file +export default DetailCardsEditAndAdd; + + + + +// +// +// +//
    +// +//
    +// +// +// {ChooseShixunList && ChooseShixunList.shixuns_count} +// 个实训 +// +//
    +// this.changeTag(`${type}`,`${search}`)} +// style={{width: '115%'}} +// > +//
    +//
    +//
      +//
    • 实训名称
    • +//
    • 使用院校
    • +//
    • 使用人数
    • +//
    • 评价等级
    • +//
    • +//
    +// +// +// {ChooseShixunListshixun_list && ChooseShixunListshixun_list.length===0?"":
    +// +// { +// ChooseShixunListshixun_list && ChooseShixunListshixun_list.map((item,key)=>{ +// return( +//
    +//
  • +// +// +// +//
  • +//
  • {item.school_users}
  • +//
  • {item.myshixuns_count}
  • +//
  • {item.preference}
  • +//
  • 详情
  • +//
    +// ) +// }) +// } +//
    +//
    } +//
    +// 取消 +// 确定 +//
    +//
    +//
    +//
    +// 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{ +// 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); +// }) +// } \ No newline at end of file diff --git a/public/react/src/modules/paths/PathDetail/DetailCardsEditAndEdit.js b/public/react/src/modules/paths/PathDetail/DetailCardsEditAndEdit.js index e52ad0ad6..3d1559797 100644 --- a/public/react/src/modules/paths/PathDetail/DetailCardsEditAndEdit.js +++ b/public/react/src/modules/paths/PathDetail/DetailCardsEditAndEdit.js @@ -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{ - //滑动到底判断 - 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{ - 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{ } :""} + {selectShixun===true?:""} - - -
    - -
    - - - {ChooseShixunList && ChooseShixunList.shixuns_count} - 个实训 - -
    - this.changeTag(`${type}`,`${search}`)} - style={{width: '115%'}} - > -
    -
    -
      -
    • 实训名称
    • -
    • 使用院校
    • -
    • 使用人数
    • -
    • 评价等级
    • -
    • -
    - - - {ChooseShixunListshixun_list && ChooseShixunListshixun_list.length===0?"":
    - - { - ChooseShixunListshixun_list && ChooseShixunListshixun_list.map((item,key)=>{ - return( -
    -
  • - - - -
  • -
  • {item.school_users}
  • -
  • {item.myshixuns_count}
  • -
  • {item.preference}
  • -
  • 详情
  • -
    - ) - }) - } -
    -
    } -
    - 取消 - 确定 -
    -
    -
    -
    {/* 可拖拽选择实训列表*/} @@ -716,4 +540,191 @@ export default DetailCardsEditAndEdit; // // ) // }) -// } \ No newline at end of file +// } + +// +// +//
    +// +//
    +// +// +// {ChooseShixunList && ChooseShixunList.shixuns_count} +// 个实训 +// +//
    +// this.changeTag(`${type}`,`${search}`)} +// style={{width: '115%'}} +// > +//
    +//
    +//
      +//
    • 实训名称
    • +//
    • 使用院校
    • +//
    • 使用人数
    • +//
    • 评价等级
    • +//
    • +//
    +// +// +// {ChooseShixunListshixun_list && ChooseShixunListshixun_list.length===0?"":
    +// +// { +// ChooseShixunListshixun_list && ChooseShixunListshixun_list.map((item,key)=>{ +// return( +//
    +//
  • +// +// +// +//
  • +//
  • {item.school_users}
  • +//
  • {item.myshixuns_count}
  • +//
  • {item.preference}
  • +//
  • 详情
  • +//
    +// ) +// }) +// } +//
    +//
    } +//
    +// 取消 +// 确定 +//
    +//
    +//
    +//
    + +// //打开选择实训弹框初始化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{ +// console.log(error); +// }) +// +// +// } +// +// +// +// } +// +// } \ No newline at end of file