jiuyiUniapp/jiuyi2/pages/index/dataCenter/pushHistory.vue

104 lines
1.6 KiB
Vue

<script setup>
// 推流历史
//
import api from '@/api/index.js'
//
import util from '@/common/js/util.js'
import {
ref,
reactive,
} from 'vue'
import {
onLoad,
onPullDownRefresh,
onReachBottom,
} from '@dcloudio/uni-app'
// 视频菜单
import videoMenu from '@/components/index/videoMenu.vue';
//
const list = reactive({
data: [],
pageNum: 1,
pageSize: 18,
total: 0,
})
onLoad(() => {
// 获取列表
getList()
})
onPullDownRefresh(() => {
// 刷新列表
refreshList()
})
onReachBottom(() => {
// 获取更多列表
getMoreList()
})
// 刷新列表
function refreshList() {
list.pageNum = 1
getList()
}
// 获取更多列表
function getMoreList() {
if (list.total <= list.data.length) return
list.pageNum++
getList()
}
// 获取推流历史列表
function getList() {
api.video.getVideoPushList({
query: {
pageNum: list.pageNum,
pageSize: list.pageSize,
},
}).then(rs => {
if (rs.code == 200) {
// 第一页
if (list.pageNum == 1) list.data.length = 0
// 合并
list.data.push(...rs.rows.map(node => {
return {
pushId: node.id,
...node.video,
}
}))
console.log('list', list)
// 总数
list.total = rs.total
return
}
util.alert({
content: rs.msg,
showCancel: false,
})
}).finally(() => {
// 停止下拉刷新
uni.stopPullDownRefresh()
})
}
//
function handleVideo() {
//
}
</script>
<template>
<view class="appbw">
<view class="listBox">
<videoMenu :list="list.data" mode="menu" @item="handleVideo" />
</view>
</view>
</template>
<style>
</style>