Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yoho-community-web
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
1
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
陈峰
6 years ago
Commit
5cdec02380a2b74788d05ad85c5358c987ac487d
1 parent
f6019b70
commit
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
56 additions
and
21 deletions
apps/components/products/product-group-item.vue
apps/components/products/product-group.vue
apps/pages/article/article.vue
apps/pages/article/components/article/article-item-comment.vue
apps/pages/article/components/article/article-item-header.vue
apps/pages/article/components/article/article-item-intro.vue
apps/pages/article/components/article/article-item-slide.vue
apps/pages/article/components/article/article-item.vue
apps/statics/scss/common.scss
apps/utils/image-handler.js
apps/components/products/product-group-item.vue
View file @
5cdec02
...
...
@@ -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']),
...
...
apps/components/products/product-group.vue
View file @
5cdec02
...
...
@@ -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() {
...
...
apps/pages/article/article.vue
View file @
5cdec02
...
...
@@ -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>
...
...
apps/pages/article/components/article/article-item-comment.vue
View file @
5cdec02
...
...
@@ -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']),
...
...
apps/pages/article/components/article/article-item-header.vue
View file @
5cdec02
...
...
@@ -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']),
...
...
apps/pages/article/components/article/article-item-intro.vue
View file @
5cdec02
...
...
@@ -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;
},
...
...
apps/pages/article/components/article/article-item-slide.vue
View file @
5cdec02
...
...
@@ -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 {
...
...
apps/pages/article/components/article/article-item.vue
View file @
5cdec02
<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() {
...
...
apps/statics/scss/common.scss
View file @
5cdec02
...
...
@@ -687,4 +687,8 @@ img[lazy=loaded] {
button
{
border
:
none
;
}
.invisible
{
visibility
:
hidden
;
}
\ No newline at end of file
...
...
apps/utils/image-handler.js
View file @
5cdec02
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
;
...
...
Please
register
or
login
to post a comment