- {{
- item
- }}
+ {{ item }}
- {{ (flag || isOver) ? '结束抽奖' : '开始抽奖' }}
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
@@ -98,11 +104,11 @@ import { drawLog } from "@/api/activity/drawPrize";
export default {
data() {
return {
- maxHeight: '40vh',
+ maxHeight: "40vh",
bkg,
flag: false, //是否开始
isEnd: true, //视图结束
- isOver: false,//抽奖是否结束
+ isOver: false, //抽奖是否结束
timer: null,
config: {
draw_prize: {},
@@ -120,19 +126,23 @@ export default {
dom.style.fontSize = baseSize * Math.min(scale, 2) + "px";
this.$nextTick(() => {
- this.maxHeight = this.$refs['numbers'].getBoundingClientRect().height + 'px'
- })
+ this.maxHeight =
+ this.$refs["numbers"].getBoundingClientRect().height + "px";
+ });
},
async getConfig() {
const res = await drawConfig({
id: this.$route.params.id,
});
- res.numbers_list = res.numbers_list.map(i => i.toString().padStart(3,'0'))
+ res.numbers_list = res.numbers_list.map((i) =>
+ i.toString().padStart(3, "0")
+ );
this.config = res;
this.$nextTick(() => {
- this.maxHeight = this.$refs['numbers'].getBoundingClientRect().height + 'px'
- })
+ this.maxHeight =
+ this.$refs["numbers"].getBoundingClientRect().height + "px";
+ });
},
async getResult() {
const res = await drawLog(
@@ -148,10 +158,15 @@ export default {
this.resultNumbers = res.data
.filter((i) => i.draw_prize_id == this.$route.params.id)
.map((i) => i.mobile.padStart(3, "0"));
+
+ this.$nextTick(() => {
+ this.maxHeight =
+ this.$refs["numbers"].getBoundingClientRect().height + "px";
+ });
},
draw: throttle(async function () {
- if (this.isOver) return
+ if (this.isOver) return;
if (!this.flag) {
console.log("开始抽奖");
try {
@@ -186,12 +201,10 @@ export default {
}, 150);
}
}, 150);
-
} catch (err) {
console.log(err);
}
} else {
-
this.flag = false;
console.log("结束抽奖");
}
@@ -210,7 +223,9 @@ export default {
set.add(
this.config.numbers_list[
Math.floor(Math.random() * this.config.numbers_list.length)
- ].toString().padStart(3,'0')
+ ]
+ .toString()
+ .padStart(3, "0")
);
}
@@ -219,8 +234,8 @@ export default {
let temp = this.config.numbers_list
.sort(() => Math.random() - 0.5)
- .slice(0, 36)
- console.log(temp)
+ .slice(0, 36);
+ console.log(temp);
return temp;
} else {
return [];
@@ -251,6 +266,7 @@ export default {
background-size: cover;
background-repeat: no-repeat;
overflow: hidden;
+ transform-style: preserve-3d;
padding-top: 17.31vh;
.title {
@@ -306,13 +322,21 @@ export default {
flex: 1;
overflow: hidden;
+ position: relative;
.numbers {
display: grid;
grid-template-columns: repeat(6, 1fr);
- grid-template-rows: repeat(6, 1fr);
+ //grid-template-rows: repeat(6, 1fr);
grid-column-gap: 2.8em;
grid-row-gap: 0.93vh;
+ justify-content: center;
+ align-content: center;
+ transform: translateY(-50%);
+ position: absolute;
+ top: 50%;
+ left: 0;
+ right: 0;
&-active {
& > div:nth-child(2n + 1) {
animation: blur 0.15s infinite linear;
@@ -324,11 +348,13 @@ export default {
@keyframes blur {
from {
text-shadow: 2px 4px #00000066;
- filter: blur(1.5px) drop-shadow(0 0 4px #00000055) drop-shadow(0 0 8px #00000033);
+ filter: blur(1.5px) drop-shadow(0 0 4px #00000055)
+ drop-shadow(0 0 8px #00000033);
}
to {
text-shadow: 2px 4px #00000066;
- filter: blur(1.5px) drop-shadow(0 0 4px #00000055) drop-shadow(0 0 8px #00000033);
+ filter: blur(1.5px) drop-shadow(0 0 4px #00000055)
+ drop-shadow(0 0 8px #00000033);
transform: translateY(-200%);
}
}
@@ -388,7 +414,7 @@ export default {
}
}
.btn {
- border-width: 0 2px 2px 0;
+ border-width: 0;
display: block;
cursor: pointer;
text-align: center;
@@ -396,13 +422,22 @@ export default {
width: 46.67%;
font-weight: 900;
transition: all 0.2s;
- background: linear-gradient(to bottom,rgb(242, 172, 106),rgb(247, 232, 203));
+ background: linear-gradient(
+ to bottom,
+ rgb(241, 170, 102) 20%,
+ rgb(234, 219, 188)
+ );
border-radius: 6px;
color: rgb(152, 50, 22);
- box-shadow: 1px 4px 10px 6px #00000055;
+ box-shadow: 1px 4px 10px 6px #00000088;
+ transform: translateZ(0);
margin: 4.2vh auto 0 auto;
padding: 10px 0;
+
+ &:active {
+ transform: perspective(100px) translateZ(-5px);
+ }
}
}