dev_forum
杨树林 5 years ago
parent e246a0c90d
commit c67050034a

@ -1411,7 +1411,7 @@ class Listofworksstudentone extends Component {
// } // }
this.setState({ this.setState({
page: e.current, page: e.current,
teacherlists: teacherlists // teacherlists: teacherlists
}) })
} }

@ -1,7 +1,7 @@
import React,{ Component } from "react"; import React,{ Component } from "react";
import {Checkbox,Input,Table, Pagination,Menu,Icon} from "antd"; import {Checkbox,Input,Table, Pagination,Menu,Icon} from "antd";
import {Link,NavLink} from 'react-router-dom'; import {Link,NavLink} from 'react-router-dom';
import { WordsBtn ,ActionBtn,SnackbarHOC} from 'educoder'; import { WordsBtn ,ActionBtn,SnackbarHOC,markdownToHTML,getImageUrl} from 'educoder';
const Search = Input.Search; const Search = Input.Search;
import axios from 'axios'; import axios from 'axios';
import './searchc.css' import './searchc.css'
@ -13,6 +13,11 @@ class SearchPage extends Component{
this.state={ this.state={
tab:"0", tab:"0",
count:0, count:0,
keywords:"python",
type:"",
page:1,
perpages:20,
data:[],
} }
} }
//切换tab //切换tab
@ -34,14 +39,47 @@ class SearchPage extends Component{
// this.setState({ // this.setState({
// tab:sum, // tab:sum,
// }) // })
this.getdata(this.state.page);
} }
setdatafuns =(value)=>{ setdatafuns =(value)=>{
} }
paginationonChanges = (pageNumber) => {
this.setState({
page: pageNumber,
loadingstate: true,
})
this.getdata(pageNumber);
}
//获取数据
getdata=(pages)=>{
let url = "/search.json";
axios.get(url,{params:{
keyword:this.state.keywords,
type:this.state.types,
page:pages,
per_page:this.state.perpages,
}
}).then((response) => {
if(response === undefined){
return
}
console.log("63");
console.log(response.data);
this.setState({
count:response.data.count,
data:response.data.results,
})
}).catch((error) => {
console.log("56");
console.log(error);
});
}
render(){ render(){
let {tab,count}=this.state; let {tab,count,data,page,perpages}=this.state;
console.log(tab); console.log(tab);
return( return(
<div className="newMain clearfix"> <div className="newMain clearfix">
@ -55,6 +93,7 @@ class SearchPage extends Component{
</div> </div>
<div className="tabtitle"> <div className="tabtitle">
<div className="tabtitles2">
<Menu mode="horizontal" className="tabtitless" selectedKeys={tab} onClick={this.changeTab}> <Menu mode="horizontal" className="tabtitless" selectedKeys={tab} onClick={this.changeTab}>
<Menu.Item className={"tabtitle1"} key="0">开发社区</Menu.Item> <Menu.Item className={"tabtitle1"} key="0">开发社区</Menu.Item>
<Menu.Item className={"tabtitle2"} key="1">实践课程</Menu.Item> <Menu.Item className={"tabtitle2"} key="1">实践课程</Menu.Item>
@ -62,17 +101,115 @@ class SearchPage extends Component{
<Menu.Item className={"tabtitle2"} key="3">交流问答</Menu.Item> <Menu.Item className={"tabtitle2"} key="3">交流问答</Menu.Item>
</Menu> </Menu>
</div> </div>
</div>
{
JSON.stringify(data) === "[]" ?
<div id="forum_list" className="forum_table">
<div className="mh650 edu-back-white">
<div className="edu-tab-con-box clearfix edu-txt-center">
<img className="edu-nodata-img mb20" src={getImageUrl("images/educoder/nodata.png")}/>
<p className="edu-nodata-p mb30">没有数据可以显示</p>
</div>
</div>
</div>
:
<div>
<div className="counttit"> <div className="counttit">
<p className="counttittext">共找到相关结果<span className="counttittexts">{count}</span></p> <p className="counttittext">共找到相关结果<span className="counttittexts">{count}</span></p>
</div> </div>
<div className="mainx"> <div className="mainx">
<div className="educontent project-packages-list mb30">
{data === undefined ? "" : data.map((item, key) => {
return (
<div className="project-package-item">
<div className={"font-16 color-dark fl "} >
{/*标题*/}
<span className={"markdown-body fonttext"}
dangerouslySetInnerHTML={{__html:item.title}}/>
{/*描述*/}
<div>
{item.content.content === undefined || item.content.content===0?"": item.content.content.map((item4, key4) => {
return (
<span className={"markdown-body magr11 fontextcolor"}
dangerouslySetInnerHTML={{__html: item4}} />
)
})
}
</div>
<div>
{/*内容*/}
{item.content.description === undefined || item.content.description===0?"": item.content.description.map((item3, key3) => {
return (
<span className={"markdown-body magr11 fontextcolor"}
dangerouslySetInnerHTML={{__html: item3}} />
)
})
}
</div>
<div className="xuxianpro"></div>
<div>
{/*挑战名字*/}
{item.content.challenge_names === undefined || item.content.challenge_names===0?"": item.content.challenge_names.map((item5, key5) => {
return (
<span className={"markdown-body"}
dangerouslySetInnerHTML={{__html: item5}} />
)
})
}
</div> </div>
<div>
{/*挑战标签*/}
{item.content.challenge_tag_names === undefined || item.content.challenge_tag_names===0?"": item.content.challenge_tag_names.map((item6, key6) => {
return (
<span className={key6>1?"markdown-body tzbq ":"markdown-body tzbqx"}
dangerouslySetInnerHTML={{__html:item6}} />
)
})
}
</div>
</div>
</div>
)
})}
</div>
</div>
<div className="mt20">
<span></span> <span></span> <span></span>
</div>
</div>
}
{
count && count && count> perpages ?
<div className="edu-txt-center" style={{paddingBottom:"30px"}}>
<Pagination showQuickJumper current={page}
onChange={this.paginationonChanges} pageSize={perpages}
total={count}></Pagination>
</div>
: ""
}
</div> </div>
) )

@ -24,14 +24,18 @@
} }
.tabtitle{ .tabtitle{
width: 100% !important;
height: 62px !important; height: 62px !important;
box-shadow: 3px 10px 21px 0px rgba(76, 76, 76, 0.15); box-shadow: 3px 10px 21px 0px rgba(76, 76, 76, 0.15);
border-radius: 6px; border-radius: 6px;
background: #fff; background: #fff;
background: rgb(244, 244, 244); display: flex;
justify-content: center;
}
.tabtitles2{
background: #fff;
height: 62px !important;
width: 1200px;
} }
.tabtitless{ .tabtitless{
height: 62px !important; height: 62px !important;
@ -39,28 +43,27 @@
} }
.tabtitle1{ .tabtitle1{
margin-left: 181px !important;
} }
.tabtitle2{ .tabtitle2{
margin-left: 90px !important; margin-left: 30px !important;
} }
.counttit{ .counttit{
width: 130px; display: flex;
height: 18px; justify-content: center;
} }
.counttittext{ .counttittext{
width: 130px; text-align: left;
width: 1200px;
height: 18px; height: 18px;
color: #888888; color: #888888;
font-size: 13px; font-size: 13px;
margin-top: 24px; margin-top: 24px;
padding-bottom: 17px;
margin-left: 343px;
} }
.counttittexts{ .counttittexts{
@ -71,4 +74,44 @@
.mainx{ .mainx{
display: flex; display: flex;
justify-content: center; justify-content: center;
margin-top: 17px;
}
.project-packages-list{
}
.project-package-item{
display: -webkit-flex;
display: flex;
flex-direction:column;
margin-bottom: 20px;
padding: 20px;
background: white;
/* box-shadow: 1px 3px 3px 1px rgba(156,156,156,0.16); */
}
.xuxianpro{
height: 20px;
border-bottom: 1px dashed;
border-color: #EAEAEA;
margin-bottom: 18px;
}
.magr11{
margin-top: 11px;
}
.highlight{
color: #4CACFF;
}
.fonttext{
font-size: 20px;
font-weight:bold;
}
.fontextcolor{
color: #777777;
}
.tzbq{
margin-left: 68px;
}
.tzbqx{
margin-left: 24px;
} }
Loading…
Cancel
Save