heyujie
2021-11-09 660bd554d74c81b683e68f7f579db0912e248d36
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
174
175
176
177
178
179
180
181
182
<template>
  <div class="left-nav" :class="{ short: isCollapse }">
    <img class="icon" src="/images/shuohuang/railroad.png" />
    <h1>
      <span v-show="!isCollapse" style="padding-left: 6px"
        >乘务员安全行为识别系统</span
      >
    </h1>
    <el-menu
      class="el-menu-vertical-demo"
      @open="handleOpen"
      @close="handleClose"
      :default-active="activeIndex"
      @select="handleSelect"
    >
      <el-menu-item index="guideIndex" v-show="isAdmin">
        <i class="iconfont iconshouye"></i>
        <span slot="title">首页</span>
      </el-menu-item>
      <el-menu-item index="searchForVideoAnalyze">
        <i class="iconfont iconshipin2"></i>
        <span slot="title">视频分析检索</span>
      </el-menu-item>
      <el-menu-item index="taskManage" v-if="isAdmin">
        <i class="iconfont iconrenwu1"></i>
        <span slot="title">任务管理</span>
      </el-menu-item>
      <el-menu-item index="memberManage" v-if="isAdmin">
        <i class="iconfont iconrenyuanguanli"></i>
        <span slot="title">人员管理</span>
      </el-menu-item>
      <el-menu-item index="configManage" v-if="isAdmin">
        <i class="iconfont iconicon-test4"></i>
        <span slot="title">配置管理</span>
      </el-menu-item>
 
      <el-submenu index="6">
        <template slot="title">
          <i class="iconfont iconcunchu"></i>
          <span slot="title">转储管理</span>
        </template>
        <el-menu-item index="transferMemo">视频转储记录</el-menu-item>
        <el-menu-item index="transferDeviceManage">转储设备管理</el-menu-item>
        <el-menu-item index="lkgManage">LKJ数据管理</el-menu-item>
      </el-submenu>
      <el-submenu index="7" v-if="isAdmin">
        <template slot="title">
          <i class="iconfont iconkeshihua"></i>
          <span slot="title">可视化大屏</span>
        </template>
        <el-menu-item index="taskscreen">任务大屏</el-menu-item>
        <el-menu-item index="hiddendangerscreen">隐患大屏</el-menu-item>
      </el-submenu>
    </el-menu>
  </div>
</template>
 
<script>
//import railroadImg from '/images/shuohuang/railroad.png';
export default {
  props: {
    isCollapse: {
      type: Boolean,
      default: true,
    },
    menuChange: {
      type: Function,
    },
  },
  computed: {
    isAdmin() {
      if (
        sessionStorage.getItem("userInfo") &&
        sessionStorage.getItem("userInfo") !== ""
      ) {
        let loginName = JSON.parse(sessionStorage.getItem("userInfo")).username;
        return loginName === "admin" || loginName === "basic";
      }
      return false;
    },
  },
  data() {
    return {
      publicPath: process.env.BASE_URL,
      activeIndex: "guideIndex",
    };
  },
  mounted() {
    // if (this.isAdmin) {
    //   if (!!sessionStorage.getItem('leftNavAct')) {
    //     console.log("leftNavAct")
    //     this.activeIndex = sessionStorage.getItem('leftNavAct');
    //   }
    // }
    this.activeIndex = this.isAdmin ? "guideIndex" : "searchForVideoAnalyze";
 
    this.$emit("menuChange", this.activeIndex);
  },
  methods: {
    handleSelect(index, indePath) {
      this.activeIndex = index;
      sessionStorage.setItem("leftNavAct", this.activeIndex);
      this.$emit("menuChange", index);
    },
    handleOpen() {},
    handleClose() {},
  },
};
</script>
 
<style lang="scss">
.left-nav {
  background-image: url(/images/shuohuang/背景.png);
  height: 100vh;
  width: 250px;
  img {
    margin-top: 80px;
    margin-bottom: 10px;
    height: 96px;
    width: 96px;
  }
  h1 {
    height: 65px;
    padding: 0 20px;
    border-bottom: 1px solid #eee;
    border: none;
    span {
      color: #fff;
    }
  }
  .iconfont {
    padding-right: 10px;
  }
  .el-menu-vertical-demo:not(.el-menu--collapse) {
    border: none;
    padding-right: 0;
    padding-left: 50px;
    width: 250px;
    background: none;
  }
  .el-menu.el-menu--inline {
    background: none;
  }
  .el-menu-item,
  .el-submenu__title {
    text-align: left;
    font-weight: 700;
    color: #fff;
 
    span {
      color: #fff;
    }
    i {
      color: #fff;
    }
    &:hover {
      color: #0b41a7;
 
      span {
        color: #0b41a7;
      }
      i {
        color: #0b41a7;
      }
    }
    border-radius: 10px 0 0 10px;
  }
  .el-menu-item.is-active {
    background-color: #ecf0fc;
    color: #0b41a7;
 
    span {
      color: #0b41a7;
    }
  }
}
 
.short {
  width: 0;
  overflow: hidden;
}
</style>