2025-05-09 13:25:31 +08:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html lang="zh-Hant">
|
|
|
|
<head>
|
|
|
|
<meta charset="UTF-8" />
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
|
|
<title>功能列</title>
|
|
|
|
<style>
|
2025-05-13 17:49:03 +08:00
|
|
|
html, body {
|
|
|
|
height: 100%;
|
|
|
|
margin: 0;
|
|
|
|
padding: 0;
|
|
|
|
font-family: Arial, sans-serif;
|
|
|
|
background-color: #ffffff;
|
|
|
|
}
|
|
|
|
|
|
|
|
* {
|
|
|
|
box-sizing: border-box;
|
|
|
|
}
|
|
|
|
|
|
|
|
.sidebar {
|
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
|
|
|
background-color: #f8f9fa;
|
|
|
|
border-right: 1px solid #ddd;
|
|
|
|
overflow-y: auto;
|
|
|
|
overflow-x: hidden;
|
|
|
|
}
|
|
|
|
|
|
|
|
.sidebar img {
|
|
|
|
display: block;
|
|
|
|
margin: 20px auto;
|
|
|
|
width: 60px;
|
|
|
|
height: 60px;
|
|
|
|
border-radius: 50%;
|
|
|
|
}
|
|
|
|
|
|
|
|
.sidebar ul {
|
|
|
|
list-style: none;
|
|
|
|
padding: 0;
|
|
|
|
margin: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
.sidebar ul li {
|
|
|
|
color: #333;
|
|
|
|
cursor: pointer;
|
|
|
|
padding: 12px 20px;
|
|
|
|
transition: background 0.2s ease;
|
|
|
|
white-space: nowrap;
|
|
|
|
overflow: hidden;
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
max-width: 100%;
|
|
|
|
}
|
|
|
|
|
|
|
|
.sidebar ul li:hover,
|
|
|
|
.sidebar ul li.active {
|
|
|
|
background-color: #e6f0f8;
|
|
|
|
color: #007bff;
|
|
|
|
}
|
|
|
|
|
|
|
|
.has-submenu > .submenu-toggle {
|
|
|
|
display: flex;
|
|
|
|
justify-content: space-between;
|
|
|
|
align-items: center;
|
|
|
|
}
|
|
|
|
|
|
|
|
.has-submenu ul {
|
|
|
|
list-style: none;
|
|
|
|
padding-left: 15px;
|
|
|
|
margin: 0;
|
|
|
|
max-height: 0;
|
|
|
|
overflow: hidden;
|
|
|
|
transition: max-height 0.3s ease, padding 0.3s ease;
|
|
|
|
}
|
|
|
|
|
|
|
|
.has-submenu.open ul {
|
|
|
|
padding-top: 5px;
|
|
|
|
max-height: 200px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.has-submenu ul li {
|
|
|
|
padding: 10px 20px;
|
|
|
|
font-size: 16px;
|
|
|
|
color: #444;
|
|
|
|
}
|
|
|
|
|
|
|
|
.has-submenu ul li:hover {
|
|
|
|
background-color: #deeaf6;
|
|
|
|
}
|
|
|
|
|
|
|
|
.submenu-arrow {
|
|
|
|
font-size: 12px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.badge {
|
|
|
|
display: inline-block;
|
|
|
|
min-width: 20px;
|
|
|
|
padding: 2px 6px;
|
|
|
|
margin-left: 8px;
|
|
|
|
font-size: 12px;
|
|
|
|
font-weight: bold;
|
|
|
|
color: white;
|
|
|
|
background-color: red;
|
|
|
|
border-radius: 10px;
|
|
|
|
text-align: center;
|
|
|
|
vertical-align: middle;
|
|
|
|
}
|
|
|
|
|
|
|
|
.sidebar ul li .li-content {
|
|
|
|
display: flex;
|
|
|
|
justify-content: space-between;
|
|
|
|
align-items: center;
|
|
|
|
}
|
|
|
|
|
|
|
|
.sidebar ul li .li-content span {
|
|
|
|
white-space: nowrap;
|
|
|
|
overflow: hidden;
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
}
|
2025-05-09 13:25:31 +08:00
|
|
|
</style>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<div class="sidebar">
|
2025-05-12 17:29:54 +08:00
|
|
|
<img src="https://cdn-icons-png.freepik.com/512/4873/4873262.png" alt="Logo" />
|
2025-05-09 13:25:31 +08:00
|
|
|
<ul>
|
2025-05-12 17:29:54 +08:00
|
|
|
<li class="active" onclick="requestNavigation('dashboard.html', this)">首頁</li>
|
2025-05-13 17:49:03 +08:00
|
|
|
|
|
|
|
<li class="has-submenu">
|
|
|
|
<div class="submenu-toggle" onclick="toggleSubmenu(this)">
|
|
|
|
<span>住戶居民</span>
|
|
|
|
<span class="submenu-arrow">▼</span>
|
|
|
|
</div>
|
|
|
|
<ul>
|
|
|
|
<li onclick="requestNavigation('Activation.html', this)">
|
|
|
|
<div class="li-content">
|
|
|
|
<span>未開通居民</span>
|
|
|
|
<span class="badge">8</span>
|
|
|
|
</div>
|
|
|
|
</li>
|
|
|
|
<li onclick="requestNavigation('Activation.html', this)">居民列表</li>
|
|
|
|
</ul>
|
|
|
|
</li>
|
|
|
|
|
2025-05-12 17:29:54 +08:00
|
|
|
<li onclick="requestNavigation('some_page1.html', this)">出入管理</li>
|
|
|
|
<li onclick="requestNavigation('some_page2.html', this)">緊急通報</li>
|
|
|
|
<li onclick="requestNavigation('some_page3.html', this)">訊息通知</li>
|
|
|
|
<li onclick="requestNavigation('some_page4.html', this)">水電服務</li>
|
|
|
|
<li onclick="requestNavigation('some_page5.html', this)">佈告欄</li>
|
|
|
|
<li onclick="requestNavigation('some_page6.html', this)">報表匯出</li>
|
|
|
|
<li onclick="requestNavigation('some_page7.html', this)">設定</li>
|
2025-05-13 17:49:03 +08:00
|
|
|
</ul>
|
2025-05-09 13:25:31 +08:00
|
|
|
</div>
|
2025-05-12 17:29:54 +08:00
|
|
|
|
|
|
|
<script>
|
|
|
|
function requestNavigation(url, clickedElement) {
|
|
|
|
console.log('Sidebar: 發送導航請求 ->', url);
|
|
|
|
parent.postMessage({ type: 'navigate', url: url }, '*');
|
|
|
|
|
2025-05-13 17:49:03 +08:00
|
|
|
const listItems = document.querySelectorAll('.sidebar ul > li');
|
|
|
|
listItems.forEach(item => item.classList.remove('active'));
|
|
|
|
if (!clickedElement.closest('.has-submenu')) {
|
2025-05-12 17:29:54 +08:00
|
|
|
clickedElement.classList.add('active');
|
|
|
|
}
|
|
|
|
}
|
2025-05-13 17:49:03 +08:00
|
|
|
|
|
|
|
function toggleSubmenu(toggleElement) {
|
|
|
|
const parentLi = toggleElement.closest('.has-submenu');
|
|
|
|
parentLi.classList.toggle('open');
|
|
|
|
|
|
|
|
const arrow = toggleElement.querySelector('.submenu-arrow');
|
|
|
|
if (arrow) {
|
|
|
|
arrow.textContent = parentLi.classList.contains('open') ? '▲' : '▼';
|
|
|
|
}
|
|
|
|
}
|
2025-05-12 17:29:54 +08:00
|
|
|
</script>
|
2025-05-09 13:25:31 +08:00
|
|
|
</body>
|
|
|
|
</html>
|