|
@@ -3,16 +3,26 @@
|
|
|
<view class="images-swiper">
|
|
<view class="images-swiper">
|
|
|
<swiper class="swiper-box" :autoplay="autoplay" :duration="duration" :indicator-dots="indicatorDots"
|
|
<swiper class="swiper-box" :autoplay="autoplay" :duration="duration" :indicator-dots="indicatorDots"
|
|
|
:interval="interval" :circular="true" @change="setCurrent">
|
|
:interval="interval" :circular="true" @change="setCurrent">
|
|
|
|
|
+ <!-- 主图视频 -->
|
|
|
|
|
+ <swiper-item v-if="video">
|
|
|
|
|
+ <view class="slide-video">
|
|
|
|
|
+ <video id="myVideo" class="video" :poster="videoCover.preview_url" :src="video.external_url" controls
|
|
|
|
|
+ x5-playsinline playsinline webkit-playsinline webkit-playsinline x5-video-player-type="h5"
|
|
|
|
|
+ x5-video-player-fullscreen x5-video-orientation="portrait" :enable-progress-gesture="false"
|
|
|
|
|
+ @play="onVideoPlay"></video>
|
|
|
|
|
+ </view>
|
|
|
|
|
+ </swiper-item>
|
|
|
|
|
+ <!-- 轮播图片 -->
|
|
|
<swiper-item v-for="(item, index) in images" :key="index" @click="onPreviewImages(index)">
|
|
<swiper-item v-for="(item, index) in images" :key="index" @click="onPreviewImages(index)">
|
|
|
<view class="slide-image">
|
|
<view class="slide-image">
|
|
|
- <image class="image" :src="item.preview_url"></image>
|
|
|
|
|
|
|
+ <image class="image" :draggable="false" :src="item.preview_url"></image>
|
|
|
</view>
|
|
</view>
|
|
|
</swiper-item>
|
|
</swiper-item>
|
|
|
</swiper>
|
|
</swiper>
|
|
|
<view class="swiper-count">
|
|
<view class="swiper-count">
|
|
|
<text>{{ currentIndex }}</text>
|
|
<text>{{ currentIndex }}</text>
|
|
|
<text>/</text>
|
|
<text>/</text>
|
|
|
- <text>{{ images.length }}</text>
|
|
|
|
|
|
|
+ <text>{{ images.length + (video ? 1 : 0) }}</text>
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
</template>
|
|
</template>
|
|
@@ -20,6 +30,21 @@
|
|
|
<script>
|
|
<script>
|
|
|
export default {
|
|
export default {
|
|
|
props: {
|
|
props: {
|
|
|
|
|
+ // 主图视频
|
|
|
|
|
+ video: {
|
|
|
|
|
+ type: Object,
|
|
|
|
|
+ default () {
|
|
|
|
|
+ return null
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ // 主图视频封面
|
|
|
|
|
+ videoCover: {
|
|
|
|
|
+ type: Object,
|
|
|
|
|
+ default () {
|
|
|
|
|
+ return null
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ // 图片轮播
|
|
|
images: {
|
|
images: {
|
|
|
type: Array,
|
|
type: Array,
|
|
|
default: []
|
|
default: []
|
|
@@ -29,18 +54,23 @@
|
|
|
return {
|
|
return {
|
|
|
indicatorDots: true, // 是否显示面板指示点
|
|
indicatorDots: true, // 是否显示面板指示点
|
|
|
autoplay: true, // 是否自动切换
|
|
autoplay: true, // 是否自动切换
|
|
|
- interval: 3000, // 自动切换时间间隔
|
|
|
|
|
|
|
+ interval: 4000, // 自动切换时间间隔
|
|
|
duration: 800, // 滑动动画时长
|
|
duration: 800, // 滑动动画时长
|
|
|
- currentIndex: 1 // 轮播图指针
|
|
|
|
|
|
|
+ currentIndex: 1, // 轮播图指针
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
methods: {
|
|
|
|
|
|
|
|
|
|
+ // 事件:视频开始播放
|
|
|
|
|
+ onVideoPlay(e) {
|
|
|
|
|
+ this.autoplay = false
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
// 设置轮播图当前指针 数字
|
|
// 设置轮播图当前指针 数字
|
|
|
- setCurrent(e) {
|
|
|
|
|
|
|
+ setCurrent({ detail }) {
|
|
|
const app = this
|
|
const app = this
|
|
|
- app.currentIndex = e.detail.current + 1
|
|
|
|
|
|
|
+ app.currentIndex = detail.current + 1
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
// 浏览商品图片
|
|
// 浏览商品图片
|
|
@@ -76,6 +106,19 @@
|
|
|
margin: 0 auto;
|
|
margin: 0 auto;
|
|
|
/* #endif */
|
|
/* #endif */
|
|
|
|
|
|
|
|
|
|
+ // 主图视频
|
|
|
|
|
+ .slide-video {
|
|
|
|
|
+ width: 100%;
|
|
|
|
|
+ height: 100%;
|
|
|
|
|
+
|
|
|
|
|
+ .video {
|
|
|
|
|
+ display: block;
|
|
|
|
|
+ width: 100%;
|
|
|
|
|
+ height: 100%;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 图片轮播
|
|
|
.slide-image {
|
|
.slide-image {
|
|
|
position: relative;
|
|
position: relative;
|
|
|
width: 100%;
|
|
width: 100%;
|
|
@@ -92,8 +135,8 @@
|
|
|
// swiper计数
|
|
// swiper计数
|
|
|
.swiper-count {
|
|
.swiper-count {
|
|
|
position: absolute;
|
|
position: absolute;
|
|
|
- right: 30rpx;
|
|
|
|
|
- bottom: 36rpx;
|
|
|
|
|
|
|
+ right: 36rpx;
|
|
|
|
|
+ bottom: 72rpx;
|
|
|
padding: 2rpx 18rpx;
|
|
padding: 2rpx 18rpx;
|
|
|
background: rgba(0, 0, 0, 0.363);
|
|
background: rgba(0, 0, 0, 0.363);
|
|
|
border-radius: 50rpx;
|
|
border-radius: 50rpx;
|