From 1012f75eac553d48f8f36d3809454690a8576cc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E6=9D=B0?= Date: Thu, 4 Sep 2025 18:58:59 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=AF=A6=E6=83=85=E9=A1=B5=E8=BD=AE?= =?UTF-8?q?=E6=92=AD=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../UploadCover/upload-source-popup.tsx | 1 - src/pages/detail/index.scss | 32 +++++++++++ src/pages/detail/index.tsx | 53 +++++++++++++------ 3 files changed, 69 insertions(+), 17 deletions(-) diff --git a/src/components/UploadCover/upload-source-popup.tsx b/src/components/UploadCover/upload-source-popup.tsx index 7ceff4b..5b02ad0 100644 --- a/src/components/UploadCover/upload-source-popup.tsx +++ b/src/components/UploadCover/upload-source-popup.tsx @@ -63,7 +63,6 @@ export default forwardRef(function UploadImage(props: UploadImageProps, ref) { function fetchImages(st: SourceType) { publishService.getPictures({ type: st }).then(res => { - console.log(res, 1122) if (res.code === 0) { let start = 0 setImages(res.data.rows.map(item => ({ diff --git a/src/pages/detail/index.scss b/src/pages/detail/index.scss index 495151a..92a3ec6 100644 --- a/src/pages/detail/index.scss +++ b/src/pages/detail/index.scss @@ -81,6 +81,38 @@ background-color: rgba(0, 0, 0, 0.3); } + .detail-swiper-container { + height: 240px; + margin-top: 15px; + margin-left: 15px; + margin-right: 15px; + overflow-x: scroll; + + .detail-swiper-scroll-container { + display: flex; + height: 240px; + width: auto; + align-items: center; + justify-content: flex-start; + flex-wrap: nowrap; + gap: 12px; + + .detail-swiper-item { + flex: 0 0 auto; + max-width: calc(100vw - 30px); + max-height: 240px; + &-image { + max-width: 100%; + max-height: 100%; + width: 300px; + height: 300px; + border-radius: 12px; + transition: transform 0.5s; + } + } + } + } + .detail-swiper { height: 240px; margin-top: 15px; diff --git a/src/pages/detail/index.tsx b/src/pages/detail/index.tsx index b8f1ae1..b9784fe 100644 --- a/src/pages/detail/index.tsx +++ b/src/pages/detail/index.tsx @@ -96,7 +96,7 @@ function Index() { // const { incrementRequestCount, resetUserStats } = useUserActions() const [current, setCurrent] = useState(0) - const [colors, setColors] = useState([]) + // const [textColor, setTextColor] = useState([]) const [detail, setDetail] = useState(null) const { params } = useRouter() const { id, autoShare, from } = params @@ -113,10 +113,10 @@ function Index() { // calcBgMainColors() // }, []) - useDidShow(() => { - fetchDetail() - calcBgMainColors() - updateLocation() + useDidShow(async () => { + await updateLocation() + await fetchDetail() + // calcBgMainColors() }) const updateLocation = async () => { @@ -137,14 +137,18 @@ function Index() { } } - const calcBgMainColors = async () => { - const textcolors: string[] = [] - for (const index in images) { - const { textColor } = await getTextColorOnImage(images[index]) - textcolors[index] = textColor - } - setColors(textcolors) - } + // const calcBgMainColors = async () => { + // const textcolors: string[] = [] + // // for (const index in images) { + // // const { textColor } = await getTextColorOnImage(images[index]) + // // textcolors[index] = textColor + // // } + // if (detail?.image_list?.length > 0) { + // const { textColor } = await getTextColorOnImage(detail.image_list[0]) + // textcolors[0] = textColor + // } + // setColors(textcolors) + // } function handleShare() { sharePopupRef.current.show() @@ -254,10 +258,27 @@ function Index() { - + {/* swiper */} - + + { + detail?.image_list?.length > 0 && detail?.image_list.map((item, index) => { + return ( + + + + ) + }) + } + + + {/* ))} - + */} {/* content */} {/* avatar and tags */}