<template>
    <div class="home_wrapper">

      <van-icon name="arrow-left" size="30" @click="goBack" />

      <div class="header">
        <div class="left">
          <div class="avatar"><img src="../../../assets/images/app/user_header.png" alt=""></div>
          <div class="info">
            <p>{{$store.getters.user.user.nickName}}</p>
            <p>{{$store.getters.user.user.dept.deptName}}</p>
          </div>
        </div>
      </div>

      <div class="content">
        <van-cell title="用户信息" is-link center :border="false" @click="$router.push({name:'appUserInfo'})">
          <template slot="icon">
            <img src="../../../assets/images/app/user_icon_01.png" width="25" alt="">
          </template>
        </van-cell>
        <van-cell title="修改密码" is-link center :border="false" @click="$router.push({name:'appUserPassWord'})">
          <template slot="icon">
            <img src="../../../assets/images/app/user_icon_02.png" width="25" alt="">
          </template>
        </van-cell>
        <van-cell title="退出登录" is-link center :border="false" @click="logout">
          <template slot="icon">
            <img src="../../../assets/images/app/user_icon_03.png" width="25" alt="">
          </template>
        </van-cell>
      </div>

    </div>
</template>

<script>
  import Cookies from "js-cookie";
  import {Dialog} from "vant";
  export default {
    name: "appUser",
    data() {
      return {

      };
    },
    created() {

    },
    methods: {
      goBack(){
        history.go(-1)
      },
      logout() {

        Dialog.confirm({
          title: '提示',
          message: '确定注销并退出系统吗？',
        })
        .then(() => {
          this.$store.dispatch('LogOut').then(() => {
            location.href = '/app/login'
          })
        })
        .catch(() => {
          // on cancel
        });
      }
    },
  };
</script>

<style scoped lang="scss">
  p{margin: 0;}
  .home_wrapper{
    width: 100vw;
    min-height: 100vh;
    background: #F6F9FB url('../../../assets/images/app/user_bg.png') no-repeat center top;
    background-size: 100% auto;
    padding: 5vh 4vw 0;
  }
  .header{
    display: flex;
    align-items: self-start;
    justify-content: space-between;
    margin-top: 3vh;
    .left{
      display: flex;
    }
    .avatar{
      width: 18vw;
      height: 18vw;
      overflow: hidden;
      img{
        width: 100%;
        height: 100%;
      }
    }
    .info{
      display: flex;
      flex-direction: column;
      justify-content: space-evenly;
      margin-left: 15px;
      p{
        &:nth-child(1){
          font-weight: bold;
          font-size: 2vh;
        }
        &:nth-child(2){
          font-size: 1.65vh;
          color: #666666;
        }
      }
    }
    i{
      margin-top: 1vh;
    }
  }

  .content{
    background: #ffffff;
    border-radius: 12px 12px 12px 12px;
    padding: 4vw 0;
    margin-top: 4vh;
    border: 2px solid #FFFFFF;
    overflow: hidden;
    .title{
      background: url("../../../assets/images/app/title_bg.png") no-repeat left 10px;
      font-size: 2.2vh;
      font-weight: bold;
      padding-bottom: 10px;
      color: #0D131A;
      font-family: Source Han Sans CN, Source Han Sans CN;
    }
    .flex-main{
      display: flex;
      justify-content: space-between;
      flex-wrap: wrap;
      div{
        width: 22%;
        display: flex;
        flex-direction: column;
        align-items: center;
        margin-top: 15px;
        img{
          width: 80%;
        }
        p{
          color: #111311;
          margin-top: 5px;
          font-size: 1.6vh;
        }
      }
    }
  }

</style>
