1
This commit is contained in:
@@ -6,15 +6,14 @@
|
||||
|
||||
<view class="onecontentright flex-start">
|
||||
<view class="onecontentrightimage">
|
||||
<view class="onecontentrightimageabsolute">
|
||||
<u-swiper circular previousMargin='30' nextMargin="30" :list="bannervo.counponsInfo" keyName="logo"
|
||||
radius="14" height='28' bgColor='none' imgMode='aspectFit'></u-swiper>
|
||||
<view class="swiperPanel" @touchstart="startMove" @touchend="endMove">
|
||||
<view class="swiperItem" v-for="(item, index) in bannervo.counponsInfo" :key="index"
|
||||
:style="{transform: itemStyle[index].transform, zIndex: itemStyle[index].zIndex, opacity: itemStyle[index].opacity}">
|
||||
<view class="children">
|
||||
<image class="pic" :src="item.logo"></image>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- <view class="onecontentrightimageabsolutetow">
|
||||
<u-swiper circular previousMargin="30" nextMargin="30" :list="bannervo.logo" keyName="coverImg"
|
||||
radius="14" height='28' bgColor='none' imgMode='aspectFit'></u-swiper>
|
||||
</view> -->
|
||||
</view>
|
||||
<view class="onecontentrighttext">
|
||||
<swiper class="swiper" circular :autoplay="true" :vertical='true' :interval="2000">
|
||||
@@ -30,12 +29,22 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import customSwiper from '@/components/blackmonth-swiper/index'
|
||||
export default {
|
||||
components: {
|
||||
customSwiper
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
isScroll: false,
|
||||
minCount: 0,
|
||||
fontColor: 'black'
|
||||
fontColor: 'black',
|
||||
timersetInterval: '0', //定时器
|
||||
slideNote: {
|
||||
x: 0,
|
||||
y: 0
|
||||
},
|
||||
screenWidth: 0
|
||||
};
|
||||
},
|
||||
props: {
|
||||
@@ -43,20 +52,68 @@
|
||||
type: Object,
|
||||
default () {
|
||||
return {
|
||||
coupons: '',
|
||||
logo: []
|
||||
counponsInfo: []
|
||||
}
|
||||
}
|
||||
},
|
||||
itemStyle: {
|
||||
type: Array,
|
||||
default () {
|
||||
return []
|
||||
}
|
||||
},
|
||||
title: {
|
||||
type: String,
|
||||
default: '每日特价'
|
||||
},
|
||||
img: {
|
||||
timersetnteritem: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
default: '0'
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
timersetnteritem(newVal, oldVal) {
|
||||
console.log(newVal, oldVal)
|
||||
if (newVal == 1) {
|
||||
clearTimeout(this.timersetInterval);
|
||||
this.timersetInterval = null;
|
||||
} else {
|
||||
this.timersetIntervalnewVal()
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
mounted() {
|
||||
this.timersetIntervalnewVal()
|
||||
},
|
||||
methods: {
|
||||
timersetIntervalnewVal() {
|
||||
this.timersetInterval = setInterval(() => {
|
||||
this.endMove()
|
||||
}, 2000);
|
||||
},
|
||||
startMove(e) {
|
||||
this.slideNote.x = e.changedTouches[0] ? e.changedTouches[0].pageX : 0;
|
||||
this.slideNote.y = e.changedTouches[0] ? e.changedTouches[0].pageY : 0;
|
||||
},
|
||||
endMove(e) {
|
||||
// this.itemStyless = []
|
||||
var newList = JSON.parse(JSON.stringify(this.itemStyle))
|
||||
console.log(newList)
|
||||
// if ((e.changedTouches[0].pageX - this.slideNote.x) < 0) {
|
||||
// 向左滑动
|
||||
var last = [newList.pop()]
|
||||
newList = last.concat(newList)
|
||||
// } else {
|
||||
// 向右滑动
|
||||
// newList.push(newList[0])
|
||||
// newList.splice(0, 1)
|
||||
// }
|
||||
this.$emit('changeValue',newList);
|
||||
|
||||
this.$forceUpdate();
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -94,6 +151,42 @@
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
height: 28rpx;
|
||||
margin-right: 10rpx;
|
||||
|
||||
.swiperPanel {
|
||||
height: 28rpx;
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
|
||||
.swiperItem {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
transition: all .5s;
|
||||
|
||||
/* 定义一个动画关键帧 */
|
||||
|
||||
|
||||
.children {
|
||||
height: 100%;
|
||||
width: 25%;
|
||||
// margin: 2rpx auto;
|
||||
|
||||
|
||||
/* 应用动画,设置动画时长、循环次数和速度曲线 */
|
||||
.pic {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
border-radius: 50%;
|
||||
// box-shadow: 0 0 10px #333;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
.onecontentrightimageabsolute {
|
||||
width: 100%;
|
||||
@@ -101,6 +194,7 @@
|
||||
top: 0;
|
||||
position: absolute;
|
||||
z-index: 9;
|
||||
height: 28rpx;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
},
|
||||
methods: {
|
||||
clickdistrict(item) {
|
||||
uni.pro.navigateTo('index/coupons/index');
|
||||
switch (item.jumpType) {
|
||||
case 'absolute':
|
||||
uni.pro.navigateTo('webview/webview', {
|
||||
@@ -39,7 +38,7 @@
|
||||
});
|
||||
break;
|
||||
case 'relative':
|
||||
uni.pro.navigateTo(item.absUrl);
|
||||
uni.pro.navigateTo(item.absUrl,item);
|
||||
break;
|
||||
case 'scan':
|
||||
if (!uni.utils.pluschooseImage()) {
|
||||
@@ -52,7 +51,7 @@
|
||||
scanType: ['qrCode', 'barCode'], // 可以指定扫二维码还是一维码,默认二者都有
|
||||
success: res => {
|
||||
// 当needResult 为 1 时,扫码返回的结果
|
||||
console.log(res.resultStr,res)
|
||||
console.log(res.resultStr, res)
|
||||
}
|
||||
});
|
||||
} else {
|
||||
@@ -68,7 +67,7 @@
|
||||
// #ifdef APP || MP-WEIXIN
|
||||
uni.scanCode({
|
||||
success: res => {
|
||||
console.log(res.result,res)
|
||||
console.log(res.result, res)
|
||||
}
|
||||
});
|
||||
// #endif
|
||||
@@ -91,6 +90,9 @@
|
||||
flex-wrap: nowrap;
|
||||
|
||||
.towcontent_item {
|
||||
width: 25%;
|
||||
margin-left: 34rpx;
|
||||
|
||||
image {
|
||||
width: 92rpx;
|
||||
height: 92rpx;
|
||||
@@ -102,7 +104,12 @@
|
||||
font-weight: 400;
|
||||
font-size: 28rpx;
|
||||
color: #333333;
|
||||
white-space: nowrap;
|
||||
}
|
||||
}
|
||||
|
||||
.towcontent_item:nth-child(1) {
|
||||
margin-left: 0rpx;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user