anln_2.2 #43
|
@ -39,7 +39,7 @@ export default function Found() {
|
|||
const [activeIndex, setActiveIndex] = useState(0);
|
||||
const [account, setAccount] = useState(null);
|
||||
const [scrollHeight, setScrollHeight] = useState(0);
|
||||
|
||||
const [loading, setLoading] = useState(false);
|
||||
// useEffect(() => {
|
||||
// const info = get("account");
|
||||
// console.log("info",info)
|
||||
|
@ -48,11 +48,14 @@ export default function Found() {
|
|||
// }
|
||||
// }, []
|
||||
// )
|
||||
const childrenFunc = () => {
|
||||
const childrenFunc = async () => {
|
||||
setLoading(true);
|
||||
if (!activeIndex) {
|
||||
recommPostRef.current?.doRefresh();
|
||||
await recommPostRef.current?.doRefresh();
|
||||
setLoading(false);
|
||||
} else {
|
||||
followPostRef.current?.doRefresh();
|
||||
await followPostRef.current?.doRefresh();
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
useEffect(() => {
|
||||
|
@ -119,7 +122,9 @@ export default function Found() {
|
|||
</Swiper.Item>
|
||||
</Swiper>
|
||||
<div
|
||||
className={`fixed bottom-[50px] right-4 z-[50] w-10 h-10 flex items-center justify-center bg-[#1d1d1d71] rounded-full`}
|
||||
className={`fixed bottom-[50px] right-4 z-[50] w-10 h-10 flex items-center justify-center bg-[#1d1d1d71] rounded-full ${
|
||||
loading ? "animate-spin" : ""
|
||||
}`}
|
||||
style={{ zIndex: 999 }}
|
||||
>
|
||||
<FontAwesomeIcon
|
||||
|
|
|
@ -28,6 +28,7 @@ export default function MessageDetail({}) {
|
|||
const [userInfo, setUserInfo] = useState(null);
|
||||
const [newMessage, setNewMessage] = useState("");
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [sendding, setSendding] = useState(false);
|
||||
const [offset, setOffset] = useState(0);
|
||||
const [more, setMore] = useState(1);
|
||||
const scrollBox = useRef();
|
||||
|
@ -212,6 +213,7 @@ export default function MessageDetail({}) {
|
|||
//查询历史记录的时候后移一位,防止记录重复
|
||||
setOffset((prev) => prev + 1);
|
||||
//请求接口发送私信
|
||||
setSendding(true);
|
||||
try {
|
||||
const data = await requireAPI(
|
||||
"POST",
|
||||
|
@ -224,6 +226,7 @@ export default function MessageDetail({}) {
|
|||
},
|
||||
}
|
||||
);
|
||||
setSendding(false);
|
||||
if (data.ret === -1) {
|
||||
Toast.show({
|
||||
icon: "error",
|
||||
|
@ -240,6 +243,7 @@ export default function MessageDetail({}) {
|
|||
});
|
||||
} catch (error) {
|
||||
// console.error(error);
|
||||
setSendding(false);
|
||||
}
|
||||
// //每次发送都缓存信息到本地
|
||||
// addArr(`${selfData.mid}_to_${params.mid}_messages`, messages);
|
||||
|
@ -415,11 +419,16 @@ export default function MessageDetail({}) {
|
|||
<div className="my-2">
|
||||
<p>触发按钮:</p>
|
||||
<ul className="grid grid-cols-2 gap-2 mt-2">
|
||||
{btns.map((item) => {
|
||||
{btns.map((item, index) => {
|
||||
return (
|
||||
<li
|
||||
key={index}
|
||||
onClick={() => {
|
||||
onSend(item, oldMessages[0]?.id || -1, oldMessages);
|
||||
onSend(
|
||||
item,
|
||||
oldMessages[0]?.id || -1,
|
||||
oldMessages.list
|
||||
);
|
||||
}}
|
||||
className="bg-[#3333331A] rounded text-center px-4 py-1"
|
||||
>
|
||||
|
@ -549,9 +558,22 @@ export default function MessageDetail({}) {
|
|||
<Button
|
||||
size="middle"
|
||||
block
|
||||
onClick={() =>
|
||||
onSend(newMessage, oldMessages[0]?.id || -1, oldMessages)
|
||||
}
|
||||
disabled={sendding}
|
||||
onClick={() => {
|
||||
if (newMessage.includes("|")) {
|
||||
Toast.show({
|
||||
icon: "fail",
|
||||
content: "消息不能包含|",
|
||||
position: "top",
|
||||
});
|
||||
return;
|
||||
}
|
||||
onSend(
|
||||
newMessage,
|
||||
oldMessages.list[0]?.id || -1,
|
||||
oldMessages.list
|
||||
);
|
||||
}}
|
||||
style={{
|
||||
"--background-color": "#FF669E",
|
||||
"--border-radius": "10px",
|
||||
|
|
|
@ -181,6 +181,7 @@ export default function Relationship() {
|
|||
hasMore={hasMore}
|
||||
isEmpty={data.length == 0}
|
||||
showNoMore={data.length === 0}
|
||||
type="friendship"
|
||||
/>
|
||||
</InfiniteScroll>
|
||||
</List>
|
||||
|
@ -238,6 +239,7 @@ export default function Relationship() {
|
|||
hasMore={hasMore}
|
||||
isEmpty={data.length == 0}
|
||||
showNoMore={data.length === 0}
|
||||
type="friendship"
|
||||
/>
|
||||
</InfiniteScroll>
|
||||
</List>
|
||||
|
|
|
@ -321,6 +321,8 @@ const SpacesList = forwardRef(({ scrollHeight }, ref) => {
|
|||
hasMore={hasMore}
|
||||
isEmpty={spacesList.length == 0}
|
||||
showNoMore={spacesList.length === 0}
|
||||
zoneEmpty={true}
|
||||
type="nospace"
|
||||
/>
|
||||
</InfiniteScroll>
|
||||
</div>
|
||||
|
@ -434,7 +436,12 @@ const SpacePostList = forwardRef(({ scrollHeight }, ref) => {
|
|||
)}
|
||||
{spacePostList?.map((item, index) => (
|
||||
<List.Item key={item.id + "_" + index} className="!p-0">
|
||||
<PostItem type="post" data={item} date={new Date(item.ct * 1000)} />
|
||||
<PostItem
|
||||
type="post"
|
||||
showFollow={false}
|
||||
data={item}
|
||||
date={new Date(item.ct * 1000)}
|
||||
/>
|
||||
</List.Item>
|
||||
))}
|
||||
{!spacePostList?.length && (
|
||||
|
@ -442,7 +449,7 @@ const SpacePostList = forwardRef(({ scrollHeight }, ref) => {
|
|||
className={`flex flex-col items-center justify-center h-screen`}
|
||||
style={{ height: `calc(100vh - 133px)` }}
|
||||
>
|
||||
<Empty type="nodata" />
|
||||
<Empty type="nospace" />
|
||||
</div>
|
||||
)}
|
||||
</List>
|
||||
|
|
|
@ -8,6 +8,8 @@ export default function InfiniteScrollContent({
|
|||
hasMore = 0,
|
||||
isEmpty,
|
||||
showNoMore = true,
|
||||
zoneEmpty = false,
|
||||
type = "nodata",
|
||||
}) {
|
||||
const router = useRouter();
|
||||
return (
|
||||
|
@ -24,21 +26,23 @@ export default function InfiniteScrollContent({
|
|||
className={`flex flex-col items-center mt-28`}
|
||||
// style={{ height: `${scrollHeight}px` }}
|
||||
>
|
||||
<Empty type="nodata" />
|
||||
<div className="text-white">
|
||||
<p
|
||||
onClick={() => router.push("/search")}
|
||||
className="text-base font-medium flex items-center justify-center bg-[#FFFFFF1A] mt-2 rounded-full w-[190px] h-[46px]"
|
||||
>
|
||||
搜索空间
|
||||
</p>
|
||||
<p
|
||||
onClick={() => router.push("/found")}
|
||||
className="text-base font-medium flex items-center justify-center bg-[#FFFFFF1A] mt-2 rounded-full w-[190px] h-[46px]"
|
||||
>
|
||||
查看推荐
|
||||
</p>
|
||||
</div>
|
||||
<Empty type={type} />
|
||||
{zoneEmpty && (
|
||||
<div className="text-white">
|
||||
<p
|
||||
onClick={() => router.push("/search")}
|
||||
className="text-base font-medium flex items-center justify-center bg-[#FFFFFF1A] mt-2 rounded-full w-[190px] h-[46px]"
|
||||
>
|
||||
搜索空间
|
||||
</p>
|
||||
<p
|
||||
onClick={() => router.push("/found")}
|
||||
className="text-base font-medium flex items-center justify-center bg-[#FFFFFF1A] mt-2 rounded-full w-[190px] h-[46px]"
|
||||
>
|
||||
查看推荐
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
|
|
Loading…
Reference in New Issue