index.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. <template>
  2. <view class="movieList">
  3. <view class="title">{{title}}</view>
  4. <view class="list" v-for="(item,index) in list" :key="index" @click="goToDetail(item)">
  5. <view class="list-left">
  6. <image :src="item.pic.normal" mode=""></image>
  7. </view>
  8. <view class="list-right">
  9. <view class="list-desc">
  10. <view class="list-title">
  11. <view class="tips">
  12. {{item.title}}
  13. </view>
  14. <van-rate color="#ffd21e" void-color='#c7c7c7' class="rate" :value="item.rating.star_count" />
  15. <text>{{item.rating.value}}</text>
  16. </view>
  17. <view class="list-icon">
  18. <image :src="imgUrl" mode=""></image>
  19. </view>
  20. </view>
  21. <view class="list-main">
  22. <descVue :val="item.comment" />
  23. </view>
  24. </view>
  25. </view>
  26. </view>
  27. </template>
  28. <script>
  29. import {
  30. Domestic,
  31. Variety,
  32. American
  33. } from '../../api/list.js';
  34. import descVue from '../../components/desc.vue';
  35. export default {
  36. data() {
  37. return {
  38. imgUrl: '/static/xiangkan.png',
  39. interfaceName: "",
  40. ids: "",
  41. list: [],
  42. title: '',
  43. startNum: 0,
  44. countNum: 8,
  45. totalNum: 0
  46. }
  47. },
  48. components:{
  49. descVue
  50. },
  51. onLoad(options) {
  52. this.ids = options.ids;
  53. console.log(options.ids, 'options')
  54. },
  55. onShow() {
  56. this.init();
  57. },
  58. onReachBottom() {
  59. console.log(("打印"))
  60. if (this.startNum < this.totalNum) {
  61. this.startNum += 8;
  62. this.getList();
  63. }
  64. },
  65. methods: {
  66. init() {
  67. if (this.ids === 'tv_domestic') {
  68. this.interfaceName = Domestic;
  69. } else if (this.ids === 'tv_american') {
  70. this.interfaceName = American;
  71. } else if (this.ids === 'tv_variety_show') {
  72. this.interfaceName = Variety;
  73. }
  74. this.getList();
  75. },
  76. getList() {
  77. uni.showLoading({
  78. title: '加载中'
  79. });
  80. setTimeout(async () => {
  81. let res = await this.interfaceName({
  82. start: this.startNum,
  83. count: this.countNum
  84. });
  85. this.list = this.list.concat(res.subject_collection_items);
  86. console.log(this.list, 'res')
  87. this.title = res.subject_collection.name;
  88. this.totalNum = res.total;
  89. uni.hideLoading();
  90. }, 600);
  91. }
  92. }
  93. }
  94. </script>
  95. <style lang="scss">
  96. .title {
  97. font-size: 24rpx;
  98. margin: 20rpx 0 30rpx 0;
  99. }
  100. .list {
  101. width: 96%;
  102. height: auto;
  103. margin: 0 auto;
  104. display: flex;
  105. padding: 30rpx 0 50rpx;
  106. border-bottom: 1px solid #eee;
  107. .list-left {
  108. flex: 2;
  109. image {
  110. width: 160rpx;
  111. height: 230rpx;
  112. border-radius: 8rpx;
  113. }
  114. }
  115. .list-right {
  116. flex: 8;
  117. display: flex;
  118. flex-direction: column;
  119. margin-left: 30rpx;
  120. .list-desc {
  121. flex: 1;
  122. display: flex;
  123. .list-title {
  124. flex: 4;
  125. border-right: 1px dashed #ccc;
  126. padding: 10rpx;
  127. .tips {
  128. font-size: 44rpx;
  129. }
  130. ::v-deep .van-rate__icon {
  131. font-size: 20rpx;
  132. }
  133. text {
  134. margin-left: 10rpx;
  135. color: #7d7d7d;
  136. }
  137. }
  138. .list-icon {
  139. flex: 1;
  140. display: flex;
  141. align-items: center;
  142. justify-content: center;
  143. image {
  144. width: 50rpx;
  145. height: 50rpx;
  146. }
  147. }
  148. }
  149. .list-main {
  150. flex: 2;
  151. font-size: 25rpx;
  152. color: #7d7d7d;
  153. background: #f7f7f7;
  154. border-radius: 10rpx;
  155. padding: 10rpx;
  156. margin-top: 20rpx;
  157. }
  158. }
  159. }
  160. </style>