From a9e8ca26d0fbb736cbf69dd53bc1c32cdef1c180 Mon Sep 17 00:00:00 2001
From: guoxing <1369478551@qq.com>
Date: Mon, 22 May 2023 15:30:00 +0800
Subject: [PATCH] 2023-5-22
---
package.json | 2 +-
src/layout/components/Sidebar/index.vue | 92 +++++++++++-------
src/main.js | 118 ++++++++++++------------
src/router/index.js | 18 ++++
4 files changed, 137 insertions(+), 93 deletions(-)
diff --git a/package.json b/package.json
index 9b9f6e8..3eb3e10 100644
--- a/package.json
+++ b/package.json
@@ -71,4 +71,4 @@
"npm": ">= 3.0.0"
},
"license": "MIT"
-}
\ No newline at end of file
+}
diff --git a/src/layout/components/Sidebar/index.vue b/src/layout/components/Sidebar/index.vue
index 7faa4b2..fda641b 100644
--- a/src/layout/components/Sidebar/index.vue
+++ b/src/layout/components/Sidebar/index.vue
@@ -3,8 +3,8 @@
+ :unique-opened="false" :active-text-color="variables.menuActiveText" :collapse-transition="false"
+ mode="vertical">
@@ -33,7 +33,26 @@
data() {
return {
YongHuid: [],
- routes: [],
+ routes: [{
+ alwaysShow: true,
+ component: "monitor",
+ meta: {
+ icon: "el-icon-menu",
+ title: "视频中心",
+ },
+ name: "",
+ path: "/monitor",
+ children: [{
+ alwaysShow: true,
+ component: "index",
+ meta: {
+ icon: "el-icon-help",
+ title: "视频中心",
+ },
+ name: "/monitor/videos",
+ path: "/monitor/videos",
+ }]
+ }],
params: {
sourceSid: '5b8b2224-7272-4c56-a8d6-1dc426e2f3df',
userSid: '',
@@ -50,16 +69,17 @@
// return this.$router.options.routes
// },
activeMenu() {
- const route = this.$route
- const {
- meta,
- path
- } = route
- // if set path, the sidebar will highlight the path you set
- if (meta.activeMenu) {
- return meta.activeMenu
- }
- return path
+ // const route = this.$route
+ // const {
+ // meta,
+ // path
+ // } = route
+ // // if set path, the sidebar will highlight the path you set
+ // if (meta.activeMenu) {
+ // return meta.activeMenu
+ // }
+ // return path
+ return "/index";
},
showLogo() {
return this.$store.state.settings.sidebarLogo
@@ -77,23 +97,30 @@
methods: {
// 获取用户信息
postHuoquyonghu() {
- var token = getStorage()
- loginDetails(token).then((response) => {
- console.log('resss', response)
- if (response.code === '200') {
- this.YongHuid = response.data
- this.params.userSid = this.YongHuid.sid
- getrolemenus(this.params).then((res) => {
- const userRoles = this.resRouter(res.data)
- userRoles.push({
- path: '*',
- redirect: '/404',
- hidden: true
- })
- return userRoles
- })
- }
- })
+ // var token = getStorage()
+ // loginDetails(token).then((response) => {
+ // console.log('resss', response)
+ // if (response.code === '200') {
+ // this.YongHuid = response.data
+ // this.params.userSid = this.YongHuid.sid
+ // getrolemenus(this.params).then((res) => {
+ // const userRoles = this.resRouter(res.data)
+ // userRoles.push({
+ // path: '*',
+ // redirect: '/404',
+ // hidden: true
+ // })
+ // return userRoles
+ // })
+ // }
+ // })
+ this.routes.push({
+ path: "*",
+ redirect: "/404",
+ hidden: true,
+ });
+ console.log("左侧菜单", this.routes);
+ return this.routes;
},
resRouter(menus) {
// 递归,将后台传来数组
@@ -113,8 +140,7 @@
redirect: menus[i].path,
children: [menus[i]],
}
- }
- else{
+ } else {
// menus[i] = {
// path: menus[i].path,
// component: '',
@@ -129,4 +155,4 @@
},
},
}
-
+
\ No newline at end of file
diff --git a/src/main.js b/src/main.js
index b54f9e5..abea665 100644
--- a/src/main.js
+++ b/src/main.js
@@ -45,14 +45,14 @@ VueAMap.initAMapApiLoader({
Vue.config.productionTip = false
-let token = null
-token = GetQueryString('token')
-if (token) {
- setStorage(token)
- const href = window.location.href
-// href = href.split(`token=${token}`)[0]
-// window.location.href = href.slice(0, href.length - 1)
-}
+// let token = null
+// token = GetQueryString('token')
+// if (token) {
+// setStorage(token)
+// const href = window.location.href
+// // href = href.split(`token=${token}`)[0]
+// // window.location.href = href.slice(0, href.length - 1)
+// }
var one = window.location.href.indexOf('&organizationData') + 18
if (parseInt(one) > 18) {
@@ -67,66 +67,66 @@ if (parseInt(one) > 18) {
// 获取登录用户信息
function getUserInfo() {
- return request({
- baseURL: '/api',
- url: '/portal/v1/sysuser/loginDetails',
- method: 'post',
- headers: {
- 'Content-Type': 'application/json'
- }
- }).then(rep => {
- const data = rep.data
- const user = {
- roleSid: data.roleSid,
- name: data.name,
- userName: data.userName,
- departmentName: data.departmentName, // 部门名称
- departmentSid: data.departmentSid, // 部门sid
- isAdmin: data.isAdmin,
- staffSid: data.staffSid, // 业务员sid
- userSid: data.sid,
- orgSid: data.organizationSid, // 单位sid
- Orgname: data.organizationName,
- dwjb: data.dwjb,
- orgNamePath: data.orgNamePath, // 使用组织全路径名称
- orgSidPath: data.orgSidPath // 使用组织全路径Sid
- }
- // 结果存入缓存
- window.sessionStorage.setItem('staffSid', user.staffSid)
- window.sessionStorage.setItem('userSid', user.userSid)
- window.sessionStorage.setItem('Orgname', user.Orgname)
- window.sessionStorage.setItem('orgSid', user.orgSid)
- window.sessionStorage.setItem('departmentName', user.departmentName)
- window.sessionStorage.setItem('name', user.name)
- window.sessionStorage.setItem('user', user)
- window.sessionStorage.setItem('departmentName', user.departmentName)
- window.sessionStorage.setItem('departmentSid', user.departmentSid)
- window.sessionStorage.setItem('orgNamePath', user.orgNamePath)
- window.sessionStorage.setItem('orgSidPath', user.orgSidPath)
+ // return request({
+ // baseURL: '/api',
+ // url: '/portal/v1/sysuser/loginDetails',
+ // method: 'post',
+ // headers: {
+ // 'Content-Type': 'application/json'
+ // }
+ // }).then(rep => {
+ // const data = rep.data
+ // const user = {
+ // roleSid: data.roleSid,
+ // name: data.name,
+ // userName: data.userName,
+ // departmentName: data.departmentName, // 部门名称
+ // departmentSid: data.departmentSid, // 部门sid
+ // isAdmin: data.isAdmin,
+ // staffSid: data.staffSid, // 业务员sid
+ // userSid: data.sid,
+ // orgSid: data.organizationSid, // 单位sid
+ // Orgname: data.organizationName,
+ // dwjb: data.dwjb,
+ // orgNamePath: data.orgNamePath, // 使用组织全路径名称
+ // orgSidPath: data.orgSidPath // 使用组织全路径Sid
+ // }
+ // // 结果存入缓存
+ // window.sessionStorage.setItem('staffSid', user.staffSid)
+ // window.sessionStorage.setItem('userSid', user.userSid)
+ // window.sessionStorage.setItem('Orgname', user.Orgname)
+ // window.sessionStorage.setItem('orgSid', user.orgSid)
+ // window.sessionStorage.setItem('departmentName', user.departmentName)
+ // window.sessionStorage.setItem('name', user.name)
+ // window.sessionStorage.setItem('user', user)
+ // window.sessionStorage.setItem('departmentName', user.departmentName)
+ // window.sessionStorage.setItem('departmentSid', user.departmentSid)
+ // window.sessionStorage.setItem('orgNamePath', user.orgNamePath)
+ // window.sessionStorage.setItem('orgSidPath', user.orgSidPath)
new Vue({
el: '#app',
router,
store,
render: h => h(App)
})
- })
+ // })
}
getUserInfo()
-function GetQueryString(name) {
- var one = window.location.href.indexOf('?token=') + 7
- if (one < 7) { return null }
- var two = window.location.href.lastIndexOf('&') // + 1
- var data = window.location.href.substr(one)
- if (two > one) {
- data = window.location.href.slice(one, two)
- console.log('token', data)
- }
- if (data) {
- return data
- }
- return null
+// function GetQueryString(name) {
+// var one = window.location.href.indexOf('?token=') + 7
+// if (one < 7) { return null }
+// var two = window.location.href.lastIndexOf('&') // + 1
+// var data = window.location.href.substr(one)
+// if (two > one) {
+// data = window.location.href.slice(one, two)
+// console.log('token', data)
+// }
+// if (data) {
+// return data
+// }
+// return null
// var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)')
// var r = window.location.search.substr(1).match(reg)
// if (r != null) return unescape(r[2]); return null
-}
+// }
diff --git a/src/router/index.js b/src/router/index.js
index 1f4b308..794ac49 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -46,6 +46,24 @@ export const constantRoutes = [
}
}]
},
+ {
+ path: '/monitor',
+ component: Layout,
+ redirect: null,
+ meta: {
+ title: '视频中心'
+ },
+ children: [{
+ path: '/monitor/videos',
+ component: () =>
+ import('@/views/monitor/videos/index.vue'),
+ name: 'index',
+ meta: {
+ title: '视频中心'
+ }
+ }
+ ]
+ },
...codemenu,
{
path: '/404',