From 56bee2216523a9ec64830700c94a869884e40d70 Mon Sep 17 00:00:00 2001 From: al Date: Mon, 15 Jul 2024 20:00:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/messageDetail/page.js | 7 +- app/my/editUserProfile/editUserName/page.js | 1 - app/my/page.js | 97 ++++++++----- app/profile/[mid]/page.js | 133 ++++++++++-------- app/search/page.js | 2 +- app/space/page.js | 122 ++++++++-------- .../person_space_introduce/[mid]/page.js | 16 ++- components/AddWeChat/index.js | 5 +- components/Photos/index.js | 84 +++++++---- components/PostItem/index.js | 10 +- components/SeeTiefen/index.js | 2 +- utils/upload.js | 4 +- 12 files changed, 278 insertions(+), 205 deletions(-) diff --git a/app/messageDetail/page.js b/app/messageDetail/page.js index 3550bdf..264c614 100644 --- a/app/messageDetail/page.js +++ b/app/messageDetail/page.js @@ -2,13 +2,10 @@ import React, { useState, useRef, useEffect, useCallback } from "react"; -import baseRequest from "@/utils/baseRequest"; -import { generateSignature } from "@/utils/crypto"; 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"; -const blurhash = "LcKUTa%gOYWBYRt6xuoJo~s8V@fk"; import { get } from "@/utils/storeInfo"; import require from "@/utils/require"; import { formatDeadline } from "@/utils/tools"; @@ -60,7 +57,7 @@ export default function MessageDetail({}) { scrollBox.current?.scrollTo(0, scrollBox.current.scrollHeight+50); toScrollBottom.current = 0; } - }, [toScrollBottom.current]); + }, [messages]); // useEffect(() => { // if (offset == 12) { // console.log("offset--------", offset); @@ -355,7 +352,7 @@ export default function MessageDetail({}) { }} /> -

在线服务

+

在线客服

