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.

89 lines
2.1 KiB

5 years ago
<template>
<view>
<view class="null flex flex-direction justify-center align-center" v-if="isNull">
<image :src="IMAGE_URL+'/photo/FkdR-m8xwYqKqxa9i547PHEmtK7r.png'" style="width: 300rpx;" mode="widthFix"></image>
<view style="font-size: 24rpx;color: #DDDDDD;margin-top: 10rpx;">暂无内容</view>
</view>
<view class="" v-else>
<dynamics :list="dynamics" :showGoodsLink="true"></dynamics>
<u-loadmore :status="loadStatus" margin-bottom="40" margin-top="20" />
</view>
</view>
</template>
<script>
export default {
data() {
return {
IMAGE_URL:this.IMAGE_URL,
page: 0,
dynamics: [],
stopLoad:false,
loadStatus: "loadmore", //触底加载状态,
isNull:false
};
},
onLoad() {
this.getList()
},
methods: {
getList() {
if(this.stopLoad){
return
}
this.loadStatus = "loading"
let sendData = {
userId: uni.getStorageSync("userInfo").id,
page: this.page
}
this.page++
this.$u.post("/api/v1/attention/list/moment_copy", sendData).then(res => {
console.log(res.data);
if (res.data.code == "FAIL") {
this.$u.toast(res.data.msg);
return
}
let list = res.data.data
if(list.length==0){
this.loadStatus = "nomore"
this.stopLoad = true
if (this.page == 1) {
console.log("没有数据")
this.isNull = true
}
return
}
//为了防止第一页商品数量不够时scrollview不能触底导致底部一直显示正在加载
if (list.length < 5) {
this.loadStatus = "nomore"
}
this.dynamics.push(...list)
})
}
},
onReachBottom(){
this.getList()
},
onShareAppMessage(res) {
console.log("自定义分享信息")
console.log(res)
let goodsMsg = res.target.dataset.goods
if (res.from === 'button') { // 来自页面内分享按钮
console.log(res.target)
}
return {
title: "我在买" + goodsMsg.name + ",快来看看吧!",
path: '/pages/goodsDetail/goodsDetail?id=' + goodsMsg.id + "&type=share",
imageUrl: this.IMAGE_URL + goodsMsg.mainPhotoURL
}
}
}
</script>
<style lang="scss">
.null{
height: 100vh;
width: 100vw;
}
</style>