修复报错页面

This commit is contained in:
biss committed 2026-07-21 17:08:03 +08:00
1 parent fe5fcc9dc2
commit 5477a261f8
10 files changed
+91 -9

No files matched your search

+2 -1
View File
@@ -21,6 +21,7 @@ export function createAdminViews(context) {
icons,
api,
renderError,
requireLogin,
emptyState,
brand,
portalShell,
@@ -30,7 +31,7 @@ export function createAdminViews(context) {
} = context;
async function renderAdmin(page) {
if (state.user?.role !== 'admin') return navigate('login');
if (state.user?.role !== 'admin') return requireLogin();
app.classList.add('admin-readable');
const meta = {
dashboard: ['考务工作台', '掌握当前报名、审核和发布任务。'], candidates: ['考生资料审核', '核验考生实名、学籍与联系信息。'],
+2 -2
View File
@@ -1,5 +1,5 @@
export function createAdmissionViews(context) {
const { state, app, h, formatDate, badge, icons, api, renderError, brand } = context;
const { state, app, h, formatDate, badge, icons, api, renderError, requireLogin, brand } = context;
const nav = [['dashboard','工作台','home'],['plans','招生计划','exam'],['placements','投档审核','check']];
function shell(page, content, title, description) {
@@ -7,7 +7,7 @@ export function createAdmissionViews(context) {
}
async function renderAdmission(page) {
if (state.user?.role !== 'admission_school') return navigate('login');
if (state.user?.role !== 'admission_school') return requireLogin();
if (!nav.some(item => item[0] === page)) page = 'dashboard';
const meta = { dashboard:['招生工作台','查看本校计划与待审核投档概况。'], plans:['本校招生计划','上传本年度普通生、特长生计划及指标分配,提交后由超级管理员审核。'], placements:['投档考生审核','查看投档考生资料和本场成绩;无特殊理由不得申请退档。'] };
app.innerHTML = shell(page, '<div class="loading-panel"><i></i><span>正在读取数据</span></div>', ...meta[page]);
+5 -1
View File
@@ -8,6 +8,10 @@ export async function api(path, options = {}) {
});
const type = response.headers.get('content-type') || '';
const data = type.includes('application/json') ? await response.json() : await response.text();
if (!response.ok) throw new Error(data?.message || '操作未完成,请稍后重试');
if (!response.ok) {
const error = new Error(data?.message || '操作未完成,请稍后重试');
error.status = response.status;
throw error;
}
return data;
}
Loaded 3 of 10 files, more files were not shown because too many files have changed in this diff. Show more