dev_forum
杨树明 5 years ago
parent 4126009fb6
commit 30c71007f9

@ -37,7 +37,8 @@ class Fileslists extends Component{
course_modules:undefined, course_modules:undefined,
has_course_groups:false, has_course_groups:false,
course_is_public:undefined, course_is_public:undefined,
isSpin:false isSpin:false,
course_second_categories:[]
} }
} }
componentDidMount=()=>{ componentDidMount=()=>{
@ -115,12 +116,22 @@ class Fileslists extends Component{
axios.get(url, { axios.get(url, {
}).then((response) => { }).then((response) => {
if(response!=undefined){ if(response!=undefined){
if(response.data&&response.data){ if(response.data&&response.data){
let list=response.data.course_modules;
let course_second_categoriess;
list.map((item,key)=>{
course_second_categoriess=item.course_second_categories
})
debugger
this.setState({ this.setState({
course_modules:response.data, course_modules:response.data,
has_course_groups:response.data.has_course_groups has_course_groups:response.data.has_course_groups,
course_second_categories:course_second_categoriess
}) })
} }
} }
}) })
@ -647,7 +658,8 @@ class Fileslists extends Component{
discussMessageid, discussMessageid,
course_modules, course_modules,
shixunmodal, shixunmodal,
course_is_public course_is_public,
filesId
} = this.state; } = this.state;
let category_id= this.props.match.params.category_id; let category_id= this.props.match.params.category_id;
@ -799,29 +811,35 @@ class Fileslists extends Component{
.drop_down_menu li { .drop_down_menu li {
overflow: visible; overflow: visible;
} }
.courseSecond{
margin-left: 10px;
padding: 10px;
}
`} `}
</style> </style>
<ul className="drop_down_menu" style={{"right":"0px","left":"unset"}}> <ul className="drop_down_menu" style={{"right":"0px","left":"unset","min-width":'150px'}}>
<p className="drop_down_search"> {this.state.course_second_categories.length>10? <p className="drop_down_search">
<Input placeholder="搜索" value={this.state.dirSearchValue} onChange={(e) => {this.setState({dirSearchValue: e.target.value})}}/> <Input placeholder="搜索" value={this.state.dirSearchValue} onChange={(e) => {this.setState({dirSearchValue: e.target.value})}}/>
</p> </p>:""}
{/*{course_modules&&course_modules.course_modules.map((item,key)=>{*/} {course_modules&&course_modules.course_modules.map((item,key)=>{
{/*return(*/} return(
{/*<li key={key} id={item.id} onClick={() => this.moveTos(0)}>{item.module_name}</li>*/} filesId&&filesId===item.id?"":<li key={key} id={item.id} onClick={() => this.moveTos(0)}>{item.module_name}</li>
{/*)*/} )
{/*})}*/} })}
{ course_modules&&course_modules.course_modules.map( (item,key) => { { course_modules&&course_modules.course_modules.map( (item,key) => {
return item.course_second_categories.filter((item)=> { return item.course_second_categories.filter((item)=> {
return (!this.state.dirSearchValue || item.name.indexOf(this.state.dirSearchValue) != -1) return (!this.state.dirSearchValue || item.name.indexOf(this.state.dirSearchValue) != -1)
}).map((itm,k)=>{ }).map((itm,k)=>{
return( return(
<li key={k} id={itm.id} onClick={() => this.moveTos(itm.id )}>{itm.name}</li> filesId&&filesId===itm.id?"":<li key={k} id={itm.id} onClick={() => this.moveTos(itm.id )}>{itm.name}</li>
) )
}) })
})} })}
{this.state.course_second_categories.length===0?
<div className={"courseSecond"}>暂无数据</div>:""}
{/*{course_modules&&course_modules.course_modules.map((item,key)=>{*/} {/*{course_modules&&course_modules.course_modules.map((item,key)=>{*/}
{/*return(*/} {/*return(*/}
@ -834,7 +852,7 @@ class Fileslists extends Component{
{/*})}*/} {/*})}*/}
{this.props.isAdmin()?parseInt(this.props.match.params.main_id)===parseInt(this.props.coursesids)? {this.props.isAdmin()?parseInt(this.props.match.params.main_id)===parseInt(this.props.coursesids)?
<p className="drop_down_btn"> <p className="drop_down_btn">
<a className="color-grey-6" onClick={()=>this.addDir()}>添加目录...</a> <a className="color-grey-6" onClick={()=>this.addDir()}>添加目录</a>
</p> </p>
:"":""} :"":""}
</ul> </ul>

Loading…
Cancel
Save