diff --git a/src/components/common/Sidebar.vue b/src/components/common/Sidebar.vue index 36e2e95..cd36e91 100644 --- a/src/components/common/Sidebar.vue +++ b/src/components/common/Sidebar.vue @@ -69,11 +69,11 @@ export default { index: "/pictureRotation", title: "图片轮巡", }, - // { - // icon: "el-icon-bell", - // index: "photoAlarm", - // title: "告警处理", - // }, + { + icon: "el-icon-bell", + index: "photoAlarm", + title: "告警处理", + }, { icon: "el-icon-search", @@ -129,6 +129,73 @@ export default { ], }, ], + items2: [ + // { + // icon: "el-icon-s-home", + // index: "stritl", + // title: "首页", + // }, + { + icon: "el-icon-camera", + index: "/realTimeMonitor", + title: "实时监控", + }, + + { + icon: "el-icon-film", + index: "/pictureRotation", + title: "图片轮巡", + }, + // { + // icon: "el-icon-bell", + // index: "photoAlarm", + // title: "告警处理", + // }, + + { + icon: "el-icon-search", + index: "/realTimeSearch", + title: "历史图片", + }, + { + icon: "el-icon-files", + index: "/property", + title: "资产管理", + subs: [ + { + index: "/lineInformation", + title: "线路信息管理", + }, + { + index: "/towerInformation", + title: "杆塔信息管理", + }, + + { + index: "/cameraChannel", + title: "通道管理", + }, + { + index: "/photographicDevice", + title: "拍照装置管理", + }, + { + index: "/devicePhotoSchedule", + title: "拍照时间表设置", + }, + // { + // index: "/deviceUpgrade", + // title: "装置升级", + // }, + // { + // icon: "el-icon-picture-outline", + // index: "imageSettings", + // title: "图像采集参数设置", + // }, + ], + }, + ], + role: "", }; }, watch: { @@ -143,6 +210,16 @@ export default { }, created() { this.setCurrentRoute(); + this.role = localStorage.getItem("role"); + console.log("用户管理"); + console.log(this.role); + + if (this.role == 1) { + this.items = this.items; + } else { + this.items = this.items2; + } + console.log(this.items); }, }; diff --git a/src/main.js b/src/main.js index e635630..d0b018c 100644 --- a/src/main.js +++ b/src/main.js @@ -50,7 +50,7 @@ Viewer.setDefaults({ //使用钩子函数对路由进行权限跳转 router.beforeEach((to, from, next) => { document.title = `${to.meta.title} | 视频监控可视化平台`; - const role = localStorage.getItem("userName"); + const role = localStorage.getItem("role"); const token = localStorage.getItem("token"); console.log(role, token); if (!token && to.path !== "/login") { diff --git a/src/store/index.js b/src/store/index.js index 44e56ff..55102b3 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -8,15 +8,17 @@ export default new Vuex.Store({ //用户登录token 存储 token: "", userName: "", - userid:'', + userid: "", channelid: "", termid: "", + role: "", }, getters: { channelid: (state) => state.channelid, token: (state) => state.token, userName: (state) => state.userName, + role: (state) => state.role, }, mutations: { //保存通道id @@ -39,9 +41,11 @@ export default new Vuex.Store({ }, SET_USERINFO(state, val) { state.userName = val.userName; - state.userid = val.id + state.userid = val.id; + state.role = val.role; localStorage.setItem("userName", state.userName); localStorage.setItem("userid", state.userid); + localStorage.setItem("role", state.role); }, //退出清除locastorge REMOVE_INFO(state) { diff --git a/src/views/Login.vue b/src/views/Login.vue index 8b5192b..1e77da2 100644 --- a/src/views/Login.vue +++ b/src/views/Login.vue @@ -70,8 +70,8 @@ export default { data: function () { return { userInfo: { - userName: "admin", - password: "123456", + userName: "", + password: "", //verificationCode: "", }, rules: { diff --git a/src/views/components/carouselChart.vue b/src/views/components/carouselChart.vue index 9e781ff..337038c 100644 --- a/src/views/components/carouselChart.vue +++ b/src/views/components/carouselChart.vue @@ -29,7 +29,7 @@ class="showPic" @click="closePic" > -