From 45da8cfddf32b2e01895b175674b180276a271d3 Mon Sep 17 00:00:00 2001 From: fuyanbin Date: Wed, 18 Dec 2019 15:54:04 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=A6=96=E9=A1=B5=E5=85=AC?= =?UTF-8?q?=E5=91=8A=E4=B8=8D=E8=83=BD=E6=AD=A3=E5=B8=B8=E5=88=86=E9=A1=B5?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/oj/api.js | 10 ++++++++-- src/pages/oj/views/general/Announcements.vue | 6 +----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/pages/oj/api.js b/src/pages/oj/api.js index 46b2fcf..4acfeba 100644 --- a/src/pages/oj/api.js +++ b/src/pages/oj/api.js @@ -13,8 +13,14 @@ export default { params }) }, - getAnnouncementList () { - return ajax('announcement', 'get') + getAnnouncementList (offset, limit) { + let params = { + offset: offset, + limit: limit + } + return ajax('announcement', 'get', { + params + }) }, login (data) { return ajax('login', 'post', { diff --git a/src/pages/oj/views/general/Announcements.vue b/src/pages/oj/views/general/Announcements.vue index af24a43..e497532 100644 --- a/src/pages/oj/views/general/Announcements.vue +++ b/src/pages/oj/views/general/Announcements.vue @@ -69,12 +69,8 @@ } }, getAnnouncementList (page = 1) { - let params = { - limit: this.limit, - offset: (page - 1) * this.limit - } this.btnLoading = true - api.getAnnouncementList(params).then(res => { + api.getAnnouncementList((page - 1) * this.limit, this.limit).then(res => { this.btnLoading = false this.announcements = res.data.data.results this.total = res.data.data.total