<template>
  <view class="morning-item" @click="isGoDetalisOfDlgHandler(list)">
    <block v-if="list.Source == 'meetingreviewchapt'">
      <view class="item-title" v-if="list.IndustryName">
        <mp-html :content="richTextClamp(3) + `【${list.IndustryName}】晨会精华 ` + '</div>'" />
      </view>
      <view class="item-rich-text">
        <mp-html :content="richTextClamp(10) + list.Content + '</div>'" />
      </view>
      <view class="item-time">
        <text>{{ list.PublishTime }}</text>
      </view>
    </block>
    <block v-else>
      <view class="item-title" v-if="list.Title">
        <mp-html :content="richTextClamp(3) + list.Title + '</div>'" />
      </view>
      <view class="item-rich-text" v-if="list.MarketStrategy">
        <mp-html :content="richTextClamp(10) + list.MarketStrategy + '</div>'" />
      </view>
      <view class="item-rich-text" v-else-if="list.Source == 'productinterior'">
        <mp-html :content="richTextClamp(10) + list.Body + '</div>'" />
      </view>
      <view class="item-rich-text" v-else>
        <mp-html :content="richTextClamp(10) + list.Abstract + '</div>'" />
      </view>
      <view class="item-time">
        <text>{{ list.Source == "productinterior" ? list.PublishTime : list.PublishDate }}</text>
      </view>
    </block>
  </view>
</template>

<script>
/*
Source 字段的分别代表 
researchsummary     本周研究汇总
minutessummary      上周纪要汇总
meetingreviewchapt  晨会精华
productnterior      产品内测
*/
export default {
  name: "",
  props: {
    list: {
      type: Object,
      default: {},
      required: true,
    },
  },
  methods: {
    // 判断是跳转本周||上周||晨会弹框
    isGoDetalisOfDlgHandler(item) {
      // 判断是晨会文章、弹出弹框 通过传统方式进行操控兄弟之间传值
      if (item.Source == "meetingreviewchapt") {
        this.$emit("showMorningDialog", item);
      } else if (item.Source == "productinterior") {
        // 跳转产品内测详情
        uni.navigateTo({
          url: "/reportPages/internalDetials/internalDetials?id=" + item.ProductInteriorId,
        });
      } else if (item.Source == "reportselection") {
        uni.navigateTo({
          url: "/reportPages/keyCompany/keyCompany?id=" + item.ArticleId,
        });
      } else {
        let isType = item.Source == "researchsummary" ? 2 : 3;
        this.$store.dispatch("checkHandle", "/reportPages/reportSecretDetail/reportSecretDetail?type=" + isType + "&id=" + item.ArticleId);
      }
    },
    // 对返回的文本进行处理 多少行进行省略
    richTextClamp(val) {
      return `<div style="${
        val >= 7 ? "min-height: 50px;" : ""
      }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;">`;
    },
  },
};
</script>
<style scoped lang="scss">
.morning-item {
  width: 100%;
  background: #ffffff;
  box-shadow: 0rpx 3rpx 8rpx 0rpx rgba(0, 0, 0, 0.16);
  border-radius: 8rpx;
  padding: 20rpx;
  margin-bottom: 20rpx;
  overflow: hidden;
  .item-title {
    position: relative;
    font-size: 32rpx;
    font-weight: 500;
    color: #333333;
    line-height: 38rpx;
    text-indent: 0.5em;
    &::before {
      content: "";
      position: absolute;
      top: 5rpx;
      left: 0;
      width: 6rpx;
      height: 31rpx;
      background-color: #3385ff;
    }
  }
  .item-rich-text {
    margin: 10rpx 0;
  }
  .item-time {
    display: flex;
    align-items: center;
    color: #acacac;
    font-size: 24rpx;
    line-height: 28rpx;
  }
}
</style>
