<template>
  <div class="sign-body">
    <!-- <img class="sign-title-2" src="/static/sign/title.png" alt="继续教育信息验证结果"> -->
    <span class="sign-title-2"> 课程学习信息验证结果</span>
    <div class="sign-content-box">
      <div class="sign-title">人员信息</div>
      <div class="sign-content">
        <ul class="sign-ul-info">
          <li class="sign-info"><span>姓名：</span><span>{{info.nickname}}</span>
          </li>
          <li class="sign-info"><span>身份证号码：</span><span>{{info.cardId}}</span></li>
          <li class="sign-info">
            <span>培训类别：</span><span>{{info.courseName}}</span>
          </li>
        </ul>
      </div>
    </div>
    <div class="sign-content-box">
      <div class="sign-title">课程
        <span style="font-size: 20px;color: black">（共</span>
        <span style="font-size: 20px;color: black">{{info.mediaList|totalXs}}</span>
        <span style="font-size: 20px;color: black">学时）</span>
      </div>

      <div class="sign-content" v-for="item in info.mediaList">
        <div class="sign-course-name">{{item.name}}</div>
        <ul class="sign-ul-info clear">
          <li class="sign-info">
            <span>学时：</span>
            <span>{{item.xs/10}}</span>
          </li>
          <!-- <li class="sign-info">
            <span>培训师资：</span>
            <span>{{item.author}}</span>
          </li> -->
        </ul>

      </div>

    </div>
  </div>
</template>
<script>
  import {
    httpServer
  } from "@/components/httpServer/httpServer.js";
  export default {
    data() {
      return {
        id: '',
        info: {}
      };
    },
    filters:{
      totalXs(list){
        if( !list) return 0;
        let xs = 0;
        for(let i=0;i < list.length;i++ ){
          xs += list[i].xs;
        }
        return (xs/10)
      }
    },
    methods: {
      gotoDetail() {
        let id = this.id;
        httpServer("User.getCert", {
          id
        }).then(res => {
          if (res.code == 200) {
            this.info = JSON.parse(res.data)
          }
        })
      }
    },
    created() {
      this.id = this.$route.query.id || '';
      if (this.id) {
        this.gotoDetail();
      }
    }
  }
</script>
<style>
  @import url("./index.css");
</style>
