From dc55deda6f3cec7afa0b269c881c048fa5ace157 Mon Sep 17 00:00:00 2001 From: wwl Date: Fri, 15 Mar 2024 18:21:22 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E6=B4=BB=E5=8A=A8=E7=A7=BB=E8=87=B3?= =?UTF-8?q?=E9=A6=96=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/sp-page/index.js | 1 - src/pages/home/index.scss | 38 +++++++++++++++++++++++ src/pages/index.js | 54 ++++++++++++++++++++++++++------- src/pages/recommend/list.js | 34 ++++++++++++--------- 4 files changed, 100 insertions(+), 27 deletions(-) diff --git a/src/components/sp-page/index.js b/src/components/sp-page/index.js index 3175f3b..3bd1bcf 100755 --- a/src/components/sp-page/index.js +++ b/src/components/sp-page/index.js @@ -359,7 +359,6 @@ function SpPage (props, ref) { "--nav-height": `${gNavbarH}px`, "--status-bar-height": `${gStatusBarHeight}px`, "--area-bottom-height": `${gAreaH}rpx`, - "$page-ipx-footer-height": `${gAreaH}px`, })} ref={wrapRef} > diff --git a/src/pages/home/index.scss b/src/pages/home/index.scss index 50e92b0..b1cd05d 100755 --- a/src/pages/home/index.scss +++ b/src/pages/home/index.scss @@ -183,6 +183,44 @@ page { height: 100%; } } + .item-btns { + display: flex; + flex-direction: column; + align-items: flex-start; + position: absolute; + left: 66px; + bottom: 170px; + z-index: 10; + // justify-content: flex-start; + .item-tit { + font-size: 42px; + font-weight: bold; + margin-bottom: 36px; + color: #fff; + } + .item-btn { + // width: 180px; + // height: 56px; + padding: 30px 70px 30px 90px; + color: #fff; + font-size: 28px; + border-radius: 10px; + background-color: #00000085; + border-width: 2px; + border-style: solid; + border-color: #fff; + display: flex; + justify-content: center; + align-items: center; + font-size: 22px; + line-height: 1; + .icon-my { + font-size: 28px; + font-weight: bold; + margin-left: 16px; + } + } + } } .shop-box { height: 520px; diff --git a/src/pages/index.js b/src/pages/index.js index c1f535c..76a2772 100755 --- a/src/pages/index.js +++ b/src/pages/index.js @@ -103,7 +103,8 @@ const initialState = { }, ], goodList: [], - recommend: [] + recommend: [], + activeInfo: {} } function Home () { @@ -238,6 +239,12 @@ function Home () { } const getSwiperList = async () => { + const { status, activity_info = {}, total_count } = await api.user.registrationActivity({ activity_id: 1 }) + const activeSwiper = activity_info.pics.map(item => ({ + type: 'image', + src: item, + goods: [] + })) const res = await api.shop.homeSwiperList({ page: 1, pageSize: 999 }) const list = res?.list?.map((item) => { return { @@ -258,8 +265,13 @@ function Home () { } }) || [] setState((draft) => { - draft.swiperList = list + draft.swiperList = [...activeSwiper, ...list] draft.goodList = list[0].goods || [] + draft.activeInfo = { + ...activity_info, + total_count, + status + } }) } @@ -353,6 +365,7 @@ function Home () { const deltaX = clientX - startX if (Math.abs(deltaY) < 50) return + console.log("🚀 ~ deltaY:", deltaY) if (deltaY > 0) { // 下滑操作 setState((draft) => { @@ -367,6 +380,7 @@ function Home () { }, 500) } } else if (deltaY < 0) { + if (currentIndex === 0) return // 上滑操作 setState((draft) => { draft.showBottom = true @@ -396,7 +410,17 @@ function Home () { }) } + const { activeInfo = {}, currentIndex } = state + const handleApply = () => { + let url = '/pages/recommend/detail?id=' + if (activeInfo.total_count) { + url = `/pages/recommend/status?id=` + } + Taro.navigateTo({ + url: url + activeInfo.activity_id + }) + } return ( ))} - {!isUpOperation && - 滑 动 探 索 - - } - {!isUpOperation && - {swiperList.map((_, index) => ( - - ))} - } + {!isUpOperation && <> + {currentIndex === 0 ? + {activeInfo.activity_name} + {activeInfo.end_time * 1000 >= Date.now() && + {activeInfo.total_count ? '已报名' : '活动申请'} + } + : + + 滑 动 探 索 + + } + + {swiperList.map((_, index) => ( + + ))} + + } {isUpOperation && } diff --git a/src/pages/recommend/list.js b/src/pages/recommend/list.js index ad9f502..9d59ab0 100755 --- a/src/pages/recommend/list.js +++ b/src/pages/recommend/list.js @@ -96,17 +96,17 @@ export default class RecommendList extends Component { // this.setState({ // list: [] // }) - // setTimeout(() => { - // // this.nextPage() - // // Taro.hideLoading() - // this.setState({ - // page: { - // isLoading: false - // } - // }) - // }, 200) + setTimeout(() => { + // this.nextPage() + // Taro.hideLoading() + this.setState({ + page: { + isLoading: false + } + }) + }, 300) // this.praiseNum() - this.getActiveDetail() + // this.getActiveDetail() } onShareAppMessage () { @@ -642,7 +642,7 @@ export default class RecommendList extends Component { const height = windowWidth * 9 / 17 return ( - } loading={page.isLoading} className='has-nav' title="" isBlack isTop> + } loading={page.isLoading} className='has-nav' title="" isBlack > {false && <> @@ -777,7 +777,9 @@ export default class RecommendList extends Component { )} } - {/* {page.isLoading ? : + + {/* 鞋床故事 */} + {page.isLoading ? : - } */} - {page.isLoading ? : + } + + {/* 活动部分 */} + {/* {page.isLoading ? : - } + } */}