index.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. <template>
  2. <view class="episode" :style="[customStyle]" @click="handlePlay">
  3. <view class="cover-image" :style="[imageStyle]">
  4. <view v-if="rank" class="rank" :class="{first: rank === 1}">
  5. <text>{{ rank }}</text>
  6. </view>
  7. <image :src="episode.cover_img" mode="aspectFill" :style="[imageStyle]" />
  8. <view v-if="recent" class="special">最近播放 </view>
  9. <view v-if="guess" class="special guess">猜你喜欢 </view>
  10. </view>
  11. <u-text
  12. :text="episode.name"
  13. :lines="1"
  14. size="32rpx"
  15. margin="20rpx 0 10rpx"
  16. :color="$colors.defaultColor"
  17. />
  18. <view class="status-box dir-left-nowrap">
  19. <u-text
  20. :text="episode.status_text"
  21. :lines="1"
  22. size="24rpx"
  23. :custom-style="{flex: 'unset'}"
  24. :color="$colors.primaryColor"
  25. />
  26. <u-text
  27. :text="`共${episode.total}集`"
  28. :lines="1"
  29. size="24rpx"
  30. margin="0 0 0 10rpx"
  31. :color="$colors.infoColor"
  32. />
  33. </view>
  34. </view></template>
  35. <script>
  36. import UText from '../../uni_modules/uview-ui/components/u--text/u--text'
  37. export default {
  38. name: 'Episode',
  39. components: { UText },
  40. props: {
  41. episode: {
  42. type: Object,
  43. required: true
  44. },
  45. customStyle: {
  46. type: Object,
  47. default() {
  48. return {}
  49. }
  50. },
  51. imageStyle: {
  52. type: Object,
  53. default() {
  54. return {}
  55. }
  56. },
  57. recent: {
  58. type: Boolean,
  59. default: false
  60. },
  61. guess: {
  62. type: Boolean,
  63. default: false
  64. },
  65. rank: {
  66. type: Number,
  67. default: 0
  68. },
  69. redirect: {
  70. type: Boolean,
  71. default: true
  72. }
  73. },
  74. data() {
  75. return {}
  76. },
  77. computed: {},
  78. methods: {
  79. handlePlay() {
  80. if (!this.redirect) return
  81. this.$u.route({
  82. url: '/pages/episode/play',
  83. params: {
  84. id: this.episode.id
  85. }
  86. })
  87. }
  88. }
  89. }
  90. </script>
  91. <style lang="scss" scoped>
  92. .episode {
  93. width: calc((#{750rpx} - #{80rpx}) / 3);
  94. margin-bottom: 30rpx;
  95. .cover-image{
  96. position: relative;
  97. overflow: hidden;
  98. height: 330rpx;
  99. image{
  100. width: 100%;
  101. height: inherit;
  102. }
  103. .special{
  104. background: rgba(48, 98, 97, 0.65);
  105. text-align: center;
  106. color: #fff;
  107. padding: 10rpx 0;
  108. position: absolute;
  109. bottom: 0;
  110. width: 100%;
  111. font-size: 26rpx;
  112. &.guess{
  113. background: rgba(124, 78, 112, 0.65);
  114. }
  115. }
  116. .rank{
  117. position: absolute;
  118. top: -35rpx;
  119. left: -35rpx;
  120. width: 70rpx;
  121. height: 70rpx;
  122. transform: rotate(45deg);
  123. background: rgba(251, 54, 81, 0.6);
  124. color: #fff;
  125. font-size: 26rpx;
  126. z-index: 99;
  127. &.first{
  128. background: #FE3552;
  129. }
  130. text{
  131. position: absolute;
  132. right: 5px;
  133. top: 10px;
  134. transform: rotate(-45deg);
  135. }
  136. }
  137. }
  138. .status-box{
  139. }
  140. }
  141. </style>