From c67050034abe1be4a0dee67cba30587a92f6ab00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Fri, 19 Jul 2019 17:47:21 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../shixunHomework/Listofworksstudentone.js | 2 +- public/react/src/search/SearchPage.js | 161 ++++++++++++++++-- public/react/src/search/searchc.css | 63 +++++-- 3 files changed, 203 insertions(+), 23 deletions(-) diff --git a/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js b/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js index 1ba8c85b7..f31cb954d 100644 --- a/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js +++ b/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js @@ -1411,7 +1411,7 @@ class Listofworksstudentone extends Component { // } this.setState({ page: e.current, - teacherlists: teacherlists + // teacherlists: teacherlists }) } diff --git a/public/react/src/search/SearchPage.js b/public/react/src/search/SearchPage.js index 076bc9f4d..14966b670 100644 --- a/public/react/src/search/SearchPage.js +++ b/public/react/src/search/SearchPage.js @@ -1,7 +1,7 @@ import React,{ Component } from "react"; import {Checkbox,Input,Table, Pagination,Menu,Icon} from "antd"; 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; import axios from 'axios'; import './searchc.css' @@ -13,6 +13,11 @@ class SearchPage extends Component{ this.state={ tab:"0", count:0, + keywords:"python", + type:"", + page:1, + perpages:20, + data:[], } } //切换tab @@ -34,14 +39,47 @@ class SearchPage extends Component{ // this.setState({ // tab:sum, // }) + this.getdata(this.state.page); } 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(){ - let {tab,count}=this.state; + let {tab,count,data,page,perpages}=this.state; console.log(tab); return(
@@ -55,24 +93,123 @@ class SearchPage extends Component{
+
开发社区 实践课程 翻转课堂 交流问答 +
+ { + JSON.stringify(data) === "[]" ? + +
+
+
+ +

没有数据可以显示!

+
+
+ +
+ : +
+
+

共找到相关结果{count}

+
+ +
+ +
+ {data === undefined ? "" : data.map((item, key) => { + return ( +
+ +
+ {/*标题*/} + + {/*描述*/} +
+ {item.content.content === undefined || item.content.content===0?"": item.content.content.map((item4, key4) => { + return ( + + ) + }) + } +
+ +
+ {/*内容*/} + {item.content.description === undefined || item.content.description===0?"": item.content.description.map((item3, key3) => { + return ( + + ) + }) + } +
+ +
+ +
+ {/*挑战名字*/} + {item.content.challenge_names === undefined || item.content.challenge_names===0?"": item.content.challenge_names.map((item5, key5) => { + return ( + + ) + }) + } +
+ +
+ {/*挑战标签*/} + {item.content.challenge_tag_names === undefined || item.content.challenge_tag_names===0?"": item.content.challenge_tag_names.map((item6, key6) => { + return ( + 1?"markdown-body tzbq ":"markdown-body tzbqx"} + dangerouslySetInnerHTML={{__html:item6}} /> + ) + }) + } +
+ + + + +
+
+ ) + })} + + +
+ + + + +
+ +
+ +
+
+ } + + + { + count && count && count> perpages ? +
+ +
+ : "" + } -
-

共找到相关结果{count}

-
- -
- - - - -
) diff --git a/public/react/src/search/searchc.css b/public/react/src/search/searchc.css index 9fe8b22a0..a3e9fafbd 100644 --- a/public/react/src/search/searchc.css +++ b/public/react/src/search/searchc.css @@ -24,14 +24,18 @@ } .tabtitle{ - width: 100% !important; height: 62px !important; box-shadow: 3px 10px 21px 0px rgba(76, 76, 76, 0.15); border-radius: 6px; background: #fff; - background: rgb(244, 244, 244); + display: flex; + justify-content: center; +} +.tabtitles2{ + background: #fff; + height: 62px !important; + width: 1200px; } - .tabtitless{ height: 62px !important; @@ -39,28 +43,27 @@ } .tabtitle1{ - margin-left: 181px !important; } .tabtitle2{ - margin-left: 90px !important; + margin-left: 30px !important; } .counttit{ - width: 130px; - height: 18px; + display: flex; + justify-content: center; } .counttittext{ - width: 130px; + text-align: left; + width: 1200px; height: 18px; color: #888888; font-size: 13px; margin-top: 24px; - padding-bottom: 17px; - margin-left: 343px; + } .counttittexts{ @@ -71,4 +74,44 @@ .mainx{ display: flex; 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; } \ No newline at end of file