index.vue 4.2 KB

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