|
|
@@ -28,8 +28,7 @@
|
|
|
@click="hideModal">
|
|
|
Close
|
|
|
</b-button>
|
|
|
- <b-button v-ripple.400="'rgba(255, 255, 255, 0.15)'" class="mt-2" variant="outline-primary" block
|
|
|
- v-b-modal.draw-animation @click="draw">
|
|
|
+ <b-button v-ripple.400="'rgba(255, 255, 255, 0.15)'" class="mt-2" variant="outline-primary" block @click="draw">
|
|
|
Accept
|
|
|
</b-button>
|
|
|
|
|
|
@@ -37,7 +36,7 @@
|
|
|
|
|
|
<b-modal ref="draw-error" centered title="抽獎" no-stacking hide-footer>
|
|
|
<b-card-text class="my-1 text-center">
|
|
|
- 獎品數量以抽完
|
|
|
+ 獎品錯誤
|
|
|
</b-card-text>
|
|
|
<b-button v-ripple.400="'rgba(255, 255, 255, 0.15)'" class="mt-3" variant="outline-secondary" block
|
|
|
@click="hideModal">
|
|
|
@@ -45,7 +44,7 @@
|
|
|
</b-button>
|
|
|
</b-modal>
|
|
|
|
|
|
- <b-modal ref="draw-animation" id="draw-animation" title="抽獎" centered no-stacking hide-footer>
|
|
|
+ <b-modal ref="draw-animation" title="抽獎" centered no-stacking hide-footer>
|
|
|
<br>
|
|
|
<div :key="index" v-for="(item, index) in drawList" :class=counterId(index)>
|
|
|
<i :datafinal=item.department>部門</i>
|
|
|
@@ -59,7 +58,7 @@
|
|
|
</div>
|
|
|
|
|
|
<b-button v-ripple.400="'rgba(255, 255, 255, 0.15)'" class="mt-2" variant="outline-primary" block
|
|
|
- @click="hideModal">
|
|
|
+ @click="store">
|
|
|
Accept
|
|
|
</b-button>
|
|
|
</b-modal>
|
|
|
@@ -111,7 +110,6 @@ export default {
|
|
|
activityId: this.$route.params.activity_id,
|
|
|
activity: {},
|
|
|
userList: [],
|
|
|
- userIdList: [],
|
|
|
departmentList: [],
|
|
|
prizeList: [],
|
|
|
recipientsList: [],
|
|
|
@@ -126,7 +124,51 @@ export default {
|
|
|
prizeId: '',
|
|
|
drawList: [],
|
|
|
|
|
|
- departments: ["行政管理部", "行政管理部庶務科", "人力資源科", "行政管理部文書科", "南區辦事處", "中區辦事處", "工程管理一部", "工程管理二部", "c3工地", "發展與企畫部", "工程製圖科", "工務部", "大地工程部", "財務部", "六張犁工地", "中華郵政工地", "法務部調查局工地", "三峽國光工地", "河濱高中工地", "運輸及土木工程部", "城鄉發展部", "軌道工程部", "董事長室", "總經理室", "企業發展中心", "成本中心", "資訊中心", "環境及水資源工程部", "環境水務部", "環境永續部", "機電系統工程部", "結構工程部", "工程設計群", "工程監理群", "總管理處", "建築及設施群", "數位工程發展部", "淡海輕軌計畫監造專案", "安坑輕軌計畫監造專案", "先進技術中心", "塭仔圳市地重劃公共工程專案管理與監造專案", "萬大果菜市場專案"]
|
|
|
+ departments: [
|
|
|
+ "行政管理部",
|
|
|
+ "行政管理部庶務科",
|
|
|
+ "人力資源科",
|
|
|
+ "行政管理部文書科",
|
|
|
+ "南區辦事處",
|
|
|
+ "中區辦事處",
|
|
|
+ "工程管理一部",
|
|
|
+ "工程管理二部",
|
|
|
+ "c3工地",
|
|
|
+ "發展與企畫部",
|
|
|
+ "工程製圖科",
|
|
|
+ "工務部",
|
|
|
+ "大地工程部",
|
|
|
+ "財務部",
|
|
|
+ "六張犁工地",
|
|
|
+ "中華郵政工地",
|
|
|
+ "法務部調查局工地",
|
|
|
+ "三峽國光工地",
|
|
|
+ "河濱高中工地",
|
|
|
+ "運輸及土木工程部",
|
|
|
+ "城鄉發展部",
|
|
|
+ "軌道工程部",
|
|
|
+ "董事長室",
|
|
|
+ "總經理室",
|
|
|
+ "企業發展中心",
|
|
|
+ "成本中心",
|
|
|
+ "資訊中心",
|
|
|
+ "環境及水資源工程部",
|
|
|
+ "環境水務部",
|
|
|
+ "環境永續部",
|
|
|
+ "機電系統工程部",
|
|
|
+ "結構工程部",
|
|
|
+ "工程設計群",
|
|
|
+ "工程監理群",
|
|
|
+ "總管理處",
|
|
|
+ "建築及設施群",
|
|
|
+ "數位工程發展部",
|
|
|
+ "淡海輕軌計畫監造專案",
|
|
|
+ "安坑輕軌計畫監造專案",
|
|
|
+ "先進技術中心",
|
|
|
+ "塭仔圳市地重劃公共工程專案管理與監造專案",
|
|
|
+ "萬大果菜市場專案",
|
|
|
+ "來賓"
|
|
|
+ ]
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
@@ -138,10 +180,6 @@ export default {
|
|
|
this.userList = res.data;
|
|
|
});
|
|
|
|
|
|
- useJwt.postData('/api/user/index').then(res => {
|
|
|
- this.userIdList = res.data;
|
|
|
- });
|
|
|
-
|
|
|
useJwt.postData('/api/prize/index_by_activity', { activityId: this.activityId }).then(res => {
|
|
|
this.prizeList = res.data;
|
|
|
});
|
|
|
@@ -183,16 +221,25 @@ export default {
|
|
|
getRecipientsList(recipientsList) {
|
|
|
var output = [];
|
|
|
recipientsList.forEach(element => {
|
|
|
- output.push({ '獎項': this.getPrizeName(element.prize_id), '獲獎人': this.userIdList[element.user_id], '時間': this.dateFormat(element.created_at) });
|
|
|
+ output.push({ '獎項': this.getPrizeName(element.prize_id), '獲獎人': this.userList[element.user_id], '時間': this.dateFormat(element.created_at) });
|
|
|
});
|
|
|
return output;
|
|
|
},
|
|
|
counterId(id) {
|
|
|
return "counter_" + id;
|
|
|
},
|
|
|
+ onlyOne(number) {
|
|
|
+ if (number == 1) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ },
|
|
|
showDraw() {
|
|
|
this.$refs['draw-modal'].show();
|
|
|
},
|
|
|
+ showDrawAnimation() {
|
|
|
+ this.$refs['draw-animation'].show();
|
|
|
+ },
|
|
|
showDrawError() {
|
|
|
this.$refs['draw-error'].show();
|
|
|
},
|
|
|
@@ -224,15 +271,30 @@ export default {
|
|
|
},
|
|
|
draw() {
|
|
|
useJwt.postData('/api/draw/draw', { activity_id: this.activityId, prize_id: this.prizeId, region: this.region, number: this.drawNumber }).then(res => {
|
|
|
- if(res.data){
|
|
|
+ if (res.data) {
|
|
|
this.drawList = res.data;
|
|
|
setTimeout(() => {
|
|
|
this.count();
|
|
|
- }, 100);
|
|
|
+ }, 500);
|
|
|
+ this.showDrawAnimation();
|
|
|
+ } else {
|
|
|
+ this.showDrawError();
|
|
|
+ console.log("draw error");
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ store() {
|
|
|
+ var idList = [];
|
|
|
+ this.drawList.forEach(element => {
|
|
|
+ idList.push(element.user_id);
|
|
|
+ });
|
|
|
+ useJwt.postData('/api/draw/store', { users: idList, prize_id: String(this.prizeId), number: this.drawNumber }).then(res => {
|
|
|
+ if (res.data) {
|
|
|
+ console.log("success");
|
|
|
} else {
|
|
|
- this.hideModal();
|
|
|
- console.log("error");
|
|
|
+ console.log("store error");
|
|
|
}
|
|
|
+ this.hideModal();
|
|
|
});
|
|
|
},
|
|
|
count() {
|