杨磊
3 天以前 a5abb70a428f59894fc9ee4330f0033d6fe93a8b
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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
<template>
  <div class="homeLayoutBox">
    <div class="leftMenu">
      <div class="leftMenuTitle" @click="$router.push('/home')">王永炎院士</div>
      <div class="leftMenuContent">
        <p>学术思想传承</p>
        <p>多维度数据库</p>
      </div>
      <div class="leftMenuList">
        <div
          class="menuItem"
          :class="{ active: $route.path == item.path }"
          v-for="(item, index) in menuList"
          :key="index"
          @click="$router.push(item.path)"
        >
          <div class="iconBox">
            <img class="autoImg" :src="item.activeIcon" alt="" v-if="$route.path == item.path">
            <img class="autoImg" :src="item.icon" alt="" v-else>
          </div>
          <div class="menuText">{{ item.name }}</div>
        </div>
      </div>
    </div>
    <div class="pageContentBox">
      <keep-alive v-if="keepAliveList.length > 0" :include="keepAliveList">
        <router-view />
      </keep-alive>
      <router-view v-else />
    </div>
  </div>
</template>
 
<script>
import { mapState } from "vuex";
import nianpu1 from "@/assets/images/menuIcon/nianpu1.png";
import nianpu from "@/assets/images/menuIcon/nianpu.png";
import mulu from "@/assets/images/menuIcon/mulu.png";
import mulu1 from "@/assets/images/menuIcon/mulu1.png";
import rongyu from "@/assets/images/menuIcon/rongyu.png";
import rongyu1 from "@/assets/images/menuIcon/rongyu1.png";
import xueshu from "@/assets/images/menuIcon/xueshu.png";
import xueshu1 from "@/assets/images/menuIcon/xueshu1.png";
export default {
  computed: {
    ...mapState(["userInfo", "keepAliveList"]),
  },
  watch: {
    $route(to, from) {
      if (to.meta.keepAlive && this.keepAliveList.indexOf(to.name) == -1) {
        this.$store.commit("addKeepAlive", to.name);
      }
    },
  },
  data() {
    return {
      menuList: [
        {
          name: "年谱",
          path: "/chronology",
          icon: nianpu1,
          activeIcon: nianpu,
        },
        {
          name: "学术成果",
          path: "/achievements",
          icon: xueshu,
          activeIcon: xueshu1,
        },
        {
          name: "荣誉奖项",
          path: "/honor",
          icon: rongyu,
          activeIcon: rongyu1,
        },
        {
          name: "学生名录",
          path: "/directory",
          icon: mulu,
          activeIcon: mulu1,
        },
      ],
    };
  },
};
</script>
 
<style lang="less" scoped>
 
.iconBox{
  width: 70px;
  height: 70px;
  position: relative;
}
.homeLayoutBox {
  height: 100%;
  display: flex;
  // background-image: url("@/assets/images/homeBg.png");
  // background-repeat: no-repeat;
  // background-size: 100% 95%;
  .pageContentBox {
    width: 100%;
    min-height: calc(100% - 525px);
  }
 
  .active {
    background: #6f5a3a;
    color: #fff;
  }
 
  .leftMenu {
    width: 200px;
    height: 100%;
    background: #937950;
    display: flex;
    flex-direction: column;
    font-family: Alimama DongFangDaKai;
 
    .leftMenuTitle {
      width: 100%;
      height: 50px;
      line-height: 50px;
      text-align: center;
      color: #fff;
      font-size: 24px;
    }
 
    .leftMenuContent {
      font-size: 20px;
      line-height: 30px;
      color: #fff;
      margin: 10px 20px;
      padding: 10px 0;
      text-align: center;
      border-top: 1px solid #fff;
      border-bottom: 1px solid #fff;
    }
 
    .leftMenuList > menuItem:first-child {
      border-top: 1px solid #fff;
    }
 
    .leftMenuList {
      display: flex;
      flex-direction: column;
      justify-content: space-around;
      border-top: 1px solid #b9a587;
      margin-top: 20px;
 
      .menuItem {
        width: 100%;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        text-align: center;
        color: #decaac;
        font-size: 24px;
        border-bottom: 1px solid #b9a587;
        height: 18vh;
        cursor: pointer;
        .menuText {
          line-height: 50px;
        }
 
        i {
          font-size: 34px;
        }
      }
    }
  }
}
</style>