<template>
  <div class="container">
    <img src="../assets/images/entrybg.jpg" alt="" width="100%" style="margin-top:4rem;">
    <div class="content">
      <div class="csbtn" @click="goPage('/doclogin')" style="margin-top:0px;">医生端</div>
      <div class="jbbtn" @click="goPage('/patregister')">个人端</div>
    </div>
  </div>
</template>

<script>
  export default {
    name: 'Index',
    data() {
      return {
        msg: 'Welcome to Your Vue.js App'
      }
    },
    methods: {
      goPage(path) {
        this.$router.push(path)
      },
      logout(){
        window.localStorage.removeItem('token')
        window.localStorage.removeItem('authinfo')
        window.location.reload()
      },
      getData(){
        this.$api.getAccountInfo().then(res=>{
          if(!res.data.code){
            if(res.data.data.role=="1"){
              this.goPage("/docindex")
            }else{
              this.goPage("/patindex")
            }
            localStorage.setItem("authinfo",JSON.stringify(res.data.data))
          }
        })
      }
    },
    created(){
      this.getData()
    }
  }

</script>

<style scoped lang="scss">
  .container {
    background:#fff;
    .bgimg {
      width: 100%;
      height: 12.3rem;
      margin-top: 3rem;
      position: absolute;
      background-image: url("../assets/images/entrybg.jpg");
      background-image: url("../assets/images/entrybg.jpg");
      background-size: 100% 100%;
    }
  }

</style>
