Commit 16bcc222 authored by zengyilun's avatar zengyilun

修复收缩侧边栏

parent 0175021f
import axios from 'axios' import axios from 'axios'
import config from './config' import config from './config'
import systemSafety from './systemSafety'
{{#serviceMonitor}} {{#serviceMonitor}}
import serviceMonitor from './serviceMonitor' import serviceMonitor from './serviceMonitor'
{{/serviceMonitor}} {{/serviceMonitor}}
...@@ -13,9 +14,6 @@ import systemMonitor from './systemMonitor' ...@@ -13,9 +14,6 @@ import systemMonitor from './systemMonitor'
{{#serverMonitor}} {{#serverMonitor}}
import serverMonitor from './serverMonitor' import serverMonitor from './serverMonitor'
{{/serverMonitor}} {{/serverMonitor}}
{{#systemSafety}}
import systemSafety from './systemSafety'
{{/systemSafety}}
const CancelToken = axios.CancelToken const CancelToken = axios.CancelToken
......
...@@ -208,7 +208,7 @@ ...@@ -208,7 +208,7 @@
// 菜单操作 // 菜单操作
handleMenu () { handleMenu () {
this.isCollapse = !this.isCollapse this.isCollapse = !this.isCollapse
this.$root.eventHub.$emit('handleMenu', this.isCollapse) // Hub触发事件,通过this.root.eventHub获取此对象//调用emit 方法 this.$store.dispatch('setCollapse', this.isCollapse)
}, },
// 重置密码 // 重置密码
handleUsercenter () { handleUsercenter () {
......
...@@ -18,13 +18,17 @@ ...@@ -18,13 +18,17 @@
export default{ export default{
name: 'SiderBar', name: 'SiderBar',
conputed: {
isCollapse () {
return this.$store.state.isCollapse
}
},
data () { data () {
return { return {
activeIndex: '', activeIndex: '',
infos: [], infos: [],
curIndex: '0', curIndex: '0',
childModuleinfos: '', // 新增定义 childModuleinfos: '', // 新增定义
isCollapse: false,
menuUrl: [] // 菜单链接集合 menuUrl: [] // 菜单链接集合
} }
}, },
...@@ -49,22 +53,6 @@ ...@@ -49,22 +53,6 @@
mounted() { mounted() {
this.init() this.init()
}, },
created () {
// 切换
this.$on('handleTab', (msg) => { // Hub接收事件
for (var i = 0; i < this.infos.length; i++) {
if (msg === this.infos[i].pageurl) {
this.curIndex = i
return
}
}
})
// 收起菜单栏,只剩图标
this.$root.eventHub.$on('handleMenu', (msg) => { // Hub接收事件
// console.log(msg)
this.isCollapse = msg
})
},
methods: { methods: {
init() { init() {
let yObj = localStorage.getItem('gisopUserInfo') let yObj = localStorage.getItem('gisopUserInfo')
......
...@@ -11,6 +11,7 @@ const store = new Vuex.Store({ ...@@ -11,6 +11,7 @@ const store = new Vuex.Store({
gisopUserInfo: { gisopUserInfo: {
}, },
isCollapse: false,
sideMenu: [], sideMenu: [],
ruleid: '' ruleid: ''
}, },
...@@ -21,6 +22,9 @@ const store = new Vuex.Store({ ...@@ -21,6 +22,9 @@ const store = new Vuex.Store({
SET_GISOP_USER(state, payload) { SET_GISOP_USER(state, payload) {
state.gisopUserInfo = payload state.gisopUserInfo = payload
}, },
SET_Collapse(state, payload) {
state.isCollapse = payload
},
SET_SIDE_MENU(state, payload) { SET_SIDE_MENU(state, payload) {
state.sideMenu = payload state.sideMenu = payload
}, },
...@@ -35,6 +39,9 @@ const store = new Vuex.Store({ ...@@ -35,6 +39,9 @@ const store = new Vuex.Store({
setGisopUser({ commit }, payload) { setGisopUser({ commit }, payload) {
commit('SET_GISOP_USER', payload) commit('SET_GISOP_USER', payload)
}, },
setCollapse({ commit }, payload) {
commit('SET_Collapse', payload)
},
setSideMenu({ commit }, payload) { setSideMenu({ commit }, payload) {
commit('SET_SIDE_MENU', payload) commit('SET_SIDE_MENU', payload)
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment