From 50c331d79900699282e7cc590e7a02f871879c6a Mon Sep 17 00:00:00 2001 From: yujialong <479214531@qq.com> Date: Tue, 12 Nov 2024 15:09:15 +0800 Subject: [PATCH] fix --- src/pages/Subscribe/index.less | 23 +++++++++++++++ src/pages/Subscribe/index.tsx | 54 ++++++++++++++++++++++++++++------ 2 files changed, 68 insertions(+), 9 deletions(-) diff --git a/src/pages/Subscribe/index.less b/src/pages/Subscribe/index.less index 9859eeb..3b59406 100644 --- a/src/pages/Subscribe/index.less +++ b/src/pages/Subscribe/index.less @@ -208,6 +208,29 @@ background-color: #fcca1e; } + .expire { + position: absolute; + top: 0; + left: 0; + display: flex; + justify-content: center; + align-items: center; + width: 100%; + height: 100%; + background-color: rgba(0, 0, 0, .6); + .expire_icon { + position: absolute; + top: .3rem; + right: .3rem; + width: 1.5rem; + height: 1.5rem; + } + .expire_text { + font-size: .8rem; + color: #f00; + } + } + .subscribe_content_singleItem_cover { width: 100%; height: 5.8rem; diff --git a/src/pages/Subscribe/index.tsx b/src/pages/Subscribe/index.tsx index 7562c8f..0fba1d2 100644 --- a/src/pages/Subscribe/index.tsx +++ b/src/pages/Subscribe/index.tsx @@ -118,6 +118,7 @@ export default function Subscribe() { if(!singleArr.some((arr_item : any) => arr_item === sec_item)){ sec_item.isFree = 0 + sec_item.MallLink = item.MallLink || '' singleArr.push(sec_item) c++ } @@ -187,6 +188,7 @@ export default function Subscribe() { if(!singleArr.some((arr_item : any) => arr_item === sec_item)){ sec_item.isFree = 0 + sec_item.MallLink = item.MallLink || '' singleArr.push(sec_item) } } @@ -282,6 +284,7 @@ export default function Subscribe() { if(!singleArr.some((arr_item : any) => arr_item.PrdtId === sec_item.PrdtId)){ sec_item.isFree = 0 + sec_item.MallLink = item.MallLink || '' singleArr.push(sec_item) c++ } @@ -370,6 +373,9 @@ export default function Subscribe() { const [isPopupOpen, setisPopupOpen] = useState(false) + //管理跳转页面路径 + const [prdtMallLink, setprdtMallLink] = useState('') + const [isToStoreOpen, setisToStoreOpen] = useState(false) const [userScene, setuserScene] = useState(null) @@ -427,10 +433,24 @@ export default function Subscribe() { }) } - //跳转详情页 + //跳转套装详情页 const handleToCollectionDetail = (item: any) => { + if (item.SubscribedState === -1) { + // 已过期,跳转商城 + setprdtMallLink(item.MallLink || '') + setisToStoreOpen(true) + } else { + Taro.navigateTo({ + url: '/pages/CollectionDetail/index?id=' + item.PrdtId + }) + } + } + + // 套装删除 + const handleDelCollection = (item: any) => { if (item.SubscribedState === -1) { // 已过期,直接删除 + debugger Taro.request({ url: 'https://interapi.jm-kid.com/api/mark/subscribed', method: 'POST', @@ -445,16 +465,27 @@ export default function Subscribe() { requestUserSubscribe() }, }) + } + } + + // 单本跳转详情 + const handleToSingleDetail = (item: any) => { + if (item.SubscribedState === -1) { + // 已过期,跳转商城 + setprdtMallLink(item.MallLink || '') + setisToStoreOpen(true) } else { Taro.navigateTo({ - url: '/pages/CollectionDetail/index?id=' + item.PrdtId + url: '/pages/SingleDetail/index?id=' + item.PrdtId }) } } - const handleToSingleDetail = (item: any) => { + // 单本删除 + const handleDelSingle = (item: any) => { if (item.SubscribedState === -1) { // 已过期,直接删除 + debugger Taro.request({ url: 'https://interapi.jm-kid.com/api/mark/subscribed', method: 'POST', @@ -469,10 +500,6 @@ export default function Subscribe() { requestUserSubscribe() }, }) - } else { - Taro.navigateTo({ - url: '/pages/SingleDetail/index?id=' + item.PrdtId - }) } } @@ -603,7 +630,7 @@ export default function Subscribe() { { item.SubscribedState === -1 && ( - + handleDelSingle(item)}> 已 过 期 ) @@ -635,6 +662,14 @@ export default function Subscribe() { mode='widthFix' lazyLoad > + { + item.SubscribedState === -1 && ( + + handleDelCollection(item)}> + 已 过 期 + + ) + } { item.isFree === 1 && 免费绘本 } @@ -712,7 +747,8 @@ export default function Subscribe() { visible={isToStoreOpen} onClose={() => setisToStoreOpen(false)} type={1} - setmallLink={(link: string) => {}} + mallLink={prdtMallLink} + setmallLink={setprdtMallLink} >