index.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. <template>
  2. <div class="bg101010">
  3. <div v-for="item in list" :key="item.id" class="box-card">
  4. <div class="fcs">
  5. <img class="wh40 m15" :src="iconURL(item.gameFileKey)" alt="">
  6. <span class="txt1">{{ item.gameName.length > 10 ? item.gameName.slice(0, 10) + '...' : item.gameName }}</span>
  7. </div>
  8. <span class="txt2">你有{{ item.unclaimedCount }}个礼包待领取</span>
  9. <div class="fncb mt6">
  10. <div class="ml15 fnc">
  11. <div v-for="(ele, index) in item.gameGiftBagList" :key="ele.id">
  12. <div v-if="index < 4" class="ibox"><img class="ibox" src="~/assets/image/activity/welfare-community/box.png" alt="" /></div>
  13. </div>
  14. <div v-if="item.gameGiftBagList.length > 4" class="ibox"><img class="ibox" src="~/assets/image/activity/welfare-community/icon_more@2x.png" alt="" /></div>
  15. </div>
  16. <div class="view-btn mr10" @click="view(item.id, item.gameName)">立即查看</div>
  17. </div>
  18. </div>
  19. </div>
  20. </template>
  21. <script>
  22. import { Toast } from 'vant';
  23. import { fileKeyToUrl } from '@/plugins/file-center.js';
  24. export default {
  25. auth: false,
  26. data() {
  27. return {
  28. list: []
  29. }
  30. },
  31. head: {
  32. title: '福利社区',
  33. },
  34. computed: {
  35. iconURL() {
  36. return (key) => {
  37. return fileKeyToUrl(key)
  38. }
  39. }
  40. },
  41. created() {
  42. this.token = this.$route.query.token;
  43. this.getAppGameGiftActivityList()
  44. },
  45. methods: {
  46. view(id, gameName) {
  47. this.$router.push({ path: '/welfare-community/list', query: { token: this.$route.query.token, id, user: this.$route.query.user, gameName } })
  48. },
  49. async getAppGameGiftActivityList() {
  50. try {
  51. const res = await this.$axios.$post('/activity/game/giftActivity/getAppGameGiftActivityList', {}, { headers: { Authorization: this.token } });
  52. this.list = res.data;
  53. } catch (err) {
  54. Toast({
  55. message: err.message,
  56. duration: 3000
  57. });
  58. }
  59. }
  60. }
  61. }
  62. </script>
  63. <style scoped>
  64. .fcs {
  65. display: flex;
  66. align-items: center;
  67. justify-content: flex-start;
  68. }
  69. .mr10 {
  70. margin-right: 10px;
  71. }
  72. .view-btn {
  73. width: 78px;
  74. height: 28px;
  75. background: #3B7FFF;
  76. border-radius: 4px;
  77. font-size: 14px;
  78. font-weight: 400;
  79. color: #FFFFFF;
  80. line-height: 28px;
  81. text-align: center;
  82. }
  83. .mt6 {
  84. margin-top: 6px;
  85. }
  86. .fncb {
  87. display: flex;
  88. align-items: center;
  89. justify-content: space-between;
  90. }
  91. .bg101010 {
  92. background: #101010;
  93. min-height: 100vh;
  94. padding-top: 15px;
  95. overflow: hidden;
  96. }
  97. .box-card {
  98. width: 345px;
  99. height: 136px;
  100. margin: 0 auto 15px;
  101. background: url('~/assets/image/activity/welfare-community/bj@2x.png');
  102. background-size: 100% 100%;
  103. border-radius: 15px;
  104. overflow: hidden;
  105. }
  106. .wh40 {
  107. width: 40px;
  108. height: 40px;
  109. }
  110. .m15 {
  111. margin: 15px;
  112. }
  113. .fnc {
  114. display: flex;
  115. align-items: center;
  116. justify-content: center;
  117. }
  118. .txt1 {
  119. font-size: 20px;
  120. font-weight: 500;
  121. color: #FFFFFF;
  122. line-height: 28px;
  123. }
  124. .txt2 {
  125. font-size: 14px;
  126. color: #CFD1D4;
  127. line-height: 20px;
  128. margin-left: 15px;
  129. }
  130. .ibox {
  131. width: 26px;
  132. height: 26px;
  133. background: rgba(216, 216, 216, 0.1);
  134. border-radius: 3px;
  135. margin-right: 6px;
  136. }
  137. .ibox img {
  138. width: 100%;
  139. height: 100%;
  140. }
  141. .ml15 {
  142. margin-left: 15px;
  143. }
  144. </style>