|
|
@@ -13,14 +13,14 @@
|
|
|
id="dropdown-6"
|
|
|
text="選擇獎項"
|
|
|
variant="info">
|
|
|
- <b-dropdown-item :key="index" v-for="(item,index) in prizes" @click="getPrizeList(item.id)">{{item.name}}</b-dropdown-item>
|
|
|
+ <b-dropdown-item :key="index" v-for="(item, index) in prizes"
|
|
|
+ @click="getPrizeList(item.id)">{{ item.name }}</b-dropdown-item>
|
|
|
</b-dropdown>
|
|
|
</div>
|
|
|
</b-card-header>
|
|
|
<b-row v-if="prizeList.length > 0">
|
|
|
<b-col cols="12" class="prize-list" :key="index" v-for="(item, index) in prizeList">
|
|
|
- <b-badge pill variant="light">{{ item.alias.padEnd(6, " ") + " " + item.user_id + " " +
|
|
|
- item.name.padEnd(4, " ") }}</b-badge>
|
|
|
+ <b-badge pill :style="color(item.alias)">{{ prizeBadge(item) }}</b-badge>
|
|
|
</b-col>
|
|
|
</b-row>
|
|
|
<b-row v-else>
|
|
|
@@ -36,7 +36,7 @@ import BCardCode from '@core/components/b-card-code/BCardCode.vue'
|
|
|
import { BCard, BCardTitle, BCardHeader, BRow, BCol, BBadge, BButton, BProgress, BDropdown, BDropdownItem } from 'bootstrap-vue'
|
|
|
|
|
|
import useJwt from '@/auth/jwt/useJwt'
|
|
|
-
|
|
|
+const colors = ["250,250,250,1", "128,128,128,1"];
|
|
|
export default {
|
|
|
components: {
|
|
|
BCard,
|
|
|
@@ -58,6 +58,8 @@ export default {
|
|
|
prizes: [],
|
|
|
index: 0,
|
|
|
variant: 'danger',
|
|
|
+ tempAlias: "",
|
|
|
+ tempColor: 0,
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
@@ -72,7 +74,6 @@ export default {
|
|
|
methods: {
|
|
|
getPrize(activity_id) {
|
|
|
useJwt.postData('/api/prize/index_by_activity', { activity_id: activity_id }).then(response => {
|
|
|
- console.log(response.data);
|
|
|
this.prizes = response.data;
|
|
|
this.index = this.prizes.length - 1;
|
|
|
let prize_id = this.prizes[this.index].id;
|
|
|
@@ -83,6 +84,8 @@ export default {
|
|
|
},
|
|
|
getPrizeList(prize_id) {
|
|
|
useJwt.postData('/api/recipient/indexByPrize', { prize_id: prize_id }).then(response => {
|
|
|
+ console.log(response.data);
|
|
|
+
|
|
|
this.prizeList = response.data.list;
|
|
|
this.prizeName = response.data.prize[0].name;
|
|
|
|
|
|
@@ -93,6 +96,22 @@ export default {
|
|
|
padEnd(string) {
|
|
|
string.padEnd(6, " ");
|
|
|
},
|
|
|
+ prizeBadge(item) {
|
|
|
+ if (item.alias == '來賓') {
|
|
|
+ return item.alias.padEnd(6, " ") + " " + item.name.padEnd(7, " ")
|
|
|
+ } else {
|
|
|
+ return item.alias.padEnd(6, " ") + " " + item.user_id + " " +
|
|
|
+ item.name.padEnd(4, " ");
|
|
|
+ }
|
|
|
+ },
|
|
|
+ color(alias) {
|
|
|
+ if (this.tempAlias != alias) {
|
|
|
+ this.tempAlias = alias;
|
|
|
+ this.tempColor = (this.tempColor + 1) % colors.length
|
|
|
+ }
|
|
|
+
|
|
|
+ return 'background-color: rgba(' + colors[this.tempColor] + ')';
|
|
|
+ }
|
|
|
},
|
|
|
computed: {
|
|
|
PauseIcon() {
|