BUG修复,返回结构统一

This commit is contained in:
李琦
2026-01-16 17:03:34 +08:00
parent 87ed11db7a
commit e6edf7210b
57 changed files with 3642 additions and 1074 deletions

View File

@@ -358,7 +358,13 @@ const runCode = async () => {
})
})
const result = await response.json()
if (!response.ok) {
const errorData = await response.json()
throw new Error(errorData.message || '代码执行失败')
}
const data = await response.json()
const result = data.result // 从统一响应格式中提取 result
let outputHtml = ''
if (result.error) {

View File

@@ -93,7 +93,9 @@ const navigate = (target: string) => {
const updateActiveNav = () => {
const path = route.path
if (path === '/') activeNav.value = 'home'
else if (path === '/blog') activeNav.value = 'blog'
else if (path === '/blog' || path.startsWith('/blog/')) activeNav.value = 'blog'
else if (path === '/columns' || path.startsWith('/columns/')) activeNav.value = 'columns'
else if (path === '/categories' || path.startsWith('/categories/')) activeNav.value = 'categories'
else if (path === '/works' || path.startsWith('/works/')) activeNav.value = 'works'
else if (path === '/snippets') activeNav.value = 'snippets'
else if (path === '/services') activeNav.value = 'services'

View File

@@ -199,6 +199,8 @@ const menuItems = ref<MenuItem[]>([
isOpen: true,
children: [
{ title: '文章管理', path: '/admin/posts', icon: '📝' },
{ title: '分类管理', path: '/admin/categories', icon: '📂' },
{ title: '专栏管理', path: '/admin/columns', icon: '📚' },
{ title: '作品管理', path: '/admin/works', icon: '🎨' },
{ title: '代码片段', path: '/admin/snippets', icon: '💻' },
{ title: '标签管理', path: '/admin/tags', icon: '🏷️' }