martial-arts/pages/tabbar/video/video.vue

131 lines
4.0 KiB
Vue
Raw Normal View History

2022-08-01 09:03:10 +00:00
<template>
<view>
<status-container :ifReturn="false" titlet="视频列表">
2022-08-03 13:28:45 +00:00
<view slot="content" style="margin-top: -20rpx;">
<view class="posi-sticky" :style="{top:newtop+'px'}">
<view class="pad-sx26 pad-zy20" style="box-shadow: 0 3rpx 20rpx rgba(0, 0, 0, 0.1);">
<view class="radius40 pad-sx2 disjbac pad-zy20" style="background-color: #fff6f5;border: 2rpx solid #ece6e6;">
2022-08-05 10:01:57 +00:00
<input v-model="keyword" @confirm="getVideoList" type="text" class="fon24 width100 pad-sx6" placeholder="关键字搜索" placeholder-style="color:#aaa4a3">
<view class="pad-sx6 pad-zy10 disjcac" @tap="getVideoList">
<image class="flexs" src="/static/tabbar/icon-search.png" mode="" style="width: 28rpx;height: 28rpx;" lazy-load></image>
</view>
2022-08-03 13:28:45 +00:00
</view>
</view>
</view>
<view class="pad-zy20">
2022-08-05 10:01:57 +00:00
<view class="radius8 bacf pad10 boxshow1 mar-s30" v-for="(item,index) in dataList" :key="index">
2022-08-03 13:28:45 +00:00
<view class="posir disjcac">
2022-08-05 10:01:57 +00:00
<image :src="item.cover" style="height: 388rpx;" mode="aspectFill" class="width100 animated fadeIn" lazy-load></image>
2022-08-07 01:50:06 +00:00
<image @tap="palyVideo(index)" class="posia" src="/static/tabbar/icon-play.png" mode="" style="width: 70rpx;height: 70rpx;" lazy-load></image>
2022-08-03 13:28:45 +00:00
</view>
<view class="pad-zy10">
2022-08-05 10:01:57 +00:00
<view class="fon24 pad-sx16 clips2" style="color: #262626;">{{item.title}}</view>
2022-08-03 13:28:45 +00:00
<view class="disjbac fon20">
<view class="disac" style="color: #aaaaaa;">
2022-08-05 10:01:57 +00:00
<image class="mar-y10" src="/static/tabbar/icon-look.png" mode="" style="width: 33rpx;height: 25rpx;" lazy-load></image>{{item.view}}
2022-08-03 13:28:45 +00:00
</view>
2022-08-05 10:01:57 +00:00
<view class="" style="color: #7f7f7f;">{{item.created_at.slice(0,10).split('-').join('.')}}</view>
2022-08-03 13:28:45 +00:00
</view>
</view>
</view>
2022-08-05 10:01:57 +00:00
<view class="" v-if="noMore">
<pitera textStr="上滑加载更多/到底了~~" textColor="#b0aaa9" paddingStr="40rpx 0 20rpx 0"></pitera>
</view>
2022-08-03 13:28:45 +00:00
</view>
2022-08-01 09:03:10 +00:00
</view>
</status-container>
<!-- 底部tab -->
<foot-tab current="3"></foot-tab>
</view>
</template>
<script>
// 底部组件
import footTab from '@/components/foot-tabs/foot-tab.vue';
2022-08-03 13:28:45 +00:00
import pitera from '@/components/nothing/pitera.vue';
2022-08-10 10:18:06 +00:00
import {reportRecord} from '@/jsFile/public-api.js';
2022-08-01 09:03:10 +00:00
export default {
components:{
'foot-tab' :footTab,
2022-08-03 13:28:45 +00:00
pitera
2022-08-01 09:03:10 +00:00
},
data() {
return {
2022-08-04 08:01:19 +00:00
newtop:uni.getSystemInfoSync().statusBarHeight + 42,
2022-08-01 09:03:10 +00:00
dataList:[],
2022-08-05 10:01:57 +00:00
page:1,
size:20,
total:0,
keyword:'',
noMore:false
2022-08-01 09:03:10 +00:00
}
},
2022-08-05 10:01:57 +00:00
onReachBottom() {
if(this.total!=this.dataList.length){
this.page++;
this.getVideoList();
}
},
onLoad() {
this.getVideoList();
},
2022-08-01 09:03:10 +00:00
methods: {
2022-08-05 10:01:57 +00:00
// 获取视频列表
getVideoList(){
let params = {
keyword:this.keyword,
page:this.page,
size:this.size
}
this.$requst.post('/api/spu/video',params).then(res=>{
if(res.code==0){
this.total = res.data.total;
if(this.page==1){this.dataList=[];}
// 设置视频列表
this.dataList = [...this.dataList,...res.data.list];
if(this.total==this.dataList.length && this.page!=1){
this.noMore = true;
}
}
})
},
2022-08-07 01:50:06 +00:00
// 播放视频
palyVideo(index){
2022-08-12 10:14:13 +00:00
if(this.dataList[index].type=="video_number"){
// #ifdef MP-WEIXIN
wx.openChannelsActivity({
finderUserName:this.dataList[index].video_number,
2022-08-12 10:14:13 +00:00
feedId:this.dataList[index].video_id,
2022-08-10 10:18:06 +00:00
success:(res)=>{
reportRecord({id:this.dataList[index].id}).then(result=>{
if(result.code==0){
this.dataList[index].view++;
}
})
},fail:()=>{
2022-08-12 10:14:13 +00:00
// this.$toolAll.tools.showToast('视频已丢失或已删除')
}
})
// #endif
} else {
let newArr = [];
newArr.push(this.dataList[index])
uni.setStorageSync('videoList',newArr);
uni.navigateTo({
url:`/pagesB/play-video/play-video?current=${index}`
})
2022-08-10 10:18:06 +00:00
reportRecord({id:this.dataList[index].id}).then(result=>{
if(result.code==0){
this.dataList[index].view++;
}
})
}
2022-08-07 01:50:06 +00:00
},
2022-08-01 09:03:10 +00:00
}
}
</script>
<style>
</style>