huangxiaoqiang
2025-06-03 975ea3c28b1661b3b6eabee5277cc98d853736d3
CodeManagement/BigScreenVue/src/api/ajax.js
@@ -1,7 +1,10 @@
// 这个时axios的配置
import axios from 'axios';
// import { config } from 'vue/types/umd';
axios.defaults.baseURL =  'http://localhost:8098';//'http://192.168.2.110:8098';//
axios.defaults.withCredentials=true;
axios.defaults.crossDomain=true;
axios.defaults.baseURL = 'http://192.168.90.253:5000/';//'http://192.168.2.51:8099'; //'http://localhost:8099'; //'http://192.168.2.51:8099';//
axios.defaults.headers.post["Content-Type"]="application/json;charset=utf-8";
// 错误信息处理
const  errorHandle = (status, other) => {
  switch (status) {
@@ -29,6 +32,7 @@
  // console.log(config);
  if(localStorage.elementToken){
    config.headers.Authorization=localStorage.elementToken;
    config.headers.con;
  }
  // console.log(config);
  return config;
@@ -43,7 +47,7 @@
  // console.log();
  // console.log(response.data.token);
  // response.headers['Authorization'] = response.data.token;
  return response.status=== 200 ? Promise.resolve(response): Promise.reject(response);
  return response.status=== 200 ? response.data: response.data;
}, function (error) {
  // 对响应错误做点什么
  const {response}=error;
@@ -51,7 +55,7 @@
    errorHandle(response.status,response.data.message)
    return Promise.reject(response.data);
  }else{
    console.log('断了');
  }
});
export default axios;