<template>
  <div class="page">
    <div class="page-title">专业美容培训师</div>
    <div class="page-top">
      <div class="swiper">
        <SimpleSwiper :imageList="doctorInfo.bannerList"></SimpleSwiper>
      </div>
    </div>
    <div class="page-content">
      <div class="doctor-info">
        <div class="name">{{ doctorInfo.doctorName }}<i /></div>
        <div class="tag">{{ doctorInfo.tagList.join(' | ') }}</div>
      </div>
      <div class="param-list">
        <div
          class="param"
          v-for="(param, index) in doctorInfo.paramList"
          :key="index"
        >
          <div class="name" v-text="param.name"></div>
          <div class="content" v-text="param.content"></div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  layout: 'app-ldm',
  data() {
    return {
      doctorId: '',
      doctorInfo: {
        tagList: [],
        paramList: [],
      },
    }
  },
  mounted() {
    this.initData()
  },
  methods: {
    initData() {
      this.doctorId = parseInt(this.$route.query.id)
      this.fetchDetail()
    },
    async fetchDetail() {
      try {
        const res = await this.$http.api.fetchDoctorDetail({
          doctorId: this.doctorId,
        })
        this.doctorInfo = res.data
      } catch (error) {
        console.log(error)
      }
      if (this.doctorInfo.bannerList.length <= 0) {
        this.doctorInfo.bannerList.push('/placeholder.png')
      }
    },
  },
}
</script>

<style scoped lang="scss">
@media screen and (min-width: 768px) {
  .page {
    position: relative;
    display: flex;
    justify-content: space-between;
    width: 1016px;
    margin: 0 auto;
    padding-top: 117px;
  }

  .page-title {
    position: absolute;
    left: 0;
    top: 60px;
    font-size: 26px;
    color: #221815;
  }
  .page-top {
    .swiper {
      width: 452px;
      height: 452px;
      background: #f7f7f7;

      ::v-deep {
        img {
          width: 452px;
          height: 452px;
        }
      }
    }
  }

  .page-content {
    width: 503px;
    .doctor-info {
      padding-bottom: 30px;
      .name {
        font-size: 35px;
        font-weight: bold;
        color: #000;
        margin-bottom: 22px;

        i {
          font-size: 0;
          display: inline-block;
          background: url(https://static.caimei365.com/www/authentic/pc/ldm-icon-star.png)
            no-repeat left center;
          padding-left: 13px;
          vertical-align: 2px;
          margin-left: 7px;
          &::after,
          &::before {
            display: inline-block;
            content: '';
            width: 13px;
            height: 13px;
            background: url(https://static.caimei365.com/www/authentic/pc/ldm-icon-star.png)
              no-repeat center;
            vertical-align: middle;
            margin-left: 4px;
          }
        }
      }
      .tag {
        font-size: 16px;
        color: #221815;
      }
    }

    .param-list {
      .param {
        padding: 24px 0;
        min-height: 160px;
        box-sizing: border-box;
        border-bottom: 1px solid rgba(0, 0, 0, 0.3);

        &:first-child {
          border-top: 1px solid rgba(0, 0, 0, 0.3);
        }

        .name {
          font-size: 18px;
          font-weight: bold;
          color: #000;
        }
        .content {
          font-size: 16px;
          color: #9c9c9c;
          margin-top: 12px;
          text-align: justify;
          line-height: 1.6;
        }
      }
    }
  }
}

@media screen and (max-width: 768px) {
  .page-top {
    .swiper {
      height: 100vw;
      background: #f7f7f7;
      ::v-deep {
        img {
          height: 100vw;
        }
      }
    }
  }

  .page-title {
    display: none;
  }

  .page-content {
    padding: 4.7vw 6.2vw;
    .doctor-info {
      padding-bottom: 6vw;
      .name {
        font-size: 6.2vw;
        font-weight: bold;
        color: #000;
        margin-bottom: 3.2vw;

        i {
          font-size: 0;
          display: inline-block;
          background: url(https://static.caimei365.com/www/authentic/h5/ldm-icon-star.png)
            no-repeat left center;
          padding-left: 3.2vw;
          vertical-align: 1vw;
          margin-left: 1.8vw;
          &::after,
          &::before {
            display: inline-block;
            content: '';
            width: 3.2vw;
            height: 3.2vw;
            background: url(https://static.caimei365.com/www/authentic/h5/ldm-icon-star.png)
              no-repeat center;
            vertical-align: middle;
            margin-left: 0.9vw;
          }
        }
      }
      .tag {
        font-size: 3vw;
        color: #221815;
      }
    }

    .param-list {
      .param {
        padding: 6vw 0;
        border-bottom: 0.1vw solid rgba(0, 0, 0, 0.3);

        &:first-child {
          border-top: 0.1vw solid rgba(0, 0, 0, 0.3);
        }

        .name {
          font-size: 3.2vw;
          font-weight: bold;
          color: #000;
        }
        .content {
          font-size: 3vw;
          color: #9c9c9c;
          margin-top: 1.6vw;
          text-align: justify;
          line-height: 1.7;
        }
      }
    }
  }
}
</style>
