martial-arts/pagesA/my-video/my-video.vue

103 lines
3.1 KiB
Vue

<template>
<view>
<status-container titlet="我的练习视频" returnc="#FFFFFF">
<view slot="content">
<view class="pad-zy20">
<view class="radius8 bacf pad10 boxshow1 mar-s30" v-for="(item,index) in dataList" :key="index">
<view class="posir disjcac">
<!-- <image :src="item.cover" style="height: 388rpx;" mode="aspectFill" class="width100" lazy-load></image> -->
<video :src="item.video" :controls="false" object-fit="contain" :show-center-play-btn="false" style="height: 388rpx;" class="width100"></video>
<image v-if="item.video.includes('.mp4')" @tap="palyVideo(index)" class="posia" src="/static/tabbar/icon-play.png" mode="" style="width: 70rpx;height: 70rpx;" lazy-load></image>
</view>
<view class="disjbac fon24 pad20" style="padding-bottom: 10rpx;">
<view class="">{{item.title}}</view>
<view class="" style="color: #7f7f7f;">{{item.created_at.split('-').join('.')}}</view>
</view>
</view>
<view class="" v-if="loading">
<pitera :textStr="`${noMore && total > dataList.length?'上滑加载更多':'到底了'}~~`" textColor="#b0aaa9" paddingStr="40rpx 0 20rpx 0"></pitera>
</view>
</view>
</view>
</status-container>
<view @tap="$toolAll.tools.goPage('/pagesB/upload-video/upload-video')" class="disjcac colf fon24 radius34" style="position: fixed;bottom: 30rpx;left: 50%;transform: translateX(-50%);width: 360rpx;height: 68rpx;background-color: #e42417;"></view>
</view>
</template>
<script>
import pitera from '@/components/nothing/pitera.vue';
export default {
components:{
pitera
},
data() {
return {
dataList:[],
page:1,
size:10,
total:0,
noMore:false,
loading:false
}
},
onShow() {
this.page = 1;
this.getPractice();
},
onReachBottom() {
if(this.total!=this.dataList.length){
this.page++;
this.getPractice();
}
},
methods: {
getPractice(){
this.loading = false;
let params = {
page:this.page,
size:this.size
}
if(this.page==1) this.dataList = [];
this.$requst.get('/api/user/my-practice',params).then(res=>{
if(res.code==0){
this.total = res.data.total;
this.dataList = [...this.dataList,...res.data.list];
if(this.total == this.dataList.length && this.page!=1){
this.noMore = true;
}
this.loading = true;
}
})
},
// 播放视频
palyVideo(index){
if(this.dataList[index].type=="video_number"){
// #ifdef MP-WEIXIN
wx.openChannelsActivity({
finderUserName:this.dataList[index].video_number,
feedId:this.dataList[index].video_id,
success:(res)=>{
},fail:()=>{
// this.$toolAll.tools.showToast('视频已丢失或已删除')
}
})
// #endif
} else {
let newArr = [];
this.dataList[index] = Object.assign({'src':this.dataList[index].video},this.dataList[index]);
newArr.push(this.dataList[index])
uni.setStorageSync('videoList',newArr);
uni.navigateTo({
url:`/pagesB/play-video/play-video?current=${index}`
})
}
},
}
}
</script>
<style>
</style>