panlei
2020-03-13 3bd017317fdbbe13a1742f5db75f4196e482c504
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
<template>
  <div class="left-slide">
    <el-menu
      default-active="2"
      class="el-menu-vertical-demo"
      @open="handleOpen"
      @close="handleClose"
      :router="true"
      background-color="#545c64"
      text-color="#fff"
      style="height:100%;text-align:left"
      active-text-color="#ffd04b">
      <el-menu-item index="Home">
        <i class="el-icon-document"></i>
        <span slot="title">首页</span>
      </el-menu-item>
      <el-menu-item index="ProductCenter">
        <i class="el-icon-menu"></i>
        <span slot="title">产品中心</span>
      </el-menu-item>
      <el-submenu index="API">
        <template slot="title">
          <i class="el-icon-location"></i>
          <span>API</span>
        </template>
        <el-menu-item-group>
          <el-menu-item index="1-1">选项1</el-menu-item>
          <el-menu-item index="1-2">选项2</el-menu-item>
        </el-menu-item-group>
      </el-submenu>
      
      <el-submenu index="Manage">
        <template slot="title">
          <i class="el-icon-location"></i>
          <span>管理</span>
        </template>
        <el-menu-item-group>
          <el-menu-item index="Manage-order">我的订单</el-menu-item>
          <el-menu-item index="Manage-device">我的设备</el-menu-item>
          <el-menu-item index="Manage-invoice">发票管理</el-menu-item>
        </el-menu-item-group>
      </el-submenu>
    </el-menu>
  </div>
</template>
 
<script>
 
 
import bus from "../main";
 
export default {
  components: {
 
  },
  props: {
    height: {
      type: Number,
      default: 0
    }
  },
 
  computed: {
 
    isAdmin() {
      if (
        sessionStorage.getItem("userInfo") &&
        sessionStorage.getItem("userInfo") !== ""
      ) {
        let loginName = JSON.parse(sessionStorage.getItem("userInfo")).username;
        return loginName === "superadmin" || loginName === "basic";
      }
      return false;
    }
  },
  data() {
    return {
    }
  },
  watch: {
    $route(to, from) {
      switch (to.name) {
        case "Searching":
          this.cameraAuth = "videoSearch:camera"
          this.dataStack = "videoSearch:dataStack"
          break
        case "VideoManage":
          this.cameraAuth = "VIDEOCAMERA:camera"
          this.dataStack = "VIDEOCAMERA:video"
          break
        default:
          this.cameraAuth = "videoMonitor:camera"
          this.dataStack = "videoMonitor:dataStack"
      }
      console.log("路由变化:", to, from)
    }
  },
  created() {
    if (this.isShow('VIDEOCAMERA:camera')) {
      this.TreeDataPool.treeActiveName = "camera"
    } else if (this.isShow('VIDEOCAMERA:video')) {
      this.TreeDataPool.treeActiveName = "localVedio"
    } else if (this.isShow('VIDEOCAMERA:image')) {
      this.TreeDataPool.treeActiveName = "localPic"
    } else if (this.isShow('VIDEOCAMERA:audio')) {
      this.TreeDataPool.treeActiveName = "localAudio"
    }
    this.TreeDataPool.fetchTreeData().then(_ => {
      if (this.$route.path == '/Layout/Searching') {
        this.TreeDataPool.filterLocalVideoWell()
      }
    });
  },
  mounted() {
    this.$nextTick(() => {
      bus.$on("slideLeft", () => {
        this.TreeDataPool.showTreeBox = !this.TreeDataPool.showTreeBox;
      });
    });
  },
  methods: {
    handleOpen(key, keyPath) {
        console.log(key, keyPath);
    },
    handleClose(key, keyPath) {
      console.log(key, keyPath);
    }
  }
};
</script>
 
<style lang="scss">
.left-slide {
  width: 300px;
  height: 700px;
 
}
</style>