<template>
  <div class="home">
    <div class="bj"></div>
    <div class="time">
      <div class="time_l">
        <ul>
          <li v-for="listt in listt" :class="{active: listton == listt}" @click="selected(listt)">
            <h2 v-if="listt.on==1">
              <p>{{listt.sky}}</p>
              <p>{{listt.time}}</p>
              <p>有号</p>
            </h2>
            <h2 class="on" v-else-if="listt.on==2">
              <p>{{listt.sky}}</p>
              <p>{{listt.time}}</p>
              <p>无</p>
            </h2>
          </li>
      </ul>
      </div>
      <div class="time_r" @click="show = true">
        <img src="../assets/calendar.png">
      </div>
     <van-calendar v-model="show" type="single" :show-confirm="false" :round="false" :formatter="formatter" color="##46C3B0"/>
    </div>
    <div class="checkbox">
      <van-checkbox v-model="checked" checked-color="#46C3B0"
        >只看有号</van-checkbox
      >
    </div>
    <div class="list">
      <ul>
        <li v-for="(item,index) in list" :key="index">
          <router-link :to="item.url">
            <h2><img :src="item.img" /></h2>
            <h3 v-if="item.on == 1">
              {{ item.name }}<span>{{ item.grade }}</span
              ><em>余{{ item.ticket }}</em>
              <p>{{ item.jianj }}</p>
            </h3>
            <h3 class="on" v-else-if="item.on == 0">
              {{ item.name }}<span>{{ item.grade }}</span
              ><em>余{{ item.ticket }}</em>
              <p>{{ item.jianj }}</p>
            </h3>
          </router-link>
        </li>
      </ul>
    </div>
  </div>
</template>

<script>
// @ is an alias to /src

export default {
  components: {},
  mounted() {
    console.log(this.$route.meta.title);
    this.title = this.$route.meta.title;
  },
  data() {
    return {
      active: 0,
      title: "",
      flag: false,
      checked: false,
      show: false,
       listt: [
         {
           sky:'周三',
           time:'04.21',
           on:1,
         },
         {
           sky:'周三',
           time:'04.21',
           on:2,
         },
         {
           sky:'周三',
           time:'04.21',
           on:1,
         },
         {
           sky:'周三',
           time:'04.21',
           on:1,
         },
         {
           sky:'周三',
           time:'04.21',
           on:1,
         },
         {
           sky:'周三',
           time:'04.21',
           on:1,
         },
       ],
    listton: '',
      list: [
        {
          img: require("../assets/yisheng.jpg"),
          url: "Ysgh",
          name: "张树立",
          grade: "主任医师",
          jianj: "擅长：骨科各种危重症的诊断和抢救、以骨关节为",
          ticket: "30",
          on: 1,
        },
        {
          img: require("../assets/yisheng.jpg"),
          url: "Ysgh",
          name: "张树立",
          grade: "主任医师",
          jianj: "擅长：骨科各种危重症的诊断和抢救、以骨关节为",
          ticket: "30",
          on: 1,
        },
        {
          img: require("../assets/yisheng.jpg"),
          url: "Ysgh",
          name: "张树立",
          grade: "主任医师",
          jianj:"擅长：骨科各种危重症的诊断和抢救、以骨关节为擅长：骨科各种危重症的诊断和抢救、以骨关节为",
          ticket: "0",
          on: 0,
        },
      ],
    };
  },
  methods: {
   selected: function(listt) {
      this.listton = listt
    },
    showPopup() {
      this.show = true;
    },
     formatter(day) {
      const month = day.date.getMonth() + 1;
      const date = day.date.getDate();

      if (month === 6) {
        if (date === 1) {
          day.bottomInfo = '有号';
        } else if (date === 4) {
          day.bottomInfo = '无号';
        }
      }

      return day;
    },
  },
};
</script>


<style scoped lang="scss">
.bj {
  background: #f5f5f5;
  position: fixed;
  width: 100%;
  height: 100%;
  top: 0px;
  left: 0px;
  z-index: -1;
}
.time {
  background: #fff;
  display: flex;
  justify-content: space-between;
  .time_l{
    padding-left: 30px;
    ul{
      display: flex;
    }
    ul li h2{
      width: 95px;
      height: 106px;
      font-size: 20px;
      text-align: center;
      line-height: 30px;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
    }
    ul li h2 p:nth-last-child(1){ color: #46C3B0;}
    ul li.active h2{
      background: #46C3B0;
      color: #fff;
    }
    ul li.active h2 p:nth-last-child(1){ color: #fff;}
    ul li.active h2.on{ cursor: none; background: #fff; color: #333;}
    ul li h2.on p:nth-last-child(1){ color: #333;}
  }
  .time_r{
    box-shadow: -5px 0px 10px 0px rgba(0, 0, 0, 0.24);
    width: 90px;
    height: 106px;
    display: flex;
    align-items: center;
    justify-content: center;
    img{
      width: 45px;
      height: auto;
    }
  }
}

.van-calendar__day{position: relative;}
.van-calendar__day::after{
  contain: '123';
  position: absolute;
  bottom: 0px;
  left: 0px;
}

::v-deep .van-calendar__selected-day{
  background: #46C3B0;
}
.checkbox {
  padding:25px 20px;
}

::v-deep .van-checkbox__label {
  font-size: 26px;
}
::v-deep .van-checkbox__icon {
  width: 35px;
}
::v-deep .van-checkbox__icon .van-icon {
  width: 35px;
  height: 35px;
}
::v-deep .van-calendar__bottom-info{ bottom: 20px;}

.list ul li {
  background: #fff;
  margin-bottom: 20px;
  a {
    display: flex;
    box-sizing: border-box;
    padding: 30px;
    h2 img {
      width: 98px;
      height: 98px;
      border-radius: 50%;
      margin-right: 20px;
    }
    h3 {
      color: #333;
      font-size: 30px;
      position: relative;
      width: calc(100% - 118px);
      span {
        font-size: 22px;
        color: #666;
        padding-left: 15px;
      }
      p {
        font-size: 24px;
        color: #999;
        display: block;
        padding-top: 20px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
      em {
        width: 86px;
        height: 38px;
        line-height: 38px;
        background: linear-gradient(-90deg, #ff464f, #ff6e77);
        border-radius: 16px;
        position: absolute;
        right: 0px;
        top: 0px;
        font-size: 20px;
        text-align: center;
        color: #fff;
      }
    }
    h3.on em {
      background: #999999;
    }
  }
}
</style>
