fix:商品详情轮播图添加视频

pull/8/head
kele 2023-03-17 15:11:04 +08:00
parent 5813f98ab1
commit e63fdf3dfc
3 changed files with 15 additions and 10 deletions

View File

@ -1,11 +1,11 @@
<!-- 订单详情 --> <!-- -->
<template> <template>
<su-video <su-video
class="sss" class="sss"
:uid="guid()" :uid="guid()"
:src="sheep.$url.cdn(data.videoUrl)" :src="sheep.$url.cdn(data.videoUrl)"
:poster="sheep.$url.cdn(data.src)" :poster="sheep.$url.cdn(data.src)"
:height="styles.height" :height="styles.height * 2"
></su-video> ></su-video>
</template> </template>

View File

@ -32,11 +32,12 @@
<su-video <su-video
v-else v-else
:ref="(el) => (refs.videoRef[`video_${index}`] = el)" :ref="(el) => (refs.videoRef[`video_${index}`] = el)"
:poster="item.poster" :poster="sheep.$url.cdn(item.poster)"
:src="item.src" :src="sheep.$url.cdn(item.src)"
:index="index" :index="index"
:moveX="state.moveX" :moveX="state.moveX"
:initialTime="item.currentTime || 0" :initialTime="item.currentTime || 0"
:height="seizeHeight"
@videoTimeupdate="videoTimeupdate" @videoTimeupdate="videoTimeupdate"
></su-video> ></su-video>
</view> </view>
@ -110,7 +111,7 @@
}, },
autoplay: { autoplay: {
type: Boolean, type: Boolean,
default: true, default: false,
}, },
interval: { interval: {
type: Number, type: Number,
@ -186,7 +187,6 @@
if (item.type === 'video') { if (item.type === 'video') {
state.videoPlaySataus = true; state.videoPlaySataus = true;
} else { } else {
console.log(item,'item');
sheep.$router.go(item.url); sheep.$router.go(item.url);
onPreview(); onPreview();
} }
@ -194,11 +194,16 @@
const onPreview = () => { const onPreview = () => {
if (!props.isPreview) return; if (!props.isPreview) return;
props.list.splice(
props.list.findIndex((item) => item.type === 'video'),
1,
);
let previewImage = props.list;
uni.previewImage({ uni.previewImage({
urls: urls:
props.list.length < 1 previewImage.length < 1
? [props.src] ? [props.src]
: props.list.reduce((pre, cur) => { : previewImage.reduce((pre, cur) => {
pre.push(cur.src); pre.push(cur.src);
return pre; return pre;
}, []), }, []),

View File

@ -3,7 +3,7 @@
<video <video
:id="`sVideo${uid}`" :id="`sVideo${uid}`"
class="radius" class="radius"
:style="[{ height: height + 'px' }]" :style="[{ height: height + 'rpx' }]"
:src="src" :src="src"
controls controls
object-fit="contain" object-fit="contain"
@ -80,7 +80,7 @@
// s // s
initialTime: { initialTime: {
type: Number, type: Number,
default: 0, default: 1,
}, },
src: { src: {
type: String, type: String,