actions.js
1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import * as Types from './types';
export default {
async fetchCommentList({commit}, {destId, columnType = 1001, limit = 20, page = 1}) {
commit(Types.FETCH_COMMENT_REQUEST);
const result = await this.$api.get('/api/grass/queryArticleComments', {
destId,
limit,
page,
columnType
});
if (result && result.code === 200) {
if (!result.data.commentInfos) {
result.data.commentInfos = [];
}
commit(Types.FETCH_COMMENT_SUCCESS);
} else {
commit(Types.FETCH_COMMENT_FAILD);
}
return result;
},
async fetchReplayList(actions, {commentId}) {
const result = await this.$api.get('/api/grass/queryArticleCommentReply', {
commentId,
limit: 200,
page: 1,
});
if (result && result.code === 200) {
if (!result.data.childrenComments) {
result.data.childrenComments = [];
}
}
return result;
},
async fetchCommentFeebbackList({commit}, {commentId, limit = 10, page = 1}) {
commit(Types.FETCH_COMMENT_FEEDBACK_REQUEST);
const result = await this.$api.get('/api/grass/queryArticleCommentReply', {
commentId,
limit,
page,
});
if (result && result.code === 200) {
if (!result.data.childrenComments) {
result.data.childrenComments = [];
}
commit(Types.FETCH_COMMENT_FEEDBACK_SUCCESS);
} else {
commit(Types.FETCH_COMMENT_FEEDBACK_FAILD);
}
return result;
},
async postComment(actions, {content, destId, commentId, addType, columnType = 1001}) {
const result = await this.$api.post('/api/grass/addArticleComment', {
destId,
content,
addType,
commentId,
columnType
});
return result;
}
};