<template>
  <div class="user">
    <!-- 标题栏 -->
    <HeaderCon :username="username"></HeaderCon>
    <div class="user_main">
      <div class="sider">
        <div
          :class="[current == item.name ? 'sider_item active' : 'sider_item ']"
          v-for="item in siderArr"
          :key="item.name"
          @click="changepage(item.name)"
        >
          <img
            :src="current == item.name ? item.img_select : item.img"
            alt=""
            class="sider_item_img"
          />
          <div
            :class="[
              current == item.name
                ? ' sider_item_name active '
                : 'sider_item_name',
            ]"
          >
            {{ item.name }}
          </div>
        </div>
      </div>
      <router-view></router-view>
    </div>
  </div>
</template>
<script>
import HeaderCon from "../../components/HeaderCon.vue";
export default {
  name: "usersetting",
  components: {
    HeaderCon,
  },
  data() {
    return {
      current: "个人信息",
      username: "",
      siderArr: [
        {
          name: "个人信息",
          img: require("@/static/user/icon-grxx.png"),
          img_select: require("@/static/user/icon-grxx-select.png"),
        },
        {
          name: "安全设置",
          img: require("@/static/user/icon-nav02.png"),
          img_select: require("@/static/user/icon-aqsz-select.png"),
        },
      ],
    };
  },
  methods: {
    changepage(name) {
      // console.log(name)

      switch (name) {
        case "个人信息":
          this.$router.push({
            path: "/personalSetting",
          });
          break;
        case "安全设置":
          this.$router.push({
            path: "/securitySetting",
          });
          break;
      }
      this.current = name;
    },
  },
};
</script>
<style lang="less" scoped>
.user {
  width: calc(100%);
  height: 100%;
  .user_main {
    height: calc(100% - 65px);
    width: 100%;
    background-color: #ebebeb;
    display: flex;
    .home_con {
      background-color: #ebebeb;
      padding-left: 30px;
      width: calc(100% -80px);
      flex: 1;
      .nav_bread {
        height: 50px;
        padding: 20px 3px;
        background-color: #ebebeb;
      }
    }
  }
  .sider {
    // height: calc(100% - 70px);
    background-color: #002d70;
    width: 80px;
    .sider_item {
      height: 100px;
      text-align: center;
      padding: 20px 10px 20px 0;
      .sider_item_img {
        width: 27px;
      }
      .sider_item_name {
        margin-top: 10px;
        color: #848bad;
        font-size: 14px;
        text-align: center;
      }
      .active {
        color: #fff;
      }
    }
    .active {
      background-color: #124795;
      color: #fff;
    }
  }
}
</style>
