/** * 项目配置文件 */ // 环境配置 export const ENV = { // 开发环境 development: { baseUrl: 'http://192.168.1.43:3000/api', imageBaseUrl: 'http://192.168.1.43:3000' }, // 生产环境 production: { baseUrl: 'https://api.youyijia.com/api', imageBaseUrl: 'https://api.youyijia.com' } } // 当前环境 - 切换为 'production' 上线 export const currentEnv = 'development' // 获取当前环境配置 export const getEnvConfig = () : UTSJSONObject => { if (currentEnv == 'production') { return { baseUrl: ENV.production.baseUrl, imageBaseUrl: ENV.production.imageBaseUrl } as UTSJSONObject } return { baseUrl: ENV.development.baseUrl, imageBaseUrl: ENV.development.imageBaseUrl } as UTSJSONObject } // 是否使用Mock数据 - 已关闭,对接真实后端 export const useMock = false // 分页配置 export const PAGE_SIZE = 10 // 图片上传配置 export const UPLOAD_CONFIG = { maxSize: 5 * 1024 * 1024, // 5MB maxCount: 9, accept: ['image/jpeg', 'image/png', 'image/gif'] } // 缓存Key export const STORAGE_KEYS = { TOKEN: 'user_token', USER_INFO: 'user_info', FAVORITES: 'user_favorites', SEARCH_HISTORY: 'search_history' } // 沙发分类 export const SOFA_CATEGORIES = [ { id: 'all', name: '全部' }, { id: 'leather', name: '皮沙发' }, { id: 'fabric', name: '布艺沙发' }, { id: 'functional', name: '功能沙发' }, { id: 'antique', name: '古典沙发' }, { id: 'office', name: '办公沙发' } ] // 翻新服务类型 export const SERVICE_TYPES = [ { id: 'repair', name: '局部修复', icon: '/static/icons/repair.png' }, { id: 'refurbish', name: '整体翻新', icon: '/static/icons/refurbish.png' } ] /** * 获取服务类型名称 */ export const getServiceTypeName = (type : string) : string => { const map : Map = new Map([ ['leather', '真皮翻新'], ['fabric', '布艺翻新'], ['functional', '功能维修'], ['antique', '古董修复'], ['office', '办公沙发'], ['cleaning', '清洁保养'], ['repair', '维修改装'], ['custom', '定制沙发'] ]) return map.get(type) ?? type }