index.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. <template>
  2. <div class="bg">
  3. <img v-if="num" class="btn" src="~/assets/image/activity/rentNo/btn-active.png" alt="" @click="receiverGameRentNoCode()">
  4. <img v-else class="btn" src="~/assets/image/activity/rentNo/btn.png" alt="">
  5. <div class="tip">
  6. 领取次数剩余 <span class="cFE87C7">{{ num }}</span> 次(数量有限 先到先得)
  7. </div>
  8. <img class="rule" src="~/assets/image/activity/rentNo/rule.png" alt="" @click="getRecordList()">
  9. <van-popup v-model="show" :style="{ background: 'transparent' }">
  10. <div class="w280h335">
  11. <div class="c333333">领取记录</div>
  12. <div class="mlr15">
  13. <div class="frnb bb1">
  14. <div class="c666666 ml20">激活码</div>
  15. <div class="c666666 mr30">操作</div>
  16. </div>
  17. <div class="h173">
  18. <div v-for="item in list" :key="item.id" class="frnb">
  19. <div class="fs15 ml20">{{ item.code }}</div>
  20. <div class="c2E76F9 mr30" @click="copy(item.code)">复制</div>
  21. </div>
  22. </div>
  23. </div>
  24. </div>
  25. <img class="wh35" src="~/assets/image/activity/rentNo/close.png" alt="" @click="show = false">
  26. </van-popup>
  27. <van-popup v-model="showResult" :style="{ background: 'transparent' }">
  28. <div class="w280h248">
  29. <div class="c333333">恭喜您获得体验会员</div>
  30. <div class="fs15">激活码:<span class="c0FA2EB">{{ code }}</span></div>
  31. <img class="w160h44" src="~/assets/image/activity/rentNo/btn-copy.png" alt="" @click="copy(code)">
  32. </div>
  33. <img class="wh35" src="~/assets/image/activity/rentNo/close.png" alt="" @click="showResult = false">
  34. </van-popup>
  35. </div>
  36. </template>
  37. <script>
  38. import { Toast } from 'vant';
  39. export default {
  40. auth: false,
  41. data() {
  42. return {
  43. show: false,
  44. showResult: false,
  45. token: '',
  46. list: [],
  47. num: 0,
  48. code: ''
  49. }
  50. },
  51. head: {
  52. title: '惊喜礼包领取'
  53. },
  54. created() {
  55. this.token = this.$route.query.token;
  56. this.gameRentNoCodeInfo()
  57. },
  58. methods: {
  59. async gameRentNoCodeInfo() {
  60. try {
  61. const res = await this.$axios.$get('/activity/game/rentNo/gameRentNoCodeInfo', { headers: { Authorization: this.token } });
  62. this.num = res.data
  63. } catch (err) {
  64. Toast({
  65. message: err.message,
  66. duration: 3000
  67. });
  68. }
  69. },
  70. async getRecordList() {
  71. try {
  72. const res = await this.$axios.$get('/activity/game/rentNo/receive/record?pageNum=1&pageSize=10000', { headers: { Authorization: this.token } });
  73. this.list = res.data.list;
  74. this.show = true
  75. } catch (err) {
  76. Toast({
  77. message: err.message,
  78. duration: 3000
  79. });
  80. }
  81. },
  82. async receiverGameRentNoCode() {
  83. try {
  84. const res = await this.$axios.$post('/activity/game/rentNo/receiverGameRentNoCode', { userName: this.$auth.user.username }, { headers: { Authorization: this.token } });
  85. this.code = res.data
  86. this.showResult = true;
  87. } catch (err) {
  88. Toast({
  89. message: err.message,
  90. duration: 3000
  91. });
  92. }
  93. },
  94. async copy(item) {
  95. await this.$native.clipboard.writeText(item.activationCode);
  96. this.$toast.success('复制成功');
  97. }
  98. }
  99. }
  100. </script>
  101. <style lang="scss">
  102. .bg {
  103. background-size: 100% auto;
  104. overflow: hidden;
  105. padding: 0;
  106. padding-bottom: env(safe-area-inset-bottom, 30px);
  107. background-image: url('~/assets/image/activity/rentNo/bg.png');
  108. height: 1052px;
  109. .btn {
  110. width: 300px;
  111. height: 72px;
  112. display: block;
  113. margin: 484px auto 0;
  114. }
  115. .tip {
  116. width: 100%;
  117. height: 40px;
  118. line-height: 40px;
  119. text-align: center;
  120. font-size: 15px;
  121. color: #FFFFFF;
  122. text-shadow: 0px 1px 2px rgba(253, 93, 190, 0.18);
  123. border-radius: 5px;
  124. margin-top: 11px;
  125. .cFE87C7 {
  126. color: #FE87C7;
  127. font-size: 20px;
  128. font-weight: bold;
  129. }
  130. }
  131. .rule {
  132. width: 35px;
  133. height: 103px;
  134. position: absolute;
  135. right: 0;
  136. top: 183px;
  137. }
  138. .w280h335 {
  139. width: 280px;
  140. height: 335px;
  141. background: url('~/assets/image/activity/rentNo/dialog.png');
  142. background-size: 100% 100%;
  143. overflow: hidden;
  144. .c333333 {
  145. height: 18px;
  146. font-size: 18px;
  147. font-weight: bold;
  148. color: #333333;
  149. text-align: center;
  150. margin-top: 91px;
  151. }
  152. .mlr15 {
  153. margin: 10px 15px 22px;
  154. .frnb {
  155. display: flex;
  156. justify-content: space-between;
  157. align-items: center;
  158. height: 30px;
  159. line-height: 30px;
  160. }
  161. .c666666 {
  162. font-size: 15px;
  163. color: #666666;
  164. }
  165. .ml20 {
  166. margin-left: 20px;
  167. }
  168. .mr30 {
  169. margin-right: 30px;
  170. }
  171. .bb1 {
  172. border-bottom: 1px solid #E6E6E6;
  173. }
  174. .fs15 {
  175. font-size: 15px;
  176. font-weight: 400;
  177. color: #333333;
  178. }
  179. .c2E76F9 {
  180. font-size: 15px;
  181. font-weight: 400;
  182. color: #2E76F9;
  183. }
  184. .h173 {
  185. height: 173px;
  186. overflow-y: auto;
  187. }
  188. }
  189. }
  190. .w280h248 {
  191. width: 280px;
  192. height: 248px;
  193. background: url('~/assets/image/activity/rentNo/dialog2.png');
  194. background-size: 100% 100%;
  195. overflow: hidden;
  196. .c333333 {
  197. font-size: 24px;
  198. font-weight: 400;
  199. color: #333333;
  200. text-align: center;
  201. margin-top: 108px;
  202. }
  203. .fs15 {
  204. font-size: 15px;
  205. font-weight: 400;
  206. color: #333333;
  207. text-align: center;
  208. margin-top: 10px;
  209. }
  210. .c0FA2EB {
  211. font-size: 15px;
  212. font-weight: 400;
  213. color: #0FA2EB !important;
  214. }
  215. .w160h44 {
  216. width: 160px;
  217. height: 44px;
  218. display: block;
  219. margin: 11px auto 0;
  220. }
  221. }
  222. .wh35 {
  223. width: 35px;
  224. height: 35px;
  225. margin: 23px auto 0;
  226. display: block;
  227. }
  228. }
  229. </style>