diff --git a/app/my/editUserProfile/editUserName/page.js b/app/my/editUserProfile/editUserName/page.js index 844f30f..9bb0bc6 100644 --- a/app/my/editUserProfile/editUserName/page.js +++ b/app/my/editUserProfile/editUserName/page.js @@ -15,7 +15,6 @@ export default function EditUserName() { useEffect(() => { const getName = async () => { - setName(account.name); }; getName(); diff --git a/app/my/page.js b/app/my/page.js index 79dcfa1..2b64cd9 100644 --- a/app/my/page.js +++ b/app/my/page.js @@ -10,7 +10,6 @@ import { get } from "@/utils/storeInfo"; import require from "@/utils/require"; const My = () => { const [userInfo, setUserInfo] = useState({}); - const searchParams = useSearchParams(); const router = useRouter(); useEffect(() => { const userInfo = get("account"); @@ -60,42 +59,69 @@ const My = () => { />
-
router.push("profile/" + userInfo.mid)} - > -
- router.push("profile/" + userInfo.mid)} + > +
+ +
+

{userInfo.name}

+
+ + {userInfo.user_id} +
+
+
+ { + // searchParams.append(); + // router.back(); + }} /> -
-

{userInfo.name}

-
- - {userInfo.user_id} +
+ ) : ( +
+
+ +
+

{userInfo.name}

+
+ + {userInfo.user_id} +
- { - // searchParams.append(); - // router.back(); - }} - /> -
+ )}
  • { className="h-4 text-gray-300" />
  • -
  • router.push("my/unlockedWechat")}> +
  • router.push("my/unlockedWechat")} + >
    { + console.log("_data",_data) + clipboard(_data); + Toast.show({ + icon: "success", + content: "已复制到剪贴板", + position: "top", + }); + }; return (
    @@ -112,7 +124,7 @@ export default function PersonSpace() { />
    { @@ -234,9 +246,7 @@ export default function PersonSpace() { /> {streamerInfo?.streamer_ext?.user_id}
  • -
  • +
  • (
    @@ -368,73 +378,71 @@ export default function PersonSpace() {
- {streamerInfo?.streamer_ext?.platforms && ( - <> - -
-

来这找我玩

+ <> + +
+

来这找我玩

-
    -
  • +
      +
    • +
      + +
      + 微信: + setVisible(true)}>点击查看 +
      +
      +
    • + {streamerInfo?.streamer_ext?.platforms?.map((item) => ( +
    • - 微信: - 点击查看 + {item?.link_name}: + {item?.nickname} +
      +
      +
      +
      { + copy(item.url); + }} + > + + 复制 +
      +
      + + 前往
    • - {streamerInfo?.streamer_ext?.platforms?.map((item) => ( -
    • -
      - -
      - {item?.link_name}: - {item?.nickname} -
      -
      -
      -
      { - // Clipboard.setStringAsync(item.url); - // }} - > - - 复制 -
      -
      - - 前往 -
      -
      -
    • - ))} -
    -
- - )} + ))} + +
+
diff --git a/app/search/page.js b/app/search/page.js index 23f2421..7f8599c 100644 --- a/app/search/page.js +++ b/app/search/page.js @@ -156,7 +156,7 @@ const ZoneItem = ({ data, showMore }) => { return ( router.push(`/space/${data.mid}`)} + onClick={() => router.push(`space/profile/${data.mid}`)} key={data.id} arrow={false} > diff --git a/app/space/page.js b/app/space/page.js index 2d2daaa..35597e0 100644 --- a/app/space/page.js +++ b/app/space/page.js @@ -165,74 +165,74 @@ export default function Space() { {!activeIndex && (
-
- {dataList.length > 0 ? ( -
    - {dataList?.map((item) => ( -
  • - -
  • - ))} -
  • router.push("/search")}> -
    navigation.navigate("Stream")} - // onClick={} - className="w-full h-52" - > -
    - {/*
    + {!loading ? ( +
    + {dataList.length > 0 ? ( +
      + {dataList?.map((item) => ( +
    • + +
    • + ))} +
    • router.push("/search")}> +
      navigation.navigate("Stream")} + // onClick={} + className="w-full h-52" + > +
      + {/*
      */} -
      -

      - 发现更多 -

      -

      - 缘分就在不经意间 -

      - - +

      + 发现更多 +

      +

      + 缘分就在不经意间 +

      + + {/* + /> */} +
      +
    • +
    + ) : ( +
    + +
    + + 搜索空间 + + + 查看推荐 +
    -
  • -
- ) : ( -
- -
- - 搜索空间 - - - 查看推荐 -
-
- )} -
- - {loading && ( + )} +
+ ) : (
{ {data?.streamer_ext?.name} -
    - {data?.admission_price !== 0 && ( +
      + {data.visitor_role === 3 && (
    • - 付费 + 创建者
    • )} - {data.visitor_role === 3 && ( + {data?.admission_price !== 0 && (
    • 付费
    • diff --git a/app/space/person_space_introduce/[mid]/page.js b/app/space/person_space_introduce/[mid]/page.js index 4bc1cfc..709646f 100644 --- a/app/space/person_space_introduce/[mid]/page.js +++ b/app/space/person_space_introduce/[mid]/page.js @@ -1,10 +1,15 @@ "use client"; import React, { useEffect, useState, useRef } from "react"; -import { Image, ImageViewer,Dialog } from "antd-mobile"; +import { Image, ImageViewer, Dialog } from "antd-mobile"; import { useRouter, useParams } from "next/navigation"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; -import { faAngleLeft, faAngleRight,faClose,faSave } from "@fortawesome/free-solid-svg-icons"; +import { + faAngleLeft, + faAngleRight, + faClose, + faSave, +} from "@fortawesome/free-solid-svg-icons"; import AddWeChat from "@/components/AddWeChat"; import { getStreamerInfo } from "@/api/space"; export default function PersonSpaceIntroduce() { @@ -24,7 +29,10 @@ export default function PersonSpaceIntroduce() { getStreamerInfo(Number(mid)).then((res) => { setData(res); - console.log("mid", mid,res); + if (res?.visitor_role!=4) { + router.push("/space/" + mid); + } + console.log("mid", mid, res); }); }, []); const showPhotos = (photos, index) => { @@ -94,7 +102,7 @@ export default function PersonSpaceIntroduce() {
      diff --git a/components/AddWeChat/index.js b/components/AddWeChat/index.js index b4ec7ab..444a7c0 100644 --- a/components/AddWeChat/index.js +++ b/components/AddWeChat/index.js @@ -17,7 +17,6 @@ export default function AddWeChat({ }) { const [isMoneyEnough, setIsMoneyEnough] = useState(true); //是否已经解锁微信 - const [isWechatUnlocked, setIsWechatUnlocked] = useState(false); const [streamerDetailData, setStreamerDetailData] = useState(null); const [wechat, setWechat] = useState(); const router = useRouter(); @@ -31,13 +30,13 @@ export default function AddWeChat({ }, [streamerData]); useEffect(() => { console.log("avatar",avatar) - if (!streamerDetailData && !streamerDetailData?.is_unlock_wechat) return; + if (!streamerDetailData || !streamerDetailData?.is_unlock_wechat) return; require("POST", "/api/vas/query_wechat", { body: { uid: streamerMid, }, }).then(res=>{ - setWechat(res.data.wechat_contact) + setWechat(res.data?.wechat_contact) }) }, [streamerDetailData]); diff --git a/components/Photos/index.js b/components/Photos/index.js index b824233..b902567 100644 --- a/components/Photos/index.js +++ b/components/Photos/index.js @@ -1,7 +1,7 @@ "use client"; import React, { useEffect, useRef, useState } from "react"; -import { Image, ImageViewer, Dialog } from "antd-mobile"; +import { Image, ImageViewer, Dialog, Swiper } from "antd-mobile"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { faAngleUp, faClose, faSave } from "@fortawesome/free-solid-svg-icons"; @@ -10,27 +10,44 @@ const tabItems = [ { key: "follow", title: "关注" }, ]; -export default function Photos({ media }) { +export default function Photos({ isUnlocked, mediaAmount, media }) { const [seeAllPhotos, setSeeAllPhotos] = useState(false); const [currentPhotos, setCurrentPhotos] = useState([]); const [photos, setPhotos] = useState([]); useEffect(() => { if (media) { - let imgArr = media.images.map(item=>({type:"img",url:item.urls?.[0]})) - let videoArr = media.videos.map(item=>({type:"video",url:item.cover_urls?.[0],mp4:item.urls?.[0]})) - let arr=[...imgArr,...videoArr] + let imgArr = media.images.map((item) => ({ + type: "img", + url: item.urls?.[0], + })); + let videoArr = media.videos.map((item) => ({ + type: "video", + url: item.cover_urls?.[0], + mp4: item.urls?.[0], + })); + let arr = [...imgArr, ...videoArr]; let newPhotos = [...arr]; - setPhotos(arr); - if (arr.length > 9) { + + if (mediaAmount && !isUnlocked) { + newPhotos = Array(mediaAmount) + .fill(null) + .map((item, index) => { + return newPhotos[index] + ? newPhotos[index] + : { url: newPhotos[0]?.url, type: "hid" }; + }); + } + setPhotos(newPhotos); + if (newPhotos.length > 9) { newPhotos = newPhotos.slice(0, 9); } + console.log("newPhotos", newPhotos); setCurrentPhotos(newPhotos); } - }, [media]); const showPhotos = (photos, index) => { ImageViewer.Multi.show({ - images: photos.map((item) => item.url), + images: photos.map((item) => item?.url), defaultIndex: index, }); }; @@ -55,12 +72,10 @@ export default function Photos({ media }) { height="100%" controls className="w-screen h-[70vh] rounded-lg object-contain" - poster={video.url} + poster={video?.url} + autoPlay={true} > - + 您的浏览器不支持 Video 标签。
      @@ -69,7 +84,7 @@ export default function Photos({ media }) { key="closeBtn" // onClick={handleSeeAllPhotos} > - +
), @@ -97,32 +112,42 @@ export default function Photos({ media }) { }; return ( <> -
1?"grid-cols-3 gap-1.5":"grid-cols-1"}`}> +
1 ? "grid-cols-3 gap-1.5" : "grid-cols-1" + }`} + > {currentPhotos.map((item, index) => { return (
{ - if (item.type == "video") { + if (item?.type == "video") { handleShowVideo(item); } else { showPhotos(photos, index); } }} > -
- } - width={currentPhotos.length>1 ? "24vw":"100%"} - height={currentPhotos.length>1 ? "24vw":"100%"} - className={`rounded max-w-full`} - fit="cover" - src={item.url} - /> - {item.type == "video" && ( + { +
+
+ } + width={currentPhotos.length > 1 ? "24vw" : "100%"} + height={currentPhotos.length > 1 ? "24vw" : "100%"} + className={`rounded max-w-full ${ + item?.type == "hid" ? "imageBlur" : "" + }`} + fit="cover" + src={item?.url} + /> +
+ } + {item?.type == "video" && (
); })} + {seeAllPhotos && (
- {data.media_component && } + {data.media_component && ( + + )} {type == "space" && !isCreator && !!data.c_type && ( router.push("/profile/" + data.mid)} + onClick={() => router.push("/space/person_space_introduce/" + data.mid)} > {data.is_active_within_a_week ? ( <> diff --git a/components/SeeTiefen/index.js b/components/SeeTiefen/index.js index bce21ad..f68a944 100644 --- a/components/SeeTiefen/index.js +++ b/components/SeeTiefen/index.js @@ -35,7 +35,7 @@ export default function SeeTiefen({ expenditure / 100 } / ${ironfanship_price / 100}`}

- 空间内累计消费达到¥1280即可成为 + 空间内累计消费达到¥{ironfanship_price / 100}即可成为 铁粉 ,可查看所有铁粉专享内容哟,快来成为我的铁粉吧~

diff --git a/utils/upload.js b/utils/upload.js index 2e566e8..a424b11 100644 --- a/utils/upload.js +++ b/utils/upload.js @@ -109,8 +109,8 @@ export async function uploadImage(asset) { }); if (uploadResponse.status === 200) { - console.log(asset); - debugger + // console.log(asset); + // debugger const info = await calculateFileMetadata(asset); const item = { src_id: auth.directory + "/" + auth.filename,