| | |
| | | import Vue from 'vue'; |
| | | import axios from 'axios'; |
| | | // import qs from 'qs'; |
| | | let newPlatform = sessionStorage.getItem('newPlatform') |
| | | if (process.env.NODE_ENV == 'dev') { |
| | | // 跨域请求 |
| | | axios.defaults.baseURL = 'http://localhost:8090/screen'; |
| | |
| | | axios.interceptors.request.use(function (config) { |
| | | if (config.asy) { |
| | | if (process.env.NODE_ENV == 'dev') { |
| | | // 跨域请求 |
| | | config.baseURL = 'http://localhost:8919/fg'; |
| | | config.withCredentials = true; // 保持请求头 |
| | | if (newPlatform == 1) { |
| | | config.baseURL = 'http://localhost:8091/fg'; |
| | | } else { |
| | | config.baseURL = 'http://localhost:8919/fg'; |
| | | } |
| | | } else { |
| | | config.baseURL = `http://${location.hostname}:8919/fg`; |
| | | config.withCredentials = true; // 保持请求头 |
| | | if (newPlatform == 1) { |
| | | config.baseURL = `http://${location.hostname}:8091/fg`; |
| | | } else { |
| | | config.baseURL = `http://${location.hostname}:8919/fg`; |
| | | } |
| | | } |
| | | config.withCredentials = true; // 保持请求头 |
| | | } |
| | | // 在发送请求之前做些什么 |
| | | return config; |