Skip to content
This repository has been archived by the owner on Nov 15, 2018. It is now read-only.

Commit

Permalink
feat: 增加从服务端获取每页数据量
Browse files Browse the repository at this point in the history
增加api的部分方法
  • Loading branch information
boxshadow committed May 5, 2018
1 parent ce67210 commit d879aa5
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/api/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import lstore from "@/plugins/lstore/lstore.js";
let cancel;
let pending = {};
const CancelToken = axios.CancelToken;

export const limit = ~~lstore.getData("BOOTSTRAPPERS").limit || 15;
const baseURL =
process.env.NODE_ENV === "production"
? `${process.env.VUE_APP_API_HOST}/api/${process.env.VUE_APP_API_VERSION}`
Expand Down
17 changes: 16 additions & 1 deletion src/api/feeds.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import api, { get } from "./api.js";
import api, { get, limit } from "./api.js";

/**
* 获取 首页动态列表
Expand Down Expand Up @@ -34,3 +34,18 @@ export function getCollectedFeed({ limit = 15, offset = 0 }) {
offset
});
}

// 获取单条动态的评论
export function getFeedComments({ feedId, after = 0 }) {
return get(`/feeds/${feedId}/comments`, {
limit,
after
});
}

export function getFeedCommentPinneds(after = 0) {
return get("/user/feed-comment-pinneds", {
limit,
after
});
}
26 changes: 25 additions & 1 deletion src/api/group.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import api, { get } from "./api.js";
import api, { get, limit } from "./api.js";
import vuex from "@/stores/index.js";

/**
Expand Down Expand Up @@ -168,3 +168,27 @@ export function likeGroupPost(postID, status) {
const method = status ? "delete" : "post";
return api({ method, url, validateStatus: s => s === 201 || s === 204 });
}

/**
* 获取待审核的帖子置顶申请
* @Author Wayne
* @DateTime 2018-05-04
* @Email [email protected]
* @param {Number} after [description]
* @return {[type]} [description]
*/
export function getPostAudits({ after = 0, group = 0 }) {
return get("/plus-group/pinned/posts", {
after,
limit,
group
});
}

export function getPostCommentAudits({ after = 0, post = 0 }) {
return get("/plus-group/pinned/comments", {
after,
limit,
post
});
}
9 changes: 8 additions & 1 deletion src/api/news.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { get } from "./api.js";
import { get, limit } from "./api.js";
const uri = "/user/news/contributes";
/**
* 获取当前用户投稿列表
Expand Down Expand Up @@ -37,3 +37,10 @@ export function searchNewsByKey(key = "", limit = 15, after = 0) {
}
);
}

export function getNewsCommentPinneds(after = 0) {
return get("/news/comments/pinneds", {
limit,
after
});
}

0 comments on commit d879aa5

Please sign in to comment.