<template>
  <div class="page">
    <div class="page-top flex flex-col justify-center items-center">
      <img class="logo" :src="supplierInfo.logo" />
      <div class="name mt-2" v-text="supplierInfo.shopName"></div>
    </div>
    <div class="page-content">
      <div class="list">
        <div
          class="section flex flex-col justify-center items-center mt-5 mb-5"
          v-for="item in list"
          :key="item.id"
          @click="toDetail(item)"
        >
          <icon-image class="icon" :name="item.image"></icon-image>
          <div class="line mt-3 mb-3"></div>
          <div class="name" v-text="item.name"></div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { mapGetters } from 'vuex'
export default {
  layout: 'app',
  data() {
    return {
      list: [],
    }
  },
  asyncData() {
    return {
      list: [
        {
          id: 1,
          name: '机构认证',
          image: 'icon-club.png',
          path: '/app/approve/club',
        },
        {
          id: 2,
          name: '设备认证',
          image: 'icon-device.png',
          path: '/app/approve/device',
        },
        {
          id: 3,
          name: '医师认证',
          image: 'icon-doctor.png',
          path: '/app/approve/personnel/operate',
        },
      ],
    }
  },
  computed: {
    ...mapGetters(['supplierInfo', 'authUserId']),
  },
  methods: {
    toDetail(item) {
      const url = `/${this.authUserId}${item.path}`
      this.$router.push(url)
    },
  },
}
</script>

<style scoped lang="scss">
// pc 端
@media screen and (min-width: 768px) {
  .page {
    min-height: calc(100vh - 80px - 80px);
    background-color: #fff;
  }
  .page-top {
    height: 360px;
    background: url(https://static.caimei365.com/www/authentic/pc/bg-approve.png);
    background-size: auto 360px;
    .logo {
      display: block;
      width: 120px;
      height: 120px;
      border-radius: 50%;
    }
    .name {
      font-size: 30px;
      color: #fff;
    }
  }
  .page-content {
    width: 1200px;
    margin: 0 auto;
    .list {
      display: flex;
      justify-content: space-between;
      align-items: center;
    }
    .section {
      width: 380px;
      height: 220px;
      background-size: 380px 220px;
      margin-left: auto;
      margin-right: auto;
      cursor: pointer;
      transition: all 0.4s;
      &:hover {
        box-shadow: 0 0 32px rgba(0, 0, 0, 0.4);
      }
      .icon {
        width: 48px;
        height: 48px;
      }
      .line {
        width: 24px;
        height: 2px;
        background-color: #bc1724;
      }
      .name {
        font-size: 20px;
        color: #fff;
      }

      &:nth-child(1) {
        background-image: url(https://static.caimei365.com/www/authentic/pc/section-bg-club.png);
      }
      &:nth-child(2) {
        background-image: url(https://static.caimei365.com/www/authentic/pc/section-bg-device.png);
      }
      &:nth-child(3) {
        background-image: url(https://static.caimei365.com/www/authentic/pc/section-bg-doctor.png);
      }
    }
  }
}

// 移动 端
@media screen and (max-width: 768px) {
  .page-top {
    height: 46vw;
    background: url(https://static.caimei365.com/www/authentic/h5/bg-approve.png);
    background-size: auto 46vw;
    .logo {
      display: block;
      width: 14.8vw;
      height: 14.8vw;
      border-radius: 50%;
    }
    .name {
      font-size: 4vw;
      color: #fff;
    }
  }
  .page-content {
    .section {
      width: 92vw;
      height: 42vw;
      background-size: 92vw 42vw;
      margin-left: auto;
      margin-right: auto;
      .icon {
        width: 8.8vw;
        height: 8.8vw;
      }
      .line {
        width: 4.2vw;
        height: 0.3vw;
        background-color: #bc1724;
      }
      .name {
        font-size: 4.2vw;
        color: #fff;
      }

      &:nth-child(1) {
        background-image: url(https://static.caimei365.com/www/authentic/h5/bg-club.png);
      }
      &:nth-child(2) {
        background-image: url(https://static.caimei365.com/www/authentic/h5/bg-device.png);
      }
      &:nth-child(3) {
        background-image: url(https://static.caimei365.com/www/authentic/h5/bg-doctor.png);
      }
    }
  }
}
</style>
