|
|
|
@ -22,51 +22,40 @@ class InfosTopics extends Component{
|
|
|
|
|
sort_direction:"desc",
|
|
|
|
|
page:1,
|
|
|
|
|
data:undefined,
|
|
|
|
|
checkBoxValues:[]
|
|
|
|
|
checkBoxValues:[],
|
|
|
|
|
per_page:15
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
componentDidMount=()=>{
|
|
|
|
|
componentDidMount(){
|
|
|
|
|
let types=this.props.match.params.topicstype;
|
|
|
|
|
let { category,
|
|
|
|
|
course_list_id,
|
|
|
|
|
sort_by,
|
|
|
|
|
sort_direction,
|
|
|
|
|
page
|
|
|
|
|
}=this.state;
|
|
|
|
|
this.searchAlldata(
|
|
|
|
|
types,
|
|
|
|
|
category,
|
|
|
|
|
course_list_id,
|
|
|
|
|
sort_by,
|
|
|
|
|
sort_direction,
|
|
|
|
|
page
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
let { category,course_list_id,sort_by,sort_direction,page}=this.state;
|
|
|
|
|
this.searchAlldata(types,category,course_list_id,sort_by,sort_direction,page)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
searchAlldata=(type,category,course_list_id,sort_by,sort_direction,page)=>{
|
|
|
|
|
let user_id=this.props.current_user&&this.props.current_user.user_id;
|
|
|
|
|
if(user_id!=undefined){
|
|
|
|
|
let {per_page}=this.state;
|
|
|
|
|
let url=`/users/${user_id}/question_banks.json`;
|
|
|
|
|
axios.get(url,{params:{
|
|
|
|
|
type,
|
|
|
|
|
category,
|
|
|
|
|
course_list_id,
|
|
|
|
|
sort_by,
|
|
|
|
|
sort_direction,
|
|
|
|
|
page,
|
|
|
|
|
per_page
|
|
|
|
|
}
|
|
|
|
|
}).then((response) => {
|
|
|
|
|
this.setState({
|
|
|
|
|
data:response.data
|
|
|
|
|
})
|
|
|
|
|
}).catch((error) => {
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let url=`/users/${user_id}/question_banks.json`;
|
|
|
|
|
|
|
|
|
|
axios.get(url,{params:{
|
|
|
|
|
type,
|
|
|
|
|
category,
|
|
|
|
|
course_list_id,
|
|
|
|
|
sort_by,
|
|
|
|
|
sort_direction,
|
|
|
|
|
page
|
|
|
|
|
}
|
|
|
|
|
}).then((response) => {
|
|
|
|
|
this.setState({
|
|
|
|
|
data:response.data
|
|
|
|
|
})
|
|
|
|
|
}).catch((error) => {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
searchCategory=(type)=>{
|
|
|
|
@ -75,20 +64,8 @@ class InfosTopics extends Component{
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
let types=this.props.match.params.topicstype;
|
|
|
|
|
let { category,
|
|
|
|
|
course_list_id,
|
|
|
|
|
sort_by,
|
|
|
|
|
sort_direction,
|
|
|
|
|
page
|
|
|
|
|
}=this.state;
|
|
|
|
|
this.searchAlldata(
|
|
|
|
|
types,
|
|
|
|
|
type,
|
|
|
|
|
course_list_id,
|
|
|
|
|
sort_by,
|
|
|
|
|
sort_direction,
|
|
|
|
|
page
|
|
|
|
|
)
|
|
|
|
|
let { category,course_list_id,sort_by,sort_direction,page}=this.state;
|
|
|
|
|
this.searchAlldata(types,type,course_list_id,sort_by,sort_direction,page)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
searchCourselistid=(id)=>{
|
|
|
|
@ -97,52 +74,57 @@ class InfosTopics extends Component{
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
let types=this.props.match.params.topicstype;
|
|
|
|
|
let { category,
|
|
|
|
|
course_list_id,
|
|
|
|
|
sort_by,
|
|
|
|
|
sort_direction,
|
|
|
|
|
page
|
|
|
|
|
}=this.state;
|
|
|
|
|
this.searchAlldata(
|
|
|
|
|
types,
|
|
|
|
|
category,
|
|
|
|
|
id,
|
|
|
|
|
sort_by,
|
|
|
|
|
sort_direction,
|
|
|
|
|
page
|
|
|
|
|
)
|
|
|
|
|
let { category,course_list_id,sort_by,sort_direction,page}=this.state;
|
|
|
|
|
this.searchAlldata(types,category,id,sort_by,sort_direction,page)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onCheckBoxChange=(checkedValues)=>{
|
|
|
|
|
debugger
|
|
|
|
|
this.setState({
|
|
|
|
|
checkBoxValues:checkedValues
|
|
|
|
|
})
|
|
|
|
|
if(checkedValues.length>15){
|
|
|
|
|
this.props.showNotification("选择条数不能大于15条")
|
|
|
|
|
}else{
|
|
|
|
|
this.setState({
|
|
|
|
|
checkBoxValues:checkedValues
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
updatedlist=(updatedtype)=>{
|
|
|
|
|
let {sort_by,sort_direction}=this.state;
|
|
|
|
|
let types=this.props.match.params.topicstype;
|
|
|
|
|
let { category,course_list_id,sort_by,sort_direction,page}=this.state;
|
|
|
|
|
if(updatedtype===sort_by){
|
|
|
|
|
if(sort_direction==="desc"){
|
|
|
|
|
this.setState({
|
|
|
|
|
sort_direction:"asc",
|
|
|
|
|
sort_by:updatedtype
|
|
|
|
|
})
|
|
|
|
|
this.searchAlldata(types,category,course_list_id,updatedtype,"asc",page)
|
|
|
|
|
}else{
|
|
|
|
|
this.setState({
|
|
|
|
|
sort_direction:"desc",
|
|
|
|
|
sort_by:updatedtype
|
|
|
|
|
})
|
|
|
|
|
this.searchAlldata(types,category,course_list_id,updatedtype,"desc",page)
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
this.setState({
|
|
|
|
|
sort_direction:"desc",
|
|
|
|
|
sort_by:updatedtype
|
|
|
|
|
})
|
|
|
|
|
this.searchAlldata(types,category,course_list_id,updatedtype,"desc",page)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
changePage=(pageNumber)=>{
|
|
|
|
|
let types=this.props.match.params.topicstype;
|
|
|
|
|
let { category,course_list_id,sort_by,sort_direction,page}=this.state;
|
|
|
|
|
this.searchAlldata(types,category,course_list_id,sort_by,sort_direction,pageNumber)
|
|
|
|
|
this.setState({
|
|
|
|
|
page:pageNumber
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
render(){
|
|
|
|
|
let{
|
|
|
|
|
category,
|
|
|
|
@ -151,7 +133,8 @@ class InfosTopics extends Component{
|
|
|
|
|
data,
|
|
|
|
|
page,
|
|
|
|
|
sort_direction,
|
|
|
|
|
sort_by
|
|
|
|
|
sort_by,
|
|
|
|
|
checkBoxValues
|
|
|
|
|
} = this.state;
|
|
|
|
|
|
|
|
|
|
let categorylist=[
|
|
|
|
@ -165,7 +148,7 @@ class InfosTopics extends Component{
|
|
|
|
|
|
|
|
|
|
let types=this.props.match.params.topicstype;
|
|
|
|
|
|
|
|
|
|
console.log(sort_by)
|
|
|
|
|
console.log(checkBoxValues)
|
|
|
|
|
|
|
|
|
|
//types===publicly 公共
|
|
|
|
|
//types===personal 私有
|
|
|
|
@ -265,7 +248,7 @@ class InfosTopics extends Component{
|
|
|
|
|
<div className="clearfix font-12 mt20">
|
|
|
|
|
<p className="font-12 alltopisc ml25 fl">
|
|
|
|
|
<span className="fl color-grey-9">共 <span className={"color-orange"}>{data&&data.count}</span> 个</span>
|
|
|
|
|
<span className="fr color-grey-9">已选择 <span className={"color-orange"}>{this.state.checkBoxValues.length}</span> 个</span>
|
|
|
|
|
<span className="fr color-grey-9">已选择 <span className={"color-orange"}>{checkBoxValues.length}</span> 个 (不支持跨页勾选)</span>
|
|
|
|
|
</p>
|
|
|
|
|
<p className="font-12 alltopiscright ml25 fr">
|
|
|
|
|
<Dropdown overlay={menu}>
|
|
|
|
@ -286,7 +269,7 @@ class InfosTopics extends Component{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{data===undefined?<NoneData></NoneData>:data.question_banks===undefined||data.question_banks.length===0?<NoneData></NoneData>:
|
|
|
|
|
<Checkbox.Group style={{ width: '100%' }} onChange={this.onCheckBoxChange} value={this.state.checkBoxValues}>
|
|
|
|
|
<Checkbox.Group style={{ width: '100%' }} onChange={this.onCheckBoxChange} value={checkBoxValues}>
|
|
|
|
|
{data.question_banks.map((item,key)=>{
|
|
|
|
|
return(
|
|
|
|
|
<div className="mt20 edu-back-white pd1323 relativef" key={key} >
|
|
|
|
|