python-wechat-kf/app/templates/index.html

81 lines
4.5 KiB
HTML

<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>微信客服 - 消息测试</title>
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; height: 100vh; display: flex; }
/* 侧栏 */
.sidebar {
width: 320px; border-right: 1px solid #e0e0e0; display: flex; flex-direction: column; background: #f5f5f5;
}
.sidebar-header { padding: 16px; border-bottom: 1px solid #e0e0e0; background: #fff; }
.sidebar-header h2 { font-size: 18px; margin-bottom: 8px; }
.sidebar-header button { padding: 6px 16px; background: #07c160; color: #fff; border: none; border-radius: 4px; cursor: pointer; font-size: 14px; }
.sidebar-header button:hover { background: #06ad56; }
.conversation-list { flex: 1; overflow-y: auto; }
.conv-item {
padding: 14px 16px; cursor: pointer; border-bottom: 1px solid #e8e8e8; transition: background .15s;
}
.conv-item:hover { background: #ececec; }
.conv-item.active { background: #d9d9d9; }
.conv-item .userid { font-size: 14px; font-weight: 500; color: #333; }
.conv-item .preview { font-size: 13px; color: #888; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-item .time { font-size: 12px; color: #aaa; margin-top: 2px; }
/* 消息区域 */
.main { flex: 1; display: flex; flex-direction: column; }
.msg-header {
padding: 16px; border-bottom: 1px solid #e0e0e0; font-size: 16px; font-weight: 500; background: #fff;
}
.msg-list { flex: 1; overflow-y: auto; padding: 16px; background: #ededed; display: flex; flex-direction: column; gap: 12px; }
.msg-bubble {
max-width: 70%; padding: 10px 14px; border-radius: 8px; font-size: 15px; line-height: 1.5; word-break: break-word;
}
.msg-inbound { align-self: flex-start; background: #fff; color: #333; }
.msg-outbound { align-self: flex-end; background: #95ec69; color: #000; }
.msg-time { font-size: 11px; color: #aaa; margin-top: 4px; }
.empty-state { flex: 1; display: flex; align-items: center; justify-content: center; color: #999; font-size: 15px; }
/* 输入区 */
.input-area { padding: 16px; border-top: 1px solid #e0e0e0; background: #fff; display: flex; gap: 10px; }
.input-area input { flex: 1; padding: 10px 14px; border: 1px solid #ddd; border-radius: 6px; font-size: 15px; outline: none; }
.input-area input:focus { border-color: #07c160; }
.input-area button { padding: 10px 24px; background: #07c160; color: #fff; border: none; border-radius: 6px; cursor: pointer; font-size: 15px; }
.input-area button:hover { background: #06ad56; }
.input-area button:disabled { background: #aaa; cursor: not-allowed; }
.toast { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); padding: 10px 20px; border-radius: 6px; color: #fff; font-size: 14px; z-index: 999; transition: opacity .3s; }
.toast-success { background: #07c160; }
.toast-error { background: #f44336; }
</style>
</head>
<body>
<!-- 侧栏 -->
<div class="sidebar">
<div class="sidebar-header">
<h2>会话列表</h2>
<div style="margin-bottom:6px;font-size:12px;color:#888;">
KFID: <span id="currentKfid">...</span>
</div>
<button onclick="syncMessages()">同步拉取</button>
<button onclick="fetchAccounts()" style="background:#576b95;margin-left:4px;">查账号</button>
<span id="syncStatus" style="font-size:12px;color:#888;margin-left:8px;"></span>
</div>
<div class="conversation-list" id="conversationList"></div>
</div>
<!-- 消息区 -->
<div class="main">
<div class="msg-header" id="msgHeader">请选择会话</div>
<div class="msg-list" id="messageList">
<div class="empty-state">选择左侧会话查看消息</div>
</div>
<div class="input-area">
<input type="text" id="msgInput" placeholder="输入消息..." onkeydown="if(event.key==='Enter') sendMessage()">
<button id="sendBtn" onclick="sendMessage()" disabled>发送</button>
</div>
</div>
<div class="toast" id="toast" style="display:none;"></div>
<script src="/static/app.js?v=2"></script>
</body>
</html>