修复
This commit is contained in:
@@ -30,7 +30,7 @@ export const checkEnvironmentVariables = () => {
|
||||
|
||||
// 检查可选的环境变量
|
||||
const devServerHost = import.meta.env.VITE_DEV_SERVER_HOST || 'localhost'
|
||||
const devServerPort = import.meta.env.VITE_DEV_SERVER_PORT || '3000'
|
||||
const devServerPort = import.meta.env.VITE_DEV_SERVER_PORT || '3001'
|
||||
|
||||
const optionalVars = [
|
||||
{ key: 'VITE_DEV_SERVER_HOST', value: devServerHost },
|
||||
@@ -72,7 +72,7 @@ export const validateEnvironment = () => {
|
||||
|
||||
// 获取API基础地址
|
||||
export const getApiBaseUrl = (): string => {
|
||||
return import.meta.env.VITE_API_BASE_URL || 'http://localhost:3000/api'
|
||||
return import.meta.env.VITE_API_BASE_URL || 'http://localhost:3001/api'
|
||||
}
|
||||
|
||||
// 获取应用配置
|
||||
@@ -82,6 +82,6 @@ export const getAppConfig = () => {
|
||||
version: import.meta.env.VITE_APP_VERSION || '1.0.0',
|
||||
apiBaseUrl: getApiBaseUrl(),
|
||||
devServerHost: import.meta.env.VITE_DEV_SERVER_HOST || 'localhost',
|
||||
devServerPort: import.meta.env.VITE_DEV_SERVER_PORT || '3000',
|
||||
devServerPort: import.meta.env.VITE_DEV_SERVER_PORT || '3001',
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,16 +122,16 @@ export const showRoutesInfo = () => {
|
||||
console.log(' 💡 提示: 可以在浏览器中直接访问这些路径')
|
||||
|
||||
console.log('\n🌐 可用链接:')
|
||||
console.log(' http://localhost:3000/ - 首页 (需要登录)')
|
||||
console.log(' http://localhost:3000/login - 登录页面')
|
||||
console.log(' http://localhost:3000/dashboard - 仪表板 (需要登录)')
|
||||
console.log(' http://localhost:3000/user - 用户管理 (需要登录)')
|
||||
console.log(' http://localhost:3000/profile - 个人资料 (需要登录)')
|
||||
console.log(' http://localhost:3000/settings - 系统设置 (需要登录)')
|
||||
console.log(' http://localhost:3000/test - 样式测试 (公开)')
|
||||
console.log(' http://localhost:3000/websocket-test - WebSocket测试 (公开)')
|
||||
console.log(' http://localhost:3000/demo - 动态路由演示 (公开)')
|
||||
console.log(' http://localhost:3000/any-other-path - 404页面 (公开)')
|
||||
console.log(' http://localhost:3001/ - 首页 (需要登录)')
|
||||
console.log(' http://localhost:3001/login - 登录页面')
|
||||
console.log(' http://localhost:3001/dashboard - 仪表板 (需要登录)')
|
||||
console.log(' http://localhost:3001/user - 用户管理 (需要登录)')
|
||||
console.log(' http://localhost:3001/profile - 个人资料 (需要登录)')
|
||||
console.log(' http://localhost:3001/settings - 系统设置 (需要登录)')
|
||||
console.log(' http://localhost:3001/test - 样式测试 (公开)')
|
||||
console.log(' http://localhost:3001/websocket-test - WebSocket测试 (公开)')
|
||||
console.log(' http://localhost:3001/demo - 动态路由演示 (公开)')
|
||||
console.log(' http://localhost:3001/any-other-path - 404页面 (公开)')
|
||||
|
||||
console.log('\n✅ 路由配置加载完成!')
|
||||
console.log('💡 提示: 启动项目后会在控制台看到真正的动态路由信息')
|
||||
|
||||
@@ -24,7 +24,7 @@ export function getFullFileUrl(relativePath: string): string {
|
||||
}
|
||||
|
||||
// 在生产环境中,拼接完整的URL
|
||||
const baseURL = import.meta.env.VITE_API_BASE_URL || 'http://localhost:3000'
|
||||
const baseURL = import.meta.env.VITE_API_BASE_URL || 'http://localhost:3001'
|
||||
return `${baseURL}${relativePath}`
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ export function getApiBaseUrl(): string {
|
||||
if (import.meta.env.DEV) {
|
||||
return '' // 开发环境使用空字符串,通过Vite代理
|
||||
}
|
||||
return import.meta.env.VITE_API_BASE_URL || 'http://localhost:3000'
|
||||
return import.meta.env.VITE_API_BASE_URL || 'http://localhost:3001'
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -47,7 +47,7 @@ export function getMediaBaseUrl(): string {
|
||||
if (import.meta.env.DEV) {
|
||||
return '' // 开发环境使用空字符串,通过Vite代理
|
||||
}
|
||||
const baseURL = import.meta.env.VITE_API_BASE_URL || 'http://localhost:3000'
|
||||
const baseURL = import.meta.env.VITE_API_BASE_URL || 'http://localhost:3001'
|
||||
return baseURL.replace('/api', '') // 移除/api后缀
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user