初始化:职引项目 v1.0

This commit is contained in:
yuzhiran
2026-06-08 16:28:00 +08:00
commit 511f60d0db
111 changed files with 27295 additions and 0 deletions
+90
View File
@@ -0,0 +1,90 @@
const getApiBaseUrl = (): string => {
if (import.meta.env.VITE_API_BASE_URL) {
return import.meta.env.VITE_API_BASE_URL
}
return 'http://localhost:3006/api'
}
export const APP_NAME = import.meta.env.VITE_APP_NAME || 'AI磁场'
export const APP_CONFIG = {
APP_NAME,
API_BASE_URL: getApiBaseUrl(),
PAGES: {
INDEX: '/pages/index/index',
INTERVIEW: '/pages/interview/interview',
REPORT: '/pages/report/report',
RESUME: '/pages/resume/resume',
HISTORY: '/pages/history/history',
MEMBER: '/pages/member/member',
PROGRESS: '/pages/progress/progress',
CONTRIBUTE: '/pages/contribute/contribute',
INTERNSHIP: '/pages/internship/internship',
USER: '/pages/user/user',
LOGIN: '/pages/login/login',
ABOUT: '/pages/about/about',
},
STORAGE_KEYS: {
TOKEN: 'token',
USER_ID: 'userId',
RESUME: 'resume',
},
} as const
export const API_ENDPOINTS = {
USER: {
SEND_CODE: '/user/send-code',
LOGIN: '/user/login',
WX_LOGIN: '/user/wx-login',
INFO: '/user/info',
UPDATE: '/user/update',
USAGE: '/user/usage',
},
INTERVIEW: {
CREATE: '/interview/create',
ANSWER: (id: string) => `/interview/${id}/answer`,
COMPLETE: (id: string) => `/interview/${id}/complete`,
GET: (id: string) => `/interview/${id}`,
LIST: '/interview/list/all',
STATS: '/interview/stats/mine',
},
ANALYZE: {
DIAGNOSIS: '/analyze/diagnosis',
OPTIMIZE: '/analyze/optimize',
},
RESUME: {
CREATE: '/resume/create',
LIST: '/resume/list',
GET: (id: string) => `/resume/${id}`,
DELETE: (id: string) => `/resume/${id}`,
},
PROGRESS: {
GET: '/progress',
STATS: '/progress/stats',
},
CONTRIBUTION: {
CREATE: '/contribution',
MY: '/contribution/my',
BANK: (company: string, position: string) => `/contribution/company/${company}/position/${position}`,
COMPANY: (company: string) => `/contribution/company/${company}`,
},
MEMBER: {
PLANS: '/member/plans',
STATUS: '/member/status',
CREATE_ORDER: '/member/create-order',
PAY: '/member/pay',
},
DAILY_QUESTION: {
TODAY: '/daily-question',
BY_POSITION: (position: string) => `/daily-question/position/${position}`,
},
} as const
const API_HOST = typeof window !== 'undefined' && window.location.hostname !== 'localhost' && window.location.hostname !== '127.0.0.1'
? (import.meta.env.VITE_PROD_API_HOST || window.location.origin)
: 'http://localhost:3006'
export function api(path: string): string {
return `${API_HOST}/api${path}`
}
export default APP_CONFIG