<template>
    <div class="mainBox">
        <side-bar :active_index="3"></side-bar>
        <div class="mainContent">
            <h1 class="title">我的</h1>
            <div class="information">
                <div class="blueBorder"></div>
                <div class="name">
                    <!--<router-link to="/EditPersonal">-->
                        <div class="item">
                            <div class="tx">
                              <img :src="myinfo.avatar" alt="" v-if="myinfo.avatar != ''">
                              <img :src="avatar" alt="" v-if="myinfo.avatar == ''">
                            </div>
                            <!--<span class="iconfont">&#xe6f9;</span>-->
                        </div>
                    <!--</router-link>-->
                </div>
                <div class="name">
                    <router-link to="/ElectronicSignature">
                        <div class="item">
                            <div class="tx">
                                <img :src="electronicsignature" alt="" v-if="electronicsignature">
                                <h2>电子签名</h2>
                            </div>
                            <span class="iconfont">&#xe6f9;</span>
                        </div>
                    </router-link>
                </div>
                <div class="set" v-show="false">
                   <div class="item">
                       <div class="tx">
                           <img src="@/assets/my/12.png" alt="">
                           <h2>消息通知</h2>
                       </div>
                       <span class="iconfont">&#xe6f9;</span>
                   </div>
                   <div class="item">
                       <div class="tx">
                           <img src="@/assets/my/13.png" alt="">
                           <h2>系统设置</h2>
                       </div>
                       <span class="iconfont">&#xe6f9;</span>
                   </div>
                   <div class="item">
                       <div class="tx">
                           <img src="@/assets/my/14.png" alt="">
                           <h2>软件更新</h2>
                       </div>
                       <span class="iconfont">&#xe6f9;</span>
                   </div>
                   <div class="item">
                       <div class="tx">
                           <img src="@/assets/my/15.png" alt="">
                           <h2>使用帮助</h2>
                       </div>
                       <span class="iconfont">&#xe6f9;</span>
                   </div>
                   <div class="item">
                       <div class="tx">
                           <img src="@/assets/my/16.png" alt="">
                           <h2>关于我们</h2>
                       </div>
                       <span class="iconfont">&#xe6f9;</span>
                   </div>
                </div>
                <div class="set">
                    <span class="out" @click="logout">退出登录</span>
                </div>
            </div>
        </div>
    </div>
</template>

<script>
import SideBar from "@/pages/layout/SideBar";
import EditPersonal from "./EditPersonal";
import { GetMyInfo } from "@/api/admin_user";

export default {
  name: "PersonalIndex",
  components: {
    SideBar,
    EditPersonal
  },
  data() {
    return {
      electronicsignature: "",
      myinfo: {},
      avatar:"@/assets/product/test.jpg"
    };
  },
  created() {
    this.GetMyInfo();
  },
  methods: {
    GetMyInfo() {
      GetMyInfo().then(response => {
        if (response.data.state == 1) {
          this.electronicsignature =
            response.data.data.electronic_signature === null
              ? ""
              : response.data.data.electronic_signature.url;
          this.myinfo =
            response.data.data.roleInfo === null
              ? {}
              : response.data.data.roleInfo;
        }
      });
    },
    logout: function() {
      // TODO 请求退出登录接口
      this.$router.push("/");
    }
  }
};
</script>

<style style="stylesheet/scss" lang="scss" scoped>
.mainContent {
  .title {
    font-size: 0.36rem;
    padding: 0.30rem 0;
    color: $title-color;
    text-align: center;
    position: fixed;
    top: 0;
    left: 1.58rem;
    right: 0;
    z-index: 1000;
    background: #fff;
  }
  .information {
    width: 100%;
    margin: 0 auto;
    padding-top:63px;
    min-height: calc(100vh - 2px);
    .name {
      background: #fff;
      width: 70%;
      margin: 0 auto;
      border-bottom: 1px #e5e5e5 solid;
      .item {
        padding: 0.37rem 0.4rem;
        @include align-items-center;
        @include display-flex;
        @include justify-content-between;
        @include text-align;
        .tx {
          @include display-flex;
          @include align-items-center;
          @include text-align;
          width: 1.24rem;
          height: 1.24rem;
          border-radius: 50%;
          margin-right: 0.26rem;
          overflow: hidden;
          box-shadow: 0 0 6px rgba(0, 0, 0, 0.4);
          img {
            width: 100%;
            height: 100%;
            object-fit: cover;
          }
          h2 {
            color: #34495e;
            font-size: 0.34rem;
          }
        }
        .iconfont {
          font-size: 0.4rem;
        }
      }
      &:last-child {
          border: none;
        }
    }

    .set {
      background: #fff;
      width: 70%;
      margin: 0 auto;
      border-radius: 4px;
      margin-top: 0.3rem;
      .item {
        padding: 0.3rem;
        @include align-items-center;
        @include display-flex;
        @include justify-content-between;
        @include text-align;
        border-bottom: 1px #e5e5e5 solid;
        &:last-child {
          border: none;
        }
        .tx {
          @include display-flex;
          @include align-items-center;
          @include text-align;
          img {
            width: 0.42rem;
            height: 0.42rem;
            border-radius: 50%;
            display: inline-block;
            margin-right: 0.3rem;
          }
          h2 {
            color: #34495e;
            font-size: 0.3rem;
          }
        }
      }
      .out {
        text-align: center;
        height: 0.9rem;
        line-height: 0.9rem;
        display: block;
        color: #f18f68;
        font-size: 0.34rem;
      }
    }
  }
}
.el-collapse-item__header {
  font-size: 0.3rem !important;
}
</style>
