修改logo为上传

This commit is contained in:
2026-06-18 16:38:21 +08:00
parent 6f3faff72d
commit f9b3a51391
6 changed files with 286 additions and 130 deletions
+14
View File
@@ -149,6 +149,20 @@ export async function uploadPdf(file: File, configKey: string): Promise<{ url: s
return res.json();
}
export async function uploadLogo(file: File): Promise<{ url: string }> {
const formData = new FormData();
formData.append('file', file);
const token = localStorage.getItem('auth_token');
const baseUrl = (import.meta as any).env?.VITE_API_URL || 'http://localhost:8000/api';
const res = await fetch(`${baseUrl}/admin/upload-logo`, {
method: 'POST',
headers: token ? { 'Authorization': `Bearer ${token}` } : {},
body: formData,
});
if (!res.ok) throw new Error('上传失败');
return res.json();
}
export async function getCreditRecords(filters?: {
user_id?: string;
user_name?: string;