|
|
@@ -54,8 +54,8 @@
|
|
|
<i>0</i>
|
|
|
<i>0</i>
|
|
|
<i>0</i>
|
|
|
+ <span :datafinal=item.userName></span>
|
|
|
</div>
|
|
|
- <span :datafinal=item.userName></span>
|
|
|
</div>
|
|
|
|
|
|
<b-button v-ripple.400="'rgba(255, 255, 255, 0.15)'" class="mt-2" variant="outline-primary" block
|
|
|
@@ -223,26 +223,16 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
draw() {
|
|
|
- useJwt.postData('/api/draw/draw_user', { deadline: this.activity.deadline, region: this.region, number: this.drawNumber }).then(res => {
|
|
|
- useJwt.postData('/api/prize/prizeDrawable', { prizeId: this.prizeId, number: this.drawNumber }).then(drawable => {
|
|
|
- if (drawable.data) {
|
|
|
- var userIdList=[];
|
|
|
- res.data.forEach(element => {
|
|
|
- this.drawList.push({ userId: element.user_id, userName: element.name, department: this.departmentList[element.department_id] });
|
|
|
- userIdList.push(element.user_id);
|
|
|
- });
|
|
|
- useJwt.postData('/api/recipients/storePatch', { prizeId: this.prizeId, userIdList: userIdList }).then(r => {
|
|
|
- console.log(r.data);
|
|
|
- useJwt.postData('/api/prize/drawPatch', { prizeId: this.prizeId, number: this.drawNumber });
|
|
|
- });
|
|
|
- setTimeout(() => {
|
|
|
- this.count(this.drawList);
|
|
|
- });
|
|
|
- } else {
|
|
|
- this.hideModal();
|
|
|
- console.log("prize is not available.");
|
|
|
- }
|
|
|
- });
|
|
|
+ useJwt.postData('/api/draw/draw', { activity_id: this.activityId, prize_id: this.prizeId, region: this.region, number: this.drawNumber }).then(res => {
|
|
|
+ if(res.data){
|
|
|
+ this.drawList = res.data;
|
|
|
+ setTimeout(() => {
|
|
|
+ this.count();
|
|
|
+ }, 100);
|
|
|
+ } else {
|
|
|
+ this.hideModal();
|
|
|
+ console.log("error");
|
|
|
+ }
|
|
|
});
|
|
|
},
|
|
|
count() {
|
|
|
@@ -251,8 +241,10 @@ export default {
|
|
|
var string = numbers;
|
|
|
|
|
|
this.drawList.forEach((element, index) => {
|
|
|
+ var departmentName = this.departmentList[element.department_id];
|
|
|
var deps = document.querySelectorAll(".counter_" + index + " > i");
|
|
|
var allCounters = document.querySelectorAll(".counter_" + index + " > div > i");
|
|
|
+
|
|
|
deps.forEach(function (el) {
|
|
|
var duration = 1000;
|
|
|
var interval = setInterval(function () {
|
|
|
@@ -260,20 +252,20 @@ export default {
|
|
|
duration = duration - 50;
|
|
|
if (duration <= 0) {
|
|
|
clearInterval(interval);
|
|
|
- el.innerText = element.department;
|
|
|
+ el.innerText = departmentName;
|
|
|
}
|
|
|
}, 50);
|
|
|
});
|
|
|
allCounters.forEach((el, i) => {
|
|
|
- var duration = 2000 + i * 1000;
|
|
|
+ var duration = 500 + i * 1000;
|
|
|
var interval = setInterval(e => {
|
|
|
el.innerText = string.charAt(Math.random() * string.length);
|
|
|
duration = duration - 50;
|
|
|
if (duration <= 0) {
|
|
|
clearInterval(interval);
|
|
|
- el.innerText = element.userId[i];
|
|
|
+ el.innerText = element.user_id[i];
|
|
|
if (i == 3) {
|
|
|
- document.querySelectorAll(".counter_" + index + " > span")[0].innerText = element.userName;
|
|
|
+ document.querySelectorAll(".counter_" + index + " > div > span")[0].innerText = element.user_name;
|
|
|
}
|
|
|
}
|
|
|
}, 50);
|