Files
AIGC/demo/frontend/vite.config.js
AIGC Developer 3c37006ebd feat: 添加任务状态级联触发器,优化支付和做同款功能
主要更新:
- 添加 MySQL 触发器实现 task_status 表到其他表的状态级联
- 移除控制器中的多表状态检查代码
- 完善做同款功能,支持参数传递
- 支付宝 USD 转 CNY 汇率转换
- 修复状态枚举映射问题

注意: 触发器仅在 task_status 更新时触发,部分代码仍直接更新业务表
2025-12-08 13:54:02 +08:00

82 lines
2.4 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { resolve } from 'path'
export default defineConfig({
plugins: [vue()],
resolve: {
alias: {
'@': resolve(__dirname, 'src')
}
},
// 生产/开发环境配置
base: process.env.NODE_ENV === 'production' ? '/' : '/',
// 开发服务器配置
server: {
port: 8081,
host: '0.0.0.0', // 允许外部访问
allowedHosts: true, // 允许所有主机访问
proxy: {
'/api': {
// 开发时代理到本地后端(统一为 localhost:8080
target: process.env.VITE_APP_API_URL || 'http://localhost:8080',
changeOrigin: true,
secure: false,
// 后端服务器路径已经包含 /api所以不需要 rewrite
// 前端请求 /api/xxx 会转发到 http://localhost:8080/api/xxx
// 调试时将 cookie 域改写为 localhost
cookieDomainRewrite: 'localhost',
cookiePathRewrite: '/',
configure: (proxy, _options) => {
proxy.on('error', (err, _req, _res) => {
console.log('proxy error', err);
});
proxy.on('proxyReq', (proxyReq, req, _res) => {
console.log('Sending Request to the Target:', req.method, req.url);
});
proxy.on('proxyRes', (proxyRes, req, _res) => {
console.log('Received Response from the Target:', proxyRes.statusCode, req.url);
const setCookie = proxyRes.headers['set-cookie'];
if (setCookie) {
console.log('Proxy Set-Cookie:', setCookie);
}
});
}
}
}
},
// public 目录配置(确保字体文件等静态资源被复制)
publicDir: 'public',
// 生产环境构建配置
build: {
outDir: 'dist',
assetsDir: 'static',
copyPublicDir: true,
// 代码分割优化
rollupOptions: {
output: {
manualChunks: {
'vue-vendor': ['vue', 'vue-router', 'pinia'],
'element-plus': ['element-plus', '@element-plus/icons-vue'],
'utils': ['axios']
}
}
},
// 生产环境移除 console
// 注意:如果使用 terser需要安装: npm install -D terser
// 暂时使用 esbuild默认更快
minify: 'esbuild',
// terserOptions: {
// compress: {
// drop_console: true,
// drop_debugger: true
// }
// },
// 块大小警告限制
chunkSizeWarningLimit: 1000
}
})