顶部导航栏搜索框还原
This commit is contained in:
parent
4e18d13b6b
commit
fe0fab7b61
|
@ -1,21 +1,41 @@
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { Input} from "antd";
|
import { Input ,notification} from "antd";
|
||||||
import './Component.scss';
|
|
||||||
|
|
||||||
|
const { Search } = Input;
|
||||||
export default ({history}) => {
|
export default ({history}) => {
|
||||||
const [searchValue, setSearchValue] = useState("");
|
const [openSearch, setOpenSearch] = useState(false);
|
||||||
|
|
||||||
function onGlobalSearch(e) {
|
function onGlobalSearch(value) {
|
||||||
window.location.href = `/search?value=${e.target.value}`;
|
history.push('/search?value=' + value);
|
||||||
|
// window.location.href = `search?value=` + value;
|
||||||
|
// history.push({
|
||||||
|
// pathname:'/search',
|
||||||
|
// state:value
|
||||||
|
// })
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
<div className="headSerach aboutSubTitle" onBlur={()=>{setTimeout(() => {
|
{
|
||||||
setSearchValue("");
|
openSearch ?
|
||||||
}, 500)}}>
|
<div
|
||||||
<i className = "iconfont icon-bianzu11 font-15" onClick={()=>onGlobalSearch({target:{value:searchValue}})}></i>
|
onBlur={() => {
|
||||||
<Input placeholder="请输入搜索关键字" onPressEnter={onGlobalSearch} onChange={(value)=>setSearchValue(value.target.value)} value={searchValue}></Input>
|
setTimeout(() => {
|
||||||
|
setOpenSearch(false)
|
||||||
|
}, 500)
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Search placeholder="请输入搜索关键字"
|
||||||
|
className={`search-input mr20`}
|
||||||
|
onSearch={onGlobalSearch}
|
||||||
|
autoFocus={true}
|
||||||
|
style={{width:'260px'}}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
:
|
||||||
|
<i className="iconfont icon-sousuo font-18 ml30" onClick={() => {
|
||||||
|
setOpenSearch(true)
|
||||||
|
}} />
|
||||||
|
}
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
|
@ -34,14 +34,10 @@ function Login(props){
|
||||||
} else {
|
} else {
|
||||||
//判断用户是否选择【下次自动登录】
|
//判断用户是否选择【下次自动登录】
|
||||||
cookie.save('autologin',values.remember);
|
cookie.save('autologin',values.remember);
|
||||||
if(search){
|
|
||||||
const searchParams = new URLSearchParams(search.substring(1));
|
const searchParams = new URLSearchParams(search.substring(1));
|
||||||
const goPage = searchParams.get("go_page");
|
const goPage = searchParams.get("go_page");
|
||||||
//意见反馈
|
//意见反馈
|
||||||
goPage && (window.location.href = goPage);
|
window.location.href = goPage ? goPage : `/${response.data.login}`
|
||||||
return;
|
|
||||||
}
|
|
||||||
window.location.href = "/"+response.data.login;
|
|
||||||
}
|
}
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
console.log('error',error);
|
console.log('error',error);
|
||||||
|
|
Loading…
Reference in New Issue