修复帖子功能选择问题

This commit is contained in:
al 2024-10-23 17:29:53 +08:00
parent 12d146c73e
commit 9432d91def
2 changed files with 9 additions and 8 deletions

View File

@ -62,7 +62,7 @@ export default function PersonSpace() {
// debugger // debugger
} }
getStreamerInfo(Number(id)).then((res) => { getStreamerInfo(Number(id)).then((res) => {
let tabitems = res.is_superfanship_enabled let tabitems = res?.is_superfanship_enabled
? [ ? [
{ label: "全部", key: "all" }, { label: "全部", key: "all" },
{ label: "铁粉专享", key: "ironFan" }, { label: "铁粉专享", key: "ironFan" },

View File

@ -25,11 +25,15 @@ export default function PostItem({
const [isThumbsUp, setIsThumbsUp] = useState( const [isThumbsUp, setIsThumbsUp] = useState(
data?.is_thumbed_up || data?.is_zone_moment_thumbed_up data?.is_thumbed_up || data?.is_zone_moment_thumbed_up
); );
const [account, setAccount] = useState(
data?.is_thumbed_up || data?.is_zone_moment_thumbed_up
);
//判断是否是发帖人 //判断是否是发帖人
const [isCreator, setIsCreator] = useState(false); const [isCreator, setIsCreator] = useState(false);
useEffect(() => { useEffect(() => {
const account = get("account"); const currentAccount = get("account");
if (account?.mid === data.mid) setIsCreator(true); setAccount(currentAccount);
if (currentAccount?.mid === data.mid) setIsCreator(true);
return () => { return () => {
router.prefetch("/profile/" + data.mid); router.prefetch("/profile/" + data.mid);
}; };
@ -370,7 +374,7 @@ export default function PostItem({
style={{ "--background": "#1E1C29" }} style={{ "--background": "#1E1C29" }}
content={ content={
<ul> <ul>
{type == "space" && ( {type == "space" && account?.mid == data?.mid ? (
<> <>
<li className="py-1 px-4" onClick={handleTop}> <li className="py-1 px-4" onClick={handleTop}>
{data.is_headed ? "取消置顶" : "置顶"} {data.is_headed ? "取消置顶" : "置顶"}
@ -393,9 +397,7 @@ export default function PostItem({
删除 删除
</li> </li>
</> </>
)} ) : (
{type == "post" && (
<> <>
<li <li
className="py-1 px-4" className="py-1 px-4"
@ -409,7 +411,6 @@ export default function PostItem({
<li <li
className="py-1 px-4" className="py-1 px-4"
onClick={async () => { onClick={async () => {
const account = await get("account");
const subMid = account.mid; const subMid = account.mid;
const objMid = data.mid; const objMid = data.mid;
await handleBlock(subMid, objMid); await handleBlock(subMid, objMid);