盐都小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

185 lines
3.7 KiB

<template>
<view class="bg">
<view class="swipe-box">
<swiper class="swiper" :autoplay="true" :interval="3000" :duration="1000" circular indicator-dots indicator-color="rgba(255,255,255,.5)"
indicator-active-color="#fff" @change="swiperChange">
<swiper-item v-for="(item, index) in info.list_images.split(',')" :key="item.id">
<view class="swiper-item">
<image class="item-img" :src="showImg(item)" ></image>
</view>
</swiper-item>
</swiper>
<view class="swiper-pointer">
{{swiperCurrent}}/{{info.list_images.split(',').length}}
</view>
<view class="collect" @click.stop="collect()">
<image src="https://tongli.sz-trip.com/uploads/20240829/9dbb80cafe8375bd6d5c96fccb617962.png" v-if="info.is_collect"></image>
<image src="https://tongli.sz-trip.com/uploads/20240826/564af778708591f5de29174d3b14bbff.png" v-else></image>
</view>
</view>
<view class="common-container info-container">
<view class="info-title text-overflowRows">{{info.title}}</view>
</view>
<view class="common-container detail-container">
<view class="" id="cpts" v-html="formateRichText(info.feature_content)"></view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
id: null,
swiperCurrent: 1,
info: {list_images:''},
}
},
onShow(options) {
},
onLoad(options) {
this.id = options.id;
this.getInfo();
},
methods: {
swiperChange (e) {
this.swiperCurrent = e.detail.current+1
},
// 获取信息
getInfo() {
this.Post({goods_id: this.id},'/api/goods/getGoodDetail').then(res => {
if (res.data.flag == 0) {
uni.showToast({title: '商品不存在或已下架',icon: 'none'})
setTimeout(() => {this.goBack()}, 2000)
}
this.info = res.data;
});
},
// 收藏
collect() {
this.Post({type: 6,id: this.id},'/api/scenic/collect').then(res => {
if (res) {
uni.showToast({title: res.msg,icon: 'none'});
this.info.is_collect = !this.info.is_collect
}
});
},
}
}
</script>
<style scoped lang="scss">
*{
box-sizing: border-box;
}
.bg{
min-height: 100vh;
background: #F8F8F8;
}
.swipe-box {
height: 867rpx;
position: relative;
.swiper-item-num {
width: 90rpx;
height: 40rpx;
background: rgba(0, 0, 0, 0.5);
border-radius: 20rpx;
font-size: 24rpx;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #ffffff;
text-align: center;
line-height: 40rpx;
position: absolute;
right: 30rpx;
bottom: 50rpx;
}
.collect{
position: absolute;
width: 51rpx;
height: 51rpx;
right: 36rpx;
top: 36rpx;
font-size: 23rpx;
background: rgba(0, 0, 0, 0.5);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
image{
width: 36rpx;
height: 36rpx;
}
}
.swiper-pointer{
position: absolute;
right: 36rpx;
bottom: 80rpx;
background: rgba(22,22,22,0.5);
border-radius: 23rpx;
font-family: PingFang SC;
font-weight: 500;
font-size: 24rpx;
color: #FFFFFF;
padding: 6rpx 14rpx;
}
}
.swiper {
height: 867rpx;
position: relative;
.swiper-item {
width: 100%;
height: 867rpx;
.item-img {
width: 750rpx;
height: 867rpx;
}
.item-img.pop-swiper-image{
height: 347rpx;
border-radius: 13rpx;
}
}
}
.common-container{
background: white;
width: 100%;
}
.info-container{
padding: 34rpx 25rpx;
width: 100%;
font-family: PingFang SC;
font-weight: bold;
font-size: 35rpx;
color: #000000;
margin-bottom: 21rpx;
}
.detail-container{
width: 100%;
padding: 28rpx;
font-family: PingFang SC;
font-weight: 500;
font-size: 28rpx;
color: #333333;
}
</style>