|
|
|
@ -1,7 +1,7 @@
|
|
|
|
|
import React,{ Component } from "react";
|
|
|
|
|
import { Link } from "react-router-dom";
|
|
|
|
|
import axios from 'axios';
|
|
|
|
|
import {Checkbox,Modal,Input,Tooltip,notification,Popover,Dropdown,Menu} from 'antd';
|
|
|
|
|
import {Checkbox,Modal,Input,Tooltip,notification,Popover,Dropdown,Menu,TreeSelect} from 'antd';
|
|
|
|
|
import { DragDropContext,Draggable, Droppable} from 'react-beautiful-dnd';
|
|
|
|
|
import Modals from '../../modals/Modals';
|
|
|
|
|
import { on, off, trigger } from 'educoder';
|
|
|
|
@ -12,6 +12,7 @@ const CheckboxGroup = Checkbox.Group;
|
|
|
|
|
|
|
|
|
|
let navidtype=true;
|
|
|
|
|
const { SubMenu } = Menu;
|
|
|
|
|
const { TreeNode } = TreeSelect;
|
|
|
|
|
|
|
|
|
|
//a little function to help us with reordering the result
|
|
|
|
|
const reorder = (list, startIndex, endIndex) => {
|
|
|
|
@ -65,7 +66,21 @@ class Coursesleftnav extends Component{
|
|
|
|
|
successFunc:undefined,
|
|
|
|
|
|
|
|
|
|
//用来判断 是不是资源点击进入的
|
|
|
|
|
Navmodalziyname:''
|
|
|
|
|
Navmodalziyname:'',
|
|
|
|
|
treeData:undefined,
|
|
|
|
|
//默认为0主目录
|
|
|
|
|
parentid:0,
|
|
|
|
|
//判断3级目录是否显示三个点
|
|
|
|
|
sanshow:'',
|
|
|
|
|
sansandiantype:undefined,
|
|
|
|
|
//新增参数判断打开关闭 默认关闭
|
|
|
|
|
showPreson:true,
|
|
|
|
|
//判断二级还是三级目录点击
|
|
|
|
|
sanclick:'issan',
|
|
|
|
|
//获取资源id 判断是否选中的事资源来判控
|
|
|
|
|
treeDataid:'',
|
|
|
|
|
//默认值
|
|
|
|
|
treedefaultValue:''
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -185,7 +200,7 @@ class Coursesleftnav extends Component{
|
|
|
|
|
groupRenameListener = (e, data) => {
|
|
|
|
|
this.Navmodalnames(e,5,"editSecondname", data.id, data.name);
|
|
|
|
|
}
|
|
|
|
|
attachmentAddlog=(e,data,name)=>{
|
|
|
|
|
attachmentAddlog=(e,data)=>{
|
|
|
|
|
console.log(data.id,data.name)
|
|
|
|
|
this.Navmodalnames(e,1,"attachment",data.id,data.name);
|
|
|
|
|
}
|
|
|
|
@ -238,7 +253,6 @@ class Coursesleftnav extends Component{
|
|
|
|
|
newselectnavid:parseInt(category_id),
|
|
|
|
|
})
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
|
|
if(isNaN(category_id)){
|
|
|
|
|
this.setState({
|
|
|
|
|
positiontype:courstype,
|
|
|
|
@ -290,7 +304,36 @@ class Coursesleftnav extends Component{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//请求接口获取资源列表数据
|
|
|
|
|
getatahcment(){
|
|
|
|
|
let coursesId=this.props.match.params.coursesId;
|
|
|
|
|
let url="/courses/"+coursesId+"/attahcment_category_list.json";
|
|
|
|
|
axios.get(url, {params:{
|
|
|
|
|
no_child: true,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}).then((response) => {
|
|
|
|
|
if(response!=undefined){
|
|
|
|
|
if(response.data&&response.data) {
|
|
|
|
|
if (response.data.status != 401) {
|
|
|
|
|
|
|
|
|
|
let tr=response.data.course_modules;
|
|
|
|
|
this.setState({
|
|
|
|
|
treeData:tr
|
|
|
|
|
})
|
|
|
|
|
tr.map((iem,index)=>{
|
|
|
|
|
this.setState({
|
|
|
|
|
treeDataid:iem.value
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
setnavid=(e,key,id,type,url)=>{
|
|
|
|
|
// this.props.getleftNavid && this.props.getleftNavid(key,type);
|
|
|
|
@ -354,11 +397,14 @@ class Coursesleftnav extends Component{
|
|
|
|
|
e.stopPropagation();//阻止冒泡
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
selectnavids=(e,key,id,type,urls,index)=>{
|
|
|
|
|
selectnavids=(e,key,id,type,urls,index,santype)=>{
|
|
|
|
|
const doesShow = this.state.showPreson;
|
|
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
|
selectnavid:true,
|
|
|
|
|
newselectnavid:id,
|
|
|
|
|
url:urls,
|
|
|
|
|
showPreson:santype==='san'?!doesShow:'',
|
|
|
|
|
indexs:index
|
|
|
|
|
})
|
|
|
|
|
this.props.updataleftNavfun();
|
|
|
|
@ -371,7 +417,6 @@ class Coursesleftnav extends Component{
|
|
|
|
|
|
|
|
|
|
// console.log("twosandianshow");
|
|
|
|
|
// console.log(key);
|
|
|
|
|
// console.log(type);
|
|
|
|
|
this.setState({
|
|
|
|
|
toopvisibleindexs:key,
|
|
|
|
|
twosandiantype:key,
|
|
|
|
@ -381,6 +426,23 @@ class Coursesleftnav extends Component{
|
|
|
|
|
})
|
|
|
|
|
e.stopPropagation();//阻止冒泡
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sansandianshow=(e,key,type,name)=>{
|
|
|
|
|
|
|
|
|
|
// console.log("twosandianshow");
|
|
|
|
|
// console.log(key);
|
|
|
|
|
this.setState({
|
|
|
|
|
toopvisibleindexs:key,
|
|
|
|
|
sansandiantype:key,
|
|
|
|
|
toopvisible:false,
|
|
|
|
|
sanshow:name,
|
|
|
|
|
toopvisibleindex:undefined,
|
|
|
|
|
twosandiantypes:type
|
|
|
|
|
})
|
|
|
|
|
e.stopPropagation();//阻止冒泡
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
twosandianshowys=(e,key,type)=>{
|
|
|
|
|
// console.log("twosandianshow");
|
|
|
|
|
// console.log(key);
|
|
|
|
@ -390,6 +452,17 @@ class Coursesleftnav extends Component{
|
|
|
|
|
})
|
|
|
|
|
e.stopPropagation();//阻止冒泡
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sansandianshowys=(e,key,type)=>{
|
|
|
|
|
// console.log("twosandianshow");
|
|
|
|
|
// console.log(key);
|
|
|
|
|
// console.log(type);
|
|
|
|
|
this.setState({
|
|
|
|
|
toopvisibleindexs:key,
|
|
|
|
|
})
|
|
|
|
|
e.stopPropagation();//阻止冒泡
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
twosandianshowyss=(e,key,type)=>{
|
|
|
|
|
// console.log("twosandianshow");
|
|
|
|
|
// console.log(key);
|
|
|
|
@ -400,6 +473,16 @@ class Coursesleftnav extends Component{
|
|
|
|
|
e.stopPropagation();//阻止冒泡
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sansandianshowyss=(e,key,type)=>{
|
|
|
|
|
// console.log("twosandianshow");
|
|
|
|
|
// console.log(key);
|
|
|
|
|
// console.log(type);
|
|
|
|
|
this.setState({
|
|
|
|
|
toopvisibleindexs:undefined,
|
|
|
|
|
})
|
|
|
|
|
e.stopPropagation();//阻止冒泡
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
twosandianhide=(e,index,type)=>{
|
|
|
|
|
// console.log(index)
|
|
|
|
|
this.setState({
|
|
|
|
@ -413,6 +496,20 @@ class Coursesleftnav extends Component{
|
|
|
|
|
e.stopPropagation();//阻止冒泡
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sansandianhide=(e,index,type)=>{
|
|
|
|
|
// console.log(index)
|
|
|
|
|
this.setState({
|
|
|
|
|
toopvisibleindexs:undefined,
|
|
|
|
|
sansandiantype:undefined,
|
|
|
|
|
twosandiantypenum:undefined,
|
|
|
|
|
toopvisible:true,
|
|
|
|
|
sanshow:'',
|
|
|
|
|
toopvisibleindex:index,
|
|
|
|
|
twosandiantypes:type
|
|
|
|
|
})
|
|
|
|
|
e.stopPropagation();//阻止冒泡
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
twosandianhideys=(e,index,type)=>{
|
|
|
|
|
// console.log(index)
|
|
|
|
|
this.setState({
|
|
|
|
@ -429,6 +526,9 @@ class Coursesleftnav extends Component{
|
|
|
|
|
navid:undefined,
|
|
|
|
|
sandiantype:undefined,
|
|
|
|
|
twosandiantype:undefined,
|
|
|
|
|
sansandiantype:undefined,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
let url="/course_modules/"+id+"/sticky_module.json"
|
|
|
|
@ -448,6 +548,7 @@ class Coursesleftnav extends Component{
|
|
|
|
|
navid:undefined,
|
|
|
|
|
sandiantype:undefined,
|
|
|
|
|
twosandiantype:undefined,
|
|
|
|
|
sansandiantype:undefined,
|
|
|
|
|
ModalsType:false
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
@ -496,8 +597,9 @@ class Coursesleftnav extends Component{
|
|
|
|
|
|
|
|
|
|
Navmodalnames=(e,id,type,setnavid,name)=>{
|
|
|
|
|
e.stopPropagation();//阻止冒泡
|
|
|
|
|
console.log(id)
|
|
|
|
|
this.getatahcment()
|
|
|
|
|
navidtype=false
|
|
|
|
|
console.log(e,id,type,setnavid,name)
|
|
|
|
|
if(id===1||id===2||id===6){
|
|
|
|
|
this.setState({
|
|
|
|
|
Navmodalname:id===2?"新建分班":"新建目录",
|
|
|
|
@ -558,7 +660,7 @@ class Coursesleftnav extends Component{
|
|
|
|
|
console.log(positiontype)
|
|
|
|
|
axios.post(url,
|
|
|
|
|
{name:value,
|
|
|
|
|
parent_id:2342
|
|
|
|
|
parent_id:this.state.parentid
|
|
|
|
|
}).then((result)=>{
|
|
|
|
|
if(result!=undefined){
|
|
|
|
|
if(result.data.status===0){
|
|
|
|
@ -791,7 +893,15 @@ class Coursesleftnav extends Component{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
tronChange=(value)=>{
|
|
|
|
|
|
|
|
|
|
console.log(this.state.treeDataid)
|
|
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
|
parentid:this.state.treeDataid===value?0:value
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
droppablepost=(url,list)=>{
|
|
|
|
|
axios.post(url,{position: list}).then((result)=>{
|
|
|
|
@ -864,6 +974,7 @@ class Coursesleftnav extends Component{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
hidesandian=(e,key)=>{
|
|
|
|
|
this.setState({
|
|
|
|
|
sandiantypes:undefined
|
|
|
|
@ -878,6 +989,7 @@ class Coursesleftnav extends Component{
|
|
|
|
|
e.stopPropagation();//阻止冒泡
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
showsandians=(e,key,urls,num,id,type,index)=> {
|
|
|
|
|
let {url}=this.state;
|
|
|
|
|
if (key === this.props.indexs) {
|
|
|
|
@ -935,11 +1047,11 @@ class Coursesleftnav extends Component{
|
|
|
|
|
<div onClick={e=>this.editSetup(e,item.id)}>置顶</div>
|
|
|
|
|
</div>)
|
|
|
|
|
}
|
|
|
|
|
content=(item,iem,index)=>{
|
|
|
|
|
content=(item,iem,index,san)=>{
|
|
|
|
|
let {twosandiantypes,twosandiantypenum}=this.state;
|
|
|
|
|
return (item.type==="graduation"?"": <div className={item.type===twosandiantypes&&twosandiantypenum===index?"sandianboxs":"sandianboxs"} >
|
|
|
|
|
{/*作业/资源*/}
|
|
|
|
|
{item.type==="shixun_homework"||item.type==="attachment"||item.type==="common_homework"||item.type==="group_homework"?<div onClick={e=>this.deleteSecondary(e,1,iem.category_id)}>新建目录</div>:""}
|
|
|
|
|
{item.type==="attachment"&&san!=='san'?<div onClick={e=>this.Navmodalnames(e,1,"attachment",iem.category_id,"资源")}>新建目录</div>:""}
|
|
|
|
|
{item.type==="shixun_homework"||item.type==="attachment"||item.type==="graduation"||item.type==="common_homework"||item.type==="group_homework"?<div onClick={e=>this.Navmodalnames(e,4,"editSecondname",iem.category_id,iem.category_name)}>重命名</div>:""}
|
|
|
|
|
{item.type==="shixun_homework"||item.type==="attachment"||item.type==="common_homework"||item.type==="group_homework"?<div onClick={e=>this.deleteSecondary(e,1,iem.category_id)}>删除</div>:""}
|
|
|
|
|
{/*分班*/}
|
|
|
|
@ -967,9 +1079,6 @@ class Coursesleftnav extends Component{
|
|
|
|
|
chapterupdate:false,
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
sunmenu=()=>{
|
|
|
|
|
alert(1231)
|
|
|
|
|
}
|
|
|
|
|
render(){
|
|
|
|
|
|
|
|
|
|
let {
|
|
|
|
@ -983,7 +1092,8 @@ class Coursesleftnav extends Component{
|
|
|
|
|
ModalSave,
|
|
|
|
|
loadtype,
|
|
|
|
|
twosandiantypes,
|
|
|
|
|
toopvisibleindexs
|
|
|
|
|
toopvisibleindexs,
|
|
|
|
|
sansandiantype
|
|
|
|
|
}=this.state;
|
|
|
|
|
|
|
|
|
|
let {course_modules,hidden_modules,is_teacher} =this.props;
|
|
|
|
@ -995,6 +1105,9 @@ class Coursesleftnav extends Component{
|
|
|
|
|
// console.log("CoursesLeftNav");
|
|
|
|
|
// console.log(course_modules);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return(
|
|
|
|
|
|
|
|
|
|
<ul className="mb10 newedu-class-leftnav">
|
|
|
|
@ -1054,7 +1167,15 @@ class Coursesleftnav extends Component{
|
|
|
|
|
<div>
|
|
|
|
|
{this.state.Navmodalziyname==="资源"?<div className="df" style={{marginBottom:50}}>
|
|
|
|
|
<div className={"fl mt5"}>上级目录:</div>
|
|
|
|
|
|
|
|
|
|
<TreeSelect
|
|
|
|
|
className={"input-flex-35 greyInput fl"}
|
|
|
|
|
dropdownStyle={{ maxHeight: 400, overflow: 'auto' }}
|
|
|
|
|
treeData={this.state.treeData}
|
|
|
|
|
placeholder="资源"
|
|
|
|
|
defaultValue={this.state.setnavid}
|
|
|
|
|
treeDefaultExpandAll
|
|
|
|
|
onChange={this.tronChange}
|
|
|
|
|
/>
|
|
|
|
|
</div>:''}
|
|
|
|
|
|
|
|
|
|
<div className="df" >
|
|
|
|
@ -1181,7 +1302,7 @@ class Coursesleftnav extends Component{
|
|
|
|
|
>
|
|
|
|
|
{/*"/classrooms/"+this.props.match.params.coursesId+"/"+item.type+"/"+iem.category_type+"/"+iem.category_id*/}
|
|
|
|
|
<a className={"Draggablelichild"} key={index}>
|
|
|
|
|
<li className="clearfix width93 Draggableli" key={index} onClick={(e)=>this.selectnavids(e,key,iem.category_id,item.type+"child",iem.second_category_url,key)} onMouseLeave={(e)=>this.twosandianhide(e,index,item.type)} onMouseEnter={(e)=>this.twosandianshow(e,index,item.type)}
|
|
|
|
|
<li className="clearfix width93 Draggableli" key={index} onClick={(e)=>this.selectnavids(e,key,iem.category_id,item.type+"child",iem.second_category_url,key,'san')} onMouseLeave={(e)=>this.twosandianhide(e,index,item.type)} onMouseEnter={(e)=>this.twosandianshow(e,index,item.type)}
|
|
|
|
|
key={index}
|
|
|
|
|
ref={provided.innerRef}
|
|
|
|
|
{...provided.draggableProps}
|
|
|
|
@ -1192,6 +1313,7 @@ class Coursesleftnav extends Component{
|
|
|
|
|
<span className={this.props.location.pathname===iem.second_category_url?"color-blue fl ml38 maxwidth170 task-hide Draggablelichild":"fl ml38 maxwidth170 task-hide Draggablelichild"} onMouseEnter={(e)=>this.twosandianshowys(e,index,item.type)}>{iem.category_name}</span>
|
|
|
|
|
|
|
|
|
|
<span className={twosandiantype===undefined?this.props.location.pathname===iem.second_category_url?"fr mr20 color-blue Draggablelichild font-14":"fr mr20 color999 Draggablelichild font-14":item.type===twosandiantypes&&twosandiantype===index&&iem.category_id!=0?"none":this.props.location.pathname===iem.second_category_url?"fr mr20 color-blue Draggablelichild font-14":"fr mr20 color999 Draggablelichild font-14"} >{iem.category_count===0?"":iem.category_count}</span>
|
|
|
|
|
|
|
|
|
|
{item.type===twosandiantypes&&twosandiantype===index?
|
|
|
|
|
iem.category_id===0?"":
|
|
|
|
|
iem.category_type==="graduation_topics"||iem.category_type==="graduation_tasks"?
|
|
|
|
@ -1223,6 +1345,53 @@ class Coursesleftnav extends Component{
|
|
|
|
|
</li>
|
|
|
|
|
|
|
|
|
|
</a>
|
|
|
|
|
{
|
|
|
|
|
this.props.location.pathname!==iem.second_category_url?"":iem.third_category.map((itt,index)=>{
|
|
|
|
|
if(itt.category_type!=="attachment"){
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return(
|
|
|
|
|
<div onClick={this.getatahcment}>
|
|
|
|
|
{/*"/classrooms/"+this.props.match.params.coursesId+"/"+item.type+"/"+iem.category_type+"/"+iem.category_id*/}
|
|
|
|
|
<a className={"Draggablelichild"} key={index}>
|
|
|
|
|
<li className="clearfix width93 Draggableli" key={index} onClick={(e)=>this.selectnavids(e,key,itt.category_id,item.type+"child",itt.second_category_url,key)} onMouseLeave={(e)=>this.sansandianhide(e,index,item.type)} onMouseEnter={(e)=>this.sansandianshow(e,index,item.type,itt.category_name)}
|
|
|
|
|
key={index}
|
|
|
|
|
ref={provided.innerRef}
|
|
|
|
|
{...provided.draggableProps}
|
|
|
|
|
{...provided.dragHandleProps}
|
|
|
|
|
// title={iem.category_name.length<10?"":iem.category_name}
|
|
|
|
|
>
|
|
|
|
|
<a className="fl pl46 pd0 Draggablelichild">
|
|
|
|
|
<span style={{marginLeft:20}} className={this.props.location.pathname===itt.second_category_url?"color-blue fl ml38 maxwidth170 task-hide Draggablelichild":"fl ml38 maxwidth170 task-hide Draggablelichild"} onMouseEnter={(e)=>this.sansandianshowys(e,index,item.type)}>{itt.category_name}</span>
|
|
|
|
|
|
|
|
|
|
<span className={sansandiantype===undefined?this.props.location.pathname===itt.second_category_url?"fr mr20 color-blue Draggablelichild font-14":"fr mr20 color999 Draggablelichild font-14":item.type===twosandiantypes&&sansandiantype===index&&itt.category_id!=0?"none":this.props.location.pathname===itt.second_category_url?"fr mr20 color-blue Draggablelichild font-14":"fr mr20 color999 Draggablelichild font-14"} >{itt.category_count===0?"":itt.category_count}</span>
|
|
|
|
|
|
|
|
|
|
{iem.category_type===twosandiantypes&&sansandiantype===index?
|
|
|
|
|
itt.category_name!==this.state.sanshow?"":
|
|
|
|
|
(
|
|
|
|
|
itt.category_name&&itt.category_name.length<13?
|
|
|
|
|
<Popover placement="right" content={this.content(item,itt,index,'san')} trigger="hover" key={index} onMouseEnter={(e)=>this.sansandianshowyss(e)}>
|
|
|
|
|
<i className={"iconfont icon-sandian fr color999 mr15 Draggablelichild"}></i>
|
|
|
|
|
</Popover>
|
|
|
|
|
:
|
|
|
|
|
<Tooltip placement="right" key={index} title={itt.category_name} visible={toopvisibleindexs===undefined?false:toopvisibleindexs===index?true:false}>
|
|
|
|
|
<Popover placement="right" content={this.content(item,itt,index,'san')} trigger="hover" key={index} onMouseEnter={(e)=>this.sansandianshowyss(e)}>
|
|
|
|
|
<i className={"iconfont icon-sandian fr color999 mr15 Draggablelichild"}></i>
|
|
|
|
|
</Popover>
|
|
|
|
|
</Tooltip>
|
|
|
|
|
)
|
|
|
|
|
:""}
|
|
|
|
|
</a>
|
|
|
|
|
</li>
|
|
|
|
|
|
|
|
|
|
</a>
|
|
|
|
|
</div>
|
|
|
|
|
)
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
</Tooltip>
|
|
|
|
|
)}
|
|
|
|
|
</Draggable>
|
|
|
|
|