添加私聊功能
|
@ -5,13 +5,10 @@ import {useRouter} from "next/navigation";
|
|||
import requireAPI from "@/utils/requireAPI";
|
||||
export default function BillDetail({ params }) {
|
||||
const [data, setData] = useState([]);
|
||||
const [isFetching, setIsFetching] = useState(true);
|
||||
const [isFetching, setIsFetching] = useState(false);
|
||||
const router = useRouter();
|
||||
useEffect(() => {
|
||||
|
||||
setTimeout(() => {
|
||||
getData();
|
||||
}, 500);
|
||||
}, []);
|
||||
const getData = async () => {
|
||||
let type;
|
||||
|
@ -32,6 +29,7 @@ export default function BillDetail({ params }) {
|
|||
break;
|
||||
}
|
||||
try {
|
||||
setIsFetching(true);
|
||||
const _data = await requireAPI(
|
||||
"POST",
|
||||
"/api/vas/get_ch_list",
|
||||
|
@ -86,7 +84,7 @@ export default function BillDetail({ params }) {
|
|||
</div>
|
||||
)}
|
||||
{data.length === 0 && (
|
||||
<div className="flex flex-col mt-4 w-full items-center">
|
||||
<div className="flex flex-col mt-14 w-full items-center">
|
||||
<svg viewBox="0 0 1024 1024" width="120" height="120">
|
||||
<path
|
||||
d="M102.4 896a409.6 51.2 0 1 0 819.2 0 409.6 51.2 0 1 0-819.2 0Z"
|
||||
|
|
|
@ -33,11 +33,22 @@ export const viewport = {
|
|||
};
|
||||
export default function RootLayout({ children }) {
|
||||
return (
|
||||
<html lang="zh-CN" className="bg-deepBg h-full" data-prefers-color-scheme="dark">
|
||||
<Head>
|
||||
<html
|
||||
lang="zh-CN"
|
||||
className="bg-deepBg h-full"
|
||||
data-prefers-color-scheme="dark"
|
||||
>
|
||||
<head>
|
||||
<title>{metadata.title}</title>
|
||||
<meta name="description" content={metadata.description} keywords={metadata.keywords}/>
|
||||
</Head>
|
||||
<link rel="icon" href="/favicon.ico" type="image/x-icon"></link>
|
||||
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon"></link>
|
||||
<link rel="icon" href="/favicon.png" type="image/png"></link>
|
||||
<meta
|
||||
name="description"
|
||||
content={metadata.description}
|
||||
keywords={metadata.keywords}
|
||||
/>
|
||||
</head>
|
||||
<body className={`${inter.className} h-full`}>
|
||||
<main className={`w-full bg-deepBg h-full`}>
|
||||
{withAuth(<Provider store={store}>{children}</Provider>)}
|
||||
|
|
|
@ -5,10 +5,11 @@ import React, { useState, useRef, useEffect, useCallback } from "react";
|
|||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
||||
import { faAngleLeft } from "@fortawesome/free-solid-svg-icons";
|
||||
import { Input, Button, Toast, Avatar, DotLoading } from "antd-mobile";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useRouter, useSearchParams } from "next/navigation";
|
||||
import { get } from "@/utils/storeInfo";
|
||||
import requireAPI from "@/utils/requireAPI";
|
||||
import { formatDeadline } from "@/utils/tools";
|
||||
import { getStreamerDetailInfo } from "@/api/space";
|
||||
/*
|
||||
params格式:
|
||||
{
|
||||
|
@ -19,6 +20,7 @@ params格式:
|
|||
export default function MessageDetail({}) {
|
||||
// const [hasMore, setHasMore] = useState(true);
|
||||
const router = useRouter();
|
||||
const searchParams = useSearchParams();
|
||||
const [oldMessages, setOldMessages] = useState([]);
|
||||
const [messages, setMessages] = useState([]);
|
||||
const [handledmessages, setHandledmessages] = useState([]);
|
||||
|
@ -26,15 +28,33 @@ export default function MessageDetail({}) {
|
|||
const [userInfo, setUserInfo] = useState(null);
|
||||
const [newMessage, setNewMessage] = useState("");
|
||||
const [loading, setLoading] = useState(false);
|
||||
|
||||
const [offset, setOffset] = useState(0);
|
||||
const [more, setMore] = useState(1);
|
||||
const scrollBox = useRef();
|
||||
const toScrollBottom = useRef(0);
|
||||
useEffect(() => {
|
||||
const userData = get("account");
|
||||
const mid = searchParams.get("mid")
|
||||
if (mid) {
|
||||
getStreamerDetailInfo(Number(mid)).then(data=>{
|
||||
setMessages([[{
|
||||
predicate: 1,
|
||||
_id: 1,
|
||||
createdAt: new Date()/1000,
|
||||
text: data?.streamer_ext.auto_response_message,
|
||||
user: {
|
||||
_id: 0,
|
||||
name: "客服",
|
||||
avatar: data?.streamer_ext?.avatar?.images[0]?.urls[0],
|
||||
},
|
||||
}]]);
|
||||
})
|
||||
|
||||
|
||||
} else {
|
||||
setUserInfo(userData);
|
||||
getSession(userData.mid);
|
||||
}
|
||||
}, []);
|
||||
useEffect(() => {
|
||||
const intervalId = setInterval(() => {
|
||||
|
@ -369,7 +389,7 @@ export default function MessageDetail({}) {
|
|||
</div>
|
||||
<div>
|
||||
<div className="my-[57px]">
|
||||
<div className="flex justify-center py-2">
|
||||
{searchParams.get("mid")=="" && <div className="flex justify-center py-2">
|
||||
<div className="px-3 py-2 rounded-full bg-[#FFFFFF1A]">
|
||||
{loading ? (
|
||||
<DotLoading />
|
||||
|
@ -379,7 +399,7 @@ export default function MessageDetail({}) {
|
|||
<span>无更早消息</span>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>}
|
||||
<ul className="py-2">
|
||||
{messages?.map((item, index) => (
|
||||
<li key={index}>
|
||||
|
@ -433,6 +453,7 @@ export default function MessageDetail({}) {
|
|||
{/* <InfiniteScroll loadMore={loadMore} hasMore={more} /> */}
|
||||
</ul>
|
||||
</div>
|
||||
{searchParams.get("mid")=="" && (
|
||||
<div className="w-full h-16 fixed bottom-0 grid grid-cols-[1fr_68px] bg-black items-center p-2 border-t-2 border-[#ffffff2a]">
|
||||
<div className="rounded bg-[#222036] px-4 py-2 mr-2">
|
||||
<Input
|
||||
|
@ -453,6 +474,7 @@ export default function MessageDetail({}) {
|
|||
发送
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
|
|
@ -472,7 +472,7 @@ export default function PersonSpace() {
|
|||
</div>
|
||||
<div
|
||||
className="text-base bg-[#FFFFFF1A] py-1 px-6 rounded-full"
|
||||
// onClick={() => handleFollow(isFollow, Number(mid), setIsFollow)}
|
||||
onClick={() => router.push("/messageDetail?mid="+streamerInfo?.streamer_ext?.mid)}
|
||||
>
|
||||
私聊
|
||||
</div>
|
||||
|
|
|
@ -168,10 +168,11 @@ const ZoneItem = ({ data, showMore, link,search }) => {
|
|||
className="grid grid-cols-[2.5rem_100%] gap-2 items-center"
|
||||
style={{ maxWidth: "calc(100vw - 2rem)" }}
|
||||
>
|
||||
<img
|
||||
<Image
|
||||
className="flex-none w-10 h-10 rounded-full mr-2"
|
||||
src={data?.avatar?.images[0]?.urls[0]}
|
||||
alt=""
|
||||
fit="cover"
|
||||
/>
|
||||
<div className="flex-1">
|
||||
<div className="flex items-center">
|
||||
|
|
|
@ -16,10 +16,10 @@ export default function WithAuth(WrappedComponent) {
|
|||
}, [pathname]);
|
||||
const checkLogin = async () => {
|
||||
const hasToken = await get("token");
|
||||
console.log("hasToken", hasToken);
|
||||
// console.log("hasToken", hasToken);
|
||||
if (hasToken) {
|
||||
const hasToken = get("token");
|
||||
console.log("hasToken", hasToken);
|
||||
// console.log("hasToken", hasToken);
|
||||
if (hasToken) {
|
||||
const currentIsLogin = await checkAuth();
|
||||
if (!currentIsLogin) {
|
||||
|
|
After Width: | Height: | Size: 4.2 KiB |
After Width: | Height: | Size: 421 B |
After Width: | Height: | Size: 299 B |
After Width: | Height: | Size: 216 B |
After Width: | Height: | Size: 730 B |
After Width: | Height: | Size: 328 B |
After Width: | Height: | Size: 196 B |
After Width: | Height: | Size: 528 B |
After Width: | Height: | Size: 602 B |
After Width: | Height: | Size: 422 B |
After Width: | Height: | Size: 290 B |
After Width: | Height: | Size: 503 B |
After Width: | Height: | Size: 324 B |
After Width: | Height: | Size: 427 B |
After Width: | Height: | Size: 769 B |
After Width: | Height: | Size: 499 B |
After Width: | Height: | Size: 228 B |
After Width: | Height: | Size: 609 B |
After Width: | Height: | Size: 952 B |
After Width: | Height: | Size: 228 B |
After Width: | Height: | Size: 258 B |
After Width: | Height: | Size: 302 B |
After Width: | Height: | Size: 223 B |
After Width: | Height: | Size: 179 B |
After Width: | Height: | Size: 386 B |
After Width: | Height: | Size: 870 B |
After Width: | Height: | Size: 398 B |
After Width: | Height: | Size: 286 B |
After Width: | Height: | Size: 258 B |
After Width: | Height: | Size: 304 B |
After Width: | Height: | Size: 267 B |
After Width: | Height: | Size: 354 B |
After Width: | Height: | Size: 273 B |
After Width: | Height: | Size: 343 B |
After Width: | Height: | Size: 269 B |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 732 B |
After Width: | Height: | Size: 702 B |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 456 B |
After Width: | Height: | Size: 356 B |
After Width: | Height: | Size: 297 B |
After Width: | Height: | Size: 4.9 KiB |
After Width: | Height: | Size: 798 B |
After Width: | Height: | Size: 1020 B |
After Width: | Height: | Size: 539 B |
After Width: | Height: | Size: 943 B |
After Width: | Height: | Size: 946 B |
After Width: | Height: | Size: 463 B |
After Width: | Height: | Size: 602 B |
After Width: | Height: | Size: 738 B |
After Width: | Height: | Size: 739 B |
After Width: | Height: | Size: 626 B |
After Width: | Height: | Size: 779 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 432 B |
After Width: | Height: | Size: 840 B |
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 883 B |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 266 KiB |
After Width: | Height: | Size: 5.4 KiB |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 161 B |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 3.5 KiB |
After Width: | Height: | Size: 3.5 KiB |
After Width: | Height: | Size: 645 B |
After Width: | Height: | Size: 1.1 KiB |