Browse Source

2023-5-22

master
guoxing 2 years ago
parent
commit
a9e8ca26d0
  1. 86
      src/layout/components/Sidebar/index.vue
  2. 118
      src/main.js
  3. 18
      src/router/index.js

86
src/layout/components/Sidebar/index.vue

@ -33,7 +33,26 @@
data() { data() {
return { return {
YongHuid: [], 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: { params: {
sourceSid: '5b8b2224-7272-4c56-a8d6-1dc426e2f3df', sourceSid: '5b8b2224-7272-4c56-a8d6-1dc426e2f3df',
userSid: '', userSid: '',
@ -50,16 +69,17 @@
// return this.$router.options.routes // return this.$router.options.routes
// }, // },
activeMenu() { activeMenu() {
const route = this.$route // const route = this.$route
const { // const {
meta, // meta,
path // path
} = route // } = route
// if set path, the sidebar will highlight the path you set // // if set path, the sidebar will highlight the path you set
if (meta.activeMenu) { // if (meta.activeMenu) {
return meta.activeMenu // return meta.activeMenu
} // }
return path // return path
return "/index";
}, },
showLogo() { showLogo() {
return this.$store.state.settings.sidebarLogo return this.$store.state.settings.sidebarLogo
@ -77,23 +97,30 @@
methods: { methods: {
// //
postHuoquyonghu() { postHuoquyonghu() {
var token = getStorage() // var token = getStorage()
loginDetails(token).then((response) => { // loginDetails(token).then((response) => {
console.log('resss', response) // console.log('resss', response)
if (response.code === '200') { // if (response.code === '200') {
this.YongHuid = response.data // this.YongHuid = response.data
this.params.userSid = this.YongHuid.sid // this.params.userSid = this.YongHuid.sid
getrolemenus(this.params).then((res) => { // getrolemenus(this.params).then((res) => {
const userRoles = this.resRouter(res.data) // const userRoles = this.resRouter(res.data)
userRoles.push({ // userRoles.push({
path: '*', // path: '*',
redirect: '/404', // redirect: '/404',
hidden: true // hidden: true
}) // })
return userRoles // return userRoles
}) // })
} // }
}) // })
this.routes.push({
path: "*",
redirect: "/404",
hidden: true,
});
console.log("左侧菜单", this.routes);
return this.routes;
}, },
resRouter(menus) { resRouter(menus) {
// //
@ -113,8 +140,7 @@
redirect: menus[i].path, redirect: menus[i].path,
children: [menus[i]], children: [menus[i]],
} }
} } else {
else{
// menus[i] = { // menus[i] = {
// path: menus[i].path, // path: menus[i].path,
// component: '', // component: '',

118
src/main.js

@ -45,14 +45,14 @@ VueAMap.initAMapApiLoader({
Vue.config.productionTip = false Vue.config.productionTip = false
let token = null // let token = null
token = GetQueryString('token') // token = GetQueryString('token')
if (token) { // if (token) {
setStorage(token) // setStorage(token)
const href = window.location.href // const href = window.location.href
// href = href.split(`token=${token}`)[0] // // href = href.split(`token=${token}`)[0]
// window.location.href = href.slice(0, href.length - 1) // // window.location.href = href.slice(0, href.length - 1)
} // }
var one = window.location.href.indexOf('&organizationData') + 18 var one = window.location.href.indexOf('&organizationData') + 18
if (parseInt(one) > 18) { if (parseInt(one) > 18) {
@ -67,66 +67,66 @@ if (parseInt(one) > 18) {
// 获取登录用户信息 // 获取登录用户信息
function getUserInfo() { function getUserInfo() {
return request({ // return request({
baseURL: '/api', // baseURL: '/api',
url: '/portal/v1/sysuser/loginDetails', // url: '/portal/v1/sysuser/loginDetails',
method: 'post', // method: 'post',
headers: { // headers: {
'Content-Type': 'application/json' // 'Content-Type': 'application/json'
} // }
}).then(rep => { // }).then(rep => {
const data = rep.data // const data = rep.data
const user = { // const user = {
roleSid: data.roleSid, // roleSid: data.roleSid,
name: data.name, // name: data.name,
userName: data.userName, // userName: data.userName,
departmentName: data.departmentName, // 部门名称 // departmentName: data.departmentName, // 部门名称
departmentSid: data.departmentSid, // 部门sid // departmentSid: data.departmentSid, // 部门sid
isAdmin: data.isAdmin, // isAdmin: data.isAdmin,
staffSid: data.staffSid, // 业务员sid // staffSid: data.staffSid, // 业务员sid
userSid: data.sid, // userSid: data.sid,
orgSid: data.organizationSid, // 单位sid // orgSid: data.organizationSid, // 单位sid
Orgname: data.organizationName, // Orgname: data.organizationName,
dwjb: data.dwjb, // dwjb: data.dwjb,
orgNamePath: data.orgNamePath, // 使用组织全路径名称 // orgNamePath: data.orgNamePath, // 使用组织全路径名称
orgSidPath: data.orgSidPath // 使用组织全路径Sid // orgSidPath: data.orgSidPath // 使用组织全路径Sid
} // }
// 结果存入缓存 // // 结果存入缓存
window.sessionStorage.setItem('staffSid', user.staffSid) // window.sessionStorage.setItem('staffSid', user.staffSid)
window.sessionStorage.setItem('userSid', user.userSid) // window.sessionStorage.setItem('userSid', user.userSid)
window.sessionStorage.setItem('Orgname', user.Orgname) // window.sessionStorage.setItem('Orgname', user.Orgname)
window.sessionStorage.setItem('orgSid', user.orgSid) // window.sessionStorage.setItem('orgSid', user.orgSid)
window.sessionStorage.setItem('departmentName', user.departmentName) // window.sessionStorage.setItem('departmentName', user.departmentName)
window.sessionStorage.setItem('name', user.name) // window.sessionStorage.setItem('name', user.name)
window.sessionStorage.setItem('user', user) // window.sessionStorage.setItem('user', user)
window.sessionStorage.setItem('departmentName', user.departmentName) // window.sessionStorage.setItem('departmentName', user.departmentName)
window.sessionStorage.setItem('departmentSid', user.departmentSid) // window.sessionStorage.setItem('departmentSid', user.departmentSid)
window.sessionStorage.setItem('orgNamePath', user.orgNamePath) // window.sessionStorage.setItem('orgNamePath', user.orgNamePath)
window.sessionStorage.setItem('orgSidPath', user.orgSidPath) // window.sessionStorage.setItem('orgSidPath', user.orgSidPath)
new Vue({ new Vue({
el: '#app', el: '#app',
router, router,
store, store,
render: h => h(App) render: h => h(App)
}) })
}) // })
} }
getUserInfo() getUserInfo()
function GetQueryString(name) { // function GetQueryString(name) {
var one = window.location.href.indexOf('?token=') + 7 // var one = window.location.href.indexOf('?token=') + 7
if (one < 7) { return null } // if (one < 7) { return null }
var two = window.location.href.lastIndexOf('&') // + 1 // var two = window.location.href.lastIndexOf('&') // + 1
var data = window.location.href.substr(one) // var data = window.location.href.substr(one)
if (two > one) { // if (two > one) {
data = window.location.href.slice(one, two) // data = window.location.href.slice(one, two)
console.log('token', data) // console.log('token', data)
} // }
if (data) { // if (data) {
return data // return data
} // }
return null // return null
// var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)') // var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)')
// var r = window.location.search.substr(1).match(reg) // var r = window.location.search.substr(1).match(reg)
// if (r != null) return unescape(r[2]); return null // if (r != null) return unescape(r[2]); return null
} // }

18
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, ...codemenu,
{ {
path: '/404', path: '/404',

Loading…
Cancel
Save