This commit is contained in:
2023-05-29 17:27:57 +08:00
parent d920d0130b
commit 9c741c940e
4 changed files with 5 additions and 30 deletions

View File

@@ -68,7 +68,6 @@ export default {
} }
}, },
mounted () { mounted () {
window.localStorage.removeItem('defaultActive')
// 点对点项目分辨率 1024 * 768 // 点对点项目分辨率 1024 * 768
// alert(document.body.clientWidth, 'a') // alert(document.body.clientWidth, 'a')
// alert(document.body.clientHeight, 'b') // alert(document.body.clientHeight, 'b')

View File

@@ -5,8 +5,8 @@
<img src="../../../images/aio/logo_1.png" alt="诺力"> <img src="../../../images/aio/logo_1.png" alt="诺力">
</div> </div>
<div class="horizontal-menu-container"> <div class="horizontal-menu-container">
<el-menu :default-active="activeIndex" mode="horizontal" @select="handleSelect"> <el-menu :default-active="$route.path" mode="horizontal" @select="handleSelect">
<el-menu-item :index="menu.index" v-for="menu in menus" :key="menu.index">{{menu.label}}</el-menu-item> <el-menu-item :index="menu.router" v-for="menu in menus" :key="menu.index">{{menu.label}}</el-menu-item>
</el-menu> </el-menu>
</div> </div>
<div class="header-wraper__right"> <div class="header-wraper__right">
@@ -95,7 +95,6 @@ export default {
data () { data () {
return { return {
username: this.$store.getters.userInfo !== '' ? JSON.parse(this.$store.getters.userInfo).user.username : '', username: this.$store.getters.userInfo !== '' ? JSON.parse(this.$store.getters.userInfo).user.username : '',
activeIndex: this.$store.getters.defaultActive,
menus: [{ menus: [{
label: '首页', label: '首页',
index: '1', index: '1',
@@ -128,16 +127,6 @@ export default {
unclick: false unclick: false
} }
}, },
beforeRouteEnter (to, from, next) {
next(vm => {
vm.menus.map(el => {
if (el.router === vm.$route.path) {
vm.activeIndex = el.index
vm.$store.dispatch('getDefaultActive', el.index)
}
})
})
},
watch: { watch: {
oldpassword (val) { oldpassword (val) {
if (val === '' || this.newpassword1 === '' || this.newpassword2 === '') { if (val === '' || this.newpassword1 === '' || this.newpassword2 === '') {
@@ -163,11 +152,9 @@ export default {
}, },
methods: { methods: {
handleSelect (key) { handleSelect (key) {
this.activeIndex = key
this.$store.dispatch('getDefaultActive', key)
this.dropdown = false this.dropdown = false
this.$router.push({ this.$router.push({
path: this.menus[Number(key) - 1].router path: key
}) })
}, },
showDropdown () { showDropdown () {

View File

@@ -1,11 +1,9 @@
import * as types from '../types' import * as types from '../types'
import { getStore, setStore } from '@config/utils.js' // import { getStore, setStore } from '@config/utils.js'
const state = { const state = {
materObj: {}, // 物料查询-盘点修改 materObj: {}, // 物料查询-盘点修改
hcxCheckObj: {}, // 缓存线盘点 - 盘点修改, hcxCheckObj: {} // 缓存线盘点 - 盘点修改
defaultActive: getStore('defaultActive') || '1',
sideActive: getStore('sideActive') || '1'
} }
const getters = { const getters = {
@@ -20,10 +18,6 @@ const actions = {
}, },
hcxCheckObj ({commit}, res) { hcxCheckObj ({commit}, res) {
commit(types.HCX_CHECK_OBJ, res) commit(types.HCX_CHECK_OBJ, res)
},
getDefaultActive ({commit}, res) {
setStore('defaultActive', res)
commit(types.GET_DEFAULT_ACTIVE, res)
} }
} }
@@ -33,9 +27,6 @@ const mutations = {
}, },
[types.HCX_CHECK_OBJ] (state, res) { [types.HCX_CHECK_OBJ] (state, res) {
state.hcxCheckObj = res state.hcxCheckObj = res
},
[types.GET_DEFAULT_ACTIVE] (state, res) {
state.defaultActive = res
} }
} }

View File

@@ -18,5 +18,3 @@ export const SET_DEVICE = 'SET_DEVICE'
// hcx数据 // hcx数据
export const MATER_OBJ = 'MATER_OBJ' // 物料查询-盘点修改 export const MATER_OBJ = 'MATER_OBJ' // 物料查询-盘点修改
export const HCX_CHECK_OBJ = 'HCX_CHECK_OBJ' // 缓存线盘点 - 盘点修改 export const HCX_CHECK_OBJ = 'HCX_CHECK_OBJ' // 缓存线盘点 - 盘点修改
export const GET_DEFAULT_ACTIVE = 'GET_DEFAULT_ACTIVE' // 菜单activeIndex