优化样式;增加修改主播资料字段校验

This commit is contained in:
yezian 2024-01-10 00:50:00 +08:00
parent e29b8bff0f
commit 5da638c253
1 changed files with 29 additions and 26 deletions

View File

@ -322,6 +322,33 @@ const StreamerInformationContent = () => {
const newPosterId = [...oldPosterId, ...displayPosterId];
const newVideoId = [...oldVideoId, ...displayVideoId];
const newGalleryId = [...oldGalleryId, ...displayGalleryId];
if (
newPosterId.length === 0 ||
newVideoId.length === 0 ||
newGalleryId.length < 2
) {
alert("请确保封面、视频不为空且相册大于2");
return;
}
if (
!defaultValues.key ||
!value.signature ||
!value.age ||
!value.height ||
!value.weight ||
!value.constellation ||
!value.location ||
!value.fans ||
!value.wechat_price ||
!value.auto_response_message
) {
alert("请完善信息后提交");
return;
}
if (value.wechat_lock_type === 0 && !value.wechat) {
alert("请填写微信后提交");
return;
}
try {
const base = baseRequest();
const detailResponse = await fetch(`/op/streamer/update`, {
@ -349,28 +376,7 @@ const StreamerInformationContent = () => {
...base,
}),
});
console.log(value);
console.log({
mid: defaultValues.key,
gender: parseInt(value.gender, 10),
wechat_contact: value.wechat,
bio: value.signature,
cover: { image_ids: newPosterId },
shorts: { video_ids: newVideoId },
album: { image_ids: newGalleryId },
age: parseInt(value.age, 10),
height: parseInt(value.height, 10),
weight: parseInt(value.weight, 10),
constellation: value.constellation,
city: value.location,
wechat_lock_type: parseInt(value.wechat_lock_type, 10),
fans: parseInt(value.fans, 10),
wechat_coin_price: parseInt(value.wechat_price, 10) * 10,
auto_response_message: value.auto_response_message,
...base,
});
const detailData = await detailResponse.json();
console.log(detailData);
if (detailData.ret === -1) {
alert(detailData.msg);
return;
@ -756,12 +762,9 @@ const StreamerInformationContent = () => {
相册图片
</p>
{defaultMedia.displayGallery.length !== 0 && (
<div>
<div className="flex flex-row flex-wrap gap-2">
{defaultMedia.displayGallery.map((item) => (
<div
key={item.urls[0]}
className="relative flex flex-row flex-wrap gap-2"
>
<div key={item.urls[0]} className="relative">
<Image src={item.urls[0]} width={100} />
<Button
className="absolute top-0 left-0 w-full"