diff --git a/src/forge/Images/emp.png b/src/forge/Images/emp.png new file mode 100644 index 00000000..5db7c077 Binary files /dev/null and b/src/forge/Images/emp.png differ diff --git a/src/forge/Issues/Pages/list.jsx b/src/forge/Issues/Pages/list.jsx index 5a690b4c..bc177ec8 100644 --- a/src/forge/Issues/Pages/list.jsx +++ b/src/forge/Issues/Pages/list.jsx @@ -81,12 +81,12 @@ function List(props){ useEffect(()=>{ let v = allValue && allValue > 0; - if((updateIds && !v && (updateIds.author_id || updateIds.issue_priorities_id || updateIds.issue_tag_ids || updateIds.milestone_id || updateIds.sort_by || updateIds.status_id ||updateIds.assigner_id)) || value || end_date || begin_date){ + if((updateIds && !v && (updateIds.author_id || updateIds.issue_priorities_id || updateIds.issue_tag_ids || updateIds.milestone_id || updateIds.sort_by || updateIds.status_id ||updateIds.assigner_id)) || value || end_date || begin_date || aboutMe !=="all"){ setClearFlag(true); }else{ setClearFlag(false); } - },[updateIds,value,allValue,begin_date,end_date]) + },[updateIds,value,allValue,begin_date,end_date,aboutMe]) // 自定义一个初始不更新的hook const useUpdateEffect = (fn, inputs) => { const didMountRef = useRef(false); diff --git a/src/modules/search/index.jsx b/src/modules/search/index.jsx index 65f270ab..9450d1c5 100644 --- a/src/modules/search/index.jsx +++ b/src/modules/search/index.jsx @@ -1,11 +1,12 @@ import React, { useEffect, useState } from 'react'; -import { Input, Row, Col, Tabs, Pagination } from 'antd'; +import { Input, Row, Col, Tabs, Pagination , Icon } from 'antd'; import axios from 'axios'; import { TPMIndexHOC } from '../tpm/TPMIndexHOC'; import { SnackbarHOC } from 'educoder'; import ItemList from './ItemList'; import Nodata from '../../forge/Nodata'; import './index.scss'; +import emp from '../../forge/Images/emp.png'; const { Search } = Input; const { TabPane } = Tabs; @@ -23,7 +24,7 @@ const GlobalSearch = ({ location, showNotification, history, mygetHelmetapi }) = const [total, setTotal] = useState(0); const [dataList, setDataList] = useState([]); - const [ orderBy , setOrderBy ] = useState(undefined); + const [ orderBy , setOrderBy ] = useState("scoreDesc"); const [forcesearch, setForcesearch] = useState(false); @@ -46,7 +47,11 @@ const GlobalSearch = ({ location, showNotification, history, mygetHelmetapi }) = useEffect(() => { searchDataList(); - }, [type, page, term, forcesearch,orderBy]); + }, [type, term, forcesearch,orderBy,page]); + + useEffect(()=>{ + setPage(1); + },[orderBy]) useEffect(() => { if (ref) { @@ -119,6 +124,8 @@ const GlobalSearch = ({ location, showNotification, history, mygetHelmetapi }) = setPage(1); if(type !== "1"){ setOrderBy(undefined); + }else{ + setOrderBy("scoreDesc"); } } @@ -129,6 +136,34 @@ const GlobalSearch = ({ location, showNotification, history, mygetHelmetapi }) = }) }, [history]); + const svg = ()=>( + + + + ) + + const descSvg = ()=>( + + + + ) + + const ascSvg = ()=>( + + + + ) + + function iconSwitch(array){ + if(array === "desc"){ + return + }else if(array === "asc"){ + return + }else{ + return + } + } + return ( @@ -156,12 +191,22 @@ const GlobalSearch = ({ location, showNotification, history, mygetHelmetapi }) =
    -
  • setOrderBy(orderBy === "scoreDesc" ? "scoreAsc" :"scoreDesc")}>匹配度
  • -
  • setOrderBy(orderBy === "watchDesc" ? "watchAsc" :"watchDesc")}>关注数
  • -
  • setOrderBy(orderBy === "forkDesc" ? "forkAsc" :"forkDesc")}>Fork数
  • -
  • setOrderBy(orderBy === "starDesc" ? "starAsc" :"starDesc")}>点赞数
  • -
  • setOrderBy(orderBy === "updateTimeDesc" ? "updateTimeAsc" :"updateTimeDesc")}>更新时间
  • -
  • setOrderBy(orderBy === "createTimeDesc" ? "createTimeAsc" :"createTimeDesc")}>创建时间
  • +
  • setOrderBy("scoreDesc")}>匹配度
  • +
  • setOrderBy(orderBy === "watchDesc" ? "watchAsc" :"watchDesc")}> + 关注数{iconSwitch(orderBy === "watchDesc" ? "desc" : orderBy === "watchAsc" ? "asc" :"")} +
  • +
  • setOrderBy(orderBy === "forkDesc" ? "forkAsc" :"forkDesc")}> + Fork数{iconSwitch(orderBy === "forkDesc" ? "desc" : orderBy === "forkAsc" ? "asc" :"")} +
  • +
  • setOrderBy(orderBy === "starDesc" ? "starAsc" :"starDesc")}> + 点赞数{iconSwitch(orderBy === "starDesc" ? "desc" : orderBy === "starAsc" ? "asc" :"")} +
  • +
  • setOrderBy(orderBy === "updateTimeDesc" ? "updateTimeAsc" :"updateTimeDesc")}> + 更新时间{iconSwitch(orderBy === "updateTimeDesc" ? "desc" : orderBy === "updateTimeAsc" ? "asc" :"")} +
  • +
  • setOrderBy(orderBy === "createTimeDesc" ? "createTimeAsc" :"createTimeDesc")}> + 创建时间{iconSwitch(orderBy === "createTimeDesc" ? "desc" : orderBy === "createTimeAsc" ? "asc" :"")} +

{`找到${totalType1}条结果`}

`共 ${total} 条`} />
- : + :
}
@@ -192,7 +237,7 @@ const GlobalSearch = ({ location, showNotification, history, mygetHelmetapi }) = dataList.length ?
size} - onChange={(page) => { setPage(page) }} + onChange={(page) => { setPage(page); }} current={page} total={total} showTotal={total => `共 ${total} 条`} @@ -249,7 +294,7 @@ const GlobalSearch = ({ location, showNotification, history, mygetHelmetapi }) = dataList.length ?
size} - onChange={(page) => { setPage(page) }} + onChange={(page) => { setPage(page);}} current={page} total={total} showTotal={total => `共 ${total} 条`}