Authored by TaoHuang

fix

... ... @@ -24,6 +24,7 @@
<CommentPlaceholderActionSheet
class="comment-cont"
:dest-id="parentComment.id"
:root-id="parentComment.id"
:pos-id="posId"
:article-id="articleId"
:add-type="1"
... ... @@ -51,6 +52,7 @@
:share="share"
:authorUid="authorUid"
:commentUid="reply.uid"
:article-id="articleId"
@on-comment="onReplyChildren"
@remove-comment="onRemoveComment"
>
... ...
... ... @@ -13,6 +13,7 @@ import CommentPlaceholder from './comment-placeholder';
import { get } from 'lodash';
const { mapActions } = createNamespacedHelpers('comment');
const {mapMutations: articleMapMutations } = createNamespacedHelpers('article');
const ITEM = {
comment: '回复',
... ... @@ -28,11 +29,13 @@ export default {
},
methods: {
...mapActions(['setCommentStatus']),
...articleMapMutations(['SUB_ARTICLE_COMMENT_COUNT']),
async onClick() {
const authorUid = this.$attrs.authorUid;
const commentUid = this.$attrs.commentUid;
const uid = get(await this.$sdk.getUser(), 'uid', 0);
const commentId = this.$attrs['dest-id'];
const articleId = this.$attrs['article-id'];
let menu = [];
if (authorUid === uid || commentUid === uid) {
... ... @@ -76,6 +79,7 @@ export default {
time: 2000
}).show();
this.$emit('remove-comment', { commentId });
this.SUB_ARTICLE_COMMENT_COUNT({ articleId });
} else {
this.$createToast({
txt: '删除失败,请重试',
... ...
... ... @@ -115,10 +115,10 @@ export default {
};
if (result.code === 200) {
this.UPDATE_ARTICLE_COMMENT_COUNT({articleId: this.destId});
this.UPDATE_ARTICLE_COMMENT_COUNT({articleId: this.articleId});
if (this.autoUpdate && this.addType === 0) {
await this.fetchArticleUpdate({articleId: this.destId});
await this.fetchArticleUpdate({articleId: this.articleId});
}
this.$emit('on-comment', {
... ...
... ... @@ -134,13 +134,13 @@ export default {
},
onReply({ comment }) {
forEach(this.commentList, (val) => {
if (val.parentComment && +val.parentComment.id === +comment.parentId) {
if (val.parentComment && +val.parentComment.id === +comment.rootId) {
val.childrenComments.unshift(Object.assign(comment, {
id: comment.destId,
destId: this.articleId,
headIco: this.yoho.context.userHeadIco,
userName: this.yoho.context.userName,
parentUserName: get(find(val.childrenComments, { id: comment.parentId }), 'userName', '')
parentUserName: get(find(val.childrenComments, { id: +comment.parentId }), 'userName', '')
}));
}
});
... ...
<template>
<Layout class="author-fans-page">
<LayoutHeader slot='header' :hide="noHeader" theme="white" class="author-page-header" :title="(isMine ? '我' : 'TA') + '的粉丝'"></LayoutHeader>
<UserList ref="userList" :follow-name="isMine ? '回粉' : '关注'" :on-fetch="onFetch"></UserList>
<UserList ref="userList" type="fans" :follow-name="isMine ? '回粉' : '关注'" :on-fetch="onFetch"></UserList>
</Layout>
</template>
... ...
... ... @@ -5,7 +5,7 @@
<TabBlock @on-change-tab="onChangeTab"></TabBlock>
</template>
</LayoutHeader>
<UserList ref="userList" :on-fetch="onFetch">
<UserList ref="userList" type="follow" :on-fetch="onFetch">
<template v-if="activeType == 0" #item="{ data }">
<TopicItem :data="data"></TopicItem>
</template>
... ...
... ... @@ -58,7 +58,8 @@ export default {
onFetch: {
type: Function,
required: true
}
},
type: String
},
data() {
return {
... ... @@ -128,7 +129,13 @@ export default {
});
},
onFollow(follow, index) {
this.list[index].isAttention = follow;
if (this.type === 'fans') {
// 粉丝是已关注的列表,你关注他,就变成互相关注
this.list[index].isAttention = 'O';
} else {
this.list[index].isAttention = follow;
}
},
toUserPage(item) {
this.$router.push({
... ...
... ... @@ -212,6 +212,14 @@ export default {
updateArticleState(state, article);
}
},
[Types.SUB_ARTICLE_COMMENT_COUNT](state, {articleId, commentCount}) {
let article = state.articleStates[articleId];
if (article) {
article.commentCount = commentCount ? commentCount : (article.commentCount - 1);
updateArticleState(state, article);
}
},
[Types.ASYNC_ARTICLE_COMMENT](state, {articleId, type}) {
state[articlefield(type)].forEach(article => {
if (article.articleId === articleId) {
... ...
... ... @@ -26,6 +26,7 @@ export const CHANGE_ARTICLE_LIST_SLIDE = 'CHANGE_ARTICLE_LIST_SLIDE';
export const UPDATE_ARTICLE_STATE = 'UPDATE_ARTICLE_STATE';
export const UPDATE_ARTICLE_COMMENT_COUNT = 'UPDATE_ARTICLE_COMMENT_COUNT';
export const SUB_ARTICLE_COMMENT_COUNT = 'SUB_ARTICLE_COMMENT_COUNT';
export const ASYNC_ARTICLE_COMMENT = 'ASYNC_ARTICLE_COMMENT';
export const CHANGE_ARTICLE_LIST_INTRO = 'CHANGE_ARTICLE_LIST_INTRO';
export const CHANGE_ARTICLE_LIST_INTRO_HEIGHT = 'CHANGE_ARTICLE_LIST_INTRO_HEIGHT';
... ...
{
"name": "yoho-community-web",
"version": "6.9.11-beta1",
"version": "6.9.11-beta2",
"private": true,
"description": "A New Yohobuy Project With Express",
"repository": {
... ...