<template>
  <div class="fixed-qb-header">
    <div class="header-info" :class="!isWeb ? 'top-set' : ''">
      <div class="info-first">
        <img v-if="directoryInfo.avatarImageUrl" :src="directoryInfo.avatarImageUrl">
        <img v-if="!directoryInfo.avatarImageUrl" src="../../images/question/portrait.png">
        <div class="infor">
          <p class="name">{{directoryInfo.name}} 医生</p>
          <p class="question-result">已做题<span>{{directoryInfo.finishedNum}}</span>错误题<span class="err">{{directoryInfo.wrongTitle}}</span>正确率<span class="suc">{{directoryInfo.correctRatio}}%</span></p>
        </div>
      </div>
      <div class="info-second">
        <div class="item" @click="wrongBook(1)"><img src="../../images/question/text.png"><span>错题集</span><span v-if="directoryInfo.wrongTitleBook">({{directoryInfo.wrongTitleBook}})</span></div>
        <div class="item" @click="wrongBook(2)"><img src="../../images/question/heart-h.png"><span>收藏</span><span v-if="directoryInfo.collectTitleBook">({{directoryInfo.collectTitleBook}})</span></div>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      isWeb: window.__isWeb,
    }
  },
  props: {
    directoryInfo: {
      type: Object,
      default: () => {}
    },
  },
  methods: {
    wrongBook(type) {
      this.$emit('handlerBook',type)
    },
  },
}
</script>
<style lang="less" scoped>
  .fixed-qb-header{
    position: relative;
    .header-info{
      position: fixed;
      z-index: 200;
      background-color: #FFFFFF;
      padding: 0 16px;
      box-sizing: border-box;
      width: 100%;
      &.top-set{
        top: 73px;
      }
      .info-first{
        display: flex;
        padding: 20px 0;
        img{
          width: 44px;
          height: 44px;
          border-radius: 50%;
        }
        .infor{
          margin-left: 12px;
          .name{
            color: #373839;
            font-size: 18px;
            font-weight: 700;
            line-height: 22px;
          }
          .question-result{
            font-size: 14px;
            color: #676869;
            line-height: 16px;
            margin-top: 9px;
            span{
              margin-left: 3px;
              margin-right: 15px;
              color: #373839;
              &.err{
                color: #ED3131;
              }
              &.suc{
                color: #449284;
              }
            }
          }
        }
      }
      .info-second{
        display: flex;
        justify-content: space-between;
        align-items: center;
        .item{
          width: 165.5px;
          height: 40px;
          border-radius: 6px;
          background-color: #F8F9FA;
          display: flex;
          align-items: center;
          justify-content: center;
          padding: 10px 0;
          vertical-align: middle;
          img{
            width: 20px;
            height: 20px;
            margin-right: 8px;
          }
          span:first-of-type{
            font-size: 14px;
            font-weight: 700;
            color: #373839;
            height: 20px;
            line-height: 20px;
          }
          span:last-of-type{
            font-size: 12px;
            margin-left: 2px;
            height: 20px;
            line-height: 20px;
            margin-top: -1px;
          }
        }
      }
    }
  }
</style>
