Authored by 陈峰

commit

... ... @@ -27,7 +27,8 @@ export default {
single: Boolean,
lazy: Boolean,
product: Object,
share: Boolean
share: Boolean,
thumb: Boolean
},
data() {
return {
... ... @@ -42,11 +43,15 @@ export default {
},
computed: {
favClass() {
return {'btn-is-fav': this.favorite, loading: this.posting};
return {
'btn-is-fav': this.favorite,
loading: this.posting,
invisible: this.thumb
};
},
favText() {
return this.favorite ? '已收藏' : '收藏';
}
},
},
methods: {
...mapActions(['postProductFav']),
... ...
... ... @@ -3,6 +3,7 @@
<ProductGroupItem
v-for="(product, inx) in data"
:share="share"
:thumb="thumb"
:single="single"
:product="product"
:lazy="lazy"
... ... @@ -27,7 +28,8 @@ export default {
type: Boolean,
default: true
},
share: Boolean
share: Boolean,
thumb: Boolean
},
computed: {
single() {
... ...
... ... @@ -5,7 +5,7 @@
:thumb="true"
:on-fetch="onFetch">
<template v-slot:thumb>
<ArticleItem type="article" v-for="(item, index) in articleThumbList" :key="index" :data="item"></ArticleItem>
<ArticleItem :thumb="true" type="article" v-for="(item, index) in articleThumbList" :key="index" :data="item"></ArticleItem>
</template>
</Article>
</template>
... ...
... ... @@ -25,7 +25,7 @@
</CommentPlaceholder>
</div>
<div class="total-comment">
<div class="total hover-opacity" @click="onShowComment">查看{{articleState.commentCount}}条评论</div>
<div class="total hover-opacity" :class="invisibleClass" @click="onShowComment">查看{{articleState.commentCount}}条评论</div>
<div class="last-time">{{data.date}}</div>
</div>
</div>
... ... @@ -45,13 +45,19 @@ export default {
}
},
type: String,
share: Boolean
share: Boolean,
thumb: Boolean
},
computed: {
...mapState(['articleStates']),
articleState() {
return this.articleStates[this.data.articleId] || this.data;
},
invisibleClass() {
return {
invisible: this.thumb
};
},
},
methods: {
...mapMutations(['ASYNC_ARTICLE_COMMENT']),
... ...
... ... @@ -5,7 +5,7 @@
<span class="user-name">{{data.authorName}}</span>
</div>
<div class="opts">
<WidgetFollow :share="share" :author-uid="data.authorUid" :authorType="data.authorType" :follow="data.hasAttention === 'Y'" @on-follow="onFollow"></WidgetFollow>
<WidgetFollow :class="invisibleClass" :share="share" :author-uid="data.authorUid" :authorType="data.authorType" :follow="data.hasAttention === 'Y'" @on-follow="onFollow"></WidgetFollow>
<i class="iconfont icon-more1" @click="onMore"></i>
</div>
</div>
... ... @@ -29,7 +29,15 @@ export default {
default: true
},
type: String,
share: Boolean
share: Boolean,
thumb: Boolean
},
computed: {
invisibleClass() {
return {
invisible: this.thumb
};
}
},
methods: {
...mapMutations(['CHANGE_AUTHOR_FOLLOW']),
... ...
... ... @@ -20,9 +20,9 @@
<WidgetShare :share="share" @click.native="onShare"></WidgetShare>
</div>
<div class="opts">
<WidgetFav :share="share" :num="articleState.praiseCount" :article-id="data.articleId" :option="praiseOption"></WidgetFav>
<WidgetLike :share="share" :num="articleState.favoriteCount" :article-id="data.articleId" :option="favoriteOption"></WidgetLike>
<WidgetComment :share="share" :num="articleState.commentCount" @click.native="onShowComment"></WidgetComment>
<WidgetFav :class="invisibleClass" :share="share" :num="articleState.praiseCount" :article-id="data.articleId" :option="praiseOption"></WidgetFav>
<WidgetLike :class="invisibleClass" :share="share" :num="articleState.favoriteCount" :article-id="data.articleId" :option="favoriteOption"></WidgetLike>
<WidgetComment :class="invisibleClass" :share="share" :num="articleState.commentCount" @click.native="onShowComment"></WidgetComment>
</div>
</div>
</div>
... ... @@ -43,7 +43,8 @@ export default {
}
},
type: String,
share: Boolean
share: Boolean,
thumb: Boolean
},
data() {
return {
... ... @@ -57,6 +58,11 @@ export default {
},
computed: {
...mapState(['articleStates']),
invisibleClass() {
return {
invisible: this.thumb
};
},
articleState() {
return this.articleStates[this.data.articleId] || this.data;
},
... ...
... ... @@ -3,7 +3,7 @@
<ArticleItemSlideImage v-if="data.blockList.length === 1" :lazy="false" :data="data.blockList[0]" :thumb-size="firstBlockSize"></ArticleItemSlideImage>
<Slide :key="`slide${data.articleId}`" v-else ref="slide" :data="data.blockList" :refresh-reset-current="false" :initial-index="slideIndex - 1" :threshold="0.2" :auto-play="false" :loop="false" :options="scrollOption" @change="onChange">
<SlideItem class="slide-item" :style="slideItemStyle" v-for="(item, inx) in data.blockList" :key="inx">
<ArticleItemSlideImage :lazy="lazy && inx > 0" :data="item" :thumb-size="firstBlockSize"></ArticleItemSlideImage>
<ArticleItemSlideImage v-if="!thumb || inx === 0" :lazy="lazy && inx > 0" :data="item" :thumb-size="firstBlockSize"></ArticleItemSlideImage>
</SlideItem>
<template slot="dots" slot-scope="props">
<span class="slide-dot"
... ... @@ -40,7 +40,8 @@ export default {
type: Boolean,
default: true
},
type: String
type: String,
thumb: Boolean
},
data() {
return {
... ...
<template>
<div class="article-item">
<ArticleItemHeader :type="type" :share="share" :data="headerData" :lazy="lazy" @on-follow="onFollow"></ArticleItemHeader>
<ArticleItemSlide :type="type" :share="share" :data="slideData" :slide-index="data.blockIndex" :lazy="lazy"></ArticleItemSlide>
<ProductGroup v-if="productListData.length" :share="share" :data="productListData" :lazy="lazy"></ProductGroup>
<ArticleItemIntro :type="type" :share="share" :data="introData" @on-expand="onExpand" @on-expanding="onExpanding" @on-show-guang="onShowGuang" @on-show-comment="onShowComment"></ArticleItemIntro>
<ArticleItemComment :type="type" :share="share" :data="commentData" @on-show-comment="onShowComment" @on-resize="onResize"></ArticleItemComment>
<ArticleItemHeader :type="type" :thumb="thumb" :share="share" :data="headerData" :lazy="lazy" @on-follow="onFollow"></ArticleItemHeader>
<ArticleItemSlide :type="type" :thumb="thumb" :share="share" :data="slideData" :slide-index="data.blockIndex" :lazy="lazy"></ArticleItemSlide>
<ProductGroup :thumb="thumb" v-if="productListData.length" :share="share" :data="productListData" :lazy="lazy"></ProductGroup>
<ArticleItemIntro :thumb="thumb" :type="type" :share="share" :data="introData" @on-expand="onExpand" @on-expanding="onExpanding" @on-show-guang="onShowGuang" @on-show-comment="onShowComment"></ArticleItemIntro>
<ArticleItemComment :thumb="thumb" :type="type" :share="share" :data="commentData" @on-show-comment="onShowComment" @on-resize="onResize"></ArticleItemComment>
<div class="line"></div>
</div>
</template>
... ... @@ -27,7 +27,8 @@ export default {
}
},
share: Boolean,
type: String
type: String,
thumb: Boolean
},
computed: {
articleState() {
... ...
... ... @@ -687,4 +687,8 @@ img[lazy=loaded] {
button {
border: none;
}
.invisible {
visibility: hidden;
}
\ No newline at end of file
... ...
const MAX_WIDTH = 750;
export function getArticleImageSize({width, height, MIN_SCALE}) {
width = +width;
height = +height;
if (width > MAX_WIDTH) {
height = height / (width / MAX_WIDTH);
width = MAX_WIDTH;
... ...