优化修改

This commit is contained in:
2026-05-27 11:24:51 +08:00
parent 95f020047d
commit 0d946c050e
6 changed files with 114 additions and 60 deletions

View File

@@ -724,11 +724,15 @@ const parseFieldsUnified = (raw: unknown): Array<{ key: string; value: string }>
}));
}
// 如果是对象格式 { key: value }
// 如果是对象格式 { key: value } 或者 { key: { value: value } }
if (typeof raw === 'object') {
const fields: Array<{ key: string; value: string }> = [];
Object.keys(raw as Record<string, unknown>).forEach((key) => {
const v = (raw as Record<string, unknown>)[key];
let v = (raw as Record<string, unknown>)[key];
// 处理 { key: { value: "value" } } 格式(后端可能返回这种结构)
if (v && typeof v === 'object' && !Array.isArray(v) && 'value' in v) {
v = (v as { value: unknown }).value;
}
const value = String(v ?? '');
fields.push({ key, value });
});