Files
ShaFaFanXin/前端/utils/config.uts
2026-01-27 18:06:04 +08:00

74 lines
1.8 KiB
Plaintext

/**
* 项目配置文件
*/
// 环境配置
export const ENV = {
// 开发环境
development: {
baseUrl: 'http://localhost:3000/api',
imageBaseUrl: 'http://localhost: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: 'recolor', name: '改色翻新', icon: '/static/icons/recolor.png' },
{ id: 'refurbish', name: '整体翻新', icon: '/static/icons/refurbish.png' },
{ id: 'custom', name: '定制换皮', icon: '/static/icons/custom.png' }
]