index.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  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 main-left">
  36. <episode
  37. v-for="(episode,episodeIndex) in item.episodes"
  38. :key="episodeIndex"
  39. :episode="episode"
  40. :custom-style="{
  41. marginRight: ((index+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. }
  86. </script>
  87. <style lang="scss" scoped>
  88. .trace-container {
  89. padding: 20rpx 0;
  90. font-size: 30rpx;
  91. color: $default-color;
  92. .status-box{
  93. margin-top: 10rpx;
  94. color: $info-color;
  95. font-size: 28rpx;
  96. .status{
  97. color: $primary-color;
  98. margin-right: 14rpx;
  99. }
  100. }
  101. .collect-container{
  102. background: #1B203C;
  103. border-radius: 30rpx;
  104. padding: 20rpx;
  105. width: 710rpx;
  106. margin: 0 auto;
  107. .header{
  108. text{
  109. color: $primary-color;
  110. font-size: 38rpx;
  111. font-weight: 800;
  112. }
  113. .more{
  114. color: $info-color;
  115. }
  116. }
  117. .content{
  118. margin-top: 20rpx;
  119. .collect-item{
  120. .cover-image{
  121. image{
  122. width: 200rpx;
  123. height: 280rpx;
  124. }
  125. }
  126. .name{
  127. margin-top: 10rpx;
  128. }
  129. }
  130. }
  131. }
  132. .title{
  133. color: $primary-color;
  134. font-size: 38rpx;
  135. font-weight: 800;
  136. padding: 0 20rpx;
  137. margin: 40rpx 0 30rpx;
  138. }
  139. .category{
  140. margin-bottom: 30rpx;
  141. .name{
  142. background: #284150;
  143. writing-mode: vertical-lr;
  144. padding: 0 20rpx;
  145. border-top-right-radius: 30rpx;
  146. border-bottom-right-radius: 30rpx;
  147. text-align: center;
  148. }
  149. .episode-box{
  150. margin-left: 20rpx;
  151. }
  152. }
  153. }
  154. </style>