feat: 修正配置

This commit is contained in:
KKKyrie 2021-02-16 00:16:45 +08:00
parent ef61d5d67a
commit 2dc2a6aa44
5 changed files with 19 additions and 9 deletions

View File

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="">
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">

View File

@ -1,6 +1,6 @@
<template>
<div id="app" class="app">
<lottery v-if="!isShowGift" />
<lottery v-if="!isShowGift" @showGift="showGift" />
<gift v-else />
</div>
</template>
@ -25,6 +25,10 @@ export default {
this.isShowGift = true;
}
},
showGift() {
this.isShowGift = true;
},
},
created() {

View File

@ -17,7 +17,7 @@
</template>
<script>
import { GLOBAL_KEYS, gifts } from '../gift.setting.js';
import { GLOBAL_KEYS, gifts, homeConfig } from '../gift.setting.js';
export default {
name: 'LotteryTurntable',
data() {
@ -90,10 +90,10 @@ export default {
this.prizes = prizes;
},
startCallBack () {
this.$refs.luckyGrid.play()
this.$refs.luckyGrid.play();
setTimeout(() => {
this.$refs.luckyGrid.stop(Math.random() * 8 >> 0)
}, 7000)
}, homeConfig.timeout);
},
endCallBack (prize) {
const { imgs, title } = prize;
@ -102,8 +102,8 @@ export default {
localStorage.setItem(GLOBAL_KEYS.NAME_KEY, title);
localStorage.setItem(GLOBAL_KEYS.IMAGE_KEY, imageUrl);
setTimeout(() => {
window.location.reload();
}, 1500);
this.$emit('success');
}, 1200);
}
},

View File

@ -12,7 +12,7 @@
/>
</swiper-slide>
<swiper-slide class="swiper-slide">
<turntable />
<turntable @success="handleTurntableSuccess" />
</swiper-slide>
</swiper>
</div>
@ -40,6 +40,10 @@ export default {
showGifts() {
this.gifts = GIFTS;
},
handleTurntableSuccess() {
this.$emit('showGift');
},
},
mounted() {
this.showGifts();

View File

@ -18,7 +18,9 @@ export const homeConfig = {
{ key: 'd', wording: '然后,这里是第三行文案', },
],
// 最终解释权归属人
owner: 'XXX'
owner: 'XXX',
// 抽奖转盘的动画时间,单位毫秒
timeout: 5000,
};
// 礼物清单