Files
shijian/docs/ui-preview.html
T

508 lines
18 KiB
HTML
Raw Normal View History

2026-11-26 10:08:04 +08:00
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="color-scheme" content="light">
<title>拾见 · 界面预览</title>
<style>
:root {
--ink: #172a24;
--muted: #4e6358;
--green: #076c53;
--screen: #f3f5f0;
--tint: #e5f0e8;
--line: #cbd7ce;
--alert: #863c15;
font: 16px/1.55 system-ui, "Microsoft YaHei", "PingFang SC", sans-serif;
color: var(--ink);
background: #e8ede6;
}
* { box-sizing: border-box; }
body { margin: 0; }
a { color: inherit; }
a:focus-visible, [tabindex]:focus-visible {
outline: 2px solid var(--green);
outline-offset: 3px;
}
.preview {
max-width: 1312px;
margin-inline: auto;
padding: 42px clamp(20px, 4vw, 56px) 48px;
}
.preview-header {
display: flex;
align-items: center;
gap: 16px;
margin-bottom: 32px;
}
.mark {
display: grid;
place-content: center;
justify-items: center;
flex: 0 0 52px;
height: 52px;
gap: 5px;
border-radius: 14px;
background: var(--green);
}
.mark i { height: 4px; background: var(--screen); }
.mark i:nth-child(1) { width: 28px; }
.mark i:nth-child(2) { width: 20px; }
.mark i:nth-child(3) { width: 12px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(26px, 4vw, 38px); font-weight: 740; line-height: 1.15; }
.preview-header p { margin-top: 7px; color: var(--muted); font-size: 14px; }
.screen-grid {
display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr));
gap: clamp(16px, 2.15vw, 30px);
align-items: start;
}
.screen-figure {
display: grid;
gap: 9px;
margin: 0;
min-width: 0;
scroll-margin-top: 18px;
}
.screen-figure figcaption { padding-inline: 8px; font-size: 16px; font-weight: 700; }
.screen-figure:target .phone { border-color: var(--green); }
.phone {
display: grid;
grid-template-rows: auto minmax(0, 1fr) auto;
min-width: 0;
height: 735px;
overflow: hidden;
border: 1px solid #aebfb2;
border-radius: 26px;
background: var(--screen);
box-shadow: 0 12px 28px #172a2411;
}
.app-name {
padding: 21px 20px 8px;
font-size: 30px;
font-weight: 740;
line-height: 1.2;
}
.phone-content {
overflow: auto;
padding: 6px 17px 8px;
scrollbar-color: #a9c2b2 transparent;
scrollbar-width: thin;
}
.card {
margin-bottom: 12px;
padding: 12px 16px 14px;
border-radius: 18px;
background: #fff;
}
.card h3 { margin-bottom: 4px; font-size: 19px; line-height: 1.45; }
.card p { margin-top: 6px; font-size: 14px; }
.card .mode { font-size: 15px; }
.hint, .summary { color: var(--muted); }
progress {
display: block;
width: 100%;
height: 4px;
margin: 12px 0 8px;
appearance: none;
overflow: hidden;
border: 0;
border-radius: 4px;
background: var(--tint);
}
progress::-webkit-progress-bar { background: var(--tint); }
progress::-webkit-progress-value { background: var(--green); }
progress::-moz-progress-bar { background: var(--green); }
.action, .app-nav a {
display: grid;
place-items: center;
min-height: 46px;
padding: 6px 10px;
border-radius: 12px;
background: var(--tint);
color: var(--green);
font-size: 15px;
font-weight: 650;
text-align: center;
text-decoration: none;
}
.action {
width: 100%;
margin-top: 7px;
}
#photo-binding [hidden] { display: none; }
#photo-binding button { border: 0; cursor: pointer; }
.action.primary, .app-nav [aria-current="page"] {
color: #fff;
background: var(--green);
}
.action[aria-disabled="true"] {
color: #fff;
background: #668b7a;
}
.app-nav {
display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr));
gap: 4px;
padding: 7px 16px 12px;
}
.app-nav a:hover { box-shadow: inset 0 0 0 1px var(--green); }
.fields {
display: grid;
gap: 10px;
margin: 7px 0 0;
}
.fields dt { margin-bottom: 3px; font-size: 14px; font-weight: 700; }
.fields dd { margin: 0; }
.control {
display: flex;
align-items: center;
min-height: 42px;
padding: 8px 11px;
border-radius: 9px;
background: var(--screen);
font-size: 15px;
overflow-wrap: anywhere;
}
.select { justify-content: space-between; gap: 9px; }
.select::after {
content: "";
width: 7px;
height: 7px;
flex: 0 0 7px;
margin: -4px 2px 0 0;
transform: rotate(45deg);
border-right: 1.5px solid currentColor;
border-bottom: 1.5px solid currentColor;
}
.multiline { min-height: 60px; align-items: start; }
.settings-input {
display: block;
width: 100%;
border: 0;
color: inherit;
font: inherit;
font-size: 15px;
}
.settings-input:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
textarea.settings-input { resize: vertical; }
.range {
display: grid;
grid-template-columns: 1fr auto 1fr;
align-items: center;
gap: 8px;
font-size: 14px;
}
.checkbox {
display: flex;
gap: 8px;
align-items: center;
min-height: 32px;
font-size: 14px;
}
.checkbox::before {
content: "";
width: 15px;
height: 15px;
flex: 0 0 15px;
border: 1.5px solid var(--muted);
border-radius: 3px;
}
code { font-size: .92em; overflow-wrap: anywhere; }
.entries {
display: grid;
gap: 7px;
margin: 8px 0 0;
padding: 0;
list-style: none;
font-size: 14px;
overflow-wrap: anywhere;
}
.entries li { padding: 0 0 7px; border-bottom: 1px solid var(--line); }
.entries li:last-child { padding-bottom: 0; border-bottom: 0; }
.entries time { font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; }
.entries .warning { color: var(--alert); }
@media (max-width: 970px) {
.screen-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 610px) {
.preview { max-width: 442px; padding-top: 25px; }
.preview-header { gap: 12px; margin-bottom: 22px; }
.mark { flex-basis: 44px; height: 44px; border-radius: 12px; }
.screen-grid { grid-template-columns: 1fr; gap: 26px; }
.phone { height: min(735px, max(530px, 80svh)); }
}
@media print {
:root { background: #fff; }
.preview { padding: 0; }
.screen-grid { display: block; }
.screen-figure { margin-bottom: 20px; }
.phone { height: auto; overflow: visible; box-shadow: none; }
.phone-content { overflow: visible; }
.card { break-inside: avoid; border: 1px solid var(--line); }
}
</style>
</head>
<body>
<main class="preview">
<header class="preview-header">
<span class="mark" aria-hidden="true"><i></i><i></i><i></i></span>
<div>
<h1>拾见 · 界面预览</h1>
<p>离线预览,可编辑话术并试用本机图片绑定。日志为演示数据。</p>
</div>
</header>
<div class="screen-grid">
<figure class="screen-figure" id="task">
<figcaption>任务</figcaption>
<section class="phone" aria-label="拾见任务页">
<h2 class="app-name">拾见</h2>
<div class="phone-content">
<div class="card">
<h3>准备运行</h3>
<p class="mode">抖音 · 仅浏览</p>
<p>关键词 1 个 · 单次 3 条</p>
<progress value="0" max="3" aria-label="已处理 0 条,共 3 条"></progress>
<p class="summary">已处理 0 / 3 · 已确认发送 0</p>
<p>关键词 国外大模型充值</p>
</div>
<div class="card">
<h3>无障碍服务未连接</h3>
<p>在系统设置中开启「拾见任务服务」,然后返回这里。</p>
<span class="action primary">打开无障碍设置</span>
</div>
<span class="action primary" aria-disabled="true">开始任务</span>
<span class="action">启用通知栏暂停按钮</span>
</div>
<nav class="app-nav" aria-label="任务页导航">
<a href="#task" aria-current="page">任务</a>
<a href="#settings">配置</a>
<a href="#logs">日志</a>
</nav>
</section>
</figure>
<figure class="screen-figure" id="settings">
<figcaption>配置</figcaption>
<section class="phone" aria-label="拾见配置页">
<h2 class="app-name">拾见</h2>
<div class="phone-content" tabindex="0" role="region" aria-label="可滚动的配置预览">
<div class="card">
<h3>任务范围</h3>
<dl class="fields">
<div><dt>平台</dt><dd class="control select">抖音</dd></div>
<div><dt>搜索关键词</dt><dd class="control multiline">国外大模型充值</dd></div>
<div><dt>单次任务总数</dt><dd class="control">3</dd></div>
</dl>
</div>
<div class="card">
<h3>动作节奏</h3>
<dl class="fields">
<div>
<dt>观看时长(秒)</dt>
<dd class="range"><span class="control">5</span><span>至</span><span class="control">12</span></dd>
</div>
<div>
<dt>动作间隔(毫秒)</dt>
<dd class="range"><span class="control">600</span><span>至</span><span class="control">1800</span></dd>
</div>
</dl>
</div>
<div class="card">
<h3>评论</h3>
<dl class="fields">
<div>
<dt><label for="reply-mode">处理方式</label></dt>
<dd><select id="reply-mode" class="control settings-input">
<option>仅浏览</option>
<option>随机使用话术并发送</option>
<option>话术优先,DeepSeek 兜底</option>
</select></dd>
</div>
<div>
<dt><label for="template-group">话术分组</label></dt>
<dd><select id="template-group" class="control settings-input">
<option value="common">通用</option>
<option value="keyword-0">关键词 · 国外大模型充值</option>
</select></dd>
</div>
<div>
<dt><label for="template-editor">话术库</label></dt>
<dd><textarea id="template-editor" class="control multiline settings-input" rows="2" placeholder="每行一条话术" autocomplete="off"></textarea></dd>
</div>
</dl>
<p class="hint">先从当前关键词分组随机选一条。该分组为空时使用通用分组。支持 <code>{keyword}</code> 和 <code>{title}</code>。</p>
<dl class="fields">
<div>
<dt><label for="photo-phrase">绑定到话术</label></dt>
<dd><select id="photo-phrase" class="control settings-input" disabled></select></dd>
</div>
</dl>
<div id="photo-binding" hidden>
<p id="photo-name" class="hint" hidden></p>
<img id="photo-thumbnail" alt="已绑定图片预览" width="96" height="76" style="object-fit: contain" hidden>
<input id="template-photo" type="file" accept="image/jpeg,image/png" hidden>
<button id="photo-choose" type="button" class="action">选择本机图片</button>
<button id="photo-remove" type="button" class="action" hidden>移除图片</button>
</div>
<p class="hint">每条话术可绑定一张本机照片。改写话术后需重新绑定。</p>
</div>
<div class="card">
<h3>DeepSeek</h3>
<p class="hint">启用兜底后,没有可用话术时才调用 DeepSeek。请求包含关键词、视频标题和可见评论样本。缺少话术且未设置 API Key 时跳过该视频。</p>
<dl class="fields">
<div><dt>API Key</dt><dd class="control hint">粘贴 API Key</dd></div>
</dl>
<div class="checkbox">清除已保存的 API Key</div>
<dl class="fields">
<div><dt>模型</dt><dd class="control">deepseek-flash</dd></div>
<div><dt>生成说明</dt><dd class="control multiline">根据视频内容提供一句具体、有帮助的中文评论。</dd></div>
</dl>
</div>
<span class="action primary">保存配置</span>
</div>
<nav class="app-nav" aria-label="配置页导航">
<a href="#task">任务</a>
<a href="#settings" aria-current="page">配置</a>
<a href="#logs">日志</a>
</nav>
</section>
</figure>
<figure class="screen-figure" id="logs">
<figcaption>日志</figcaption>
<section class="phone" aria-label="拾见日志页">
<h2 class="app-name">拾见</h2>
<div class="phone-content">
<div class="card">
<h3>运行日志</h3>
<ul class="entries">
<li class="warning"><time datetime="2026-11-25T15:22:14+08:00">11-25 15:22:14</time> 异常 抖音评论未回读到完整内容或未看到唯一发送按钮</li>
<li><time datetime="2026-11-25T15:22:01+08:00">11-25 15:22:01</time> 运行 搜索关键词 国外大模型充值</li>
<li><time datetime="2026-11-25T15:22:00+08:00">11-25 15:22:00</time> 运行 开始任务 · 话术优先,DeepSeek 兜底 · 上限 3 条</li>
<li><time datetime="2026-11-25T15:19:09+08:00">11-25 15:19:09</time> 运行 任务完成 · 处理 3 条 · 确认发送 0 条</li>
<li><time datetime="2026-11-25T15:19:02+08:00">11-25 15:19:02</time> 运行 观看第 3 条 · 7 秒</li>
<li><time datetime="2026-11-25T15:18:47+08:00">11-25 15:18:47</time> 运行 观看第 2 条 · 11 秒</li>
<li><time datetime="2026-11-25T15:18:37+08:00">11-25 15:18:37</time> 运行 观看第 1 条 · 8 秒</li>
</ul>
</div>
</div>
<nav class="app-nav" aria-label="日志页导航">
<a href="#task">任务</a>
<a href="#settings">配置</a>
<a href="#logs" aria-current="page">日志</a>
</nav>
</section>
</figure>
</div>
</main>
<script>
const groups = document.getElementById("template-group");
const editor = document.getElementById("template-editor");
const photoPhrase = document.getElementById("photo-phrase");
const photoBinding = document.getElementById("photo-binding");
const photoName = document.getElementById("photo-name");
const thumbnail = document.getElementById("photo-thumbnail");
const fileInput = document.getElementById("template-photo");
const choosePhoto = document.getElementById("photo-choose");
const removePhoto = document.getElementById("photo-remove");
const drafts = new Map([["keyword-0", "这条视频里提到的方式适用于哪些地区?"]]);
const photos = new Map();
let activeGroup = groups.value;
let photoTarget;
const photoKey = () => JSON.stringify([activeGroup, photoPhrase.value]);
const redrawPhoto = () => {
const attachment = photos.get(photoKey());
photoBinding.hidden = photoPhrase.disabled;
photoName.hidden = thumbnail.hidden = removePhoto.hidden = !attachment;
if (attachment) {
photoName.textContent = "图片 · " + attachment.name;
thumbnail.src = attachment.url;
} else {
thumbnail.removeAttribute("src");
}
choosePhoto.textContent = attachment ? "更换图片" : "选择本机图片";
};
const redrawPhrases = () => {
const previous = photoPhrase.value;
const phrases = [...new Set(editor.value.split(/\r?\n/).map(line => line.trim()).filter(Boolean))];
photoPhrase.replaceChildren(...(phrases.length ? phrases.map(phrase => new Option(phrase, phrase)) :
[new Option("先填写一条话术", "")]));
if (phrases.includes(previous)) photoPhrase.value = previous;
photoPhrase.disabled = !phrases.length;
redrawPhoto();
};
choosePhoto.addEventListener("click", () => {
photoTarget = photoKey();
fileInput.click();
});
fileInput.addEventListener("change", () => {
const file = fileInput.files[0];
if (photoTarget && file && ["image/jpeg", "image/png"].includes(file.type)) {
const previous = photos.get(photoTarget);
if (previous) URL.revokeObjectURL(previous.url);
photos.set(photoTarget, { name: file.name, url: URL.createObjectURL(file) });
}
photoTarget = undefined;
fileInput.value = "";
redrawPhoto();
});
removePhoto.addEventListener("click", () => {
const key = photoKey();
const attachment = photos.get(key);
if (attachment) URL.revokeObjectURL(attachment.url);
photos.delete(key);
redrawPhoto();
});
photoPhrase.addEventListener("change", redrawPhoto);
editor.addEventListener("input", redrawPhrases);
editor.value = drafts.get(activeGroup) ?? "";
redrawPhrases();
groups.addEventListener("change", () => {
drafts.set(activeGroup, editor.value);
activeGroup = groups.value;
editor.value = drafts.get(activeGroup) ?? "";
redrawPhrases();
});
</script>
</body>
</html>