mediaList.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. <template>
  2. <view>
  3. <view class="list-cell" hover-class="uni-list-cell-hover" @click="bindClick">
  4. <view class="media-list" v-if="options.title">
  5. <view :class="{'media-image-right': options.article_type === 2, 'media-image-left': options.article_type === 1}">
  6. <text class="media-title" :class="{'media-title2': options.article_type === 1 || options.article_type === 2}">{{options.title}}</text>
  7. <view v-if="options.image_list || options.image_url" class="image-section" :class="{'image-section-right': options.article_type === 2, 'image-section-left': options.article_type === 1}">
  8. <image class="image-list1" :class="{'image-list2': options.article_type === 1 || options.article_type === 2}"
  9. v-if="options.image_url" :src="options.image_url"></image>
  10. <image class="image-list3" v-if="options.image_list" :src="source.url" v-for="(source, i) in options.image_list"
  11. :key="i" />
  12. </view>
  13. </view>
  14. <view class="media-foot">
  15. <view class="media-info">
  16. <text class="info-text">{{options.source}}</text>
  17. <text class="info-text">{{options.comment_count}}条评论</text>
  18. <text class="info-text">{{options.datetime}}</text>
  19. </view>
  20. <view class="max-close-view" @click.stop="close">
  21. <view class="close-view"><text class="close">×</text></view>
  22. </view>
  23. </view>
  24. </view>
  25. </view>
  26. </view>
  27. </template>
  28. <script>
  29. export default {
  30. props: {
  31. options: {
  32. type: Object,
  33. default: function(e) {
  34. return {}
  35. }
  36. }
  37. },
  38. methods: {
  39. close(e) {
  40. this.$emit('close');
  41. },
  42. bindClick() {
  43. this.$emit('click');
  44. }
  45. }
  46. }
  47. </script>
  48. <style>
  49. view {
  50. display: flex;
  51. flex-direction: column;
  52. box-sizing: border-box;
  53. }
  54. .list-cell {
  55. width: 750upx;
  56. padding: 0 30upx;
  57. }
  58. .uni-list-cell-hover {
  59. background-color: #eeeeee;
  60. }
  61. .media-list {
  62. flex: 1;
  63. flex-direction: column;
  64. border-bottom-width: 1upx;
  65. border-bottom-style: solid;
  66. border-bottom-color: #c8c7cc;
  67. padding: 20upx 0;
  68. }
  69. .media-image-right {
  70. flex-direction: row;
  71. }
  72. .media-image-left {
  73. flex-direction: row-reverse;
  74. }
  75. .media-title {
  76. flex: 1;
  77. }
  78. .media-title {
  79. lines: 3;
  80. text-overflow: ellipsis;
  81. font-size: 32upx;
  82. color: #555555;
  83. }
  84. .media-title2 {
  85. flex: 1;
  86. margin-top: 6upx;
  87. line-height: 40upx;
  88. }
  89. .image-section {
  90. margin-top: 20upx;
  91. flex-direction: row;
  92. justify-content: space-between;
  93. }
  94. .image-section-right {
  95. margin-top: 0upx;
  96. margin-left: 10upx;
  97. width: 225upx;
  98. height: 146upx;
  99. }
  100. .image-section-left {
  101. margin-top: 0upx;
  102. margin-right: 10upx;
  103. width: 225upx;
  104. height: 146upx;
  105. }
  106. .image-list1 {
  107. width: 690upx;
  108. height: 481upx;
  109. }
  110. .image-list2 {
  111. width: 225upx;
  112. height: 146upx;
  113. }
  114. .image-list3 {
  115. width: 225upx;
  116. height: 146upx;
  117. }
  118. .media-info {
  119. flex-direction: row;
  120. }
  121. .info-text {
  122. margin-right: 20upx;
  123. color: #999999;
  124. font-size: 24upx;
  125. }
  126. .media-foot {
  127. margin-top: 20upx;
  128. flex-direction: row;
  129. justify-content: space-between;
  130. }
  131. .max-close-view {
  132. align-items: center;
  133. justify-content: flex-end;
  134. flex-direction: row;
  135. height: 40upx;
  136. width: 80upx;
  137. }
  138. .close-view {
  139. border-style: solid;
  140. border-width: 1px;
  141. border-color: #999999;
  142. border-radius: 10upx;
  143. justify-content: center;
  144. height: 30upx;
  145. width: 40upx;
  146. line-height: 30upx;
  147. }
  148. .close {
  149. text-align: center;
  150. color: #999999;
  151. font-size: 28upx;
  152. }
  153. </style>