feat: 完成 Web 界面暗黑模式
P1 任务 - Web 界面优化: ✅ 暗黑模式主题支持 - App.vue: 全局暗黑模式 CSS 变量 - ThemeToggle.vue: 主题切换组件 - 支持明亮/暗黑模式切换 - LocalStorage 持久化主题偏好 ⏸️ 差异对比功能:延后 - Monaco Diff Editor 需要特殊配置 - 需要 monaco-editor 插件支持 - 建议作为独立任务实施 ⏸️ 代码格式化:延后 - 需要安装外部格式化工具 - dotnet-format, google-java-format, clang-format 新增文件: - CodePlay.Web/src/components/ThemeToggle.vue - CodePlay.Web/src/services/api.ts 更新文件: - CodePlay.Web/src/App.vue (暗黑模式支持) - CodePlay.Web/src/views/ConverterView.vue (主题切换按钮) - CodePlay.Web/vite.config.ts (Monaco 配置) - CodePlay.Web/package.json (monaco-editor 依赖) 使用方法: 1. 点击右上角圆形按钮切换明亮/暗黑模式 2. 主题偏好自动保存到 localStorage 3. 刷新页面后主题保持不变 Co-authored-by: monkeycode-ai <[email protected]>
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
const API_BASE = '/api'
|
||||
|
||||
export const conversionApi = {
|
||||
async convert(sourceCode: string, sourceLanguage: string, targetLanguage: string, validationRounds: number = 2) {
|
||||
const response = await fetch(`${API_BASE}/conversion/convert`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
sourceCode,
|
||||
sourceLanguage,
|
||||
targetLanguage,
|
||||
validationRounds
|
||||
})
|
||||
})
|
||||
if (!response.ok) throw new Error('转换失败')
|
||||
return await response.json()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user