<template>
  <div class="result-box">
    <div class="pop-layer"></div>
    <div class="trophy-box">
      <img src="https://webapp-pub.ezijing.com/x-training-new/trophy.png">
      <div class="text">你的得分是<span>{{ score }}</span>分</div>
    </div>
    <div class="title-box">
      <div class="title">产品分析报告</div>
      <div class="code">{{ title }}</div>
    </div>
    <div v-for="(item, index) in completions" :key="index">
      <!-- 产品概括 -->
      <product ref="product" v-if="item.tag === 'product_overview'" :data="item"></product>
      <!-- 投资目标 -->
      <invest-target ref="investTarget" v-if="item.tag === 'investment_objectives'" :data="item"></invest-target>
      <!-- 业绩比较基准 -->
      <compares ref="compares" v-if="item.tag === 'performance_benchmark'" :data="item"></compares>
      <!-- 风险收益特征 -->
      <features ref="features" v-if="item.tag === 'risk_return_characteristics'" :data="item"></features>
      <!-- 基金涉及费用 -->
      <cost ref="cost" v-if="item.tag === 'fund_related_expenses'" :data="item"></cost>
    </div>
  </div>
</template>

<script>
import Product from '../components/Products.vue'
import InvestTarget from '../components/InvestTarget.vue'
import Compares from '../components/Compares.vue'
import Features from '../components/Features.vue'
import Cost from '../components/Cost.vue'
export default {
  components: {
    Product,
    InvestTarget,
    Compares,
    Features,
    Cost
  },
  data() {
    return {
      completions: [],
      score: '',
      title: ''
    }
  },
  created() {
    const localData = JSON.parse(window.localStorage.reportData)
    this.completions = localData.data
    this.score = localData.score
    this.title = this.completions.find(item => { return item.tag === 'title' }).value
  }
}
</script>

<style lang="scss" scoped>
.result-box{
  margin: 66px auto;
  width: 714px;
  background: #FFFFFF;
  border: 1px solid #DCDCDC;
  border-radius: 10px;
  padding: 20px;
  box-sizing: border-box;
  position: relative;
  .pop-layer{
    position: absolute;
    top: 0;
    left: 0;
    z-index: 9999;
    width: 100%;
    height: 100%;
  }
  .trophy-box{
    padding: 50px 0 38px 0;
    position: relative;
    &::after{
      content: "";
      position: absolute;
      bottom: 0;
      left: 50%;
      transform: translateX(-50%);
      width: 620px;
      border-bottom: 1px dashed #C0C0C0;
    }
    img{
      width: 69px;
      display: block;
      margin: 0 auto;
    }
    .text{
      font-size: 18px;
      color: #666666;
      text-align: center;
      margin-top: 18px;
      span{
        color: rgba(67, 169, 143, 1);
        font-size: 26px;
      }
    }
  }
  .title-box{
    padding: 28px 0 50px;
    .title{
      text-align: center;
      font-size: 24px;
      font-weight: bold;
      color: #4CAC94;
      line-height: 100%;
    }
    .code{
      width: 310px;
      line-height: 47px;
      margin: 29px auto 0;
      border-bottom: 1px solid #B4B4B4;
      text-align: center;
      font-size: 18px;
      color: #656565;
    }
  }
}
</style>
