首页轮播图跳转公众号

main
wwl 2024-04-26 09:44:14 +08:00
parent f1be6694c0
commit 6d4ab29b2e
7 changed files with 83 additions and 29 deletions

View File

@ -1,8 +1,8 @@
APP_BASE_URL=https://slb.birkenstock.net.cn/api/h5app/wxapp APP_BASE_URL=https://test.birkenstock.net.cn/api/h5app/wxapp
APP_WEBSOCKET=wss://slb.birkenstock.net.cn/ws APP_WEBSOCKET=wss://test.birkenstock.net.cn/ws
APP_COMPANY_ID=1 APP_COMPANY_ID=1
APP_PLATFORM=standard APP_PLATFORM=standard
APP_CUSTOM_SERVER=https://slb.birkenstock.net.cn/ APP_CUSTOM_SERVER=https://test.birkenstock.net.cn/
APP_HOME_PAGE=/pages/index APP_HOME_PAGE=/pages/index
APP_TRACK=youshu APP_TRACK=youshu
APP_YOUSHU_TOKEN=bi281e87ab2424481a APP_YOUSHU_TOKEN=bi281e87ab2424481a

View File

@ -304,6 +304,7 @@ function SpPage (props, ref) {
// 'icon-home1': cusCurrentPage == 1, // 'icon-home1': cusCurrentPage == 1,
'icon-fanhui': alwaysBackUrl ? true : cusCurrentPage != 1 'icon-fanhui': alwaysBackUrl ? true : cusCurrentPage != 1
})} })}
style={{ color: isBlack ? 'white' : 'black' }}
onClick={() => { onClick={() => {
if (alwaysBackUrl) { if (alwaysBackUrl) {
Taro.navigateTo({ Taro.navigateTo({

View File

@ -167,14 +167,15 @@ page {
.spot-pagination-bullet { .spot-pagination-bullet {
// margin-right: 5px; // margin-right: 5px;
// border-radius: 20%; // border-radius: 20%;
height: 4px; height: 6px;
width: 30px; width: 30px;
background: #ddd; background: #d9d9d9;
transition: all 0.3s ease-in-out 0s; transition: all 0.3s ease-in-out 0s;
} }
// //
.spot-pagination-bullet-active { .spot-pagination-bullet-active {
background: #fff; // background: #fff;
background: #818181;
} }
} }
.icon-kf { .icon-kf {

View File

@ -366,9 +366,17 @@ function Home () {
}) })
} }
}) || []).sort((a, b) => a.sort - b.sort) }) || []).sort((a, b) => a.sort - b.sort)
const _swiperList = [...activeSwiper, {
type: 'image',
src: process.env.APP_IMAGE_CDN_NEW + '/1774/kv.jpg?t' + new Date().getTime(),
goods: [],
onClick: () => {
// Taro.navigateTo({ url: '/pages/other/goods' })
}
}, ...list]
setState((draft) => { setState((draft) => {
draft.swiperList = [...activeSwiper, ...list] draft.swiperList = _swiperList
draft.goodList = list[0].goods || [] draft.goodList = _swiperList[0].goods || []
draft.loading = false draft.loading = false
draft.activeInfo = { draft.activeInfo = {
...activity_info, ...activity_info,
@ -480,7 +488,7 @@ function Home () {
}, 500) }, 500)
} }
} else if (deltaY < 0) { } else if (deltaY < 0) {
if (currentIndex === 0) return if (goodList?.length == 0) return
// 上滑操作 // 上滑操作
setState((draft) => { setState((draft) => {
draft.showBottom = true draft.showBottom = true
@ -524,7 +532,8 @@ function Home () {
const onSwiperChange = (e) => { const onSwiperChange = (e) => {
const { current } = e.detail const { current } = e.detail
if (current === 0) { const _goodList = swiperList[current].goods || []
if (current === 0 || _goodList.length === 0) {
setState((draft) => { setState((draft) => {
draft.showBottom = false draft.showBottom = false
draft.isUpOperation = false draft.isUpOperation = false
@ -532,7 +541,7 @@ function Home () {
} }
setState((draft) => { setState((draft) => {
draft.currentIndex = current draft.currentIndex = current
draft.goodList = swiperList[current].goods || [] draft.goodList = _goodList
}) })
} }
@ -562,6 +571,11 @@ function Home () {
url: url url: url
}) })
} }
const indexUrl = 'https://mp.weixin.qq.com/s/LBXthKa-P9gNK8FCv3n1pA'
const handleGoWx = () => {
Taro.navigateTo({ url: '/pages/webview?url=' + encodeURIComponent(indexUrl) })
}
return ( return (
<SpPage <SpPage
className='page-index' className='page-index'
@ -625,13 +639,14 @@ function Home () {
duration={800} duration={800}
// indicatorDots // indicatorDots
circular circular
autoplay={!isUpOperation} autoplay={process.env.NODE_ENV === 'development' ? false : !isUpOperation}
onChange={onSwiperChange} onChange={onSwiperChange}
> >
{state.swiperList.map((item, index) => ( {state.swiperList.map((item, index) => (
<SwiperItem key={index} className="" style={{ height: "100%" }}> <SwiperItem key={index} className="" style={{ height: "100%" }}>
{item.type === "image" && ( {item.type === "image" && (
<Image <Image
onClick={item.onClick}
src={item.src} src={item.src}
style={{ width: "100%", height: "100%", objectPosition: "center" }} style={{ width: "100%", height: "100%", objectPosition: "center" }}
mode={isUpOperation ? 'aspectFill' : 'aspectFill'} mode={isUpOperation ? 'aspectFill' : 'aspectFill'}
@ -677,16 +692,20 @@ function Home () {
</SwiperItem> </SwiperItem>
))} ))}
</Swiper> </Swiper>
{!isUpOperation && currentIndex === 0 ? <View className="item-btns" style="left: 220rpx;
bottom: 180rpx;" >
{<View onClick={handleGoWx} className="item-btn" style={{ padding: '50rpx 156rpx', opacity: 0, background: 'transparent', border: 'none' }} >
<View className="item-btn-txt"></View>
</View>}
</View> : null}
{!isUpOperation && <> {!isUpOperation && <>
{currentIndex === 0 ? <View className="item-btns"> {/* currentIndex === -1 ? <View className="item-btns">
<View className="item-tit">{activeInfo.activity_name}</View> <View className="item-tit">{activeInfo.activity_name}</View>
{/* <SpLogin newUser={isNewUser} onChange={handleApply}> */}
{activeInfo.end_time * 1000 >= Date.now() && <View className="item-btn" style={{ padding: '30rpx 60rpx' }} onClick={() => handleApply()}> {activeInfo.end_time * 1000 >= Date.now() && <View className="item-btn" style={{ padding: '30rpx 60rpx' }} onClick={() => handleApply()}>
<View className="item-btn-txt">{activeInfo.total_count ? '已报名' : '活动申请'}</View> <View className="item-btn-txt">{activeInfo.total_count ? '已报名' : '活动申请'}</View>
{/* <Image className="jiantou" mode="aspectFit" src={require('../assets/hengjiantou.gif')}></Image> */}
</View>} </View>}
{/* </SpLogin> */} </View> : */}
</View> : {goodList?.length > 0 &&
<View className="item-img-box"> <View className="item-img-box">
<View className="item-img-txt"> </View> <View className="item-img-txt"> </View>
<Image className="item-img" height="62" src={require('../assets/i-sou.gif')} isShowMenuByLongpress={false} lazyLoad isNew={false} /> <Image className="item-img" height="62" src={require('../assets/i-sou.gif')} isShowMenuByLongpress={false} lazyLoad isNew={false} />

View File

@ -756,11 +756,13 @@ function EspierDetail (props) {
<Text className='desc-title-txt'>{info?.itemName}</Text> <Text className='desc-title-txt'>{info?.itemName}</Text>
<SpGoodsPrice info={curItem ? curItem : info} /> <SpGoodsPrice info={curItem ? curItem : info} />
</View> </View>
</View> */} </View>
{true ? <> false ? <>
{goods_1774[1].map((item, index) => <SpImage src={`1774/${item}`} width={width} isNew > {goods_1774[1].map((item, index) => <SpImage src={`1774/${item}`} width={width} isNew >
</SpImage>)} </SpImage>)}
</> : <> </> :
*/}
{<>
{isArray(info.intro) ? ( {isArray(info.intro) ? (
<View> <View>
{info.intro.map((item, idx) => ( {info.intro.map((item, idx) => (
@ -768,18 +770,15 @@ function EspierDetail (props) {
{item.name === 'film' && <WgtFilm info={item} />} {item.name === 'film' && <WgtFilm info={item} />}
{item.name === 'slider' && <WgtSlider info={item} />} {item.name === 'slider' && <WgtSlider info={item} />}
{item.name === 'writing' && <WgtWriting info={item} />} {item.name === 'writing' && <WgtWriting info={item} />}
{/* {item.name === 'heading' && <WgtHeading info={item} />} */}
{item.name === 'headline' && <WgtHeadline info={item} />} {item.name === 'headline' && <WgtHeadline info={item} />}
{item.name === 'goods' && <WgtGoods info={item} />} {item.name === 'goods' && <WgtGoods info={item} />}
</View> </View>
))} ))}
</View> </View>
) : ( ) :
<> <>
{/* <SpHtml content={info.intro} /> */} </>}
</> {introList.length ? introList.length === 2 ? <SpHtml content={introList[0].content} /> : introList.map((item, index) => <View className={classNames('sp-accordion')} key={`item__${index}`}>
)}
{introList.length ? introList.map((item, index) => <View className={classNames('sp-accordion')} key={`item__${index}`}>
<AtAccordion <AtAccordion
open={item.isOpen} open={item.isOpen}
isAnimation={false} isAnimation={false}
@ -825,7 +824,7 @@ function EspierDetail (props) {
{/* 商品评价 */} {/* 商品评价 */}
{/* <CompEvaluation list={evaluationList} itemId={info.itemId}></CompEvaluation> */} {/* <CompEvaluation list={evaluationList} itemId={info.itemId}></CompEvaluation> */}
{isArray(historyList) ? <View className='bottom-box'> {isArray(historyList) && introList?.length > 2 ? <View className='bottom-box'>
<View className="bottom-box-tit">浏览历史</View> <View className="bottom-box-tit">浏览历史</View>
<ScrollView scrollX scrollWithAnimation showScrollbar={true} scrollLeft={0} className="shop-box"> <ScrollView scrollX scrollWithAnimation showScrollbar={true} scrollLeft={0} className="shop-box">
{historyList.map((item, idx) => ( {historyList.map((item, idx) => (

View File

@ -7,7 +7,8 @@ import { View, Text, Picker, Input } from "@tarojs/components"
import './goods.scss' import './goods.scss'
const initState = { const initState = {
loading: false loading: false,
shopList: []
} }
function goods () { function goods () {
const [state, setState] = useImmer(initState) const [state, setState] = useImmer(initState)
@ -15,13 +16,24 @@ function goods () {
const { windowHeight, windowWidth } = Taro.getSystemInfoSync() const { windowHeight, windowWidth } = Taro.getSystemInfoSync()
const width = windowWidth * 2 const width = windowWidth * 2
const goods_1774 = [1, 2, 3, 4, 5, 6, 7] const goods_1774 = [1, 2, 3, 4, 5, 6, 7]
const { shopList } = state
const handleBackToIndex = () => { const handleBackToIndex = () => {
Taro.redirectTo({ url: '/pages/index' }) Taro.redirectTo({ url: '/pages/index' })
} }
const handleGoBuy = (item, index) => { const handleGoBuy = (item, index) => {
console.log("🚀 ~ file: goods.js:22 ~ item:", item, index) if (index === 3) {
Taro.navigateTo({
url: `/pages/item/espier-detail?id=${shopList[0]?.itemId}`
})
}
if (index === 5) {
Taro.navigateTo({
url: `/pages/item/espier-detail?id=${shopList[1]?.itemId}`
})
}
} }
useEffect(() => { useEffect(() => {
getShop()
setTimeout(() => { setTimeout(() => {
setState((draft) => { setState((draft) => {
draft.loading = false draft.loading = false
@ -29,6 +41,23 @@ function goods () {
}, 300) }, 300)
}, []) }, [])
const getShop = async () => {
let params = {
page: 1,
pageSize: 10,
keywords: '',
approve_status: 'onsale,only_show,offline_sale',
item_type: 'normal',
is_point: 'false',
goodsSort: 6
}
const { list: BK_075List = [] } = await api.item.search({ ...params, keywords: 'BK075' })
const { list: BK_074List = [] } = await api.item.search({ ...params, keywords: 'BK074' })
setState((draft) => {
draft.shopList = [...BK_075List, ...BK_074List]
})
}
return ( return (
<SpPage loading={loading} title={''} className='page-other-goods has-navbar' showNavSearchIcon showNavLogo> <SpPage loading={loading} title={''} className='page-other-goods has-navbar' showNavSearchIcon showNavLogo>
<View className="" style={{ minHeight: windowHeight * 2, background: '#000' }} > <View className="" style={{ minHeight: windowHeight * 2, background: '#000' }} >

View File

@ -1,6 +1,11 @@
.page-other-goods { .page-other-goods {
.custom-navigation { .custom-navigation {
background-color: #000 !important; background-color: #000 !important;
.left-container {
.icon-fanhui {
color: #fff !important;
}
}
} }
.content-btn { .content-btn {
margin: 0 auto; margin: 0 auto;