mediaList.nvue 4.3 KB

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