<template>
  <div>
    <top-title></top-title>
    <div class="info-box">
      <img :src="info.avatar" alt="">
      <div class="info">
        <div class="name">{{ info.nickname }}</div>
        <div class="mobile">{{ info.mobile }}</div>
        <div class="em">{{ info.email }}</div>
      </div>
    </div>
    <div class="out-login" @click="loginOut">退出登录</div>
    <div class="tabbar-box">
      <tabbar type='2'></tabbar>
    </div>
  </div>
</template>

<script>
import topTitle from '../../components/topTitle.vue'
import tabbar from '../../components/tabbar.vue'
import action from '@action'
export default {
  components: {
    topTitle,
    tabbar
  },
  data() {
    return {
      info: {}
    }
  },
  mounted() {
    this.getUserInfo()
  },
  methods: {
    getUserInfo() {
      action.Login.getUserInfo().then((res) => {
        if (res.code === 0) {
          this.info = res.data
          console.log(res)
        }
      })
    },
    loginOut() {
      action.Login.loginOut().then((res) => {
        if (res.code === 0) {
          this.$router.push({
            path: '/login'
          })
        }
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.info-box{
  display: flex;
  margin-left: .4rem;
  img{
    width: 1.68rem;
    height: 1.68rem;
    border-radius: 50%;
    display: block;
  }
  .info{
    margin-left: .4rem;
    div{
      line-height: 100%;
    }
    .name{
      font-size: .34rem;
      color: #222;
    }
    .mobile{
      font-size: .28rem;
      color: #999;
      margin-top: .35rem;
    }
    .em{
      font-size: .28rem;
      color: #999;
      margin-top: .35rem;
    }
  }
}
.out-login{
  position: absolute;
  bottom: 1.4rem;
  left: 50%;
  -webkit-transform: translateX(-50%);
  font-size: .36rem;
  color: #fff;
  text-align: center;
  line-height: .86rem;
  width: 6.7rem;
  height: 0.86rem;
  background: linear-gradient(90deg, #AF1B40 0%, #EA6183 100%);
  box-shadow: 0rem 0.06rem 0.1rem 0rem rgba(175, 27, 64, 0.2);
  border-radius: 0.06rem;
}
.tabbar-box{
  width: 100%;
  position: fixed;
  bottom: 0;
  left: 0;
}
</style>
