...
|
...
|
@@ -22,7 +22,7 @@ |
|
|
<img :src="item.authorHeadIco">
|
|
|
</div>
|
|
|
<p class="user-name">{{item.authorName}}</p>
|
|
|
<div class="zan-container">
|
|
|
<div class="zan-container" :data-praised="item.hasPraised" :data-index="index" :data-id="item.articleId" @click="updatePraise">
|
|
|
<i :class="[item.hasPraised === 'Y' ? 'iconzan-fill' : 'iconzan_n', 'iconfont', 'btn-zan']"></i>
|
|
|
<p class="zan-count">{{item.praiseCount ? item.praiseCount : '赞'}}</p>
|
|
|
</div>
|
...
|
...
|
@@ -45,11 +45,11 @@ export default { |
|
|
name: 'waterFallList',
|
|
|
components: {WaterFall},
|
|
|
props: {
|
|
|
listData: {
|
|
|
listData: { // 列表数据
|
|
|
type: Array,
|
|
|
default: []
|
|
|
},
|
|
|
listInfo: {
|
|
|
listInfo: { // 列表基础信息
|
|
|
type: Object,
|
|
|
default: {}
|
|
|
},
|
...
|
...
|
@@ -61,7 +61,7 @@ export default { |
|
|
type: Number,
|
|
|
default: 18
|
|
|
},
|
|
|
isLoading: {
|
|
|
isLoading: { // 是否正在调用列表接口
|
|
|
type: Boolean,
|
|
|
default: false
|
|
|
}
|
...
|
...
|
@@ -69,9 +69,10 @@ export default { |
|
|
data() {
|
|
|
return {
|
|
|
col: 2,
|
|
|
scrollTop: 0,
|
|
|
isLogin: false,
|
|
|
loadText: ''
|
|
|
scrollTop: 0, // 页面滚动高度
|
|
|
isLogin: false, // 是否登录
|
|
|
loadText: '', // 加载新列表提示文字
|
|
|
isUpdatingPraise: false, // 是否正在调用点赞接口
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
...
|
...
|
@@ -104,17 +105,15 @@ export default { |
|
|
this.isLogin = val;
|
|
|
},
|
|
|
isLoading(newVal) {
|
|
|
console.log('isLoading', newVal);
|
|
|
if (newVal === true) {
|
|
|
this.loadText = '加载中...';
|
|
|
} else {
|
|
|
this.loadText = '';
|
|
|
}
|
|
|
console.log(this.loadText);
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
...mapActions(['articleAddLike']),
|
|
|
...mapActions(['updateArticlePraise']),
|
|
|
loadMore() {
|
|
|
this.$emit('load-more');
|
|
|
},
|
...
|
...
|
@@ -141,6 +140,16 @@ export default { |
|
|
}
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
updatePraise(e) {
|
|
|
let articleId = e.currentTarget.dataset.id;
|
|
|
let index = e.currentTarget.dataset.index;
|
|
|
let status = e.currentTarget.dataset.praised === 'Y' ? 1 : 0;
|
|
|
|
|
|
console.log(articleId,index, status);
|
|
|
this.updateArticlePraise({articleId, status, index}).then(result => {
|
|
|
console.log(result);
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
};
|
...
|
...
|
|