diff --git a/public/favicon.ico b/public/favicon.ico old mode 100755 new mode 100644 index 05b9d163e..75a4c3dfd Binary files a/public/favicon.ico and b/public/favicon.ico differ diff --git a/src/modules/search/index.jsx b/src/modules/search/index.jsx index 753a7107c..ee3b40b5f 100644 --- a/src/modules/search/index.jsx +++ b/src/modules/search/index.jsx @@ -12,14 +12,17 @@ const { TabPane } = Tabs; // const https = 'http://192.168.0.77:8081'; //曾伟内网后台 // const https = 'http://192.168.31.104:8081'; //曾伟外网后台 -const https='http://106.75.31.211:58081'; +// const https='http://106.75.31.211:58081'; +const https = 'https://test-statistics.trustie.net'; -const GlobalSearch = ({ location, showNotification }) => { +const GlobalSearch = ({ location, showNotification, history }) => { const size = 10; let defaultValue = decodeURI(location.search.split("=")[1] || ""); const [term, setTerm] = useState(defaultValue); + const [searchValue, setSearchValue] = useState(defaultValue); + const [type, setType] = useState(1); const [page, setPage] = useState(1); const [total, setTotal] = useState(0); @@ -31,6 +34,7 @@ const GlobalSearch = ({ location, showNotification }) => { const [totalType2, setTotalType2] = useState(0); const [totalType3, setTotalType3] = useState(0); const [totalType4, setTotalType4] = useState(0); + const [totalType5, setTotalType5] = useState(0); useEffect(() => { @@ -50,6 +54,10 @@ const GlobalSearch = ({ location, showNotification }) => { function searchDataList() { const url = https + '/search'; + if (!term) { + showNotification('请输入关键字'); + return; + } axios.defaults.withCredentials = true; axios.get(url, { params: { @@ -72,6 +80,8 @@ const GlobalSearch = ({ location, showNotification }) => { setTotalType3(item.count); } else if (item.type == 4) { setTotalType4(item.count); + } else if (item.type == 5) { + setTotalType5(item.count); } } } else if (res && res.data) { @@ -96,7 +106,11 @@ const GlobalSearch = ({ location, showNotification }) => { setPage(1); } - + useEffect(() => { + history.listen(historyLocation => { + setSearchValue(historyLocation.search.split("=")[1] || ""); + }) + }, [history]); return (
{`找到${totalType2}条结果`}
{`找到${totalType3}条结果`}
{`找到${totalType5}条结果`}
+