|
|
<template>
|
|
|
<div class="article-detail-notes">
|
|
|
<ArticleItemHeader v-if="share" :share="share" :data="authorData" :lazy="lazy" :more="false" @on-follow="onFollowAuthor"></ArticleItemHeader>
|
|
|
<ArticleItemHeader v-if="share" :share="share" :data="authorData" :lazy="lazy" :more="false"
|
|
|
@on-follow="onFollowAuthor"></ArticleItemHeader>
|
|
|
<LayoutHeader v-else ref="header" style="visibility: hidden;"></LayoutHeader>
|
|
|
|
|
|
<div v-if="data.empty" class="article-empty">
|
|
|
{{data.emptyTip || '文章不存在或文章被删除'}}
|
|
|
</div>
|
|
|
<div v-else class="article-context">
|
|
|
<VideoPlayer v-if="+data.sort === 4" class="note-video" :source="data.videoUrl" :cover="data.coverUrl" :width="data.width" :height="data.height"></VideoPlayer>
|
|
|
<ArticleItemSlide v-else :thumb="thumb" :share="share" :data="slideData" :slide-index="slideIndex" :lazy="lazy" @on-praise="onPraise" @change="onChangeSlide"></ArticleItemSlide>
|
|
|
<ProductGroup name="articleTwoColumn" :article-id="data.articleId" :pos-id="0" :index="0" :thumb="thumb" v-if="productListData.length" :share="share" :data="productListData" :lazy="lazy"></ProductGroup>
|
|
|
<VideoPlayer v-if="+data.sort === 4" class="note-video" :source="data.videoUrl" :cover="data.coverUrl"
|
|
|
:width="data.width" :height="data.height"></VideoPlayer>
|
|
|
<ArticleItemSlide v-else :thumb="thumb" :share="share" :data="slideData" :slide-index="slideIndex" :lazy="lazy"
|
|
|
@on-praise="onPraise" @change="onChangeSlide"></ArticleItemSlide>
|
|
|
<ProductGroup name="articleTwoColumn" :article-id="data.articleId" :pos-id="0" :index="0" :thumb="thumb"
|
|
|
v-if="productListData.length" :share="share" :data="productListData" :lazy="lazy"></ProductGroup>
|
|
|
|
|
|
<div class="context-title">{{data.articleTitle}}</div>
|
|
|
|
...
|
...
|
@@ -22,7 +26,16 @@ |
|
|
<i class="iconfont icon-more1" @click="onMore"></i>
|
|
|
</div>
|
|
|
</div>
|
|
|
<ArticleDetailCommentList ref="commentList" v-if="data.articleId" :article-id="data.articleId" :share="share" :comment-count="articleState.commentCount" :has-comment="data.hasComment" :authorUid="data.authorUid"></ArticleDetailCommentList>
|
|
|
|
|
|
<ArticleDetailCommentList ref="commentList" v-if="data.articleId"
|
|
|
:article-id="data.articleId"
|
|
|
:share="share"
|
|
|
:comment-count="articleState.commentCount"
|
|
|
:has-comment="data.hasComment"
|
|
|
:authorUid="data.authorUid"
|
|
|
:authorName="data.authorName">
|
|
|
</ArticleDetailCommentList>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div v-if="listTitle" class="rec-article-title">
|
...
|
...
|
@@ -32,15 +45,16 @@ |
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import {get} from 'lodash';
|
|
|
import { get } from 'lodash';
|
|
|
import ArticleDetailCommentList from './comment-list';
|
|
|
import ArticleItemHeader from '../article/article-item-header';
|
|
|
import ArticleItemSlide from '../article/article-item-slide';
|
|
|
import ArticleItemTopics from '../article/article-item-topics';
|
|
|
import ArticleDetailIntro from './article-intro';
|
|
|
import dayjs from 'utils/day';
|
|
|
import {createNamespacedHelpers} from 'vuex';
|
|
|
const {mapState} = createNamespacedHelpers('article');
|
|
|
import { createNamespacedHelpers } from 'vuex';
|
|
|
|
|
|
const { mapState } = createNamespacedHelpers('article');
|
|
|
|
|
|
export default {
|
|
|
name: 'ArticleDetailNote',
|
...
|
...
|
@@ -72,7 +86,7 @@ export default { |
|
|
const articleState = this.articleStates[this.data.articleId] || this.data;
|
|
|
const authorState = this.authorStates[`${this.data.authorUid}-${this.data.authorType}`] || this.data;
|
|
|
|
|
|
return Object.assign({...articleState}, {hasAttention: authorState.hasAttention});
|
|
|
return Object.assign({ ...articleState }, { hasAttention: authorState.hasAttention });
|
|
|
},
|
|
|
thumb() {
|
|
|
return !!this.data.thumb;
|
...
|
...
|
@@ -134,15 +148,15 @@ export default { |
|
|
onPraise() {
|
|
|
this.$emit('on-praise');
|
|
|
},
|
|
|
onChangeSlide({index}) {
|
|
|
onChangeSlide({ index }) {
|
|
|
this.slideIndex = index;
|
|
|
},
|
|
|
onComment({comment}) {
|
|
|
onComment({ comment }) {
|
|
|
this.$refs.commentList && this.$refs.commentList.addComment(comment);
|
|
|
},
|
|
|
toCommentList() {
|
|
|
if (this.$refs.commentList && this.scrollTo) {
|
|
|
this.scrollTo({scrollTop: this.$refs.commentList.$el.offsetTop - get(this.$refs, 'header.$el.offsetHeight', 0)});
|
|
|
this.scrollTo({ scrollTop: this.$refs.commentList.$el.offsetTop - get(this.$refs, 'header.$el.offsetHeight', 0) });
|
|
|
}
|
|
|
},
|
|
|
onMore() {
|
...
|
...
|
|