ImageAlbumCard.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. <template>
  2. <el-col style="padding-right: 7px; padding-left: 7px">
  3. <div style="cursor: pointer">
  4. <el-card :body-style="{ padding: '0px' }" class="card">
  5. <router-link target="_blank" :to="`/image/album/${imageAlbum.albumId}`">
  6. <div class="imgs">
  7. <el-image
  8. lazy
  9. fit="cover"
  10. :src="imageAlbum.coverUrl"
  11. class="coverImg"
  12. />
  13. </div>
  14. </router-link>
  15. <div style="padding: 14px">
  16. <router-link target="_blank" :to="`/image/album/${imageAlbum.albumId}`">
  17. <span style="left: 0;margin-bottom: 0px;color: black;">{{ imageAlbum.albumName | ellipsis }}</span>
  18. </router-link>
  19. </div>
  20. <!-- <div style="padding: 14px">
  21. <span style="left: 0;margin-bottom: 0px;color: black;">
  22. <router-link target="_blank" :to="`/user/${imageAlbum.userId}`"><i class="el-icon-user"> {{ imageAlbum.username }} </i></router-link> · {{ imageAlbum.pubDate }}
  23. </span>
  24. </div>-->
  25. </el-card>
  26. </div>
  27. </el-col>
  28. </template>
  29. <script>
  30. import { handleVisited } from 'assets/js/utils'
  31. export default {
  32. name: 'ImageAlbumCard',
  33. filters: {
  34. ellipsis(value) {
  35. if (!value) return ''
  36. const max = 20
  37. if (value.length > max) {
  38. return value.slice(0, max) + '...'
  39. }
  40. return value
  41. }
  42. },
  43. props: {
  44. imageAlbum: {
  45. type: Object,
  46. default: null
  47. },
  48. // 时间前的描述
  49. dateTit: {
  50. type: String,
  51. default: ''
  52. }
  53. },
  54. methods: {
  55. getVisited(visited) {
  56. return handleVisited(visited)
  57. }
  58. }
  59. }
  60. </script>
  61. <style scoped>
  62. .time {
  63. font-size: 15px;
  64. color: #999;
  65. }
  66. .bottom {
  67. margin-top: 13px;
  68. line-height: 12px;
  69. }
  70. .tit {
  71. font-weight: 700;
  72. font-size: 18px;
  73. height: 50px;
  74. overflow: hidden;
  75. text-overflow: ellipsis;
  76. display: -webkit-box;
  77. -webkit-line-clamp: 2; /*行数*/
  78. -webkit-box-orient: vertical;
  79. }
  80. .num {
  81. position: relative;
  82. font-size: 15px;
  83. padding-top: 9px;
  84. }
  85. /*处于手机屏幕时*/
  86. @media screen and (max-width: 768px) {
  87. .tit {
  88. font-weight: 600;
  89. font-size: 12px;
  90. height: 32px;
  91. }
  92. .time {
  93. font-size: 10px;
  94. color: #999;
  95. }
  96. .num {
  97. font-size: 9px;
  98. padding-top: 3px;
  99. }
  100. .bottom {
  101. margin-top: 2px;
  102. line-height: 7px;
  103. }
  104. .coverImg {
  105. height: 120px !important;
  106. }
  107. }
  108. .coverImg {
  109. width: 100%;
  110. height: 175px;
  111. display: block;
  112. }
  113. .clearfix:before,
  114. .clearfix:after {
  115. display: table;
  116. content: "";
  117. }
  118. .clearfix:after {
  119. clear: both;
  120. }
  121. .card {
  122. margin-bottom: 20px;
  123. transition: all 0.6s; /*所有属性变化在0.6秒内执行动画*/
  124. }
  125. /*.card:hover {
  126. !*鼠标放上之后元素变成1.06倍大小*!
  127. transform: scale(1.06);
  128. }*/
  129. .imgs {
  130. position: relative;
  131. }
  132. .play-icon {
  133. position: absolute;
  134. /*top: -15px;*/
  135. right: 2%;
  136. bottom: 5px;
  137. z-index: 7;
  138. width: 40px;
  139. }
  140. </style>