添加审核不展示二维码的功能
This commit is contained in:
@@ -67,6 +67,8 @@ const ListPageContent: React.FC<ListPageContentProps> = ({
|
|||||||
} = store;
|
} = store;
|
||||||
|
|
||||||
const supportedCitiesList = useDictionaryStore((s) => s.getDictionaryValue('supported_cities', ['上海市'])) || [];
|
const supportedCitiesList = useDictionaryStore((s) => s.getDictionaryValue('supported_cities', ['上海市'])) || [];
|
||||||
|
// 首页是否展示二维码,由 getDictionaryManyKey 的 show_home_qrcode 控制,默认 true 保持原样
|
||||||
|
const showHomeQrcode = useDictionaryStore((s) => s.getDictionaryValue('show_home_qrcode', true));
|
||||||
|
|
||||||
const {
|
const {
|
||||||
isShowFilterPopup,
|
isShowFilterPopup,
|
||||||
@@ -227,18 +229,16 @@ const ListPageContent: React.FC<ListPageContentProps> = ({
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// 分批异步执行初始化操作,避免阻塞首屏渲染
|
// 分批异步执行初始化操作,避免阻塞首屏渲染
|
||||||
// 1. 立即执行:获取城市、二维码和行政区列表(轻量操作)
|
|
||||||
getCities();
|
getCities();
|
||||||
getCityQrCode();
|
if (showHomeQrcode) getCityQrCode();
|
||||||
getDistricts(); // 新增:获取行政区列表
|
getDistricts();
|
||||||
|
|
||||||
// 只有当页面激活时才加载位置和列表数据
|
|
||||||
if (isActive) {
|
if (isActive) {
|
||||||
getLocation().catch((error) => {
|
getLocation().catch((error) => {
|
||||||
console.error('获取位置信息失败:', error);
|
console.error('获取位置信息失败:', error);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, [isActive]);
|
}, [isActive, showHomeQrcode]);
|
||||||
|
|
||||||
// 记录上一次的城市,用于检测城市变化
|
// 记录上一次的城市,用于检测城市变化
|
||||||
const prevAreaRef = useRef<[string, string] | null>(null);
|
const prevAreaRef = useRef<[string, string] | null>(null);
|
||||||
@@ -537,7 +537,13 @@ const ListPageContent: React.FC<ListPageContentProps> = ({
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{shouldShowNoGames ? (
|
{shouldShowNoGames ? (
|
||||||
renderCityQrcode()
|
showHomeQrcode ? (
|
||||||
|
renderCityQrcode()
|
||||||
|
) : (
|
||||||
|
<View className={styles.cqContainer}>
|
||||||
|
<Text>当前城市暂无球局,敬请期待</Text>
|
||||||
|
</View>
|
||||||
|
)
|
||||||
) : (
|
) : (
|
||||||
<View ref={scrollContextRef}>
|
<View ref={scrollContextRef}>
|
||||||
<View className={styles.listPage} style={{ paddingTop: totalHeight }}>
|
<View className={styles.listPage} style={{ paddingTop: totalHeight }}>
|
||||||
|
|||||||
@@ -35,17 +35,22 @@ export const useDictionaryStore = create<DictionaryState>()((set, get) => ({
|
|||||||
set({ isLoading: true, error: null })
|
set({ isLoading: true, error: null })
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const keys = 'publishing_requirements,court_type,court_surface,supplementary_information,game_play,fabu_tip,supported_cities,bannerListImage,bannerDetailImage,bannerListIndex';
|
const keys = 'publishing_requirements,court_type,court_surface,supplementary_information,game_play,fabu_tip,supported_cities,show_home_qrcode,bannerListImage,bannerDetailImage,bannerListIndex';
|
||||||
const response = await commonApi.getDictionaryManyKey(keys)
|
const response = await commonApi.getDictionaryManyKey(keys)
|
||||||
|
|
||||||
if (response.code === 0 && response.data) {
|
if (response.code === 0 && response.data) {
|
||||||
const dictionaryData = {};
|
const dictionaryData: DictionaryData = {};
|
||||||
keys.split(',').forEach(key => {
|
keys.split(',').forEach(key => {
|
||||||
const list = response.data[key];
|
const raw = response.data[key];
|
||||||
|
// 单值配置:首页是否展示二维码(1/0 或 true/false)
|
||||||
|
if (key === 'show_home_qrcode') {
|
||||||
|
dictionaryData[key] = raw === '1' || raw === 1 || raw === true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
// supported_cities 格式如 "上海市||北京市",用 || 分割
|
// supported_cities 格式如 "上海市||北京市",用 || 分割
|
||||||
const listData = key === 'supported_cities'
|
const listData = key === 'supported_cities'
|
||||||
? (list ? String(list).split('||').map((s) => s.trim()).filter(Boolean) : [])
|
? (raw ? String(raw).split('||').map((s) => s.trim()).filter(Boolean) : [])
|
||||||
: (list ? list.split('|') : []);
|
: (raw ? String(raw).split('|') : []);
|
||||||
dictionaryData[key] = listData;
|
dictionaryData[key] = listData;
|
||||||
})
|
})
|
||||||
set({
|
set({
|
||||||
|
|||||||
Reference in New Issue
Block a user