index.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. <template>
  2. <view class="trace-container">
  3. <!--我的收藏-->
  4. <view class="collect-container">
  5. <view class="header main-between cross-center" @click="$u.route('/pages/trace/collect')">
  6. <text>我的收藏</text>
  7. <view class="more main-left cross-center">查看全部
  8. <u-icon name="arrow-right" />
  9. </view>
  10. </view>
  11. <!--剧集-->
  12. <view class="content main-left cross-center">
  13. <episode
  14. v-for="(item,index) in collect"
  15. :key="index"
  16. :episode="item.episode"
  17. :custom-style="{
  18. marginRight: ((index+1) % 4 !== 0 ? '10rpx' :''),
  19. width: ((710 - 60) / 4 )+'rpx' // 60为间隔 710为 collect-container宽度
  20. }"
  21. :image-style="{
  22. height: '200rpx'
  23. }"
  24. />
  25. </view>
  26. </view>
  27. <!--其他剧集-->
  28. <view class="title">其他剧集</view>
  29. <view
  30. v-for="(item,index) in category"
  31. :key="index"
  32. class="category main-left"
  33. >
  34. <view class="name">{{ item.name }}</view>
  35. <view class="episode-box dir-left-wrap">
  36. <episode
  37. v-for="(episode,episodeIndex) in item.episodes"
  38. :key="episodeIndex"
  39. :episode="episode"
  40. :custom-style="{
  41. marginRight: ((episodeIndex + 1) % 3 !== 0 ? '10rpx' :''),
  42. width: ((700 - 80) / 3 )+'rpx'
  43. }"
  44. :image-style="{
  45. height: '280rpx'
  46. }"
  47. />
  48. </view>
  49. </view>
  50. <!--tab bar-->
  51. <tab-bar />
  52. </view>
  53. </template>
  54. <script>
  55. import Episode from '../../components/Episode/index'
  56. import TabBar from '../../components/TabBar/index'
  57. export default {
  58. name: 'Trace',
  59. components: { TabBar, Episode },
  60. data() {
  61. return {
  62. collect: [],
  63. category: []
  64. }
  65. },
  66. computed: {},
  67. methods: {
  68. getCollect() {
  69. this.$api.user.collect.record({ limit: 4 }).then(res => {
  70. this.collect = res.data
  71. })
  72. },
  73. getTrace() {
  74. this.$loading()
  75. this.$api.episode.trace().then(res => {
  76. this.$hideLoading()
  77. this.category = res.data
  78. })
  79. }
  80. },
  81. onLoad() {
  82. this.getCollect()
  83. this.getTrace()
  84. },
  85. onShow() {
  86. this.getCollect()
  87. }
  88. }
  89. </script>
  90. <style lang="scss" scoped>
  91. .trace-container {
  92. padding: 20rpx 0 120rpx;
  93. font-size: 30rpx;
  94. color: $default-color;
  95. .status-box{
  96. margin-top: 10rpx;
  97. color: $info-color;
  98. font-size: 28rpx;
  99. .status{
  100. color: $primary-color;
  101. margin-right: 14rpx;
  102. }
  103. }
  104. .collect-container{
  105. background: #1B203C;
  106. border-radius: 30rpx;
  107. padding: 20rpx;
  108. width: 710rpx;
  109. margin: 0 auto;
  110. .header{
  111. text{
  112. color: $primary-color;
  113. font-size: 38rpx;
  114. font-weight: 800;
  115. }
  116. .more{
  117. color: $info-color;
  118. }
  119. }
  120. .content{
  121. margin-top: 20rpx;
  122. min-height: 200rpx;
  123. .collect-item{
  124. .cover-image{
  125. image{
  126. width: 200rpx;
  127. height: 280rpx;
  128. }
  129. }
  130. .name{
  131. margin-top: 10rpx;
  132. }
  133. }
  134. }
  135. }
  136. .title{
  137. color: $primary-color;
  138. font-size: 38rpx;
  139. font-weight: 800;
  140. padding: 0 20rpx;
  141. margin: 40rpx 0 30rpx;
  142. }
  143. .category{
  144. margin-bottom: 30rpx;
  145. .name{
  146. background: #284150;
  147. writing-mode: vertical-lr;
  148. padding: 0 20rpx;
  149. border-top-right-radius: 30rpx;
  150. border-bottom-right-radius: 30rpx;
  151. text-align: center;
  152. min-height: 400rpx;
  153. }
  154. .episode-box{
  155. margin-left: 20rpx;
  156. }
  157. }
  158. }
  159. </style>