game.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. <template>
  2. <view class="center">
  3. <view class="box" v-for="(item,index) in gameList " >
  4. <!-- <view class="box-title">
  5. {{item.name}}
  6. </view> -->
  7. <view class="game-box" @click="goGame(item.id,index)">
  8. <image :src="'../../static/img/game0'+(index%5+1)+'.png'" mode=""></image>
  9. <view class="game-box-content">{{item.add_time}}
  10. <view class="game-box-content1">
  11. {{item.end_time}}
  12. </view>
  13. </view>
  14. </view>
  15. </view>
  16. <!-- <view class="game-box" @click="goGame(1)">
  17. <image src="../../static/img/game02.png" mode=""></image>
  18. <view class="game-box-content" style="color: #BA4FBC;">开打时间
  19. <view class="game-box-content1" style="background-color: #BA4FBC;">
  20. 每天10:00
  21. </view>
  22. </view>
  23. </view>
  24. <view class="game-box" @click="goGame(2)">
  25. <image src="../../static/img/game03.png" mode=""></image>
  26. <view class="game-box-content" style="color: #E88B2D;">开打时间
  27. <view class="game-box-content1" style="background-color: #E88B2D;">
  28. 每天10:00
  29. </view>
  30. </view>
  31. </view>
  32. <view class="game-box" @click="goGame(3)">
  33. <image src="../../static/img/game04.png" mode=""></image>
  34. <view class="game-box-content" style="color: #FF6E3E;">开打时间
  35. <view class="game-box-content1" style="background-color: #FF6E3E;">
  36. 每天10:00
  37. </view>
  38. </view>
  39. </view>
  40. <view class="game-box" @click="goGame(4)">
  41. <image src="../../static/img/game05.png" mode=""></image>
  42. <view class="game-box-content" style="color:#21BB9F;">开打时间
  43. <view class="game-box-content1" style="background-color: #21BB9F;">
  44. 每天10:00
  45. </view>
  46. </view>
  47. </view> -->
  48. <!-- <view class="kong">
  49. <u-empty mode="data" text="敬请期待"></u-empty>
  50. </view> -->
  51. <!-- <u-tabbar activeColor="#EE0979" v-model="current" :list="tabbar" :mid-button="true"></u-tabbar> -->
  52. </view>
  53. </template>
  54. <script>
  55. import {
  56. getGame
  57. } from '@/api/game.js'
  58. import {
  59. tabbar
  60. } from '@/utils/tabbar.js';
  61. export default {
  62. data() {
  63. return {
  64. tabbar: tabbar,
  65. current: 2,
  66. add_time: '', //开始事件
  67. end_time: '', //结束时间
  68. gameList: '', //游戏列表
  69. };
  70. },
  71. onShow() {
  72. getGame().then(res => {
  73. console.log(res, 'res');
  74. this.gameList = res.data.data
  75. })
  76. },
  77. methods: {
  78. goGame(e,index) {
  79. console.log(e, '点击跳转');
  80. uni.navigateTo({
  81. url: './gameDetail?id=' + e+'&index='+index
  82. })
  83. }
  84. },
  85. };
  86. </script>
  87. <style lang="scss">
  88. .center {
  89. width: 750rpx;
  90. padding: 0;
  91. margin: 20rpx;
  92. }
  93. .box-title{
  94. display: flex;
  95. font-size: 28rpx;
  96. font-weight: 500;
  97. }
  98. .game-box {
  99. position: relative;
  100. // margin: 10rpx;
  101. width: 690rpx;
  102. height: 280rpx;
  103. image {
  104. width: 100%;
  105. height: 100%;
  106. }
  107. }
  108. .game-box-content {
  109. top: 200rpx;
  110. left: 60rpx;
  111. line-height: 40rpx;
  112. position: absolute;
  113. font-size: 24rpx;
  114. font-weight: 500;
  115. color: #8F6AFD;
  116. padding-left: 10rpx;
  117. width: 500rpx;
  118. height: 40rpx;
  119. background: #FFFFFF;
  120. border-radius: 27rpx;
  121. align-items: center;
  122. .game-box-content1 {
  123. align-items: center;
  124. position: absolute;
  125. right: 0;
  126. top: 0;
  127. line-height: 40rpx;
  128. text-align: center;
  129. width: 270rpx;
  130. height: 40rpx;
  131. background: #754AF0;
  132. border-radius: 27rpx;
  133. font-size: 24rpx;
  134. font-weight: 500;
  135. color: #FFFFFF;
  136. }
  137. }
  138. // .kong {
  139. // height: 100vh;
  140. // width: 750rpx;
  141. // }
  142. </style>