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

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

@@ -0,0 +1,91 @@
/**
* 空状态页面
* 当球局不存在或已删除时显示的独立页面
*/
import React, { useState, useEffect } from 'react';
import { View, Text, Image } from '@tarojs/components';
import Taro from '@tarojs/taro';
import { useGlobalState } from '@/store/global';
import { GeneralNavbar } from '@/components';
import emptyStateIcon from '@/static/emptyStatus/game-detail-empty.svg';
import './index.scss';
function Index() {
const { statusNavbarHeightInfo } = useGlobalState() || {};
const { totalHeight = 98 } = statusNavbarHeightInfo || {};
const [countdown, setCountdown] = useState(5);
// 倒计时自动返回
useEffect(() => {
if (countdown <= 0) {
handle_go_to_home();
return;
}
const timer = setTimeout(() => {
setCountdown(countdown - 1);
}, 1000);
return () => clearTimeout(timer);
}, [countdown]);
// 跳转到其他球局 - 返回首页列表
const handle_go_to_other_games = () => {
(Taro as any).redirectTo({
url: '/main_pages/index',
});
};
// 返回首页
const handle_go_to_home = () => {
const pages = Taro.getCurrentPages();
if (pages.length <= 1) {
Taro.redirectTo({
url: '/main_pages/index',
});
} else {
Taro.navigateBack();
}
};
return (
<View className="empty_state_page" style={{ paddingTop: `${totalHeight}px` }}>
<GeneralNavbar title="" showBack={true} />
<View className="empty_state_page__content">
{/* 空状态图片 */}
<Image
className="empty_state_page__icon"
src={emptyStateIcon}
mode="aspectFit"
/>
{/* 提示文字 */}
<View className="empty_state_page__tip">
<Text className="empty_state_page__tip_text">
{countdown}s
</Text>
</View>
{/* 按钮区域 */}
<View className="empty_state_page__buttons">
<View
className="empty_state_page__button empty_state_page__button--primary"
onClick={handle_go_to_other_games}
>
<Text className="empty_state_page__button_text"></Text>
</View>
<View
className="empty_state_page__button empty_state_page__button--secondary"
onClick={handle_go_to_home}
>
<Text className="empty_state_page__button_text"></Text>
</View>
</View>
</View>
</View>
);
}
export default Index;