game.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. <template>
  2. <view class="center">
  3. <view class="box" v-for="(item,index) in gameList ">
  4. <view class="game-box" @click="goGame(item.id,index)">
  5. <!-- <view class="box-title">
  6. 超有趣的种植人参游戏
  7. </view> -->
  8. <view class="box-titlee">
  9. 消耗积分{{item.lower_limit*1}}~{{item.upper_limit*1}}
  10. </view>
  11. <image :src="'../../static/img/index0'+(index%4+1)+'.png'" mode=""></image>
  12. <view class="game-box-content">{{item.name}}
  13. <view class="game-box-content1">
  14. 每天{{item.add_time}}
  15. </view>
  16. </view>
  17. </view>
  18. </view>
  19. <!-- <view class="game-box" @click="goGame(1)">
  20. <image src="../../static/img/game02.png" mode=""></image>
  21. <view class="game-box-content" style="color: #BA4FBC;">开打时间
  22. <view class="game-box-content1" style="background-color: #BA4FBC;">
  23. 每天10:00
  24. </view>
  25. </view>
  26. </view>
  27. <view class="game-box" @click="goGame(2)">
  28. <image src="../../static/img/game03.png" mode=""></image>
  29. <view class="game-box-content" style="color: #E88B2D;">开打时间
  30. <view class="game-box-content1" style="background-color: #E88B2D;">
  31. 每天10:00
  32. </view>
  33. </view>
  34. </view>
  35. <view class="game-box" @click="goGame(3)">
  36. <image src="../../static/img/game04.png" mode=""></image>
  37. <view class="game-box-content" style="color: #FF6E3E;">开打时间
  38. <view class="game-box-content1" style="background-color: #FF6E3E;">
  39. 每天10:00
  40. </view>
  41. </view>
  42. </view>
  43. <view class="game-box" @click="goGame(4)">
  44. <image src="../../static/img/game05.png" mode=""></image>
  45. <view class="game-box-content" style="color:#21BB9F;">开打时间
  46. <view class="game-box-content1" style="background-color: #21BB9F;">
  47. 每天10:00
  48. </view>
  49. </view>
  50. </view> -->
  51. <!-- <view class="kong">
  52. <u-empty mode="data" text="敬请期待"></u-empty>
  53. </view> -->
  54. <!-- <u-tabbar activeColor="#EE0979" v-model="current" :list="tabbar" :mid-button="true"></u-tabbar> -->
  55. </view>
  56. </template>
  57. <script>
  58. import {
  59. getGame
  60. } from '@/api/game.js'
  61. import {
  62. tabbar
  63. } from '@/utils/tabbar.js';
  64. export default {
  65. data() {
  66. return {
  67. tabbar: tabbar,
  68. current: 2,
  69. add_time: '', //开始事件
  70. end_time: '', //结束时间
  71. gameList: '', //游戏列表
  72. };
  73. },
  74. onShow() {
  75. getGame().then(res => {
  76. // console.log(res, 'res');
  77. this.gameList = res.data.data
  78. console.log(this.gameList, 'resssss');
  79. res.data.data.forEach(e => {
  80. // this.end_time =
  81. var end = e.add_time.split(' ')
  82. e.add_time = end[1]
  83. })
  84. })
  85. },
  86. methods: {
  87. goGame(e, index) {
  88. console.log(e, '点击跳转');
  89. uni.navigateTo({
  90. url: './gameDetail?id=' + e + '&index=' + index
  91. })
  92. }
  93. },
  94. };
  95. </script>
  96. <style lang="scss">
  97. .center {
  98. width: 750rpx;
  99. padding: 0;
  100. margin: 20rpx;
  101. }
  102. .game-box {
  103. position: relative;
  104. // margin: 10rpx;
  105. width: 690rpx;
  106. height: 280rpx;
  107. image {
  108. width: 100%;
  109. height: 100%;
  110. }
  111. .box-title {
  112. position: absolute;
  113. z-index: 99;
  114. top: 40rpx;
  115. left: 60rpx;
  116. display: flex;
  117. font-size: 43rpx;
  118. font-family: zihun100hao-fangfangxianfengti;
  119. font-weight: 500;
  120. color: #29554E;
  121. }
  122. .box-titlee {
  123. position: absolute;
  124. z-index: 99;
  125. top: 110rpx;
  126. left: 200rpx;
  127. display: flex;
  128. color: #FFFFFF;
  129. border: 1rpx solid #f36062;
  130. background: #f36062;
  131. border-radius: 10rpx;
  132. padding: 0 10rpx;
  133. font-size: 32rpx;
  134. font-family: zihun100hao-fangfangxianfengti;
  135. font-weight: 500;
  136. }
  137. }
  138. .game-box-content {
  139. top: 180rpx;
  140. left: 60rpx;
  141. line-height: 55rpx;
  142. position: absolute;
  143. font-size: 32rpx;
  144. font-weight: 500;
  145. color: #28554E;
  146. padding-left: 20rpx;
  147. width: 380rpx;
  148. height: 55rpx;
  149. background: #FFFFFF;
  150. border-radius: 27rpx;
  151. align-items: center;
  152. .game-box-content1 {
  153. align-items: center;
  154. position: absolute;
  155. right: 0;
  156. top: 0;
  157. line-height: 55rpx;
  158. text-align: center;
  159. width: 220rpx;
  160. height: 55rpx;
  161. background: #29554E;
  162. border-radius: 27rpx;
  163. font-size: 32rpx;
  164. font-weight: 500;
  165. color: #FFFFFF;
  166. }
  167. }
  168. // .kong {
  169. // height: 100vh;
  170. // width: 750rpx;
  171. // }
  172. </style>