Commit 62230994 authored by 潘永坪's avatar 潘永坪

组合票页面视频加载处理

parent 2c59cc26
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<view class="wrap"> <view class="wrap">
<scroll-view @scroll="scrollFull" style="height: 100%;" :scroll-into-view="toViewFull" scroll-y enhanced :bounces="false"> <scroll-view @scroll="scrollFull" style="height: 100%;" :scroll-into-view="toViewFull" scroll-y enhanced :bounces="false">
<view class="banner" id='banner'> <view class="banner" id='banner'>
<u-swiper :list="imgList" @change="e => currentNum = e.current" indicatorStyle="right: 20px;bottom:25px" height="400" circular> <u-swiper :list="imgList" @change="e => currentNum = e.current" indicatorStyle="right: 20px;bottom:16px" height="400" :interval='interval' circular>
<view slot="indicator" class="indicator-num"> <view slot="indicator" class="indicator-num">
<text class="indicator-num__text">{{ currentNum + 1 }}/{{ imgList.length }}</text> <text class="indicator-num__text">{{ currentNum + 1 }}/{{ imgList.length }}</text>
</view> </view>
...@@ -221,6 +221,7 @@ export default { ...@@ -221,6 +221,7 @@ export default {
}, },
data() { data() {
return { return {
interval:3000,//轮播时间
currentMerchant:'',//当前入口商家信息 currentMerchant:'',//当前入口商家信息
showTip:false,//系统调不通或者崩了跳出弹窗 showTip:false,//系统调不通或者崩了跳出弹窗
detailData:'',//详情数据 detailData:'',//详情数据
...@@ -433,6 +434,22 @@ export default { ...@@ -433,6 +434,22 @@ export default {
//获取当前景区图片,把当前景区放在第一位 //获取当前景区图片,把当前景区放在第一位
if (item.id == this.merchantId) { if (item.id == this.merchantId) {
this.imgList = item.imgList this.imgList = item.imgList
//视频排在图片前面
this.imgList.sort((a,b)=>{
return b.type-a.type
})
//类型转化,用于视频播放
this.imgList.forEach(item2=>{
if(item2.type==1){
//图片
item2.type='image'
}
if(item2.type==2){
//如果有视频,轮播时间改为60秒
item2.type='video'
this.interval=100*1000
}
})
this.scenicList.splice(index, 1) this.scenicList.splice(index, 1)
this.scenicList.unshift(item) this.scenicList.unshift(item)
item.productListCopy = item.productList item.productListCopy = item.productList
...@@ -641,8 +658,8 @@ export default { ...@@ -641,8 +658,8 @@ export default {
let scrollTop=e.detail.scrollTop let scrollTop=e.detail.scrollTop
let selectFun=(data)=>{ let selectFun=(data)=>{
if(data){ if(data){
//20为中间盒子的top-20 //10为中间盒子的top-10
height=data.height+this.middleTopHeight-20-this.topHeight height=data.height+this.middleTopHeight-10-this.topHeight
let opacity=scrollTop/(data.height) let opacity=scrollTop/(data.height)
this.tabbarOpacity=parseFloat(opacity.toFixed(2)) this.tabbarOpacity=parseFloat(opacity.toFixed(2))
//下面值取整数,防止部分手机取值太多小数,出现抖动的bug //下面值取整数,防止部分手机取值太多小数,出现抖动的bug
...@@ -895,7 +912,7 @@ export default { ...@@ -895,7 +912,7 @@ export default {
.middle { .middle {
padding-bottom: 100rpx; padding-bottom: 100rpx;
position: relative; position: relative;
top: -20px; top: -10px;
} }
// 中间上部分 // 中间上部分
.middle-top{ .middle-top{
......
...@@ -169,14 +169,14 @@ ...@@ -169,14 +169,14 @@
咨询电话 咨询电话
</view> </view>
</view> </view>
<view class="middle3-list" @click="goSuggest()"> <!-- <view class="middle3-list" @click="goSuggest()">
<view> <view>
<image src="@/static/img/my/center/suggest.png"></image> <image src="@/static/img/my/center/suggest.png"></image>
</view> </view>
<view> <view>
建议投诉 建议投诉
</view> </view>
</view> </view> -->
</view> </view>
</view> </view>
</view> </view>
......
...@@ -65,6 +65,7 @@ ...@@ -65,6 +65,7 @@
height: $u.addUnit(height) height: $u.addUnit(height)
}" }"
controls controls
:autoplay='ifAutoplay(index)'
@tap="clickHandler(index)" @tap="clickHandler(index)"
></video> ></video>
<text <text
...@@ -90,8 +91,8 @@ ...@@ -90,8 +91,8 @@
</template> </template>
<script> <script>
import props from './props.js'; import props from './props.js'
/** /**
* Swiper 轮播图 * Swiper 轮播图
* @description 该组件一般用于导航轮播,广告展示等场景,可开箱即用, * @description 该组件一般用于导航轮播,广告展示等场景,可开箱即用,
* @tutorial https://www.uviewui.com/components/swiper.html * @tutorial https://www.uviewui.com/components/swiper.html
...@@ -123,7 +124,7 @@ ...@@ -123,7 +124,7 @@
* @event {Function(index)} change 轮播图切换时触发(自动或者手动切换) index:切换到了第几张图片,从0开始 * @event {Function(index)} change 轮播图切换时触发(自动或者手动切换) index:切换到了第几张图片,从0开始
* @example <u-swiper :list="list4" keyName="url" :autoplay="false"></u-swiper> * @example <u-swiper :list="list4" keyName="url" :autoplay="false"></u-swiper>
*/ */
export default { export default {
name: 'u-swiper', name: 'u-swiper',
mixins: [uni.$u.mpMixin, uni.$u.mixin, props], mixins: [uni.$u.mpMixin, uni.$u.mixin, props],
data() { data() {
...@@ -133,8 +134,8 @@ ...@@ -133,8 +134,8 @@
}, },
watch: { watch: {
current(val, preVal) { current(val, preVal) {
if(val === preVal) return; if(val === preVal) return
this.currentIndex = val; // 和上游数据关联上 this.currentIndex = val // 和上游数据关联上
} }
}, },
computed: { computed: {
...@@ -154,6 +155,14 @@ ...@@ -154,6 +155,14 @@
} }
}, },
methods: { methods: {
//---是否自动播放
ifAutoplay(index){
if(index==0){
return true
}else{
return false
}
},
getItemType(item) { getItemType(item) {
if (typeof item === 'string') return uni.$u.test.video(this.getSource(item)) ? 'video' : 'image' if (typeof item === 'string') return uni.$u.test.video(this.getSource(item)) ? 'video' : 'image'
if (typeof item === 'object' && this.keyName) { if (typeof item === 'object' && this.keyName) {
...@@ -198,7 +207,7 @@ ...@@ -198,7 +207,7 @@
this.$emit('click', index) this.$emit('click', index)
} }
}, },
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment