Browse Source

修改布局、修改侧边栏高亮逻辑

pull/97/head
zq 2 months ago
parent
commit
3da5de8ff2
  1. 3
      src/components/SliderMenu.vue
  2. 48
      src/components/SliderScond.vue
  3. 4
      src/store/index.js
  4. 829
      src/views/agent/siteServiceAdd.vue

3
src/components/SliderMenu.vue

@ -282,4 +282,5 @@ export default {
// .el-menu--collapse .el-submenu.is-opened > .el-menu {
// opacity: 0;
// height: 0;
// }</style>
// }
</style>

48
src/components/SliderScond.vue

@ -77,11 +77,23 @@ export default {
GuipToolTip
},
watch: {
menuList(newVal) {
let subtitle = this.renderKeyNew.subtitle;
this.activeFloor = newVal[this.curIndex]?.list?.[0][subtitle];
this.componentsName = newVal[this.curIndex]?.list?.[0]?.componentsName || '';
store.commit('SET_CURRENTMENUITEM', newVal[this.curIndex]?.list?.[0]);
menuList:{
handler(newVal, oldVal) {
// oldVal
if (!oldVal || oldVal.length === 0) {
this.setDefaultActive(newVal);
return;
}
console.log(newVal,'newVal===');
// menuList
const currentItemExists = this.checkCurrentItem(newVal);
console.log(currentItemExists,'currentItemExists--');
//
if (!currentItemExists) {
this.setDefaultActive(newVal);
}
},
immediate: true
}
},
mounted() {
@ -105,6 +117,32 @@ export default {
}
},
methods: {
checkCurrentItem(newMenuList) {
const subtitle = this.renderKeyNew.subtitle;
//
if (!this.activeFloor) return false;
// menuList
for (const item of newMenuList) {
if (item.list) {
const found = item.list.some(subItem =>
subItem[subtitle] === this.activeFloor ||
subItem.componentsName === this.activeFloor
);
if (found) return true;
}
}
return false;
},
setDefaultActive(menuList) {
//
if (menuList && menuList.length > 0 && menuList[0].list && menuList[0].list.length > 0) {
const subtitle = this.renderKeyNew.subtitle;
this.activeFloor = menuList[0].list[0][subtitle] || menuList[0].list[0]?.componentsName || '';
this.componentsName = menuList[0].list[0]?.componentsName || '';
store.commit('SET_CURRENTMENUITEM', menuList[0].list[0]);
this.curIndex = 0;
}
},
handleChange(val) {
console.log("面板状态变化:", val);
},

4
src/store/index.js

@ -567,7 +567,7 @@ export default new Vuex.Store({
},
mutations: {
SET_CURRENTMENUITEM(state,data){
state.currentMenuItem = JSON.parse(JSON.stringify(data));
state.currentMenuItem = data && JSON.parse(JSON.stringify(data));
},
SET_COMPONENTS_NAME(state,name){
state.componentsName = name;
@ -576,7 +576,7 @@ export default new Vuex.Store({
state.slidermenu = state[type]
},
SET_SECOND_MENU(state,data){
state.secondMenu = JSON.parse(JSON.stringify(data))
state.secondMenu = data && JSON.parse(JSON.stringify(data))
},
SET_CUSTOMIZE(state,show) {
state.customize = show

829
src/views/agent/siteServiceAdd.vue

File diff suppressed because it is too large
Loading…
Cancel
Save