竞赛列表页记录第几页

This commit is contained in:
unknown 2022-01-25 17:07:42 +08:00
parent f6ffe6357c
commit 5e98cebfd3
1 changed files with 20 additions and 4 deletions

View File

@ -17,10 +17,11 @@ for (const item of competitionStatus) {
// current_status 1 2 3 4 5 6
function Competition(props){
const {mygetHelmetapi, showNotification} = props;
const {mygetHelmetapi, showNotification, history} = props;
const {main_web_site_url} = mygetHelmetapi;
const {hash} = history && history.location;
const [loading, setLoading] = useState(false);
const [curPage, setCurPage] = useState(1);
const [curPage, setCurPage] = useState(hashDate(hash) || 1);
//
const [expertReview,setExpertReview] = useState(undefined);
//
@ -60,7 +61,7 @@ function Competition(props){
className="column-select"
showArrow
defaultValue={' '}
onChange={(value)=>{setExpertReview(value);setCurPage(1);}}
onChange={(value)=>{setExpertReview(value);updateUrl(1);}}
>
<Option key={' '} >专家评审</Option>
<Option key={true} >已提交评审</Option>
@ -259,6 +260,16 @@ function Competition(props){
})
}
// ,
function updateUrl(page){
setCurPage(page);
window.location.href=`/expert/admin/competition/#page=${page}`;
}
function hashDate(hash) {
return parseInt(hash.split("&")[0].substring(hash.split("&")[0].indexOf("=")+1));
}
//
useEffect(()=>{
setLoading(true);
@ -352,6 +363,11 @@ function Competition(props){
});
pulicReview && setPublicReview(false);
},[lookRules,lookExperts,pulicReview])
//hash
useEffect(()=>{
setCurPage(hashDate(hash) || 1);
},[hash])
return(
<div className="centerbox competitionList">
@ -360,7 +376,7 @@ function Competition(props){
dataSource={competitionList}
columns={columns}
total={total}
setCurPage={setCurPage}
setCurPage={(page)=>{updateUrl(page)}}
current={curPage}
/>
</div>