From 0339587d23c292f7921add6b7cac655f69af057d Mon Sep 17 00:00:00 2001 From: al Date: Fri, 19 Jul 2024 16:22:43 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=99=BB=E5=BD=95=E9=AA=8C?= =?UTF-8?q?=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/globals.css | 4 ++ app/my/setting/editPassword/page.js | 3 +- app/profile/[mid]/page.js | 93 +++++++++++++++++------------ app/search/page.js | 9 +-- components/Photos/index.js | 9 +-- components/PostItem/index.js | 1 + components/WithAuth/index.js | 29 +++++++-- utils/require.js | 1 + utils/storeInfo.js | 2 +- 9 files changed, 100 insertions(+), 51 deletions(-) diff --git a/app/globals.css b/app/globals.css index d75babd..f9f8416 100644 --- a/app/globals.css +++ b/app/globals.css @@ -215,6 +215,10 @@ body{ width: max-content; border-radius: 0.25rem; } */ +.mediaDom .adm-image-viewer-slide{ + /* max-height: 90vh; */ + max-width: 100vw; +} .photos-body img{ /* max-height: 90vh; */ filter: blur(8px); diff --git a/app/my/setting/editPassword/page.js b/app/my/setting/editPassword/page.js index 4c45b25..f0833c6 100644 --- a/app/my/setting/editPassword/page.js +++ b/app/my/setting/editPassword/page.js @@ -157,9 +157,10 @@ export default function EditPassword() { {/* 内容 */}

+ {console.log(mobilePhone,"cccc")} {searchParams.get("is_enabled") == "0" ? "设置密码" - : mobilePhone == "0" + : mobilePhone ? "修改密码" : "重置密码"}

diff --git a/app/profile/[mid]/page.js b/app/profile/[mid]/page.js index 8a4e8ca..cc5b0d9 100644 --- a/app/profile/[mid]/page.js +++ b/app/profile/[mid]/page.js @@ -103,7 +103,7 @@ export default function PersonSpace() { }; //保存内容到剪贴板 const copy = (_data) => { - console.log("_data",_data) + console.log("_data", _data); clipboard(_data); Toast.show({ icon: "success", @@ -340,43 +340,57 @@ export default function PersonSpace() { )}
- -
-
router.push(spaceData?.visitor_role === 4?`/space/person_space_introduce/${mid}`:`/space/${mid}`)}> -
- 空间动态 -
- - 查看{spaceData?.zone_moment_count || 0}条 - - { - router.back(); - }} - /> + {spaceData&&!!spaceData?.previews?.images?.length&& + <> + +
+
+ router.push( + spaceData?.visitor_role === 4 + ? `/space/person_space_introduce/${mid}` + : `/space/${mid}` + ) + } + > +
+ 空间动态 +
+ + 查看{spaceData?.zone_moment_count}条 + + { + router.back(); + }} + /> +
+
+
+ {spaceData?.previews?.images?.map((item, index) => ( +
+ +
+ ))} +
-
- {spaceData?.previews?.images?.map((item, index) => ( -
- -
- ))} -
-
-
+ + } <> @@ -394,7 +408,12 @@ export default function PersonSpace() { />
微信: - setVisible(true)}>点击查看 + setVisible(true)} + > + 点击查看 +
diff --git a/app/search/page.js b/app/search/page.js index c4e19d5..2c680f0 100644 --- a/app/search/page.js +++ b/app/search/page.js @@ -132,6 +132,7 @@ export default function Search() { data={item} key={item.id} showMore={arr.length === 1} + link={`space/person_space_introduce/${item.mid}`} /> )); })()} @@ -139,9 +140,9 @@ export default function Search() { )} {streamers.length > 0 && (
-

个人

+

用户

{streamers.map((item) => ( - + ))}
)} @@ -151,12 +152,12 @@ export default function Search() { ); } -const ZoneItem = ({ data, showMore }) => { +const ZoneItem = ({ data, showMore, link }) => { const router = useRouter(); return ( router.push(`space/person_space_introduce/${data.mid}`)} + onClick={() => router.push(link)} key={data.id} arrow={false} > diff --git a/components/Photos/index.js b/components/Photos/index.js index f2e482a..82c6365 100644 --- a/components/Photos/index.js +++ b/components/Photos/index.js @@ -7,7 +7,7 @@ import { faAngleUp, faClose, faSave } from "@fortawesome/free-solid-svg-icons"; import { saveFile } from "@/utils/tools/handleFuns"; import { useRouter } from "next/navigation"; -export default function Photos({ isUnlocked, mediaAmount, media }) { +export default function Photos({ isUnlocked, mediaAmount, media, type }) { const [seeAllPhotos, setSeeAllPhotos] = useState(false); const [currentPhotos, setCurrentPhotos] = useState([]); const [photos, setPhotos] = useState([]); @@ -46,7 +46,7 @@ export default function Photos({ isUnlocked, mediaAmount, media }) { const showPhotos = (photos, index) => { const mediaDom = document.createElement("div"); document.body.appendChild(mediaDom); - mediaDom.className = `${photos[index]?.type == "hid" ? "photos-body" : ""}`; + mediaDom.className = `${photos[index]?.type == "hid" ? "mediaDom photos-body" : "mediaDom"}`; ImageViewer.Multi.show({ images: photos.map((item) => item?.url), defaultIndex: index, @@ -55,7 +55,7 @@ export default function Photos({ isUnlocked, mediaAmount, media }) { getContainer: mediaDom, onIndexChange: (index) => { mediaDom.className = `${ - photos[index]?.type == "hid" ? "photos-body" : "" + photos[index]?.type == "hid" ? "mediaDom photos-body" : "mediaDom" }`; }, afterClose: () => { @@ -181,7 +181,8 @@ export default function Photos({ isUnlocked, mediaAmount, media }) { height={currentPhotos.length > 1 ? "24vw" : "auto"} className={`rounded max-w-full ${ item?.type == "hid" || - (item?.type == "video" && !isUnlocked) + ( + item?.type == "video" && !isUnlocked && type=="space") ? "imageBlur" : "" }`} diff --git a/components/PostItem/index.js b/components/PostItem/index.js index fbb37c4..f2b0b18 100644 --- a/components/PostItem/index.js +++ b/components/PostItem/index.js @@ -135,6 +135,7 @@ export default function PostItem({ media={data.media_component} isUnlocked={data.is_zone_moment_unlocked} mediaAmount={data.media_amount} + type={type} /> )} {type == "space" && !!data.c_type && ( diff --git a/components/WithAuth/index.js b/components/WithAuth/index.js index e93420a..b97e938 100644 --- a/components/WithAuth/index.js +++ b/components/WithAuth/index.js @@ -1,7 +1,28 @@ import { checkAuth } from "@/utils/auth"; -import { redirect } from "next/navigation"; - +import { useRouter } from "next/navigation"; +import { useEffect } from "react"; +import { get } from "@/utils/storeInfo"; export default function WithAuth(WrappedComponent) { - - return checkAuth() ? WrappedComponent : redirect("/login"); + const router = useRouter(); + useEffect(() => { + checkLogin(); + // console.log("isLogin",isLogin) + }, []); + const checkLogin = async () => { + const hasToken = get("token"); + console.log("hasToken", hasToken); + if (hasToken) { + const hasToken = get("token"); + console.log("hasToken", hasToken); + if (hasToken) { + const currentIsLogin = await checkAuth(); + if (!currentIsLogin) { + router.push("/login") + } + } + }else{ + router.push("/login") + } + }; + return WrappedComponent; } diff --git a/utils/require.js b/utils/require.js index 8cbba94..5c32be8 100644 --- a/utils/require.js +++ b/utils/require.js @@ -44,6 +44,7 @@ export default function customFetch(method, url, options = {}, mid) { resolve(data); }) .catch((error) => { + console.log("error",error) Toast.show({ icon: "fail", content: error.toString(), diff --git a/utils/storeInfo.js b/utils/storeInfo.js index b00df55..e306e91 100644 --- a/utils/storeInfo.js +++ b/utils/storeInfo.js @@ -5,7 +5,7 @@ export function get(key){ let data = localStorage.getItem(key); // console.log(key,data) - return data ? JSON.parse(data) : {}; + return data ? JSON.parse(data) : null; } export function remove(key){ localStorage.removeItem(key)