You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
124 lines
9.0 KiB
124 lines
9.0 KiB
<template>
|
|
<view class="carousel">
|
|
<swiper circular="true" duration="400" touchable @change="swiperchange" class="swiper">
|
|
<swiper-item v-for="(item, index) in goodsData.imgList" :key="index" class="swiper-item" @click="preview(goodsData.imgList,index)">
|
|
<view class="image-wrapper">
|
|
<image :src="item" class="loaded" mode="aspectFill"></image>
|
|
</view>
|
|
</swiper-item>
|
|
</swiper>
|
|
<view class="dots" v-if="goodsData.imgList.length > 0">
|
|
<text>{{currentIndex}}</text> / <text>{{goodsData.imgList.length}}</text>
|
|
</view>
|
|
<view class="video_btn" @click="onshowVideo" v-if="goodsData.videos">
|
|
<text>{{minutes}}'{{seconds}}'</text>
|
|
<!-- 这里的视频时间 建议后端上传视频时进行计算 返回给前端 前端兼容多端的情况下计算起来比较复杂 -->
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
data() {
|
|
return {
|
|
currentIndex: 1,
|
|
showVideo: false,
|
|
minutes:'00',
|
|
seconds:'10',
|
|
isH5: false ,//针对H5做处理
|
|
platform:'',
|
|
videos:''
|
|
}
|
|
},
|
|
props: {
|
|
goodsData: {
|
|
type: Object,
|
|
default: () => ({
|
|
imgList: []
|
|
})
|
|
}
|
|
},
|
|
created() {
|
|
this.platform = uni.getSystemInfoSync().platform //判断当前是安卓还是ios
|
|
},
|
|
methods: {
|
|
onshowVideo() {
|
|
// #ifndef H5
|
|
this.showVideo = true
|
|
// #endif
|
|
// #ifdef H5
|
|
// h5 在真机上测试
|
|
if(this.platform == 'android'){ //判断是安卓还是ios来对视频做适配
|
|
this.isH5 = true
|
|
}else{
|
|
this.showVideo = true
|
|
}
|
|
// #endif
|
|
this.$emit('setShowVideo',this.showVideo,this.isH5)
|
|
},
|
|
swiperchange(e) {
|
|
this.currentIndex = e.detail.current + 1
|
|
},
|
|
preview(imgs, index) { //预览图片
|
|
uni.previewImage({
|
|
current: index,
|
|
urls: imgs
|
|
})
|
|
},
|
|
|
|
}
|
|
}
|
|
</script>
|
|
<style scoped lang="scss">
|
|
.carousel {
|
|
position: relative;
|
|
overflow: hidden;
|
|
.dots {
|
|
height: 40upx;
|
|
line-height: 40upx;
|
|
font-size: 24upx;
|
|
text-align: center;
|
|
background-color: rgba(0, 0, 0, .2);
|
|
position: absolute;
|
|
bottom: 30upx;
|
|
right: 0;
|
|
z-index: 20;
|
|
color: #FFFFFF;
|
|
padding: 0 20upx;
|
|
border-radius: 20upx 0 0 20upx;
|
|
}
|
|
}
|
|
|
|
.swiper {
|
|
width: 100vw;
|
|
height: 100vw;
|
|
z-index: 100;
|
|
}
|
|
|
|
.loaded {
|
|
width: 100vw;
|
|
height: 100vw;
|
|
display: block;
|
|
}
|
|
|
|
.video_btn {
|
|
width: 165upx;
|
|
height: 60upx;
|
|
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKYAAAA8CAYAAADsdcFSAAAAAXNSR0IArs4c6QAAEudJREFUeAHtnQuMFdUZx89c9nn3hSwgLIumtCjIo6iA+Cy+SSpJJbIm1ai1ppo2atP6gkrF2opYxUpjU7FWiVKVVpqGtKCtBiu1cVetwlJdfCTtPngowrKwj7J7p///950zdy579wVrsqNzsjPnzHe+85hzf/udOWdmznjms3Mess7FloNtmN0S8CnnFrvotICPqnJLYeuyWyf8Q9goH3Q32IAQvHxuU6ZMKXj44YcnnnjiiZOKi4vHFxQUVObk5IzyPC+ZSCSK4BPY2A3xFvB9vzOVSh2E39rZ2flxe3t7w4EDB+rr6ureu/nmm9/ftm1bO06hw24Ed1DcYIFJy5hcsGBByb333nvG+PHj5xYWFk4HfAWDUss4kyHZAoC1va2tbUt9ff2mxYsXv7Zu3boWVLQVGy3pUbmjBTMPpScfffTR8VVVVQvLysrOi2E8qt8jsokJaXNz88tr1679/fXXX1+PEyGg/zvSEzpSMNllF69cubLymmuuuRpdNYE80ryOtO5xuiHYAgDUR1f/8pNP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3wAKa8fhL3wLcEpo+fLl94CbJjRGxiR6b41DSzhQl4cu/Rj8ByzgpzD67NoHmnus/7loAXbdTU1NT3OeEl34XpzUgD4W1tN0UW+N04V5zrYVK1bUlZeXv3LSSSeV5uXlfQmAHgnkvZUTx0WwBQCkj/d2Xl61atU9F1544T/ACp+R7TZP2depHS1M/GhQ8rHHHjvuMjgu8A4+uSJs7L5gLQAe2/noGp8SwvwkX25ktz0gKxlusqMF0+XF77Mk+dUBLvDOtbS5bHEMqWuez6dPGPk6BJ8850O+9nlKApn1i7oDaYXBAtOVyaklTiflcy1tLlvMFWK5GCfXPeQSc4A1yduc8LvfTXK5xP6QaQHA18llW+C3cjECDGYa+Iot36zlS4z2HR0+jcZNHmYcjMoPNpjhOjFvWlICyGtZbgSX8s+yXGQfu0FuATsTLeBhHR/5jDOvG2kZZUp6kMsz/wfVI9hkCTqF2AAAAABJRU5ErkJggg==) no-repeat;
|
|
background-size: 100% 100%;
|
|
position: absolute;
|
|
bottom: 20upx;
|
|
left: 50%;
|
|
transform: translateX(-50%);
|
|
text-align: right;
|
|
line-height: 60upx;
|
|
padding: 0 20upx;
|
|
font-size: 24upx;
|
|
letter-spacing: 2upx;
|
|
|
|
&:active {
|
|
opacity: .8;
|
|
}
|
|
}
|
|
</style>
|