Commit 1ef34785 authored by 郝聪敏's avatar 郝聪敏

添加充值克币动画

parent ca35f130
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
</template> </template>
<script> <script>
import wepy from '@wepy/core'; import wepy from '@wepy/core';
let showMenusTimer = null;
wepy.component({ wepy.component({
props: { props: {
showMenus: { showMenus: {
...@@ -34,7 +34,8 @@ ...@@ -34,7 +34,8 @@
watch: { watch: {
showMenus(v) { showMenus(v) {
if (!v) { if (!v) {
setTimeout(() => { if (showMenusTimer) clearTimeout(showMenusTimer);
showMenusTimer = setTimeout(() => {
this.show = false; this.show = false;
}, 300); }, 300);
} else { } else {
...@@ -61,7 +62,7 @@ ...@@ -61,7 +62,7 @@
created() { created() {
let statusHeight = this.$app.$options.globalData.statusBarHeight || ''; let statusHeight = this.$app.$options.globalData.statusBarHeight || '';
statusHeight && (this.popupStyle = 'top:' + (statusHeight + 56) + 'px'); statusHeight && (this.popupStyle = 'top:' + (statusHeight + 56) + 'px');
} },
}); });
</script> </script>
<style lang="less"> <style lang="less">
......
...@@ -57,6 +57,7 @@ ...@@ -57,6 +57,7 @@
share: '/static/images/share@2x.png', share: '/static/images/share@2x.png',
lottery: '/static/images/lottery@2x.png' lottery: '/static/images/lottery@2x.png'
}; };
let addGoldTimer = null;
wepy.component({ wepy.component({
store, store,
data: { data: {
...@@ -126,7 +127,13 @@ ...@@ -126,7 +127,13 @@
}, },
watch: { watch: {
isReceive(newVal, oldVal) { isReceive(newVal, oldVal) {
this.addGold = true; this.addGold = newVal;
if (newVal) {
if (addGoldTimer) clearTimeout(addGoldTimer);
addGoldTimer = setTimeout(() => {
this.$emit('resetAddGold');
}, 1000);
}
}, },
des(newVal, oldVal) { des(newVal, oldVal) {
if (this.type === 'gold') { if (this.type === 'gold') {
......
...@@ -171,7 +171,7 @@ ...@@ -171,7 +171,7 @@
<image v-if="!authmodal" @tap="showMenu(!showModal)" :src="userInfo.avatarUrl" mode="cover" class="userimage"></image> <image v-if="!authmodal" @tap="showMenu(!showModal)" :src="userInfo.avatarUrl" mode="cover" class="userimage"></image>
</view> </view>
<view> <view>
<gold type="gold" :des="mainInfo && mainInfo.account && mainInfo.account.quantity || 0" :gold="sign" :isReceive="isReceive" @showCorn="cornModalShow"></gold> <gold type="gold" :des="mainInfo && mainInfo.account && mainInfo.account.quantity || 0" :gold="sign" :isReceive="isReceive" @resetAddGold="resetAddGold" @showCorn="cornModalShow"></gold>
<sign type="sign" des="签到" :sign="sign" @sign-in="signIn"></sign> <sign type="sign" des="签到" :sign="sign" @sign-in="signIn"></sign>
<lottery type="lottery" des="抽奖" @getAwards="getAwards" @getUserInfo="getUserInfo" :authmodal="authmodal"></lottery> <lottery type="lottery" des="抽奖" @getAwards="getAwards" @getUserInfo="getUserInfo" :authmodal="authmodal"></lottery>
<share type="share" des="分享"></share> <share type="share" des="分享"></share>
...@@ -220,7 +220,7 @@ ...@@ -220,7 +220,7 @@
isReceive: false, // 是否显示领取克币动画 isReceive: false, // 是否显示领取克币动画
cornModal:false, cornModal:false,
cornCode: '', //克币充值码 cornCode: '', //克币充值码
cornText:'', cornText:'充值码无效,请重新输入',
cornTextShow: false, cornTextShow: false,
}, },
...@@ -420,6 +420,8 @@ ...@@ -420,6 +420,8 @@
if(data.code === 0){ if(data.code === 0){
//充值成功 //充值成功
this.cornModal = false; this.cornModal = false;
this.mainInfo.account.quantity = data.accountCoins;
this.isReceive = true;
} else { } else {
const msgindex = data.code+2; const msgindex = data.code+2;
this.cornText = msg[msgindex]; this.cornText = msg[msgindex];
...@@ -428,6 +430,9 @@ ...@@ -428,6 +430,9 @@
}); });
}, },
resetAddGold() {
this.isReceive = false;
}
}, },
async onLoad (options) { async onLoad (options) {
// 获取分享人openid // 获取分享人openid
......
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