ActivityPage.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. <template>
  2. <div>
  3. <b-row class="match-height">
  4. <b-col v-if="checkinPage.includes(role)" md="6" :lg="lg">
  5. <b-card no-body border-variant="info" class="text-center">
  6. <b-card-body>
  7. <b-button variant="success"
  8. :to="{ name: 'checkin', params: { 'activity_id': this.$route.params.activity_id } }">報到頁面</b-button>
  9. </b-card-body>
  10. </b-card>
  11. </b-col>
  12. <b-col v-if="drawPage.includes(role)" md="6" :lg="lg">
  13. <b-card no-body border-variant="info" class="text-center">
  14. <b-card-body>
  15. <b-button variant="success"
  16. :to="{ name: 'draw', params: { 'activity_id': this.$route.params.activity_id } }">抽獎頁面</b-button>
  17. </b-card-body>
  18. </b-card>
  19. </b-col>
  20. <b-col v-if="drawPage.includes(role)" md="6" :lg="lg">
  21. <b-card no-body border-variant="info" class="text-center">
  22. <b-card-body>
  23. <b-button variant="success"
  24. target="_blank"
  25. :to="{ name: 'slot', params: { 'activity_id': this.$route.params.activity_id } }">大獎抽獎頁面</b-button>
  26. </b-card-body>
  27. </b-card>
  28. </b-col>
  29. <b-col v-if="checkinPage.includes(role)" md="6" :lg="lg">
  30. <b-card no-body border-variant="info" class="text-center">
  31. <b-card-body>
  32. <b-button variant="success"
  33. :to="{ name: 'claim', params: { 'activity_id': this.$route.params.activity_id } }">兌獎頁面</b-button>
  34. </b-card-body>
  35. </b-card>
  36. </b-col>
  37. <b-col v-if="checkinPage.includes(role)" md="6" :lg="lg">
  38. <b-card no-body border-variant="info" class="text-center">
  39. <b-card-body>
  40. <b-button variant="success"
  41. :to="{ name: 'playPrizeList', params: { 'activity_id': this.$route.params.activity_id } }">中獎輪播名單</b-button>
  42. </b-card-body>
  43. </b-card>
  44. </b-col>
  45. <b-col v-if="checkinPage.includes(role)" md="6" :lg="lg">
  46. <b-card no-body border-variant="info" class="text-center">
  47. <b-card-body>
  48. <b-button variant="success"
  49. target="_blank"
  50. :to="{ name: 'prizeList', params: { 'activity_id': this.$route.params.activity_id } }">主持人中獎名單</b-button>
  51. </b-card-body>
  52. </b-card>
  53. </b-col>
  54. <b-col v-if="checkinPage.includes(role)" md="6" :lg="lg">
  55. <b-card no-body border-variant="info" class="text-center">
  56. <b-card-body>
  57. <b-button variant="success"
  58. @click="downloadFile">匯出報到名單</b-button>
  59. </b-card-body>
  60. </b-card>
  61. </b-col>
  62. <b-col v-if="checkinPage.includes(role)" md="6" :lg="lg">
  63. <b-card no-body border-variant="info" class="text-center">
  64. <b-card-body>
  65. <b-button variant="success"
  66. @click="downloadRecipients">匯出得獎名單</b-button>
  67. </b-card-body>
  68. </b-card>
  69. </b-col>
  70. <b-col md="6" :lg="lg">
  71. <b-card no-body border-variant="info" class="text-center">
  72. <b-card-body>
  73. <b-button variant="success"
  74. :to="{ name: 'search', params: { 'activity_id': this.$route.params.activity_id } }">查詢個人資訊</b-button>
  75. </b-card-body>
  76. </b-card>
  77. </b-col>
  78. </b-row>
  79. <div v-if="canViewVerticalNavMenuLink({ route: 'slotManager' })" class="group-area mt-1">
  80. <h3>管理功能</h3>
  81. <hr>
  82. </div>
  83. <b-row class="match-height">
  84. <b-col v-if="canViewVerticalNavMenuLink({ route: 'slotManager' })" md="6" :lg="lg">
  85. <b-card no-body border-variant="info" class="text-center">
  86. <b-card-body>
  87. <b-button variant="success"
  88. :to="{ name: 'slotManager', params: { 'activity_id': this.$route.params.activity_id } }">抽獎管理頁面</b-button>
  89. </b-card-body>
  90. </b-card>
  91. </b-col>
  92. <b-col v-if="canViewVerticalNavMenuLink({ route: 'slotManager' })" md="6" :lg="lg">
  93. <b-card no-body border-variant="info" class="text-center">
  94. <b-card-body>
  95. <b-button variant="success"
  96. :to="{ name: 'randomTest', params: { 'activity_id': this.$route.params.activity_id } }">亂數分布測試</b-button>
  97. </b-card-body>
  98. </b-card>
  99. </b-col>
  100. <b-col v-if="drawPage.includes(role)" md="6" :lg="lg">
  101. <b-card no-body border-variant="info" class="text-center">
  102. <b-card-body>
  103. <b-button variant="success"
  104. :to="{ name: 'activityUpdate', params: { 'activity_id': this.$route.params.activity_id } }">編輯活動</b-button>
  105. </b-card-body>
  106. </b-card>
  107. </b-col>
  108. </b-row>
  109. </div>
  110. </template>
  111. <script>
  112. import { useUtils as useAclUtils } from '@core/libs/acl'
  113. import { BCard, BCardBody, BCardText, BLink, BButton, BButtonGroup, BRow, BCol } from 'bootstrap-vue'
  114. import { getUserData } from '@/auth/utils'
  115. import useJwt from '@/auth/jwt/useJwt'
  116. import Ripple from 'vue-ripple-directive'
  117. export default {
  118. components: {
  119. BCard,
  120. BCardBody,
  121. BCardText,
  122. BLink,
  123. BButton,
  124. BButtonGroup,
  125. BRow,
  126. BCol,
  127. },
  128. directives: {
  129. Ripple,
  130. },
  131. setup() {
  132. const { canViewVerticalNavMenuLink } = useAclUtils()
  133. return {
  134. // ACL
  135. canViewVerticalNavMenuLink,
  136. }
  137. },
  138. data() {
  139. return {
  140. userData: getUserData(),
  141. lg: 4,
  142. adminPage: ['Admin'],
  143. drawPage: ['Admin', 'Draw'],
  144. checkinPage: ['Admin', 'Checkin'],
  145. role: "guest",
  146. }
  147. },
  148. created() {
  149. this.role = this.userData && this.userData.role ? this.userData.role : "guest"
  150. },
  151. methods: {
  152. downloadFile() {
  153. useJwt.postData('/api/checkin/export', { 'activity_id': this.$route.params.activity_id }).then(response => {
  154. let blob = new Blob([response.data], {
  155. type: 'application/csv'
  156. })
  157. let link = document.createElement('a')
  158. link.href = window.URL.createObjectURL(blob)
  159. link.download = response.headers["content-disposition"].split('filename=')[1]
  160. link.click()
  161. }).catch(error => {
  162. console.log(error)
  163. this.user = { name: "查無此人", user_id: " ", department: " " };
  164. this.input = "";
  165. });
  166. },
  167. downloadRecipients() {
  168. useJwt.postData('/api/recipients/export', { 'activity_id': this.$route.params.activity_id }).then(response => {
  169. let blob = new Blob([response.data], {
  170. type: 'application/csv'
  171. })
  172. let link = document.createElement('a')
  173. link.href = window.URL.createObjectURL(blob)
  174. link.download = response.headers["content-disposition"].split('filename=')[1]
  175. link.click()
  176. }).catch(error => {
  177. console.log(error)
  178. });
  179. }
  180. }
  181. }
  182. </script>
  183. <style>
  184. .redirect-back {
  185. position: fixed;
  186. bottom: 5%;
  187. right: 30px;
  188. z-index: 99;
  189. }
  190. </style>