|
|
|
@ -35,7 +35,12 @@ const user = { |
|
|
|
menuAll: getStore({ name: 'menuAll' }) || [], |
|
|
|
menuAll: getStore({ name: 'menuAll' }) || [], |
|
|
|
token: getStore({ name: 'token' }) || '', |
|
|
|
token: getStore({ name: 'token' }) || '', |
|
|
|
refreshToken: getStore({ name: 'refreshToken' }) || '', |
|
|
|
refreshToken: getStore({ name: 'refreshToken' }) || '', |
|
|
|
|
|
|
|
leftMenu:getStore({name:'leftMenu'}) || [], |
|
|
|
|
|
|
|
activeIndex:getStore({name:'activeIndex'}) || '', |
|
|
|
|
|
|
|
selectedIndex:getStore({name:'selectedIndex'}) || '', |
|
|
|
|
|
|
|
selectIndex:getStore({name:'selectIndex'}) || 0, |
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
actions: { |
|
|
|
actions: { |
|
|
|
//根据用户名登录
|
|
|
|
//根据用户名登录
|
|
|
|
LoginByUsername({ commit }, userInfo = {}) { |
|
|
|
LoginByUsername({ commit }, userInfo = {}) { |
|
|
|
@ -226,6 +231,8 @@ const user = { |
|
|
|
.then(() => { |
|
|
|
.then(() => { |
|
|
|
commit('SET_TOKEN', ''); |
|
|
|
commit('SET_TOKEN', ''); |
|
|
|
commit('SET_MENU_ALL_NULL', []); |
|
|
|
commit('SET_MENU_ALL_NULL', []); |
|
|
|
|
|
|
|
commit('SET_LEFT_MENU', []); |
|
|
|
|
|
|
|
commit('SET_ACTIVE_INDEX', ''); |
|
|
|
commit('SET_MENU', []); |
|
|
|
commit('SET_MENU', []); |
|
|
|
commit('SET_ROLES', []); |
|
|
|
commit('SET_ROLES', []); |
|
|
|
commit('DEL_ALL_TAG', []); |
|
|
|
commit('DEL_ALL_TAG', []); |
|
|
|
@ -245,6 +252,8 @@ const user = { |
|
|
|
return new Promise(resolve => { |
|
|
|
return new Promise(resolve => { |
|
|
|
commit('SET_TOKEN', ''); |
|
|
|
commit('SET_TOKEN', ''); |
|
|
|
commit('SET_MENU_ALL_NULL', []); |
|
|
|
commit('SET_MENU_ALL_NULL', []); |
|
|
|
|
|
|
|
commit('SET_LEFT_MENU', []); |
|
|
|
|
|
|
|
commit('SET_ACTIVE_INDEX', ''); |
|
|
|
commit('SET_MENU', []); |
|
|
|
commit('SET_MENU', []); |
|
|
|
commit('SET_ROLES', []); |
|
|
|
commit('SET_ROLES', []); |
|
|
|
commit('DEL_ALL_TAG', []); |
|
|
|
commit('DEL_ALL_TAG', []); |
|
|
|
@ -269,6 +278,7 @@ const user = { |
|
|
|
const data = res.data.data; |
|
|
|
const data = res.data.data; |
|
|
|
let menu = deepClone(data); |
|
|
|
let menu = deepClone(data); |
|
|
|
menu.forEach(ele => formatPath(ele, true)); |
|
|
|
menu.forEach(ele => formatPath(ele, true)); |
|
|
|
|
|
|
|
console.log('setMenu--------------------------------',menu) |
|
|
|
commit('SET_MENU', menu); |
|
|
|
commit('SET_MENU', menu); |
|
|
|
commit('SET_MENU_ALL', menu); |
|
|
|
commit('SET_MENU_ALL', menu); |
|
|
|
dispatch('GetButtons'); |
|
|
|
dispatch('GetButtons'); |
|
|
|
@ -358,6 +368,22 @@ const user = { |
|
|
|
state.menu = menu; |
|
|
|
state.menu = menu; |
|
|
|
setStore({ name: 'menu', content: state.menu }); |
|
|
|
setStore({ name: 'menu', content: state.menu }); |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
SET_LEFT_MENU:(state,leftMenu) =>{ |
|
|
|
|
|
|
|
state.leftMenu = leftMenu |
|
|
|
|
|
|
|
setStore({name:'leftMenu',leftMenu}) |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
SET_ACTIVE_INDEX:(state,activeIndex) =>{ |
|
|
|
|
|
|
|
state.activeIndex = activeIndex |
|
|
|
|
|
|
|
setStore({name:'activeIndex',content:activeIndex}) |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
SET_SELECT_INDEX:(state,selectIndex) =>{ |
|
|
|
|
|
|
|
state.selectIndex = selectIndex |
|
|
|
|
|
|
|
setStore({name:'selectIndex',content:selectIndex}) |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
SET_SELECTED_INDEX:(state,selectedIndex) =>{ |
|
|
|
|
|
|
|
state.selectedIndex = selectedIndex |
|
|
|
|
|
|
|
setStore({name:'selectedIndex',content:selectedIndex}) |
|
|
|
|
|
|
|
}, |
|
|
|
SET_ROLES: (state, roles) => { |
|
|
|
SET_ROLES: (state, roles) => { |
|
|
|
state.roles = roles; |
|
|
|
state.roles = roles; |
|
|
|
}, |
|
|
|
}, |
|
|
|
|