提交报错

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',
method:'POST',
data:{
classify:3,
classify:2,
...data
}
})
@@ -118,4 +118,13 @@ export function getDrawCount(data){
method:'GET',
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>
<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"
@@ -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">
<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}}</text>
<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>
@@ -53,6 +54,7 @@
</template>
<script setup>
import * as Api from '@/api/video/index.js'
import {
computed,
nextTick,
@@ -157,12 +159,47 @@
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() {
if(isFirstPlay&&!isPlayFinish){
sendPlayStatus('start')
}
isFirstPlay=false
isPlying.value = true
// #ifdef H5
emits('controlstoggles', {
detail: {
show: true
show: false
}
})
// #endif
@@ -174,7 +211,7 @@
// #ifdef H5
emits('controlstoggles', {
detail: {
show: false
show: true
}
})
// #endif
@@ -183,7 +220,7 @@
function ended() {
Api.playStatus('end')
}
function dianzanClick() {
@@ -244,7 +281,6 @@
})
onMounted(() => {
init()
console.log('itemMounted',props.index);
emits('itemMounted', props.index)
})
@@ -270,6 +306,8 @@
watch(() => showVideo.value, (newval) => {
console.log('showVideo change:'+newval);
if (newval) {
isFirstPlay=true
isPlayFinish=false
nextTick(()=>{
init()
})

View File

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

View File

@@ -1,6 +1,7 @@
<template>
<view class="container">
<up-navbar title="申请提现"
:autoBack="true"
bgColor="rgb(255, 117, 129)"
leftIconColor="#FFF"
:titleStyle ="{color:'#FFF'}" >
@@ -10,7 +11,7 @@
</view>
</template>
</up-navbar>
<view class="content">
<view class="title">可提现总额</view>
<view class="mayMoney">¥ {{ data.mayMoney }}</view>

View File

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

View File

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