fix: 更新API路径和代理配置以适配本地开发环境

修改vite配置中的代理目标地址为本地服务,并添加路径重写规则
更新多个组件中的API请求路径,统一添加'/aw'前缀
This commit is contained in:
gaohaifeng 2025-08-28 19:33:42 +08:00
parent 645e0d2a2c
commit 587c6f4f38
4 changed files with 6 additions and 5 deletions

View File

@ -74,7 +74,7 @@ use([DatasetComponent, CanvasRenderer, LineChart, GridComponent, TooltipComponen
// API
const fetchChartData = async (timeType: string, riskLevel: number) => {
try {
const response = await axios.get(`/screen/alarmByOption/${timeType}/${riskLevel}`)
const response = await axios.get(`/aw/screen/alarmByOption/${timeType}/${riskLevel}`)
if (response.data.state === true) {
return response.data.value || []
} else {

View File

@ -85,7 +85,7 @@ const selectedTimeRange = ref('day')
// API
const fetchChartData = async (option: string) => {
try {
const response = await axios.get(`/screen/handleByOption/${option}`)
const response = await axios.get(`/aw/screen/handleByOption/${option}`)
if (response.data.state === true) {
return response.data.value || []
} else {

View File

@ -93,7 +93,7 @@ const calculateWidth = (value: number) => {
// API
const fetchCorpsData = async (option: string) => {
try {
const response = await axios.get(`/screen/corpsFive/${option}`)
const response = await axios.get(`/aw/screen/corpsFive/${option}`)
if (response.data.state === true) {
displayData.value = response.data.value || []
} else {

View File

@ -61,8 +61,9 @@ export default ({ mode }) =>
secure: true
},
'/aw/': {
target: 'http://10.91.33.244/',
changeOrigin: true
target: 'http://127.0.0.1:8080/',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/aw/, '')
},
'/awjt/': {
target: 'http://127.0.0.1:8921/',