This commit is contained in:
parent
2c4f135bbf
commit
c8c1fea7c4
|
@ -29,7 +29,10 @@ axios.interceptors.response.use(
|
|||
if (error.response) {
|
||||
if (error.response.status == 401) {
|
||||
ElMessage.error("请重新登录!");
|
||||
window.location.href = '/#/login?return_url=' + window.location.href
|
||||
// window.location.href = '/#/login?returnURL=' + window.location.href
|
||||
window.location.href =
|
||||
'http://220.191.238.50:996/api/login?returnURL=' +
|
||||
window.location.href
|
||||
} else if (error.response.status == 404) {
|
||||
ElMessage.error("Status:404,正在请求不存在的服务器记录!");
|
||||
} else if (error.response.status == 500) {
|
||||
|
@ -59,7 +62,7 @@ var http = {
|
|||
params: params
|
||||
})
|
||||
.then((response) => {
|
||||
if(response.data.code == 400 && response.data.msg){
|
||||
if (response.data.code == 400 && response.data.msg) {
|
||||
ElMessage.error(response.data.msg);
|
||||
}
|
||||
resolve(response.data);
|
||||
|
@ -78,7 +81,7 @@ var http = {
|
|||
return new Promise((resolve, reject) => {
|
||||
axios.post(url, params)
|
||||
.then((response) => {
|
||||
if(response.data.code == 400 && response.data.msg){
|
||||
if (response.data.code == 400 && response.data.msg) {
|
||||
ElMessage.error(response.data.msg);
|
||||
}
|
||||
resolve(response.data);
|
||||
|
@ -93,7 +96,7 @@ var http = {
|
|||
return new Promise((resolve, reject) => {
|
||||
axios.put(url, params)
|
||||
.then((response) => {
|
||||
if(response.data.code == 400 && response.data.msg){
|
||||
if (response.data.code == 400 && response.data.msg) {
|
||||
ElMessage.error(response.data.msg);
|
||||
}
|
||||
resolve(response.data);
|
||||
|
@ -108,7 +111,7 @@ var http = {
|
|||
return new Promise((resolve, reject) => {
|
||||
axios.delete(url, params)
|
||||
.then((response) => {
|
||||
if(response.data.code == 400 && response.data.msg){
|
||||
if (response.data.code == 400 && response.data.msg) {
|
||||
ElMessage.error(response.data.msg);
|
||||
}
|
||||
resolve(response.data);
|
||||
|
|
|
@ -15,7 +15,8 @@ export default defineConfig({
|
|||
// 第一个代理
|
||||
"/api": {
|
||||
// 匹配到啥来进行方向代理
|
||||
target: "http://192.168.2.42:8095/", //周源
|
||||
// target: "http://192.168.2.42:8095/", //周源
|
||||
target: "http://220.191.238.50:996/", //周源
|
||||
changeOrigin: true, //是否支持跨域
|
||||
//rewrite: (path) => path.replace(/^\/api/, '') // 如果不需要api 直接把路径上的api 替换成空,这个
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue