game.vue 3.6 KB

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