ether-docs/05-ISSUES/known-patterns.json

113 lines
4.5 KiB
JSON
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{
"patterns": {
"pat-001": {
"name": "Vite Dev Server与ClashX代理冲突",
"source": "user_feedback",
"confidence": 0.95,
"applications": 5,
"created": "2026-03-21",
"category": "environment",
"pattern": "Vite dev server在ClashX开启时挂起不响应",
"problem": "Node.js HTTP服务器监听成功但curl请求挂起",
"solution": "使用原生Node.js HTTP服务器dev-server.mjs替代Vite dev server或关闭ClashX的增强模式",
"quality_rules": [
"使用npm run dev:simple启动开发服务器",
"代码修改后需npm run build重新构建",
"dev-server.mjs会自动添加CORS头"
]
},
"pat-002": {
"name": "Axios响应数据嵌套结构",
"source": "user_feedback",
"confidence": 0.95,
"applications": 5,
"created": "2026-03-22",
"category": "frontend",
"pattern": "后端API响应统一格式为{code,message,data{}}前端直接访问res.data导致数据为undefined",
"problem": "登录、用户、角色、权限等页面fetch数据时res.data是ApiResponse而非实际数据",
"solution": "使用res.data.data获取实际的列表/用户数据",
"quality_rules": [
"所有API调用后赋值给ref时使用 res.data.data",
"示例: users.value = res.data.data || []",
"不仅是登录API所有列表查询API都有相同的嵌套结构"
]
},
"pat-003": {
"name": "API路径双重/api前缀问题",
"source": "implementation_review",
"confidence": 0.95,
"applications": 2,
"created": "2026-03-22",
"category": "frontend",
"pattern": "baseURL和API路径都包含/api导致请求变成/api/api/xxx",
"problem": "后端收到/api/api/permissions请求返回NoResourceFoundException",
"solution": "baseURL设置为http://localhost:8080不含/apiAPI路径使用/api/permissions",
"quality_rules": [
"baseURL: http://localhost:8080",
"API路径: /api/permissions, /api/users 等",
"不要在baseURL和API路径中同时包含/api"
]
},
"pat-004": {
"name": "CORS配置端口限制",
"source": "implementation_review",
"confidence": 0.85,
"applications": 2,
"created": "2026-03-22",
"category": "backend",
"pattern": "后端CORS只允许特定端口导致跨域失败",
"problem": "前端使用不同端口时API请求被CORS阻止",
"solution": "CORS配置中添加所有可能的前端开发端口5173-5180",
"quality_rules": [
"后端CorsConfiguration设置allowedOrigins包含所有开发端口"
]
},
"pat-005": {
"name": "Git提交纪律",
"source": "user_feedback",
"confidence": 0.95,
"applications": 5,
"created": "2026-03-22",
"category": "workflow",
"pattern": "代码修改后未提交到Gitnpm install或操作导致工作目录恢复到旧状态",
"problem": "昨天修复的问题今天又发生因为修改从未commit",
"solution": "每次修复完成后立即commit建立开发流程规范",
"quality_rules": [
"完成功能或修复后立即git commit",
"git commit message要清晰描述修改内容",
"在git commit之前不要进行npm install等可能重置环境的操作"
]
},
"pat-006": {
"name": "登录跳转使用window.location.href",
"source": "implementation_review",
"confidence": 0.90,
"applications": 2,
"created": "2026-03-22",
"category": "frontend",
"pattern": "SPA登录成功后router.push('/')不工作",
"problem": "Pinia store更新和Vue Router跳转时序问题",
"solution": "使用window.location.href = '/'强制页面重新加载",
"quality_rules": [
"登录回调中使用window.location.href进行跳转",
"登出时也使用window.location.href = '/login'"
]
},
"pat-007": {
"name": "dist构建产物未及时更新",
"source": "user_feedback",
"confidence": 0.80,
"applications": 3,
"created": "2026-03-22",
"category": "workflow",
"pattern": "修改代码后构建产物没有更新",
"problem": "前端修改后没有重新npm run build",
"solution": "建立标准流程:修改代码 → npm run build → 重启dev-server",
"quality_rules": [
"每次测试前确认dist是最新的",
"使用dev-server.mjs时每次修改都需要重新构建"
]
}
}
}