1
0

article-min-card.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. <template>
  2. <view class="article-min-card" @click="fnClickEvent('card')">
  3. <view class="left">
  4. <cache-image class="thumbnail" radius="6rpx" :url="$utils.checkThumbnailUrl(article.spec.cover)" :fileMd5="article.spec.cover"
  5. mode="aspectFill"></cache-image>
  6. </view>
  7. <view class="right">
  8. <view class="title text-overflow">{{ article.spec.title }}</view>
  9. <view class="content text-overflow">{{ article.status.excerpt }}</view>
  10. <view class="foot">
  11. <view class="create-time">
  12. <text class="time-label">发布时间:</text>
  13. {{ {d: article.spec.publishTime, f: 'yyyy-MM-dd'} | formatTime }}
  14. </view>
  15. <view class="visits">
  16. 浏览
  17. <text class="number">{{ article.stats.visit }}</text>
  18. </view>
  19. </view>
  20. </view>
  21. </view>
  22. </template>
  23. <script>
  24. export default {
  25. name: 'article-min-card',
  26. props: {
  27. article: {
  28. type: Object,
  29. default: () => {
  30. }
  31. }
  32. },
  33. methods: {
  34. fnClickEvent() {
  35. this.$emit('on-click', this.article);
  36. }
  37. }
  38. };
  39. </script>
  40. <style scoped lang="scss">
  41. .article-min-card {
  42. display: flex;
  43. box-sizing: border-box;
  44. border-radius: 12rpx;
  45. background-color: #ffff;
  46. overflow: hidden;
  47. margin: 12rpx 24rpx;
  48. margin-bottom: 24rpx;
  49. padding: 16rpx;
  50. box-shadow: 0rpx 2rpx 24rpx rgba(0, 0, 0, 0.03);
  51. &.lr_image_text {
  52. }
  53. &.lr_text_image {
  54. .left {
  55. order: 2;
  56. padding-left: 30rpx;
  57. }
  58. .right {
  59. order: 1;
  60. padding-left: 0;
  61. }
  62. }
  63. &.tb_image_text {
  64. flex-direction: column;
  65. .left {
  66. width: 100%;
  67. height: 220rpx;
  68. }
  69. .right {
  70. padding-left: 0;
  71. width: 100%;
  72. .title {
  73. margin-top: 24rpx;
  74. }
  75. .foot {
  76. justify-content: flex-start;
  77. .create-time {
  78. .time-label {
  79. display: inline-block;
  80. }
  81. }
  82. .visits {
  83. margin-left: 24rpx;
  84. }
  85. }
  86. }
  87. }
  88. &.tb_text_image {
  89. flex-direction: column;
  90. .left {
  91. width: 100%;
  92. height: 220rpx;
  93. order: 2;
  94. margin-top: 20rpx;
  95. }
  96. .right {
  97. padding-left: 0;
  98. width: 100%;
  99. order: 1;
  100. .foot {
  101. justify-content: flex-start;
  102. .create-time {
  103. .time-label {
  104. display: inline-block;
  105. }
  106. }
  107. .visits {
  108. margin-left: 24rpx;
  109. }
  110. }
  111. }
  112. }
  113. &.only_text {
  114. .left {
  115. display: none;
  116. }
  117. .right {
  118. padding-left: 0;
  119. .foot {
  120. justify-content: flex-start;
  121. .create-time {
  122. .time-label {
  123. display: inline-block;
  124. }
  125. }
  126. .visits {
  127. margin-left: 24rpx;
  128. }
  129. }
  130. }
  131. }
  132. .left {
  133. width: 180rpx;
  134. height: 130rpx;
  135. .thumbnail {
  136. width: 100%;
  137. height: 100%;
  138. border-radius: 12rpx;
  139. }
  140. }
  141. .right {
  142. width: 0;
  143. flex-grow: 1;
  144. display: flex;
  145. flex-direction: column;
  146. padding-left: 20rpx;
  147. .title {
  148. font-size: 28rpx;
  149. font-weight: 600;
  150. color: var(--main-text-color);
  151. }
  152. .content {
  153. font-size: 26rpx;
  154. color: #909399;
  155. margin-top: 14rpx;
  156. }
  157. .foot {
  158. display: flex;
  159. font-size: 24rpx;
  160. justify-content: space-between;
  161. align-items: center;
  162. color: #909399;
  163. margin-top: 14rpx;
  164. .create-time {
  165. font-size: 24rpx;
  166. .time-label {
  167. display: none;
  168. }
  169. .icon {
  170. font-size: 24rpx;
  171. padding-right: 4rpx;
  172. }
  173. }
  174. .visits {
  175. .icon {
  176. font-size: 28rpx;
  177. }
  178. .number {
  179. padding: 0 6rpx;
  180. font-size: 24rpx;
  181. }
  182. }
  183. }
  184. }
  185. }
  186. </style>