From b88c5b1faf89956cdd63211db3ec39a640ef022c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BD=95=E7=AB=A5=E5=B4=87?= Date: Thu, 3 Jun 2021 10:00:24 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AF=BC=E8=88=AA?= =?UTF-8?q?=E7=9A=84=E6=90=9C=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/Component/HeadSearch.jsx | 40 ++++++++++++++++++ src/forge/Component/SiderBar.js | 2 +- src/forge/Head/Header.js | 66 +++++++++++++++--------------- 3 files changed, 75 insertions(+), 33 deletions(-) create mode 100644 src/forge/Component/HeadSearch.jsx diff --git a/src/forge/Component/HeadSearch.jsx b/src/forge/Component/HeadSearch.jsx new file mode 100644 index 000000000..6a61e6445 --- /dev/null +++ b/src/forge/Component/HeadSearch.jsx @@ -0,0 +1,40 @@ +import React, { useState } from "react"; +import { Input ,notification} from "antd"; + +const { Search } = Input; +export default ({history}) => { + const [openSearch, setOpenSearch] = useState(false); + + function onGlobalSearch(value) { + history.push('/search?value=' + value); + // window.location.href = `search?value=` + value; + // history.push({ + // pathname:'/search', + // state:value + // }) + } + return ( + + { + openSearch ? +
{ + setTimeout(() => { + setOpenSearch(false) + }, 500) + }} + > + +
+ : + { + setOpenSearch(true) + }} /> + } +
+ ) +}; diff --git a/src/forge/Component/SiderBar.js b/src/forge/Component/SiderBar.js index 8267959ba..3d6b8acf8 100644 --- a/src/forge/Component/SiderBar.js +++ b/src/forge/Component/SiderBar.js @@ -43,7 +43,7 @@ function SiderBar() { { list && list.map((i,k)=>{ return( -
  • {i.question}
  • +
  • {i.question}
  • ) }) } diff --git a/src/forge/Head/Header.js b/src/forge/Head/Header.js index 4d55f824c..f3b69c4ea 100644 --- a/src/forge/Head/Header.js +++ b/src/forge/Head/Header.js @@ -5,7 +5,8 @@ import axios from 'axios'; import { Modal, Input, message, notification , Dropdown , Menu } from 'antd'; import LoginDialog from '../../modules/login/LoginDialog'; -import GotoQQgroup from '../../modal/GotoQQgroup' +import GotoQQgroup from '../../modal/GotoQQgroup'; +import HeadSearch from '../Component/HeadSearch'; import '../../modules/tpm/TPMIndex.css'; import logo from '../../modules/tpm/images/logo.png'; @@ -81,35 +82,35 @@ class NewHeader extends Component { } catch (e) {} } - SearchInput = (open,item)=>{ - if(open){ - return( -
    { - setTimeout(() => { - this.setState({ - openSearch:false - }) - }, 300) - }} - > - this.onGlobalSearch(value,item)} - autoFocus={true} - /> -
    - ) - }else{ - return { - this.setState({openSearch:true}) - }} /> - } - } + // SearchInput = (open,item)=>{ + // if(open){ + // return( + //
    { + // setTimeout(() => { + // this.setState({ + // openSearch:false + // }) + // }, 300) + // }} + // > + // this.onGlobalSearch(value,item)} + // autoFocus={true} + // /> + //
    + // ) + // }else{ + // return { + // this.setState({openSearch:true}) + // }} /> + // } + // } - onGlobalSearch=(value,item)=>{ - window.location.href=`${item}?value=` + value; - } + // onGlobalSearch=(value,item)=>{ + // window.location.href=`${item}?value=` + value; + // } openNotification = (messge) => { notification.open({ @@ -329,7 +330,7 @@ class NewHeader extends Component { { list.map((item,key)=>{ return( - (item.name !=="加入课堂" && item.name !=="加入开发项目") && {item.name} + (item.name !=="加入课堂" && item.name !=="加入开发项目") && {item.name} ) }) } @@ -434,7 +435,7 @@ class NewHeader extends Component { }) } - let search_url = settings && settings.common && settings.common.search; + // let search_url = settings && settings.common && settings.common.search; let notice_url = settings && settings.common && settings.common.notice; return (
    @@ -503,7 +504,8 @@ class NewHeader extends Component { }
    - {search_url ? this.SearchInput(openSearch,search_url):""} + {/* {search_url ? this.SearchInput(openSearch,search_url):""} */} + { current_user && (current_user.main_site || current_user.login) && (settings && settings.add && settings.add.length>0)? -- 2.34.1 From af6f90525b3dc178a2875dc9f0ea626f07bf6996 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BD=95=E7=AB=A5=E5=B4=87?= Date: Tue, 8 Jun 2021 16:08:06 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=90=9C=E7=B4=A2placepl?= =?UTF-8?q?aceholder?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/Component/HeadSearch.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/forge/Component/HeadSearch.jsx b/src/forge/Component/HeadSearch.jsx index 6a61e6445..f71fb014e 100644 --- a/src/forge/Component/HeadSearch.jsx +++ b/src/forge/Component/HeadSearch.jsx @@ -24,7 +24,7 @@ export default ({history}) => { }, 500) }} > -