From 12600ebdfb11f5f28f8213f34c25c6f277f29401 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E7=91=9E?= Date: Sun, 12 Oct 2025 23:49:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/FilterPopup/index.tsx | 6 +++++- src/components/ListLoadError/index.module.scss | 2 +- src/components/ListLoadError/index.tsx | 6 +++--- src/components/Picker/CalendarUI/CalendarUI.tsx | 3 +++ src/components/Picker/PopupPicker.tsx | 3 +++ src/components/ShareCardCanvas/index.tsx | 8 ++++---- src/container/listContainer/index.tsx | 17 +++++------------ src/container/listCustomNavbar/index.tsx | 14 ++++++++++---- src/game_pages/list/index.config.ts | 1 + src/game_pages/list/index.tsx | 5 ++--- src/store/listStore.ts | 9 ++++++--- src/utils/share.ts | 4 ++-- 12 files changed, 45 insertions(+), 33 deletions(-) diff --git a/src/components/FilterPopup/index.tsx b/src/components/FilterPopup/index.tsx index c795caf..c15a29d 100644 --- a/src/components/FilterPopup/index.tsx +++ b/src/components/FilterPopup/index.tsx @@ -39,7 +39,6 @@ const FilterPopup = (props: FilterPopupProps) => { // const [selectedDates, setSelectedDates] = useState([]) const handleDateChange = (dates: Date[]) => { - console.log(dates,'datesdatesdatesdatesdates'); let times: String[] = []; if (Array.isArray(dates)) { const currentDay = dayjs(dates[0]).format('YYYY-MM-DD'); @@ -129,6 +128,11 @@ const FilterPopup = (props: FilterPopupProps) => { showRangeStart={false} value={filterOptions?.dateRange} onChange={handleDateChange} + style={{ + bottom: '25%', + width: 'calc(100vw - 32px)', + left: '16px', + }} /> {/* 时间气泡选项 */} diff --git a/src/components/ListLoadError/index.module.scss b/src/components/ListLoadError/index.module.scss index 1629275..342b51b 100644 --- a/src/components/ListLoadError/index.module.scss +++ b/src/components/ListLoadError/index.module.scss @@ -3,7 +3,7 @@ flex-direction: column; align-items: center; justify-content: center; - min-height: 400px; + height: calc(100vh - 94px - 72px - 110px); .listLoadErrorImg { width: 154px; diff --git a/src/components/ListLoadError/index.tsx b/src/components/ListLoadError/index.tsx index 9fa0415..a4af789 100644 --- a/src/components/ListLoadError/index.tsx +++ b/src/components/ListLoadError/index.tsx @@ -1,4 +1,4 @@ -import { Image, View, Text, Button } from "@tarojs/components"; +import { Image, View, Text } from "@tarojs/components"; import styles from "./index.module.scss"; import img from "@/config/images"; @@ -24,10 +24,10 @@ const ListLoadError = (props: IProps) => { /> {text && {text}} {reload && ( - + )} ); diff --git a/src/components/Picker/CalendarUI/CalendarUI.tsx b/src/components/Picker/CalendarUI/CalendarUI.tsx index 9cdcd69..10611ff 100644 --- a/src/components/Picker/CalendarUI/CalendarUI.tsx +++ b/src/components/Picker/CalendarUI/CalendarUI.tsx @@ -19,6 +19,7 @@ interface NutUICalendarProps { showQuickActions?: boolean; onHeaderClick?: (date: Date) => void; showRangeStart?: boolean; + style?: React.CSSProperties; } export interface CalendarUIRef { @@ -36,6 +37,7 @@ const NutUICalendar = React.forwardRef( showRangeStart = true, showQuickActions = true, onHeaderClick, + style, }, ref ) => { @@ -281,6 +283,7 @@ const NutUICalendar = React.forwardRef( value={[current.getFullYear(), current.getMonth() + 1]} type="month" onChange={(value) => handleMonthChange(value)} + style={style} /> )} diff --git a/src/components/Picker/PopupPicker.tsx b/src/components/Picker/PopupPicker.tsx index a63d5ce..225099f 100644 --- a/src/components/Picker/PopupPicker.tsx +++ b/src/components/Picker/PopupPicker.tsx @@ -25,6 +25,7 @@ interface PickerProps { img?: string; onConfirm?: (options: PickerOption[], values: (string | number)[]) => void; onChange?: (value: (string | number)[]) => void; + style?: React.CSSProperties } const PopupPicker = ({ @@ -36,6 +37,7 @@ const PopupPicker = ({ onChange, options = [], type = null, + style, }: PickerProps) => { const [defaultValue, setDefaultValue] = useState<(string | number)[]>([]); const [defaultOptions, setDefaultOptions] = useState([]); @@ -106,6 +108,7 @@ const PopupPicker = ({ position="bottom" round zIndex={1000} + style={style} > {type === "ntrp" && ( diff --git a/src/components/ShareCardCanvas/index.tsx b/src/components/ShareCardCanvas/index.tsx index b27b084..5e1cdeb 100644 --- a/src/components/ShareCardCanvas/index.tsx +++ b/src/components/ShareCardCanvas/index.tsx @@ -487,8 +487,8 @@ const ShareCardCanvas: React.FC = ({ // 绘制用户昵称 已完成 const nicknameX = avatarX + avatarSize + 8 * dpr // 距离头像8px - const nicknameY = avatarY + (avatarSize - 24 * dpr) / 2 // 与头像水平居中对齐 - const nicknameFontSize = scale * 24 * dpr + const nicknameY = avatarY + (avatarSize - 18 * dpr) / 2 // 与头像水平居中对齐 + const nicknameFontSize = scale * 18 * dpr drawText(ctx, data.userNickname, nicknameX, nicknameY, 200 * dpr, nicknameFontSize, '#000000', true, '"Noto Sans SC"') // 绘制"邀你加入球局"文案 @@ -669,8 +669,8 @@ const ShareCardCanvas: React.FC = ({ width: `${canvasWidth}px`, height: `${canvasHeight}px`, position: 'absolute', // 绝对定位避免影响布局 - top: '-9999px', // 移出可视区域 - left: '-9999px' + // top: '-9999px', // 移出可视区域 + // left: '-9999px' }} width={`${canvasWidth * dpr}`} height={`${canvasHeight * dpr}`} diff --git a/src/container/listContainer/index.tsx b/src/container/listContainer/index.tsx index 8bb582c..2970af0 100644 --- a/src/container/listContainer/index.tsx +++ b/src/container/listContainer/index.tsx @@ -29,9 +29,12 @@ const ListContainer = (props) => { useReachBottom(() => { // 加载更多方法 - timerRef.current = setTimeout(() => { + if (loading) { + return; + } + // timerRef.current = setTimeout(() => { loadMoreMatches(); - }, 500); + // }, 500); }); useEffect(() => { @@ -102,15 +105,6 @@ const ListContainer = (props) => { return ( - {/* */} {renderList(data)} {/* 显示骨架屏 */} {loading && renderSkeleton()} @@ -120,7 +114,6 @@ const ListContainer = (props) => { {renderList(recommendList)} */} {/* 到底了 */} {data?.length > 0 && 到底了} - {/* */} ); }; diff --git a/src/container/listCustomNavbar/index.tsx b/src/container/listCustomNavbar/index.tsx index d99fc73..9786f42 100644 --- a/src/container/listCustomNavbar/index.tsx +++ b/src/container/listCustomNavbar/index.tsx @@ -7,6 +7,7 @@ import CustomNavbar from "@/components/CustomNavbar"; import { Input } from "@nutui/nutui-react-taro"; import Taro from "@tarojs/taro"; import "./index.scss"; +import { getCurrentFullPath } from "@/utils"; interface IProps { config?: { @@ -40,10 +41,8 @@ const ListHeader = (props: IProps) => { const currentAddress = city + district const handleInputClick = () => { - const pages = Taro.getCurrentPages(); - const currentPage = pages[pages.length - 1]; - const currentPagePath = currentPage.route; - if (currentPagePath === "game_pages/searchResult/index") { + const currentPagePath = getCurrentFullPath() + if (currentPagePath === "/game_pages/searchResult/index") { Taro.navigateBack(); } else { Taro.navigateTo({ @@ -54,6 +53,13 @@ const ListHeader = (props: IProps) => { // 点击logo const handleLogoClick = () => { + // 如果当前在列表页,点击后页面回到顶部 + if (getCurrentFullPath() === "/game_pages/list/index") { + Taro.pageScrollTo({ + scrollTop: 0, + duration: 300, + }); + } Taro.redirectTo({ url: "game_pages/list/index", // 列表页 }); diff --git a/src/game_pages/list/index.config.ts b/src/game_pages/list/index.config.ts index d49b1ea..2292231 100644 --- a/src/game_pages/list/index.config.ts +++ b/src/game_pages/list/index.config.ts @@ -3,4 +3,5 @@ export default definePageConfig({ enablePullDownRefresh: true, backgroundTextStyle: 'dark', navigationStyle: 'custom', + onReachBottomDistance: 300, }) diff --git a/src/game_pages/list/index.tsx b/src/game_pages/list/index.tsx index bde9505..f18492c 100644 --- a/src/game_pages/list/index.tsx +++ b/src/game_pages/list/index.tsx @@ -4,8 +4,8 @@ import styles from "./index.module.scss"; import { useEffect, useRef, useCallback, useState } from "react"; import Taro, { usePageScroll, - useShareAppMessage, - useShareTimeline, + // useShareAppMessage, + // useShareTimeline, } from "@tarojs/taro"; import { useListStore } from "@/store/listStore"; import { useGlobalState } from "@/store/global"; @@ -395,7 +395,6 @@ const ListPage = () => { venueImages: ["https://bimwe.oss-cn-shanghai.aliyuncs.com/front/ball/images/63f62c80-ac44-4f3b-bb6c-d7f6e8ebf76d.jpg", "https://bimwe.oss-cn-shanghai.aliyuncs.com/front/ball/images/63f62c80-ac44-4f3b-bb6c-d7f6e8ebf76d.jpg" ], - playerImage: "https://bimwe.oss-cn-shanghai.aliyuncs.com/front/ball/images/63f62c80-ac44-4f3b-bb6c-d7f6e8ebf76d.jpg" } } onGenerated={handleShare} diff --git a/src/store/listStore.ts b/src/store/listStore.ts index 9bc609e..6cd3dd1 100644 --- a/src/store/listStore.ts +++ b/src/store/listStore.ts @@ -94,7 +94,7 @@ const commonStateDefaultValue = { // 是否是搜索结果页 isSearchResult: false, // 是否加载中 - loading: true, + loading: false, // 错误信息 error: null, // 位置 @@ -225,6 +225,9 @@ export const useListStore = create()((set, get) => ({ // 获取列表数据(常规搜索) fetchMatches: async (params, isFirstLoad = false, isAppend = false) => { + if (get().loading) { + return; + } set({ loading: true, error: null }); const { getSearchParams, setListData } = get(); @@ -463,14 +466,14 @@ export const useListStore = create()((set, get) => ({ searchPageState: { ...searchPageStateDefaultValue }, - loading: true, + // loading: true, }); } else { set({ listPageState: { ...listPageStateDefaultValue }, - loading: true, + // loading: true, }); } if (!isSearchData) { diff --git a/src/utils/share.ts b/src/utils/share.ts index 746edac..1cf3000 100644 --- a/src/utils/share.ts +++ b/src/utils/share.ts @@ -529,8 +529,8 @@ const drawShareCard = async (ctx: any, data: ShareCardData, offscreen: any): Pro // 绘制用户昵称 已完成 const nicknameX = avatarX + avatarSize + 8 * dpr // 距离头像8px - const nicknameY = avatarY + (avatarSize - 24 * dpr) / 2 // 与头像水平居中对齐 - const nicknameFontSize = scale * 24 * dpr + const nicknameY = avatarY + (avatarSize - 18 * dpr) / 2 // 与头像水平居中对齐 + const nicknameFontSize = scale * 18 * dpr drawText(ctx, data.userNickname, nicknameX, nicknameY, 200 * dpr, nicknameFontSize, '#000000', true, '"Noto Sans SC"') // 绘制"邀你加入球局"文案