|
@@ -20,7 +20,10 @@
|
|
|
<!-- 加载图片会闪屏 双if避免 -->
|
|
<!-- 加载图片会闪屏 双if避免 -->
|
|
|
<template v-if="currentIndex + visible >= index && currentIndex <= index">
|
|
<template v-if="currentIndex + visible >= index && currentIndex <= index">
|
|
|
<view class="tantan-slide-img-box" :style="{height: winHeigh + 'px'}">
|
|
<view class="tantan-slide-img-box" :style="{height: winHeigh + 'px'}">
|
|
|
- <image class="tantan-slide-img" :class="{'overturn-shake':overturnType===1,'overturn-back-shake':overturnType===2}" :style="{height: winHeigh + 'px'}" mode="aspectFill" :src="item.image" ></image>
|
|
|
|
|
|
|
+ <view :animation="animationData">
|
|
|
|
|
+ <image class="tantan-slide-img" v-show="imgIndex===imgKey" v-for="(img,imgIndex) in item.images" :style="{height: winHeigh + 'px'}" mode="aspectFill" :src="img" ></image>
|
|
|
|
|
+ </view>
|
|
|
|
|
+
|
|
|
<view class="slide-img-click">
|
|
<view class="slide-img-click">
|
|
|
<view class="slide-img-click-item" @click.stop="setImgKey(item,0)"></view>
|
|
<view class="slide-img-click-item" @click.stop="setImgKey(item,0)"></view>
|
|
|
<view class="slide-img-click-item" @click.stop="setImgKey(item,1)"></view>
|
|
<view class="slide-img-click-item" @click.stop="setImgKey(item,1)"></view>
|
|
@@ -86,8 +89,9 @@
|
|
|
dislike: 0,
|
|
dislike: 0,
|
|
|
|
|
|
|
|
imgKey:0,
|
|
imgKey:0,
|
|
|
- overturnType:0
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ overturnType:0,
|
|
|
|
|
+ animationData:{}
|
|
|
|
|
+ }
|
|
|
},
|
|
},
|
|
|
watch:{
|
|
watch:{
|
|
|
'overturnType':function (){
|
|
'overturnType':function (){
|
|
@@ -102,7 +106,9 @@
|
|
|
console.log(res)
|
|
console.log(res)
|
|
|
this.winWidth = res.windowWidth
|
|
this.winWidth = res.windowWidth
|
|
|
this.winHeigh = res.windowHeight-46
|
|
this.winHeigh = res.windowHeight-46
|
|
|
- },
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ },
|
|
|
methods: {
|
|
methods: {
|
|
|
setImgKey(item, type){
|
|
setImgKey(item, type){
|
|
|
if( this.overturnType<=0){
|
|
if( this.overturnType<=0){
|
|
@@ -127,28 +133,44 @@
|
|
|
setOverturnImg(item){
|
|
setOverturnImg(item){
|
|
|
// tools.success('one')
|
|
// tools.success('one')
|
|
|
// return;
|
|
// return;
|
|
|
|
|
+ let animation = uni.createAnimation({
|
|
|
|
|
+ duration: 100,
|
|
|
|
|
+ timingFunction: 'ease',
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ animation.rotateY(3).scale(1.01).step()
|
|
|
|
|
+ item.image=item.images[this.imgKey]
|
|
|
|
|
+ tools.vibrate()
|
|
|
|
|
+ this.animationData = animation.export()
|
|
|
|
|
+ setTimeout(function() {
|
|
|
|
|
+ animation.rotateY(0).scale(1).step()
|
|
|
|
|
+ this.animationData = animation.export()
|
|
|
|
|
+ }.bind(this), 100)
|
|
|
|
|
|
|
|
- this.overturnType=1;
|
|
|
|
|
- setTimeout(()=>{
|
|
|
|
|
- item.image=item.images[this.imgKey]
|
|
|
|
|
- this.overturnType=2;
|
|
|
|
|
- setTimeout(()=>{
|
|
|
|
|
- this.overturnType=0;
|
|
|
|
|
- },80)
|
|
|
|
|
- },80)
|
|
|
|
|
},
|
|
},
|
|
|
setOverturnTwo(){
|
|
setOverturnTwo(){
|
|
|
// tools.error('two')
|
|
// tools.error('two')
|
|
|
// return;
|
|
// return;
|
|
|
- this.overturnType=1;
|
|
|
|
|
|
|
+ let animation = uni.createAnimation({
|
|
|
|
|
+ duration: 100,
|
|
|
|
|
+ timingFunction: 'ease',
|
|
|
|
|
+ })
|
|
|
|
|
+ animation.rotateY(5).step()
|
|
|
|
|
+ tools.vibrate()
|
|
|
let overturnNum=1
|
|
let overturnNum=1
|
|
|
let overturnServe=setInterval(()=>{
|
|
let overturnServe=setInterval(()=>{
|
|
|
++overturnNum
|
|
++overturnNum
|
|
|
if(overturnNum>4){
|
|
if(overturnNum>4){
|
|
|
- this.overturnType=0;
|
|
|
|
|
clearInterval(overturnServe)
|
|
clearInterval(overturnServe)
|
|
|
}else {
|
|
}else {
|
|
|
- this.overturnType=(overturnNum%2===1)?1:2
|
|
|
|
|
|
|
+ let overturnType=(overturnNum%2===1)?1:2
|
|
|
|
|
+ if(overturnType===1){
|
|
|
|
|
+ animation.rotateY(3).step()
|
|
|
|
|
+ tools.vibrate()
|
|
|
|
|
+ }else {
|
|
|
|
|
+ animation.rotateY(0).step()
|
|
|
|
|
+ }
|
|
|
|
|
+ this.animationData = animation.export()
|
|
|
}
|
|
}
|
|
|
},80)
|
|
},80)
|
|
|
|
|
|