refactor: 重构项目结构,按功能模块拆分文件
- 后端:将 app.py 拆分为 lib/api/ 目录下的多个蓝图模块 - config_api.py: 配置管理 API - entity_api.py: 实体管理 API - field_api.py: 字段列表 API - report_api.py: 日报生成和历史记录 API - init_api.py: 数据库初始化 API - download_api.py: 文件下载 API - 前端:将 index.html 拆分为多个文件 - static/css/style.css: CSS 样式 - static/js/common.js: 通用工具函数 - static/js/config.js: 配置管理 - static/js/entity.js: 实体管理 - static/js/report.js: 日报生成 - static/js/history.js: 历史记录 - 更新 app.py 使用蓝图注册 API - 创建 AGENTS.md 项目文档 Coze-Commit-Type: user Coze-User-ID: 3722323274763196 Coze-Conversation-ID: 9894087
This commit is contained in:
31
static/js/common.js
Normal file
31
static/js/common.js
Normal file
@@ -0,0 +1,31 @@
|
||||
// 全局错误处理,防止JavaScript错误中断执行
|
||||
window.onerror = function(msg, url, line, col, error) {
|
||||
console.error('JavaScript错误:', msg, 'at', url, 'line:', line);
|
||||
return true; // 阻止错误传播
|
||||
};
|
||||
|
||||
let editingConfigId = null;
|
||||
let allFields = [];
|
||||
let currentPage = 1;
|
||||
const pageSize = 20;
|
||||
|
||||
// 切换标签页
|
||||
function switchTab(tabName, event) {
|
||||
document.querySelectorAll('.tab').forEach(t => t.classList.remove('active'));
|
||||
document.querySelectorAll('.tab-content').forEach(t => t.classList.remove('active'));
|
||||
|
||||
if (event && event.target) {
|
||||
event.target.classList.add('active');
|
||||
}
|
||||
document.getElementById(`${tabName}-tab`).classList.add('active');
|
||||
|
||||
if (tabName === 'config') {
|
||||
loadConfigs();
|
||||
} else if (tabName === 'generate') {
|
||||
loadGenerateConfigs();
|
||||
} else if (tabName === 'history') {
|
||||
loadHistory();
|
||||
}
|
||||
}
|
||||
|
||||
// 加载配置列表
|
||||
Reference in New Issue
Block a user