<template>
  <div class="item-leader-container">
    <div class="basic-title">项目负责人</div>
    <div class="leader-info">
      <img :src="projectLeader.appImageUrl" />
      <div class="leader-text">
        <div class="leader-con">
          <span>{{projectLeader.name}}</span>
          <span class="leader-title">{{projectLeader.title}}</span>
        </div>
        <div class="address">{{projectLeader.hospital}}</div>
      </div>
    </div>
    <div class="content">
      <div class="text" v-html="leaderText"></div>
      <div v-if="leaderText.length > 70" class="desc" @click="allText">
        <span>{{btnText}}</span>
        <img v-if="!allTextFlag" src="../../images/down.png" />
        <img v-if="allTextFlag" src="../../images/up.png" />
      </div>
    </div>
  </div>
</template>
<script>
export default {
  props: {
    projectLeader: {
      type: Object,
      default: () => {}
    },
    leaderText: {
      type: String,
      default: ""
    }
  },
  data() {
    return {
      btnText: "详情",
      allTextFlag: false
    };
  },
  methods: {
    allText() {
      if (!this.allTextFlag) {
        this.btnText = "收起";
        this.allTextFlag = true;
      } else {
        this.btnText = "详情";
        this.allTextFlag = false;
      }
      this.$emit("changeLeaderText",{allTextFlag: this.allTextFlag});
    }
  }
};
</script>
<style lang="less" scoped>
.item-leader-container {
  padding-bottom: 20px;
  margin: 30px 15px 0px;
  border-bottom: 1px solid #e7e8e9;
  .basic-title {
    font-size: 18px;
    line-height: 18px;
    color: #373839;
    font-weight: 700;
  }
  .leader-info {
    display: flex;
    flex-direction: row;
    margin-top: 16px;
    img {
      display: inline-block;
      width: 44px;
      height: 44px;
      border-radius: 50%;
    }
    .leader-text {
      flex: 1;
      width: 100px;
      margin-left: 16px;
      margin-top: 6px;
      .leader-con {
        line-height: 14px;
        display: flex;
        flex-direction: row;
        white-space: nowrap;
        span {
          font-size: 16px;
          color: #676869;
        }
        span:first-child {
          font-size: 16px;
          color: #373839;
          font-weight: 700;
        }
        .leader-title {
          width: 220px;
          overflow : hidden;
          text-overflow: ellipsis;
          white-space:nowrap;
          line-height: 16px;
          margin-left: 10px;
        }
      }
      .address {
        margin-top: 5px;
        font-size: 13px;
        color: #979899;
        width: 240px;
        overflow : hidden;
        text-overflow: ellipsis;
        white-space:nowrap;
      }
    }
  }
  .content {
    position: relative;
    margin-top: 16px;
    .text {
      font-size: 14px;
      line-height: 21px;
      color: #676869;
    }
    .desc {
      // position: absolute;
      // right: 0;
      // bottom: 1px;
      text-align: right;
      background: #fff;
      line-height: 14px;
      z-index: 99;
      span {
        font-size: 14px;
        color: #449284;
      }
      img {
        width: 12px;
      }
    }
  }
}
</style>
