综述: 优化平台端web权限管理页面的iframe嵌入功能和菜单项点击处理
- 修改权限编辑和市场经营者创建菜单项的链接方式,从hash路由改为相对路径引用 - 新增openTabWithIframe函数,用于通过iframe方式加载子页面 - 优化菜单项点击事件处理逻辑,支持默认链接跳转行为 - 重写标签页点击事件处理函数,以支持iframe标签页的面包屑更新 - 删除权限分配.html文件
This commit is contained in:
parent
3321e8e979
commit
4f048ae14d
|
|
@ -449,7 +449,7 @@
|
||||||
</button>
|
</button>
|
||||||
<div class="submenu">
|
<div class="submenu">
|
||||||
<a href="./权限管理/权限编辑.html" class="submenu-item" onclick="openTabWithIframe(this, '权限编辑')">权限编辑</a>
|
<a href="./权限管理/权限编辑.html" class="submenu-item" onclick="openTabWithIframe(this, '权限编辑')">权限编辑</a>
|
||||||
<a href="#/permission/manager" class="submenu-item" onclick="openTab(this, '市场经营者创建')">市场经营者创建</a>
|
<a href="./权限管理/市场经营者创建.html" class="submenu-item" onclick="openTabWithIframe(this, '市场经营者创建')">市场经营者创建</a>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
<li class="menu-item">
|
<li class="menu-item">
|
||||||
|
|
@ -661,7 +661,6 @@
|
||||||
newContent.className = 'tab-content';
|
newContent.className = 'tab-content';
|
||||||
newContent.style.display = 'none';
|
newContent.style.display = 'none';
|
||||||
newContent.innerHTML = `
|
newContent.innerHTML = `
|
||||||
<h2>${title}</h2>
|
|
||||||
<p>这里是${title}页面的内容...</p>
|
<p>这里是${title}页面的内容...</p>
|
||||||
`;
|
`;
|
||||||
contentArea.appendChild(newContent);
|
contentArea.appendChild(newContent);
|
||||||
|
|
@ -701,7 +700,6 @@
|
||||||
newContent.className = 'tab-content';
|
newContent.className = 'tab-content';
|
||||||
newContent.style.display = 'none';
|
newContent.style.display = 'none';
|
||||||
newContent.innerHTML = `
|
newContent.innerHTML = `
|
||||||
<h2>${title}</h2>
|
|
||||||
<iframe src="${link.href}" style="width: 100%; height: 600px; border: none;"></iframe>
|
<iframe src="${link.href}" style="width: 100%; height: 600px; border: none;"></iframe>
|
||||||
`;
|
`;
|
||||||
contentArea.appendChild(newContent);
|
contentArea.appendChild(newContent);
|
||||||
|
|
@ -728,8 +726,7 @@
|
||||||
activeTab.classList.add('active');
|
activeTab.classList.add('active');
|
||||||
activeContent.style.display = 'block';
|
activeContent.style.display = 'block';
|
||||||
|
|
||||||
// 更新面包屑导航
|
// 不更新面包屑导航中的标题
|
||||||
updateBreadcrumb(title);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -770,12 +767,20 @@
|
||||||
|
|
||||||
// 更新面包屑导航
|
// 更新面包屑导航
|
||||||
function updateBreadcrumb(title) {
|
function updateBreadcrumb(title) {
|
||||||
const breadcrumbItems = document.querySelectorAll('.breadcrumb-item');
|
// 不更新面包屑导航中的标题
|
||||||
if (breadcrumbItems.length >= 3) {
|
return;
|
||||||
breadcrumbItems[2].textContent = title;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 重写标签页点击事件处理函数,以支持iframe标签页的面包屑更新
|
||||||
|
document.querySelectorAll('.tab-item').forEach(tab => {
|
||||||
|
tab.onclick = () => {
|
||||||
|
const tabId = tab.getAttribute('data-tab');
|
||||||
|
// 获取标签标题用于更新面包屑
|
||||||
|
const title = tab.querySelector('.tab-title').textContent;
|
||||||
|
setActiveTab(tabId, title);
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
// 菜单项点击事件处理
|
// 菜单项点击事件处理
|
||||||
document.querySelectorAll('.submenu-item').forEach(item => {
|
document.querySelectorAll('.submenu-item').forEach(item => {
|
||||||
item.addEventListener('click', function(e) {
|
item.addEventListener('click', function(e) {
|
||||||
|
|
@ -793,8 +798,7 @@
|
||||||
|
|
||||||
const title = this.textContent;
|
const title = this.textContent;
|
||||||
this.onclick.call(this);
|
this.onclick.call(this);
|
||||||
// 更新面包屑导航
|
// 不更新面包屑导航中的标题
|
||||||
updateBreadcrumb(title);
|
|
||||||
}
|
}
|
||||||
// 如果没有onclick属性,允许默认行为(链接跳转)
|
// 如果没有onclick属性,允许默认行为(链接跳转)
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue