commit
This commit is contained in:
@@ -243,6 +243,7 @@ layout("/layouts/v4/baseLayout.html"){
|
||||
|
||||
|
||||
try {
|
||||
debugger
|
||||
const app = JSON.parse(window.sessionStorage.getItem("zhgh_sub_app"))
|
||||
$("#sub-app-container #sidebar-menu .menu-header .menu-title").text(app?.name)
|
||||
} catch (e) {
|
||||
@@ -323,16 +324,53 @@ layout("/layouts/v4/baseLayout.html"){
|
||||
if (res.code === 0) {
|
||||
this.menus = res.data
|
||||
window.sessionStorage.setItem("zhgh_sub_app_menus", JSON.stringify(res.data))
|
||||
this.echoMenus()
|
||||
this.matchUrlToMenu()
|
||||
} else {
|
||||
this.menus = []
|
||||
}
|
||||
this.echoMenus()
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
// 按 URL 精准激活
|
||||
matchUrlToMenu() {
|
||||
// 跳转带过来的地址
|
||||
const pathname = window.location.pathname
|
||||
const find = (list, parentIds = []) => {
|
||||
for (const m of list) {
|
||||
if (m.href && pathname.includes(m.href.split('?')[0])) {
|
||||
return { menu: m, parentIds }
|
||||
}
|
||||
if (m.children?.length) {
|
||||
const hit = find(m.children, [...parentIds, m.id])
|
||||
if (hit) return hit
|
||||
}
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
const hit = find(this.menus)
|
||||
if (hit) {
|
||||
// 激活跳转菜单
|
||||
this.activeMenuIndex = hit.menu.id
|
||||
this.openedMenus = hit.parentIds
|
||||
const app = JSON.parse(window.sessionStorage.getItem("zhgh_sub_app"))
|
||||
$("#sub-app-container #sidebar-menu .menu-header .menu-title").text(app?.name)
|
||||
this.$nextTick(() => {
|
||||
this.menuSelect(hit.menu.id, hit.parentIds)
|
||||
// 保证内容区对应
|
||||
commonUtil.pjaxPush(hit.menu.href)
|
||||
})
|
||||
} else if (!this.activeMenuIndex) {
|
||||
// 没命中且缓存也没有 → 再降级到第一个
|
||||
this.defaultSelect()
|
||||
}
|
||||
},
|
||||
|
||||
// 设置应用信息
|
||||
setAppInfo(app) {
|
||||
if (app) {
|
||||
debugger
|
||||
// 储存到缓存
|
||||
window.sessionStorage.setItem("zhgh_sub_app", JSON.stringify(app))
|
||||
// 储存到div中
|
||||
|
||||
@@ -326,7 +326,7 @@ layout("/layouts/v4/baseLayout.html"){
|
||||
|
||||
<div class="apps-wrapper" id="app">
|
||||
<div class="apps-hero">
|
||||
<img src="https://i.cug.edu.cn/data/sys-attach/download/1i8hmpaq7wmewu9c7w3pt9qhu3gb8bkcvow0" alt="应用中心" />
|
||||
<img src="/assets/platform/img/v4/yyzx.png" alt="应用中心" />
|
||||
</div>
|
||||
|
||||
<div class="apps-container">
|
||||
|
||||
@@ -322,7 +322,7 @@ layout("/layouts/v4/baseLayout.html"){
|
||||
|
||||
<div class="apps-wrapper" id="app">
|
||||
<div class="apps-hero">
|
||||
<img src="https://i.cug.edu.cn/data/sys-attach/download/1i8hmpaqdwmvwajjvw2c8isi61jj0gkmosw0" alt="应用中心"/>
|
||||
<img src="/assets/platform/img/v4/lczx.png" alt="流程中心"/>
|
||||
</div>
|
||||
|
||||
<div class="apps-container">
|
||||
|
||||
Reference in New Issue
Block a user