98 lines
2.6 KiB
JavaScript
98 lines
2.6 KiB
JavaScript
// src/config/pageConfigs.js
|
|
/**
|
|
* 各页面的初始化配置
|
|
* 统一管理不同页面对 usePageInitialization 的配置需求
|
|
*/
|
|
export const PageConfig = {
|
|
HOST_CENTER: {
|
|
needsBankBalance: true,
|
|
needsWorkStatistics: true,
|
|
needsRouteGuard: true,
|
|
title: 'Host Center',
|
|
userTag: '👑 Host',
|
|
},
|
|
|
|
COIN_SELLER: {
|
|
needsBankBalance: true,
|
|
needsWorkStatistics: false, // Coin Seller 不需要工作统计
|
|
needsRouteGuard: true,
|
|
title: 'Coin Seller',
|
|
userTag: '💰 Coin Seller',
|
|
},
|
|
|
|
AGENCY_CENTER: {
|
|
needsBankBalance: true,
|
|
needsWorkStatistics: true,
|
|
needsRouteGuard: true,
|
|
title: 'Agency Center',
|
|
userTag: '🏢 Agency',
|
|
},
|
|
|
|
BD_LEADER_CENTER: {
|
|
needsBankBalance: true,
|
|
needsWorkStatistics: false, // BD 可能不需要日常工作统计
|
|
needsRouteGuard: true,
|
|
title: 'BD Leader Center',
|
|
userTag: '📈 BD Leader',
|
|
},
|
|
|
|
BD_CENTER: {
|
|
needsBankBalance: true,
|
|
needsWorkStatistics: false, // BD 可能不需要日常工作统计
|
|
needsRouteGuard: true,
|
|
title: 'BD Center',
|
|
userTag: '📈 BD',
|
|
},
|
|
|
|
APPLY: {
|
|
needsBankBalance: false, // 申请页面不需要余额
|
|
needsWorkStatistics: false, // 申请页面不需要工作统计
|
|
needsRouteGuard: false, // 申请页面不需要身份检查
|
|
title: 'Apply',
|
|
userTag: null, // 申请页面可能没有身份标签
|
|
},
|
|
|
|
ADMIN_CENTER: {
|
|
needsBankBalance: false,
|
|
needsWorkStatistics: false, // ADMIN 可能不需要日常工作统计
|
|
needsRouteGuard: true,
|
|
title: 'ADMIN Center',
|
|
userTag: 'ADMIN',
|
|
},
|
|
}
|
|
|
|
/**
|
|
* 获取页面配置的工具函数
|
|
* @param {string} pageType 页面类型
|
|
* @returns {Object} 页面配置对象
|
|
*/
|
|
export function getPageConfig(pageType) {
|
|
const config = PageConfig[pageType]
|
|
if (!config) {
|
|
console.warn(`未找到页面配置: ${pageType}`)
|
|
return PageConfig.HOST_CENTER // 默认使用 HOST_CENTER 配置
|
|
}
|
|
return config
|
|
}
|
|
|
|
// ==========================================
|
|
import { usePageInitialization } from './usePageInitialization.js'
|
|
|
|
/**
|
|
* 使用预配置的页面初始化函数
|
|
* @param {string} pageType 页面类型 (HOST_CENTER, COIN_SELLER, etc.)
|
|
* @param {Object} customOptions 自定义选项,会覆盖默认配置
|
|
* @returns {Object} usePageInitialization 的返回值
|
|
*/
|
|
export function usePageInitializationWithConfig(pageType, customOptions = {}) {
|
|
const pageConfig = getPageConfig(pageType)
|
|
|
|
// 合并默认配置和自定义选项
|
|
const options = {
|
|
...pageConfig,
|
|
...customOptions,
|
|
}
|
|
|
|
return usePageInitialization(options)
|
|
}
|