Files
leaser_front/src/constants/index.ts
T

72 lines
1.7 KiB
TypeScript
Raw Normal View History

// API相关常量
export const API_BASE_URL = import.meta.env.VITE_APP_BASE_URL || '/api';
// 存储相关常量
export const STORAGE_KEYS = {
TOKEN: 'LEASER_TOKEN',
USER_INFO: 'LEASER_USER_INFO',
LOCALE: 'arco-locale',
THEME: 'arco-theme',
} as const;
// 路由相关常量
export const ROUTE_NAMES = {
LOGIN: 'login',
DASHBOARD: 'dashboard',
PROJECT: 'project',
TENANT: 'tenant',
CONTRACT: 'contract',
} as const;
// 业务相关常量
export const PAGE_SIZE_OPTIONS = [10, 20, 50, 100];
export const DEFAULT_PAGE_SIZE = 20;
// 文件相关常量
export const FILE_UPLOAD = {
MAX_SIZE: 10 * 1024 * 1024, // 10MB
ALLOWED_TYPES: [
'image/jpeg',
'image/png',
'image/gif',
'application/pdf',
'application/msword',
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
],
} as const;
// 表单验证相关常量
export const VALIDATION_RULES = {
PHONE: /^1[3-9]\d{9}$/,
EMAIL: /^[^\s@]+@[^\s@]+\.[^\s@]+$/,
ID_CARD:
/^[1-9]\d{5}(18|19|20)\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/,
} as const;
2026-01-12 00:19:24 +08:00
// 房源状态
//状态:1招商 2保留 3下架 4在租
export const HOUSE_STATUS = [
{ id: 1, text: '招商' },
{ id: 2, text: '保留' },
{ id: 3, text: '下架' },
{ id: 4, text: '在租' },
];
// 价格单位选项
export const PRICE_UNITS = [
{ value: 1, text: '元/㎡*月' },
{ value: 2, text: '元/㎡*天' },
{ value: 3, text: '元/天' },
{ value: 4, text: '元/月' },
{ value: 5, text: '元/年' },
] as const;
// 价格单位映射表
export const PRICE_UNIT_MAP = new Map([
[1, '元/㎡*月'],
[2, '元/㎡*天'],
[3, '元/天'],
[4, '元/月'],
[5, '元/年'],
]);