shjz-applet/pagesA/video/video.vue

85 lines
1.8 KiB
Vue

<template>
<view class="pad-x100">
<!-- 头部 -->
<status-nav navBarTitle="视频" :marginBottom="0"></status-nav>
<!-- 视频列表 -->
<view class="video">
<list-all :videoList="videoList"></list-all>
</view>
<!-- 加载更多 -->
<view class="tags font20 opacity-05">{{tags}}</view>
<!-- 尾部 -->
<foot-tab :current="99"></foot-tab>
</view>
</template>
<script>
import listAll from '@/components/list/list-all.vue';
export default {
components:{
listAll
},
data() {
return {
screenHeight:uni.getSystemInfoSync().screenHeight,
statusHeight:uni.getSystemInfoSync().statusBarHeight,
videoList:[], //视频列表
tags:'~ 下拉加载更多内容 ~', //提示信息
page:1,
size:10,
total:0,
noMore:false,
isLoading:false,
}
},
onLoad(op) {
// 获取视频列表
this.getVideoList();
},
// 触底
onReachBottom(e) {
if(!this.noMore){
this.page++;
// 获取视频列表
this.getVideoList();
}
},
methods: {
// 获取视频列表
getVideoList(){
uni.showLoading({
title:'加载中'
})
let params = {
page:this.page,
size:this.size
}
this.$requst.post('/api/common/video-list',params).then(res=>{
if(res.code==0){
console.log(res,'视频列表');
this.total = res.data.total;
let videoArr = [];
res.data.list.forEach(item=>{
let obj = {
id:item.id,
title:item.title,
cover:item.cover,
src:item.src
}
videoArr.push(obj);
})
this.videoList = this.videoList.concat(videoArr);
if(this.videoList.length == this.total){
this.noMore = true;
this.tags = '~ 暂无更多内容 ~';
}
uni.hideLoading();
this.isLoading = true;
}
})
},
}
}
</script>
<style>
</style>