From 7d4dcf52ab1724338f37cde724b9287a472b041c Mon Sep 17 00:00:00 2001 From: xixi <123@qq.com> Date: Thu, 1 Aug 2024 13:25:33 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/card/CardProj.tsx | 2 +- src/components/list/ListProj.tsx | 19 ++++++-- src/route/index/Index.tsx | 79 ++++++++++++++++++-------------- 3 files changed, 59 insertions(+), 41 deletions(-) diff --git a/src/components/card/CardProj.tsx b/src/components/card/CardProj.tsx index 1d2c55f..7feb11f 100644 --- a/src/components/card/CardProj.tsx +++ b/src/components/card/CardProj.tsx @@ -210,7 +210,7 @@ export default function CardProj(props: any) {
{ diff --git a/src/components/list/ListProj.tsx b/src/components/list/ListProj.tsx index 4bf938f..b9c00ae 100644 --- a/src/components/list/ListProj.tsx +++ b/src/components/list/ListProj.tsx @@ -29,7 +29,7 @@ export default function ListProj() { // // setKeywords(state.keyword) // } const keywords = state ? state.keyword : '' - const name = state ? state.name : '' + const type = state ? state.type : '' const chargeAdditionals = state ? state.chargeAdditionals : '' const tagDataId = state ? state.tagDataId : '' @@ -61,7 +61,7 @@ export default function ListProj() { page: currentPage, rows: 10, keywords: keywords, - charge: name, + charge: type, chargeAdditionals: chargeAdditionals, tagDataId: tagDataId, authorId: authorId, @@ -74,7 +74,8 @@ export default function ListProj() { }, onSuccess({ data }) { // console.log('数据', data); - + console.log('得到数据'); + setPage(data.page); setTotal(data.total); setProjs(data.rows); @@ -119,6 +120,8 @@ export default function ListProj() { } useEffect(()=>{ getTag() + // console.log('这啥啊',indexListContext.categoryChangeCount); + // console.log('这啥啊2',indexListContext.category) },[]) // 更新数据 // const upreqData = () => { @@ -197,15 +200,21 @@ export default function ListProj() { setTimeout(() => { setShowPage(true) }, 0); - }, [indexListContext.status, keywords, name, chargeAdditionals, tagDataId, authorId]) + + + }, [indexListContext.status, keywords, type, chargeAdditionals, tagDataId, authorId]) useEffect(() => { - reqData(page); + // reqData(page); //注释掉了 不知道者干嘛的 写上之后刷新要两次才不掉状态 // if (indexListContext.categorys) { // reqData(page); // // renderCategory(); // } + // alert(1) + // console.log('什么玩意',indexListContext.categoryChangeCount); + // console.log('什么玩意',indexListContext.category); + }, [indexListContext.categoryChangeCount, indexListContext.category]) // const renderStatus = () => { diff --git a/src/route/index/Index.tsx b/src/route/index/Index.tsx index 8cdc33f..7659a3b 100644 --- a/src/route/index/Index.tsx +++ b/src/route/index/Index.tsx @@ -449,7 +449,6 @@ export default function Index() { getProjOwnerList() getTag() }, []); - useEffect(() => { // console.log('监听', '类型:', type, '关键字:', keywords, '额外付费:', chargeAdditionals,'进度:',tagDataId); // console.log(Boolean(keywords)); @@ -474,30 +473,43 @@ export default function Index() { // } // console.log('监听',Boolean(authorId)); if (location.pathname.includes('/home')) { - if (!keywords && !type && !chargeAdditionals && !tagDataId && !authorId) { - nav('/home', { - state: { - keyword: '', - name: '', - chargeAdditionals: '', - tagDataId: '', - authorId: '' - } - }) - } else { - nav('/home', { - state: { - keyword: keywords, - name: type, - chargeAdditionals: chargeAdditionals, - tagDataId: tagDataId, - authorId: authorId - } - }) - } + // if (!keywords && !type && !chargeAdditionals && !tagDataId && !authorId) { + // init() + // nav('/home', { + // state: { + // keyword: '', + // name: '', + // chargeAdditionals: '', + // tagDataId: '', + // authorId: '' + // } + // }) + + // } else { + // nav('/home', { + // state: { + // keyword: keywords, + // name: type, + // chargeAdditionals: chargeAdditionals, + // tagDataId: tagDataId, + // authorId: authorId + // } + // }) + // } + nav('/home', { + state: { + keyword: keywords, + type: type, + chargeAdditionals: chargeAdditionals, + tagDataId: tagDataId, + authorId: authorId + } + }) } // } - + console.log('type',type); + console.log('chargeAdditionals',chargeAdditionals); + }, [type, chargeAdditionals, keywords, tagDataId, authorId]); const handleSearch = (value: string) => { @@ -506,7 +518,7 @@ export default function Index() { nav('/home', { state: { keyword: value, - name: type, + type: type, chargeAdditionals: chargeAdditionals, tagDataId: tagDataId, authorId: authorId @@ -522,7 +534,7 @@ export default function Index() { nav('/home', { state: { keyword: '', - name: type, + type: type, chargeAdditionals: chargeAdditionals, tagDataId: tagDataId, authorId: authorId @@ -569,7 +581,7 @@ export default function Index() { nav('/home', { state: { keyword: keywords, - name: type, + type: type, chargeAdditionals: chargeAdditionals, tagDataId: tagDataId, authorId: '' @@ -580,7 +592,7 @@ export default function Index() { nav('/home', { state: { keyword: keywords, - name: type, + type: type, chargeAdditionals: chargeAdditionals, tagDataId: tagDataId, authorId: item.projOwnerId @@ -688,15 +700,12 @@ export default function Index() { value={type} style={{ height: '31px', width: '183px', marginLeft: 20, display: showSearchBox ? 'block' : 'none' }} onChange={(value: string) => { - // console.log(`selected ${value}`); setType(value) - // alert(`selected ${value}`) - // lyp nav('/home', { state: { keyword: keywords, + type: value, chargeAdditionals: chargeAdditionals, - name: value, tagDataId: tagDataId, authorId: authorId } @@ -725,7 +734,7 @@ export default function Index() { nav('/home', { state: { keyword: keywords, - name: type, + type: type, chargeAdditionals: value, tagDataId: tagDataId, authorId: authorId @@ -754,7 +763,7 @@ export default function Index() { nav('/home', { state: { keyword: keywords, - name: type, + type: type, chargeAdditionals: chargeAdditionals, tagDataId: value, authorId: authorId @@ -810,7 +819,7 @@ export default function Index() { nav('/home', { state: { keyword: keywords, - name: type, + type: type, chargeAdditionals: chargeAdditionals, tagDataId: tagDataId, authorId: authorId @@ -834,7 +843,7 @@ export default function Index() { nav('/home', { state: { keyword: keywords, - name: type, + type: type, chargeAdditionals: chargeAdditionals, tagDataId: tagDataId, authorId: authorId