From 08092a89abb433925b79a9d34d511535ceef862a Mon Sep 17 00:00:00 2001 From: Ultrame <1019265060@qq.com> Date: Wed, 11 Feb 2026 09:09:53 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=8F=91=E5=B8=83=E7=90=83?= =?UTF-8?q?=E5=B1=80=E6=8B=A6=E6=88=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/NTRPEvaluatePopup/index.tsx | 8 +-- src/container/listContainer/index.tsx | 55 +++++++++++++++---- .../components/MyselfPageContent.tsx | 32 ++++++++--- 3 files changed, 69 insertions(+), 26 deletions(-) diff --git a/src/components/NTRPEvaluatePopup/index.tsx b/src/components/NTRPEvaluatePopup/index.tsx index f827afd..5a0373d 100644 --- a/src/components/NTRPEvaluatePopup/index.tsx +++ b/src/components/NTRPEvaluatePopup/index.tsx @@ -67,12 +67,6 @@ const NTRPEvaluatePopup = (props: NTRPEvaluatePopupProps, ref) => { const { updateUserInfo } = useUserActions(); const userInfo = useUserInfo(); const ntrpLevels = useNtrpLevels(); - const options = [ - ntrpLevels.map((item) => ({ - text: item, - value: item, - })), - ]; const [evaCallback, setEvaCallback] = useState({ type: "", next: () => {}, @@ -171,7 +165,7 @@ const NTRPEvaluatePopup = (props: NTRPEvaluatePopupProps, ref) => { {visible && ( { console.log(val[0]); diff --git a/src/container/listContainer/index.tsx b/src/container/listContainer/index.tsx index e8f58e0..0c90998 100644 --- a/src/container/listContainer/index.tsx +++ b/src/container/listContainer/index.tsx @@ -4,7 +4,11 @@ import ListLoadError from "@/components/ListLoadError"; import ListCardSkeleton from "@/components/ListCardSkeleton"; import { useReachBottom } from "@tarojs/taro"; import Taro from "@tarojs/taro"; -import { useUserInfo, useUserActions, useLastTestResult } from "@/store/userStore"; +import { + useUserInfo, + useUserActions, + useLastTestResult, +} from "@/store/userStore"; import { NTRPTestEntryCard } from "@/components"; import { EvaluateScene } from "@/store/evaluateStore"; import { waitForAuthInit } from "@/utils/authInit"; @@ -46,7 +50,11 @@ const ListContainer = (props) => { const { fetchUserInfo, fetchLastTestResult } = useUserActions(); // 使用全局状态中的测试结果,避免重复调用接口 const lastTestResult = useLastTestResult(); - const { bannerListImage, bannerDetailImage, bannerListIndex = 0 } = useDictionaryStore((s) => s.bannerDict) || {}; + const { + bannerListImage, + bannerDetailImage, + bannerListIndex = 0, + } = useDictionaryStore((s) => s.bannerDict) || {}; useReachBottom(() => { // 加载更多方法 if (loading) { @@ -102,7 +110,7 @@ const ListContainer = (props) => { // 先等待静默登录完成 await waitForAuthInit(); // 然后再获取用户信息 - const userInfoId = userInfo && 'id' in userInfo ? userInfo.id : null; + const userInfoId = userInfo && "id" in userInfo ? userInfo.id : null; if (!userInfoId) { await fetchUserInfo(); return; // 等待下一次 useEffect 触发(此时 userInfo.id 已有值) @@ -113,7 +121,13 @@ const ListContainer = (props) => { } }; init(); - }, [evaluateFlag, enableHomeCards, userInfo, lastTestResult, fetchLastTestResult]); + }, [ + evaluateFlag, + enableHomeCards, + userInfo, + lastTestResult, + fetchLastTestResult, + ]); // 从全局状态中获取测试状态 const hasTestInLastMonth = lastTestResult?.has_test_in_last_month || false; @@ -142,7 +156,11 @@ const ListContainer = (props) => { const idx = Number(bannerListIndex); return [ ...list.slice(0, idx), - { type: "banner", banner_image_url: bannerListImage, banner_detail_url: bannerDetailImage }, + { + type: "banner", + banner_image_url: bannerListImage, + banner_detail_url: bannerDetailImage, + }, ...list.slice(idx), ]; } @@ -151,7 +169,9 @@ const ListContainer = (props) => { function insertEvaluateCard(list) { if (!list || !Array.isArray(list)) return insertBannerCard(list ?? []); - const limitedList = shouldLimitByShowNumber ? list.slice(0, showNumber) : list; + const limitedList = shouldLimitByShowNumber + ? list.slice(0, showNumber) + : list; if (!evaluateFlag || hasTestInLastMonth) { return insertBannerCard(limitedList); @@ -168,7 +188,16 @@ const ListContainer = (props) => { const memoizedList = useMemo( () => (enableHomeCards ? insertEvaluateCard(data) : data), - [enableHomeCards, evaluateFlag, data, hasTestInLastMonth, showNumber, bannerListImage, bannerDetailImage, bannerListIndex] + [ + enableHomeCards, + evaluateFlag, + data, + hasTestInLastMonth, + showNumber, + bannerListImage, + bannerDetailImage, + bannerListIndex, + ] ); // 渲染 banner 卡片 @@ -183,7 +212,9 @@ const ListContainer = (props) => { const target = item.banner_detail_url; if (target) { (Taro as any).navigateTo({ - url: `/other_pages/bannerDetail/index?img=${encodeURIComponent(target)}`, + url: `/other_pages/bannerDetail/index?img=${encodeURIComponent( + target + )}`, }); } }} @@ -196,8 +227,7 @@ const ListContainer = (props) => { backgroundPosition: "center", backgroundRepeat: "no-repeat", }} - > - + > ); }; @@ -229,7 +259,10 @@ const ListContainer = (props) => { } if (enableHomeCards && match?.type === "evaluateCard") { return ( - + ); } return ; diff --git a/src/main_pages/components/MyselfPageContent.tsx b/src/main_pages/components/MyselfPageContent.tsx index 7c9145f..019344c 100644 --- a/src/main_pages/components/MyselfPageContent.tsx +++ b/src/main_pages/components/MyselfPageContent.tsx @@ -11,6 +11,8 @@ import { EvaluateScene } from "@/store/evaluateStore"; import { useUserInfo, useUserActions } from "@/store/userStore"; import { usePickerOption } from "@/store/pickerOptionsStore"; import { useGlobalState } from "@/store/global"; +import { useListState } from "@/store/listStore"; +import { useDictionaryStore } from "@/store/dictionaryStore"; interface MyselfPageContentProps { isActive?: boolean; @@ -41,6 +43,10 @@ const MyselfPageContent: React.FC = ({ const [collapseProfile, setCollapseProfile] = useState(false); const [refreshing, setRefreshing] = useState(false); + const { area } = useListState(); + const supportedCitiesList = + useDictionaryStore((s) => s.getDictionaryValue("supported_cities")) || []; + useEffect(() => { pickerOption.getCities(); pickerOption.getProfessions(); @@ -82,7 +88,6 @@ const MyselfPageContent: React.FC = ({ console.log("notEndGames", notEndGames); return { notEndGames, finishedGames }; - }, [] ); @@ -100,7 +105,6 @@ const MyselfPageContent: React.FC = ({ games_data = await UserService.get_participated_games(user_info.id); } - const sorted_games = games_data.sort((a, b) => { return ( new Date(a.original_start_time.replace(/\s/, "T")).getTime() - @@ -156,6 +160,16 @@ const MyselfPageContent: React.FC = ({ }; const goPublish = () => { + const [_, address] = area; + if (!supportedCitiesList.includes(address)) { + (Taro as any).showModal({ + title: "提示", + content: "该城市尚未开放,您可加入社群或切换城市", + showCancel: false, + confirmText: "知道了", + }); + return; + } (Taro as any).navigateTo({ url: "/publish_pages/publishBall/index", }); @@ -258,15 +272,17 @@ const MyselfPageContent: React.FC = ({ setActiveTab("hosted")} > 我主办的 setActiveTab("participated")} > 我参与的 @@ -287,7 +303,7 @@ const MyselfPageContent: React.FC = ({ btnImg="ICON_ADD" reload={goPublish} isShowNoData={game_records.length === 0} - loadMoreMatches={() => { }} + loadMoreMatches={() => {}} collapse={true} style={{ paddingBottom: ended_game_records.length ? 0 : "90px", @@ -313,7 +329,7 @@ const MyselfPageContent: React.FC = ({ error={null} errorImg="ICON_LIST_EMPTY_CARD" isShowNoData={ended_game_records.length === 0} - loadMoreMatches={() => { }} + loadMoreMatches={() => {}} collapse={true} style={{ paddingBottom: "90px", overflow: "hidden" }} listLoadErrorWrapperHeight="fit-content"