Files
work-1 01f43d8da5 feat: v3.1 - 统一规约视图、项目树导航、移动端支持
主要更新:
- 统一规约管理视图(全局/项目规约共享表格)
- 项目树形导航(看板/项目规约子菜单)
- 智能高亮与状态持久化
- 移动端响应式支持(汉堡菜单)
- 规约类型更新为7个专业分类
- 文件清理(85→15文件,减少82%)

修复问题:
- 修复创建项目功能(JavaScript语法错误)
- 修复协作规约错误高亮
- 修复看板需要点击2次才高亮
- 修复项目树自动收起问题

新增工具:
- debug.html(项目创建测试)
- test.html(移动端测试)
- status.html(系统诊断)

技术改进:
- 上下文状态管理(currentRuleContext)
- 展开状态持久化(projectExpandedState)
- 触摸事件支持
- 移除console.log提升兼容性
2026-02-24 15:04:25 +08:00

88 lines
2.8 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>调试 - 新建项目</title>
<style>
body { padding: 20px; font-family: Arial; }
.log { background: #f5f5f5; padding: 10px; margin: 10px 0; border-radius: 5px; }
button { padding: 10px 20px; background: #667eea; color: white; border: none; border-radius: 5px; cursor: pointer; margin: 5px; }
input, textarea { width: 100%; padding: 8px; margin: 5px 0; border: 1px solid #ddd; border-radius: 4px; }
</style>
</head>
<body>
<h1>新建项目调试页面</h1>
<div>
<h3>测试1: 按钮点击</h3>
<button id="test-btn">点击测试</button>
<div id="log1" class="log">等待点击...</div>
</div>
<div>
<h3>测试2: 创建项目</h3>
<input type="text" id="project-name" placeholder="项目名称">
<textarea id="project-desc" placeholder="项目描述" rows="3"></textarea>
<button id="create-btn">创建项目</button>
<div id="log2" class="log">等待创建...</div>
</div>
<div>
<h3>测试3: 项目列表</h3>
<button id="list-btn">加载项目</button>
<div id="log3" class="log">等待加载...</div>
</div>
<script>
const log = (id, msg) => {
document.getElementById(id).innerHTML += `<div>${new Date().toLocaleTimeString()}: ${msg}</div>`;
};
// 测试1
document.getElementById('test-btn').addEventListener('click', () => {
log('log1', '✅ 按钮点击事件正常');
});
// 测试2
document.getElementById('create-btn').addEventListener('click', async () => {
const name = document.getElementById('project-name').value;
const desc = document.getElementById('project-desc').value;
if (!name) {
log('log2', '❌ 请输入项目名称');
return;
}
log('log2', '发送请求...');
try {
const response = await fetch('/api/projects', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ name, description: desc, created_by: 'debug' })
});
const data = await response.json();
log('log2', `✅ 创建成功: ${JSON.stringify(data)}`);
} catch (error) {
log('log2', `❌ 错误: ${error.message}`);
}
});
// 测试3
document.getElementById('list-btn').addEventListener('click', async () => {
log('log3', '加载中...');
try {
const response = await fetch('/api/projects');
const data = await response.json();
log('log3', `✅ 获取到 ${data.length} 个项目`);
data.forEach(p => log('log3', `- ${p.name}`));
} catch (error) {
log('log3', `❌ 错误: ${error.message}`);
}
});
</script>
</body>
</html>