提交报错

This commit is contained in:
duan
2025-01-14 18:08:25 +08:00
6 changed files with 165 additions and 35 deletions

View File

@@ -25,7 +25,7 @@ export function dianzan(data) {
url: 'courseCollect/insertCourseCollect', url: 'courseCollect/insertCourseCollect',
method:'POST', method:'POST',
data:{ data:{
classify:3, classify:2,
...data ...data
} }
}) })
@@ -119,3 +119,12 @@ export function getDrawCount(data){
data data
}) })
} }
//播放开始或者结束
export function playStatus(data){
return http.request({
url: 'course/viewCourse',
method:'GET',
data
})
}

View File

@@ -2,6 +2,7 @@
<view class="item" @appear="appear" @disappear="disappear" @click.stop> <view class="item" @appear="appear" @disappear="disappear" @click.stop>
<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()" @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="false"
@@ -36,7 +37,7 @@
<view class="love u-flex u-flex-xy-center u-flex-col u-m-b-40 u-text-center" @click="dianzanClick"> <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-if="item.isGood==1" color="red" size="30"></up-icon>
<up-icon name="heart-fill" v-else color="#ffffff" 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}}</text> <text class="text color-fff u-font-24">{{item.goodNum<0?0:item.goodNum}}</text>
</view> </view>
<view class="share u-m-b-40 u-flex u-flex-xy-center u-flex-col u-text-center" @click="share"> <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> <image class="icon" src="@/static/images/share.png" mode=""></image>
@@ -53,6 +54,7 @@
</template> </template>
<script setup> <script setup>
import * as Api from '@/api/video/index.js'
import { import {
computed, computed,
nextTick, nextTick,
@@ -157,12 +159,47 @@
emits('showInfo', newval) emits('showInfo', newval)
}) })
//是否是第一次加载时的播放,不是暂停再播放
let isFirstPlay=true
let isPlayFinish=false//是否播放完成
/**
* @param {type} = [start,end]
*/
function sendPlayStatus(type='start'){
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() { function videoPlay() {
if(isFirstPlay&&!isPlayFinish){
sendPlayStatus('start')
}
isFirstPlay=false
isPlying.value = true isPlying.value = true
// #ifdef H5 // #ifdef H5
emits('controlstoggles', { emits('controlstoggles', {
detail: { detail: {
show: true show: false
} }
}) })
// #endif // #endif
@@ -174,7 +211,7 @@
// #ifdef H5 // #ifdef H5
emits('controlstoggles', { emits('controlstoggles', {
detail: { detail: {
show: false show: true
} }
}) })
// #endif // #endif
@@ -183,7 +220,7 @@
function ended() { function ended() {
Api.playStatus('end')
} }
function dianzanClick() { function dianzanClick() {
@@ -244,7 +281,6 @@
}) })
onMounted(() => { onMounted(() => {
init() init()
console.log('itemMounted',props.index);
emits('itemMounted', props.index) emits('itemMounted', props.index)
}) })
@@ -270,6 +306,8 @@
watch(() => showVideo.value, (newval) => { watch(() => showVideo.value, (newval) => {
console.log('showVideo change:'+newval); console.log('showVideo change:'+newval);
if (newval) { if (newval) {
isFirstPlay=true
isPlayFinish=false
nextTick(()=>{ nextTick(()=>{
init() init()
}) })

View File

@@ -47,12 +47,16 @@
</view> </view>
<up-icon name="close" :size="16" color="#333" bold @click="popupClose('show')"></up-icon> <up-icon name="close" :size="16" color="#333" bold @click="popupClose('show')"></up-icon>
</view> </view>
<scroll-view scroll-y="true" class="u-m-t-30" style="height: 400px;box-sizing: border-box;" <scroll-view scroll-y="true" class="u-m-t-30 xuanji-scroll"
:show-scrollbar="false"> ref="refXuanjiList"
:style="{height:xuanjiData.height+'px'}"
@scroll="xuanjiScroll"
:scroll-top="xuanjiData.scrollTop" scroll-with-animation :show-scrollbar="false">
<view class="ji-list u-flex u-flex-row u-flex-wrap"> <view class="ji-list u-flex u-flex-row u-flex-wrap">
<view class="ji-item u-flex-xy-center u-text-center" @click="jiClick(item,index)" <view class="ji-item u-flex-xy-center u-text-center" @click="jiClick(item,index)"
:class="{active:nowIndex==index,'mr-0':(index+1)%3==0}" v-for="(item,index) in list"
:key="index"> :class="[nowIndex==index?'active':'',(index+1)%3==0?'mr-0':'','ji-item'+index]"
v-for="(item,index) in list" :key="index">
<text class="u-font-28" :class="{'color-fff':nowIndex==index}">{{index+1}}</text> <text class="u-font-28" :class="{'color-fff':nowIndex==index}">{{index+1}}</text>
<view class="lock u-flex-xy-center" v-if="!item.videoUrl"> <view class="lock u-flex-xy-center" v-if="!item.videoUrl">
<up-icon name="lock" :size="14" color="#fff"></up-icon> <up-icon name="lock" :size="14" color="#fff"></up-icon>
@@ -157,6 +161,9 @@
import { import {
useCommonStore useCommonStore
} from '@/store/common.js' } from '@/store/common.js'
import {
getElRect
} from '@/utils/util.js'
const $common = useCommonStore() const $common = useCommonStore()
// #ifdef APP // #ifdef APP
@@ -185,6 +192,7 @@
let initing = true let initing = true
const refPoster = ref(null) const refPoster = ref(null)
const props = defineProps({ const props = defineProps({
list: { list: {
type: Array, type: Array,
@@ -192,11 +200,11 @@
[] []
} }
}, },
options:{ options: {
tpye: Object, tpye: Object,
default: () => { default: () => {
return { return {
courseDetailsId:'' courseDetailsId: ''
} }
} }
}, },
@@ -241,6 +249,7 @@
}) })
function controlstoggles(e) { function controlstoggles(e) {
console.log(e);
control.showControls = e.detail.show control.showControls = e.detail.show
control.showBack = control.showControls control.showBack = control.showControls
} }
@@ -265,7 +274,7 @@
const $mountedComponents = {} const $mountedComponents = {}
function itemMounted(index) { function itemMounted(index) {
$mountedComponents[index]=true $mountedComponents[index] = true
} }
function back() { function back() {
@@ -307,6 +316,49 @@
payType: null payType: null
}) })
//选集数据
const xuanjiData = reactive({
scrollTop: 0,
items: [],
scrollHeight: 0,
height:400
})
const refXuanjiList=ref(null)
function xuanjiScroll(e){
console.log(e);
}
async function xuanjiInit() {
// #ifdef APP
const height=44
const marginBottom=10
const oneItemHeight=height+marginBottom
xuanjiData.scrollTop=Math.ceil((nowIndex.value+1)/3) * oneItemHeight - (xuanjiData.height)/2+oneItemHeight/2
return
// #endif
if (!xuanjiData.items[props.list.length - 1]) {
const res = await getElRect('ji-list', instance, {
rect: true
})
xuanjiData.scrollHeight = res.height
let firstItemTop=0
for (let i in props.list) {
const res1 = await getElRect('ji-item' + i, instance, {
rect: true
})
if(i==0){
firstItemTop=res1.top
}
xuanjiData.items[i] = {
height: res1.height,
top: i==0?0: res1.top-firstItemTop
}
}
}
xuanjiData.scrollTop =xuanjiData.items[nowIndex.value].top-(xuanjiData.height)/2+(xuanjiData.items[nowIndex.value].height)/2
console.log(xuanjiData);
}
function openBs() { function openBs() {
@@ -315,7 +367,7 @@
let cacheIndex = null let cacheIndex = null
function appear(isFirst, item, index) { function appear(isFirst, item, index) {
if(isFirst){ if (isFirst) {
$mountedComponents[index] = true $mountedComponents[index] = true
} }
if (!initing) { if (!initing) {
@@ -339,12 +391,11 @@
} }
//非金币支付 //非金币支付
async function payOrder(data) { async function payOrder(data) {
const res = await Api.payOrder(data) const res = await Api.payOrder(data)
if (res) { if (res) {
uni.setStorageSync('nobuyCourseId', popup.data.courseId) uni.setStorageSync('nobuyCourseId', popup.data.courseDetailsId)
// #ifdef APP // #ifdef APP
uni.navigateTo({ uni.navigateTo({
url: '/pages/pays/pays?orderId=' + data.orderId + '&url=' + res.h5Url url: '/pages/pays/pays?orderId=' + data.orderId + '&url=' + res.h5Url
@@ -374,10 +425,13 @@
} }
//确认支付 //确认支付
async function payConfirm() { async function payConfirm() {
if (!isAgree.value) {
return infoBox.showToast('请阅读并同意 《付费须知说明》')
}
const [type, num] = popup.payType.split('-'); const [type, num] = popup.payType.split('-');
if (type != 'gold') {
if (!isAgree.value) {
return infoBox.showToast('请阅读并同意 《付费须知说明》')
}
}
console.log(type, num); console.log(type, num);
let data = { let data = {
courseId: popup.data.courseId courseId: popup.data.courseId
@@ -387,6 +441,13 @@
} }
const res = num == '10' ? await Api.buyTenVideo(data) : await Api.buyVideo(data) const res = num == '10' ? await Api.buyTenVideo(data) : await Api.buyVideo(data)
console.log(res);
if (!res.orders) {
return uni.showToast({
title: '创建订单失败',
icon: 'none'
})
}
if (res) { if (res) {
if (type == 'gold') { if (type == 'gold') {
goldPay({ goldPay({
@@ -408,6 +469,9 @@
function payBtnClick(type, num) { function payBtnClick(type, num) {
console.log(type, num); console.log(type, num);
popup.payType = `${type}-${num}` popup.payType = `${type}-${num}`
if (type == 'gold') {
return payConfirm()
}
popupClose('show') popupClose('show')
popupShow('payTips') popupShow('payTips')
} }
@@ -476,6 +540,17 @@
function popupShow(key = 'show', item, index) { function popupShow(key = 'show', item, index) {
console.log(item); console.log(item);
if (key == 'show') {
// #ifdef H5
nextTick(() => {
xuanjiInit()
})
// #endif
// #ifdef APP
xuanjiInit()
// #endif
}
popup[key] = true popup[key] = true
if (item) { if (item) {
popup.data = item popup.data = item
@@ -499,6 +574,7 @@
isCollect.value = newval isCollect.value = newval
}) })
function toDetail(item, index) { function toDetail(item, index) {
uni.navigateTo({ uni.navigateTo({
url: '/pages/video/detail?courseId=' + item.courseId url: '/pages/video/detail?courseId=' + item.courseId
@@ -519,15 +595,15 @@
function init() { function init() {
let item=props.list.find(v=>props.options.courseDetailsId==v.courseDetailsId) let item = props.list.find(v => props.options.courseDetailsId == v.courseDetailsId)
item=item?item:props.info.current; item = item ? item : props.info.current;
if (JSON.stringify(item) !== '{}') { if (JSON.stringify(item) !== '{}') {
// #ifdef H5 // #ifdef H5
setVideoList(item) setVideoList(item)
// #endif // #endif
// #ifdef APP // #ifdef APP
nextTick(() => { nextTick(() => {
const index = props.list.findIndex(v => v.courseDetailsId ==item.courseDetailsId) const index = props.list.findIndex(v => v.courseDetailsId == item.courseDetailsId)
goListPosition(index) goListPosition(index)
}) })
// #endif // #endif
@@ -569,11 +645,11 @@
courseId: item.courseId, courseId: item.courseId,
courseDetailsId: item.courseDetailsId, courseDetailsId: item.courseDetailsId,
type: item.isGood ? 1 : 0 type: item.isGood ? 1 : 0
}).then(res=>{ }).then(res => {
if(res){ if (res) {
uni.showToast({ uni.showToast({
title:'操作成功!', title: '操作成功!',
icon:'none' icon: 'none'
}) })
} }
}) })
@@ -704,14 +780,17 @@
configInit() configInit()
onMounted(() => { onMounted(() => {
init() init()
// setTimeout(()=>{ // setTimeout(()=>{
// },500) // },500)
}) })
watch(() => props.list.length, (newval) => { watch(() => props.list.length, (newval) => {
console.log('props.list.length change' + newval);
// #ifdef H5 // #ifdef H5
init() init()
// #endif // #endif
}) })
watch(() => nowIndex.value, (newval) => {})
const nowDanjiPrice = computed(() => { const nowDanjiPrice = computed(() => {
return videoList.value[current.value].price return videoList.value[current.value].price
}) })

View File

@@ -1,6 +1,7 @@
<template> <template>
<view class="container"> <view class="container">
<up-navbar title="申请提现" <up-navbar title="申请提现"
:autoBack="true"
bgColor="rgb(255, 117, 129)" bgColor="rgb(255, 117, 129)"
leftIconColor="#FFF" leftIconColor="#FFF"
:titleStyle ="{color:'#FFF'}" > :titleStyle ="{color:'#FFF'}" >

View File

@@ -83,6 +83,7 @@
} from '@/api/me/withdraw.js'; } from '@/api/me/withdraw.js';
import { import {
reactive, reactive,
ref,
getCurrentInstance, getCurrentInstance,
nextTick, nextTick,
ref ref
@@ -269,7 +270,6 @@
let res = await state({ let res = await state({
extraKey: datas.urlCallback.extra extraKey: datas.urlCallback.extra
}) })
getCanCash()
} else { } else {
// 播放中途退出 // 播放中途退出
} }

View File

@@ -80,13 +80,16 @@
console.log(drawRes); console.log(drawRes);
const nobuyCourseId = uni.getStorageSync('nobuyCourseId') const nobuyCourseId = uni.getStorageSync('nobuyCourseId')
const item = state.list.find(v => v.courseId == nobuyCourseId) const item = state.list.find(v => v.courseId == nobuyCourseId)
uni.clearStorageSync('nobuyCourseId') uni.removeStorageSync('nobuyCourseId')
if (drawRes.count * 1 > 0 && nobuyCourseId !== null && nobuyCourseId !== undefined && item if(item){
.videoUrl) { if (drawRes.count * 1 > 0 && nobuyCourseId !== null && nobuyCourseId !== undefined && item
uni.navigateTo({ .videoUrl) {
url: '/pages/me/prizeDraw' uni.navigateTo({
}) url: '/pages/me/prizeDraw'
})
}
} }
} }
}) })
</script> </script>