初始版本

This commit is contained in:
2026-04-23 16:30:57 +08:00
commit 0d0683a6e6
538 changed files with 113042 additions and 0 deletions

51
app/config/setting.ts Normal file
View File

@@ -0,0 +1,51 @@
// 环境配置
export const ENV_CONFIG = {
dev: {
name: '开发环境',
serverUrl: 'http://127.0.0.1:9500',
},
prod: {
name: '生产环境',
serverUrl: 'https://websopy-api.websoft.top',
},
} as const
export type EnvKey = keyof typeof ENV_CONFIG
const STORAGE_KEY = 'websopy_api_env'
// 客户端检测
function isClient(): boolean {
return typeof window !== 'undefined'
}
// 从 localStorage 读取保存的环境,默认生产环境
export function getCurrentEnv(): EnvKey {
if (!isClient()) return 'prod'
const saved = localStorage.getItem(STORAGE_KEY)
if (saved && saved in ENV_CONFIG) {
return saved as EnvKey
}
return 'prod'
}
export function setCurrentEnv(env: EnvKey) {
if (!isClient()) return
localStorage.setItem(STORAGE_KEY, env)
}
export function getApiBaseUrl(): string {
return ENV_CONFIG[getCurrentEnv()].serverUrl
}
// 动态 API URL根据当前环境
const BASE_URL = getApiBaseUrl()
export const SERVER_API_URL = '/api/_server'
export const MODULES_API_URL = '/api/_modules'
// App 模块:相对路径,走 /api/_app proxy → websopy-api.websoft.top/api/app/*
export const APP_API_URL = '/api/app'
export const FILE_SERVER = '/api/_file'
// Some endpoints use this as a special TenantId override (defaults to current tenant)
export const TEMPLATE_ID = '5'