feat: UI优化和功能完善
- 添加公共分页组件,支持上边显示、分页大小10 - 侧边栏/Header按Liner风格优化,添加动画效果 - 异常处理列表支持分页和明细弹窗 - 任务结果页面支持已匹配列表分页 - 修复Dialog弹窗背景透明问题 - 新增dropdown-menu组件 - 添加parsed_file_record模型和回填脚本 - 前端枚举中文化
This commit is contained in:
@@ -21,10 +21,22 @@ export async function GET(
|
||||
|
||||
try {
|
||||
const response = await fetch(targetUrl, { headers });
|
||||
const data = await response.json();
|
||||
return NextResponse.json(data, { status: response.status });
|
||||
|
||||
// 先检查 Content-Type,确保是 JSON
|
||||
const contentType = response.headers.get('content-type');
|
||||
if (contentType && contentType.includes('application/json')) {
|
||||
const data = await response.json();
|
||||
return NextResponse.json(data, { status: response.status });
|
||||
} else {
|
||||
const text = await response.text();
|
||||
return new NextResponse(text, {
|
||||
status: response.status,
|
||||
headers: { 'content-type': contentType || 'text/plain' }
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
return NextResponse.json({ detail: 'Proxy error' }, { status: 502 });
|
||||
console.error('GET proxy error:', error);
|
||||
return NextResponse.json({ detail: 'Proxy error', error: String(error) }, { status: 502 });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,10 +63,22 @@ export async function POST(
|
||||
headers,
|
||||
body,
|
||||
});
|
||||
const data = await response.json();
|
||||
return NextResponse.json(data, { status: response.status });
|
||||
|
||||
// 先检查 Content-Type,确保是 JSON
|
||||
const contentType = response.headers.get('content-type');
|
||||
if (contentType && contentType.includes('application/json')) {
|
||||
const data = await response.json();
|
||||
return NextResponse.json(data, { status: response.status });
|
||||
} else {
|
||||
const text = await response.text();
|
||||
return new NextResponse(text, {
|
||||
status: response.status,
|
||||
headers: { 'content-type': contentType || 'text/plain' }
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
return NextResponse.json({ detail: 'Proxy error' }, { status: 502 });
|
||||
console.error('POST proxy error:', error);
|
||||
return NextResponse.json({ detail: 'Proxy error', error: String(error) }, { status: 502 });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,10 +105,21 @@ export async function PUT(
|
||||
headers,
|
||||
body,
|
||||
});
|
||||
const data = await response.json();
|
||||
return NextResponse.json(data, { status: response.status });
|
||||
|
||||
const contentType = response.headers.get('content-type');
|
||||
if (contentType && contentType.includes('application/json')) {
|
||||
const data = await response.json();
|
||||
return NextResponse.json(data, { status: response.status });
|
||||
} else {
|
||||
const text = await response.text();
|
||||
return new NextResponse(text, {
|
||||
status: response.status,
|
||||
headers: { 'content-type': contentType || 'text/plain' }
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
return NextResponse.json({ detail: 'Proxy error' }, { status: 502 });
|
||||
console.error('PUT proxy error:', error);
|
||||
return NextResponse.json({ detail: 'Proxy error', error: String(error) }, { status: 502 });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,10 +146,21 @@ export async function PATCH(
|
||||
headers,
|
||||
body,
|
||||
});
|
||||
const data = await response.json();
|
||||
return NextResponse.json(data, { status: response.status });
|
||||
|
||||
const contentType = response.headers.get('content-type');
|
||||
if (contentType && contentType.includes('application/json')) {
|
||||
const data = await response.json();
|
||||
return NextResponse.json(data, { status: response.status });
|
||||
} else {
|
||||
const text = await response.text();
|
||||
return new NextResponse(text, {
|
||||
status: response.status,
|
||||
headers: { 'content-type': contentType || 'text/plain' }
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
return NextResponse.json({ detail: 'Proxy error' }, { status: 502 });
|
||||
console.error('PATCH proxy error:', error);
|
||||
return NextResponse.json({ detail: 'Proxy error', error: String(error) }, { status: 502 });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -139,9 +185,20 @@ export async function DELETE(
|
||||
method: 'DELETE',
|
||||
headers,
|
||||
});
|
||||
const data = await response.json();
|
||||
return NextResponse.json(data, { status: response.status });
|
||||
|
||||
const contentType = response.headers.get('content-type');
|
||||
if (contentType && contentType.includes('application/json')) {
|
||||
const data = await response.json();
|
||||
return NextResponse.json(data, { status: response.status });
|
||||
} else {
|
||||
const text = await response.text();
|
||||
return new NextResponse(text, {
|
||||
status: response.status,
|
||||
headers: { 'content-type': contentType || 'text/plain' }
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
return NextResponse.json({ detail: 'Proxy error' }, { status: 502 });
|
||||
console.error('DELETE proxy error:', error);
|
||||
return NextResponse.json({ detail: 'Proxy error', error: String(error) }, { status: 502 });
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user