From b60efdbdb3c675bc632d9a6f8ac16658a2b45c1d Mon Sep 17 00:00:00 2001 From: yujialong <479214531@qq.com> Date: Tue, 22 Oct 2024 15:14:11 +0800 Subject: [PATCH] fix --- src/pages/SingleDetail/index.tsx | 13 ++++++------- src/pages/Subscribe/index.config.ts | 2 +- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/pages/SingleDetail/index.tsx b/src/pages/SingleDetail/index.tsx index db302f2..35056bd 100644 --- a/src/pages/SingleDetail/index.tsx +++ b/src/pages/SingleDetail/index.tsx @@ -65,6 +65,7 @@ export default function SingleDetail() { const [singleDetail, setsingleDetail] = useState() + const [isVideo, setisVideo] = useState(false) const [isListenBook, setisListenBook] = useState(false) useLoad((query) => { @@ -122,9 +123,8 @@ export default function SingleDetail() { success: (res) => { console.log('产品资源获取成功=>', res.data) - if(res.data.data.StoryResource.length > 0){ - setisListenBook(true) - } + res.data.data.StoryResource.length && setisListenBook(true) + res.data.data.Resource.length && setisVideo(true) }, fail: (err) => { console.log('产品资源获取失败=>', err) @@ -142,9 +142,8 @@ export default function SingleDetail() { success: (res) => { console.log('产品资源获取成功=>', res.data) - if(res.data.data.StoryResource.length > 0){ - setisListenBook(true) - } + res.data.data.StoryResource.length && setisListenBook(true) + res.data.data.Resource.length && setisVideo(true) }, fail: (err) => { console.log('产品资源获取失败=>', err) @@ -264,7 +263,7 @@ export default function SingleDetail() { className='single_tabbar_item' key={index} onClick={() => handleNavigateTo(item.url)} - style={( item.tabIndex === 2 && !isListenBook ) ? {display: 'none'} : {}} + style={( (item.tabIndex === 1 && !isVideo) || (item.tabIndex === 2 && !isListenBook) ) ? {display: 'none'} : {}} >