game.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  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. 怪兽名称:{{item.name}}
  7. </view>
  8. <image :src="'../../static/img/game0'+(index%5+1)+'.png'" mode=""></image>
  9. <view class="game-box-content">开打时间
  10. <view class="game-box-content1">
  11. 每天{{item.add_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. res.data.data.forEach(e=>{
  76. // this.end_time =
  77. var end = e.add_time.split(' ')
  78. e.add_time = end[1]
  79. })
  80. })
  81. },
  82. methods: {
  83. goGame(e,index) {
  84. console.log(e, '点击跳转');
  85. uni.navigateTo({
  86. url: './gameDetail?id=' + e+'&index='+index
  87. })
  88. }
  89. },
  90. };
  91. </script>
  92. <style lang="scss">
  93. .center {
  94. width: 750rpx;
  95. padding: 0;
  96. margin: 20rpx;
  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. .box-title{
  108. font-family:Cursive;
  109. font-weight: 500;
  110. position: absolute;
  111. z-index: 99;
  112. top: 120rpx;
  113. left: 60rpx;
  114. display: flex;
  115. color: #FFFFFF;
  116. font-size: 40rpx;
  117. font-weight: 500;
  118. }
  119. }
  120. .game-box-content {
  121. top: 200rpx;
  122. left: 60rpx;
  123. line-height: 45rpx;
  124. position: absolute;
  125. font-size: 30rpx;
  126. font-weight: 500;
  127. color: #8F6AFD;
  128. padding-left: 20rpx;
  129. width: 340rpx;
  130. height: 45rpx;
  131. background: #FFFFFF;
  132. border-radius: 27rpx;
  133. align-items: center;
  134. .game-box-content1 {
  135. align-items: center;
  136. position: absolute;
  137. right: 0;
  138. top: 0;
  139. line-height: 45rpx;
  140. text-align: center;
  141. width: 200rpx;
  142. height: 45rpx;
  143. background: #754AF0;
  144. border-radius: 27rpx;
  145. font-size: 30rpx;
  146. font-weight: 500;
  147. color: #FFFFFF;
  148. }
  149. }
  150. // .kong {
  151. // height: 100vh;
  152. // width: 750rpx;
  153. // }
  154. </style>