1、修改前台登陆样式背景可使用视频
2、增加后台配置前台背景样式
This commit is contained in:
@@ -276,6 +276,22 @@ export async function uploadLogo(file: File): Promise<{ url: string }> {
|
||||
return { url: res.url };
|
||||
}
|
||||
|
||||
export async function uploadLoginVideo(file: File): Promise<{ url: string }> {
|
||||
const form = new FormData();
|
||||
form.append('file', file);
|
||||
const token = localStorage.getItem('auth_token');
|
||||
const res = await fetch(`${import.meta.env.VITE_API_BASE || 'http://localhost:8000'}/api/admin/upload-login-video`, {
|
||||
method: 'POST',
|
||||
headers: token ? { Authorization: `Bearer ${token}` } : {},
|
||||
body: form,
|
||||
});
|
||||
if (!res.ok) {
|
||||
const err = await res.json().catch(() => ({}));
|
||||
throw new Error(err?.detail || '上传失败');
|
||||
}
|
||||
return res.json();
|
||||
}
|
||||
|
||||
function setMaybe(params: URLSearchParams, key: string, value: unknown): void {
|
||||
if (value !== undefined && value !== null && String(value) !== '') params.set(key, String(value));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user