<template>
    <div>
        <div class="report-container">
            <div class="report-title">{{reportInfo.Title}}</div>
            <div class="report-author-box">
                <div class="report-author-name">
                    {{reportInfo.SellerAndMobile}}
                </div>
                <div class="report-publishTime">
                    <div>
                        {{publishDate}}
                    </div>
                    <div>
                        {{publishTime}}
                    </div>
                </div>
            </div>
            <div class="report-disclaimer">
                注：请务必阅读<span @click="showDisclaimer">免责声明</span>
            </div>
            <div class="report-abstract">
                摘要：{{reportInfo.Abstract}}
            </div>
            <div class="report-content-item">
                <div class="report-content" id="report-content" v-html="reportInfo.Body"></div>
                <div class="deeperReport" @click="lookDeeperReport" v-if="reportInfo.ReportLink">
                    查看深度报告
                </div>
            </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";
import { raiInterface } from "@/api/api.js";

export default {
    name:"summaryPre",
    components:{
        Disclaimer,
        toTop
    },
    computed:{
        publishDate(){
            return moment(this.reportInfo.PublishDate).format('YYYY-MM-DD')
        },
        publishTime(){
            return moment(this.reportInfo.PublishDate).format('hh:mm:ss')
        },
    },
    data(){
        return {
            reportInfo:{},
            showTips:false
        }
    },
    created(){
        this.init()
    },
    methods:{
        showDisclaimer(){
            this.showTips = true
        },
        lookDeeperReport(){
            window.open(this.reportInfo.ReportLink, '_blank');
        },
        async init(){
            if(this.$route.query.ArticleId){
                // 有ArticleId 是通过列表点击进来的
                let res = await raiInterface.roadshowEssenceDetail({ ArticleId: this.$route.query.ArticleId || ""})
                if(res.Ret == 200){
                    this.reportInfo = res.Data
                }else{
                    this.reportInfo = JSON.parse(sessionStorage.getItem('roadShowPre')) || {}
                }
            }else{
                this.reportInfo = JSON.parse(sessionStorage.getItem('roadShowPre')) || {}
            }
            // console.log(this.reportInfo);
        }
    },
    mounted() {
        $("#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-title{
            font-style: normal;
            font-weight: bold;
            font-size: 18px;
            color: #333333;
            margin-bottom: 10px;
        }
        .report-author-box{
            margin-bottom: 10px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            .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: 16px;
                color: #999999;
                text-align: right;
            }
        }
        .report-disclaimer{
            font-style: normal;
            font-weight: 400;
            font-size: 16px;
            line-height: 22px;
            color: #999999;
            span{
                color: #3385FF;
                cursor: pointer;
                margin-left: 4px;
            }
        }
        .report-abstract{
            font-style: normal;
            font-weight: 400;
            font-size: 16px;
            color: #666666;
            padding: 12px 0;
            text-indent: 14px;
            word-break: break-all;
            position: relative;
            border-bottom: 1px dashed #DCDFE6;
            &:before{
                content: '';
                height: 20px;
                width: 4px;
                background-color: #3385FF;
                position: absolute;
                left: 0;
                top: 12px;
            }
        }
        .report-content-item{
            margin-top: 10px;
            .deeperReport{
                width: 128px;
                height: 40px;
                background: #1890FF;
                box-shadow: 0px 2px 0px 0px rgba(0,0,0,0.0400);
                border-radius: 2px 2px 2px 2px;
                font-size: 16px;
                font-weight: 400;
                color: #FFFFFF;
                display: flex;
                align-items: center;
                justify-content: center;
                margin: 30px auto 0 auto;
                cursor: pointer;
            }
        }
    }
</style>