From 1d1fa9752e758e80b9518862e563f75a3c7f925c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Fri, 19 Jul 2019 18:10:19 +0800 Subject: [PATCH 01/41] b --- public/react/src/common/hooks/ImageLayerHook.js | 7 ++++--- public/react/src/modules/user/LoginRegisterComponent.js | 4 ++-- public/react/src/search/SearchPage.js | 6 ++++-- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/public/react/src/common/hooks/ImageLayerHook.js b/public/react/src/common/hooks/ImageLayerHook.js index c9f0a14a4..f41cfb0d2 100644 --- a/public/react/src/common/hooks/ImageLayerHook.js +++ b/public/react/src/common/hooks/ImageLayerHook.js @@ -1,6 +1,7 @@ -import React, { useState, useEffect, memo } from 'react' -import ImageLayer from '../../modules/page/layers/ImageLayer' -import { isImageExtension } from 'educoder' +import React, { useState, useEffect, memo } from 'react'; +import ImageLayer from '../../modules/page/layers/ImageLayer'; +import { isImageExtension } from 'educoder'; +const $ = window.$; function ImageLayerHook(props) { const [showImage, setShowImage] = useState(false) const [imageSrc, setImageSrc] = useState('') diff --git a/public/react/src/modules/user/LoginRegisterComponent.js b/public/react/src/modules/user/LoginRegisterComponent.js index 0b4044711..03dbdb9e5 100644 --- a/public/react/src/modules/user/LoginRegisterComponent.js +++ b/public/react/src/modules/user/LoginRegisterComponent.js @@ -279,13 +279,13 @@ class LoginRegisterComponent extends Component { }).then((result) => { if(result){ if(result.data.status===-2){ - if(response.data.message==="验证码不正确"){ + if(result.data.message==="验证码不正确"){ this.setState({ Phonenumberisnotcosyzm:"验证码不正确", }) return; - }else if(response.data.message==="验证码已失效"){ + }else if(result.data.message==="验证码已失效"){ this.setState({ Phonenumberisnotcosyzm:"验证码不正确", }) diff --git a/public/react/src/search/SearchPage.js b/public/react/src/search/SearchPage.js index 14966b670..d9b2db7bb 100644 --- a/public/react/src/search/SearchPage.js +++ b/public/react/src/search/SearchPage.js @@ -1,11 +1,13 @@ import React,{ Component } from "react"; import {Checkbox,Input,Table, Pagination,Menu,Icon} from "antd"; +import {TPMIndexHOC} from "../modules/tpm/TPMIndexHOC"; import {Link,NavLink} from 'react-router-dom'; import { WordsBtn ,ActionBtn,SnackbarHOC,markdownToHTML,getImageUrl} from 'educoder'; -const Search = Input.Search; import axios from 'axios'; import './searchc.css' -import {TPMIndexHOC} from "../modules/tpm/TPMIndexHOC"; +const Search = Input.Search; + + class SearchPage extends Component{ constructor(props) { From 32f9ed1799c28c21e2932bde3b4e1bf9b9a613a4 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 18:28:46 +0800 Subject: [PATCH 02/41] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/tpm/NewHeader.js | 43 +++++++++++---------- public/react/src/search/SearchPage.js | 46 +++++++++++++++++------ public/react/src/search/searchc.css | 3 ++ 3 files changed, 61 insertions(+), 31 deletions(-) diff --git a/public/react/src/modules/tpm/NewHeader.js b/public/react/src/modules/tpm/NewHeader.js index 15360f6ec..3ea3c493c 100644 --- a/public/react/src/modules/tpm/NewHeader.js +++ b/public/react/src/modules/tpm/NewHeader.js @@ -118,22 +118,23 @@ function loadHeader(){ function header_search(reactHeaderComponnet){ console.log(old_url) var keyword = $("input[name='search_keyword']").val(); // 搜索关键字 - if (!reactHeaderComponnet) { - reactHeaderComponnet = window._header_componentHandler - } - if (!reactHeaderComponnet) { - var index = $("#search_type").val(); // 搜索课程/项目 - keyword = encodeURIComponent(keyword); - // $.get('/users/search_shixuns_or_course', - // { search: keyword, - // index: index}); - window.location.href = old_url+"/users/search_shixuns_or_courses" + "?search=" + keyword + "&index=" + index; + window.location.href ="/search"+"?value="+keyword; + // if (!reactHeaderComponnet) { + // reactHeaderComponnet = window._header_componentHandler + // } + // if (!reactHeaderComponnet) { + // var index = $("#search_type").val(); // 搜索课程/项目 + // keyword = encodeURIComponent(keyword); + // // $.get('/users/search_shixuns_or_course', + // // { search: keyword, + // // index: index}); + // window.location.href = old_url+"/users/search_shixuns_or_courses" + "?search=" + keyword + "&index=" + index; //e.stopPropagation();//阻止冒泡 - } else { - window.__headSearchKeyword = keyword - reactHeaderComponnet.props.history.push(`/shixuns`) - trigger('searchKeywordChange', keyword) - } + // } else { + // window.__headSearchKeyword = keyword + // reactHeaderComponnet.props.history.push(`/shixuns`) + // trigger('searchKeywordChange', keyword) + // } } //头部导航条的隐藏 function closeSearch(){ @@ -382,12 +383,14 @@ class NewHeader extends Component { header_search(this) } onKeywordSearchKeyDown = (e) => { - let code = e.keyCode; + + window.location.href ="/search"+"?value="+e.target.value; + // let code = e.keyCode; - if(code == 13) { - header_search(this); - return false; - } + // if(code == 13) { + // header_search(this); + // return false; + // } } hideAddcoursestypes=()=>{ diff --git a/public/react/src/search/SearchPage.js b/public/react/src/search/SearchPage.js index 14966b670..65130ba9b 100644 --- a/public/react/src/search/SearchPage.js +++ b/public/react/src/search/SearchPage.js @@ -13,7 +13,7 @@ class SearchPage extends Component{ this.state={ tab:"0", count:0, - keywords:"python", + keywords:"", type:"", page:1, perpages:20, @@ -22,11 +22,29 @@ class SearchPage extends Component{ } //切换tab changeTab=(e)=>{ - this.setState({ - tab:e.key - }) + console.log(e.key); + + let types =""; + if(parseInt(e.key)===0){ + types="course"; + } + if(parseInt(e.key)===1){ + types="shixun"; + } + if(parseInt(e.key)===2){ + types="subject"; + + } + if(parseInt(e.key)===3){ + types="memo"; + } + this.setState({ + tab:e.key, + type:types + }) + this.getdata(1,types,this.state.keywords); } componentDidMount(){ @@ -39,25 +57,31 @@ class SearchPage extends Component{ // this.setState({ // tab:sum, // }) - this.getdata(this.state.page); + let courstype=this.props.match.url; + courstype = courstype.split('?value='); + console.log(courstype); + this.getdata(this.state.page,this.state.type,this.state.keywords); } setdatafuns =(value)=>{ - + this.setState({ + keywords:value + }) + this.getdata(this.state.page,this.state.type,value); } paginationonChanges = (pageNumber) => { this.setState({ page: pageNumber, loadingstate: true, }) - this.getdata(pageNumber); + this.getdata(pageNumber,this.state.type,this.state.keywords); } //获取数据 - getdata=(pages)=>{ + getdata=(pages,type,keywords)=>{ let url = "/search.json"; axios.get(url,{params:{ - keyword:this.state.keywords, - type:this.state.types, + keyword:keywords, + type:type, page:pages, per_page:this.state.perpages, } @@ -106,7 +130,7 @@ class SearchPage extends Component{ JSON.stringify(data) === "[]" ?
-
+

没有数据可以显示!

diff --git a/public/react/src/search/searchc.css b/public/react/src/search/searchc.css index a3e9fafbd..e148505f3 100644 --- a/public/react/src/search/searchc.css +++ b/public/react/src/search/searchc.css @@ -114,4 +114,7 @@ } .tzbqx{ margin-left: 24px; +} +.bjyss{ + background: #F8F8F8; } \ No newline at end of file From d85d763143b9e51fc039bed9d28f1ed27aa316fc 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 19:53:45 +0800 Subject: [PATCH 03/41] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/search/SearchPage.js | 8 ++++---- public/react/src/search/searchc.css | 8 ++++++++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/public/react/src/search/SearchPage.js b/public/react/src/search/SearchPage.js index d2eb5ef93..4ce2939cb 100644 --- a/public/react/src/search/SearchPage.js +++ b/public/react/src/search/SearchPage.js @@ -204,7 +204,9 @@ class SearchPage extends Component{
- +
+ 主讲:{item.author_name}{item.author_school_name} 任务:{item.challenges_count===undefined?0:item.challenges_count} 学习人数:{item.study_count===undefined?0:item.study_count} +
@@ -219,9 +221,7 @@ class SearchPage extends Component{
-
- -
+ } diff --git a/public/react/src/search/searchc.css b/public/react/src/search/searchc.css index e148505f3..d228a2ba6 100644 --- a/public/react/src/search/searchc.css +++ b/public/react/src/search/searchc.css @@ -117,4 +117,12 @@ } .bjyss{ background: #F8F8F8; +} +.zj{ + overflow:hidden; + text-overflow:ellipsis; + white-space:nowrap +} +.ziticor{ + color: #777777; } \ No newline at end of file From 88d059aa1a0ccf154b92e861c7a40ee533989af4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Fri, 19 Jul 2019 19:54:14 +0800 Subject: [PATCH 04/41] =?UTF-8?q?=20=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/tpm/TPMIndex.css | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/public/react/src/modules/tpm/TPMIndex.css b/public/react/src/modules/tpm/TPMIndex.css index d55369370..655f58637 100644 --- a/public/react/src/modules/tpm/TPMIndex.css +++ b/public/react/src/modules/tpm/TPMIndex.css @@ -188,3 +188,7 @@ body>.-task-title { .HeaderSearch .ant-input-search .ant-input{ color: #fff; } + +.HeaderSearch .ant-input-search .ant-input-suffix{ + background: transparent !important; +} \ No newline at end of file From 8ec3869815e8bf7c2f397d0e6bf6233964344e0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Fri, 19 Jul 2019 20:39:51 +0800 Subject: [PATCH 05/41] =?UTF-8?q?=E6=90=9C=E7=B4=A2=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/App.js | 8 ++- public/react/src/modules/tpm/NewHeader.js | 5 +- .../src/modules/tpm/newshixuns/Newshixuns.js | 6 +- public/react/src/search/SearchPage.js | 55 ++++++++++++++----- 4 files changed, 55 insertions(+), 19 deletions(-) diff --git a/public/react/src/App.js b/public/react/src/App.js index 293d1baca..b7658450a 100644 --- a/public/react/src/App.js +++ b/public/react/src/App.js @@ -333,7 +333,13 @@ class App extends Component { {/*实训课程(原实训路径)*/} - + + () + } + > + {/*课堂*/} diff --git a/public/react/src/modules/tpm/NewHeader.js b/public/react/src/modules/tpm/NewHeader.js index 3ea3c493c..43152a074 100644 --- a/public/react/src/modules/tpm/NewHeader.js +++ b/public/react/src/modules/tpm/NewHeader.js @@ -384,7 +384,7 @@ class NewHeader extends Component { } onKeywordSearchKeyDown = (e) => { - window.location.href ="/search"+"?value="+e.target.value; + window.location.href ="/search?value="+e.target.value; // let code = e.keyCode; // if(code == 13) { @@ -709,6 +709,7 @@ submittojoinclass=(value)=>{ console.log(value)} + onPressEnter={this.onKeywordSearchKeyDown} style={{ width: 258 }} /> @@ -791,6 +792,8 @@ submittojoinclass=(value)=>{