Browse Source

美食详情注释base

master
shaojing 1 year ago
parent
commit
e1c19d47f5
  1. 76
      subPackages/food/foodDetail.vue
  2. 2
      subPackages/food/foodList.vue

76
subPackages/food/foodDetail.vue

@ -2,6 +2,19 @@
<view class="bg" id="bg" v-if="info">
<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">
<swiper-item v-if="info && info.videourl">
<video
:src="info.videourl"
id="detailVideo"
:poster="
smallSwipeList.length > 0 ? smallSwipeList[0] : ''
"
controls
playsinline=""
webkit-playsinline=""
x5-video-player-type="h5-page"
></video>
</swiper-item>
<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)" mode="aspectFill"></image>
@ -161,9 +174,7 @@
</template>
<script>
// import Base from '@/components/Base';
export default {
extends: Base,
data() {
return {
id: null,
@ -187,62 +198,19 @@
commentNum: ''
};
},
// onLoad(option) {
// this.id = option.id;
// this.getInfo();
// this.getSpecificationsByGoodsId();
// this.getBusinessInfo();
// },
onLoad(option) {
this.id = option.id;
this.getDetail();
},
methods: {
// getComment() {
// this.Post({
// goods_id: this.info.id,
// offset: 0,
// limit: 2
// }, '/api/scenic/getGoodsCommentByScenicId').then(res => {
// this.commentList = res.data
// this.commentNum = res.msg
// })
// },
// changeNav(item,index) {
// this.navIndex = index
// console.log(item.name);
// // id
// let to = item.id
// //
// uni.createSelectorQuery().select('#' + to).boundingClientRect(function(rect){
// // 使scrollIntoView
// console.log(rect);
// uni.pageScrollTo({
// scrollTop: rect.top,
// duration: 200
// })
// }).exec();
// },
// changeProduct(index) {
// this.productIndex = index
// },
getInfo() {
getDetail() {
this.Post({
goods_id: this.id
},
'/api/goods/getGoodDetail'
).then(res => {
if (res.data.flag == 0) {
setTimeout(() => {
uni.showToast({
title: '商品不存在或已下架',
icon: 'none'
})
}, 0)
setTimeout(() => {
this.goBack()
}, 2000)
}
this.info = res.data;
this.isCollect = res.data.is_collect;
},'/api/goods/getGoodDetail').then(res => {
res.data.goods_new_tag = (res.data.goods_new_tag ? res.data.goods_new_tag.split(',') : []).splice(0, 2);
this.info = res.data
this.getComment()
});
})
},
getSpecificationsByGoodsId() {
this.Post({

2
subPackages/food/foodList.vue

@ -87,7 +87,7 @@
.item {
width: 696rpx;
height: 213rpx;
// height: 213rpx;
background: #FFFFFF;
box-shadow: 0rpx 0rpx 9rpx 0rpx rgba(153,153,153,0.38);
border-radius: 13rpx;

Loading…
Cancel
Save