...
|
...
|
@@ -115,18 +115,22 @@ export default { |
|
|
}
|
|
|
}
|
|
|
},
|
|
|
mounted() {
|
|
|
console.log('mounted');
|
|
|
this.checkLogin();
|
|
|
},
|
|
|
methods: {
|
|
|
loadMore() {
|
|
|
this.$emit('load-more');
|
|
|
},
|
|
|
scroll(e) {
|
|
|
scroll() {
|
|
|
// console.log(this.$refs.waterfall.scrollTop);
|
|
|
this.scrollTop = this.$refs.waterfall.scrollTop;
|
|
|
this.$refs.waterfallComp.emitLoadMore();
|
|
|
},
|
|
|
async checkLogin() {
|
|
|
const user = await this.$yoho.auth();
|
|
|
|
|
|
const user = await this.$sdk.getUser(true);
|
|
|
console.log('userInfo=', user);
|
|
|
if (user.uid) {
|
|
|
this.isLogin = true;
|
|
|
}
|
...
|
...
|
@@ -143,18 +147,25 @@ 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;
|
|
|
updatePraise(e) { // 点赞
|
|
|
if (this.isLogin) {
|
|
|
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.$emit('update-praise', {articleId, status, index});
|
|
|
console.log(articleId, index, status);
|
|
|
this.$emit('update-praise', {articleId, status, index});
|
|
|
} else {
|
|
|
this.$yoho.auth();
|
|
|
}
|
|
|
},
|
|
|
scrollToOldPlace() { // 从详情页路由回来时,滚动到原来的位置
|
|
|
console.log('scrollTop=', this.scrollTop);
|
|
|
if (!this.isLogin) {
|
|
|
this.checkLogin();
|
|
|
}
|
|
|
|
|
|
routeLeave(to, from, next) {
|
|
|
console.log('RouteLeave:', 'to=', to, 'from=', from);
|
|
|
next();
|
|
|
this.$refs.waterfall.scrollTo(0, this.scrollTop);
|
|
|
}
|
|
|
}
|
|
|
};
|
...
|
...
|
|