|
@@ -33,9 +33,22 @@
|
|
|
</a-row>
|
|
|
<a-row>
|
|
|
<div class="container">
|
|
|
- <a-table :columns="columns" :data-source="data" bordered>
|
|
|
- <template #name="{ text }">
|
|
|
- <a>{{ text }}</a>
|
|
|
+ <a-table
|
|
|
+ :columns="columns"
|
|
|
+ :data-source="roomList"
|
|
|
+ :pagination="pagination"
|
|
|
+ bordered
|
|
|
+ >
|
|
|
+ <template #bodyCell="{ column, text }">
|
|
|
+ <template v-if="column.dataIndex === 'sceneNameList'">
|
|
|
+ {{ text[0] }}
|
|
|
+ </template>
|
|
|
+ <template v-if="column.dataIndex === 'roomStatus'">
|
|
|
+ <span v-if="text == 0">未开始</span>
|
|
|
+ <span v-if="text == 1">带看中</span>
|
|
|
+ <span v-if="text == 2">已结束</span>
|
|
|
+
|
|
|
+ </template>
|
|
|
</template>
|
|
|
</a-table>
|
|
|
</div>
|
|
@@ -44,11 +57,30 @@
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
-import { computed, onMounted, UnwrapRef, reactive } from 'vue'
|
|
|
+import { computed, onMounted, UnwrapRef, reactive, unref } from 'vue'
|
|
|
import { TableColumnProps } from 'ant-design-vue'
|
|
|
import { useStatisticStore } from '@/store/modules/statistic'
|
|
|
|
|
|
const statisticStore = useStatisticStore()
|
|
|
+// const total = computed(() => statisticStore.allRoom.total)
|
|
|
+const pagination = computed(() => {
|
|
|
+ return {
|
|
|
+ current: statisticStore.allRoom.pageNum,
|
|
|
+ total: statisticStore.allRoom.total,
|
|
|
+ pageSize: statisticStore.allRoom.pageSize, //每页中显示10条数据
|
|
|
+ showSizeChanger: true,
|
|
|
+ onChange: (current: number, page: any) => {
|
|
|
+ console.log('page', current, page)
|
|
|
+ pagination.value.current = current
|
|
|
+ pagination.value.pageSize = page
|
|
|
+ fetchList()
|
|
|
+ },
|
|
|
+ pageSizeOptions: ['10', '20', '50', '100'], //每页中显示的数据
|
|
|
+ showTotal: (total: string) => `共有 ${total} 条数据` //分页中显示总的数据
|
|
|
+ }
|
|
|
+})
|
|
|
+
|
|
|
+const roomList = computed(() => statisticStore.allRoom.list)
|
|
|
interface FormState {
|
|
|
roomTitle: string
|
|
|
userTime: string[]
|
|
@@ -57,6 +89,7 @@ const formState: UnwrapRef<FormState> = reactive({
|
|
|
roomTitle: '',
|
|
|
userTime: []
|
|
|
})
|
|
|
+
|
|
|
const columns: TableColumnProps[] = [
|
|
|
// {
|
|
|
// title: '房间id',
|
|
@@ -68,12 +101,11 @@ const columns: TableColumnProps[] = [
|
|
|
},
|
|
|
{
|
|
|
title: '相关场景',
|
|
|
- // className: 'column-money',
|
|
|
- dataIndex: 'sceneNames'
|
|
|
+ dataIndex: 'sceneNameList'
|
|
|
},
|
|
|
{
|
|
|
title: '时长/分',
|
|
|
- dataIndex: 'totalViewTime'
|
|
|
+ dataIndex: 'lookTime'
|
|
|
},
|
|
|
{
|
|
|
title: '创建时间',
|
|
@@ -81,61 +113,34 @@ const columns: TableColumnProps[] = [
|
|
|
},
|
|
|
{
|
|
|
title: '状态',
|
|
|
- dataIndex: 'status'
|
|
|
+ dataIndex: 'roomStatus'
|
|
|
},
|
|
|
{
|
|
|
title: '观看',
|
|
|
- dataIndex: 'viewPersonNums'
|
|
|
+ dataIndex: 'lookManCount'
|
|
|
},
|
|
|
{
|
|
|
title: '分享',
|
|
|
- dataIndex: 'shareNums'
|
|
|
+ dataIndex: 'shareCount'
|
|
|
}
|
|
|
]
|
|
|
|
|
|
-const data = [
|
|
|
- {
|
|
|
- key: '1',
|
|
|
- roomTitle: '测试房间',
|
|
|
- sceneNames: ['11', '22'],
|
|
|
- totalViewTime: 1212121212,
|
|
|
- createTime: 1212121212,
|
|
|
- status: 0,
|
|
|
- viewPersonNums: 100,
|
|
|
- shareNums: 29292
|
|
|
- },
|
|
|
- {
|
|
|
- key: '2',
|
|
|
- roomTitle: '测试房间',
|
|
|
- sceneNames: ['11', '22'],
|
|
|
- totalViewTime: 1212121212,
|
|
|
- createTime: 1212121212,
|
|
|
- status: 0,
|
|
|
- viewPersonNums: 100,
|
|
|
- shareNums: 29292
|
|
|
- },
|
|
|
- {
|
|
|
- key: '3',
|
|
|
- roomTitle: '测试房间',
|
|
|
- sceneNames: ['11', '22'],
|
|
|
- totalViewTime: 1212121212,
|
|
|
- createTime: 1212121212,
|
|
|
- status: 0,
|
|
|
- viewPersonNums: 100,
|
|
|
- shareNums: 29292
|
|
|
- },
|
|
|
- {
|
|
|
- key: '4',
|
|
|
- roomTitle: '测试房间',
|
|
|
- sceneNames: ['11', '22'],
|
|
|
- totalViewTime: 1212121212,
|
|
|
- createTime: 1212121212,
|
|
|
- status: 0,
|
|
|
- viewPersonNums: 100,
|
|
|
- shareNums: 29292
|
|
|
- }
|
|
|
-]
|
|
|
-const handleFinish = () => {}
|
|
|
+const fetchList = () => {
|
|
|
+ statisticStore.fetchAllRoomList({
|
|
|
+ pageNum: pagination.value.current,
|
|
|
+ pageSize: pagination.value.pageSize,
|
|
|
+ startTime: formState.userTime ? formState.userTime[0] : '',
|
|
|
+ endTime: formState.userTime ? formState.userTime[1] : '',
|
|
|
+ roomTitle: formState.roomTitle ? formState.roomTitle : ''
|
|
|
+ })
|
|
|
+}
|
|
|
+onMounted(() => {
|
|
|
+ fetchList()
|
|
|
+})
|
|
|
+const handleFinish = () => {
|
|
|
+ statisticStore.sethAllRoomListPage();
|
|
|
+ fetchList()
|
|
|
+}
|
|
|
const handleFinishFailed = () => {}
|
|
|
</script>
|
|
|
<style lang="less">
|