Files
yu-zhi-ran/platform/backend/static/diagnostic.html
T
lt e1ba31afda 版本1.0.4 - 发布前准备
- 修复system.py缩进错误
- 优化前端页面样式(待重构)
- 改进API接口结构
- 完善文档和自动化脚本
- 平台基本功能稳定运行
2026-04-29 09:32:43 +08:00

270 lines
14 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>
<!-- 测试资源加载 -->
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
<link rel="stylesheet" href="https://unpkg.com/element-plus@2.4.3/dist/index.css">
<script src="https://unpkg.com/element-plus@2.4.3/dist/index.full.min.js"></script>
<style>
.card { background: white; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.1); padding: 24px; margin-bottom: 24px; }
aside button { width: 100%; text-align: left; border: none; background: transparent; border-radius: 8px; margin-bottom: 4px; }
@media (max-width: 768px) { main { padding-bottom: 70px; } }
.nav-title { text-align: center; }
.status-badge { display: inline-flex; align-items: center; gap: 4px; }
.status-dot { width: 6px; height: 6px; border-radius: 50%; }
.status-dot.pending { background: #E6A23C; }
.status-dot.review { background: #F56C6C; }
.status-dot.ready { background: #67C23A; }
.status-dot.published { background: #409EFF; }
</style>
</head>
<body>
<div id="app">
<!-- 导航栏 -->
<nav class="bg-gradient-to-r from-blue-600 to-blue-700 text-white shadow-lg">
<div class="container mx-auto px-6 py-4 flex justify-between items-center">
<h1 class="text-2xl font-bold nav-title">宇之然内容创作平台 - 诊断测试</h1>
</div>
</nav>
<!-- 侧边栏 -->
<div class="page flex gap-6">
<aside class="w-40 flex-shrink-0 hidden md:block">
<button @click="showTest('topics')" :class="['px-4 py-2 rounded-lg', testType === 'topics' ? 'bg-blue-50 text-blue-600 font-semibold' : 'text-gray-600']">📋 选题管理测试</button>
<button @click="showTest('logs')" :class="['px-4 py-2 rounded-lg', testType === 'logs' ? 'bg-blue-50 text-blue-600 font-semibold' : 'text-gray-600']">📄 系统日志测试</button>
<button @click="showTest('users')" :class="['px-4 py-2 rounded-lg', testType === 'users' ? 'bg-blue-50 text-blue-600 font-semibold' : 'text-gray-600']">👥 用户管理测试</button>
</aside>
<!-- 主内容区 -->
<main class="flex-1">
<div class="card" style="padding: 20px; margin-top: 20px;">
<h2 class="text-2xl font-bold text-gray-800 mb-6">🔍 功能诊断测试</h2>
<!-- 测试结果显示 -->
<div v-if="testResults.length > 0" class="mb-4 p-4 bg-green-50 border-l-4 border-green-400">
<h3 class="font-bold mb-2">✅ 测试结果:</h3>
<ul class="list-disc pl-5">
<li v-for="result in testResults">{{ result }}</li>
</ul>
</div>
<!-- 选题管理测试 -->
<div v-if="testType === 'topics'">
<h3 class="text-xl font-bold mb-4">📋 选题管理功能测试</h3>
<div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6">
<div class="p-4 bg-blue-50 rounded">
<h4 class="font-bold mb-2">批量操作测试</h4>
<button @click="testBatchOperations" class="px-4 py-2 bg-blue-500 text-white rounded hover:bg-blue-600">测试批量刷新</button>
<span v-if="batchTested" class="ml-2 text-green-600">✅ 通过</span>
</div>
<div class="p-4 bg-green-50 rounded">
<h4 class="font-bold mb-2">数据加载测试</h4>
<button @click="testDataLoading" class="px-4 py-2 bg-green-500 text-white rounded hover:bg-green-600">测试数据加载</button>
<span v-if="dataLoaded" class="ml-2 text-green-600">✅ 通过</span>
</div>
</div>
<!-- 模拟表格 -->
<div class="overflow-x-auto">
<table class="w-full border-collapse">
<thead>
<tr class="bg-gray-50">
<th class="border p-2"><input type="checkbox"></th>
<th class="border p-2">ID</th>
<th class="border p-2">标题</th>
<th class="border p-2">状态</th>
<th class="border p-2">操作</th>
</tr>
</thead>
<tbody>
<tr v-for="topic in mockTopics" :key="topic.id">
<td class="border p-2"><input type="checkbox"></td>
<td class="border p-2">{{ topic.id }}</td>
<td class="border p-2">{{ topic.title }}</td>
<td class="border p-2">
<span class="status-badge">
<span class="status-dot" :class="getStatusClass(topic.status)"></span>
{{ getStatusText(topic.status) }}
</span>
</td>
<td class="border p-2">
<button class="px-2 py-1 bg-blue-500 text-white rounded mr-1 text-xs">预览</button>
<button class="px-2 py-1 bg-green-500 text-white rounded mr-1 text-xs">创作</button>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<!-- 系统日志测试 -->
<div v-if="testType === 'logs'" class="p-6 bg-yellow-50 rounded">
<h3 class="text-xl font-bold mb-4">📄 系统日志功能测试</h3>
<div class="flex flex-wrap gap-4 mb-4">
<select v-model="logType" class="px-3 py-2 border rounded">
<option value="creator">创作日志</option>
<option value="optimizer">优化日志</option>
<option value="collector">收集日志</option>
</select>
<input v-model="logDate" type="date" class="px-3 py-2 border rounded">
<button @click="fetchMockLogs" class="px-4 py-2 bg-blue-500 text-white rounded hover:bg-blue-600">加载日志</button>
</div>
<pre class="bg-white p-4 rounded border min-h-[200px] whitespace-pre-wrap font-mono text-sm">{{ logContent }}</pre>
</div>
<!-- 用户管理测试 -->
<div v-if="testType === 'users'" class="p-6 bg-purple-50 rounded">
<h3 class="text-xl font-bold mb-4">👥 用户管理功能测试</h3>
<div class="flex justify-between items-center mb-4">
<h4 class="font-bold">用户列表</h4>
<button @click="addMockUser" class="px-4 py-2 bg-blue-500 text-white rounded hover:bg-blue-600">+ 新建用户</button>
</div>
<table class="w-full border-collapse">
<thead>
<tr class="bg-gray-50">
<th class="border p-2">ID</th>
<th class="border p-2">用户名</th>
<th class="border p-2">角色</th>
<th class="border p-2">操作</th>
</tr>
</thead>
<tbody>
<tr v-for="user in users" :key="user.id">
<td class="border p-2">{{ user.id }}</td>
<td class="border p-2">{{ user.username }}</td>
<td class="border p-2">
<span :class="[user.role === 'admin' ? 'bg-red-100 text-red-800' : 'bg-green-100 text-green-800', 'px-2 py-1 rounded']">
{{ user.role === 'admin' ? '管理员' : '编辑' }}
</span>
</td>
<td class="border p-2">
<button @click="deleteUser(user.id)" class="px-2 py-1 bg-red-500 text-white rounded text-xs" :disabled="user.role === 'admin'">删除</button>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</main>
</div>
</div>
<script>
const DiagnosticApp = {
data() {
return {
testType: 'topics',
testResults: [],
batchTested: false,
dataLoaded: false,
mockTopics: [
{ id: 'A01', title: '可持续发展趋势分析', status: 'pending' },
{ id: 'B02', title: 'AI在内容创作中的应用', status: 'review' },
{ id: 'C03', title: '数字化转型案例研究', status: 'ready' }
],
logType: 'creator',
logDate: '',
logContent: '请选择日志类型和日期,然后点击加载',
users: [
{ id: 'admin', username: '管理员', role: 'admin' },
{ id: 'editor1', username: '编辑小王', role: 'editor' }
]
}
},
methods: {
showTest(type) {
this.testType = type;
this.testResults = [];
},
// 测试方法
testBatchOperations() {
this.testResults.push('✅ 批量操作按钮点击正常');
this.batchTested = true;
console.log('批量操作测试通过');
},
testDataLoading() {
setTimeout(() => {
this.testResults.push('✅ 数据加载正常 (3个选题)');
this.dataLoaded = true;
console.log('数据加载测试通过');
}, 500);
},
fetchMockLogs() {
const logs = {
creator: `2026-04-27 11:45:23 | 成功生成选题 B02 - AI在内容创作中的应用
2026-04-27 11:30:15 | 开始生成选题 C03 - 数字化转型案例研究`,
optimizer: `2026-04-27 12:05:30 | 优化完成选题 C03 - 合规分提升至78
2026-04-27 11:50:45 | 优化中选题 B02 - 等待人工审核`,
collector: `2026-04-27 10:30:12 | 收集到3个新选题
2026-04-27 09:45:20 | 更新行业热点数据`
}[this.logType] || '暂无日志数据';
this.logContent = `日志类型: ${this.logType}
日期: ${this.logDate || '今天'}
${logs}`;
this.testResults.push(`✅ 日志加载成功 (${this.logType})`);
},
addMockUser() {
const newId = 'user' + Date.now();
this.users.push({ id: newId, username: '新用户', role: 'editor' });
this.testResults.push('✅ 新建用户成功');
},
deleteUser(id) {
if (id !== 'admin') {
this.users = this.users.filter(u => u.id !== id);
this.testResults.push('✅ 删除用户成功');
} else {
this.testResults.push('❌ 不能删除管理员');
}
},
getStatusClass(status) {
const classes = {
'pending': 'status-dot pending',
'review': 'status-dot review',
'ready': 'status-dot ready',
'published': 'status-dot published'
};
return classes[status] || '';
},
getStatusText(status) {
const texts = {
'pending': '待处理',
'review': '待审查',
'ready': '待发布',
'published': '已发布'
};
return texts[status] || status;
}
},
mounted() {
console.log('诊断测试应用已启动');
this.testDataLoading(); // 自动测试数据加载
}
}
Vue.createApp(DiagnosticApp).mount('#app')
</script>
</body>
</html>