index.vue 3.2 KB

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