base.html
14.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<title>{% block title %}WeChat Viewer{% endblock %}</title>
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: #f0f2f5; color: #333; height: 100vh; overflow: hidden; }
/* Top bar */
.topbar { background: #2c3e50; color: white; height: 48px; display: flex; align-items: center; padding: 0 12px; gap: 12px; position: fixed; top: 0; left: 0; right: 0; z-index: 100; }
.topbar .menu-btn { background: none; border: none; color: white; font-size: 22px; cursor: pointer; padding: 4px 8px; line-height: 1; }
.topbar .brand { font-size: 15px; font-weight: bold; }
.topbar .brand-sub { font-size: 12px; color: #95a5a6; margin-left: 4px; }
.topbar .spacer { flex: 1; }
.topbar select { padding: 3px 8px; border: 1px solid #555; border-radius: 4px; background: #2c3e50; color: white; font-size: 11px; max-width: 120px; }
/* Drawer overlay */
.overlay { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.4); z-index: 200; }
.overlay.show { display: block; }
/* Drawer */
.drawer { position: fixed; top: 0; left: 0; bottom: 0; width: 260px; background: #2c3e50; z-index: 201; transform: translateX(-100%); transition: transform 0.25s ease; display: flex; flex-direction: column; overflow-y: auto; }
.drawer.open { transform: translateX(0); }
.drawer .drawer-header { padding: 16px; border-bottom: 1px solid rgba(255,255,255,0.1); }
.drawer .drawer-header .d-brand { font-size: 18px; font-weight: bold; color: white; }
.drawer .drawer-header .d-sub { font-size: 11px; color: #7f8c8d; margin-top: 4px; }
.drawer .drawer-nav { flex: 1; padding: 8px 0; }
.drawer .drawer-nav a { display: flex; align-items: center; gap: 10px; padding: 12px 20px; color: #bbb; text-decoration: none; font-size: 14px; transition: .15s; }
.drawer .drawer-nav a:hover { background: rgba(255,255,255,0.05); color: white; }
.drawer .drawer-nav a.active { background: rgba(255,255,255,0.1); color: white; font-weight: bold; border-left: 3px solid #3498db; padding-left: 17px; }
.drawer .drawer-nav a .icon { font-size: 16px; width: 22px; text-align: center; }
.drawer .drawer-footer { padding: 12px 16px; border-top: 1px solid rgba(255,255,255,0.1); }
.drawer .drawer-footer select { width: 100%; padding: 6px 8px; border: 1px solid #555; border-radius: 4px; background: #34495e; color: white; font-size: 12px; }
/* Main content */
.main { height: 100vh; padding-top: 48px; overflow-y: auto; background: #f0f2f5; }
/* Shared components (unchanged from original) */
/* Session list */
.sidebar { width: 320px; background: white; border-right: 1px solid #e0e0e0; overflow-y: auto; flex-shrink: 0; }
.layout { display: flex; height: 100%; }
.search-box { padding: 12px; border-bottom: 1px solid #eee; position: sticky; top: 0; background: white; z-index: 10; }
.search-box input { width: 100%; padding: 8px 12px; border: 1px solid #ddd; border-radius: 6px; font-size: 13px; outline: none; }
.search-box input:focus { border-color: #3498db; }
.session-item { padding: 14px 16px; border-bottom: 1px solid #f5f5f5; cursor: pointer; transition: .15s; display: flex; gap: 10px; }
.session-item:hover { background: #f5f7fa; }
.session-item.active { background: #e8f0fe; }
.session-item .avatar { width: 40px; height: 40px; border-radius: 4px; background: #3498db; color: white; display: flex; align-items: center; justify-content: center; font-size: 16px; font-weight: bold; flex-shrink: 0; }
.session-item .avatar.group { background: #27ae60; }
.session-item .avatar.official { background: #e67e22; }
.session-item .info { flex: 1; min-width: 0; }
.session-item .name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.session-item .preview { font-size: 12px; color: #999; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.session-item .time { font-size: 11px; color: #bbb; margin-top: 4px; }
/* Messages */
.messages { padding: 20px; max-width: 800px; margin: 0 auto; }
.msg-header { background: white; padding: 16px 20px; border-radius: 8px; margin-bottom: 16px; box-shadow: 0 1px 2px rgba(0,0,0,0.05); }
.msg-header h2 { font-size: 18px; }
.msg-header .sub { font-size: 12px; color: #999; margin-top: 4px; }
.msg-bubble { margin-bottom: 12px; display: flex; }
.msg-bubble.sent { justify-content: flex-end; }
.msg-bubble .bubble { max-width: 70%; padding: 10px 14px; border-radius: 8px; font-size: 14px; line-height: 1.5; word-break: break-all; position: relative; }
.msg-bubble.received .bubble { background: white; color: #333; }
.msg-bubble.sent .bubble { background: #95EC69; color: #333; }
.msg-bubble .time-sub { font-size: 11px; color: #999; margin-top: 4px; text-align: right; }
.msg-bubble img { max-width: 240px; border-radius: 4px; cursor: pointer; }
.msg-bubble video { max-width: 240px; border-radius: 4px; }
.msg-bubble audio { margin-top: 6px; }
.msg-bubble .msg-type-badge { font-size: 10px; color: #999; background: #f0f0f0; padding: 2px 6px; border-radius: 3px; margin-right: 6px; }
.msg-bubble a { color: #3498db; }
.empty-state { text-align: center; padding: 60px 20px; color: #999; }
.empty-state .icon { font-size: 48px; margin-bottom: 12px; }
/* Shared page styles */
.circle-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; padding: 20px; }
.circle-card { background: white; border-radius: 8px; padding: 20px; box-shadow: 0 1px 2px rgba(0,0,0,0.05); }
.circle-card h3 { font-size: 16px; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.circle-card .count { font-size: 12px; color: #999; background: #f0f0f0; padding: 2px 8px; border-radius: 10px; }
.stats-bar { padding: 20px; display: flex; gap: 20px; }
.stat-item { background: white; padding: 16px 24px; border-radius: 8px; box-shadow: 0 1px 2px rgba(0,0,0,0.05); text-align: center; flex: 1; }
.stat-item .num { font-size: 28px; font-weight: bold; color: #2c3e50; }
.stat-item .label { font-size: 12px; color: #999; margin-top: 4px; }
.list-table { width: 100%; border-collapse: collapse; }
.list-table th, .list-table td { text-align: left; padding: 8px 12px; border-bottom: 1px solid #f0f0f0; font-size: 13px; }
.list-table th { color: #999; font-weight: 500; font-size: 12px; }
.list-table .tag { font-size: 11px; padding: 2px 8px; border-radius: 10px; }
.list-table .tag.pending { background: #fff3cd; color: #856404; }
.list-table .tag.read { background: #d4edda; color: #155724; }
.loading { text-align: center; padding: 40px; color: #999; }
.spinner { display: inline-block; width: 24px; height: 24px; border: 3px solid #ddd; border-top-color: #3498db; border-radius: 50%; animation: spin .6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; top: 60px; right: 20px; background: #333; color: white; padding: 10px 20px; border-radius: 6px; font-size: 13px; z-index: 1000; opacity: 0; transition: .3s; }
.toast.show { opacity: 1; }
.article-card { background: white; border-radius: 8px; padding: 12px; margin: 4px 0; border: 1px solid #e8e8e8; cursor: pointer; transition: .15s; display: flex; gap: 10px; text-decoration: none; color: inherit; }
.article-card:hover { background: #f8f9fa; }
.article-card .card-thumb { width: 60px; height: 60px; border-radius: 4px; object-fit: cover; flex-shrink: 0; background: #f0f0f0; }
.article-card .card-body { flex: 1; min-width: 0; }
.article-card .card-title { font-size: 13px; font-weight: 600; line-height: 1.4; margin-bottom: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.article-card .card-desc { font-size: 11px; color: #999; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.article-card .card-source { font-size: 10px; color: #bbb; margin-top: 4px; }
.finder-card { background: white; border-radius: 8px; overflow: hidden; margin: 4px 0; border: 1px solid #e8e8e8; cursor: pointer; }
.finder-card .finder-cover { position: relative; width: 100%; aspect-ratio: 9/16; max-height: 280px; background: #000; overflow: hidden; }
.finder-card .finder-cover img { width: 100%; height: 100%; object-fit: cover; }
.finder-card .finder-play { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); width: 48px; height: 48px; background: rgba(0,0,0,0.6); border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.finder-card .finder-play::after { content: ''; border-left: 14px solid white; border-top: 8px solid transparent; border-bottom: 8px solid transparent; margin-left: 4px; }
.finder-card .finder-dur { position: absolute; bottom: 8px; right: 8px; background: rgba(0,0,0,0.7); color: white; font-size: 11px; padding: 2px 6px; border-radius: 3px; }
.finder-card .finder-info { padding: 10px 12px; display: flex; gap: 8px; align-items: flex-start; }
.finder-card .finder-avatar { width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0; }
.finder-card .finder-body { flex: 1; min-width: 0; }
.finder-card .finder-nick { font-size: 12px; font-weight: 600; color: #576b95; }
.finder-card .finder-desc { font-size: 12px; color: #333; margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.msg-image-wrap { position: relative; display: inline-block; max-width: 300px; }
.msg-image-wrap img { width: 100%; border-radius: 6px; cursor: pointer; }
.msg-image-wrap .dl-hint { position: absolute; bottom: 4px; right: 4px; background: rgba(0,0,0,0.6); color: white; font-size: 10px; padding: 2px 6px; border-radius: 3px; opacity: 0; transition: .2s; }
.msg-image-wrap:hover .dl-hint { opacity: 1; }
.img-modal { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.9); z-index: 999; align-items: center; justify-content: center; flex-direction: column; }
.img-modal img { max-width: 95%; max-height: 80%; border-radius: 4px; }
.img-modal .dl-btn { margin-top: 12px; padding: 8px 20px; background: #3498db; color: white; border: none; border-radius: 6px; cursor: pointer; font-size: 14px; }
.img-modal .dl-btn:hover { background: #2980b9; }
@media (max-width: 768px) {
.sidebar { width: 100%; height: 40%; }
.main { height: 60%; }
.layout { flex-direction: column; }
.circle-grid { grid-template-columns: 1fr; }
}
</style>
</head>
<body>
<!-- Top bar -->
<div class="topbar">
<button class="menu-btn" onclick="toggleDrawer()" aria-label="菜单">☰</button>
<span class="brand">📱 微信管理</span>
<span class="brand-sub">{% block page_title %}{% endblock %}</span>
{% block topbar_extra %}{% endblock %}
<span class="spacer"></span>
<select id="accountSwitcher" onchange="switchAccount(this.value)">
<option value="">加载中...</option>
</select>
</div>
<!-- Overlay -->
<div class="overlay" id="overlay" onclick="closeDrawer()"></div>
<!-- Drawer -->
<div class="drawer" id="drawer">
<div class="drawer-header">
<div class="d-brand">📱 微信管理</div>
<div class="d-sub">WeChat Viewer</div>
</div>
<div class="drawer-nav">
<a href="/dashboard" class="{% if request.path == '/dashboard' %}active{% endif %}">
<span class="icon">📊</span> 数据看板
</a>
<a href="/chat" class="{% if request.path == '/chat' %}active{% endif %}">
<span class="icon">🤖</span> AI 对话
</a>
<a href="/" class="{% if request.path == '/' %}active{% endif %}">
<span class="icon">💬</span> 消息
</a>
<a href="/articles" class="{% if request.path == '/articles' %}active{% endif %}">
<span class="icon">📰</span> 文章列表
</a>
<a href="/reports" class="{% if request.path == '/reports' %}active{% endif %}">
<span class="icon">📋</span> 日报列表
</a>
<a href="/report-images" class="{% if request.path == '/report-images' %}active{% endif %}">
<span class="icon">🖼</span> 日报图片
</a>
<a href="/jobs" class="{% if request.path.startswith('/job') %}active{% endif %}">
<span class="icon">🔧</span> 任务监控
</a>
<a href="/learn" class="{% if request.path == '/learn' %}active{% endif %}">
<span class="icon">📚</span> 学习管线
</a>
<a href="/approvals" class="{% if request.path.startswith('/approval') %}active{% endif %}">
<span class="icon">✅</span> 自动回复审批
</a>
<a href="/whitelist" class="{% if request.path.startswith('/whitelist') %}active{% endif %}">
<span class="icon">⭐</span> 回复白名单
</a>
<a href="/cron" class="{% if request.path.startswith('/cron') %}active{% endif %}">
<span class="icon">⏱</span> Cron 管理
</a>
</div>
<div class="drawer-footer">
<select id="drawerAccountSwitcher" onchange="switchAccount(this.value)">
<option value="">加载中...</option>
</select>
</div>
</div>
<script>
function toggleDrawer() {
var d = document.getElementById('drawer');
var o = document.getElementById('overlay');
if (d.classList.contains('open')) { closeDrawer(); }
else { d.classList.add('open'); o.classList.add('show'); }
}
function closeDrawer() {
document.getElementById('drawer').classList.remove('open');
document.getElementById('overlay').classList.remove('show');
}
async function loadAccounts(){
try{var r=await fetch('/api/accounts');var j=await r.json();
if(j.ok){
var opts='';
for(var i=0;i<j.data.accounts.length;i++){var a=j.data.accounts[i];
opts+='<option value="'+a.id+'"'+(a.id===j.data.current?' selected':'')+'>'+escHtml(a.name)+'</option>';
}
document.getElementById('accountSwitcher').innerHTML=opts;
document.getElementById('drawerAccountSwitcher').innerHTML=opts;
}
}catch(e){}
}
async function switchAccount(id){
try{await fetch('/api/accounts/switch',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({account_id:id})});
location.reload();
}catch(e){}
}
function escHtml(s){return String(s).replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>').replace(/"/g,'"');}
loadAccounts();
// Close drawer on swipe-right (mobile)
var touchStartX=0;
document.addEventListener('touchstart',function(e){touchStartX=e.touches[0].clientX});
document.addEventListener('touchend',function(e){
var dx=e.changedTouches[0].clientX-touchStartX;
if(dx>80&&touchStartX<30)closeDrawer();
});
</script>
<div class="main">
{% block body %}{% endblock %}
</div>
</body>
</html>