Enzo 4 years ago
parent
commit
e068f04c33
  1. 8
      pages/collect/index.vue
  2. 11
      pages/goodsDetail/index.vue

8
pages/collect/index.vue

@ -1,5 +1,6 @@
<template>
<view>
<skeleton :loading="skeletonLoading" :row="6" :showAvatar="false" :showTitle="true">
<view class="list-box">
<view class="lf-row-between list-item" v-for="(item, index) in list" :key="item.id">
<image class="goods-img" :src="item.goods.cover" @click="enterDetail(index)"></image>
@ -25,6 +26,7 @@
<text v-if="list.length" :class="{'loading-more-text': loadingClass}">{{ loadingText }}</text>
<my-nocontent v-else></my-nocontent>
</view>
</skeleton>
</view>
</template>
@ -37,7 +39,8 @@
loadingText: '正在加载中',
page: 1,
isPage: true,
pageSize: 20
pageSize: 20,
skeletonLoading: true
}
},
onLoad(){
@ -46,6 +49,7 @@
methods: {
getCollectList(){
this.$http(this.API.API_COLLECT_LIST).then(res => {
this.skeletonLoading = false;
this.isPage = res.data.has_more_page;
let list = res.data.items.map(item => {
item.is_collect = true; //
@ -60,6 +64,8 @@
}else{
this.list.push(...list);
}
}).catch(err => {
this.skeletonLoading = false;
})
},
//

11
pages/goodsDetail/index.vue

@ -1,5 +1,6 @@
<template>
<view>
<skeleton :loading="skeletonLoading" :row="12" :showAvatar="false" :showTitle="true">
<block v-if="isRight(goods_detail)">
<!-- 商品图片轮播 -->
<swiper :current="current" :indicator-dots="true" :circular="true" class="swiper-box" indicator-active-color="#FE9903">
@ -81,19 +82,19 @@
<button class="btn" @click="toAddOrder">立即抢购</button>
</view>
</block>
</skeleton>
</view>
</template>
<script>
let time = null;
export default {
data(){
return {
current: 0, //
goods_id: 0,
goods_detail: {},
is_collect: 0 // 10
is_collect: 0, // 10
skeletonLoading: true
}
},
computed: {
@ -112,11 +113,13 @@
let that = this;
this.$http(this.API.API_GOODS_DETAIL, {goods_id: this.goods_id}).then(res => {
console.log("res", res);
this.skeletonLoading = false;
this.goods_detail = res.data;
this.is_collect = Boolean(res.data.user.is_collect);
}).catch(err => {
this.skeletonLoading = false;
that.$msg(err.msg);
time = setTimeout(() => {
setTimeout(() => {
that.$toBack();
}, 1000);
})

Loading…
Cancel
Save