"use client"; import React, { useEffect, useState } from "react"; import { Mask, Image } from "antd-mobile"; import { getStreamer } from "@/api/streamer"; import { useRouter } from "next/navigation"; import { connect } from "react-redux"; import { changeInviter } from "@/store/actions"; function StreamerNavigator({ userId, changeInviter }) { const [streamerInfo, setStreamerInfo] = useState(null); const router = useRouter(); useEffect(() => { userId && getStreamer(userId).then((res) => { setStreamerInfo(res); }); }, []); const handleCloseMask = () => { changeInviter(null); setStreamerInfo(null); }; return (

{streamerInfo?.streamer_ext?.name}

{!streamerInfo?.streamer_ext?.zones?.length ? streamerInfo?.streamer_ext?.bio : streamerInfo?.streamer_ext?.zones[0]?.profile}

{ handleCloseMask(); router.replace( "/profile/" + streamerInfo?.streamer_ext?.mid ); } : () => { handleCloseMask(); router.replace( "/space/person_space_introduce/" + streamerInfo?.streamer_ext?.mid ); } } className="w-full p-2 mt-4 text-base rounded-full bg-[#FF669E] text-center" > {streamerInfo?.streamer_ext?.zones?.length === 0 ? "查看主页" : "查看空间"}
); } const mapStateToProps = ({ reducer }) => { return { userId: parseInt(reducer.inviter, 10), }; }; const mapDispatchToProps = { changeInviter, }; export default connect(mapStateToProps, mapDispatchToProps)(StreamerNavigator);