移除前端配置中的 postSlug 和 avatarPrefix 参数,改为从后端接口获取 重构 CWDComments 核心类,自动推导 postSlug 等参数并异步加载服务端配置 更新文档和示例页面以反映配置变更
165 lines
3.2 KiB
HTML
165 lines
3.2 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>CWD - 开发预览</title>
|
|
<style>
|
|
* {
|
|
margin: 0;
|
|
padding: 0;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
body {
|
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
|
|
background: #f5f5f5;
|
|
padding: 40px 20px;
|
|
}
|
|
|
|
.container {
|
|
max-width: 800px;
|
|
margin: 0 auto;
|
|
background: white;
|
|
padding: 40px;
|
|
border-radius: 8px;
|
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
|
}
|
|
|
|
h1 {
|
|
margin-bottom: 20px;
|
|
color: #333;
|
|
}
|
|
|
|
.config-panel {
|
|
background: #f8f9fa;
|
|
padding: 20px;
|
|
border-radius: 6px;
|
|
margin-bottom: 30px;
|
|
}
|
|
|
|
.config-panel h3 {
|
|
margin-bottom: 15px;
|
|
font-size: 16px;
|
|
}
|
|
|
|
.config-item {
|
|
margin-bottom: 12px;
|
|
}
|
|
|
|
.config-item label {
|
|
display: block;
|
|
margin-bottom: 4px;
|
|
font-size: 13px;
|
|
color: #666;
|
|
}
|
|
|
|
.config-item input,
|
|
.config-item select {
|
|
width: 100%;
|
|
padding: 8px 12px;
|
|
border: 1px solid #ddd;
|
|
border-radius: 4px;
|
|
font-size: 14px;
|
|
}
|
|
|
|
.config-actions {
|
|
display: flex;
|
|
gap: 10px;
|
|
margin-top: 15px;
|
|
}
|
|
|
|
.btn {
|
|
padding: 8px 16px;
|
|
border: none;
|
|
border-radius: 4px;
|
|
font-size: 14px;
|
|
cursor: pointer;
|
|
transition: background 0.2s;
|
|
}
|
|
|
|
.btn-primary {
|
|
background: #0969da;
|
|
color: white;
|
|
}
|
|
|
|
.btn-primary:hover {
|
|
background: #0864ca;
|
|
}
|
|
|
|
.btn-secondary {
|
|
background: #f0f0f0;
|
|
color: #333;
|
|
}
|
|
|
|
.btn-secondary:hover {
|
|
background: #e0e0e0;
|
|
}
|
|
|
|
.divider {
|
|
height: 1px;
|
|
background: #e0e0e0;
|
|
margin: 30px 0;
|
|
}
|
|
|
|
.demo-post {
|
|
margin-bottom: 40px;
|
|
}
|
|
|
|
.demo-post h2 {
|
|
font-size: 18px;
|
|
margin-bottom: 10px;
|
|
}
|
|
|
|
.demo-post p {
|
|
color: #666;
|
|
line-height: 1.6;
|
|
}
|
|
</style>
|
|
</head>
|
|
|
|
<body>
|
|
<div class="container">
|
|
<h1>CWD - 开发预览</h1>
|
|
|
|
<div class="config-panel">
|
|
<h3>配置面板</h3>
|
|
<div class="config-item">
|
|
<label>API 地址</label>
|
|
<input type="text" id="apiBaseUrl" value="http://localhost:8788" />
|
|
</div>
|
|
<div class="config-item">
|
|
<label>主题</label>
|
|
<select id="theme">
|
|
<option value="light">浅色</option>
|
|
<option value="dark">深色</option>
|
|
</select>
|
|
</div>
|
|
<div class="config-actions">
|
|
<button class="btn btn-primary" onclick="initWidget()">保存</button>
|
|
<button class="btn btn-secondary" onclick="toggleTheme()">切换主题</button>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="divider"></div>
|
|
|
|
<div class="demo-post">
|
|
<h2>这是一篇示例文章</h2>
|
|
<p>
|
|
这是一个演示 CWD Comments Widget 的示例页面。你可以在上方的配置面板中修改 API 地址和主题,
|
|
然后点击"应用配置"按钮重新加载评论组件。
|
|
</p>
|
|
</div>
|
|
|
|
<div class="divider"></div>
|
|
|
|
<!-- 评论组件容器 -->
|
|
<div id="comments"></div>
|
|
</div>
|
|
|
|
<script type="module" src="/src/dev.js"></script>
|
|
</body>
|
|
|
|
</html>
|