index --lod.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. <template>
  2. <view class="container">
  3. <image class="headImg" mode="aspectFill" :src="$fileUrl() + '/homeHead.jpeg'"></image>
  4. <view class="headBarrage"></view>
  5. <view class="tabs">
  6. <view class="tab">
  7. <image :src="$fileUrl() + '/Frame3.png'" alt="" />
  8. <span>全部</span>
  9. </view>
  10. <view class="tab" @click="$navigateTo('/pages/excellentValue/excellentValue')">
  11. <image :src="$fileUrl() + '/Frame4.png'" alt="" />
  12. <span>超值挑战</span>
  13. </view>
  14. <view class="tab">
  15. <image :src="$fileUrl() + '/Frame2.png'" alt="" />
  16. <span>拍卖专区</span>
  17. </view>
  18. <view class="tab">
  19. <image :src="$fileUrl() + '/Frame1.png'" alt="" />
  20. <span>VIP福利</span>
  21. </view>
  22. </view>
  23. <view class="buttons">
  24. <view class="left">
  25. <image :src="$fileUrl() + '/button3.png'" @click="toInvite"></image>
  26. </view>
  27. <view class="right">
  28. <image :src="$fileUrl() + '/button1.png'"></image>
  29. <image :src="$fileUrl() + '/button2.png'" @click="$navigateTo('/pages/raffle/raffle')" />
  30. </view>
  31. </view>
  32. <view class="list-title">- 热门推荐 -</view>
  33. <view class="list">
  34. <view class="ka" v-for="(item, index) in kaList">
  35. <view class="top">
  36. <image mode="aspectFit" :src="$fileUrl() + '/ka.jpeg'"></image>
  37. </view>
  38. <view class="ka-info">
  39. <view class="ka-name">宝可梦简中原盒拆拆乐</view>
  40. <view class="row">
  41. <uni-tag text="创意热销" inverted type="default"></uni-tag>
  42. <view class="money">¥9.9</view>
  43. </view>
  44. </view>
  45. </view>
  46. </view>
  47. </view>
  48. </template>
  49. <script>
  50. import { messageListApi } from '@/api/common.js'
  51. export default {
  52. data() {
  53. return {
  54. kaList: 6,
  55. messageList: [],
  56. barrageData: [],
  57. barrageIndex: 0,
  58. timeOut: null,
  59. }
  60. },
  61. onLoad(query) {
  62. if (query.inviteId) {
  63. getApp().globalData.inviteId = query.inviteId
  64. } else {
  65. const scene = decodeURIComponent(query.scene)
  66. let inviteId = scene.split('=')[1]
  67. console.log(inviteId, 'inviteId')
  68. getApp().globalData.inviteId = inviteId
  69. }
  70. },
  71. onShow() {
  72. this.getMessage()
  73. },
  74. methods: {
  75. getMessage() {
  76. let params = {
  77. limit: 20,
  78. page: 1,
  79. }
  80. messageListApi(params).then(res => {
  81. this.messageList = res.data.list
  82. this.initBarrage()
  83. })
  84. },
  85. // 初始化弹幕
  86. initBarrage() {},
  87. toInvite() {
  88. wx.navigateTo({
  89. url: '/pages/invite/invite',
  90. })
  91. },
  92. },
  93. }
  94. </script>
  95. <style scoped lang="scss">
  96. .container {
  97. /* padding: 20px; */
  98. font-size: 14px;
  99. line-height: 24px;
  100. }
  101. .headImg {
  102. height: 180px;
  103. width: 100%;
  104. }
  105. .headBarrage {
  106. height: 180px;
  107. width: 100%;
  108. position: absolute;
  109. top: 0;
  110. }
  111. .tabs {
  112. display: flex;
  113. justify-content: space-around;
  114. margin-top: 10px;
  115. > .tab {
  116. width: 20%;
  117. display: flex;
  118. flex-direction: column;
  119. justify-content: center;
  120. align-items: center;
  121. > image {
  122. width: 40px;
  123. height: 40px;
  124. }
  125. }
  126. }
  127. .buttons {
  128. margin-top: 5px;
  129. padding: 10px;
  130. display: flex;
  131. justify-content: space-between;
  132. > .left {
  133. width: calc(50vw - 15px);
  134. height: 40vw;
  135. image {
  136. width: 100%;
  137. height: 100%;
  138. }
  139. }
  140. > .right {
  141. width: calc(50vw - 15px);
  142. height: 40vw;
  143. display: flex;
  144. flex-direction: column;
  145. justify-content: space-between;
  146. align-items: center;
  147. image {
  148. width: 100%;
  149. height: calc(50% - 5px);
  150. }
  151. }
  152. }
  153. .list-title {
  154. font-size: 16px;
  155. font-weight: 600;
  156. text-align: center;
  157. padding: 10px;
  158. }
  159. .list {
  160. display: grid;
  161. grid-template-columns: 1fr 1fr;
  162. grid-gap: 10px;
  163. padding: 10px;
  164. .ka {
  165. width: calc(50vw - 15px);
  166. box-shadow: 0px 2px 8px 2px rgba(0, 0, 0, 0.1);
  167. border-radius: 10px;
  168. // height: 60vw;
  169. .top {
  170. // height: 60vw;
  171. background: linear-gradient(180deg, #faf1a7 0%, #ffe456 100%);
  172. text-align: center;
  173. display: flex;
  174. justify-content: center;
  175. image {
  176. width: 35vw;
  177. height: 50vw;
  178. }
  179. }
  180. .ka-info {
  181. padding: 10px;
  182. .ka-name {
  183. font-size: 15px;
  184. font-weight: 600;
  185. }
  186. .row {
  187. margin-top: 5px;
  188. display: flex;
  189. justify-content: space-between;
  190. .money {
  191. font-size: 16px;
  192. font-weight: 600;
  193. color: #ff2c43;
  194. }
  195. }
  196. }
  197. }
  198. }
  199. .bullet {
  200. height: 30px;
  201. line-height: 30px;
  202. padding: 0 10px;
  203. border-radius: 15px;
  204. background-color: rgba(0, 0, 0, 0.3);
  205. color: #fff;
  206. }
  207. </style>