ZZJ
2022-07-14 2b99047683332624832c1dfcae596e957a710b7d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<template>
  <div class="left-menu">
    <div class="user-img">
      <img src="/images/hashrate/s_empty.png" alt="" />
    </div>
    <div class="user-name">{{ userInfo.username }}</div>
 
    <div class="menu-list">
      <div
        class="item"
        @click="pickMenu(index)"
        v-for="(item, index) in menuList"
        :key="index"
        :class="index == activeIndex ? 'active-item' : ''"
      >
        <span class="iconfont">&#xe614;</span>
        <span class="item-name"> {{ item.name }}</span>
      </div>
    </div>
  </div>
</template>
 
<script>
export default {
  created() {
    this.userInfo = JSON.parse(sessionStorage.getItem("userInfo"));
    if (this.$route.query && this.$route.query.id) {
      this.activeIndex = this.$route.query.id;
    }
  },
  data() {
    return {
      menuList: [
        // { name: "账户总览" },
        { name: "订单管理" },
        // { name: "消息中心" },
        { name: "基本资料" },
        { name: "子账户管理" },
      ],
      userInfo: null,
      activeIndex: 0,
    };
  },
  methods: {
    pickMenu(i) {
      this.activeIndex = i;
      this.$emit("mChange", i);
    },
  },
};
</script>
 
<style scoped lang="scss">
.left-menu {
  background: #fff;
  width: 220px;
  min-height: 856px;
  padding: 30px 10px;
  box-sizing: border-box;
  .user-img {
    display: flex;
    justify-content: center;
    margin-bottom: 10px;
    img {
      width: 60px;
      height: 60px;
    }
  }
  .user-name {
    font-size: 18px;
    line-height: 25px;
    color: #3d3d3d;
    text-align: center;
  }
  .menu-list {
    margin-top: 30px;
    .item {
      height: 40px;
      padding-left: 10px;
      border-radius: 4px;
      margin-bottom: 4px;
      cursor: pointer;
      line-height: 40px;
      .iconfont {
        margin-right: 8px;
      }
    }
    .item:not(.active-item):hover {
      background: #e9ebee;
    }
    .active-item {
      background: #0065ff;
      color: #fff;
    }
  }
}
</style>