dev_forum
杨树明 5 years ago
parent ec97d5aff9
commit 2a613bd638

@ -878,6 +878,7 @@ class ShixunHomework extends Component{
if(response.data&&response.data){ if(response.data&&response.data){
this.setState({ this.setState({
course_modules:response.data, course_modules:response.data,
homework_categorys:response.data.homework_category
}) })
} }
} }
@ -1128,20 +1129,32 @@ class ShixunHomework extends Component{
<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.main_category.map((item,key)=>{*/} {course_modules&&course_modules.main_category.map((item,key)=>{
{/*return(*/} return(
{/*<li key={key} id={item.main_category_id} onClick={() => this.moveTos(item.main_category_id)}>{item.main_category_name}</li>*/} datas&&datas.category_id===null?datas.main_category_id===item.main_category_id?"":<li key={key} id={item.main_category_id} onClick={() => this.moveTos(item.main_category_id)}>{item.main_category_name}</li>:""
{/*)*/} )
{/*})}*/} })}
{ course_modules&&course_modules.homework_category.filter((item)=> { { course_modules&&course_modules.homework_category.filter((item,key)=> {
return (!this.state.dirSearchValue || item.category_name.indexOf(this.state.dirSearchValue) != -1) return (!this.state.dirSearchValue || item.category_name.indexOf(this.state.dirSearchValue) != -1)
}).map( (item,key) => { }).map( (item,key) => {
return <li key={key} id={item.category_id} onClick={() => this.moveTos(item.category_id )}>{item.category_name}</li> return
datas&&datas.category_id!=null?datas.category_id===item.category_id?"":<li key={key} id={item.category_id} onClick={() => this.moveTos(item.category_id )}>{item.category_name}</li>:""
})} })}
<style>
{`
.courseSecond{
margin-left: 10px;
padding: 10px;
}
`}
</style>
{course_modules&&course_modules.homework_category.length===0?
<div className={"courseSecond"}>暂无数据</div>:""}
{/*{course_modules&&course_modules.homework_category.map((item,key)=>{*/} {/*{course_modules&&course_modules.homework_category.map((item,key)=>{*/}
{/*return(*/} {/*return(*/}
{/*<li key={key} id={item.category_id} onClick={() => this.moveTos(item.category_id )}>{item.category_name}</li>*/} {/*<li key={key} id={item.category_id} onClick={() => this.moveTos(item.category_id )}>{item.category_name}</li>*/}

Loading…
Cancel
Save