<template>
  <div>
    <div class="report-container">
      <div class="report-title">{{ reportInfo.Title }}</div>
      <div class="report-author-box">
        <img :src="reportInfo.ImgUrl" v-if="reportInfo.ImgUrl" />
        <div :class="[!reportInfo.NickName && 'report-hz']">
          <div class="report-author-name">
            {{ reportInfo.NickName || reportInfo.SellerAndMobile }}
          </div>
          <div class="report-publishTime">
            {{ publishTime }}
          </div>
        </div>
      </div>
      <div class="report-disclaimer">注：请务必阅读<span @click="showDisclaimer">免责声明</span></div>
      <div class="report-abstract">
        <div>摘要：</div>
        <div>
          {{ reportInfo.Abstract }}
        </div>
      </div>
      <div class="report-content-item">
        <div class="report-content" id="report-content" v-html="reportInfo.Body"></div>
      </div>
      <div class="deeperReport" @click="lookDeeperReport" v-if="reportInfo.ReportLink">查看报告链接</div>
    </div>
    <Disclaimer :showTips="showTips" @hideDlg="showTips = false" />
    <toTop />
  </div>
</template>
<script>
import Disclaimer from "./components/disclaimer.vue";
import toTop from "./components/toTop.vue";
import moment from "moment";

export default {
  name: "summaryPre",
  components: {
    Disclaimer,
    toTop,
  },
  computed: {
    publishTime() {
      return moment(new Date()).format("YYYY-MM-DD");
    },
  },
  data() {
    return {
      reportInfo: JSON.parse(sessionStorage.getItem("summaryPre")) || "",
      showTips: false,
    };
  },
  methods: {
    showDisclaimer() {
      this.showTips = true;
    },
    lookDeeperReport() {
      window.open(this.reportInfo.ReportLink, "_blank");
    },
  },
  mounted() {
    console.log(this.reportInfo);
    $("#report-content img").css("max-width", "100%");
  },
};
</script>
<style lang="scss" scoped>
.report-container {
  word-break: break-all;
  padding: 20px;
  max-width: 1200px;
  margin: 0 auto;
  box-sizing: border-box;
  .report-hz {
    display: flex;
    align-items: center;
    .report-author-name {
      margin-right: 30px;
      margin-bottom: 0px !important;
    }
  }
  .report-title {
    font-style: normal;
    font-weight: bold;
    font-size: 30px;
    color: #333333;
    font-weight: 600;
    margin-bottom: 10px;
  }
  .report-author-box {
    margin-bottom: 10px;
    display: flex;
    img {
      width: 41px;
      height: 41px;
      overflow: hidden;
      margin-right: 15px;
    }
    .report-author-name {
      font-style: normal;
      font-weight: 500;
      font-size: 16px;
      color: #333333;
      margin-bottom: 4px;
    }
    .report-publishTime {
      font-style: normal;
      font-weight: 400;
      font-size: 12px;
      color: #b3b3b3;
    }
  }
  .report-disclaimer {
    font-style: normal;
    font-weight: 400;
    font-size: 14px;
    line-height: 22px;
    color: #999999;
    margin: 15px 0;
    span {
      color: #3385ff;
      cursor: pointer;
      margin-left: 4px;
    }
  }
  .report-abstract {
    border-left: 3px solid #001529;
    padding-left: 12px;
    :nth-child(1){
      margin-bottom: 0.6em;
      font-size: 20px;
      color: #000;
      font-style: italic;
    }
  }
  .report-content-item {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #f0f0f0;
  }
  .deeperReport {
    width: 128px;
    height: 40px;
    background: #1890ff;
    box-shadow: 0px 2px 0px 0px rgba(0, 0, 0, 0.04);
    border-radius: 2px 2px 2px 2px;
    font-size: 16px;
    font-weight: 400;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 80px auto 0 auto;
    cursor: pointer;
  }
}
</style>
