Feat:特色礼品加载优化,不在先挤在一起了

This commit is contained in:
LinCyJang
2026-06-01 01:27:22 +08:00
parent 0c738a2dc5
commit e7182902ba
+45 -6
View File
@@ -1,7 +1,13 @@
<template> <template>
<view class="gift-page"> <view class="gift-page">
<view class="banner" @click="linkTo"> <view class="banner" @click="linkTo">
<rich-text :nodes="topBannerHtml" /> <view v-if="topBannerImage" class="banner-image-wrap">
<image
:src="topBannerImage"
class="banner-img"
mode="aspectFill"
/>
</view>
</view> </view>
<view class="province-enter-wrap"> <view class="province-enter-wrap">
<view <view
@@ -60,7 +66,12 @@
class="item" class="item"
> >
<view class="bg" @click="provinceItemClick(item)"> <view class="bg" @click="provinceItemClick(item)">
<rich-text :nodes="item.bgHtml" /> <image
:src="item.backgroundImage"
class="bg-img"
mode="aspectFill"
lazy-load
/>
</view> </view>
<view class="good-list"> <view class="good-list">
<view <view
@@ -70,7 +81,7 @@
@click.stop="goodItemClick(goodItem)" @click.stop="goodItemClick(goodItem)"
> >
<view class="good-img"> <view class="good-img">
<image :src="goodItem.productImage" class="img" /> <image :src="goodItem.productImage" class="img" lazy-load />
</view> </view>
<view class="name"> <view class="name">
{{ goodItem.productName }} {{ goodItem.productName }}
@@ -97,7 +108,7 @@ export default {
data() { data() {
return { return {
provinceList: [], provinceList: [],
topBannerHtml: '', topBannerImage: '',
topBannerUrl: '', topBannerUrl: '',
toggleStatus: false, toggleStatus: false,
pageKeyId: Object.freeze('customizedGiftIndex') pageKeyId: Object.freeze('customizedGiftIndex')
@@ -111,7 +122,7 @@ export default {
customizedGift().then(res => { customizedGift().then(res => {
const { success, data } = res const { success, data } = res
if (success) { if (success) {
this.topBannerHtml = `<img src="${data.topBanner.image}" style="display: block;max-width: 100%;">` this.topBannerImage = data.topBanner.image || ''
this.topBannerUrl = data.topBanner.appUrl || '' this.topBannerUrl = data.topBanner.appUrl || ''
const list = data.cities || [] const list = data.cities || []
if (list.length > 0) { if (list.length > 0) {
@@ -120,7 +131,7 @@ export default {
if (backgroundImage && item.productList.length > 0) { if (backgroundImage && item.productList.length > 0) {
this.provinceList.push({ this.provinceList.push({
...item, ...item,
bgHtml: `<img src="${item.backgroundImage}" style="display: block;max-width: 100%;">` backgroundImage
}) })
} }
}) })
@@ -164,6 +175,21 @@ export default {
.banner { .banner {
position: relative; position: relative;
z-index: 1; z-index: 1;
.banner-image-wrap {
position: relative;
width: 100%;
padding-top: 46%;
overflow: hidden;
background-color: #f6f6f6;
}
.banner-img {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
display: block;
}
} }
.province-enter-wrap { .province-enter-wrap {
position: relative; position: relative;
@@ -243,6 +269,19 @@ export default {
.bg { .bg {
position: relative; position: relative;
z-index: 2; z-index: 2;
width: 100%;
padding-top: 62%;
overflow: hidden;
border-radius: 20rpx;
background-color: #f6f6f6;
.bg-img {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
display: block;
}
} }
.good-list { .good-list {
position: absolute; position: absolute;