reportItem.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. <template>
  2. <view class="container-report-item" @click="goDetail(list)">
  3. <view class="item-title" v-if="list.Title">
  4. <mp-html :content="richTextClamp(3) + list.Title + '</div>'" />
  5. </view>
  6. <view class="item-image" v-if="list.BodyHtml">
  7. <image :src="list.BodyHtml"></image>
  8. </view>
  9. <view class="item-image" v-if="list.Cover">
  10. <image :src="list.Cover"></image>
  11. </view>
  12. <block v-if="(list.Annotation || list.Body[0]) && !list.Cover">
  13. <text class="item-content" v-if="!list.Body[0]">{{ list.ArticleResponse == 4 ? "核心观点" : "核心结论" }}:</text>
  14. <view class="item-rich-text">
  15. <mp-html :content="richTextClamp(7) + (list.Annotation || list.Body[0]) + '</div>'" />
  16. </view>
  17. </block>
  18. <view class="item-abstract text-Line" v-if="list.Abstract && list.ArticleResponse != 1"> 摘要:{{ list.Abstract }} </view>
  19. <view class="item-time">
  20. <text>{{ list.PublishDate }}</text>
  21. <view class="item-examine" v-if="list.IsResearch">
  22. <image src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/examine_icon.png"></image>
  23. <text>{{ list.Pv }}</text>
  24. </view>
  25. </view>
  26. </view>
  27. </template>
  28. <script>
  29. import mpHtml from "@/uni_modules/mp-html/components/mp-html/mp-html.vue";
  30. export default {
  31. name: "",
  32. components: { mpHtml },
  33. props: {
  34. list: {
  35. type: Object,
  36. default: {},
  37. required: true,
  38. },
  39. },
  40. data() {
  41. return {};
  42. },
  43. computed: {},
  44. watch: {},
  45. created() {},
  46. mounted() {},
  47. methods: {
  48. goDetail(item) {
  49. if (item.HomeType !== 1) {
  50. /* 无需授权且已绑定 检验是或否有权限 */
  51. uni.navigateTo({ url: "/pageMy/reportDetail/reportDetail?id=" + item.ArticleId });
  52. }
  53. },
  54. richTextClamp(val) {
  55. return `<div style="${
  56. val == 7 ? "min-height: 50px;" : ""
  57. }line-clamp: ${val};-webkit-line-clamp: ${val};text-overflow: -o-ellipsis-lastline;overflow: hidden;text-overflow: ellipsis;display: -webkit-box;-webkit-box-orient: vertical;word-wrap: break-word;word-break: break-all;">`;
  58. },
  59. },
  60. };
  61. </script>
  62. <style scoped lang="scss">
  63. .container-report-item {
  64. width: 100%;
  65. background: #ffffff;
  66. box-shadow: 0rpx 3rpx 8rpx 0rpx rgba(0, 0, 0, 0.16);
  67. border-radius: 8rpx;
  68. padding: 20rpx;
  69. margin-bottom: 20rpx;
  70. overflow: hidden;
  71. .item-title {
  72. position: relative;
  73. font-size: 32rpx;
  74. font-weight: 500;
  75. color: #333333;
  76. line-height: 38rpx;
  77. text-indent: 0.5em;
  78. &::before {
  79. content: "";
  80. position: absolute;
  81. top: 5rpx;
  82. left: 0;
  83. width: 6rpx;
  84. height: 31rpx;
  85. background-color: #3385ff;
  86. }
  87. }
  88. .item-content,
  89. .item-rich-text {
  90. font-size: 26rpx;
  91. font-weight: 400;
  92. color: #666666;
  93. }
  94. .item-content {
  95. margin-top: 10rpx;
  96. }
  97. .item-rich-text {
  98. margin-bottom: 20rpx;
  99. }
  100. .item-image {
  101. height: 242rpx;
  102. margin: 15rpx 0;
  103. image {
  104. width: 100%;
  105. height: 100%;
  106. }
  107. }
  108. .item-abstract {
  109. font-size: 28rpx;
  110. font-weight: 400;
  111. color: #333333;
  112. line-height: 33rpx;
  113. -webkit-line-clamp: 3;
  114. line-clamp: 3;
  115. margin-bottom: 20rpx;
  116. }
  117. .text-Line {
  118. text-overflow: -o-ellipsis-lastline;
  119. overflow: hidden;
  120. text-overflow: ellipsis;
  121. display: -webkit-box;
  122. -webkit-box-orient: vertical;
  123. word-wrap: break-word;
  124. word-break: break-all;
  125. }
  126. .item-time {
  127. display: flex;
  128. align-items: center;
  129. justify-content: space-between;
  130. color: #acacac;
  131. font-size: 24rpx;
  132. line-height: 28rpx;
  133. .item-examine {
  134. display: flex;
  135. align-items: center;
  136. image {
  137. width: 30rpx;
  138. height: 24rpx;
  139. margin: 0 10rpx 0 15rpx;
  140. }
  141. }
  142. }
  143. }
  144. </style>