综述: 优化iframe内容显示,实现无缝全屏效果
This commit is contained in:
parent
d3275da1a8
commit
e9c3c224b2
Binary file not shown.
|
After Width: | Height: | Size: 161 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 89 KiB |
|
|
@ -1,52 +0,0 @@
|
||||||
## IFRAME嵌入页面样式规范
|
|
||||||
═══════════════════════
|
|
||||||
|
|
||||||
为确保所有通过iframe嵌入的页面都能顶格显示(无边距、无空白),所有嵌入页面必须遵循以下CSS样式规范:
|
|
||||||
|
|
||||||
### 必须修改的样式:
|
|
||||||
|
|
||||||
1. **body标签样式**:
|
|
||||||
```css
|
|
||||||
body {
|
|
||||||
margin: 0 !important;
|
|
||||||
padding: 0 !important;
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
2. **容器样式(.container或主容器)**:
|
|
||||||
```css
|
|
||||||
.container {
|
|
||||||
width: 100% !important;
|
|
||||||
height: 100vh !important;
|
|
||||||
margin: 0 !important;
|
|
||||||
padding: 0 !important;
|
|
||||||
max-width: none !important;
|
|
||||||
border-radius: 0 !important;
|
|
||||||
box-shadow: none !important;
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
3. **响应式设计**:
|
|
||||||
```css
|
|
||||||
@media (max-width: 768px) {
|
|
||||||
.container {
|
|
||||||
margin: 0 !important;
|
|
||||||
border-radius: 0 !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### 修改清单:
|
|
||||||
- [ ] 移除body的padding
|
|
||||||
- [ ] 将max-width改为width: 100%
|
|
||||||
- [ ] 将margin: 0 auto改为margin: 0
|
|
||||||
- [ ] 移除border-radius和box-shadow
|
|
||||||
- [ ] 确保高度为100vh
|
|
||||||
- [ ] 检查响应式样式
|
|
||||||
|
|
||||||
### 适用范围:
|
|
||||||
- 权限管理模块所有页面
|
|
||||||
- 产品管理模块所有页面
|
|
||||||
- 用户管理模块所有页面
|
|
||||||
- 系统设置模块所有页面
|
|
||||||
- 所有未来新增的iframe嵌入页面
|
|
||||||
|
|
@ -3,9 +3,9 @@
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>商家端后台</title>
|
<title>大妈集市商户端</title>
|
||||||
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
|
||||||
<style>
|
<style>
|
||||||
/* CSS样式将在这里添加 */
|
|
||||||
* {
|
* {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
|
@ -13,425 +13,464 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", 微软雅黑, Arial, sans-serif;
|
||||||
background-color: #f5f7fa;
|
background-color: #f5f5f5;
|
||||||
color: #333;
|
color: #333;
|
||||||
height: 100vh;
|
|
||||||
display: flex;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 左侧菜单样式 */
|
/* 顶部导航栏 */
|
||||||
.sidebar {
|
.top-nav {
|
||||||
width: 250px;
|
background-color: rgb(9, 84, 43);
|
||||||
background: linear-gradient(180deg, #2c3e50, #1a2530);
|
height: 50px;
|
||||||
color: #ecf0f1;
|
|
||||||
height: 100%;
|
|
||||||
overflow-y: auto;
|
|
||||||
transition: all 0.3s ease;
|
|
||||||
box-shadow: 3px 0 10px rgba(0, 0, 0, 0.1);
|
|
||||||
}
|
|
||||||
|
|
||||||
.sidebar-header {
|
|
||||||
padding: 20px;
|
|
||||||
background-color: rgba(0, 0, 0, 0.2);
|
|
||||||
text-align: center;
|
|
||||||
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
|
|
||||||
}
|
|
||||||
|
|
||||||
.sidebar-header h2 {
|
|
||||||
font-size: 1.5rem;
|
|
||||||
font-weight: 600;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 菜单样式 */
|
|
||||||
.menu {
|
|
||||||
list-style: none;
|
|
||||||
padding: 10px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.menu-item {
|
|
||||||
border-bottom: 1px solid rgba(255, 255, 255, 0.05);
|
|
||||||
}
|
|
||||||
|
|
||||||
.menu-item > a {
|
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
padding: 12px 20px;
|
justify-content: space-between;
|
||||||
color: #bdc3c7;
|
padding: 0 20px;
|
||||||
text-decoration: none;
|
color: white;
|
||||||
transition: all 0.3s ease;
|
position: fixed;
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.menu-item > a:hover {
|
|
||||||
background-color: rgba(255, 255, 255, 0.1);
|
|
||||||
color: #ecf0f1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.menu-item > a i {
|
|
||||||
margin-right: 10px;
|
|
||||||
width: 20px;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 子菜单样式 */
|
|
||||||
.submenu {
|
|
||||||
list-style: none;
|
|
||||||
padding-left: 0;
|
|
||||||
max-height: 0;
|
|
||||||
overflow: hidden;
|
|
||||||
transition: max-height 0.3s ease;
|
|
||||||
background-color: rgba(0, 0, 0, 0.2);
|
|
||||||
}
|
|
||||||
|
|
||||||
.submenu.open {
|
|
||||||
max-height: 500px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.submenu-item a {
|
|
||||||
display: block;
|
|
||||||
padding: 10px 20px 10px 50px;
|
|
||||||
color: #95a5a6;
|
|
||||||
text-decoration: none;
|
|
||||||
transition: all 0.3s ease;
|
|
||||||
border-left: 3px solid transparent;
|
|
||||||
}
|
|
||||||
|
|
||||||
.submenu-item a:hover {
|
|
||||||
background-color: rgba(255, 255, 255, 0.05);
|
|
||||||
color: #ecf0f1;
|
|
||||||
border-left-color: #3498db;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 内容区域样式 */
|
|
||||||
.content {
|
|
||||||
flex: 1;
|
|
||||||
padding: 0;
|
|
||||||
overflow-y: hidden;
|
|
||||||
background-color: #fff;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
}
|
|
||||||
|
|
||||||
.content-header {
|
|
||||||
display: none;
|
|
||||||
margin-bottom: 20px;
|
|
||||||
padding-bottom: 15px;
|
|
||||||
border-bottom: 1px solid #eee;
|
|
||||||
}
|
|
||||||
|
|
||||||
.content-header h1 {
|
|
||||||
color: #2c3e50;
|
|
||||||
font-size: 2rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.content-body {
|
|
||||||
flex: 1;
|
|
||||||
line-height: 1.6;
|
|
||||||
padding: 0;
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.content-section {
|
|
||||||
margin-bottom: 30px;
|
|
||||||
padding: 20px;
|
|
||||||
background-color: #f8f9fa;
|
|
||||||
border-radius: 5px;
|
|
||||||
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
|
|
||||||
}
|
|
||||||
|
|
||||||
.content-section h2 {
|
|
||||||
color: #3498db;
|
|
||||||
margin-bottom: 15px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.content-section p {
|
|
||||||
margin-bottom: 15px;
|
|
||||||
color: #555;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* iframe样式 */
|
|
||||||
.content-iframe {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
border: none;
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 为iframe内的页面提供通用的顶格显示样式 */
|
|
||||||
.content-iframe::after {
|
|
||||||
content: '';
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
bottom: 0;
|
z-index: 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 通过JavaScript动态注入CSS到iframe中,确保所有嵌入页面都顶格显示 */
|
.nav-brand {
|
||||||
|
font-size: 18px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: white;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-left {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-right {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-icon {
|
||||||
|
width: 24px;
|
||||||
|
height: 24px;
|
||||||
|
cursor: pointer;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-avatar {
|
||||||
|
width: 32px;
|
||||||
|
height: 32px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background-color: #28a745;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
cursor: pointer;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 侧边栏 */
|
||||||
|
.sidebar {
|
||||||
|
position: fixed;
|
||||||
|
left: 0;
|
||||||
|
top: 50px;
|
||||||
|
width: 220px;
|
||||||
|
height: calc(100vh - 50px);
|
||||||
|
background-color: white;
|
||||||
|
border-right: 1px solid #e8e8e8;
|
||||||
|
overflow-y: auto;
|
||||||
|
z-index: 999;
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu-search {
|
||||||
|
padding: 15px;
|
||||||
|
border-bottom: 1px solid #f0f0f0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-input {
|
||||||
|
width: 100%;
|
||||||
|
height: 32px;
|
||||||
|
padding: 0 10px;
|
||||||
|
border: 1px solid #d9d9d9;
|
||||||
|
border-radius: 4px;
|
||||||
|
font-size: 12px;
|
||||||
|
background-color: #fafafa;
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu-list {
|
||||||
|
list-style: none;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu-item {
|
||||||
|
border-bottom: 1px solid #f0f0f0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu-link {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
padding: 12px 20px;
|
||||||
|
color: #666;
|
||||||
|
text-decoration: none;
|
||||||
|
font-size: 14px;
|
||||||
|
transition: all 0.3s;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu-link:hover {
|
||||||
|
background-color: #f5f5f5;
|
||||||
|
color: #1890ff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu-link.active {
|
||||||
|
background-color: #e6f7ff;
|
||||||
|
color: #1890ff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu-icon {
|
||||||
|
width: 16px;
|
||||||
|
height: 16px;
|
||||||
|
margin-right: 10px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu-text {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu-arrow {
|
||||||
|
font-size: 12px;
|
||||||
|
transition: transform 0.3s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu-item.expanded .menu-arrow {
|
||||||
|
transform: rotate(90deg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.submenu {
|
||||||
|
background-color: #fafafa;
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu-item.expanded .submenu {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.submenu-link {
|
||||||
|
padding: 8px 20px 8px 46px;
|
||||||
|
font-size: 13px;
|
||||||
|
color: #666;
|
||||||
|
display: block;
|
||||||
|
text-decoration: none;
|
||||||
|
transition: all 0.3s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.submenu-link:hover {
|
||||||
|
background-color: #e6f7ff;
|
||||||
|
color: #1890ff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.submenu-icon {
|
||||||
|
width: 6px;
|
||||||
|
height: 6px;
|
||||||
|
background-color: #ccc;
|
||||||
|
border-radius: 50%;
|
||||||
|
margin-right: 8px;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 主内容区域 */
|
||||||
|
.main-content {
|
||||||
|
margin-left: 220px;
|
||||||
|
margin-top: 50px;
|
||||||
|
min-height: calc(100vh - 50px);
|
||||||
|
background-color: white;
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content-placeholder {
|
||||||
|
text-align: center;
|
||||||
|
color: #999;
|
||||||
|
font-size: 16px;
|
||||||
|
margin-top: 50px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.breadcrumb {
|
||||||
|
margin-bottom: 20px;
|
||||||
|
padding: 10px 0;
|
||||||
|
border-bottom: 1px solid #f0f0f0;
|
||||||
|
font-size: 14px;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
|
||||||
/* 响应式设计 */
|
/* 响应式设计 */
|
||||||
@media (max-width: 768px) {
|
@media (max-width: 768px) {
|
||||||
.sidebar {
|
.sidebar {
|
||||||
width: 70px;
|
transform: translateX(-100%);
|
||||||
|
transition: transform 0.3s;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sidebar-header h2,
|
.sidebar.open {
|
||||||
.menu-item span,
|
transform: translateX(0);
|
||||||
.submenu-item span {
|
}
|
||||||
|
|
||||||
|
.main-content {
|
||||||
|
margin-left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-toggle {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-toggle {
|
||||||
display: none;
|
display: none;
|
||||||
|
background: none;
|
||||||
|
border: none;
|
||||||
|
color: white;
|
||||||
|
font-size: 18px;
|
||||||
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
.menu-item a,
|
|
||||||
.submenu-item a {
|
|
||||||
justify-content: center;
|
|
||||||
padding: 15px 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.menu-item a i,
|
|
||||||
.submenu-item a i {
|
|
||||||
margin-right: 0;
|
|
||||||
font-size: 1.2rem;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<!-- 左侧菜单 -->
|
<!-- 顶部导航栏 -->
|
||||||
<div class="sidebar">
|
<nav class="top-nav">
|
||||||
<div class="sidebar-header">
|
<div class="nav-left">
|
||||||
<h2>大妈系统平台</h2>
|
<button class="nav-toggle" onclick="toggleSidebar()">
|
||||||
|
<i class="fas fa-bars"></i>
|
||||||
|
</button>
|
||||||
|
<a href="#" class="nav-brand">大妈集市商户端</a>
|
||||||
</div>
|
</div>
|
||||||
<ul class="menu">
|
<div class="nav-right">
|
||||||
<li class="menu-item">
|
<div class="nav-icon">
|
||||||
<a>
|
<i class="fas fa-cog"></i>
|
||||||
<i>📊</i>
|
</div>
|
||||||
<span>权限管理</span>
|
<div class="nav-icon">
|
||||||
</a>
|
<i class="fas fa-expand"></i>
|
||||||
<ul class="submenu">
|
</div>
|
||||||
<li class="submenu-item">
|
<div class="nav-avatar">
|
||||||
<a>
|
<i class="fas fa-user"></i>
|
||||||
<i>📈</i>
|
</div>
|
||||||
<span>账号权限分配</span>
|
</div>
|
||||||
</a>
|
</nav>
|
||||||
</li>
|
|
||||||
<li class="submenu-item">
|
<!-- 侧边栏 -->
|
||||||
<a>
|
<aside class="sidebar" id="sidebar">
|
||||||
<i>👥</i>
|
<div class="menu-search">
|
||||||
<span>市场经营者创建</span>
|
<input type="text" class="search-input" placeholder="快速搜索菜单">
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li class="submenu-item">
|
|
||||||
<a>
|
|
||||||
<i>🛒</i>
|
|
||||||
<span>产品分析</span>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 内容区域 -->
|
<ul class="menu-list">
|
||||||
<div class="content">
|
<li class="menu-item">
|
||||||
<div class="content-header">
|
<a href="#" class="menu-link active">
|
||||||
<h1>欢迎使用大妈系统平台</h1>
|
<span class="menu-icon">
|
||||||
|
<i class="fas fa-home"></i>
|
||||||
|
</span>
|
||||||
|
<span class="menu-text">首页</span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="menu-item">
|
||||||
|
<div class="menu-link" onclick="toggleSubmenu(this)">
|
||||||
|
<span class="menu-icon">
|
||||||
|
<i class="fas fa-tasks"></i>
|
||||||
|
</span>
|
||||||
|
<span class="menu-text">运营管理</span>
|
||||||
|
<span class="menu-arrow">
|
||||||
|
<i class="fas fa-chevron-right"></i>
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="content-body">
|
<div class="submenu">
|
||||||
<div class="content-section">
|
<a href="#" class="submenu-link">
|
||||||
<h2>系统介绍</h2>
|
<span class="submenu-icon"></span>
|
||||||
<p>这是一个简洁美观的大妈系统平台,左侧是多级导航菜单,右侧是内容展示区域。您可以点击左侧菜单浏览不同的内容板块。</p>
|
商品管理
|
||||||
<p>系统支持响应式设计,在不同设备上都能提供良好的用户体验。</p>
|
</a>
|
||||||
|
<a href="#" class="submenu-link">
|
||||||
|
<span class="submenu-icon"></span>
|
||||||
|
订单管理
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="content-section">
|
</li>
|
||||||
<h2>功能特点</h2>
|
|
||||||
<p>1. 多级菜单结构:支持无限层级的菜单分类</p>
|
<li class="menu-item expanded">
|
||||||
<p>2. 展开收起功能:点击箭头可展开或收起子菜单</p>
|
<div class="menu-link" onclick="toggleSubmenu(this)">
|
||||||
<p>3. 响应式设计:适配不同屏幕尺寸的设备</p>
|
<span class="menu-icon">
|
||||||
<p>4. 美观界面:现代化的设计风格,提供良好的视觉体验</p>
|
<i class="fas fa-chart-bar"></i>
|
||||||
|
</span>
|
||||||
|
<span class="menu-text">数据中心</span>
|
||||||
|
<span class="menu-arrow">
|
||||||
|
<i class="fas fa-chevron-right"></i>
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="content-section">
|
<div class="submenu">
|
||||||
<h2>使用说明</h2>
|
<a href="#" class="submenu-link">
|
||||||
<p>点击左侧菜单项可以展开或收起子菜单。</p>
|
<span class="submenu-icon"></span>
|
||||||
<p>在移动设备上,菜单会自动折叠以节省空间。</p>
|
客户分析
|
||||||
<p>内容区域会根据选择的菜单项显示相应的内容。</p>
|
</a>
|
||||||
|
<a href="#" class="submenu-link">
|
||||||
|
<span class="submenu-icon"></span>
|
||||||
|
商品分析
|
||||||
|
</a>
|
||||||
|
<a href="#" class="submenu-link">
|
||||||
|
<span class="submenu-icon"></span>
|
||||||
|
订单统计分析
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="menu-item">
|
||||||
|
<a href="#" class="menu-link">
|
||||||
|
<span class="menu-icon">
|
||||||
|
<i class="fas fa-ticket-alt"></i>
|
||||||
|
</span>
|
||||||
|
<span class="menu-text">优惠卷营销工具管理</span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="menu-item">
|
||||||
|
<div class="menu-link" onclick="toggleSubmenu(this)">
|
||||||
|
<span class="menu-icon">
|
||||||
|
<i class="fas fa-clock"></i>
|
||||||
|
</span>
|
||||||
|
<span class="menu-text">预售营销工具管理</span>
|
||||||
|
<span class="menu-arrow">
|
||||||
|
<i class="fas fa-chevron-right"></i>
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="submenu">
|
||||||
|
<a href="#" class="submenu-link">
|
||||||
|
<span class="submenu-icon"></span>
|
||||||
|
预售活动管理
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="menu-item">
|
||||||
|
<div class="menu-link" onclick="toggleSubmenu(this)">
|
||||||
|
<span class="menu-icon">
|
||||||
|
<i class="fas fa-users"></i>
|
||||||
|
</span>
|
||||||
|
<span class="menu-text">会员营销工具管理</span>
|
||||||
|
<span class="menu-arrow">
|
||||||
|
<i class="fas fa-chevron-right"></i>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div class="submenu">
|
||||||
|
<a href="#" class="submenu-link">
|
||||||
|
<span class="submenu-icon"></span>
|
||||||
|
会员管理
|
||||||
|
</a>
|
||||||
|
<a href="#" class="submenu-link">
|
||||||
|
<span class="submenu-icon"></span>
|
||||||
|
积分管理
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="menu-item">
|
||||||
|
<div class="menu-link" onclick="toggleSubmenu(this)">
|
||||||
|
<span class="menu-icon">
|
||||||
|
<i class="fas fa-wallet"></i>
|
||||||
|
</span>
|
||||||
|
<span class="menu-text">钱包管理</span>
|
||||||
|
<span class="menu-arrow">
|
||||||
|
<i class="fas fa-chevron-right"></i>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div class="submenu">
|
||||||
|
<a href="#" class="submenu-link">
|
||||||
|
<span class="submenu-icon"></span>
|
||||||
|
余额管理
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="menu-item">
|
||||||
|
<div class="menu-link" onclick="toggleSubmenu(this)">
|
||||||
|
<span class="menu-icon">
|
||||||
|
<i class="fas fa-shipping-fast"></i>
|
||||||
|
</span>
|
||||||
|
<span class="menu-text">运费管理</span>
|
||||||
|
<span class="menu-arrow">
|
||||||
|
<i class="fas fa-chevron-right"></i>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div class="submenu">
|
||||||
|
<a href="#" class="submenu-link">
|
||||||
|
<span class="submenu-icon"></span>
|
||||||
|
运费模板
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</aside>
|
||||||
|
|
||||||
|
<!-- 主内容区域 -->
|
||||||
|
<main class="main-content">
|
||||||
|
<div class="breadcrumb">
|
||||||
|
当前位置:首页
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="content-placeholder">
|
||||||
|
<h2>欢迎使用大妈集市商户端管理系统</h2>
|
||||||
|
<p style="margin-top: 20px; color: #666;">此区域用于显示具体的页面内容</p>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
// JavaScript功能将在这里添加
|
// 切换侧边栏显示/隐藏(移动端)
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
function toggleSidebar() {
|
||||||
// 获取所有可展开的菜单项
|
const sidebar = document.getElementById('sidebar');
|
||||||
const menuItems = document.querySelectorAll('.menu-item > a');
|
sidebar.classList.toggle('open');
|
||||||
|
}
|
||||||
|
|
||||||
|
// 切换子菜单展开/收起
|
||||||
|
function toggleSubmenu(element) {
|
||||||
|
const menuItem = element.parentElement;
|
||||||
|
menuItem.classList.toggle('expanded');
|
||||||
|
}
|
||||||
|
|
||||||
|
// 菜单搜索功能
|
||||||
|
document.querySelector('.search-input').addEventListener('input', function(e) {
|
||||||
|
const searchText = e.target.value.toLowerCase();
|
||||||
|
const menuItems = document.querySelectorAll('.menu-item');
|
||||||
|
|
||||||
// 为每个可展开的菜单项添加点击事件
|
|
||||||
menuItems.forEach(item => {
|
menuItems.forEach(item => {
|
||||||
item.addEventListener('click', function(e) {
|
const menuText = item.querySelector('.menu-text');
|
||||||
e.preventDefault();
|
if (menuText) {
|
||||||
e.stopPropagation(); // 阻止事件冒泡到父级
|
const text = menuText.textContent.toLowerCase();
|
||||||
|
if (text.includes(searchText) || searchText === '') {
|
||||||
// 切换子菜单的显示状态
|
item.style.display = 'block';
|
||||||
const submenu = this.nextElementSibling;
|
|
||||||
submenu.classList.toggle('open');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// 为所有菜单项添加点击事件(仅子菜单项会加载页面)
|
|
||||||
const allMenuItems = document.querySelectorAll('.menu-item a, .submenu-item a');
|
|
||||||
allMenuItems.forEach(item => {
|
|
||||||
item.addEventListener('click', function(e) {
|
|
||||||
// 获取菜单项文本
|
|
||||||
const text = this.querySelector('span').textContent;
|
|
||||||
|
|
||||||
// 只有子菜单项点击才会加载页面
|
|
||||||
if (this.parentElement.classList.contains('submenu-item')) {
|
|
||||||
// 移除所有菜单项的活动状态
|
|
||||||
allMenuItems.forEach(i => i.classList.remove('active'));
|
|
||||||
|
|
||||||
// 为当前点击的菜单项添加活动状态
|
|
||||||
this.classList.add('active');
|
|
||||||
|
|
||||||
// 这里可以根据需要更新内容区域的内容
|
|
||||||
updateContent(text);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// 更新内容区域的函数
|
|
||||||
function updateContent(title) {
|
|
||||||
const contentBody = document.querySelector('.content-body');
|
|
||||||
|
|
||||||
// 移除内容区域标题的显示逻辑,直接在iframe中显示页面
|
|
||||||
|
|
||||||
// 如果是权限编辑或市场经营者创建,显示iframe
|
|
||||||
if (title === '账号权限分配') {
|
|
||||||
contentBody.innerHTML = `
|
|
||||||
<iframe class="content-iframe" src="1 权限管理/账号权限分配.html" onload="injectFullScreenStyles(this)"></iframe>
|
|
||||||
`;
|
|
||||||
} else if (title === '市场经营者创建') {
|
|
||||||
contentBody.innerHTML = `
|
|
||||||
<iframe class="content-iframe" src="1 权限管理/市场经营者创建.html" onload="injectFullScreenStyles(this)"></iframe>
|
|
||||||
`;
|
|
||||||
} else {
|
} else {
|
||||||
// 其他菜单项直接在内容区域显示iframe
|
item.style.display = 'none';
|
||||||
let url = '';
|
|
||||||
switch(title) {
|
|
||||||
case '首页':
|
|
||||||
url = '首页.html';
|
|
||||||
break;
|
|
||||||
case '新增产品':
|
|
||||||
url = '产品管理/新增产品.html';
|
|
||||||
break;
|
|
||||||
case '编辑产品':
|
|
||||||
url = '产品管理/编辑产品.html';
|
|
||||||
break;
|
|
||||||
case '删除产品':
|
|
||||||
url = '产品管理/删除产品.html';
|
|
||||||
break;
|
|
||||||
case '用户列表':
|
|
||||||
url = '用户管理/用户列表.html';
|
|
||||||
break;
|
|
||||||
case '权限设置':
|
|
||||||
url = '用户管理/权限设置.html';
|
|
||||||
break;
|
|
||||||
case '常规设置':
|
|
||||||
url = '系统设置/常规设置.html';
|
|
||||||
break;
|
|
||||||
case '外观设置':
|
|
||||||
url = '系统设置/外观设置.html';
|
|
||||||
break;
|
|
||||||
case '插件管理':
|
|
||||||
url = '系统设置/插件管理.html';
|
|
||||||
break;
|
|
||||||
case '产品分析':
|
|
||||||
url = '权限管理/产品分析.html';
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
// 对于未指定的菜单项,显示默认内容(包含标题)
|
|
||||||
contentBody.innerHTML = `
|
|
||||||
<div class="content-section">
|
|
||||||
<h2>${title}</h2>
|
|
||||||
<p>您已选择"${title}"菜单项。在这里可以展示与该菜单项相关的详细内容。</p>
|
|
||||||
<p>这是一个内容展示容器,您可以根据实际需求添加任何内容,包括文本、图片、表格等。</p>
|
|
||||||
</div>
|
|
||||||
<div class="content-section">
|
|
||||||
<p>此区域用于展示"${title}"相关的具体内容。</p>
|
|
||||||
<p>您可以添加任何HTML内容,包括:</p>
|
|
||||||
<ul>
|
|
||||||
<li>文本段落</li>
|
|
||||||
<li>图片展示</li>
|
|
||||||
<li>数据表格</li>
|
|
||||||
<li>表单元素</li>
|
|
||||||
<li>图表展示</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
`;
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
// 如果有对应的URL,则在iframe中显示该页面
|
// 菜单点击高亮
|
||||||
if (url) {
|
document.querySelectorAll('.menu-link, .submenu-link').forEach(link => {
|
||||||
contentBody.innerHTML = `<iframe class="content-iframe" src="${url}" onload="injectFullScreenStyles(this)"></iframe>`;
|
link.addEventListener('click', function(e) {
|
||||||
}
|
if (!this.onclick) { // 只有非展开菜单的链接才添加高亮
|
||||||
}
|
// 移除所有高亮
|
||||||
}
|
document.querySelectorAll('.menu-link, .submenu-link').forEach(l => {
|
||||||
|
l.classList.remove('active');
|
||||||
// 为iframe注入通用的全屏样式
|
});
|
||||||
function injectFullScreenStyles(iframe) {
|
// 添加当前高亮
|
||||||
try {
|
this.classList.add('active');
|
||||||
// 等待iframe加载完成
|
|
||||||
iframe.onload = function() {
|
|
||||||
try {
|
|
||||||
const iframeDoc = iframe.contentDocument || iframe.contentWindow.document;
|
|
||||||
|
|
||||||
// 创建样式标签
|
|
||||||
const style = iframeDoc.createElement('style');
|
|
||||||
style.textContent = `
|
|
||||||
* {
|
|
||||||
margin: 0 !important;
|
|
||||||
padding: 0 !important;
|
|
||||||
box-sizing: border-box !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
html, body {
|
|
||||||
width: 100% !important;
|
|
||||||
height: 100% !important;
|
|
||||||
margin: 0 !important;
|
|
||||||
padding: 0 !important;
|
|
||||||
overflow-x: hidden !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.container {
|
|
||||||
width: 100% !important;
|
|
||||||
height: 100vh !important;
|
|
||||||
margin: 0 !important;
|
|
||||||
padding: 0 !important;
|
|
||||||
max-width: none !important;
|
|
||||||
border-radius: 0 !important;
|
|
||||||
box-shadow: none !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
body {
|
|
||||||
padding: 0 !important;
|
|
||||||
margin: 0 !important;
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|
||||||
// 将样式添加到iframe的head中
|
|
||||||
iframeDoc.head.appendChild(style);
|
|
||||||
} catch (e) {
|
|
||||||
// 如果跨域无法访问iframe内容,忽略错误
|
|
||||||
console.log('无法访问iframe内容(可能是跨域限制):', e);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
} catch (e) {
|
|
||||||
console.log('注入样式失败:', e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
Loading…
Reference in New Issue