修复帖子功能选择问题

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
}
getStreamerInfo(Number(id)).then((res) => {
let tabitems = res.is_superfanship_enabled
let tabitems = res?.is_superfanship_enabled
? [
{ label: "全部", key: "all" },
{ label: "铁粉专享", key: "ironFan" },

View File

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