From e4ac54ed2dbeb3a64013b2cea1c3d8be3e62bb7e Mon Sep 17 00:00:00 2001 From: x ronger Date: Tue, 15 Sep 2020 22:15:02 +0800 Subject: [PATCH] =?UTF-8?q?:bug:=20=E7=94=A8=E6=88=B7/=E8=A7=92=E8=89=B2?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E7=95=8C=E9=9D=A2=E5=88=86=E9=A1=B5=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/admin/roles.vue | 8 +++++--- pages/admin/users.vue | 8 +++++--- store/admin.js | 14 ++++++++++++-- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/pages/admin/roles.vue b/pages/admin/roles.vue index 8d545a5..585232e 100644 --- a/pages/admin/roles.vue +++ b/pages/admin/roles.vue @@ -177,16 +177,18 @@ }); }); }, - handleSizeChange(page) { + handleSizeChange(pageSize) { let _ts = this; _ts.$store.dispatch('admin/fetchRoles', { - page: page + page: _ts.pagination.currentPage, + rows: pageSize }) }, handleCurrentChange(page) { let _ts = this; _ts.$store.dispatch('admin/fetchRoles', { - page: page + page: page, + rows: _ts.pagination.pageSize }) } } diff --git a/pages/admin/users.vue b/pages/admin/users.vue index bad7272..d2876c4 100644 --- a/pages/admin/users.vue +++ b/pages/admin/users.vue @@ -178,16 +178,18 @@ }); }); }, - handleSizeChange(page) { + handleSizeChange(pageSize) { let _ts = this; _ts.$store.dispatch('admin/fetchUsers', { - page: page + page: _ts.pagination.currentPage, + rows: pageSize }) }, handleCurrentChange(page) { let _ts = this; _ts.$store.dispatch('admin/fetchUsers', { - page: page + page: page, + rows: _ts.pagination.pageSize }) }, updateRole() { diff --git a/store/admin.js b/store/admin.js index ce45f70..ba4c39d 100644 --- a/store/admin.js +++ b/store/admin.js @@ -42,9 +42,14 @@ export const actions = { commit('updateUsersData', getDefaultUsersData()) commit('updateFetching', true) + let data = { + page: params.page || 1, + rows: params.rows || 10 + } + return this.$axios .$get(`${ADMIN_API_PATH}/users`, { - params: params + params: data }) .then(response => { commit('updateFetching', false); @@ -60,9 +65,14 @@ export const actions = { commit('updateRolesData', getDefaultRolesData()) commit('updateFetching', true) + let data = { + page: params.page || 1, + rows: params.rows || 10 + } + return this.$axios .$get(`${ADMIN_API_PATH}/roles`, { - params: params + params: data }) .then(response => { commit('updateFetching', false);