Files
2025-08-25 11:20:35 +08:00

401 lines
9.6 KiB
Vue

<template>
<view class="compontents">
<uni-popup ref="choiceNumPup" type="bottom" :safe-area="fales">
<view class="choiceNumPupConts" v-if="selectType=='1'">
<view class="firstSelectHeader">
<text> 当前播放第{{ playVideoInfo.weigh }}个视频</text>
<uni-icons type="down" size="20" color="#999999" @click="hideChoicePup"></uni-icons>
</view>
<scroll-view scroll-y class="videoScroll">
<view class="firstList">
<view class="firstItem" v-for="videos in videoListData" :key="videos.id" @click="clickItem(videos)">
<image class="videoCover" :src="videos.img" mode="widthFix"></image>
<view class="videoCont">
<text class="videoNum">{{ videos.name }}</text>
<view class="videoNameBox">
<text class="videoName"> {{ videos.title }}</text>
<image class="lock" v-if="videos.pays=='1'" mode="scaleToFill" src="https://wx.yaohe.hnjrdzkj.xyz/static/wechat/static/shilu-login/2.png"></image>
</view>
<text class="videoInfo"> {{ videos.msg }}</text>
</view>
</view>
</view>
</scroll-view>
</view>
<view class="choiceNumPupConts" v-if="selectType=='2'">
<view class="choiceTItle">
<text class="videoName">{{ videoInfo.name }}
<!-- <text class="videoNameSecond">更新至({{ videoInfo.sum }})</text> -->
</text>
<view class="schoiceClose" @click="hideChoicePup">
<uni-icons type="closeempty" size="20" color="#999999"></uni-icons>
</view>
</view>
<scroll-view scroll-x="true" class="pageLine">
<text :class="['pageItem',{'pageItemCheck': index+1 == page.currentPage}]"
v-for="(item,index) in pageList" :key="index" @click="changePage(index)"
>{{ item }}
</text>
</scroll-view>
<scroll-view scroll-y class="choiceScroll">
<view class="videoList">
<view :class="['videoItem',{'videoItemCheck': videos.playing}]" @click="clickItem(videos)"
v-for="videos in videoListData" :key="videos.id">
<view class="tag" v-if="videos.pays==1">
<image class="lock" src="https://wx.yaohe.hnjrdzkj.xyz/static/wechat/static/white_lock_icon.png" mode="scaleToFill"></image>
</view>
<image v-if="videos.playing && videos.pays==2" class="playGif" src="https://wx.yaohe.hnjrdzkj.xyz/static/wechat/static/player.gif"
mode="scaleToFill"></image>
<text v-else class="videoNumber">{{ videos.numText }}</text>
</view>
</view>
</scroll-view>
</view>
</uni-popup>
</view>
</template>
<script>
import {httpRequest} from "@/utils/request";
export default {
props: {
playVideoInfo: {
type: Object,
default: ()=>{
return new Object
}
},
videoInfo: {
type: Object,
default: ()=>{
return new Object
}
}
},
data() {
return {
videoListData: [],
pageList: [],
videoDel: {},
userInfo: {},
page: {
pageSize: 25,
currentPage: 1,
allPage: 1,
totalNum: 0
},
selectType: '2'
}
},
mounted() {
this.userInfo = uni.getStorageSync('userinfo');
// this.videoDel = Object.assign({},{},this.videoInfo);
},
methods: {
clickItem(item) {
this.$emit('choiceVideoItem', item)
this.hideChoicePup()
},
showChoicePup() {
this.getVideoList();
this.$refs.choiceNumPup.open()
},
hideChoicePup() {
this.$refs.choiceNumPup.close()
},
creatFirstPaging(ResData) {
let that = this;
ResData.data.forEach((item, index) => {
item.ranking_num = Number(index);
})
if (that.page.currentPage == 1) {
that.page.totalNum = ResData.total;
that.videoListData = ResData.data
} else {
that.videoListData = that.videoListData.concat(ResData.data)
}
that.page.currentPage += 1;
},
creatSecondPaging(ResData) {
let that = this;
ResData.data.forEach((item, index) => {
item.ranking_num = (that.page.currentPage - 1) * that.page.pageSize + index;
item.numText = (that.page.currentPage - 1) * that.page.pageSize + index + 1;
if (item.id == that.playVideoInfo.id) {
item.playing = true;
} else {
item.playing = false;
}
})
that.videoListData = ResData.data;
that.page.totalNum = ResData.total;
if (that.page.currentPage == 1) {
that.videoDel = ResData.videodata;
let pageItemLength = Math.ceil(Number(ResData.total) / that.page.pageSize),
listData = [];
for (let i = 1; i <= pageItemLength; i++) {
if (i == 1) {
listData.push(`${i} - ${that.page.pageSize}`)
} else {
if (i == pageItemLength) {
listData.push(`${(i - 1) * that.page.pageSize + 1} - ${ResData.total}`)
} else {
listData.push(`${(i - 1) * that.page.pageSize + 1} - ${i * that.page.pageSize}`)
}
}
}
that.pageList = listData;
}
},
getVideoList() {
let that = this;
httpRequest({
url: "/api/video/videoinfo",
method: "GET",
data: {
uid: that.userInfo.id,
token: that.userInfo.token,
page: that.page.currentPage,
limit: that.page.pageSize,
vid: that.videoInfo.id,
vs_id: ""
},
}).then(res=>{
if (that.selectType == '1') {
that.creatFirstPaging(res)
} else {
that.creatSecondPaging(res)
}
}).catch(err=>{
console.log(err)
})
},
changePage(val) {
console.log(val)
if (val + 1 != this.page.currentPage) {
this.page.currentPage = val + 1;
this.getVideoList();
}
},
}
}
</script>
<style scoped lang="scss">
.choiceNumPupConts {
width: 750rpx;
border-radius: 24rpx 24rpx 0rpx 0rpx;
padding: 36rpx 40rpx 0 40rpx;
background-color: #212122;
}
.firstSelectHeader {
display: flex;
align-items: center;
flex-direction: row;
font-size: 36rpx;
color: rgba(255, 255, 255, 0.87);
}
.videoScroll{
height: 600rpx;
}
.firstList{
padding-top: 40rpx;
}
.firstItem {
display: flex;
align-items: center;
flex-direction: row;
position: relative;
margin-bottom: 30rpx;
.videoCover {
width: 160rpx;
height: 180rpx;
border-radius: 10rpx;
}
.videoCont{
padding-left: 15rpx;
.videoNum{
font-size: 36rpx;
color: #FFFFFF;
font-weight: bold;
}
.lock {
width: 50rpx;
height: 50rpx;
margin-left: 15rpx;
}
.videoNameBox{
display: flex;
align-items: center;
flex-direction: row;
}
.videoName {
font-size: 16px;
color: #FFFFFF;
margin-top: 5px;
overflow: hidden;
}
.videoInfo {
font-size: 16px;
color: #FFFFFF;
margin-top: 5px;
overflow: hidden;
opacity: 0.6;
}
}
}
.choiceTItle {
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
.videoName {
font-weight: 500;
font-size: 36rpx;
color: rgba(255, 255, 255, 0.87);
}
.videoNameSecond {
font-weight: 400;
font-size: 28rpx;
color: rgba(255, 255, 255, 0.36);
padding-left: 24rpx;
}
.schoiceClose {
padding: 10rpx;
border-radius: 8rpx;
}
}
.pageLine {
/* #ifdef MP-TOUTIAO || MP-WEIXIN || H5 */
display: block;
min-width: 100%;
width: auto;
/* #endif */
/* #ifdef APP */
width: 750rpx;
display: flex;
flex-direction: row;
/* #endif */
margin-top: 20rpx;
padding-left: 40rpx;
white-space: nowrap;
overflow: hidden;
overflow-x: auto;
height: 60rpx;
.pageItem {
/* #ifdef MP-TOUTIAO || MP-WEIXIN || H5 */
display: inline-block;
/* #endif */
/* #ifdef APP */
width: 140rpx;
/* #endif */
padding: 0 26rpx;
line-height: 48rpx;
font-weight: 400;
font-size: 28rpx;
color: rgba(255, 255, 255, 0.36);
margin-right: 20rpx;
}
.pageItemCheck {
position: relative;
color: #09D89E;
}
.pageItemCheck::before {
content: ' ';
width: 40rpx;
height: 4px;
border-radius: 5rpx;
background: #09D89E;
position: absolute;
bottom: -10rpx;
left: 40rpx;
}
}
.choiceScroll {
height: 600rpx;
padding-top: 40rpx;
.videoList {
display: flex;
align-items: center;
justify-content: left;
flex-direction: row;
flex-wrap: wrap;
}
.videoItem {
width: 120rpx;
height: 100rpx;
background: #404040;
border-radius: 12rpx;
text-align: center;
position: relative;
margin-right: 15rpx;
margin-bottom: 20rpx;
.tag {
position: absolute;
top: 0;
right: 0;
background: #09D89E;
width: 30rpx;
text-align: center;
border-radius: 0rpx 12rpx 0rpx 12rpx;
.lock {
width: 20rpx;
height: 20rpx;
vertical-align: middle;
margin: 0 auto;
}
}
.videoNumber {
line-height: 100rpx;
text-align: center;
font-weight: 400;
font-size: 28rpx;
color: rgba(255, 255, 255, 0.87);
}
}
.videoItemCheck {
width: calc(20% - 24rpx);
height: 96rpx;
border: 2rpx solid #404040;
background: #121212;
border-radius: 12rpx;
display: flex;
align-items: center;
justify-content: center;
.playGif {
width: 80rpx;
height: 80rpx;
}
}
}
</style>