Commit d5e0dd09 by zhangquan

新增产品页面出来不切换二级目录

1 parent a94153b2
......@@ -533,6 +533,8 @@ export default {
this.isEditType = true
},
goListPage(){
const { menuId , subMenuId } = this.formObj
window.localStorage.setItem('menuInfo', JSON.stringify({menuId , subMenuId}))
this.$router.push({path: '/discoverManager/index'})
}
}
......
......@@ -122,7 +122,12 @@
}
},
created(){
this.getMenuList()
const menuInfo = window.localStorage.getItem('menuInfo') //判断是否是新增产品进来,不切换二级目录
if(menuInfo){
this.getMenuList('rename', JSON.parse(menuInfo))
}else{
this.getMenuList()
}
},
mounted() {
document.addEventListener("click", this.eventListener);
......@@ -134,15 +139,18 @@
eventListener(e){
if (!this.$refs?.menuOpRef?.[0]?.contains(e.target)) this.boxShow = false;
},
getMenuList(type) {
getMenuList(type, menuInfo) {
this.$apis.discover.getMenuListApi({}).then(res => {
if(res?.length){
this.menuList = res
let menuItem = res[0]
let subMenuItem = res[0]?.childList[0] || {}
if(type=='rename') {
menuItem = res.find(item => item.id == this.curModuleInfo.menuId)
subMenuItem = menuItem.find(item => item.id == this.curModuleInfo.subMenuId)
let menuId = menuInfo ? menuInfo.menuId : this.curModuleInfo.menuId
let subMenuId = menuInfo ? menuInfo.subMenuId : this.curModuleInfo.subMenuId
menuItem = res.find(item => item.id == menuId)
subMenuItem = menuItem?.childList?.find(item => item.id == subMenuId)
window.localStorage.removeItem('menuInfo')
}
this.slectedSubmenu(menuItem, subMenuItem)
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!