This commit is contained in:
duan 2025-01-15 17:24:32 +08:00
commit d255512ade
9 changed files with 1161 additions and 23 deletions

View File

@ -2,7 +2,7 @@
"version" : "1.0",
"configurations" : [
{
"playground" : "standard",
"playground" : "custom",
"type" : "uni-app:app-android"
},
{

View 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>

View 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>

View File

@ -1,10 +1,11 @@
<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"
@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="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"
:autoplay="autoplay" @ended="ended" :id="'myVideo'+item.courseDetailsId" :src="item.videoUrl"></video>
@ -62,7 +63,17 @@
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: () => {
@ -224,7 +235,7 @@
function ended() {
Api.playStatus('end')
sendPlayStatus('end')
}
function dianzanClick() {
@ -336,8 +347,8 @@
<style lang="scss" scoped>
.item {
flex: 1;
height: 100%;
// flex: 1;
// height: 100%;
position: relative;
}

View File

@ -6,6 +6,7 @@
@transition="transition" :indicator-dots="false" :autoplay="false" :interval="0" :duration="200">
<swiper-item v-for="(item,index) in videoList" :key="index">
<list-item-vue :total="list.length" :item="item" :isCommand="isCommand"
:height="wHeight"
@playStatusChange="playStatusChange"
:showControls="control.showControls" :current="current" :isCollect="isCollect"
@toDetail="toDetail(item,index)" @controlstoggles="controlstoggles" :playSpeeds="playSpeeds"
@ -23,6 +24,7 @@
<view class="swipers-items" :style="boxStyle" @longpress="popupShow('speed')">
<list-item-vue :total="list.length" :item="item" :current="current" :isCollect="isCollect"
@playStatusChange="playStatusChange"
:height="wHeight"
:isCommand="isCommand" :showControls="control.showControls" @toDetail="toDetail(item,index)"
@itemMounted="itemMounted" @controlstoggles="controlstoggles" :index="index" :instance="instance"
:nowIndex="nowIndex" @appear="appear($event,item,index)" :playSpeeds="playSpeeds"
@ -782,7 +784,6 @@
configInit()
onMounted(() => {
init()
// setTimeout(()=>{
// },500)
})

View File

@ -83,7 +83,7 @@
<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">
</ad-rewarded-video>
</view>
@ -112,6 +112,7 @@
totalCount: 0,
cashMoney: 0,
urlCallback: {},
adpid: null,
adRewardedShow: true,
adRewardedVideoloadNum: 0,
isWithdraw: false,
@ -122,6 +123,12 @@
const adRewarded = ref(null);
onLoad(() => {
if ( uni.getSystemInfoSync().platform == 'android' ) {
data.adpid = 1531580352
}
if ( uni.getSystemInfoSync().platform == 'ios' ) {
data.adpid = 1373604770
}
getExtractFei();
getMoneyDetail();

View File

@ -17,6 +17,7 @@
const state = reactive({
orderId: '',
timer: null,
timer1: null,
maxAjaxNum: 5,
ajaxNum: 0,
url: null, //
@ -31,6 +32,8 @@
getOrderInfo({
orderId: state.orderId
}).then(res => {
state.ajaxNum+=1
console.log(res);
if (res == 1) {
uni.hideLoading()
@ -50,31 +53,56 @@
title: '支付成功',
icon: 'none'
})
state.timer = setTimeout(() => {
clearTimeout(state.timer)
state.timer1 = setTimeout(() => {
cleartimer()
uni.navigateBack()
}, 500)
}
} else {
// #ifdef APP
uni.showLoading({
title: '支付中'
})
// #endif
}
if(state.ajaxNum>=state.maxAjaxNum){
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(() => {
// #ifdef APP
uni.showLoading({
title: '支付中'
})
// #endif
state.ajaxNum=0;
getOrder()
clearInterval(state.timer)
state.timer=setInterval(()=>{
getOrder()
},2000)
})
onHide(() => {
console.log('onHide');
cleartimer()
uni.hideLoading()
})
onUnload(() => {
console.log('onUnload');
cleartimer()
uni.hideLoading()
uni.hideLoading()
})
onLoad((option) => {
console.log(option);
state.url = option.url
state.orderId = option.orderId
})

View File

@ -62,7 +62,7 @@
<!-- 激励视频广告 -->
<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">
</ad-rewarded-video>
</view>
@ -103,12 +103,19 @@
signInList: [],
list: [],
urlCallback: {},
adpid: null,
adRewardedShow: true,
adRewardedVideoloadNum: 0,
})
const adRewarded = ref(null);
onShow(() => {
if ( uni.getSystemInfoSync().platform == 'android' ) {
datas.adpid = 1531580352
}
if ( uni.getSystemInfoSync().platform == 'ios' ) {
datas.adpid = 1373604770
}
if (uni.getStorageSync("token")) {
getTaskdata()
getsignIn()

View File

@ -45,11 +45,16 @@ export const useCommonStore = defineStore("common", {
state() {
return {
payTips: '付款完成后不要忘记抽红包哦',
goldBili: 0
goldBili: 0,
sysInfo:{},
isIos:false,
isExamine:1
};
},
actions: {
async init() {
this.sysInfo=uni.getSystemInfoSync()
this.isIos=this.sysInfo.platform == 'ios'
const res = await getCommonConfig()
if (res) {
for (let i in $map) {
@ -62,13 +67,10 @@ export const useCommonStore = defineStore("common", {
}
},
isIosExamine() {
const sysInfo = uni.getSystemInfoSync();
let isIos = sysInfo.platform == 'ios'
if (!isIos) {
if (!this.isIos) {
return true
}
let isExamine = useCommonStore()
if (isExamine.isExamine == 1) {
if (this.isExamine == 1) {
return false
}
return true