From e2fa57b1492551c34147b3430a4f9ed6a89b0128 Mon Sep 17 00:00:00 2001 From: mutoe Date: Tue, 3 Jul 2018 11:31:36 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20(#273)=20=E9=97=AE=E9=A2=98=E5=9B=9E?= =?UTF-8?q?=E7=AD=94=E6=89=93=E8=B5=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/question/answer.js | 30 ++++++++++++++ src/page/article/ArticleLikes.vue | 20 ++++----- src/page/article/ArticleRewards.vue | 5 ++- src/page/question/AnswerDetail.vue | 63 +++++++++++++++++++++++++---- src/routers/question.js | 29 +++++++++++++ 5 files changed, 129 insertions(+), 18 deletions(-) diff --git a/src/api/question/answer.js b/src/api/question/answer.js index be80a6f7..836438ef 100644 --- a/src/api/question/answer.js +++ b/src/api/question/answer.js @@ -81,3 +81,33 @@ export function getAnswer(answerId) { const url = `/question-answers/${answerId}`; return api.get(url, { validateStatus: s => s === 200 }); } + +/** + * 打赏回答 + * @author mutoe + * @export + * @param {number} answerId + * @param {Object} payload + * @param {number} payload.amount 打赏金额 + * @returns + */ +export function rewardAnswer(answerId, payload) { + const url = `/question-answers/${answerId}/new-rewards`; + return api.post(url, payload, { validateStatus: s => s === 200 }); +} + +/** + * 获取打赏列表 + * @author mutoe + * @export + * @param {number} answerId + * @param {Object} params + * @param {string} [params.type = 'time'] time 按时间倒序 amount 按金额倒序 + * @param {number} [params.limit = 20] limit + * @param {number} [params.offset = 0] offset + * @returns + */ +export function getRewards(answerId, params) { + const url = `/question-answers/${answerId}/rewarders`; + return api.get(url, { params, validateStatus: s => s === 200 }); +} diff --git a/src/page/article/ArticleLikes.vue b/src/page/article/ArticleLikes.vue index 24b27df7..f185658f 100644 --- a/src/page/article/ArticleLikes.vue +++ b/src/page/article/ArticleLikes.vue @@ -1,15 +1,15 @@