ItemContent.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. <template>
  2. <view class="morning-item" @click="isGoDetalisOfDlgHandler(list)">
  3. <block v-if="list.Source == 'meetingreviewchapt'">
  4. <view class="item-title" v-if="list.IndustryName">
  5. <mp-html :content="richTextClamp(3) + list.IndustryName + '</div>'" />
  6. </view>
  7. <view class="item-rich-text">
  8. <mp-html :content="richTextClamp(10) + list.Content + '</div>'" />
  9. </view>
  10. <view class="item-time">
  11. <text>{{ list.PublishTime }}</text>
  12. </view>
  13. </block>
  14. <block v-else>
  15. <view class="item-title" v-if="list.Title">
  16. <mp-html :content="richTextClamp(3) + list.Title + '</div>'" />
  17. </view>
  18. <view class="item-rich-text">
  19. <mp-html :content="richTextClamp(10) + list.Abstract + '</div>'" />
  20. </view>
  21. <view class="item-time">
  22. <text>{{ list.PublishDate }}</text>
  23. </view>
  24. </block>
  25. </view>
  26. </template>
  27. <script>
  28. export default {
  29. name: "",
  30. props: {
  31. list: {
  32. type: Object,
  33. default: {},
  34. required: true,
  35. },
  36. },
  37. data() {
  38. return {};
  39. },
  40. watch: {
  41. list: {
  42. handler(newval) {
  43. console.log(newval);
  44. },
  45. deep: true,
  46. },
  47. },
  48. methods: {
  49. // 判断是跳转本周||上周||晨会弹框
  50. isGoDetalisOfDlgHandler(item) {
  51. // 判断是晨会文章、弹出弹框 通过传统方式进行操控兄弟之间传值
  52. if (item.Source == "meetingreviewchapt") {
  53. this.$emit("showMorningDialog", item);
  54. } else {
  55. let isType = item.Source == "researchsummary" ? 2 : 3;
  56. this.$store.dispatch("checkHandle", "/reportPages/reportSecretDetail/reportSecretDetail?type=" + isType + "&id=" + item.ArticleId);
  57. }
  58. },
  59. // 对返回的文本进行处理 多少行进行省略
  60. richTextClamp(val) {
  61. return `<div style="${
  62. val == 7 ? "min-height: 50px;" : ""
  63. }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;">`;
  64. },
  65. },
  66. };
  67. </script>
  68. <style scoped lang="scss">
  69. .morning-item {
  70. width: 100%;
  71. background: #ffffff;
  72. box-shadow: 0rpx 3rpx 8rpx 0rpx rgba(0, 0, 0, 0.16);
  73. border-radius: 8rpx;
  74. padding: 20rpx;
  75. margin-bottom: 20rpx;
  76. overflow: hidden;
  77. .item-title {
  78. position: relative;
  79. font-size: 32rpx;
  80. font-weight: 500;
  81. color: #333333;
  82. line-height: 38rpx;
  83. text-indent: 0.5em;
  84. &::before {
  85. content: "";
  86. position: absolute;
  87. top: 5rpx;
  88. left: 0;
  89. width: 6rpx;
  90. height: 31rpx;
  91. background-color: #3385ff;
  92. }
  93. }
  94. .item-rich-text {
  95. margin: 10rpx 0;
  96. }
  97. .item-time {
  98. display: flex;
  99. align-items: center;
  100. color: #acacac;
  101. font-size: 24rpx;
  102. line-height: 28rpx;
  103. }
  104. }
  105. </style>