<template>
  <div class="mainBox">
    <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 class="myTitle">我的</div> -->
      <div class="mybanner">
        <img class="bannerOne" src="../../assets/my/myBanner.png" alt />
        <div class="avatar">
          <img src="../../assets/my/avatar.png" alt />
          <p>{{ user_name }}</p>
        </div>
      </div>
      <div class="list">
        <router-link to="/ElectronicSignature">
          <div class="name">
            <div class="left">
              <img src="../../assets/my/name.png" alt />
              <span>电子签名</span>
            </div>
            <span class="iconfont jiantou">&#xe6f9;</span>
          </div>
        </router-link>
        <!-- <router-link to="/ChangePassword"> -->
        <div class="name" style="display:none">
          <div class="left">
            <img src="../../assets/my/modification.png" alt />
            <span>修改密码</span>
          </div>
          <span class="iconfont jiantou">&#xe6f9;</span>
        </div>
        <!-- </router-link> -->
        <div class="name" @click="logout">
          <div class="left">
            <img src="../../assets/my/exit.png" alt />
            <span>退出登录</span>
          </div>
          <span class="iconfont jiantou">&#xe6f9;</span>
        </div>
      </div>
    </div>
    <side-bar :active_index="3"></side-bar>
  </div>
</template>

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

export default {
  name: "PersonalIndex",
  components: {
    SideBar,
    EditPersonal
  },
  data() {
    return {
      electronicsignature: "",
      myinfo: {},
      avatar: "@/assets/product/test.jpg",
      user_name: ""
    };
  },
  created() {
    this.GetMyInfo();
  },
  methods: {
    GetMyInfo() {
      GetMyInfo().then(response => {
        if (response.data.state == 1) {
          var roleInfo = response.data.data.roleInfo;
          this.user_name = roleInfo.user_name;
          console.log("hhhhhhhhhhhhh", response.data.data.roleInfo);
          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.3rem 0;
    // color: $title-color;
    text-align: center;
    position: fixed;
    top: 0;
    left: 0;
    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;
}
.mainBox {
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  > :first-child {
    flex: 1;
    overflow: auto;
  }
  .myTitle {
    height: 1.4rem;
    line-height: 1.4rem;
    width: 100%;
    background: #3275fd;
    text-align: center;
    color: #fff;
    font-size: 0.6rem;
  }
  .mybanner {
    height: 30%;
    position: relative;
    .bannerOne {
      position: absolute;
    }
    img {
      width: 100%;
      height: 100%;
    }
    .avatar {
      position: absolute;
      width: 4rem;
      top: 1.3rem;
      left: 0;
      right: 0;
      bottom: 0;
      margin: auto;
      text-align: center;
      img {
        width: 2.5rem;
        height: 2.5rem;
      }
      p {
        font-size: 0.5rem;
        color: #fff;
        margin-top: 0.2rem;
      }
    }
  }
  .name {
    display: flex;
    height: 1.8rem;
    line-height: 1.8rem;
    background: #fff;
    margin: 0 0.4rem;
    padding: 0 0.4rem;
    display: flex;
    justify-content: space-between;
    border-radius: 5px;
    margin-top: 0.5rem;
    .left {
      height: 100%;
      line-height: 1.8rem;
      display: flex;
      align-items: center;
      span {
        color: #34495e;
        font-size: 0.5rem;
        margin-left: 0.4rem;
      }
    }
    img {
      width: 1rem;
      height: 1rem;
      display: inline-block;
    }
    .jiantou {
      font-size: 0.6rem;
    }
  }
}
</style>
