Blame view

apps/store/user/actions.js 3.4 KB
yyq authored
1 2
import * as Types from './types';
陈峰 authored
3
export default {
TaoHuang authored
4
  async followUser(actions, {followUid, status, authorType}) {
htoooth authored
5
    const result = await this.$api.post('/api/grass/updateAttention', {
陈峰 authored
6 7
      followUid,
      status,
TaoHuang authored
8 9
      attentionType: 1,
      authorType
陈峰 authored
10 11 12 13 14
    });

    return result;
  },
  async followTopic(actions, {topicId, status}) {
htoooth authored
15
    const result = await this.$api.post('/api/grass/updateAttention', {
陈峰 authored
16 17 18 19 20 21 22
      topicId,
      status,
      attentionType: 0
    });

    return result;
  },
yyq authored
23
  async followArticle(actions, {articleId, status}) {
htoooth authored
24
    const result = await this.$api.post('/api/grass/updateFavorite', {
yyq authored
25 26 27 28 29 30 31
      articleId,
      isAdd: status ? 'Y' : 'N'
    });

    return result;
  },
  async praiseArticle(actions, {articleId, status}) {
陈峰 authored
32
    const result = await this.$api.post('/api/grass/updateArticlePraise', {
yyq authored
33 34 35 36 37 38 39
      articleId,
      status: status ? 0 : 1
    });

    return result;
  },
  async praiseComment(actions, {commentId, status}) {
陈峰 authored
40
    const result = await this.$api.post('/api/grass/updateCommentPraise', {
yyq authored
41 42 43 44 45 46
      commentId,
      status: status ? 0 : 1
    });

    return result;
  },
yyq authored
47 48
  async autherBaseInfo({commit}, {authorUid, authorType}) {
    commit(Types.FETCH_AUTHOR_INFO_REQUEST);
yyq authored
49 50 51 52 53
    const result = await this.$api.get('/api/grass/getGrassUserBaseInfo', {
      authorUid,
      authorType
    });
yyq authored
54 55 56 57 58 59 60 61 62
    if (result && result.code === 200) {
      if (!result.data) {
        result.data = {};
      }
      commit(Types.FETCH_AUTHOR_INFO_SUCCESS, result);
    } else {
      commit(Types.FETCH_AUTHOR_INFO_FAILD);
    }
yyq authored
63 64 65 66 67 68 69 70 71 72
    return result;
  },
  async autherAritcleNum(actions, {authorUid, authorType}) {
    const result = await this.$api.get('/api/grass/getGrassPubAndFavorNum', {
      authorUid,
      authorType
    });

    return result;
  },
yyq authored
73
  async autherPubList(actions, {authorUid, authorType, limit, page, lastedTime}) {
yyq authored
74 75 76
    const result = await this.$api.get('/api/grass/userPublishedArticleList', {
      authorUid,
      authorType,
yyq authored
77
      limit,
yyq authored
78 79 80 81 82 83
      page,
      lastedTime
    });

    return result;
  },
yyq authored
84
  async autherFavList(actions, {authorUid, authorType, limit, page, lastedTime}) {
yyq authored
85 86 87
    const result = await this.$api.get('/api/grass/userFavouriteArticleList', {
      authorUid,
      authorType,
yyq authored
88
      limit,
yyq authored
89 90 91 92 93 94
      page,
      lastedTime
    });

    return result;
  },
yyq authored
95 96
  async autherMineBaseInfo({commit}, {authorType}) {
    commit(Types.FETCH_AUTHOR_INFO_REQUEST);
yyq authored
97 98 99 100
    const result = await this.$api.get('/api/grass/getMineGrassBaseInfo', {
      authorType
    });
yyq authored
101 102 103 104 105 106 107 108 109
    if (result && result.code === 200) {
      if (!result.data) {
        result.data = {};
      }
      commit(Types.FETCH_AUTHOR_INFO_SUCCESS, result);
    } else {
      commit(Types.FETCH_AUTHOR_INFO_FAILD);
    }
yyq authored
110 111 112 113 114 115 116 117 118
    return result;
  },
  async autherMineAritcleNum(actions, {authorType}) {
    const result = await this.$api.get('/api/grass/getMineGrassPubAndFavorNum', {
      authorType
    });

    return result;
  },
yyq authored
119
  async autherMinePubList(actions, {authorType, limit, page, lastedTime}) {
yyq authored
120 121
    const result = await this.$api.get('/api/grass/minePublishedArticleList', {
      authorType,
yyq authored
122
      limit,
yyq authored
123 124 125 126 127 128
      page,
      lastedTime
    });

    return result;
  },
yyq authored
129
  async autherMineFavList(actions, {authorType, limit, page, lastedTime}) {
yyq authored
130 131
    const result = await this.$api.get('/api/grass/mineFavouriteArticleList', {
      authorType,
yyq authored
132
      limit,
yyq authored
133 134 135 136 137 138
      page,
      lastedTime
    });

    return result;
  },
陈峰 authored
139
};