chore(request): add dev proxy

This commit is contained in:
woody 2025-06-08 14:01:49 +08:00
parent 2b7fc03414
commit 83e62b7944
3 changed files with 22 additions and 30 deletions

View File

@ -1,17 +1,4 @@
~# just a flag
ENV = 'development'
# base api
#开发
#VUE_APP_BASE_API = 'http://182.92.11.203:8050'
#超
#VUE_APP_BASE_API = 'http://192.168.31.159:8080'
VUE_APP_BASE_API = 'http://localhost:8080'
#测试
# VUE_APP_BASE_API = 'http://a1.hzs413.com/prod-api'
# VUE_APP_BASE_API = 'http://s.hzs413.com/prod-api'
VUE_APP_ADDRESS = 'https://yx.hzs413.com/'
VUE_APP_ADDRESS1 = 'https://cn.hzs413.com/'
VUE_APP_BASE_API = '/prod-api'

View File

@ -9,14 +9,14 @@ import { MessageBox, Message, Loading } from 'element-ui'
import store from '@/store'
import { getToken } from '@/utils/auth'
import errorCode from '@/utils/errorCode'
import { tansParams, blobValidate } from "@/utils/ruoyi"
import { tansParams, blobValidate } from '@/utils/ruoyi'
import { saveAs } from 'file-saver'
// create an axios instance
let downloadLoadingInstance
// 是否显示重新登录
export let isRelogin = { show: false }
export const isRelogin = { show: false }
const service = axios.create({
baseURL: process.env.VUE_APP_BASE_API, // url = base url + request url
// withCredentials: true, // send cookies when cross-domain requests
@ -27,7 +27,7 @@ const service = axios.create({
service.interceptors.request.use(
config => {
if (localStorage.getItem('lang')) {
config.headers['Accept-Language'] = localStorage.getItem('lang');
config.headers['Accept-Language'] = localStorage.getItem('lang')
} else {
config.headers['Accept-Language'] = 'zh-CN'
}
@ -44,7 +44,7 @@ service.interceptors.request.use(
if (value !== null && typeof (value) !== 'undefined') {
if (typeof value === 'object') {
for (const key of Object.keys(value)) {
let params = propName + '[' + key + ']'
const params = propName + '[' + key + ']'
var subPart = encodeURIComponent(params) + '='
url += subPart + encodeURIComponent(value[key]) + '&'
}
@ -140,7 +140,6 @@ service.interceptors.response.use(
}
)
// 通用下载方法
export function download(url, params, filename, config) {
downloadLoadingInstance = Loading.service({ text: '正在下载数据,请稍候', spinner: 'el-icon-loading', background: 'rgba(0, 0, 0, 0.7)' })

View File

@ -42,7 +42,13 @@ module.exports = {
warnings: false,
errors: true
},
before: require('./mock/mock-server.js')
proxy: {
'/prod-api': {
target: 'http://192.168.1.100:8080',
changeOrigin: true,
pathRewrite: { '^/prod-api': '' }
}
}
},
configureWebpack: {
// provide the app's title in webpack's name field, so that
@ -58,7 +64,7 @@ module.exports = {
'enUS': 'enUS',
'zhTC': 'zhTC',
'ruRU': 'ruRU',
'frFR':'frFR',
'frFR': 'frFR'
}
},
chainWebpack(config) {