Commit 667f630d by wjw

ww-购物车添加动画

parent b63396c8
...@@ -5,6 +5,7 @@ Page({ ...@@ -5,6 +5,7 @@ Page({
rightTitle: '优惠套餐', rightTitle: '优惠套餐',
showPopup: false, showPopup: false,
showAddSucc: false, showAddSucc: false,
hideAnimation: true,
leftMenuList: [ leftMenuList: [
{ {
id: 0, id: 0,
...@@ -103,6 +104,12 @@ Page({ ...@@ -103,6 +104,12 @@ Page({
goods_now_text: '业主价' goods_now_text: '业主价'
} }
}, },
onLoad() {
this.animationDown = wx.createAnimation({
duration: 400,
timingFunction: 'ease'
})
},
handleItemTap(e) { handleItemTap(e) {
let index = e.currentTarget.dataset.index let index = e.currentTarget.dataset.index
let rightTitle = this.data.leftMenuList[index].tab let rightTitle = this.data.leftMenuList[index].tab
...@@ -127,10 +134,26 @@ Page({ ...@@ -127,10 +134,26 @@ Page({
handleAddCart() { handleAddCart() {
let showPopup = false let showPopup = false
let showAddSucc = true let showAddSucc = true
let hideAnimation = false
this.animationDown.translateY(180).step()
this.setData({ this.setData({
showPopup, showPopup,
showAddSucc showAddSucc,
hideAnimation,
})
setTimeout(() => {
this.setData({
animationDown: this.animationDown.export()
})
})
setTimeout(() => {
this.animationDown.translateY(0).step()
let hideAnimation = true
this.setData({
hideAnimation,
animationDown: this.animationDown.export()
}) })
}, 400)
}, },
goToCart() { goToCart() {
wx.navigateTo({ wx.navigateTo({
......
...@@ -52,7 +52,6 @@ ...@@ -52,7 +52,6 @@
<image src="../../../image/cart.png" mode="widthFix"></image> <image src="../../../image/cart.png" mode="widthFix"></image>
</view> </view>
</view> </view>
</scroll-view>
<!-- 购物车弹窗 --> <!-- 购物车弹窗 -->
<l-popup show="{{showPopup}}" content-align="center" locked="{{true}}"> <l-popup show="{{showPopup}}" content-align="center" locked="{{true}}">
<view class="popup-wrap"> <view class="popup-wrap">
...@@ -80,5 +79,8 @@ ...@@ -80,5 +79,8 @@
</l-popup> </l-popup>
<!-- 添加成功 --> <!-- 添加成功 -->
<l-toast show="{{showAddSucc}}" l-image-class="toast-image" l-class="toast-bg" image="/image/success.png" title="添加购物车成功" /> <l-toast show="{{showAddSucc}}" l-image-class="toast-image" l-class="toast-bg" image="/image/success.png" title="添加购物车成功" />
<!-- 加入购物车动画 -->
<view class="redPoint {{hideAnimation ? 'animation-hide' : ''}}" animation="{{animationDown}}"></view>
</scroll-view>
</view> </view>
</view> </view>
\ No newline at end of file
...@@ -72,6 +72,19 @@ Page { ...@@ -72,6 +72,19 @@ Page {
height: 48rpx; height: 48rpx;
} }
.redPoint {
position: fixed;
right: 80rpx;
bottom: 560rpx;
width: 15px;
height: 15px;
background-color: #E66060;
border-radius: 50%;
}
.animation-hide {
display: none;
}
.item { .item {
width: 100%; width: 100%;
height: 250rpx; height: 250rpx;
......
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 sign in to comment