211 lines
5.1 KiB
HTML
211 lines
5.1 KiB
HTML
|
<!DOCTYPE html>
|
||
|
<html lang="zh-Hant">
|
||
|
<head>
|
||
|
<meta charset="UTF-8" />
|
||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
||
|
<title>訊息中心</title>
|
||
|
<style>
|
||
|
* {
|
||
|
box-sizing: border-box;
|
||
|
font-family: 'Noto Sans TC', sans-serif;
|
||
|
margin: 0;
|
||
|
padding: 0;
|
||
|
}
|
||
|
|
||
|
body {
|
||
|
background-color: #f7f8fa;
|
||
|
color: #333;
|
||
|
padding-bottom: 80px;
|
||
|
}
|
||
|
|
||
|
header {
|
||
|
background-color: #9eaf9f;
|
||
|
color: #fff;
|
||
|
padding: 16px;
|
||
|
font-size: 20px;
|
||
|
font-weight: bold;
|
||
|
text-align: center;
|
||
|
position: relative;
|
||
|
}
|
||
|
|
||
|
.back-button {
|
||
|
position: absolute;
|
||
|
top: 12px;
|
||
|
left: 16px;
|
||
|
cursor: pointer;
|
||
|
}
|
||
|
|
||
|
.back-button img {
|
||
|
width: 24px;
|
||
|
height: 24px;
|
||
|
filter: brightness(0) invert(1);
|
||
|
}
|
||
|
|
||
|
.chat-box {
|
||
|
padding: 16px;
|
||
|
max-height: 70vh;
|
||
|
overflow-y: auto;
|
||
|
}
|
||
|
|
||
|
.message {
|
||
|
max-width: 75%;
|
||
|
padding: 10px 16px;
|
||
|
margin-bottom: 12px;
|
||
|
border-radius: 16px;
|
||
|
font-size: 14px;
|
||
|
line-height: 1.5;
|
||
|
word-break: break-word;
|
||
|
}
|
||
|
|
||
|
.message.user {
|
||
|
background-color: #d0e9c6;
|
||
|
align-self: flex-end;
|
||
|
margin-left: auto;
|
||
|
}
|
||
|
|
||
|
.message.admin {
|
||
|
background-color: #e0e0e0;
|
||
|
align-self: flex-start;
|
||
|
margin-right: auto;
|
||
|
}
|
||
|
|
||
|
.chat-container {
|
||
|
display: flex;
|
||
|
flex-direction: column;
|
||
|
}
|
||
|
|
||
|
.chat-input {
|
||
|
position: fixed;
|
||
|
bottom: 56px;
|
||
|
left: 0;
|
||
|
right: 0;
|
||
|
background-color: #fff;
|
||
|
padding: 8px 12px;
|
||
|
display: flex;
|
||
|
gap: 8px;
|
||
|
border-top: 1px solid #ddd;
|
||
|
}
|
||
|
|
||
|
.chat-input input {
|
||
|
flex: 1;
|
||
|
border-radius: 20px;
|
||
|
border: 1px solid #ccc;
|
||
|
padding: 8px 16px;
|
||
|
}
|
||
|
|
||
|
.chat-input button {
|
||
|
background-color: #4caf50;
|
||
|
color: white;
|
||
|
border: none;
|
||
|
border-radius: 20px;
|
||
|
padding: 8px 16px;
|
||
|
font-size: 14px;
|
||
|
}
|
||
|
|
||
|
.chat-input button:hover {
|
||
|
background-color: #388e3c;
|
||
|
}
|
||
|
|
||
|
.footer-nav {
|
||
|
position: fixed;
|
||
|
bottom: 0;
|
||
|
left: 0;
|
||
|
right: 0;
|
||
|
background-color: #fff;
|
||
|
border-top: 1px solid #ddd;
|
||
|
display: flex;
|
||
|
justify-content: space-around;
|
||
|
padding: 8px 0;
|
||
|
}
|
||
|
|
||
|
.footer-nav a {
|
||
|
text-decoration: none;
|
||
|
font-size: 12px;
|
||
|
color: #666;
|
||
|
text-align: center;
|
||
|
}
|
||
|
|
||
|
.footer-nav img {
|
||
|
width: 24px;
|
||
|
height: 24px;
|
||
|
margin-bottom: 4px;
|
||
|
}
|
||
|
|
||
|
.chat-input {
|
||
|
position: fixed;
|
||
|
bottom: 56px; /* 原本是這裡 */
|
||
|
}
|
||
|
.chat-input {
|
||
|
position: fixed;
|
||
|
bottom: 64px; /* 增加高度,避免壓到 navbar */
|
||
|
left: 0;
|
||
|
right: 0;
|
||
|
background-color: #fff;
|
||
|
padding: 8px 12px;
|
||
|
display: flex;
|
||
|
gap: 8px;
|
||
|
border-top: 1px solid #ddd;
|
||
|
z-index: 10;
|
||
|
}
|
||
|
</style>
|
||
|
</head>
|
||
|
<body>
|
||
|
|
||
|
<header>
|
||
|
<div class="back-button">
|
||
|
<img src="https://img.icons8.com/ios-filled/50/ffffff/left.png" alt="返回" onclick="history.back()" />
|
||
|
</div>
|
||
|
訊息中心
|
||
|
</header>
|
||
|
|
||
|
<!-- 聊天內容 -->
|
||
|
<div class="chat-box">
|
||
|
<div class="chat-container">
|
||
|
<div class="message admin">您好,請記得繳交這個月的管理費。</div>
|
||
|
<div class="message user">好的,謝謝通知!</div>
|
||
|
<div class="message admin">提醒您 4/18 上午社區將進行水塔清洗,會暫停供水。</div>
|
||
|
<div class="message user">了解!</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<!-- 輸入區 -->
|
||
|
<div class="chat-input">
|
||
|
<label for="imageUpload" class="btn btn-light p-0 m-0">
|
||
|
<img src="https://img.icons8.com/ios-filled/24/image.png" alt="夾帶圖片" style="width: 24px; height: 24px; margin: 8px;" />
|
||
|
</label>
|
||
|
<input type="file" id="imageUpload" accept="image/*" style="display: none;" />
|
||
|
|
||
|
<input type="text" placeholder="輸入訊息..." />
|
||
|
<button>發送</button>
|
||
|
</div>
|
||
|
|
||
|
<!-- 底部選單 -->
|
||
|
<nav class="navbar fixed-bottom navbar-light bg-light border-top">
|
||
|
<div class="container justify-content-around">
|
||
|
<a class="nav-link text-center" href="main.html"><div>🏠<br>首頁</div></a>
|
||
|
<a class="nav-link text-center" href="#report"><div>🚪<br>出入</div></a>
|
||
|
<a class="nav-link text-center" href="message.html"><div>💬<br>訊息</div></a>
|
||
|
<a class="nav-link text-center" href="#"><div>👤<br>住戶</div></a>
|
||
|
</div>
|
||
|
</nav>
|
||
|
|
||
|
<script>
|
||
|
// 這裡可日後補上發送功能或 AJAX
|
||
|
document.querySelector('.chat-input button').addEventListener('click', () => {
|
||
|
const input = document.querySelector('.chat-input input');
|
||
|
const text = input.value.trim();
|
||
|
if (text !== '') {
|
||
|
const msg = document.createElement('div');
|
||
|
msg.className = 'message user';
|
||
|
msg.textContent = text;
|
||
|
document.querySelector('.chat-container').appendChild(msg);
|
||
|
input.value = '';
|
||
|
document.querySelector('.chat-box').scrollTop = document.querySelector('.chat-box').scrollHeight;
|
||
|
}
|
||
|
});
|
||
|
</script>
|
||
|
|
||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
|
||
|
</body>
|
||
|
</html>
|