Merge pull request '修改API调用指向路径及发布任务时的判断逻辑' (#254) from tongChong/forgeplus-react:hotfix_api_address into pre_dev_military

This commit is contained in:
baladiwei 2021-11-10 15:04:28 +08:00
commit d9bd0387db
5 changed files with 15 additions and 33 deletions

View File

@ -116,7 +116,7 @@
},
"scripts": {
"start": "node --max_old_space_size=15360 scripts/start.js",
"build": "cross-env NODE_ENV=production node --max_old_space_size=15360 scripts/build.js",
"build": " NODE_ENV=production node --max_old_space_size=15360 scripts/build.js",
"test-build": "NODE_ENV=testBuild node --max_old_space_size=15360 scripts/build.js",
"pre-build": "NODE_ENV=preBuild node --max_old_space_size=15360 scripts/build.js",
"gen_stats": "NODE_ENV=production webpack --profile --config=./config/webpack.config.prod.js --json > stats.json",

View File

@ -57,6 +57,7 @@ export function initAxiosInterceptors(props) {
var
proxy = "http://localhost:3000";
proxy = "https://forge.osredm.com";
// proxy = "http://117.50.100.12:49999";
const requestMap = {};
window.setfalseInRequestMap = function (keyName) {

View File

@ -3,18 +3,9 @@ import axios from 'axios';
import cookie from 'react-cookies';
let actionUrl = '';
if (window.location.href.indexOf('localhost') > -1) {
actionUrl='https://taskapi.osredm.com';
// actionUrl='http://192.168.31.47:8081';
}else if(window.location.href.indexOf('192.168.31.48') > -1){
actionUrl='https://taskapi.osredm.com';
axios.defaults.withCredentials = true;
}else if(window.location.href.indexOf('noticeweb.osredm') > -1){
actionUrl="https://taskapi.osredm.com";
axios.defaults.withCredentials = true;
}else if(window.location.href.indexOf('forge.osredm.com')>-1){
actionUrl="https://task.osredm.com";
let settings=JSON.parse(localStorage.chromesetting);
let actionUrl = settings.api_urls? settings.api_urls.task :'https://task.osredm.com';
if (window.location.href.indexOf('localhost') < 0) {
axios.defaults.withCredentials = true;
}
export const httpUrl = actionUrl;

View File

@ -1,26 +1,18 @@
import { notification,message } from 'antd';
import { notification } from 'antd';
import axios from 'axios';
import cookie from 'react-cookies';
let actionUrl = '';
if (window.location.href.indexOf('localhost') > -1) {
actionUrl='https://taskapi.osredm.com';
// actionUrl='http://192.168.31.47:8081';
}else if(window.location.href.indexOf('192.168.31.48') > -1){
actionUrl='https://taskapi.osredm.com';
axios.defaults.withCredentials = true;
}else if(window.location.href.indexOf('noticeweb.osredm') > -1){
actionUrl="https://taskapi.osredm.com";
axios.defaults.withCredentials = true;
}else if(window.location.href.indexOf('forge.osredm.com')>-1){
actionUrl="https://info.osredm.com";
let settings = JSON.parse(localStorage.chromesetting);
let actionUrl = settings.api_urls ? settings.api_urls.notice : 'https://info.osredm.com';
if (window.location.href.indexOf('localhost')< 0) {
axios.defaults.withCredentials = true;
}
export const httpUrl = actionUrl;
const TokenKey = 'autologin_forge_military';
// 创建axios实例
const service = axios.create({
baseURL: httpUrl,
@ -91,7 +83,7 @@ service.interceptors.response.use(
},
error => {
console.log(error);
let res = error.response||{};
let res = error.response || {};
if (res.status === 400) {
notification.open({
message: "提示",
@ -111,10 +103,10 @@ service.interceptors.response.use(
message: "提示",
description: res.data.message || '无权限!',
});
window.location.href="/403";
window.location.href = "/403";
return Promise.reject('error');
}
return Promise.reject(error);
}
);

View File

@ -198,7 +198,7 @@ export default Form.create()(forwardRef(({ current_user, form, showNotification,
showNotification("任务保存成功!");
if (!status) {
history.push("/task/myTask?published=false")
} else if (publishMode == '1') {
} else {
info({
title: '提示',
content: <div>
@ -209,9 +209,7 @@ export default Form.create()(forwardRef(({ current_user, form, showNotification,
history.push("/task/myTask?published=false");
},
});
} else {
history.push("/task/myTask");
}
}
} else {
showNotification(res.message);
}