【fix】优化代码
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div class="coupon-box" >
|
||||
<div class="coupon-box" v-if="couponsData?.length > 0">
|
||||
<div class="coupon-list coupon-flex coupon-swiper" v-if="componentContent.arrangeType == '横向滑动'">
|
||||
<swiper class="swiper"
|
||||
:disable-touch="couponsData.length < 3"
|
||||
|
@ -157,12 +157,14 @@ const { activityData, productList, count, jumpProductDetail, jumpDiscount } = co
|
||||
line-height: 28rpx;
|
||||
color: #CCCCCC;
|
||||
display: inline-block;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.stock{
|
||||
line-height: 1em;
|
||||
display: inline-block;
|
||||
font-size: 20rpx;
|
||||
color: #999999;
|
||||
white-space: nowrap;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -55,7 +55,9 @@ export default function (componentContent, typeId, shopId) {
|
||||
(res) => {
|
||||
afterGetData()
|
||||
activityData.value = res.data
|
||||
getTime()
|
||||
if(res.data){
|
||||
getTime()
|
||||
}
|
||||
},
|
||||
() => {
|
||||
afterGetData()
|
||||
|
@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div class="group-list">
|
||||
<div class="group-list" v-if="productList.length > 0">
|
||||
<div class="group-warp">
|
||||
<div class="header">
|
||||
<div class="header-warp">
|
||||
@ -8,15 +8,15 @@
|
||||
</div>
|
||||
<a v-show="componentContent.showMore" class="btn-all a-link" @click="jumpGroupWorks(componentContent.id)">查看更多</a>
|
||||
</div>
|
||||
<div v-if="productList.length > 0">
|
||||
<div>
|
||||
<swiper class="swiper pro-box"
|
||||
:disable-touch="productList.length < 3"
|
||||
:circular="false"
|
||||
:indicator-dots="false"
|
||||
:autoplay="productList.length > 2"
|
||||
:display-multiple-items="2"
|
||||
:previous-margin="swiperCurrent === productList.length - 2?'60rpx':'0rpx'"
|
||||
:next-margin="swiperCurrent === productList.length - 2?'0rpx':'60rpx'"
|
||||
:previous-margin="swiperCurrent === productList.length - 2 && productList.length.length > 2?'60rpx':'0rpx'"
|
||||
:next-margin="swiperCurrent === productList.length - 2 && productList.length.length > 2?'0rpx':'60rpx'"
|
||||
@change="swiperChange">
|
||||
<swiper-item class="swiper-slide pro-item-warp" v-for="(item,index) in productList" :key="index" @click="jumpProductDetail(item)">
|
||||
<div class="pro-item-inner">
|
||||
|
@ -22,7 +22,6 @@ export default function (componentContent, typeId, shopId) {
|
||||
})
|
||||
|
||||
function getData () {
|
||||
if (componentContent.value.id) {
|
||||
beforeGetData()
|
||||
const params = {
|
||||
method: 'POST',
|
||||
@ -42,9 +41,6 @@ export default function (componentContent, typeId, shopId) {
|
||||
afterGetData()
|
||||
}
|
||||
)
|
||||
} else {
|
||||
productList.value = []
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
|
@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<global-loading />
|
||||
<div class="hom-pro-list">
|
||||
<div class="hom-pro-list" v-if="productData.length > 0">
|
||||
<div class="header">
|
||||
<div class="header-warp">
|
||||
<div class="title">商品推荐</div>
|
||||
@ -115,7 +115,7 @@
|
||||
|
||||
<div
|
||||
class="product-list-box"
|
||||
v-if="productData.length>0">
|
||||
v-if="!loading">
|
||||
<div
|
||||
class="product-list-item-warp"
|
||||
v-for="(col,i) in colList"
|
||||
@ -216,7 +216,7 @@ const props = defineProps({
|
||||
},
|
||||
});
|
||||
const {typeId, componentContent} = toRefs(props);
|
||||
const {productData, jumpProductDetail, jumpProList, loadNext, getPercentageNum} = productMixin(componentContent);
|
||||
const {productData, jumpProductDetail, jumpProList, loadNext, getPercentageNum, loading} = productMixin(componentContent);
|
||||
const swiperCurrent = ref(0)
|
||||
|
||||
const colList = computed(() => [
|
||||
|
@ -6,11 +6,13 @@ export default function (componentContent) {
|
||||
const { sendReq, beforeGetData, afterGetData, jumpProductDetail, jumpProList } = funMixin()
|
||||
|
||||
const productData = ref([])
|
||||
const loading = ref(true)
|
||||
onMounted(() => {
|
||||
getData(true)
|
||||
})
|
||||
|
||||
function getData (isFirst) {
|
||||
loading.value = true
|
||||
if (componentContent.value.productData.sourceType === '1') {
|
||||
if (
|
||||
componentContent.value.productData.productIdList?.length > 0
|
||||
@ -24,12 +26,14 @@ export default function (componentContent) {
|
||||
(proRes) => {
|
||||
afterGetData()
|
||||
productData.value = proRes.data.list
|
||||
loading.value = false
|
||||
if (isFirst) {
|
||||
componentContent.value.productData.imgTextData = productData.value
|
||||
}
|
||||
},
|
||||
() => {
|
||||
afterGetData()
|
||||
loading.value = false
|
||||
}
|
||||
)
|
||||
} else {
|
||||
@ -45,6 +49,7 @@ export default function (componentContent) {
|
||||
},
|
||||
(proRes) => {
|
||||
afterGetData()
|
||||
loading.value = false
|
||||
productData.value = proRes.data.list
|
||||
if (isFirst) {
|
||||
componentContent.value.productData.imgTextData = productData.value
|
||||
@ -53,6 +58,7 @@ export default function (componentContent) {
|
||||
},
|
||||
() => {
|
||||
afterGetData()
|
||||
loading.value = false
|
||||
}
|
||||
)
|
||||
} else {
|
||||
@ -73,6 +79,7 @@ export default function (componentContent) {
|
||||
productData,
|
||||
jumpProductDetail,
|
||||
jumpProList,
|
||||
getPercentageNum
|
||||
getPercentageNum,
|
||||
loading
|
||||
}
|
||||
}
|
||||
|
@ -151,6 +151,7 @@ const { activityData, productList, count, jumpProductDetail, jumpSeckills } = co
|
||||
color: #EE6D46;
|
||||
padding-right: 10rpx;
|
||||
display: inline-block;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.original-price{
|
||||
font-size: 20rpx;
|
||||
@ -163,6 +164,7 @@ const { activityData, productList, count, jumpProductDetail, jumpSeckills } = co
|
||||
display: inline-block;
|
||||
font-size: 20rpx;
|
||||
color: #999999;
|
||||
white-space: nowrap;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -55,7 +55,9 @@ export default function (componentContent, typeId, shopId) {
|
||||
(res) => {
|
||||
afterGetData()
|
||||
activityData.value = res.data
|
||||
getTime()
|
||||
if(res.data){
|
||||
getTime()
|
||||
}
|
||||
},
|
||||
() => {
|
||||
afterGetData()
|
||||
|
Reference in New Issue
Block a user