| | |
| | | import axios from 'axios' |
| | | import qs from 'qs' |
| | | import {notification } from 'antd' |
| | | |
| | | // axios.defaults.baseURL = 'http://qingqiumarket.cn' |
| | | axios.defaults.crossDomain = true |
| | |
| | | return Promise.resolve(response.data) |
| | | } |
| | | }, (error) => { |
| | | // console.log(error.response.status) |
| | | notification.error({ |
| | | className: 'notification-custom-error', |
| | | bottom: 0, |
| | | message: '状态码-' + error.response.status + ',请联系管理员', |
| | | placement: 'bottomRight', |
| | | duration: 15 |
| | | }) |
| | | return Promise.reject(error) |
| | | }) |
| | | |
| | | class Api { |
| | | constructor() { |
| | | let service = window.GLOB.service ? (/\/$/.test(window.GLOB.service) ? window.GLOB.service : window.GLOB.service + '/') : '' |
| | | if (process.env.NODE_ENV === 'production') { |
| | | axios.defaults.baseURL = document.location.origin + (window.GLOB.service ? '/' + window.GLOB.service : '') |
| | | axios.defaults.baseURL = document.location.origin + '/' + service |
| | | } else { |
| | | // axios.defaults.baseURL = 'http://127.0.0.1:8888' |
| | | } |