card-cover-detail.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. <template>
  2. <div class="card-cover-detail">
  3. <div class="cover-box">
  4. <img class="cover" :src="info.cover" alt="" v-if="is_normal" />
  5. <div class="is_normal" v-else>
  6. <img src="@/assets/icon/lapse.png" alt="" />
  7. </div>
  8. <div class="type">{{ is_normal ? type : "已失效" }}</div>
  9. </div>
  10. <div class="info-box" v-if="is_normal">
  11. <div class="title-box">
  12. <div class="series-title">{{ info.series_title }}</div>
  13. <div class="title">{{ info.title }}</div>
  14. </div>
  15. <div class="footer">
  16. <img class="app-logo" :src="info.app_logo" alt="" />
  17. <div class="app-name">{{ info.app_name }}</div>
  18. <img class="icon" src="@/assets/icon/play.png" />
  19. <div class="read-num">{{ info.read_num || 0 }}</div>
  20. </div>
  21. </div>
  22. <div class="info-box" v-else>
  23. <div class="is_normal">已失效</div>
  24. </div>
  25. </div>
  26. </template>
  27. <script>
  28. export default {
  29. name: "CardCoverDetail",
  30. props: {
  31. info: {
  32. type: Object,
  33. },
  34. },
  35. data() {
  36. return {
  37. show: false,
  38. typeDict: {
  39. article_id: "图文",
  40. video_id: "视频",
  41. },
  42. };
  43. },
  44. computed: {
  45. type() {
  46. let typeKey = "";
  47. for (let key in this.typeDict) {
  48. if (Reflect.has(this.info, key)) {
  49. typeKey = key;
  50. }
  51. }
  52. if (typeKey == "video_id") {
  53. const time = this.info.duration;
  54. let m = Math.floor(time / 60),
  55. s = Math.floor(time - m * 60);
  56. s == 0 ? (s = 1) : "";
  57. return (
  58. m.toString().padStart(2, "0") + ":" + s.toString().padStart(2, "0")
  59. );
  60. } else {
  61. return this.typeDict[typeKey];
  62. }
  63. },
  64. is_normal() {
  65. return Reflect.has(this.info, "is_normal") ? !!this.info.is_normal : true;
  66. },
  67. },
  68. };
  69. </script>
  70. <style lang="scss" scoped>
  71. .card-cover-detail {
  72. width: 100%;
  73. display: flex;
  74. align-items: center;
  75. cursor: default;
  76. .cover-box {
  77. width: 200px;
  78. height: 120px;
  79. position: relative;
  80. .cover {
  81. width: 100%;
  82. height: 100%;
  83. object-fit: cover;
  84. }
  85. .is_normal {
  86. width: 100%;
  87. height: 100%;
  88. background: #d8d8d8;
  89. display: flex;
  90. align-items: center;
  91. justify-content: center;
  92. img {
  93. width: 20px;
  94. height: 20px;
  95. }
  96. }
  97. .type {
  98. padding: 0 3px;
  99. height: 18px;
  100. font-size: 12px;
  101. font-weight: 400;
  102. color: #ffffff;
  103. line-height: 18px;
  104. text-align: center;
  105. background: rgba(0, 0, 0, 0.7);
  106. border-radius: 2px;
  107. position: absolute;
  108. bottom: 10px;
  109. right: 10px;
  110. }
  111. }
  112. .info-box {
  113. width: calc(100% -140px);
  114. height: 114px;
  115. margin-left: 15px;
  116. display: flex;
  117. flex-direction: column;
  118. justify-content: space-between;
  119. padding: 3px 0;
  120. .is_normal {
  121. width: 100%;
  122. height: 100%;
  123. text-align: center;
  124. line-height: 114px;
  125. color: #999999;
  126. font-size: 14px;
  127. }
  128. .title-box {
  129. width: 100%;
  130. height: 114px;
  131. .series-title {
  132. max-width: 500px;
  133. height: 25px;
  134. line-height: 25px;
  135. width: 100%;
  136. font-size: 16px;
  137. font-weight: 400;
  138. color: #222222;
  139. text-overflow: ellipsis;
  140. overflow: hidden;
  141. white-space: nowrap;
  142. }
  143. .title {
  144. width: 100%;
  145. max-width: 500px;
  146. font-size: 16px;
  147. font-weight: 400;
  148. color: #222222;
  149. }
  150. }
  151. .footer {
  152. display: flex;
  153. align-items: center;
  154. .app-logo {
  155. width: 16px;
  156. height: 16px;
  157. border-radius: 50%;
  158. }
  159. .app-name {
  160. font-size: 12px;
  161. font-weight: 400;
  162. color: #666666;
  163. margin-left: 5px;
  164. }
  165. .icon {
  166. height: 14px;
  167. width: 14px;
  168. margin-left: 10px;
  169. }
  170. .read-num {
  171. font-size: 12px;
  172. font-weight: 400;
  173. color: #999999;
  174. margin-left: 3px;
  175. }
  176. }
  177. }
  178. }
  179. </style>