diff --git a/src/api/live.js b/src/api/live.js index 72652d7..7678094 100644 --- a/src/api/live.js +++ b/src/api/live.js @@ -1,7 +1,7 @@ import Vue from 'vue'; -async function getLive() { - return Vue.axios.get('/admin/live') +async function getLive(page, size) { + return Vue.axios.get('/admin/live?page=' + (page - 1) + '&size=' + size) } export { getLive } diff --git a/src/views/Live/LiveList.vue b/src/views/Live/LiveList.vue index eb0ffc2..dc4d7bc 100644 --- a/src/views/Live/LiveList.vue +++ b/src/views/Live/LiveList.vue @@ -31,6 +31,10 @@ {{ item.content }} + + @@ -55,7 +59,7 @@ 공개 - @@ -79,6 +93,9 @@ export default { data() { return { isLoading: false, + page: 1, + page_size: 20, + total_page: 0, liveList: [], headers: [ { @@ -99,6 +116,12 @@ export default { sortable: false, value: 'content', }, + { + text: '현재참여인원', + align: 'center', + sortable: false, + value: 'numberOfParticipants', + }, { text: '방장', align: 'center', @@ -152,16 +175,27 @@ export default { this.$dialog.notify.success(message) }, + async next() { + await this.getLive() + }, + async getLive() { this.isLoading = true try { this.isLoading = false - const res = await api.getLive() + const res = await api.getLive(this.page, this.page_size) if (res.status === 200 && res.data.success === true) { - this.liveList = res.data.data.liveList + const data = res.data.data; + const totalPage = Math.ceil(data.totalCount / this.page_size) + this.liveList = data.liveList + + if (totalPage <= 0) + this.total_page = 1 + else + this.total_page = totalPage } else { this.notifyError(res.data.message || '알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.') }