diff --git a/public/react/src/modules/courses/Resource/index.js b/public/react/src/modules/courses/Resource/index.js
index 9eb14b886..1b503962e 100644
--- a/public/react/src/modules/courses/Resource/index.js
+++ b/public/react/src/modules/courses/Resource/index.js
@@ -166,7 +166,7 @@ class Fileslists extends Component{
let list = response.data.course_modules;
let course_second_categoriess;
list.map((item, key) => {
- course_second_categoriess = item.course_second_categories
+ course_second_categoriess = item.children
})
this.setState({
@@ -461,10 +461,8 @@ class Fileslists extends Component{
checkBoxValues:[]
})
if(parseInt(this.props.match.params.main_id)!=parseInt(this.props.coursesids)){
- console.log(1)
trigger('attachmentAddlog', {id: parseInt( course_modules&&course_modules.course_modules[0].id),name:'目录'})
}else{
- console.log(2)
trigger('attachmentAddlog', {id:parseInt(filesId),name:'资源'})
}
@@ -666,7 +664,7 @@ class Fileslists extends Component{
//判断二级链接是否显示
istowshow(item){
this.setState({
- istowshowid:item.id
+ istowshowid:item.value
})
}
@@ -1025,27 +1023,27 @@ class Fileslists extends Component{
{course_modules&&course_modules.course_modules.map((item,key)=>{
return(
- filesId&&filesId===item.id?"":
-
this.moveTos(itm.id )} style={{marginLeft:15,color:'#000000'}}>{itm.name}
+
this.moveTos(itm.value )} style={{marginLeft:15,color:'#000000'}}>{itm.title}
this.istowshow(itm,filesId)} className="iconfont icon-xiajiantou font-12 ml2">
- { this.state.istowshowid===itm.id?
- itm.course_third_categories.map((tt,ti) => {
+ { this.state.istowshowid===itm.value?
+ itm.children.map((tt,ti) => {
return(
filesId&&filesId===itm.id?"":
-
this.moveTos(tt.id )} title={tt.name}>{tt.name}
+
this.moveTos(tt.value )} title={tt.name}>{tt.title}
)
})
:''}
diff --git a/public/react/src/modules/courses/coursesDetail/CoursesLeftNav.js b/public/react/src/modules/courses/coursesDetail/CoursesLeftNav.js
index 363f21e0d..56694d9e5 100644
--- a/public/react/src/modules/courses/coursesDetail/CoursesLeftNav.js
+++ b/public/react/src/modules/courses/coursesDetail/CoursesLeftNav.js
@@ -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{
this.editSetup(e,item.id)}>置顶
)
}
- content=(item,iem,index)=>{
+ content=(item,iem,index,san)=>{
let {twosandiantypes,twosandiantypenum}=this.state;
return (item.type==="graduation"?"":