Commit 7dd2e318 by liguokang

feat: 🎨

parent e71de27c
import axios from 'axios';
import { load as cookieLoad, save as cookieSave } from 'react-cookies';
const { webDomain, apiDomain } = require('./common/webConfigs');
// 创建axios实例
let serverPath = window.CONFIG.server;
if (SERVER) {
serverPath = SERVER;
}
let serverPath = apiDomain;
const service = axios.create({
baseURL: serverPath, // api 的 base_url
......@@ -41,15 +38,7 @@ service.interceptors.response.use(
// 坚决禁止在response中做业务异常操作
const rejectCode = [];
if (code < 200 || code > 300) {
if (code == 418) {
window.location.href = 'https://www.xiaomai5.com/maintain.html';
} else if (code == 401 || code == 403) {
User.loginIn();
} else {
processHttpError(response);
}
return data;
// return Promise.reject(new Error('error'));
processHttpError(response);
} else {
if (rejectCode.indexOf(code) > -1) {
console.table({
......@@ -58,22 +47,14 @@ service.interceptors.response.use(
errorInfo: message || result,
path: response.config.url,
});
// return Promise.reject(data);
return Promise.reject(data);
}
return data;
}
},
(error) => {
let code = 0;
try {
code = error.response.data.status;
if (code == 418) {
window.location.href = 'https://www.xiaomai5.com/maintain.html';
} else if (code == 401 || code == 403) {
User.loginIn();
} else {
processHttpError(error.response);
}
processHttpError(error.response);
} catch (e) {
if (error.toString().indexOf('Error: timeout') !== -1) {
console.table({
......
......@@ -2,15 +2,13 @@
* @Author: liguokang
* @Date: 2021-07-29 16:19:43
* @LastEditors: liguokang
* @LastEditTime: 2021-07-29 16:37:35
* @LastEditTime: 2021-07-29 16:46:20
* @Description:
* @Copyrigh: ©2021 杭州杰竞科技有限公司 版权所有
*/
const DEPLOY_ENV = process.env.DEPLOY_ENV;
console.log(DEPLOY_ENV, '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@');
const webDomain = {
dev: 'https://dev.xiaomai5.com/',
rc: 'https://rc.xiaomai5.com/',
......
......@@ -2,7 +2,7 @@
* @Author: liguokang
* @Date: 2021-07-14 20:36:28
* @LastEditors: liguokang
* @LastEditTime: 2021-07-29 16:34:27
* @LastEditTime: 2021-07-29 16:45:28
* @Description:
* @Copyrigh: ©2021 杭州杰竞科技有限公司 版权所有
*/
......@@ -27,13 +27,14 @@ module.exports = withLessExcludeAntd({
return Object.assign({
'/': { page: '/' },
'/404.html': { page: '/404' },
'/wheatSchool.html': { page: '/wheatSchool' },
});
},
webpack(config, options) {
config.resolve.alias['@'] = path.join(__dirname, 'common');
config.resolve.alias['components'] = path.join(__dirname, 'components');
config.resolve.alias['static'] = path.join(__dirname, 'static');
config.plugins.push(
new webpack.DefinePlugin({
'process.env': {
......
......@@ -2,7 +2,7 @@
* @Author: liguokang
* @Date: 2021-07-29 16:14:30
* @LastEditors: liguokang
* @LastEditTime: 2021-07-29 16:41:22
* @LastEditTime: 2021-07-29 16:46:12
* @Description:
* @Copyrigh: ©2021 杭州杰竞科技有限公司 版权所有
*/
......@@ -13,8 +13,6 @@ const { webDomain, apiDomain } = require('./common/webConfigs');
const readStream = fs.createReadStream('./sitemap/sitemap.html', { encoding: 'utf8' });
const writeStream = fs.createWriteStream('./dist/sitemap.html', { encoding: 'utf8' });
console.log(webConfigs, '11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111');
readStream.on('data', (data) => {
let reData = data.replace(/https\:\/\/www\.xiaomai5\.com\//g, webDomain);
reData = reData.replace(/https\:\/\/heimdall\.xiaomai5\.com\//g, apiDomain);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment