feat: 本次提交更新内容如下
基础设置做好了
This commit is contained in:
@@ -20,7 +20,6 @@ export async function uploadFile(
|
|||||||
"Content-Type": "multipart/form-data",
|
"Content-Type": "multipart/form-data",
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
return res.url;
|
return res.url;
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
throw new Error(e?.message || "文件上传失败");
|
throw new Error(e?.message || "文件上传失败");
|
||||||
|
|||||||
@@ -598,6 +598,7 @@ const BasicSettings: React.FC<BasicSettingsProps> = ({
|
|||||||
onChange={async (e) => {
|
onChange={async (e) => {
|
||||||
const file = e.target.files?.[0];
|
const file = e.target.files?.[0];
|
||||||
if (file) {
|
if (file) {
|
||||||
|
// 直接上传
|
||||||
try {
|
try {
|
||||||
const url = await uploadFile(file);
|
const url = await uploadFile(file);
|
||||||
const newPoster = {
|
const newPoster = {
|
||||||
@@ -606,14 +607,9 @@ const BasicSettings: React.FC<BasicSettingsProps> = ({
|
|||||||
type: "poster",
|
type: "poster",
|
||||||
preview: url,
|
preview: url,
|
||||||
};
|
};
|
||||||
console.log(newPoster);
|
|
||||||
|
|
||||||
setCustomPosters((prev) => [...prev, newPoster]);
|
setCustomPosters((prev) => [...prev, newPoster]);
|
||||||
setSelectedMaterials([newPoster]);
|
|
||||||
onChange({ ...formData, materials: [newPoster] });
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
// 可加toast提示
|
// 可加toast提示
|
||||||
log;
|
|
||||||
}
|
}
|
||||||
e.target.value = "";
|
e.target.value = "";
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user