Files
justin dcb008d381 Refactor recurring investment form and API payloads:
- Simplify the creation form by removing price type and CT offset fields, defaulting to market orders.
- Update `buildScheduleInvestmentCreateBody` and related functions to handle new payload structure with `ctOffsetMinutes` set to null.
- Consolidate end type options into a dropdown, integrating 'GTC' as a selection.
- Adjust internationalization files to reflect new labels and hints for the updated form.
- Document changes in `IMPACT_ANALYSIS.md` and `TASK_SUMMARY.md` for clarity on the updates.
2026-10-13 14:47:33 +08:00

84 lines
2.3 KiB
TypeScript

import vue from '@vitejs/plugin-vue'
import { fileURLToPath, URL } from 'node:url'
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
import { defineConfig, loadEnv } from 'vite'
const DEFAULT_PROXY_TARGET = 'https://192.168.3.233'
/** Vite `base`:与 `VITE_BASE_URL` 对齐,供 `import.meta.env.BASE_URL` 与 Vue Router 使用 */
function resolveViteBase(raw: string | undefined): string {
const trimmed = (raw ?? '/').trim()
if (!trimmed || trimmed === '/') return '/'
const withLeading = trimmed.startsWith('/') ? trimmed : `/${trimmed}`
return withLeading.endsWith('/') ? withLeading : `${withLeading}/`
}
// https://vite.dev/config/
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd(), '')
const proxyTarget = (env.VITE_API_PROXY_TARGET || DEFAULT_PROXY_TARGET).trim().replace(/\/+$/, '')
const base = resolveViteBase(env.VITE_BASE_URL)
return {
base,
plugins: [
vue(),
AutoImport({
resolvers: [ElementPlusResolver()],
dts: 'src/types/auto-imports.d.ts',
}),
Components({
resolvers: [ElementPlusResolver({ importStyle: 'sass' })],
dts: 'src/types/components.d.ts',
}),
],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)),
},
},
server: {
host: true,
port: 5177,
open: true,
allowedHosts: true,
proxy: {
// '/base': {
// target: proxyTarget,
// changeOrigin: true,
// secure: false,
// },
// '/trade': {
// target: proxyTarget,
// changeOrigin: true,
// secure: false,
// },
// '/product': {
// target: proxyTarget,
// changeOrigin: true,
// secure: false,
// },
'/api': {
target: proxyTarget,
changeOrigin: true,
secure: false,
},
},
},
preview: {
host: true,
port: 5173,
allowedHosts: true,
},
css: {
preprocessorOptions: {
scss: {
additionalData: `@use "@/styles/mixins/respond" as *;\n`,
},
},
},
}
})