综述: 优化权限分配页面UI和功能
- 修改平台web/index.html,将"用户统计"菜单项改为"市场经营者创建" - 为权限分配页面添加市场经营者创建功能的iframe支持 - 优化权限分配页面的UI样式,包括节点样式、悬停效果和选中状态 - 增强权限节点的展开按钮样式和动画效果 - 添加权限选中时的视觉反馈样式
This commit is contained in:
		
							parent
							
								
									92d85d780b
								
							
						
					
					
						commit
						b0a91d5660
					
				|  | @ -208,7 +208,7 @@ | ||||||
|                     <li class="submenu-item"> |                     <li class="submenu-item"> | ||||||
|                         <a> |                         <a> | ||||||
|                             <i>👥</i> |                             <i>👥</i> | ||||||
|                             <span>用户统计</span> |                             <span>市场经营者创建</span> | ||||||
|                         </a> |                         </a> | ||||||
|                     </li> |                     </li> | ||||||
|                     <li class="submenu-item"> |                     <li class="submenu-item"> | ||||||
|  | @ -363,11 +363,15 @@ | ||||||
|             function updateContent(title) { |             function updateContent(title) { | ||||||
|                 const contentBody = document.querySelector('.content-body'); |                 const contentBody = document.querySelector('.content-body'); | ||||||
|                  |                  | ||||||
|                 // 如果是权限编辑,显示iframe |                 // 如果是权限编辑或市场经营者创建,显示iframe | ||||||
|                 if (title === '权限编辑') { |                 if (title === '权限编辑') { | ||||||
|                     contentBody.innerHTML = ` |                     contentBody.innerHTML = ` | ||||||
|                         <iframe class="content-iframe" src="权限管理/权限编辑.html"></iframe> |                         <iframe class="content-iframe" src="权限管理/权限编辑.html"></iframe> | ||||||
|                     `; |                     `; | ||||||
|  |                 } else if (title === '市场经营者创建') { | ||||||
|  |                     contentBody.innerHTML = ` | ||||||
|  |                         <iframe class="content-iframe" src="权限管理/权限分配.html"></iframe> | ||||||
|  |                     `; | ||||||
|                 } else { |                 } else { | ||||||
|                     // 其他菜单项显示默认内容 |                     // 其他菜单项显示默认内容 | ||||||
|                     contentBody.innerHTML = ` |                     contentBody.innerHTML = ` | ||||||
|  |  | ||||||
|  | @ -222,32 +222,48 @@ | ||||||
|         .permission-node { |         .permission-node { | ||||||
|             display: flex; |             display: flex; | ||||||
|             align-items: center; |             align-items: center; | ||||||
|             padding: 8px 12px; |             padding: 12px 15px; | ||||||
|             border-radius: 4px; |             border-radius: 6px; | ||||||
|             transition: background-color 0.2s ease; |             transition: all 0.3s ease; | ||||||
|             cursor: pointer; |             cursor: pointer; | ||||||
|  |             background-color: #fff; | ||||||
|  |             border: 1px solid #e9ecef; | ||||||
|  |             margin-bottom: 5px; | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         .permission-node:hover { |         .permission-node:hover { | ||||||
|             background-color: #e9ecef; |             background-color: #f8f9fa; | ||||||
|  |             border-color: #3498db; | ||||||
|  |             box-shadow: 0 2px 8px rgba(52, 152, 219, 0.15); | ||||||
|  |         } | ||||||
|  |          | ||||||
|  |         .permission-node.selected { | ||||||
|  |             background-color: #e3f2fd; | ||||||
|  |             border-color: #3498db; | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         .permission-checkbox { |         .permission-checkbox { | ||||||
|             margin-right: 10px; |             margin-right: 12px; | ||||||
|             transform: scale(1.1); |             width: 18px; | ||||||
|  |             height: 18px; | ||||||
|             cursor: pointer; |             cursor: pointer; | ||||||
|  |             accent-color: #3498db; | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         .expand-btn { |         .expand-btn { | ||||||
|             background: none; |             background: #3498db; | ||||||
|             border: none; |             border: none; | ||||||
|             cursor: pointer; |             cursor: pointer; | ||||||
|             padding: 2px 5px; |             padding: 2px 8px; | ||||||
|             margin-right: 5px; |             margin-right: 12px; | ||||||
|             color: #3498db; |             color: #fff; | ||||||
|             font-size: 12px; |             font-size: 14px; | ||||||
|             transition: transform 0.3s ease; |             transition: all 0.3s ease; | ||||||
|             min-width: 20px; |             min-width: 28px; | ||||||
|  |             border-radius: 4px; | ||||||
|  |             display: flex; | ||||||
|  |             align-items: center; | ||||||
|  |             justify-content: center; | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         .expand-btn.collapsed { |         .expand-btn.collapsed { | ||||||
|  | @ -259,26 +275,47 @@ | ||||||
|             color: #2c3e50; |             color: #2c3e50; | ||||||
|             user-select: none; |             user-select: none; | ||||||
|             flex: 1; |             flex: 1; | ||||||
|  |             font-weight: 500; | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         .permission-children { |         .permission-children { | ||||||
|             margin-left: 30px; |             margin-left: 35px; | ||||||
|             margin-top: 5px; |             margin-top: 8px; | ||||||
|             border-left: 2px solid #ecf0f1; |             border-left: 2px solid #3498db; | ||||||
|             padding-left: 15px; |             padding-left: 20px; | ||||||
|             display: none; |             display: none; | ||||||
|  |             position: relative; | ||||||
|  |         } | ||||||
|  |          | ||||||
|  |         .permission-children::before { | ||||||
|  |             content: ''; | ||||||
|  |             position: absolute; | ||||||
|  |             left: 0; | ||||||
|  |             top: -8px; | ||||||
|  |             height: calc(100% + 16px); | ||||||
|  |             width: 2px; | ||||||
|  |             background-color: #3498db; | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         .permission-children.expanded { |         .permission-children.expanded { | ||||||
|             display: block; |             display: block; | ||||||
|  |             animation: fadeIn 0.3s ease-in-out; | ||||||
|  |         } | ||||||
|  |          | ||||||
|  |         @keyframes fadeIn { | ||||||
|  |             from { opacity: 0; transform: translateY(-5px); } | ||||||
|  |             to { opacity: 1; transform: translateY(0); } | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         .permission-item.parent { |         .permission-item.parent > .permission-node { | ||||||
|             font-weight: 500; |             background-color: #edf7ff; | ||||||
|  |             border-color: #bbdefb; | ||||||
|  |             font-weight: 600; | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         .permission-item.child { |         .permission-item.child .permission-node { | ||||||
|             font-weight: normal; |             margin-left: 15px; | ||||||
|  |             background-color: #f8f9fa; | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         /* 操作区域 */ |         /* 操作区域 */ | ||||||
|  | @ -550,7 +587,7 @@ | ||||||
|             } else { |             } else { | ||||||
|                 // 占位符保持对齐 |                 // 占位符保持对齐 | ||||||
|                 const placeholder = document.createElement('span'); |                 const placeholder = document.createElement('span'); | ||||||
|                 placeholder.style.width = '20px'; |                 placeholder.style.width = '28px'; | ||||||
|                 placeholder.style.display = 'inline-block'; |                 placeholder.style.display = 'inline-block'; | ||||||
|                 nodeDiv.appendChild(placeholder); |                 nodeDiv.appendChild(placeholder); | ||||||
|             } |             } | ||||||
|  | @ -603,6 +640,16 @@ | ||||||
|             const checkbox = event.target; |             const checkbox = event.target; | ||||||
|             const isChecked = checkbox.checked; |             const isChecked = checkbox.checked; | ||||||
|             const permissionCode = permission.code; |             const permissionCode = permission.code; | ||||||
|  |             const node = checkbox.closest('.permission-node'); | ||||||
|  |              | ||||||
|  |             // 更新节点选中样式 | ||||||
|  |             if (node) { | ||||||
|  |                 if (isChecked) { | ||||||
|  |                     node.classList.add('selected'); | ||||||
|  |                 } else { | ||||||
|  |                     node.classList.remove('selected'); | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|              |              | ||||||
|             if (isChecked) { |             if (isChecked) { | ||||||
|                 selectedPermissions.add(permissionCode); |                 selectedPermissions.add(permissionCode); | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue