Merge branch 'test' of https://e.coding.net/g-cphe0354/duanju/new_app into test
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
"version" : "1.0",
|
"version" : "1.0",
|
||||||
"configurations" : [
|
"configurations" : [
|
||||||
{
|
{
|
||||||
"playground" : "standard",
|
"playground" : "custom",
|
||||||
"type" : "uni-app:app-android"
|
"type" : "uni-app:app-android"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
529
components/my-video-list/list-item-稳定版.vue
Normal file
529
components/my-video-list/list-item-稳定版.vue
Normal file
@@ -0,0 +1,529 @@
|
|||||||
|
<template>
|
||||||
|
<view class="item" @appear="appear" @disappear="disappear" @click.stop :style="{height:height+'px'}">
|
||||||
|
|
||||||
|
<video class="u-flex-1 video" :show-fullscreen-btn="false" @controlstoggle="controlstoggles" v-if="showVideo"
|
||||||
|
|
||||||
|
@timeupdate="timeupdate" @waiting="waiting()" object-fit="cover" @pause="onpause" @click="videoClick()"
|
||||||
|
@play="videoPlay('myVideo'+item.courseDetailsId,item.courseDetailsId)" :play-strategy="2"
|
||||||
|
:show-loading="true" codec="software" :muted="false" :show-center-play-btn="true" :loop="loop"
|
||||||
|
:enable-progress-gesture="false" :poster="item.titleImg" :ref="'myVideo'+item.courseDetailsId"
|
||||||
|
:autoplay="autoplay" @ended="ended" :id="'myVideo'+item.courseDetailsId" :src="item.videoUrl"></video>
|
||||||
|
|
||||||
|
<image class="poster" v-else @click="!item.videoUrl?popupShow('pay',item):''" :src="item.titleImg"
|
||||||
|
mode="aspectFill">
|
||||||
|
</image>
|
||||||
|
|
||||||
|
<view class="info" v-if="!isCommand" :style="infoStyle">
|
||||||
|
<text class="color-fff" v-if="item.courseDetailsName">{{item.courseDetailsName}}</text>
|
||||||
|
<view v-if="item.content" v-html="item.content"></view>
|
||||||
|
<view class="u-m-t-20 color-fff" @click="popupShow('show')">
|
||||||
|
<text class="color-fff">
|
||||||
|
{{item.courseDetailsName}}(共{{total}}集)选集 >
|
||||||
|
</text>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
</view>
|
||||||
|
<view class="info" v-if="isCommand" :style="infoStyle">
|
||||||
|
<text class="color-fff" v-if="item.courseDetailsName">{{item.courseDetailsName}}</text>
|
||||||
|
<view v-if="item.content" v-html="item.content"></view>
|
||||||
|
<view class="u-m-t-20 color-fff" @click="toDetail">
|
||||||
|
<text class="color-fff">
|
||||||
|
查看更多续集 >
|
||||||
|
</text>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
</view>
|
||||||
|
<view class="right" :style="rightStyle">
|
||||||
|
<view class="love u-flex u-flex-xy-center u-flex-col u-m-b-40 u-text-center" @click="dianzanClick">
|
||||||
|
<up-icon name="heart-fill" v-if="item.isGood==1" color="red" size="30"></up-icon>
|
||||||
|
<up-icon name="heart-fill" v-else color="#ffffff" size="30"></up-icon>
|
||||||
|
<text class="text color-fff u-font-24">{{item.goodNum<0?0:item.goodNum}}</text>
|
||||||
|
</view>
|
||||||
|
<view class="share u-m-b-40 u-flex u-flex-xy-center u-flex-col u-text-center" @click="share">
|
||||||
|
<image class="icon" src="@/static/images/share.png" mode=""></image>
|
||||||
|
<text class="text color-fff u-font-24">分享</text>
|
||||||
|
</view>
|
||||||
|
<view class="zhuiju u-m-b-40 u-flex u-flex-xy-center u-flex-col u-text-center" @click="zhuijuClick">
|
||||||
|
<image class="icon" v-if="isCollect" src="@/static/images/shuqian_s.png" mode=""></image>
|
||||||
|
<image class="icon" v-else src="@/static/images/shuqian.png" mode=""></image>
|
||||||
|
<text class="text color-fff u-font-24">{{isCollect?'已追':'追剧'}}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import * as Api from '@/api/video/index.js'
|
||||||
|
import {
|
||||||
|
computed,
|
||||||
|
nextTick,
|
||||||
|
onMounted,
|
||||||
|
ref,
|
||||||
|
watch
|
||||||
|
} from 'vue'
|
||||||
|
|
||||||
|
|
||||||
|
let loop = ref(false)
|
||||||
|
// #ifdef APP
|
||||||
|
loop.value = true
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
height:{
|
||||||
|
type:Number,
|
||||||
|
default:0
|
||||||
|
},
|
||||||
|
item: {
|
||||||
|
type: Object,
|
||||||
|
defaulr: () => {
|
||||||
|
return {
|
||||||
|
videoUrl: ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
rightStyle: {
|
||||||
|
type: Object,
|
||||||
|
default: () => {
|
||||||
|
return {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
infoStyle: {
|
||||||
|
type: Object,
|
||||||
|
default: () => {
|
||||||
|
return {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
isCommand: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
instance: {
|
||||||
|
type: Object,
|
||||||
|
defaulr: () => {
|
||||||
|
return {
|
||||||
|
proxy: {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
current: {
|
||||||
|
//h5判断是否是当前项目
|
||||||
|
type: Number,
|
||||||
|
default: 0
|
||||||
|
},
|
||||||
|
index: {
|
||||||
|
type: Number,
|
||||||
|
default: 0
|
||||||
|
},
|
||||||
|
nowIndex: {
|
||||||
|
//app判断是否是当前项目
|
||||||
|
type: Number,
|
||||||
|
default: 0
|
||||||
|
},
|
||||||
|
total: {
|
||||||
|
type: Number,
|
||||||
|
default: 0
|
||||||
|
},
|
||||||
|
isCollect: {
|
||||||
|
type: [Number, Boolean],
|
||||||
|
default: 0
|
||||||
|
},
|
||||||
|
playSpeeds: {
|
||||||
|
type: Number,
|
||||||
|
default: 1
|
||||||
|
},
|
||||||
|
showControls: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
let autoplay = ref(props.item.videoUrl ? true : false)
|
||||||
|
|
||||||
|
const emits = defineEmits(['controlstoggles', 'disappear', 'appear', 'waiting', 'videoPlay', 'ended', 'dianzanClick',
|
||||||
|
'share', 'zhuijuClick', 'popupShow', 'itemMounted', 'toDetail', 'showInfo', 'playStatusChange'
|
||||||
|
])
|
||||||
|
|
||||||
|
function controlstoggles(e) {
|
||||||
|
emits('controlstoggles', e)
|
||||||
|
}
|
||||||
|
|
||||||
|
function toDetail() {
|
||||||
|
if (video) {
|
||||||
|
video.pause()
|
||||||
|
}
|
||||||
|
emits('toDetail')
|
||||||
|
}
|
||||||
|
|
||||||
|
function waiting() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
let isPlying = ref(false)
|
||||||
|
watch(() => isPlying.value, (newval) => {
|
||||||
|
console.log(newval);
|
||||||
|
emits('showInfo', newval)
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
//是否是第一次加载时的播放,不是暂停再播放
|
||||||
|
let isFirstPlay = true
|
||||||
|
let isPlayFinish = false //是否播放完成
|
||||||
|
/**
|
||||||
|
* @param {type} = [start,end]
|
||||||
|
*/
|
||||||
|
function sendPlayStatus(type = 'start') {
|
||||||
|
emits('playStatusChange', {
|
||||||
|
courseId: props.item.courseId,
|
||||||
|
courseDetailsId: props.item.courseDetailsId,
|
||||||
|
type
|
||||||
|
})
|
||||||
|
// Api.playStatus({
|
||||||
|
// courseId:props.item.courseId,
|
||||||
|
// courseDetailsId:props.item.courseDetailsId,
|
||||||
|
// type
|
||||||
|
// })
|
||||||
|
}
|
||||||
|
|
||||||
|
function timeupdate(e) {
|
||||||
|
//隐藏loding
|
||||||
|
// #ifdef H5
|
||||||
|
uni.hideLoading()
|
||||||
|
// #endif
|
||||||
|
if (isPlayFinish) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (e.detail.currentTime > e.detail.duration * 0.9) {
|
||||||
|
if (!isFirstPlay) {
|
||||||
|
sendPlayStatus('end')
|
||||||
|
isPlayFinish = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function videoPlay() {
|
||||||
|
if (isFirstPlay && !isPlayFinish) {
|
||||||
|
sendPlayStatus('start')
|
||||||
|
}
|
||||||
|
isFirstPlay = false
|
||||||
|
isPlying.value = true
|
||||||
|
// #ifdef H5
|
||||||
|
emits('controlstoggles', {
|
||||||
|
detail: {
|
||||||
|
show: false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function onpause() {
|
||||||
|
isPlying.value = false
|
||||||
|
// #ifdef H5
|
||||||
|
emits('controlstoggles', {
|
||||||
|
detail: {
|
||||||
|
show: true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
// #endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function ended() {
|
||||||
|
sendPlayStatus('end')
|
||||||
|
}
|
||||||
|
|
||||||
|
function dianzanClick() {
|
||||||
|
emits('dianzanClick')
|
||||||
|
}
|
||||||
|
|
||||||
|
function share() {
|
||||||
|
emits('share')
|
||||||
|
}
|
||||||
|
|
||||||
|
function zhuijuClick() {
|
||||||
|
emits('zhuijuClick')
|
||||||
|
}
|
||||||
|
|
||||||
|
function popupShow(key) {
|
||||||
|
emits('popupShow', key)
|
||||||
|
}
|
||||||
|
|
||||||
|
function videoClick() {
|
||||||
|
console.log('videoClick');
|
||||||
|
if (video) {
|
||||||
|
if (isPlying.value) {
|
||||||
|
video.pause()
|
||||||
|
} else {
|
||||||
|
video.play()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let first = true
|
||||||
|
|
||||||
|
function appear() {
|
||||||
|
if (video) {
|
||||||
|
video.playbackRate(props.playSpeeds)
|
||||||
|
video.play()
|
||||||
|
}
|
||||||
|
emits('appear', first)
|
||||||
|
if (first) {
|
||||||
|
first = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let video = null
|
||||||
|
|
||||||
|
function disappear() {
|
||||||
|
if (video) {
|
||||||
|
video.pause()
|
||||||
|
}
|
||||||
|
emits('disappear')
|
||||||
|
}
|
||||||
|
const showVideo = computed(() => {
|
||||||
|
// #ifdef H5
|
||||||
|
return props.current === props.index && props.item.videoUrl
|
||||||
|
// #endif
|
||||||
|
// #ifdef APP
|
||||||
|
return props.nowIndex === props.index && props.item.videoUrl
|
||||||
|
// #endif
|
||||||
|
})
|
||||||
|
onMounted(() => {
|
||||||
|
init()
|
||||||
|
emits('itemMounted', props.index)
|
||||||
|
})
|
||||||
|
|
||||||
|
function init() {
|
||||||
|
try {
|
||||||
|
if (props.item.videoUrl && showVideo.value) {
|
||||||
|
video = uni.createVideoContext('myVideo' + props.item.courseDetailsId)
|
||||||
|
video.playbackRate(props.playSpeeds)
|
||||||
|
video.play()
|
||||||
|
console.log('init play');
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('------')
|
||||||
|
//TODO handle the exception
|
||||||
|
}
|
||||||
|
}
|
||||||
|
watch(() => props.playSpeeds, (newval) => {
|
||||||
|
console.log('speed' + newval);
|
||||||
|
if (video) {
|
||||||
|
video.playbackRate(newval)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
watch(() => showVideo.value, (newval) => {
|
||||||
|
console.log('showVideo change:' + newval);
|
||||||
|
if (newval) {
|
||||||
|
isFirstPlay = true
|
||||||
|
isPlayFinish = false
|
||||||
|
nextTick(() => {
|
||||||
|
init()
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
video = null
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
const infoStyle = computed(() => {
|
||||||
|
return {
|
||||||
|
transform: `translateX(${(!isPlying.value||!props.item.videoUrl)?0:'-110%'})`
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const rightStyle = computed(() => {
|
||||||
|
return {
|
||||||
|
transform: `translateX(${(!isPlying.value||!props.item.videoUrl)?'0':60}px)`
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.item {
|
||||||
|
// flex: 1;
|
||||||
|
// height: 100%;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.box {
|
||||||
|
/* #ifdef H5 */
|
||||||
|
flex: 1;
|
||||||
|
/* #endif */
|
||||||
|
}
|
||||||
|
|
||||||
|
.u-flex-1 {
|
||||||
|
flex: 1;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.u-popup {
|
||||||
|
position: fixed !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
::v-deep .u-popup {
|
||||||
|
position: fixed !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.video {
|
||||||
|
width: 750rpx;
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.poster {
|
||||||
|
/* #ifdef H5 */
|
||||||
|
position: absolute;
|
||||||
|
width: 100%;
|
||||||
|
height: 90%;
|
||||||
|
top: 50%;
|
||||||
|
left: 50%;
|
||||||
|
transform: translate(-50%, -50%);
|
||||||
|
/* #endif */
|
||||||
|
/* #ifdef APP */
|
||||||
|
width: 750rpx;
|
||||||
|
flex: 1;
|
||||||
|
/* #endif */
|
||||||
|
}
|
||||||
|
|
||||||
|
.u-text-center {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.u-flex-row {
|
||||||
|
flex-direction: row !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.info {
|
||||||
|
/* #ifdef H5 */
|
||||||
|
width: 80%;
|
||||||
|
/* #endif */
|
||||||
|
height: auto;
|
||||||
|
position: absolute !important;
|
||||||
|
bottom: 50px;
|
||||||
|
left: 10px;
|
||||||
|
color: #ffffff;
|
||||||
|
font-size: 15px;
|
||||||
|
z-index: 9999;
|
||||||
|
transition: all .3s ease-in-out;
|
||||||
|
}
|
||||||
|
|
||||||
|
.u-flex-y-center {
|
||||||
|
align-items: center !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.swipers-items {
|
||||||
|
width: 750rpx;
|
||||||
|
flex: 1;
|
||||||
|
position: relative;
|
||||||
|
background-color: #000;
|
||||||
|
}
|
||||||
|
|
||||||
|
.right {
|
||||||
|
transition: all .3s ease-in-out;
|
||||||
|
position: absolute !important;
|
||||||
|
right: 20rpx;
|
||||||
|
/* #ifdef H5 */
|
||||||
|
top: 50%;
|
||||||
|
transform: translateY(-50%);
|
||||||
|
/* #endif */
|
||||||
|
/* #ifdef APP */
|
||||||
|
top: 500px;
|
||||||
|
/* #endif */
|
||||||
|
z-index: 999;
|
||||||
|
color: #fff;
|
||||||
|
font-size: 24rpx;
|
||||||
|
|
||||||
|
.icon {
|
||||||
|
width: 60rpx;
|
||||||
|
height: 60rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.share {
|
||||||
|
.text {
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.zhuiju {}
|
||||||
|
}
|
||||||
|
|
||||||
|
.poster-popup {
|
||||||
|
position: fixed !important;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
top: 0;
|
||||||
|
bottom: 0;
|
||||||
|
background-color: rgba(0, 0, 0, 0.6);
|
||||||
|
z-index: 9999;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ji-list {
|
||||||
|
.ji-item {
|
||||||
|
width: 210rpx;
|
||||||
|
margin-bottom: 20rpx;
|
||||||
|
margin-right: 30rpx;
|
||||||
|
height: 88rpx;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #333;
|
||||||
|
border-radius: 12rpx;
|
||||||
|
background-color: #F5F7FF;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
&.active {
|
||||||
|
background-color: $my-main-color;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.lock {
|
||||||
|
position: absolute;
|
||||||
|
border-radius: 0px 6px 0px 6px;
|
||||||
|
background-color: #ccc;
|
||||||
|
padding: 2rpx 4rpx;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.playing {
|
||||||
|
position: absolute;
|
||||||
|
width: 32rpx;
|
||||||
|
height: 24rpx;
|
||||||
|
bottom: 5px;
|
||||||
|
right: 7px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.ji-item:nth-of-type(3n) {
|
||||||
|
margin-right: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hot {
|
||||||
|
width: 40rpx;
|
||||||
|
height: 40rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pay-list {
|
||||||
|
.pay-list-item {
|
||||||
|
flex-direction: row;
|
||||||
|
justify-content: center;
|
||||||
|
background-color: #F2F2F2;
|
||||||
|
padding: 24rpx;
|
||||||
|
border-radius: 20rpx;
|
||||||
|
margin-bottom: 40rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.zhifubao {
|
||||||
|
width: 56rpx;
|
||||||
|
height: 56rpx;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
553
components/my-video-list/list-item-预发布优化版.vue
Normal file
553
components/my-video-list/list-item-预发布优化版.vue
Normal file
@@ -0,0 +1,553 @@
|
|||||||
|
<template>
|
||||||
|
<view class="item" @appear="appear" @disappear="disappear" @click.stop :style="{height:height+'px'}">
|
||||||
|
|
||||||
|
<video class="u-flex-1 video" :show-fullscreen-btn="false" @controlstoggle="controlstoggles" v-if="showVideo"
|
||||||
|
:controls="showControls" @timeupdate="timeupdate" @waiting="waiting()" object-fit="cover"
|
||||||
|
@pause="onpause" @click="videoClick()"
|
||||||
|
@play="videoPlay('myVideo'+item.courseDetailsId,item.courseDetailsId)" :play-strategy="2"
|
||||||
|
:show-loading="true" codec="software" :muted="false" :show-center-play-btn="true" :loop="loop"
|
||||||
|
:enable-progress-gesture="false" :poster="item.titleImg" :ref="'myVideo'+item.courseDetailsId"
|
||||||
|
:autoplay="autoplay" @ended="ended" :id="'myVideo'+item.courseDetailsId" :src="item.videoUrl"></video>
|
||||||
|
|
||||||
|
<image class="poster" v-else @click="!item.videoUrl?popupShow('pay',item):''" :src="item.titleImg"
|
||||||
|
mode="aspectFill">
|
||||||
|
</image>
|
||||||
|
|
||||||
|
<view class="info" v-if="!isCommand" :style="infoStyle">
|
||||||
|
<text class="color-fff" v-if="item.courseDetailsName">{{item.courseDetailsName}}</text>
|
||||||
|
<view v-if="item.content" v-html="item.content"></view>
|
||||||
|
<view class="u-m-t-20 color-fff" @click="popupShow('show')">
|
||||||
|
<text class="color-fff">
|
||||||
|
{{item.courseDetailsName}}(共{{total}}集)选集 >
|
||||||
|
</text>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
</view>
|
||||||
|
<view class="info" v-if="isCommand" :style="infoStyle">
|
||||||
|
<text class="color-fff" v-if="item.courseDetailsName">{{item.courseDetailsName}}</text>
|
||||||
|
<view v-if="item.content" v-html="item.content"></view>
|
||||||
|
<view class="u-m-t-20 color-fff" @click="toDetail">
|
||||||
|
<text class="color-fff">
|
||||||
|
查看更多续集 >
|
||||||
|
</text>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
</view>
|
||||||
|
<view class="right" :style="rightStyle">
|
||||||
|
<view class="love u-flex u-flex-xy-center u-flex-col u-m-b-40 u-text-center" @click="dianzanClick">
|
||||||
|
<up-icon name="heart-fill" v-if="item.isGood==1" color="red" size="30"></up-icon>
|
||||||
|
<up-icon name="heart-fill" v-else color="#ffffff" size="30"></up-icon>
|
||||||
|
<text class="text color-fff u-font-24">{{item.goodNum<0?0:item.goodNum}}</text>
|
||||||
|
</view>
|
||||||
|
<view class="share u-m-b-40 u-flex u-flex-xy-center u-flex-col u-text-center" @click="share">
|
||||||
|
<image class="icon" src="@/static/images/share.png" mode=""></image>
|
||||||
|
<text class="text color-fff u-font-24">分享</text>
|
||||||
|
</view>
|
||||||
|
<view class="zhuiju u-m-b-40 u-flex u-flex-xy-center u-flex-col u-text-center" @click="zhuijuClick">
|
||||||
|
<image class="icon" v-if="isCollect" src="@/static/images/shuqian_s.png" mode=""></image>
|
||||||
|
<image class="icon" v-else src="@/static/images/shuqian.png" mode=""></image>
|
||||||
|
<text class="text color-fff u-font-24">{{isCollect?'已追':'追剧'}}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import * as Api from '@/api/video/index.js'
|
||||||
|
import {
|
||||||
|
computed,
|
||||||
|
nextTick,
|
||||||
|
onMounted,
|
||||||
|
ref,
|
||||||
|
watch
|
||||||
|
} from 'vue'
|
||||||
|
let loop=ref(false)
|
||||||
|
// #ifdef APP
|
||||||
|
loop.value=true
|
||||||
|
// #endif
|
||||||
|
const props = defineProps({
|
||||||
|
item: {
|
||||||
|
type: Object,
|
||||||
|
defaulr: () => {
|
||||||
|
return {
|
||||||
|
videoUrl: ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
rightStyle: {
|
||||||
|
type: Object,
|
||||||
|
default: () => {
|
||||||
|
return {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
infoStyle: {
|
||||||
|
type: Object,
|
||||||
|
default: () => {
|
||||||
|
return {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
isCommand: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
instance: {
|
||||||
|
type: Object,
|
||||||
|
defaulr: () => {
|
||||||
|
return {
|
||||||
|
proxy: {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
current: {
|
||||||
|
//h5判断是否是当前项目
|
||||||
|
type: Number,
|
||||||
|
default: 0
|
||||||
|
},
|
||||||
|
index: {
|
||||||
|
type: Number,
|
||||||
|
default: 0
|
||||||
|
},
|
||||||
|
nowIndex: {
|
||||||
|
//app判断是否是当前项目
|
||||||
|
type: Number,
|
||||||
|
default: 0
|
||||||
|
},
|
||||||
|
total: {
|
||||||
|
type: Number,
|
||||||
|
default: 0
|
||||||
|
},
|
||||||
|
isCollect: {
|
||||||
|
type: [Number, Boolean],
|
||||||
|
default: 0
|
||||||
|
},
|
||||||
|
playSpeeds: {
|
||||||
|
type: Number,
|
||||||
|
default: 1
|
||||||
|
},
|
||||||
|
showControls: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
let autoplay = ref(props.item.videoUrl ? true : false)
|
||||||
|
|
||||||
|
const emits = defineEmits(['controlstoggles', 'disappear', 'appear', 'waiting', 'videoPlay', 'ended', 'dianzanClick',
|
||||||
|
'share', 'zhuijuClick', 'popupShow', 'itemMounted', 'toDetail', 'showInfo', 'playStatusChange'
|
||||||
|
])
|
||||||
|
|
||||||
|
function controlstoggles(e) {
|
||||||
|
emits('controlstoggles', e)
|
||||||
|
}
|
||||||
|
|
||||||
|
function toDetail() {
|
||||||
|
if (video) {
|
||||||
|
video.pause()
|
||||||
|
}
|
||||||
|
emits('toDetail')
|
||||||
|
}
|
||||||
|
|
||||||
|
function waiting() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
let isPlying = ref(false)
|
||||||
|
watch(() => isPlying.value, (newval) => {
|
||||||
|
emits('showInfo', newval)
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
//是否是第一次加载时的播放,不是暂停再播放
|
||||||
|
let isFirstPlay = true
|
||||||
|
let isPlayFinish = false //是否播放完成
|
||||||
|
/**
|
||||||
|
* @param {type} = [start,end]
|
||||||
|
*/
|
||||||
|
function sendPlayStatus(type = 'start') {
|
||||||
|
emits('playStatusChange', {
|
||||||
|
courseId: props.item.courseId,
|
||||||
|
courseDetailsId: props.item.courseDetailsId,
|
||||||
|
type
|
||||||
|
})
|
||||||
|
// Api.playStatus({
|
||||||
|
// courseId:props.item.courseId,
|
||||||
|
// courseDetailsId:props.item.courseDetailsId,
|
||||||
|
// type
|
||||||
|
// })
|
||||||
|
}
|
||||||
|
|
||||||
|
function timeupdate(e) {
|
||||||
|
//隐藏loding
|
||||||
|
// #ifdef H5
|
||||||
|
uni.hideLoading()
|
||||||
|
// #endif
|
||||||
|
if (isPlayFinish) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (e.detail.currentTime > e.detail.duration * 0.9) {
|
||||||
|
if (!isFirstPlay) {
|
||||||
|
sendPlayStatus('end')
|
||||||
|
isPlayFinish = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function videoPlay() {
|
||||||
|
if (isFirstPlay && !isPlayFinish) {
|
||||||
|
sendPlayStatus('start')
|
||||||
|
}
|
||||||
|
isFirstPlay = false
|
||||||
|
isPlying.value = true
|
||||||
|
// #ifdef H5
|
||||||
|
emits('controlstoggles', {
|
||||||
|
detail: {
|
||||||
|
show: false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function onpause() {
|
||||||
|
isPlying.value = false
|
||||||
|
// #ifdef H5
|
||||||
|
emits('controlstoggles', {
|
||||||
|
detail: {
|
||||||
|
show: true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
// #endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function ended() {
|
||||||
|
sendPlayStatus('end')
|
||||||
|
}
|
||||||
|
|
||||||
|
function dianzanClick() {
|
||||||
|
emits('dianzanClick')
|
||||||
|
}
|
||||||
|
|
||||||
|
function share() {
|
||||||
|
emits('share')
|
||||||
|
}
|
||||||
|
|
||||||
|
function zhuijuClick() {
|
||||||
|
emits('zhuijuClick')
|
||||||
|
}
|
||||||
|
|
||||||
|
function popupShow(key) {
|
||||||
|
emits('popupShow', key)
|
||||||
|
}
|
||||||
|
|
||||||
|
function videoClick() {
|
||||||
|
console.log('videoClick');
|
||||||
|
if (video) {
|
||||||
|
if (isPlying.value) {
|
||||||
|
video.pause()
|
||||||
|
} else {
|
||||||
|
video.play()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let first = true
|
||||||
|
let isAppear = false //是否出现
|
||||||
|
|
||||||
|
function appear() {
|
||||||
|
isAppear = true
|
||||||
|
if (video && props.index == props.nowIndex) {
|
||||||
|
video.playbackRate(props.playSpeeds)
|
||||||
|
video.play()
|
||||||
|
}
|
||||||
|
emits('appear', first)
|
||||||
|
if (first) {
|
||||||
|
first = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let video = null
|
||||||
|
|
||||||
|
function disappear() {
|
||||||
|
console.log('disappear');
|
||||||
|
isAppear = false
|
||||||
|
if (video) {
|
||||||
|
video.pause()
|
||||||
|
}
|
||||||
|
emits('disappear')
|
||||||
|
}
|
||||||
|
const showVideo = computed(() => {
|
||||||
|
if (isAppear && props.item.videoUrl) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
// #ifdef H5
|
||||||
|
return props.current === props.index && props.item.videoUrl
|
||||||
|
// #endif
|
||||||
|
// #ifdef APP
|
||||||
|
return props.nowIndex === props.index && props.item.videoUrl
|
||||||
|
// #endif
|
||||||
|
})
|
||||||
|
onMounted(() => {
|
||||||
|
init()
|
||||||
|
emits('itemMounted', props.index)
|
||||||
|
})
|
||||||
|
|
||||||
|
function init() {
|
||||||
|
console.log('init');
|
||||||
|
try {
|
||||||
|
if (props.item.videoUrl && showVideo.value) {
|
||||||
|
video = uni.createVideoContext('myVideo' + props.item.courseDetailsId)
|
||||||
|
video.playbackRate(props.playSpeeds)
|
||||||
|
if (props.index == props.nowIndex) {
|
||||||
|
video.play()
|
||||||
|
console.log('init play');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('------')
|
||||||
|
//TODO handle the exception
|
||||||
|
}
|
||||||
|
}
|
||||||
|
watch(() => props.playSpeeds, (newval) => {
|
||||||
|
console.log('speed' + newval);
|
||||||
|
if (video) {
|
||||||
|
video.playbackRate(newval)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
watch(() => showVideo.value, (newval) => {
|
||||||
|
console.log('showVideo change:' + newval);
|
||||||
|
if (newval) {
|
||||||
|
isFirstPlay = true
|
||||||
|
isPlayFinish = false
|
||||||
|
// #ifdef H5
|
||||||
|
nextTick(() => {
|
||||||
|
init()
|
||||||
|
})
|
||||||
|
// #endif
|
||||||
|
// #ifdef APP
|
||||||
|
init()
|
||||||
|
// #endif
|
||||||
|
} else {
|
||||||
|
video = null
|
||||||
|
}
|
||||||
|
})
|
||||||
|
// #ifdef APP
|
||||||
|
watch(() => props.nowIndex, (newval) => {
|
||||||
|
if (props.item.videoUrl && showVideo.value && props.index == props.nowIndex) {
|
||||||
|
init()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
|
||||||
|
const showControls=computed(()=>{
|
||||||
|
// #ifdef H5
|
||||||
|
return true
|
||||||
|
// #endif
|
||||||
|
// #ifdef APP
|
||||||
|
return props.index==props.nowIndex&&!isPlying.value
|
||||||
|
// #endif
|
||||||
|
})
|
||||||
|
|
||||||
|
const infoStyle = computed(() => {
|
||||||
|
return {
|
||||||
|
transform: `translateX(${(!isPlying.value||!props.item.videoUrl)?0:'-110%'})`
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const rightStyle = computed(() => {
|
||||||
|
return {
|
||||||
|
transform: `translateX(${(!isPlying.value||!props.item.videoUrl)?'0':60}px)`
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.item {
|
||||||
|
flex: 1;
|
||||||
|
height: 100%;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.box {
|
||||||
|
/* #ifdef H5 */
|
||||||
|
flex: 1;
|
||||||
|
/* #endif */
|
||||||
|
}
|
||||||
|
|
||||||
|
.u-flex-1 {
|
||||||
|
flex: 1;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.u-popup {
|
||||||
|
position: fixed !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
::v-deep .u-popup {
|
||||||
|
position: fixed !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.video {
|
||||||
|
width: 750rpx;
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.poster {
|
||||||
|
/* #ifdef H5 */
|
||||||
|
position: absolute;
|
||||||
|
width: 100%;
|
||||||
|
height: 90%;
|
||||||
|
top: 50%;
|
||||||
|
left: 50%;
|
||||||
|
transform: translate(-50%, -50%);
|
||||||
|
/* #endif */
|
||||||
|
/* #ifdef APP */
|
||||||
|
width: 750rpx;
|
||||||
|
flex: 1;
|
||||||
|
/* #endif */
|
||||||
|
}
|
||||||
|
|
||||||
|
.u-text-center {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.u-flex-row {
|
||||||
|
flex-direction: row !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.info {
|
||||||
|
/* #ifdef H5 */
|
||||||
|
width: 80%;
|
||||||
|
/* #endif */
|
||||||
|
height: auto;
|
||||||
|
position: absolute !important;
|
||||||
|
bottom: 50px;
|
||||||
|
left: 10px;
|
||||||
|
color: #ffffff;
|
||||||
|
font-size: 15px;
|
||||||
|
z-index: 9999;
|
||||||
|
transition: all .3s ease-in-out;
|
||||||
|
}
|
||||||
|
|
||||||
|
.u-flex-y-center {
|
||||||
|
align-items: center !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.swipers-items {
|
||||||
|
width: 750rpx;
|
||||||
|
flex: 1;
|
||||||
|
position: relative;
|
||||||
|
background-color: #000;
|
||||||
|
}
|
||||||
|
|
||||||
|
.right {
|
||||||
|
transition: all .3s ease-in-out;
|
||||||
|
position: absolute !important;
|
||||||
|
right: 20rpx;
|
||||||
|
/* #ifdef H5 */
|
||||||
|
top: 50%;
|
||||||
|
transform: translateY(-50%);
|
||||||
|
/* #endif */
|
||||||
|
/* #ifdef APP */
|
||||||
|
top: 500px;
|
||||||
|
/* #endif */
|
||||||
|
z-index: 999;
|
||||||
|
color: #fff;
|
||||||
|
font-size: 24rpx;
|
||||||
|
|
||||||
|
.icon {
|
||||||
|
width: 60rpx;
|
||||||
|
height: 60rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.share {
|
||||||
|
.text {
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.zhuiju {}
|
||||||
|
}
|
||||||
|
|
||||||
|
.poster-popup {
|
||||||
|
position: fixed !important;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
top: 0;
|
||||||
|
bottom: 0;
|
||||||
|
background-color: rgba(0, 0, 0, 0.6);
|
||||||
|
z-index: 9999;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ji-list {
|
||||||
|
.ji-item {
|
||||||
|
width: 210rpx;
|
||||||
|
margin-bottom: 20rpx;
|
||||||
|
margin-right: 30rpx;
|
||||||
|
height: 88rpx;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #333;
|
||||||
|
border-radius: 12rpx;
|
||||||
|
background-color: #F5F7FF;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
&.active {
|
||||||
|
background-color: $my-main-color;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.lock {
|
||||||
|
position: absolute;
|
||||||
|
border-radius: 0px 6px 0px 6px;
|
||||||
|
background-color: #ccc;
|
||||||
|
padding: 2rpx 4rpx;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.playing {
|
||||||
|
position: absolute;
|
||||||
|
width: 32rpx;
|
||||||
|
height: 24rpx;
|
||||||
|
bottom: 5px;
|
||||||
|
right: 7px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.ji-item:nth-of-type(3n) {
|
||||||
|
margin-right: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hot {
|
||||||
|
width: 40rpx;
|
||||||
|
height: 40rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pay-list {
|
||||||
|
.pay-list-item {
|
||||||
|
flex-direction: row;
|
||||||
|
justify-content: center;
|
||||||
|
background-color: #F2F2F2;
|
||||||
|
padding: 24rpx;
|
||||||
|
border-radius: 20rpx;
|
||||||
|
margin-bottom: 40rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.zhifubao {
|
||||||
|
width: 56rpx;
|
||||||
|
height: 56rpx;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -1,10 +1,11 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="item" @appear="appear" @disappear="disappear" @click.stop>
|
<view class="item" @appear="appear" @disappear="disappear" @click.stop :style="{height:height+'px'}">
|
||||||
|
|
||||||
<video class="u-flex-1 video" :show-fullscreen-btn="false" @controlstoggle="controlstoggles" v-if="showVideo"
|
<video class="u-flex-1 video" :show-fullscreen-btn="false" @controlstoggle="controlstoggles" v-if="showVideo"
|
||||||
|
|
||||||
@timeupdate="timeupdate" @waiting="waiting()" object-fit="cover" @pause="onpause" @click="videoClick()"
|
@timeupdate="timeupdate" @waiting="waiting()" object-fit="cover" @pause="onpause" @click="videoClick()"
|
||||||
@play="videoPlay('myVideo'+item.courseDetailsId,item.courseDetailsId)" :play-strategy="2"
|
@play="videoPlay('myVideo'+item.courseDetailsId,item.courseDetailsId)" :play-strategy="2"
|
||||||
:show-loading="true" codec="software" :muted="false" :show-center-play-btn="true" :loop="false"
|
:show-loading="true" codec="software" :muted="false" :show-center-play-btn="true" :loop="loop"
|
||||||
:enable-progress-gesture="false" :poster="item.titleImg" :ref="'myVideo'+item.courseDetailsId"
|
:enable-progress-gesture="false" :poster="item.titleImg" :ref="'myVideo'+item.courseDetailsId"
|
||||||
:autoplay="autoplay" @ended="ended" :id="'myVideo'+item.courseDetailsId" :src="item.videoUrl"></video>
|
:autoplay="autoplay" @ended="ended" :id="'myVideo'+item.courseDetailsId" :src="item.videoUrl"></video>
|
||||||
|
|
||||||
@@ -62,7 +63,17 @@
|
|||||||
watch
|
watch
|
||||||
} from 'vue'
|
} from 'vue'
|
||||||
|
|
||||||
|
|
||||||
|
let loop = ref(false)
|
||||||
|
// #ifdef APP
|
||||||
|
loop.value = true
|
||||||
|
// #endif
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
|
height:{
|
||||||
|
type:Number,
|
||||||
|
default:0
|
||||||
|
},
|
||||||
item: {
|
item: {
|
||||||
type: Object,
|
type: Object,
|
||||||
defaulr: () => {
|
defaulr: () => {
|
||||||
@@ -224,7 +235,7 @@
|
|||||||
|
|
||||||
|
|
||||||
function ended() {
|
function ended() {
|
||||||
Api.playStatus('end')
|
sendPlayStatus('end')
|
||||||
}
|
}
|
||||||
|
|
||||||
function dianzanClick() {
|
function dianzanClick() {
|
||||||
@@ -336,8 +347,8 @@
|
|||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.item {
|
.item {
|
||||||
flex: 1;
|
// flex: 1;
|
||||||
height: 100%;
|
// height: 100%;
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
@transition="transition" :indicator-dots="false" :autoplay="false" :interval="0" :duration="200">
|
@transition="transition" :indicator-dots="false" :autoplay="false" :interval="0" :duration="200">
|
||||||
<swiper-item v-for="(item,index) in videoList" :key="index">
|
<swiper-item v-for="(item,index) in videoList" :key="index">
|
||||||
<list-item-vue :total="list.length" :item="item" :isCommand="isCommand"
|
<list-item-vue :total="list.length" :item="item" :isCommand="isCommand"
|
||||||
|
:height="wHeight"
|
||||||
@playStatusChange="playStatusChange"
|
@playStatusChange="playStatusChange"
|
||||||
:showControls="control.showControls" :current="current" :isCollect="isCollect"
|
:showControls="control.showControls" :current="current" :isCollect="isCollect"
|
||||||
@toDetail="toDetail(item,index)" @controlstoggles="controlstoggles" :playSpeeds="playSpeeds"
|
@toDetail="toDetail(item,index)" @controlstoggles="controlstoggles" :playSpeeds="playSpeeds"
|
||||||
@@ -23,6 +24,7 @@
|
|||||||
<view class="swipers-items" :style="boxStyle" @longpress="popupShow('speed')">
|
<view class="swipers-items" :style="boxStyle" @longpress="popupShow('speed')">
|
||||||
<list-item-vue :total="list.length" :item="item" :current="current" :isCollect="isCollect"
|
<list-item-vue :total="list.length" :item="item" :current="current" :isCollect="isCollect"
|
||||||
@playStatusChange="playStatusChange"
|
@playStatusChange="playStatusChange"
|
||||||
|
:height="wHeight"
|
||||||
:isCommand="isCommand" :showControls="control.showControls" @toDetail="toDetail(item,index)"
|
:isCommand="isCommand" :showControls="control.showControls" @toDetail="toDetail(item,index)"
|
||||||
@itemMounted="itemMounted" @controlstoggles="controlstoggles" :index="index" :instance="instance"
|
@itemMounted="itemMounted" @controlstoggles="controlstoggles" :index="index" :instance="instance"
|
||||||
:nowIndex="nowIndex" @appear="appear($event,item,index)" :playSpeeds="playSpeeds"
|
:nowIndex="nowIndex" @appear="appear($event,item,index)" :playSpeeds="playSpeeds"
|
||||||
@@ -782,7 +784,6 @@
|
|||||||
configInit()
|
configInit()
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
init()
|
init()
|
||||||
|
|
||||||
// setTimeout(()=>{
|
// setTimeout(()=>{
|
||||||
// },500)
|
// },500)
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -83,7 +83,7 @@
|
|||||||
|
|
||||||
<view style="width: 0;height: 0;overflow: hidden;">
|
<view style="width: 0;height: 0;overflow: hidden;">
|
||||||
<!-- 激励视频广告 -->
|
<!-- 激励视频广告 -->
|
||||||
<ad-rewarded-video v-if="data.adRewardedShow" ref="adRewarded" adpid="1507000689" :loadnext="true"
|
<ad-rewarded-video v-if="data.adRewardedShow" ref="adRewarded" :adpid="data.adpid" :loadnext="true"
|
||||||
:url-callback="data.urlCallback" @load="onadload" @close="onadclose" @error="onaderror">
|
:url-callback="data.urlCallback" @load="onadload" @close="onadclose" @error="onaderror">
|
||||||
</ad-rewarded-video>
|
</ad-rewarded-video>
|
||||||
</view>
|
</view>
|
||||||
@@ -112,6 +112,7 @@
|
|||||||
totalCount: 0,
|
totalCount: 0,
|
||||||
cashMoney: 0,
|
cashMoney: 0,
|
||||||
urlCallback: {},
|
urlCallback: {},
|
||||||
|
adpid: null,
|
||||||
adRewardedShow: true,
|
adRewardedShow: true,
|
||||||
adRewardedVideoloadNum: 0,
|
adRewardedVideoloadNum: 0,
|
||||||
isWithdraw: false,
|
isWithdraw: false,
|
||||||
@@ -122,6 +123,12 @@
|
|||||||
|
|
||||||
const adRewarded = ref(null);
|
const adRewarded = ref(null);
|
||||||
onLoad(() => {
|
onLoad(() => {
|
||||||
|
if ( uni.getSystemInfoSync().platform == 'android' ) {
|
||||||
|
data.adpid = 1531580352
|
||||||
|
}
|
||||||
|
if ( uni.getSystemInfoSync().platform == 'ios' ) {
|
||||||
|
data.adpid = 1373604770
|
||||||
|
}
|
||||||
getExtractFei();
|
getExtractFei();
|
||||||
getMoneyDetail();
|
getMoneyDetail();
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
const state = reactive({
|
const state = reactive({
|
||||||
orderId: '',
|
orderId: '',
|
||||||
timer: null,
|
timer: null,
|
||||||
|
timer1: null,
|
||||||
maxAjaxNum: 5,
|
maxAjaxNum: 5,
|
||||||
ajaxNum: 0,
|
ajaxNum: 0,
|
||||||
url: null, //要打开的外部链接
|
url: null, //要打开的外部链接
|
||||||
@@ -31,6 +32,8 @@
|
|||||||
getOrderInfo({
|
getOrderInfo({
|
||||||
orderId: state.orderId
|
orderId: state.orderId
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
|
state.ajaxNum+=1
|
||||||
|
|
||||||
console.log(res);
|
console.log(res);
|
||||||
if (res == 1) {
|
if (res == 1) {
|
||||||
uni.hideLoading()
|
uni.hideLoading()
|
||||||
@@ -50,31 +53,56 @@
|
|||||||
title: '支付成功',
|
title: '支付成功',
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
})
|
})
|
||||||
state.timer = setTimeout(() => {
|
state.timer1 = setTimeout(() => {
|
||||||
clearTimeout(state.timer)
|
cleartimer()
|
||||||
uni.navigateBack()
|
uni.navigateBack()
|
||||||
}, 500)
|
}, 500)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// #ifdef APP
|
|
||||||
uni.showLoading({
|
}
|
||||||
title: '支付中'
|
|
||||||
})
|
if(state.ajaxNum>=state.maxAjaxNum){
|
||||||
// #endif
|
uni.navigateBack()
|
||||||
|
cleartimer()
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function cleartimer(){
|
||||||
|
console.log('cleartimer');
|
||||||
|
uni.hideLoading()
|
||||||
|
clearInterval(state.timer)
|
||||||
|
clearTimeout(state.timer1)
|
||||||
|
state.timer=null
|
||||||
|
state.timer1=null
|
||||||
|
state.ajaxNum=0
|
||||||
|
}
|
||||||
onShow(() => {
|
onShow(() => {
|
||||||
|
// #ifdef APP
|
||||||
|
uni.showLoading({
|
||||||
|
title: '支付中'
|
||||||
|
})
|
||||||
|
// #endif
|
||||||
|
state.ajaxNum=0;
|
||||||
getOrder()
|
getOrder()
|
||||||
|
clearInterval(state.timer)
|
||||||
|
state.timer=setInterval(()=>{
|
||||||
|
getOrder()
|
||||||
|
},2000)
|
||||||
})
|
})
|
||||||
onHide(() => {
|
onHide(() => {
|
||||||
|
console.log('onHide');
|
||||||
|
cleartimer()
|
||||||
uni.hideLoading()
|
uni.hideLoading()
|
||||||
})
|
})
|
||||||
onUnload(() => {
|
onUnload(() => {
|
||||||
|
console.log('onUnload');
|
||||||
|
cleartimer()
|
||||||
|
uni.hideLoading()
|
||||||
uni.hideLoading()
|
uni.hideLoading()
|
||||||
})
|
})
|
||||||
onLoad((option) => {
|
onLoad((option) => {
|
||||||
console.log(option);
|
|
||||||
state.url = option.url
|
state.url = option.url
|
||||||
state.orderId = option.orderId
|
state.orderId = option.orderId
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -62,7 +62,7 @@
|
|||||||
<!-- 激励视频广告 -->
|
<!-- 激励视频广告 -->
|
||||||
<view style="width: 0;height: 0;overflow: hidden;">
|
<view style="width: 0;height: 0;overflow: hidden;">
|
||||||
<!-- 激励视频广告 -->
|
<!-- 激励视频广告 -->
|
||||||
<ad-rewarded-video v-if="datas.adRewardedShow" ref="adRewarded" adpid="1507000689" :loadnext="true"
|
<ad-rewarded-video v-if="datas.adRewardedShow" ref="adRewarded" :adpid="datas.adpid" :loadnext="true"
|
||||||
:url-callback="datas.urlCallback" @load="onadload" @close="onadclose" @error="onaderror">
|
:url-callback="datas.urlCallback" @load="onadload" @close="onadclose" @error="onaderror">
|
||||||
</ad-rewarded-video>
|
</ad-rewarded-video>
|
||||||
</view>
|
</view>
|
||||||
@@ -103,12 +103,19 @@
|
|||||||
signInList: [],
|
signInList: [],
|
||||||
list: [],
|
list: [],
|
||||||
urlCallback: {},
|
urlCallback: {},
|
||||||
|
adpid: null,
|
||||||
adRewardedShow: true,
|
adRewardedShow: true,
|
||||||
adRewardedVideoloadNum: 0,
|
adRewardedVideoloadNum: 0,
|
||||||
|
|
||||||
})
|
})
|
||||||
const adRewarded = ref(null);
|
const adRewarded = ref(null);
|
||||||
onShow(() => {
|
onShow(() => {
|
||||||
|
if ( uni.getSystemInfoSync().platform == 'android' ) {
|
||||||
|
datas.adpid = 1531580352
|
||||||
|
}
|
||||||
|
if ( uni.getSystemInfoSync().platform == 'ios' ) {
|
||||||
|
datas.adpid = 1373604770
|
||||||
|
}
|
||||||
if (uni.getStorageSync("token")) {
|
if (uni.getStorageSync("token")) {
|
||||||
getTaskdata()
|
getTaskdata()
|
||||||
getsignIn()
|
getsignIn()
|
||||||
|
|||||||
@@ -45,11 +45,16 @@ export const useCommonStore = defineStore("common", {
|
|||||||
state() {
|
state() {
|
||||||
return {
|
return {
|
||||||
payTips: '付款完成后不要忘记抽红包哦',
|
payTips: '付款完成后不要忘记抽红包哦',
|
||||||
goldBili: 0
|
goldBili: 0,
|
||||||
|
sysInfo:{},
|
||||||
|
isIos:false,
|
||||||
|
isExamine:1
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
async init() {
|
async init() {
|
||||||
|
this.sysInfo=uni.getSystemInfoSync()
|
||||||
|
this.isIos=this.sysInfo.platform == 'ios'
|
||||||
const res = await getCommonConfig()
|
const res = await getCommonConfig()
|
||||||
if (res) {
|
if (res) {
|
||||||
for (let i in $map) {
|
for (let i in $map) {
|
||||||
@@ -62,13 +67,10 @@ export const useCommonStore = defineStore("common", {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
isIosExamine() {
|
isIosExamine() {
|
||||||
const sysInfo = uni.getSystemInfoSync();
|
if (!this.isIos) {
|
||||||
let isIos = sysInfo.platform == 'ios'
|
|
||||||
if (!isIos) {
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
let isExamine = useCommonStore()
|
if (this.isExamine == 1) {
|
||||||
if (isExamine.isExamine == 1) {
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
|
|||||||
Reference in New Issue
Block a user