修改 球局详情,添加 页面不适用组件

This commit is contained in:
张成
2025-12-09 13:59:02 +08:00
parent 760d1bb4fe
commit 8fb2c4eaa7
8 changed files with 233 additions and 31 deletions

View File

@@ -22,7 +22,6 @@ import Participants from "./components/Participants";
import SupplementalNotes from "./components/SupplementalNotes";
import OrganizerInfo from "./components/OrganizerInfo";
import SharePopup from "./components/SharePopup";
import EmptyState from "./components/EmptyState";
import { navto, toast } from "@/utils/helper";
import ArrowLeft from "@/static/detail/icon-arrow-left.svg";
// import Logo from "@/static/detail/icon-logo-go.svg";
@@ -30,7 +29,6 @@ import styles from "./index.module.scss";
function Index() {
const [detail, setDetail] = useState<any>({});
const [showEmptyState, setShowEmptyState] = useState(false);
const { params } = useRouter();
const [currentLocation, setCurrentLocation] = useState<[number, number]>([
0, 0,
@@ -92,18 +90,20 @@ function Index() {
const fetchDetail = async () => {
if (!id) return;
try {
const res = await DetailService.getDetail(Number(id));
if (res.code === 0) {
setDetail(res.data);
fetchUserInfoById(res.data.publisher_id);
setShowEmptyState(false);
}
} catch (e) {
if (e.message === "球局不存在") {
setShowEmptyState(true);
}
const res = await DetailService.getDetail(Number(id)).catch(e => {
// 跳转到空状态页面
(Taro as any).redirectTo({
url: '/other_pages/emptyState/index',
});
return e;
});
if (res.code === 0) {
setDetail(res.data);
fetchUserInfoById(res.data.publisher_id);
}
// Taro.hideLoading();
};
@@ -175,20 +175,6 @@ function Index() {
setGlass(top > 20);
}, 16);
// 如果显示空状态,渲染空状态页面
if (showEmptyState) {
return (
<EmptyState
onGoToOtherGames={() => {
Taro.switchTab({
url: "/main_pages/index",
});
}}
onGoToHome={handleBack}
/>
);
}
const [scrollToTarget, setScrollToTarget] = useState("");
return (