BUG修复,返回结构统一
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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: '🏷️' }
|
||||
|
||||
Reference in New Issue
Block a user