import React,{Component} from 'react'; import { Modal,Checkbox,Select,Input,Tooltip,Spin,Icon,Drawer,Dropdown,Menu,Breadcrumb,Pagination,Button} from "antd"; import axios from'axios'; import './Newshixunmodel.css'; const Search = Input.Search; class NewShixunModel extends Component{ constructor(props){ super(props) this.state={ diff:0, shixun_list:undefined, shixuns_count:undefined, } } componentDidMount() { console.log(this.props.type) if(this.props.type==='shixun'){ let url="/shixuns/shixun_list.json" axios.get(url).then((response) => { if(response.data){ console.log(response.data); if(response.data.status===0){ } } }) }else{ let url="/shixuns/shixun_list.json" axios.get(url,{params:{ type:'all', //这是带过来的值 status:'all', search:undefined, diff:0, order:'desc', page:1, limit:15, }}).then((response) => { if(response.data){ this.setState({ shixun_list:response.data.shixun_list, shixuns_count:response.data.shixuns_count, }) } }) } } DropdownClick=(type)=>{ this.setState({ diff:type }) } ItsCourse=(item)=>{ return {item.map((list,key)=>{ return( {list.name} ) })} } render() { let {diff,datas,shixun_list,shixuns_count}=this.state; // let {visible,patheditarry}=this.props; const menus = ( this.DropdownClick(0)}> 所有 this.DropdownClick(1)} > 初级 this.DropdownClick(2)}> 中级 this.DropdownClick(3)}> 高级 this.DropdownClick(4)}> 顶级 ); return(
搜索} onInput={(e)=>this.setdatafunsval(e)} onSearch={ (value)=>this.setdatafuns(value)} />

已选 6 个实训 {shixuns_count===undefined?"":shixuns_count} 个实训 学习人数 this.updatedlist(sort_by)}> {diff===0?"所有":diff===1?"初级":diff===2?"中级":diff===3?"高级":diff===4?"顶级":""}

我的实训 全部实训

{/*author_name: "刘强"*/} {/*author_school_name: "湖南工业大学"*/} {/*challenge_names: ["打印输出 Hello World", "打印输出图形", "求3个数的最大值", "熟悉C语言调试过程"]*/} {/*challenges_count: 4*/} {/*content: {}*/} {/*id: 1504*/} {/*identifier: "tb7hw62n"*/} {/*level: "初级"*/} {/*study_count: 6002*/} {/*subjects: [{id: 138, name: "C语言程序设计"}, {id: 180, name: "C语言程序设计(湖南师范大学)"}, {id: 211, name: "移动云启 —— C语言练习题库"}]*/} {/*title: "C语言程序设计编辑与调试环境"*/} {/*visits_count: 9419*/} {shixun_list===undefined?"":shixun_list.length===0?"":shixun_list.map((item,key)=>{ console.log(item.content) return(
{item.title}

{/*{item.content}*/}

{item.challenge_names.map((item,key)=>{ return( {item} ) })}

{item.author_name} {item.author_school_name} 难度系数:{item.level} 学习人数:{item.study_count}

{item.subjects.length===0?"":this.ItsCourse(item.subjects)}> 所属课程 }
)}) } {shixun_list===undefined?"":shixuns_count>15?
:""}
) } } export default NewShixunModel;