修改请求路径

This commit is contained in:
haozq 2024-08-08 08:51:32 +08:00
parent 57dcfed450
commit d8078ba816
3 changed files with 7 additions and 4 deletions

View File

@ -106,7 +106,7 @@ const user = {
})
})
},
// 退出系统
LogOut({ commit, state }) {
return new Promise((resolve, reject) => {

View File

@ -100,7 +100,7 @@ service.interceptors.request.use(config => {
if(config.headers['Content-Type']==null || config.headers['Content-Type']==''){
config.headers['Content-Type']='application/json';
console.warn("请求类型为空");
console.warn("请求类型为空");
}
return config
}, error => {
@ -116,8 +116,11 @@ service.interceptors.response.use(res => {
const resultData=decryptCBC(res.data.data);
res.data=JSON.parse(resultData);
}
if(typeof res.data.code=='undefined'){
res.data= res.data.data
}
// 未设置状态码则默认成功状态
const code = res.data.code || 200;
const code = res.data.code || 200;
// 获取错误信息
const msg = errorCode[code] || res.data.msg || errorCode['default']
// 二进制数据则直接返回

View File

@ -35,7 +35,7 @@ module.exports = {
proxy: {
// detail: https://cli.vuejs.org/config/#devserver-proxy
[process.env.VUE_APP_BASE_API]: {
target: `http://127.0.0.1:18080`,
target: `http://127.0.0.1:18080/ljzhgd`,
changeOrigin: true,
pathRewrite: {
['^' + process.env.VUE_APP_BASE_API]: ''