article-min-card.vue 3.4 KB

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