라이브 리스트 - 현재참여인원 추가 #34
@@ -1,7 +1,7 @@
 | 
				
			|||||||
import Vue from 'vue';
 | 
					import Vue from 'vue';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
async function getLive() {
 | 
					async function getLive(page, size) {
 | 
				
			||||||
    return Vue.axios.get('/admin/live')
 | 
					    return Vue.axios.get('/admin/live?page=' + (page - 1) + '&size=' + size)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export { getLive }
 | 
					export { getLive }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -31,6 +31,10 @@
 | 
				
			|||||||
              {{ item.content }}
 | 
					              {{ item.content }}
 | 
				
			||||||
            </template>
 | 
					            </template>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            <template v-slot:item.numberOfParticipants="{ item }">
 | 
				
			||||||
 | 
					              {{ item.numberOfParticipants }}
 | 
				
			||||||
 | 
					            </template>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            <template v-slot:item.nickname="{ item }">
 | 
					            <template v-slot:item.nickname="{ item }">
 | 
				
			||||||
              {{ item.managerNickname }}
 | 
					              {{ item.managerNickname }}
 | 
				
			||||||
            </template>
 | 
					            </template>
 | 
				
			||||||
@@ -55,7 +59,7 @@
 | 
				
			|||||||
              <span v-else>공개</span>
 | 
					              <span v-else>공개</span>
 | 
				
			||||||
            </template>
 | 
					            </template>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            <template v-slot:item.nickname="{ item }">
 | 
					            <template v-slot:item.password="{ item }">
 | 
				
			||||||
              {{ item.password }}
 | 
					              {{ item.password }}
 | 
				
			||||||
            </template>
 | 
					            </template>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -66,6 +70,16 @@
 | 
				
			|||||||
          </v-data-table>
 | 
					          </v-data-table>
 | 
				
			||||||
        </v-col>
 | 
					        </v-col>
 | 
				
			||||||
      </v-row>
 | 
					      </v-row>
 | 
				
			||||||
 | 
					      <v-row class="text-center">
 | 
				
			||||||
 | 
					        <v-col>
 | 
				
			||||||
 | 
					          <v-pagination
 | 
				
			||||||
 | 
					            v-model="page"
 | 
				
			||||||
 | 
					            :length="total_page"
 | 
				
			||||||
 | 
					            circle
 | 
				
			||||||
 | 
					            @input="next"
 | 
				
			||||||
 | 
					          />
 | 
				
			||||||
 | 
					        </v-col>
 | 
				
			||||||
 | 
					      </v-row>
 | 
				
			||||||
    </v-container>
 | 
					    </v-container>
 | 
				
			||||||
  </div>
 | 
					  </div>
 | 
				
			||||||
</template>
 | 
					</template>
 | 
				
			||||||
@@ -79,6 +93,9 @@ export default {
 | 
				
			|||||||
  data() {
 | 
					  data() {
 | 
				
			||||||
    return {
 | 
					    return {
 | 
				
			||||||
      isLoading: false,
 | 
					      isLoading: false,
 | 
				
			||||||
 | 
					      page: 1,
 | 
				
			||||||
 | 
					      page_size: 20,
 | 
				
			||||||
 | 
					      total_page: 0,
 | 
				
			||||||
      liveList: [],
 | 
					      liveList: [],
 | 
				
			||||||
      headers: [
 | 
					      headers: [
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
@@ -99,6 +116,12 @@ export default {
 | 
				
			|||||||
          sortable: false,
 | 
					          sortable: false,
 | 
				
			||||||
          value: 'content',
 | 
					          value: 'content',
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					          text: '현재참여인원',
 | 
				
			||||||
 | 
					          align: 'center',
 | 
				
			||||||
 | 
					          sortable: false,
 | 
				
			||||||
 | 
					          value: 'numberOfParticipants',
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
          text: '방장',
 | 
					          text: '방장',
 | 
				
			||||||
          align: 'center',
 | 
					          align: 'center',
 | 
				
			||||||
@@ -152,16 +175,27 @@ export default {
 | 
				
			|||||||
      this.$dialog.notify.success(message)
 | 
					      this.$dialog.notify.success(message)
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    async next() {
 | 
				
			||||||
 | 
					      await this.getLive()
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    async getLive() {
 | 
					    async getLive() {
 | 
				
			||||||
      this.isLoading = true
 | 
					      this.isLoading = true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      try {
 | 
					      try {
 | 
				
			||||||
        this.isLoading = false
 | 
					        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) {
 | 
					        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 {
 | 
					        } else {
 | 
				
			||||||
          this.notifyError(res.data.message || '알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.')
 | 
					          this.notifyError(res.data.message || '알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.')
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user