article-min-card.vue 3.5 KB

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