增加新模块
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
<view class="content">
|
||||
<view class="lottery">
|
||||
<dengbo-lotteryWheel :prizes="prizes" :size="626" :duration="5000" @run="startClick(1)"
|
||||
@done="Done" ref="luckyWheel" :lightImgs="lightImages" customStyle="borderRadius: 50%;">
|
||||
@done="Done" ref="luckyWheel" :lightImgs="lightImages" customStyle="borderRadius: 50%;" :styleOpt="styleOpt">
|
||||
<template v-slot:bg>
|
||||
<image src="/static/turntable/turntable.png" style="width: 100%; height: 100%;" />
|
||||
</template>
|
||||
@@ -64,16 +64,36 @@
|
||||
prizesObj:{},
|
||||
prizes: [],
|
||||
lotteryList:[],// 中奖的列表ID
|
||||
styleOpt:{
|
||||
prizeBgColors: ['#fff0a3', '#fffce6','#fdba64'],
|
||||
},
|
||||
isRun:false,// 是否正在抽奖
|
||||
backPath:null,
|
||||
}
|
||||
},
|
||||
onLoad(){
|
||||
onLoad(option){
|
||||
const backPath = option.backPath;
|
||||
console.log("option backPath",backPath);
|
||||
if( backPath && backPath !=='null'){
|
||||
this.backPath = backPath;
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getActivityList();
|
||||
},
|
||||
methods: {
|
||||
jumpMine(){
|
||||
uni.switchTab({
|
||||
url: '/pages/mine/mine',
|
||||
})
|
||||
const backPath = this.backPath;
|
||||
console.log("backPath",backPath);
|
||||
if(backPath){
|
||||
uni.switchTab({
|
||||
url: '/pages/home/home',
|
||||
})
|
||||
}else{
|
||||
uni.switchTab({
|
||||
url: '/pages/mine/mine',
|
||||
})
|
||||
}
|
||||
},
|
||||
// 查询活动详情
|
||||
async getActivityList() {
|
||||
@@ -81,6 +101,9 @@
|
||||
if(resp && resp.bizcode === 100){
|
||||
this.prizesObj = resp.data;
|
||||
this.prizes = resp.data.prizes || [];
|
||||
if(this.prizes.length % 2 === 0){
|
||||
this.styleOpt.prizeBgColors = ['#fff0a3','#fdba64'];
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -94,6 +117,9 @@
|
||||
},
|
||||
// 用户点击开始,需要请求后台,去算出抽奖的选中的哪个
|
||||
async startClick(num) {
|
||||
if(this.isRun){
|
||||
return;
|
||||
}
|
||||
const count = this.prizesObj.times;// 当前拥有的抽奖次数
|
||||
if(!count || count===0){
|
||||
uni.showToast({
|
||||
@@ -106,6 +132,7 @@
|
||||
return;
|
||||
}
|
||||
|
||||
this.isRun = true;
|
||||
const params={
|
||||
id:this.prizesObj.id,
|
||||
times:num,
|
||||
@@ -120,7 +147,6 @@
|
||||
const prizes = this.prizes;
|
||||
const lastData = data[data.length - 1];
|
||||
for (let i = 0; i < prizes.length; i++) {
|
||||
console.log("prizes[i]",prizes[i]);
|
||||
if(prizes[i].id === lastData.prizeId){
|
||||
runCount = i;
|
||||
break;
|
||||
@@ -135,8 +161,6 @@
|
||||
return;
|
||||
}
|
||||
this.$refs.luckyWheel.run(runCount);
|
||||
// this.$refs.luckyWheel.setCount(runCount);
|
||||
// this.$refs.luckyWheel.setCount();
|
||||
},
|
||||
//prize
|
||||
Done() {
|
||||
@@ -154,7 +178,7 @@
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
|
||||
this.isRun = false;
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -251,26 +275,6 @@
|
||||
}
|
||||
|
||||
}
|
||||
// .turntable_wp {
|
||||
// width: 610rpx;
|
||||
// height: 610rpx;
|
||||
// position: relative;
|
||||
// margin: 0 auto;
|
||||
// top: -176rpx;
|
||||
// }
|
||||
// .turntable_wp image {
|
||||
// display: block;
|
||||
// width: 100%;
|
||||
// height: 100%;
|
||||
// }
|
||||
// .turntable_wp .turntable_pointer {
|
||||
// position: absolute;
|
||||
// width: 224rpx;
|
||||
// height: 224rpx;
|
||||
// top: 50%;
|
||||
// left: 50%;
|
||||
// margin: -125rpx 0 0 -112rpx;
|
||||
// }
|
||||
|
||||
.winning_record{
|
||||
position: fixed;
|
||||
|
||||
Reference in New Issue
Block a user