gree_leran/pages/video/video.vue

156 lines
2.9 KiB
Vue

<template>
<view class="content">
<view class="swiper-item">
<card-video style="margin-bottom: 20px;" @onplay="getVideo" :VideoId="index" :key="index"
v-for="(item,index) in videoList" :Videos="item"></card-video>
</view>
<!-- <u-loadmore :status="status" @loadmore="onReachLoad" /> -->
</view>
</template>
<script>
import cardVideo from "@/components/cardVideo.vue"
// import {
// UserVideo
// } from "../../../api/videoApi.js"
// import {userImage} from "../../../api/image.js"
import potoInfo from "@/components/photosInfo.vue"
// import api from "../../../api/api.js"
export default {
components: {
cardVideo,
potoInfo
},
data() {
return {
status: "loadmore",
list: [{
name: '视频'
}, {
name: '图片'
}],
current: 0,
imageList: [],
swpper: {
index: 0
},
page: {
pageNum: 1,
pageSize: 10,
total: 0
},
videoList: [{
src: "",
avatar: 'dsfs',
username: 'sdsd',
titleName: 'asdsdas',
tagName: 'sdasd'
}],
videoContext: null
}
},
onLoad() {
// this.ISstatusInit()
},
methods: {
getVideo(e) {
console.log(e)
if (this.videoContext) {
console.log("test")
this.videoContext.pause()
}
this.videoContext = e.videoContext
},
ISstatusInit() {
switch (this.swpper.index) { //根据页面进行判断
case 0: {
this.getVideoList()
break
}
case 1: {
this.getImageList()
}
}
},
onReachLoad() {
this.status = 'loading';
this.page.pageSize += 10
this.ISstatusInit()
console.log(this.swpper.index)
if (this.list.length >= this.page.total) {
console.log(this.list.length)
this.status = 'nomore'
} else {
this.status = "loadmore"
}
},
async getVideoList() {
const __this = this
// UserVideo(this.page).then(res => {
// console.log(res)
// __this.page.total = res.total
// const list = res.data
// if (list.length == 0) {
// return uni.showToast({
// icon: "none",
// title: res.msg
// })
// }
// for (let i of list) {
// __this.videoList.push({
// src: `${api.qiNiuUrl}/${i.VideoUrl}`,
// avatar: i.user_pic,
// username: i.nikename,
// titleName: i.filename,
// tagName: i.type
// })
// }
// })
},
change(e) {
console.log(e)
this.swpper.index = e.index
this.page = {
pageNum: 1,
pageSize: 10,
total: 0
}
this.ISstatusInit()
}
}
}
</script>
<style lang="scss">
.content {
.nav {
display: flex;
width: 100%;
position: fixed;
top: 0%;
justify-content: center;
z-index: 2;
}
// background-color: $w-BgColor;
position: relative;
swiper {
position: relative;
top: 90rpx;
swiper-item {
overflow: scroll;
}
}
width: 100%;
height: 100vh;
padding-bottom: 10%;
}
</style>