zxl
18 小时以前 cb084b230023cfed42249b0145e177deb4b8261c
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
<template>
  <div>
    <BaseHeader></BaseHeader>
 
    <div class="container width_1200">
      <Layout class="layoutAll">
        <Sider class="side-bar" ref="side" :collapsed-width="78">
          <Menu
            class="side-menu"
            theme="light"
            width="auto"
            :active-name="$route.name"
            :open-names="['订单中心', '会员中心', '账户中心']"
            @on-select="onSelect"
          >
            <div class="user-icon">
              <div class="user-img">
                <img
                  :src="userInfo.face"
                  style="width: 100%; height: 100%"
                  v-if="userInfo.face"
                  alt
                />
                <Avatar icon="ios-person" class="mb_10" v-else size="96" />
              </div>
              <p>{{ userInfo.nickName }}</p>
            </div>
 
            <!--   循环导航栏       -->
            <Submenu
              v-for="(menu, index) in menuList"
              :key="index"
              :name="menu.title"
            >
              <template slot="title" v-if="menu.display">
                <Icon type="location"></Icon>
                <span>{{ menu.title }}</span>
              </template>
              <MenuItem
                v-for="(chlidren, i) in menu.menus"
                :key="i"
                :name="chlidren.path"
                >{{ chlidren.title }}</MenuItem
              >
            </Submenu>
          </Menu>
        </Sider>
        <Layout class="layout ml_10">
          <Content class="content">
            <transition mode="out-in">
              <router-view></router-view>
            </transition>
          </Content>
        </Layout>
      </Layout>
    </div>
  </div>
</template>
 
<script>
import menuList from "./menu";
import Storage from "@/plugins/storage.js";
 
export default {
  name: "Home",
  data() {
    return {
      menuList, // 会员中心左侧列表
    };
  },
  computed: {
    userInfo() {
      // 用户信息
      if (Storage.getItem("userInfo")) {
        return JSON.parse(Storage.getItem("userInfo"));
      } else {
        return {};
      }
    },
  },
 
  methods: {
    // 每次点击左侧bar的callback
    onSelect(name) {
      this.$router.push({ name: name });
    },
  },
};
</script>
 
<style scoped lang="scss">
.content {
  padding: 15px 50px;
}
 
.header {
  @include background_color($light_background_color);
}
 
.side-menu,
.side-bar,
.content {
  @include white_background_color();
  @include title_color($light_title_color);
}
 
.side-bar {
  min-height: 600px;
  height: auto;
}
 
.layoutAll {
  min-height: 1200px;
  @include background_color($light_background_color);
}
 
.container {
  margin: 0 auto;
  padding: 20px 0;
}
 
.side-bar a {
  @include title_color($light_title_color);
}
 
.user-icon {
  height: 200px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}
 
.user-img {
  margin-bottom: 15px;
  width: 96px;
  height: 96px;
  border-radius: 48px;
  overflow: hidden;
}
 
.layout-footer-center {
  padding: 0px 15px;
 
  padding-bottom: 15px;
  text-align: center;
}
</style>