Authored by 陈峰

commit

... ... @@ -15,12 +15,16 @@ export default {
user: {
type: String,
default: ''
}
},
share: Boolean
},
methods: {
...mapActions(['postComment']),
...articleMapActions(['fetchArticleUpdate']),
async openComentInput() {
if (this.share) {
return this.$links.toDownloadApp();
}
const user = await this.$sdk.getUser();
if (user && user.uid) {
... ...
... ... @@ -26,7 +26,8 @@ export default {
props: {
single: Boolean,
lazy: Boolean,
product: Object
product: Object,
share: Boolean
},
data() {
return {
... ... @@ -50,6 +51,9 @@ export default {
methods: {
...mapActions(['postProductFav']),
async onFav() {
if (this.share) {
return this.$links.toDownloadApp();
}
if (this.posting) {
return;
}
... ...
... ... @@ -2,6 +2,7 @@
<div class="product-group">
<ProductGroupItem
v-for="(product, inx) in data"
:share="share"
:single="single"
:product="product"
:lazy="lazy"
... ... @@ -25,7 +26,8 @@ export default {
lazy: {
type: Boolean,
default: true
}
},
share: Boolean
},
computed: {
single() {
... ...
<template>
<WidgetIconBtn type="msg" :text="num" :option="selfOption"></WidgetIconBtn>
<WidgetIconBtn type="msg" :share="share" :text="num" :option="selfOption"></WidgetIconBtn>
</template>
<script>
... ... @@ -7,7 +7,8 @@ export default {
name: 'WidgetComment',
props: {
num: [String, Number],
option: Object
option: Object,
share: Boolean
},
computed: {
selfOption() {
... ...
<template>
<WidgetIconBtn type="fav" :text="num" :article-id="articleId" :comment-id="commentId" :option="option"></WidgetIconBtn>
<WidgetIconBtn type="fav" :share="share" :text="num" :article-id="articleId" :comment-id="commentId" :option="option"></WidgetIconBtn>
</template>
<script>
... ... @@ -9,7 +9,8 @@ export default {
num: [String, Number],
articleId: Number,
commentId: Number,
option: Object
option: Object,
share: Boolean
}
};
</script>
... ...
... ... @@ -16,7 +16,8 @@ export default {
authorType: {
type: [Number, String],
default: 1
}
},
share: Boolean
},
data() {
return {
... ... @@ -43,6 +44,9 @@ export default {
methods: {
...mapActions(['followUser']),
async onFollow() {
if (this.share) {
return this.$links.toDownloadApp();
}
if (this.loading) {
return;
}
... ...
... ... @@ -65,7 +65,8 @@ export default {
default() {
return defaultOption;
}
}
},
share: Boolean
},
data() {
return {
... ... @@ -189,6 +190,9 @@ export default {
}
},
onClick(evt) {
if (this.share) {
return this.$links.toDownloadApp();
}
if (this.syncing) {
return;
}
... ...
<template>
<WidgetIconBtn type="star" :text="num" :article-id="articleId" :comment-id="commentId" :option="option"></WidgetIconBtn>
<WidgetIconBtn type="star" :share="share" :text="num" :article-id="articleId" :comment-id="commentId" :option="option"></WidgetIconBtn>
</template>
<script>
... ... @@ -9,7 +9,8 @@ export default {
num: [String, Number],
articleId: Number,
commentId: Number,
option: Object
option: Object,
share: Boolean
}
};
</script>
... ...
... ... @@ -10,6 +10,7 @@ import {get} from 'lodash';
import Lazy from 'vue-lazyload';
import yoho from 'common/yoho';
import sdk from 'common/sdk';
import links from 'utils/links';
import InitClient from 'utils/init-client';
import 'statics/scss/common.scss';
import 'statics/scss/grass-prompt.scss';
... ... @@ -30,6 +31,7 @@ window._router = get(store, 'state.yoho.context.route');
Vue.prop('yoho', yoho);
Vue.prop('sdk', sdk);
Vue.prop('links', links);
Vue.prop('auth', function() {
if (!get(this.$store, '$context.isLogin')) {
this.$sdk && this.$sdk.goLogin && this.$sdk.goLogin();
... ...
<template>
<Article
ref="article"
type="article"
share
:on-fetch="onFetch">
</Article>
</template>
<script>
import {get} from 'lodash';
import Article from './components/article/article';
import ArticleItem from './components/article/article-item';
import {createNamespacedHelpers} from 'vuex';
const {mapActions} = createNamespacedHelpers('article');
export default {
name: 'ArticleSharePage',
data() {
return {
page: 1,
id: 0,
};
},
created() {
this.id = +this.$route.params.id;
},
activated() {
if (+this.$route.params.id !== this.id) {
this.id = +this.$route.params.id;
this.init();
}
},
methods: {
...mapActions(['fetchArticleList']),
init() {
this.page = 1;
this.$refs.article.init();
},
async onFetch() {
const articleId = parseInt(this.id, 10);
if (!articleId) {
return;
}
const result = await this.fetchArticleList({
articleId,
page: this.page,
authorUid: this.authorUid,
authorType: this.authorType,
type: this.type
});
if (result.code === 200) {
if (get(result, 'data.detailList', []).length) {
this.page++;
return Promise.resolve(result.data.detailList);
}
return Promise.resolve(false);
} else {
this.$createToast && this.$createToast({
txt: result.message || '服务器开小差了',
type: 'warn',
time: 1000
}).show();
}
}
},
components: {
Article,
ArticleItem
}
};
</script>
<style lang="scss" scoped>
.article-page {
background-color: #f0f0f0;
}
</style>
... ...
<template>
<div class="article-item-comment">
<CommentPlaceholder
:share="share"
tag="p"
class="comment-item"
v-for="(comment, inx) in data.comments"
... ... @@ -14,6 +15,7 @@
</CommentPlaceholder>
<div class="comment">
<CommentPlaceholder
:share="share"
class="comment-input hover-opacity"
:dest-id="data.articleId"
:add-type="0"
... ... @@ -42,7 +44,8 @@ export default {
return {};
}
},
type: String
type: String,
share: Boolean
},
computed: {
...mapState(['articleStates']),
... ... @@ -53,6 +56,9 @@ export default {
methods: {
...mapMutations(['ASYNC_ARTICLE_COMMENT']),
onShowComment() {
if (this.share) {
return this.$links.toDownloadApp();
}
if (this.articleState.commentCount) {
this.$emit('on-show-comment');
}
... ...
<template>
<div class="article-item-header">
<router-link class="avatar" :to="`/grass/author/${data.authorType}/${data.authorUid}`">
<WidgetAvatar :lazy="lazy" class="widget-avatar" :src="data.authorHeadIco" :width="70" :height="70"></WidgetAvatar>
<div class="avatar" @click="toUserPage">
<WidgetAvatar :share="share" :lazy="lazy" class="widget-avatar" :src="data.authorHeadIco" :width="70" :height="70"></WidgetAvatar>
<span class="user-name">{{data.authorName}}</span>
</router-link>
</div>
<div class="opts">
<WidgetFollow :author-uid="data.authorUid" :authorType="data.authorType" :follow="data.hasAttention === 'Y'" @on-follow="onFollow"></WidgetFollow>
<WidgetFollow :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>
... ... @@ -28,7 +28,8 @@ export default {
type: Boolean,
default: true
},
type: String
type: String,
share: Boolean
},
methods: {
...mapMutations(['CHANGE_AUTHOR_FOLLOW']),
... ... @@ -46,6 +47,18 @@ export default {
}
}).show();
},
toUserPage() {
if (this.share) {
return this.$links.toDownloadApp();
}
this.$router.push({
name: 'author',
params: {
type: this.data.authorType,
id: this.data.authorUid
}
});
},
onFollow(follow) {
this.CHANGE_AUTHOR_FOLLOW({authorUid: this.data.authorUid, follow, type: this.type});
this.$emit('on-follow', follow);
... ...
... ... @@ -8,6 +8,7 @@
</div>
<div class="topics">
<WidgetTopic
:share="share"
:topic="label.labelName"
@click.native="onTopic(label)"
v-for="label in data.labelList"
... ... @@ -16,12 +17,12 @@
</div>
<div class="widgets">
<div class="share">
<WidgetShare @click.native="onShare"></WidgetShare>
<WidgetShare :share="share" @click.native="onShare"></WidgetShare>
</div>
<div class="opts">
<WidgetFav :num="articleState.praiseCount" :article-id="data.articleId" :option="praiseOption"></WidgetFav>
<WidgetLike :num="articleState.favoriteCount" :article-id="data.articleId" :option="favoriteOption"></WidgetLike>
<WidgetComment :num="articleState.commentCount" @click.native="onShowComment"></WidgetComment>
<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>
</div>
</div>
</div>
... ... @@ -40,7 +41,8 @@ export default {
return {};
}
},
type: String
type: String,
share: Boolean
},
data() {
return {
... ... @@ -122,6 +124,9 @@ export default {
methods: {
...mapMutations(['CHANGE_ARTICLE_LIST_INTRO_HEIGHT', 'CHANGE_ARTICLE_LIST_INTRO']),
onTopic({labelId, labelName}) {
if (this.share) {
return this.$links.toDownloadApp();
}
this.$router.push({
name: 'topic',
params: {
... ... @@ -132,9 +137,9 @@ export default {
},
onShare() {
this.$yoho.share({
title: '逛资讯',
imgUrl: this.data.imageUrl,
link: `http://yoho-community-web.test3.ingress.dev.yohocorp.com/article/${this.data.articleId}?isShare=1`,
title: '逛',
imgUrl: this.data.shareImage,
link: `http://yoho-community-web.test3.ingress.dev.yohocorp.com/grass/article/share/${this.data.articleId}`,
desc: this.data.intro,
hideType: ['7', '8', '9']
});
... ...
<template>
<div class="article-item">
<ArticleItemHeader :type="type" :data="headerData" :lazy="lazy" @on-follow="onFollow"></ArticleItemHeader>
<ArticleItemSlide :type="type" :data="slideData" :slide-index="data.blockIndex" :lazy="lazy"></ArticleItemSlide>
<ProductGroup v-if="productListData.length" :data="productListData" :lazy="lazy"></ProductGroup>
<ArticleItemIntro :type="type" :data="introData" @on-expand="onExpand" @on-expanding="onExpanding" @on-show-guang="onShowGuang" @on-show-comment="onShowComment"></ArticleItemIntro>
<ArticleItemComment :type="type" :data="commentData" @on-show-comment="onShowComment" @on-resize="onResize"></ArticleItemComment>
<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>
<div class="line"></div>
</div>
</template>
... ... @@ -26,6 +26,7 @@ export default {
return {};
}
},
share: Boolean,
type: String
},
computed: {
... ... @@ -60,7 +61,7 @@ export default {
praiseCount: this.data.praiseCount,
favoriteCount: this.data.favoriteCount,
articleId: this.data.articleId,
imageUrl: get(first(this.slideData.blockList), 'contentData', '').replace('{mode}', 2).replace('{width}', 200).replace('{height}', 200)
shareImage: get(first(this.slideData.blockList), 'contentData', '').replace('{mode}', 2).replace('{width}', 200).replace('{height}', 200)
};
},
commentData() {
... ...
... ... @@ -3,13 +3,13 @@
<Layout class="article">
<LayoutHeader theme="white" slot='header' :title="title" :opacity="currentAuthor.opacity">
<template v-if="showHeader">
<router-link class="avatar-wrapper" :to="`/grass/author/${currentAuthor.authorType}/${currentAuthor.authorUid}`">
<div class="avatar-wrapper" @click="toUserPage">
<WidgetAvatar class="widget-avatar" :src="currentAuthor.authorHeadIco" :width="70" :height="70"></WidgetAvatar>
<span class="user-name">{{currentAuthor.authorName}}</span>
</router-link>
</div>
</template>
<template v-if="showHeader" v-slot:opts>
<WidgetFollow class="widget-follow" :author-uid="currentAuthor.authorUid" :follow="currentAuthor.hasAttention === 'Y'" @on-follow="follow => onFollow(currentAuthor, follow)"></WidgetFollow>
<WidgetFollow :share="share" class="widget-follow" :author-uid="currentAuthor.authorUid" :follow="currentAuthor.hasAttention === 'Y'" @on-follow="follow => onFollow(currentAuthor, follow)"></WidgetFollow>
</template>
</LayoutHeader>
<LayoutRecycleList :size="30" ref="scroll" @scroll="onScroll" :offset="2000" :on-fetch="onFetch">
... ... @@ -19,6 +19,7 @@
:type="type"
:data="data"
:data-id="data.articleId"
:share="share"
@on-follow="follow => onFollow(data, follow)"
@on-resize="onResize"
@on-show-guang="onShowGuang"
... ... @@ -48,6 +49,7 @@ export default {
type: String,
default: '逛'
},
share: Boolean,
type: String,
onFetch: Function
},
... ... @@ -82,6 +84,18 @@ export default {
},
methods: {
...mapMutations(['CHANGE_ARTICLE_LIST_PRELAZY', 'ASYNC_ARTICLE_COMMENT']),
toUserPage() {
if (this.share) {
return this.$links.toDownloadApp();
}
this.$router.push({
name: 'author',
params: {
type: this.currentAuthor.authorType,
id: this.currentAuthor.authorUid
}
});
},
onShowComment({articleId, index}) {
this.articleId = articleId;
this.articleIndex = index;
... ...
... ... @@ -7,6 +7,14 @@ export default [{
keepAlive: true
}
}, {
path: '/article/share/:id',
name: 'article.share',
alias: '/article/share/:id',
component: () => import(/* webpackChunkName: "article" */ './article-share'),
meta: {
keepAlive: true
}
}, {
path: '/article/:id/user/:type/:authorType/:authorUid',
name: 'article.user',
alias: '/article/:id/user/:type/:authorType/:authorUid',
... ...
export default {
toDownloadApp() {
window.location.href = 'https://union.yoho.cn/union/app-downloads.html?union_type=100000000000349&client_id=1927079456&openby:yohobuy={"action":"go.home","params":{"channel":"1"}}';
}
};
... ...