<template>
    <div class="partner-home" >
      <div class="partner-info">
        <div class="qrcode-title">
          <div class="left">
            <img :src="userInfo.headurl?userInfo.headurl:require('../../../static/imgs/public/public-avatar.png')" alt />
          </div>
          <div class="right">
            <span class="partner-name">
              {{userInfo.doctorName}}
              <!-- <span class="doctor-level">主任医师</span> -->
            </span>
            <span class="audit-status" v-if="userInfo.checkStatus===1">审核中</span>
            <span class="audit-status" v-if="userInfo.checkStatus===2">已认证</span>
            <span class="audit-status" v-if="userInfo.checkStatus===0">未通过</span>
          </div>
        </div>
      </div>
      <div class="content" v-if="isShow">
        <div class="partner-invite"></div>
        <div class="partner-menu">
          <Card class="menu-card" @click.native="jumpTo('MyProfitIndex')">
            <div class="left">
              <img src="../../../static/imgs/partner/earnings.png" alt />
              <span>我的收益</span>
            </div>
            <div class="right">
              <van-icon name="arrow" />
            </div>
          </Card>
          <Card class="menu-card" @click.native="jumpTo('myVideos')">
            <div class="left">
              <img src="../../../static/imgs/doctorRegister/my-video.png" alt />
              <span>我的视频</span>
            </div>
            <div class="right">
              <span class="doctor-count"></span>
              <van-icon name="arrow" />
            </div>
          </Card>
          <Card class="menu-card" @click.native="jumpTo('likeVideo')">
            <div class="left">
              <img src="../../../static/imgs/doctorRegister/my-like.png" alt />
              <span>喜欢的视频</span>
            </div>
            <div class="right">
              <span class="doctor-count"></span>
              <van-icon name="arrow" />
            </div>
          </Card>
          <Card class="menu-card" @click.native="jumpTo('attention')">
            <div class="left">
              <img src="../../../static/imgs/doctorRegister/my-attention.png" alt />
              <span>我的关注</span>
            </div>
            <div class="right">
              <span class="doctor-count"></span>
              <van-icon name="arrow" />
            </div>
          </Card>
        </div>
      </div>

      <div v-else>
        <div class="modify-info" @click="$router.push('/doctorFlow')">修改信息</div>
      </div>
    </div>
</template>

<script>
import Card from "../../../components/common/Card";
import {reqGetDoctorInfo} from '../../../api/doctorRegister/doctorRegister'
export default {
  components: {
    Card
  },
  data() {
    return {
      isShow: false,
      userInfo: {}    // 用户信息
    };
  },
  methods: {
    // 页面跳转
    jumpTo(path){
      window.location.href=`https://ue.360lj.com/api/Home/Login?identity=1&backurl=https://ue.360lj.com/dist/${path}`
    },
    // 获取用户信息接口
    async getUserInfo(){
      const {data: response} = await reqGetDoctorInfo()
      console.log(response)
      this.userInfo = response.result
      if(response.success!==1) return this.$toast(response.messages)
      response.result.checkStatus===2 ? this.isShow=true : this.isShow=false
      delete this.userInfo.createTime
      delete this.userInfo.lastModifyTime
      window.sessionStorage.setItem('doctorFillForm', JSON.stringify(this.userInfo))
      window.sessionStorage.setItem('doctorMessageForm', JSON.stringify({specialty: this.userInfo.specialty, description: this.userInfo.description}))
      window.sessionStorage.setItem('licenseForm', JSON.stringify({headurl: response.result.headurl, qualificationImgurl:response.result.qualificationImgurl, practiceImgurl: response.result.practiceImgurl}))
    }
  },

  created() {
    this.getUserInfo()
  },
  mounted() {
    
  }
};
</script>

<style lang="less">
#app {
  background-color: #f7f7f7;
}
.partner-home {
  .partner-info {
    width: 100%;
    height: 2.18rem;
    background-color: #5594fc;
    .qrcode-title {
      display: flex;
      align-items: center;
      margin-right: 0.3rem;
      width: 100%;
      min-height: 1.96rem;
      .left {
        width: 20%;
        img {
          width: 0.96rem;
          height: 0.96rem;
          border-radius: 50%;
        }
      }

      .right {
        display: flex;
        flex-direction: column;
        justify-content: space-evenly;
        align-items: flex-start;
        width: 80%;
        font-size: 0.36rem;
        .partner-name {
          color: #ffffff;
          margin-bottom: 0.2rem;
          letter-spacing: 0.02rem;
        }

        .audit-status {
          display: block;
          line-height: 0.4rem;
          color: #fff;
          padding: 0 0.1rem;
          background-color: #f93232;
          font-size: 0.24rem;
          border-radius: 0.05rem;
        }
      }
    }
  }

  .content {
    padding: 0.2rem;
    .partner-invite {
      display: flex;
      .card {
        display: flex;
        justify-content: center;
        align-items: center;
        width: 3.4rem;
        height: 1.64rem;
        &:first-child {
          margin-right: 0.3rem;
        }
        img {
          display: block;
          width: 0.72rem;
          height: 0.72rem;
        }
        h3 {
          margin-left: 0.2rem;
          color: #000;
          font-size: 0.3rem;
          font-weight: bold;
        }
      }
    }

    .partner-menu {
      margin-top: 0.2rem;
      .menu-card {
        padding: 0 0.2rem;
        display: flex;
        justify-content: space-between;
        align-items: center;
        border-bottom: 1px solid #eee;
        &:first-child {
          border-bottom: 1px solid #f7f7f7;
        }
        &:first-child {
          margin-bottom: 0.3rem;
        }
      }
      .left {
        display: flex;
        align-items: center;
        img {
          display: block;
          width: 0.4rem;
          height: 0.4rem;
          margin-right: 0.1rem;
        }
        span {
          font-size: 0.3rem;
          color: #000;
        }
      }
      .right {
        display: flex;
        align-items: center;
        .van-icon {
          font-size: 0.3rem;
          margin-left: 0.1rem;
        }
      }
    }
  }
}

.doctor-level {
  font-size: 0.24rem;
  color: #b3cffe;
}

.modify-info {
  margin: 0 auto;
  margin-top: 1rem;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 2.7rem;
  height: .64rem;
  background-color: #478bfb;
  color: #fff;
  font-size: .3rem;
  border-radius: .1rem;
}
</style>