index.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. <script setup lang="ts">
  2. import Tabbar from '../components/tabbar.vue'
  3. import router from '@/router'
  4. definePage({
  5. name: 'film-index',
  6. islogin: false,
  7. style: {
  8. navigationBarTitleText: '电影演出',
  9. backgroundColorBottom: '#fff',
  10. },
  11. })
  12. const hotList = ref<Api.filmMovieList>([
  13. ])
  14. const comingSoonList = ref<Api.filmMovieList>([
  15. ])
  16. function jump(active: any) {
  17. router.push({ name: 'film-movie', params: { active } })
  18. }
  19. function handleBuy(item: Api.filmMovieList) {
  20. console.log('goumai')
  21. router.push({ name: 'film-movie-detail', params: { id: item.id as string, movieId: item.movieId as string } })
  22. }
  23. async function getList(showSt: number) {
  24. uni.showLoading({ title: '加载中' })
  25. const res = await Apis.film.getMovieList({ data: { showSt, pageNum: 1, pageSize: 8 } })
  26. console.log(res, '请求')
  27. if (!res.data) {
  28. useGlobalToast().show('暂无该商品查看权限!')
  29. }
  30. if (showSt === 1) {
  31. hotList.value = res.data?.records
  32. }
  33. else {
  34. comingSoonList.value = res.data?.records
  35. }
  36. uni.hideLoading()
  37. }
  38. getList(1)
  39. getList(2)
  40. onMounted(() => {
  41. })
  42. </script>
  43. <template>
  44. <view class="film-page px-24rpx pb-300rpx pt-20rpx">
  45. <view class="mb-20rpx rounded-16rpx bg-[#fff] px-24rpx pt-24rpx">
  46. <view class="flex justify-between">
  47. <view class="text-[#222] font-bold">
  48. 热映电影
  49. </view>
  50. <view class="flex items-center text-center text-24rpx text-[#AAAAAA]" @click="jump(0)">
  51. 查看全部
  52. <wd-icon name="chevron-right" size="24rpx" color="#AAA" />
  53. </view>
  54. </view>
  55. <view class="p-0r gap-y-10r grid grid-cols-4 w-full gap-x-20rpx">
  56. <view
  57. v-for="(item, index) in hotList" :key="index" class="item relative aspect-square w-152rpx"
  58. @click="handleBuy(item)"
  59. >
  60. <view class="tag absolute rounded-8rpx bg-[rgba(34,34,34,0.7)] px-10rpx text-18rpx text-[#fff] leading-26rpx">
  61. {{ item.version }}
  62. </view>
  63. <image class="h-208rpx w-152rpx rounded-16rpx" :src="item.posterUrl" />
  64. <view class="w-full overflow-hidden text-ellipsis whitespace-nowrap text-center text-24rpx">
  65. {{ item.name }}
  66. </view>
  67. <view class="btn" @click.stop="handleBuy(item)">
  68. 购票
  69. </view>
  70. </view>
  71. </view>
  72. </view>
  73. <view class="mb-20rpx rounded-16rpx bg-[#fff] px-24rpx pt-24rpx">
  74. <view class="flex justify-between">
  75. <view class="text-[#222] font-bold">
  76. 即将上映
  77. </view>
  78. <view class="flex items-center text-center text-24rpx text-[#AAAAAA]" @click="jump(2)">
  79. 查看全部
  80. <wd-icon name="chevron-right" size="24rpx" color="#AAA" />
  81. </view>
  82. </view>
  83. <view class="gap-y-10r p-0r grid grid-cols-4 w-full gap-x-20rpx">
  84. <view
  85. v-for="(item, index) in comingSoonList" :key="index" class="item relative aspect-square w-152rpx"
  86. @click="handleBuy(item)"
  87. >
  88. <view class="tag absolute rounded-8rpx bg-[rgba(34,34,34,0.7)] px-10rpx text-18rpx text-[#fff] leading-26rpx">
  89. {{ item.version }}
  90. </view>
  91. <image class="h-208rpx w-152rpx rounded-16rpx" :src="item.posterUrl" />
  92. <view class="w-full overflow-hidden text-ellipsis whitespace-nowrap text-center text-24rpx">
  93. {{ item.name }}
  94. </view>
  95. <!-- <view class="btn" @click.stop="handleBuy(item)">
  96. 购票
  97. </view> -->
  98. </view>
  99. </view>
  100. </view>
  101. <Tabbar :active="0" />
  102. </view>
  103. </template>
  104. <style lang="scss" scoped>
  105. .film-page {
  106. .item {
  107. padding-bottom: 24rpx;
  108. margin-top: 26rpx;
  109. .tag {
  110. top: 4rpx;
  111. right: 10rpx;
  112. background: rgba(34, 34, 34, 0.7);
  113. text-align: center;
  114. font-size: 18rpx;
  115. }
  116. .btn {
  117. width: 96rpx;
  118. height: 44rpx;
  119. line-height: 44rpx;
  120. text-align: center;
  121. background: #9ED605;
  122. border-radius: 26rpx 26rpx 26rpx 26rpx;
  123. font-size: 28rpx;
  124. color: #FFFFFF;
  125. margin: 16rpx auto 0;
  126. }
  127. }
  128. }
  129. </style>