forked from gxwebsoft/mp-10550
refactor(index):优化首页布局与样式- 移除 Banner 组件中多余的 View 包裹层,简化结构- 调整轮播图区域样式,提升触摸交互体验
-为今日热卖和社区拼团区域添加阴影效果- 减小社区拼团图片高度,优化视觉比例 - 调整热销榜单区域间距,改善布局紧凑度- 注释未使用的吸顶状态逻辑,减少冗余代码 - 更新页面标题为更直观的首页标识- 优化首页组件结构,提升渲染性能
This commit is contained in:
@@ -99,47 +99,40 @@ const MyPage = () => {
|
||||
<View className="flex p-2 justify-between" style={{height: `${carouselHeight}px`}}>
|
||||
{/* 左侧轮播图区域 */}
|
||||
<View style={{width: '50%', height: '100%'}}>
|
||||
<View
|
||||
<Swiper
|
||||
defaultValue={0}
|
||||
height={carouselHeight}
|
||||
indicator
|
||||
autoPlay
|
||||
duration={3000}
|
||||
style={{
|
||||
width: '100%',
|
||||
height: '100%',
|
||||
touchAction: 'pan-y',
|
||||
pointerEvents: 'none'
|
||||
height: `${carouselHeight}px`,
|
||||
touchAction: 'pan-y'
|
||||
}}
|
||||
>
|
||||
<Swiper
|
||||
defaultValue={0}
|
||||
height={carouselHeight}
|
||||
indicator
|
||||
autoPlay
|
||||
duration={3000}
|
||||
style={{height: `${carouselHeight}px`}}
|
||||
>
|
||||
{carouselData && carouselData?.imageList?.map((img, index) => (
|
||||
<Swiper.Item key={index}>
|
||||
<Image
|
||||
width="100%"
|
||||
height="100%"
|
||||
src={img.url}
|
||||
mode={'scaleToFill'}
|
||||
onClick={() => navTo(`${img.path}`)}
|
||||
lazyLoad={false}
|
||||
style={{
|
||||
height: `${carouselHeight}px`,
|
||||
borderRadius: '4px',
|
||||
pointerEvents: 'auto'
|
||||
}}
|
||||
/>
|
||||
</Swiper.Item>
|
||||
))}
|
||||
</Swiper>
|
||||
</View>
|
||||
{carouselData && carouselData?.imageList?.map((img, index) => (
|
||||
<Swiper.Item key={index}>
|
||||
<Image
|
||||
width="100%"
|
||||
height="100%"
|
||||
src={img.url}
|
||||
mode={'scaleToFill'}
|
||||
onClick={() => navTo(`${img.path}`)}
|
||||
lazyLoad={false}
|
||||
style={{
|
||||
height: `${carouselHeight}px`,
|
||||
borderRadius: '4px'
|
||||
}}
|
||||
/>
|
||||
</Swiper.Item>
|
||||
))}
|
||||
</Swiper>
|
||||
</View>
|
||||
|
||||
{/* 右侧上下图片区域 - 从API获取数据 */}
|
||||
<View className="flex flex-col" style={{width: '50%', height: '100%'}}>
|
||||
{/* 上层图片 - 使用今日热卖素材 */}
|
||||
<View className={'ml-2 bg-white rounded-lg'}>
|
||||
<View className={'ml-2 bg-white rounded-lg shadow-sm'}>
|
||||
<View className={'px-3 my-2 font-bold text-sm'}>今日热卖</View>
|
||||
<View className={'px-3 flex'} style={{
|
||||
height: '110px'
|
||||
@@ -166,12 +159,12 @@ const MyPage = () => {
|
||||
</View>
|
||||
|
||||
{/* 下层图片 - 使用社区拼团素材 */}
|
||||
<View className={'ml-2 bg-white rounded-lg mt-3'}>
|
||||
<View className={'ml-2 bg-white rounded-lg mt-3 shadow-sm'}>
|
||||
<View className={'px-3 my-2 font-bold text-sm'}>走进社区</View>
|
||||
<View className={'rounded-lg px-3 pb-3'}>
|
||||
<Image
|
||||
width={'100%'}
|
||||
height={106}
|
||||
height={94}
|
||||
src={item?.image}
|
||||
mode={'scaleToFill'}
|
||||
lazyLoad={false}
|
||||
|
||||
@@ -105,7 +105,7 @@ const BestSellers = (props: {onStickyChange?: (isSticky: boolean) => void}) => {
|
||||
</Tabs>
|
||||
</Sticky>
|
||||
|
||||
<View className={'flex flex-col justify-between items-center rounded-lg px-2 mt-4'}>
|
||||
<View className={'flex flex-col justify-between items-center rounded-lg px-2 mt-2'}>
|
||||
{/* 今日主推 */}
|
||||
{tab1value == '0' && list?.map((item, index) => {
|
||||
return (
|
||||
|
||||
@@ -14,7 +14,7 @@ import './index.scss'
|
||||
|
||||
function Home() {
|
||||
// 吸顶状态
|
||||
const [stickyStatus, setStickyStatus] = useState<boolean>(false)
|
||||
// const [stickyStatus, setStickyStatus] = useState<boolean>(false)
|
||||
// Tabs粘性状态
|
||||
const [tabsStickyStatus, setTabsStickyStatus] = useState<boolean>(false)
|
||||
|
||||
@@ -23,7 +23,7 @@ function Home() {
|
||||
const userId = Taro.getStorageSync('UserId');
|
||||
|
||||
return {
|
||||
title: '网宿小店 - 网宿软件',
|
||||
title: '🏠 首页 🏠',
|
||||
path: userId ? `/pages/index/index?inviter=${userId}&source=share&t=${Date.now()}` : `/pages/index/index`,
|
||||
success: function () {
|
||||
console.log('首页分享成功');
|
||||
@@ -81,11 +81,11 @@ function Home() {
|
||||
});
|
||||
};
|
||||
|
||||
const onSticky = (item: IArguments) => {
|
||||
if(item){
|
||||
setStickyStatus(!stickyStatus)
|
||||
}
|
||||
}
|
||||
// const onSticky = (item: IArguments) => {
|
||||
// if(item){
|
||||
// setStickyStatus(!stickyStatus)
|
||||
// }
|
||||
// }
|
||||
|
||||
// 处理Tabs粘性状态变化
|
||||
const handleTabsStickyChange = (isSticky: boolean) => {
|
||||
@@ -165,7 +165,7 @@ function Home() {
|
||||
) : (
|
||||
<Header stickyStatus={tabsStickyStatus}/>
|
||||
)}
|
||||
|
||||
|
||||
<div className={'flex flex-col mt-12'}>
|
||||
<Menu/>
|
||||
<Banner/>
|
||||
|
||||
Reference in New Issue
Block a user