Fix:2797 【商城小程序】根据运营设计的调整,非遗主页的省名删除,只显示图片

This commit is contained in:
modendeveloper
2024-12-17 22:10:14 +08:00
parent eddb02d2cf
commit 8e8ca5a261
+57 -44
View File
@@ -1,50 +1,81 @@
<template>
<view class="pkg-product-heritage">
<image style="width: 100%" :src="topImage" mode="widthFix" />
<view class="main-box">
<image style="width: 100%" :src="backgroundImage" mode="widthFix" />
<view
class="item"
:style="{ left: item.gx + 'rpx', top: item.gy + 'rpx' }"
v-for="(item, index) in contents"
:key="index"
@click="goDetails(item)"
>
<image
class="img-item"
:src="item.image"
:class="{ unlink: !item.isLink }"
/>
<!-- <view
class="v12-text-center v12-white-text v12-radius-80 v12-px-1 title"
:class="{
'v12-primary': item.isLink,
'un-actived': !item.isLink,
}"
>
{{ item.title }}</view
> -->
</view>
</view>
</view>
</template>
<script>
import {getICH} from '@/api/product'
import { pageListenMixins } from '@/mixins/pageListenMixins'
import { getICH } from "@/api/product";
import { pageListenMixins } from "@/mixins/pageListenMixins";
export default {
name: 'HeritagePage',
name: "HeritagePage",
mixins: [pageListenMixins],
data() {
return {
contents: [],
topImage: '',
backgroundImage: '',
topImage: "",
backgroundImage: "",
bgImgWidth: 0,
pageKeyId: Object.freeze('ichIndex')
}
pageKeyId: Object.freeze("ichIndex"),
};
},
computed: {
scale() {
return 750 / this.bgImgWidth
}
return 750 / this.bgImgWidth;
},
},
onLoad() {
this.init()
this.init();
},
methods: {
init() {
getICH().then(({data}) => {
getICH().then(({ data }) => {
this.contents = data.contents;
this.topImage = data.topImage;
this.backgroundImage = data.backgroundImage;
this.bgImgWidth = data.backgroundImageWidth;
this.calcPosition();
})
});
},
// 计算位置
calcPosition() {
this.contents?.forEach(item => {
item.gx = item.x * this.scale
item.gy = item.y * this.scale
})
this.contents?.forEach((item) => {
item.gx = item.x * this.scale;
item.gy = item.y * this.scale;
});
},
goDetails(item) {
if (!item.isLink) return
if (!item.isLink) return;
// 1-视频,2-图文(可配置商品),3-商品+视频
uni.navigateTo({
url: '/pkg_product/views/heritage/index?id=' + item.id
})
url: "/pkg_product/views/heritage/index?id=" + item.id,
});
// if (item.type === 1) {
// uni.navigateTo({
// url: '/pkg_product/views/heritage/index?id=' + item.id
@@ -58,36 +89,18 @@ export default {
// url: '/pkg_product/views/heritage/index?id=' + item.id
// })
// }
}
}
}
},
},
};
</script>
<template>
<view class="pkg-product-heritage">
<image style="width: 100%" :src="topImage" mode="widthFix"/>
<view class="main-box">
<image style="width: 100%" :src="backgroundImage" mode="widthFix"/>
<view class="item" :style="{'left':item.gx+'rpx','top':item.gy+'rpx'}" v-for="(item,index) in contents"
:key="index" @click="goDetails(item)">
<image class="img-item" :src="item.image" :class="{'unlink': !item.isLink}"/>
<view
class=" v12-text-center v12-white-text v12-radius-80 v12-px-1 title"
:class="{
'v12-primary': item.isLink,
'un-actived': !item.isLink
}">
{{ item.title }}</view>
</view>
</view>
</view>
</template>
<style scoped lang="less">
.unlink{
.unlink {
filter: grayscale(100%);
}
.un-actived{
.un-actived {
background: #494949 !important;
background-color: #494949 !important;
}
@@ -119,4 +132,4 @@ export default {
}
}
}
</style>
</style>