gree_leran/pages/video/video.vue

156 lines
2.9 KiB
Vue
Raw Normal View History

2024-06-14 01:11:29 +00:00
<template>
2024-06-16 23:47:03 +00:00
<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" /> -->
2024-06-14 01:11:29 +00:00
</view>
</template>
<script>
2024-06-16 23:47:03 +00:00
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"
2024-06-14 01:11:29 +00:00
export default {
2024-06-16 23:47:03 +00:00
components: {
cardVideo,
potoInfo
},
2024-06-14 01:11:29 +00:00
data() {
return {
2024-06-16 23:47:03 +00:00
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
2024-06-14 01:11:29 +00:00
}
},
2024-06-16 15:32:15 +00:00
onLoad() {
2024-06-16 23:47:03 +00:00
// this.ISstatusInit()
2024-06-16 15:32:15 +00:00
},
2024-06-14 01:11:29 +00:00
methods: {
2024-06-16 23:47:03 +00:00
getVideo(e) {
console.log(e)
if (this.videoContext) {
console.log("test")
this.videoContext.pause()
}
this.videoContext = e.videoContext
2024-06-16 15:32:15 +00:00
},
2024-06-16 23:47:03 +00:00
ISstatusInit() {
switch (this.swpper.index) { //根据页面进行判断
case 0: {
this.getVideoList()
break
2024-06-16 15:32:15 +00:00
}
2024-06-16 23:47:03 +00:00
case 1: {
this.getImageList()
2024-06-16 15:32:15 +00:00
}
}
2024-06-16 23:47:03 +00:00
},
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"
2024-06-16 15:32:15 +00:00
}
},
2024-06-16 23:47:03 +00:00
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
// })
// }
// })
2024-06-16 15:32:15 +00:00
},
2024-06-16 23:47:03 +00:00
change(e) {
console.log(e)
this.swpper.index = e.index
this.page = {
pageNum: 1,
pageSize: 10,
total: 0
}
this.ISstatusInit()
}
2024-06-14 01:11:29 +00:00
}
}
</script>
2024-06-16 23:47:03 +00:00
<style lang="scss">
.content {
.nav {
display: flex;
width: 100%;
position: fixed;
top: 0%;
justify-content: center;
z-index: 2;
}
2024-06-14 01:11:29 +00:00
2024-06-16 23:47:03 +00:00
// background-color: $w-BgColor;
position: relative;
2024-06-16 15:32:15 +00:00
2024-06-16 23:47:03 +00:00
swiper {
position: relative;
top: 90rpx;
2024-06-16 15:32:15 +00:00
2024-06-16 23:47:03 +00:00
swiper-item {
overflow: scroll;
}
}
2024-06-16 15:32:15 +00:00
2024-06-16 23:47:03 +00:00
width: 100%;
height: 100vh;
padding-bottom: 10%;
2024-06-16 15:32:15 +00:00
}
</style>