<template>
  <div class="home">
    <div class="act_shoose">
      <div @click="doGuidance" class="act_btn active">
        <img />
        <div class="hospital_info">
          <div class="hospital_name">海慈医院</div>
          <div class="hospital_addr">青岛市市南区栖霞路18号</div>
        </div>
      </div>
      <div @click="doGuidance" class="act_btn">
        <img />
        <div class="hospital_info">
          <div class="hospital_name">即墨人民医院</div>
          <div class="hospital_addr">青岛市市南区栖霞路18号</div>
        </div>
      </div>
      <div @click="doGuidance" class="act_btn">
        <img />
        <div class="hospital_info">
          <div class="hospital_name">平度人民医院</div>
          <div class="hospital_addr">青岛市市南区栖霞路18号</div>
        </div>
      </div>
      <div @click="doGuidance" class="act_btn">
        <img />
        <div class="hospital_info">
          <div class="hospital_name">胶州医院</div>
          <div class="hospital_addr">青岛市市南区栖霞路18号</div>
        </div>
      </div>
      <div @click="doGuidance" class="act_btn">
        <img />
        <div class="hospital_info">
          <div class="hospital_name">莱西市立医院</div>
          <div class="hospital_addr">青岛市市南区栖霞路18号</div>
        </div>
      </div>
    </div>
    <div class="act_box">
      <div @click="testAlert" class="act_btn">我的预约</div>
    </div>
    <!-- 阅读须知 -->
    <!-- <GuidanceVue @doCancelGuide="doCancelGuide" v-if="guideShow"></GuidanceVue> -->
  </div>
</template>
<script>
import GuidanceVue from '@/components/Guidance.vue';
import { getUserInfo } from '@/utils/aisdapp';
import { isMobile } from '@/utils';
export default {
  name: "HomeView",
  components: {
    GuidanceVue,
  },
  data() {
    return {
      guideShow: false,
      userInfo: null,
    }
  },
  mounted() {
    if (isMobile()) {
      let userInfo = sessionStorage.getItem('userInfo') ? JSON.parse(sessionStorage.getItem('userInfo')) : null;
      console.log(userInfo);
      if (userInfo == null) {
        getUserInfo();
      }
      else {
        this.userInfo = userInfo;
      }
    } else {
      return false // alert('PC端')
    }
  },
  methods: {
    testAlert() {
      lightAppJssdk.notification.alert({
        message: "这是一个弹窗",
        title: "提示",//可传空
        buttonName: "收到",
        success: function (data) {
          //onSuccess将在点击button之后回调
          /*回调*/
        },
        fail: function (data) { //错误返回
        }
      });
    },
    //取消阅读
    doCancelGuide() {
      this.guideShow = false;
    },
    //阅读须知
    doGuidance() {
      // this.guideShow = true;
      this.$router.push({name:'guidance',query:{deptId:1}})
    },
  }
};
</script>
<style scoped lang="scss">
.home {
  .act_shoose {
    height: 9rem;
    margin: 1.4rem 0 0;
    padding: 0 0.24rem;
    overflow-y: auto;

    .act_btn {
      width: 6.98rem;
      height: 0.96rem;
      background: #F6F6F6;
      border-radius: 0.08rem;
      border: 0.02rem solid #F6F6F6;
      text-align: center;
      padding: 0.12rem 0;
      margin-bottom: 0.3rem;

      &.active {
        background: #FFFFFF;
        border-color: #1677FF;
      }

      img {
        width: 0.6rem;
        height: 0.6rem;
        margin-right: 0.24rem;
      }

      .hospital_info {
        display: inline-block;
        text-align: left;

        .hospital_name {
          color: #333333;
          font-size: 0.34rem;
          font-family: PingFang SC-Regular, PingFang SC;
          font-weight: 400;
          line-height: 0.48rem;
        }

        .hospital_addr {
          color: #999999;
          line-height: 0.45rem;
          font-size: 0.22rem;
          font-family: PingFang SC-Regular, PingFang SC;
          font-weight: 400;
        }
      }
    }
  }

  .act_box {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 0.24rem;
    background: #fff;

    .act_btn {
      color: #FFFFFF;
      font-size: 0.3rem;
      font-family: PingFang SC-Bold, PingFang SC;
      font-weight: bold;
      line-height: 0.96rem;
      text-align: center;
      background: #1677FF;
      border-radius: 0.08rem;
    }
  }
}
</style>
