Showing
3 changed files
with
14 additions
and
11 deletions
@@ -32,7 +32,8 @@ | @@ -32,7 +32,8 @@ | ||
32 | :share="share" | 32 | :share="share" |
33 | :pos-id="posId" | 33 | :pos-id="posId" |
34 | @on-show-more="onShowMore" | 34 | @on-show-more="onShowMore" |
35 | - @on-follow="onFollowAuthor"> | 35 | + @on-follow="onFollowAuthor" |
36 | + @on-praise="onPraise"> | ||
36 | </ArticleDeatilNote> | 37 | </ArticleDeatilNote> |
37 | </template> | 38 | </template> |
38 | <template class="article-item" #item="{ data }"> | 39 | <template class="article-item" #item="{ data }"> |
@@ -51,7 +52,7 @@ | @@ -51,7 +52,7 @@ | ||
51 | </template> | 52 | </template> |
52 | </RecycleScrollReveal> | 53 | </RecycleScrollReveal> |
53 | 54 | ||
54 | - <ArticleDetailFooter v-show="!articleInfo.thumb" class="detail-fixed-footer" :style="`transform: translate3d(0, ${viewMoreArticles ? '100%' : '0'}, 0)`" v-bind="footerData" @on-comment-click="onComment"> | 55 | + <ArticleDetailFooter ref="footer" v-show="!articleInfo.thumb" class="detail-fixed-footer" :style="`transform: translate3d(0, ${viewMoreArticles ? '100%' : '0'}, 0)`" v-bind="footerData" @on-comment-click="onComment"> |
55 | <template v-if="articleInfo.sort != 2" v-slot:before> | 56 | <template v-if="articleInfo.sort != 2" v-slot:before> |
56 | <div class="footer-comment"> | 57 | <div class="footer-comment"> |
57 | <CommentPlaceholder | 58 | <CommentPlaceholder |
@@ -344,11 +345,16 @@ export default { | @@ -344,11 +345,16 @@ export default { | ||
344 | onEdit() { | 345 | onEdit() { |
345 | this.articleOnEdit = true; | 346 | this.articleOnEdit = true; |
346 | }, | 347 | }, |
348 | + onPraise() { | ||
349 | + this.$refs.footer.onPraise(); | ||
350 | + }, | ||
347 | onComment() { | 351 | onComment() { |
348 | if (this.articleInfo.sort === 2) { | 352 | if (this.articleInfo.sort === 2) { |
349 | this.$refs.detailLong.onComment(); | 353 | this.$refs.detailLong.onComment(); |
350 | - } else { | 354 | + } else if (this.articleState.commentCount) { |
351 | this.$refs.detailNote.toCommentList(); | 355 | this.$refs.detailNote.toCommentList(); |
356 | + } else { | ||
357 | + this.$refs.commentInput.$el.click(); | ||
352 | } | 358 | } |
353 | }, | 359 | }, |
354 | onCommentInput(comment) { | 360 | onCommentInput(comment) { |
1 | <template> | 1 | <template> |
2 | <div class="article-detail-notes"> | 2 | <div class="article-detail-notes"> |
3 | <ArticleItemHeader v-if="share" :share="share" :data="authorData" :lazy="lazy" :more="false" @on-follow="onFollowAuthor"></ArticleItemHeader> | 3 | <ArticleItemHeader v-if="share" :share="share" :data="authorData" :lazy="lazy" :more="false" @on-follow="onFollowAuthor"></ArticleItemHeader> |
4 | - <LayoutHeader v-else style="visibility: hidden;"></LayoutHeader> | 4 | + <LayoutHeader v-else ref="header" style="visibility: hidden;"></LayoutHeader> |
5 | 5 | ||
6 | <div v-if="data.empty" class="article-empty"> | 6 | <div v-if="data.empty" class="article-empty"> |
7 | {{data.emptyTip || '文章不存在或文章被删除'}} | 7 | {{data.emptyTip || '文章不存在或文章被删除'}} |
@@ -120,7 +120,7 @@ export default { | @@ -120,7 +120,7 @@ export default { | ||
120 | this.$emit('on-follow', this.data, follow); | 120 | this.$emit('on-follow', this.data, follow); |
121 | }, | 121 | }, |
122 | onPraise() { | 122 | onPraise() { |
123 | - this.$refs.footer.onPraise(); | 123 | + this.$emit('on-praise'); |
124 | }, | 124 | }, |
125 | onChangeSlide({index}) { | 125 | onChangeSlide({index}) { |
126 | this.slideIndex = index; | 126 | this.slideIndex = index; |
@@ -129,12 +129,8 @@ export default { | @@ -129,12 +129,8 @@ export default { | ||
129 | this.$refs.commentList && this.$refs.commentList.addComment(comment); | 129 | this.$refs.commentList && this.$refs.commentList.addComment(comment); |
130 | }, | 130 | }, |
131 | toCommentList() { | 131 | toCommentList() { |
132 | - if (this.articleState.commentCount) { | ||
133 | - if (this.$refs.commentList && this.scrollTo) { | ||
134 | - this.scrollTo({scrollTop: this.$refs.commentList.$el.offsetTop - this.$refs.header.$el.offsetHeight}); | ||
135 | - } | ||
136 | - } else { | ||
137 | - this.$refs.commentInput.$el.click(); | 132 | + if (this.$refs.commentList && this.scrollTo) { |
133 | + this.scrollTo({scrollTop: this.$refs.commentList.$el.offsetTop - get(this.$refs, 'header.$el.offsetHeight', 0)}); | ||
138 | } | 134 | } |
139 | }, | 135 | }, |
140 | onMore() { | 136 | onMore() { |
@@ -24,6 +24,7 @@ function processArticleListData(listData) { | @@ -24,6 +24,7 @@ function processArticleListData(listData) { | ||
24 | templateKey: 'text', | 24 | templateKey: 'text', |
25 | } | 25 | } |
26 | ], | 26 | ], |
27 | + hasComment: true, | ||
27 | commentCount: 0, | 28 | commentCount: 0, |
28 | comments: [], | 29 | comments: [], |
29 | dataType: listData.dataType, | 30 | dataType: listData.dataType, |
-
Please register or login to post a comment