修复入驻问题

This commit is contained in:
al 2024-10-30 21:42:23 +08:00
parent adb617d041
commit 886ac93858
10 changed files with 263 additions and 157 deletions

View File

@ -86,9 +86,9 @@ export default function CreateProfile() {
const router = useRouter();
const searchParams = useSearchParams();
const [formData, setFormData] = useState({
spacePrice: 0,
ironFanPrice: 0,
openSuper: true,
spacePrice: "",
ironFanPrice: "",
openSuper: false,
superSingle: [
{ enable: false, price: 0, wechatFree: false },
{ enable: false, price: 0, wechatFree: false },
@ -119,8 +119,15 @@ export default function CreateProfile() {
const handleSubmit = async () => {
const { spaceIntro, spacePrice, ironFanPrice, openSuper, superSingle } =
formData;
if (!spaceIntro || !spacePrice || !ironFanPrice) {
const openSuperEveryFalse = Object.values(superSingle).every(
(it) => !it.enable
);
if (
!spaceIntro ||
!spacePrice ||
!ironFanPrice ||
(openSuper && openSuperEveryFalse)
) {
Toast.show({
icon: "fail",
content: "请完善内容后提交",
@ -196,41 +203,41 @@ export default function CreateProfile() {
}));
setIsSubmitting(true);
try {
const body = {
profile: spaceIntro,
admission_price: parseInt(spacePrice * 100, 10),
ironfanship_price: parseInt(ironFanPrice * 100, 10),
is_superfanship_enabled: openSuper ? 1 : 0,
superfan_price_list,
};
const _data = await requireAPI(
"POST",
"/api/zone/update",
{
body,
},
true
);
if (_data.ret === -1) {
Toast.show({
icon: "error",
content: _data.msg,
position: "top",
});
return;
}
Toast.show({
icon: "success",
content: "修改成功,请重进空间刷新查看",
position: "top",
});
router.back();
} catch (error) {
console.error(error);
} finally {
setIsSubmitting(false);
}
// try {
// const body = {
// profile: spaceIntro,
// admission_price: parseInt(spacePrice * 100, 10),
// ironfanship_price: parseInt(ironFanPrice * 100, 10),
// is_superfanship_enabled: openSuper ? 1 : 0,
// superfan_price_list,
// };
// const _data = await requireAPI(
// "POST",
// "/api/zone/create",
// {
// body,
// },
// true
// );
// if (_data.ret === -1) {
// Toast.show({
// icon: "fail",
// content: _data.msg,
// position: "top",
// });
// return;
// }
// Toast.show({
// icon: "success",
// content: "",
// position: "top",
// });
// router.back();
// } catch (error) {
// console.error(error);
// } finally {
// setIsSubmitting(false);
// }
};
return (
<div>
@ -287,10 +294,13 @@ export default function CreateProfile() {
id="spacePrice"
type="number"
fontSize="22"
placeholder="1~3888仅支持整数"
value={formData.spacePrice}
onChange={(value) =>
setFormData((old) => ({ ...old, spacePrice: value }))
}
inputClassName="placeholder:text-[14px]"
className={!formData.spacePrice ? "pb-1.5" : ""}
/>
</div>
<label
@ -309,7 +319,7 @@ export default function CreateProfile() {
<span className="text-[#f00]">*</span>
</p>
<p className="text-[#ffffffae] text-xs">
累计空间内消费达标可成为铁粉可查看相关帖
累计消费达成后解锁铁粉权益
</p>
</div>
<div className="mt-2 px-4 py-3 h-12 rounded-[0.8rem] bg-[#FFFFFF1a] flex justify-between items-center">
@ -319,10 +329,13 @@ export default function CreateProfile() {
id="ironPrice"
type="number"
fontSize="22"
placeholder="1~3888仅支持整数"
value={formData.ironFanPrice}
onChange={(value) =>
setFormData((old) => ({ ...old, ironFanPrice: value }))
}
inputClassName="placeholder:text-[14px]"
className={!formData.ironFanPrice ? "pb-1.5" : ""}
/>
</div>
<label
@ -359,24 +372,28 @@ export default function CreateProfile() {
</div>
</div>
</div>
<div className="mt-3">
<div className="flex justify-between items-center">
<p className="text-sm">
<span>超粉单次开通类型</span>
<span className="text-[#f00]">*</span>
</p>
<div className="flex items-center"></div>
{formData.openSuper && (
<div className="mt-3">
<div className="flex justify-between items-center">
<p className="text-sm">
<span>超粉单次开通类型</span>
<span className="text-[#f00]">*</span>
</p>
<p className="text-[#ffffffae] text-xs">
付费后解锁对应期限超粉权益
</p>
</div>
<Space direction="vertical" block>
<Checkbox.Group
onChange={(values) => {
setSuperSingleCheckeds(values);
}}
>
<ul>{listItemWithCheckboxMemo}</ul>
</Checkbox.Group>
</Space>
</div>
<Space direction="vertical" block>
<Checkbox.Group
onChange={(values) => {
setSuperSingleCheckeds(values);
}}
>
<ul>{listItemWithCheckboxMemo}</ul>
</Checkbox.Group>
</Space>
</div>
)}
<div className="mt-10 flex justify-center">
<Button
size="middle"

View File

@ -324,8 +324,8 @@ export default function EditHome() {
<Picker
columns={[
[
{ label: "男", value: "0" },
{ label: "女", value: "1" },
{ label: "男", value: "0" },
],
]}
value={formData.gender}

View File

@ -123,6 +123,8 @@ const My = () => {
iconUrl: "icons/32DP/editprofile.png",
title: "完善资料",
subTitle: "完善后解锁全部功能",
status: !statuses.data.details_status ? "审核中" : "未通过",
disable: statuses.data.details_status == 2,
},
...currentOld,
];
@ -154,26 +156,57 @@ const My = () => {
title: "添加到主屏幕",
},
];
if (account.data.account.role != 3 && !isInJoinProgress) {
if (
(account.data.account.role != 3 && !isInJoinProgress) ||
statuses.data.details_status === 2
) {
currentOld = [
...currentOld,
{
url: `my/wallet`,
iconUrl: "icons/32DP/wallet.png",
title: "我的钱包",
},
{
url: `my/unlockedWechat`,
iconUrl: "icons/32DP/wechat.png",
title: "已解锁微信",
},
{
url: `my/streamerVerification/joinStreamer`,
iconUrl: "icons/32DP/join.png",
title: "申请入驻",
},
{
url: `/messageDetail`,
iconUrl: "icons/32DP/contact.png",
title: "联系客服",
},
{
url: `/my/addToHome`,
iconUrl: "icons/32DP/toScreen.png",
title: "添加到主屏幕",
},
];
}
return currentOld;
});
setUserInfo({ ...data.data, ...account.data.account, ...streamer.data });
};
const ItemEle = ({ url, iconUrl, title, subTitle, toWebView }) => {
const ItemEle = ({
url,
iconUrl,
title,
subTitle,
toWebView,
status,
disable,
}) => {
return (
<li
className="flex justify-between items-center p-3 py-2"
onClick={() => {
subTitle != "完善资料后解锁" &&
!disable &&
router.push(
toWebView ? `/webView/${encodeURIComponent(url)}` : url
);
@ -189,13 +222,28 @@ const My = () => {
<span className="text-base">{title}</span>
</div>
<div className={`flex items-center text-[#FFFFFF80]`}>
<span className="mr-2">{subTitle}</span>
<FontAwesomeIcon
icon={faAngleRight}
style={{ maxWidth: "12px" }}
size="sm"
className="h-4"
/>
<div
className={`rounded-full`}
style={{
backgroundColor: status
? status == "未通过"
? "#db2020"
: "#207edb"
: "none",
padding: status ? "2px 10px" : "0",
marginRight: !disable ? "0.5rem" : "0",
}}
>
{status || subTitle}
</div>
{!disable && (
<FontAwesomeIcon
icon={faAngleRight}
style={{ maxWidth: "12px" }}
size="sm"
className="h-4"
/>
)}
</div>
</li>
);

View File

@ -39,7 +39,6 @@ export default function Relationship() {
}, [currentKey]);
useEffect(() => {
const key = searchParams.get("key");
// console.log('nnnnn',searchParams.get("key"))
key && setCurrentKey(key);
}, [searchParams]);
async function loadMore(key) {

View File

@ -9,8 +9,8 @@ export default function SettleIn() {
const router = useRouter();
return (
<div>
<div className="p-4 fixed top-0 z-10 w-full">
<div className="w-9 h-9 flex items-center justify-center bg-[#FFFFFF1A] rounded-full absolute">
<div className="p-4 fixed top-0 z-10 w-full ">
<div className="w-9 h-9 flex items-center justify-between bg-[#FFFFFF1A] rounded-full absolute">
<FontAwesomeIcon
icon={faAngleLeft}
style={{ maxWidth: "12px" }}
@ -19,8 +19,9 @@ export default function SettleIn() {
router.back();
}}
/>
<p className="text-base text-center leading-9">申请入驻</p>
<p className="text-base text-center leading-9">平台准则</p>
</div>
<p className="text-base text-center leading-9">申请入驻</p>
</div>
{/* 内容 */}
<div className="pt-16 p-4 flex flex-col justify-center items-center">

View File

@ -80,10 +80,7 @@ export default function AfterSubmitStreamerVerification() {
paddingLeft: "32px",
paddingRight: "32px",
}}
onClick={() => () =>
router.replace(
"my/streamerVerification/completeStreamerInformation"
)}
onClick={() => router.replace("completeStreamerInformation")}
>
<div className="flex flex-col items-center text-base">
<span>前往完善资料</span>

View File

@ -93,12 +93,12 @@ export default function CompleteStreamerInformation() {
const [isWaitingReview, setIsWaitingReview] = useState(false);
const [formData, setFormData] = useState({
wechatPrice: 0,
gender: ["0"],
age: ["18"],
height: ["140"],
weight: ["35"],
constellation: ["白羊座"],
province: ["北京市"],
gender: [""],
age: [""],
height: [""],
weight: [""],
constellation: [""],
province: [""],
tags: [],
info: "",
autoResponse: "",
@ -106,8 +106,8 @@ export default function CompleteStreamerInformation() {
wechatAddWay: 0,
fans: 0,
imageAssets: [],
displayImage: null,
displayVideo: null,
displayImage: [],
displayVideo: [],
});
const [spacePriceAble, setSpacePriceAble] = useState(false);
// const [wechatAddWay, setWechatAddWay] = useState("0");
@ -133,8 +133,11 @@ export default function CompleteStreamerInformation() {
getData();
}, []);
useEffect(() => {
if (data.tag) {
// console.log("setFormData", data?.streamer);
if (data?.streamer?.tag) {
const {
fans,
wechat_coin_price,
gender,
age,
@ -150,7 +153,9 @@ export default function CompleteStreamerInformation() {
cover,
shorts,
} = data?.streamer;
setFormData({
setFormData((old) => ({
...old,
fans,
wechatPrice: wechat_coin_price,
gender: [`${gender}`],
age: [`${age}`],
@ -163,23 +168,27 @@ export default function CompleteStreamerInformation() {
autoResponse: auto_response_message,
wechatAddWay: wechat_lock_type,
wechat: wechat_contact,
displayImage: [
{
notChanged: true,
id: { image_ids: cover.image_ids },
uri: cover.images[0].urls[0],
image_ids: cover.image_ids,
url: cover.images[0].urls[0],
},
],
displayVideo: [
{
notChanged: true,
id: { video_ids: shorts?.video_ids },
cover: shorts?.videos[0]?.cover_urls[0],
video_ids: shorts?.video_ids,
url: shorts?.videos[0]?.cover_urls[0],
},
],
});
}));
}
}, [data]);
useEffect(() => {
setFormData((old) => ({ ...old, imageAssets: oldPhotos }));
}, [oldPhotos]);
const superSingles = [
{ key: 0, text: "主动添加对方" },
{ key: 1, text: "向对方展示微信" },
@ -258,26 +267,33 @@ export default function CompleteStreamerInformation() {
setData({ ...account, streamer: _data.data.list[0] });
setWechatInputShow(_data.data.list[0].wechat_lock_type);
if (_data.data.list[0])
if (_data.data.list[0]) {
setFormData((old) => ({
...old,
displayImage: [
{
notChanged: true,
id: { image_ids: _data.data.list[0].cover.image_ids },
uri: _data.data.list[0].cover.images[0].urls[0],
image_ids: _data.data.list[0].cover.image_ids,
url: _data.data.list[0].cover.images[0].urls[0],
},
],
displayVideo: [
{
notChanged: true,
id: { video_ids: _data.data.list[0].shorts?.video_ids },
cover: _data.data.list[0].shorts?.videos[0]?.cover_urls[0],
video_ids: _data.data.list[0].shorts?.video_ids,
url: _data.data.list[0].shorts?.videos[0]?.cover_urls[0],
},
],
}));
setOldPhotos(_data.data.list[0].album.images);
setIsloading(false);
setOldPhotos(
_data.data.list[0].album.images.map((it) => ({
id: it.id,
url: it.urls[0],
}))
);
}
// setIsloading(false);
} catch (error) {
console.error(error);
} finally {
@ -327,6 +343,14 @@ export default function CompleteStreamerInformation() {
});
return;
}
if (isNaN(fans) || fans < 1) {
Toast.show({
icon: "fail",
content: "请输入有效的全网粉丝量大于等于1的整数",
position: "top",
});
return;
}
const price = parseInt(wechatPrice, 10);
if (isNaN(price) || price < 1) {
Toast.show({
@ -345,7 +369,7 @@ export default function CompleteStreamerInformation() {
return;
}
//2
if (displayImage.length < 2) {
if (imageAssets.length < 2) {
Toast.show({
icon: "fail",
content: "相册至少需要上传2张照片哦",
@ -354,7 +378,7 @@ export default function CompleteStreamerInformation() {
return;
}
//9
if (displayImage.length > 9) {
if (imageAssets.length > 9) {
Toast.show({
icon: "fail",
content: "相册最多只能上传9张照片哦",
@ -363,12 +387,14 @@ export default function CompleteStreamerInformation() {
return;
}
setIsSubmitting(true);
const cover = displayImage?.id
? displayImage
: await multiUploadImage(displayImage.file, 1);
const shorts = displayVideo?.id
? displayVideo
: await multiUploadImage(displayVideo.file, 2);
const cover =
displayImage[0]?.image_ids?.length > 0
? displayImage[0]
: await multiUploadImage(displayImage[0].file, 1);
const shorts =
displayVideo[0]?.video_ids?.length > 0
? displayVideo[0]
: await multiUploadImage(displayVideo[0].file, 2);
const newMedia = imageAssets.filter((it) => it.id == undefined);
const media = await multiUploadImage(newMedia, 1);
const album = {
@ -446,19 +472,23 @@ export default function CompleteStreamerInformation() {
if (type == 1) {
setFormData((old) => ({
...old,
displayImage: {
url: URL.createObjectURL(file),
file: Array.from(e.target.files),
},
displayImage: [
{
url: URL.createObjectURL(file),
file: Array.from(e.target.files),
},
],
}));
} else {
creatVideoCanvas(file);
setFormData((old) => ({
...old,
displayVideo: {
url: frameImageUrl,
file: Array.from(e.target.files),
},
displayVideo: [
{
url: frameImageUrl,
file: Array.from(e.target.files),
},
],
}));
}
};
@ -582,8 +612,8 @@ export default function CompleteStreamerInformation() {
<Picker
columns={[
[
{ label: "男", value: "0" },
{ label: "女", value: "1" },
{ label: "男", value: "0" },
],
]}
value={formData.gender}
@ -880,9 +910,9 @@ export default function CompleteStreamerInformation() {
type="number"
placeholder="请输入真实有效数据"
value={formData.fans}
onChange={(value) =>
setFormData((old) => ({ ...old, fans: value }))
}
onChange={(value) => {
setFormData((old) => ({ ...old, fans: value }));
}}
/>
</div>
</div>
@ -970,12 +1000,12 @@ export default function CompleteStreamerInformation() {
</p>
<label htmlFor="uploadBtn1">
<div className="flex items-center">
{formData?.displayImage ? (
{formData?.displayImage[0] ? (
<Image
width={36}
height={36}
className="rounded-lg"
src={formData.displayImage?.url}
src={formData.displayImage[0]?.url}
fit="cover"
/>
) : (
@ -1013,12 +1043,12 @@ export default function CompleteStreamerInformation() {
// onClick={() => pickDisPlayImage()}
className="flex items-center"
>
{formData?.displayVideo ? (
{formData?.displayVideo[0] ? (
<Image
width={36}
height={36}
className="rounded-lg"
src={frameImageUrl || formData.displayVideo.url}
src={frameImageUrl || formData.displayVideo[0]?.url}
fit="cover"
/>
) : (
@ -1066,9 +1096,9 @@ export default function CompleteStreamerInformation() {
type={1}
existImages={oldPhotos}
assets={formData.imageAssets}
getImgs={(imgs) =>
setFormData((old) => ({ ...old, imageAssets: imgs }))
}
getImgs={(imgs) => {
setFormData((old) => ({ ...old, imageAssets: imgs }));
}}
/>
</div>
</li>

View File

@ -86,8 +86,8 @@ export default function JoinStreamer() {
return (
<div>
{/* 头部标题 */}
<div className="p-4 fixed top-0 z-10 w-full bg-black">
<div className="w-9 h-9 flex items-center justify-center bg-[#FFFFFF1A] rounded-full absolute">
<div className="p-4 fixed top-0 z-10 w-full bg-black flex justify-between items-center">
<div className="w-9 h-9 flex items-center justify-center bg-[#FFFFFF1A] rounded-full">
<FontAwesomeIcon
icon={faAngleLeft}
style={{ maxWidth: "12px" }}
@ -98,6 +98,16 @@ export default function JoinStreamer() {
/>
</div>
<p className="text-base text-center leading-9">申请入驻</p>
<p
className="text-base text-center leading-9 text-[#FF669E]"
onClick={() => {
router.push(
`/webView/${encodeURIComponent("/doc/platformguidelines")}`
);
}}
>
平台准则
</p>
</div>
{/* 内容 */}
<div className="pt-16 p-4">

View File

@ -89,7 +89,7 @@ export default function spacePaymentSetting() {
const [formData, setFormData] = useState({
spacePrice: null,
ironFanPrice: null,
openSuper: true,
openSuper: false,
superSingle: [
{ enable: false, price: 0, wechatFree: false },
{ enable: false, price: 0, wechatFree: false },
@ -138,8 +138,10 @@ export default function spacePaymentSetting() {
}, [formData, superSingleCheckeds]);
const handleSubmit = async () => {
const { spacePrice, ironFanPrice, openSuper, superSingle } = formData;
if (!spacePrice || !ironFanPrice) {
const openSuperEveryFalse = Object.values(superSingle).every(
(it) => !it.enable
);
if (!spacePrice || !ironFanPrice || (openSuper && openSuperEveryFalse)) {
Toast.show({
icon: "fail",
content: "请完善内容后提交",
@ -344,7 +346,7 @@ export default function spacePaymentSetting() {
<span className="text-[#f00]">*</span>
</p>
<p className="text-[#ffffffb3] text-xs">
累计空间内消费达标可成为铁粉可查看相关帖
累计消费达成后解锁铁粉权益
</p>
</div>
<div className="mt-2 px-4 py-3 h-12 rounded-[0.8rem] bg-[#FFFFFF1a] flex justify-between items-center">
@ -364,7 +366,7 @@ export default function spacePaymentSetting() {
onChange={(value) =>
setFormData((old) => ({ ...old, ironFanPrice: value }))
}
className={!formData.spacePrice ? "pb-1.5" : ""}
className={!formData.ironFanPrice ? "pb-1.5" : ""}
inputClassName="placeholder:text-[14px]"
/>
</div>
@ -402,25 +404,30 @@ export default function spacePaymentSetting() {
</div>
</div>
</div>
<div className="mt-3">
<div className="flex justify-between items-center">
<p className="text-sm">
<span>超粉单次开通类型</span>
<span className="text-[#f00]">*</span>
</p>
<div className="flex items-center"></div>
{formData.openSuper && (
<div className="mt-3">
<div className="flex justify-between items-center">
<p className="text-sm">
<span>超粉单次开通类型</span>
<span className="text-[#f00]">*</span>
</p>
<p className="text-[#ffffffb3] text-xs">
付费后解锁对应期限超粉权益
</p>
</div>
<Space direction="vertical" block>
<Checkbox.Group
value={superSingleCheckeds}
onChange={(values) => {
setSuperSingleCheckeds(values);
}}
>
<ul>{listItemWithCheckboxMemo}</ul>
</Checkbox.Group>
</Space>
</div>
<Space direction="vertical" block>
<Checkbox.Group
value={superSingleCheckeds}
onChange={(values) => {
setSuperSingleCheckeds(values);
}}
>
<ul>{listItemWithCheckboxMemo}</ul>
</Checkbox.Group>
</Space>
</div>
)}
<div className="mt-10 flex justify-center">
<Button
size="middle"

View File

@ -15,7 +15,7 @@ export default function UploadImgs({
}) {
const maxCount = 6;
const [loading, setLoading] = useState(false);
const [filesUrls, setFilesUrls] = useState([...existImages]);
const [filesUrls, setFilesUrls] = useState([]);
const [videoUrl, setVideoUrl] = useState(null);
const [frameImage, setFrameImage] = useState({ src: null, h: 0, w: 0 });
useEffect(() => {
@ -35,13 +35,10 @@ export default function UploadImgs({
if (!file) return;
var videoUrl = URL.createObjectURL(file);
var videoObj = document.createElement("video");
let newFilesUrls = [...filesUrls];
const eles = Array.from(e.target.files);
if (type == 1) {
eles.forEach((element) => {
newFilesUrls = [...newFilesUrls, URL.createObjectURL(element)];
});
setFilesUrls(newFilesUrls);
const newFils = eles.map((it) => URL.createObjectURL(it));
setFilesUrls((old) => [...old, ...newFils]);
} else {
videoObj.onloadedmetadata = function (evt) {
URL.revokeObjectURL(videoUrl);