diff --git a/package.json b/package.json index e9c42f0e..8a63685b 100644 --- a/package.json +++ b/package.json @@ -118,7 +118,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", diff --git a/src/AppConfig.js b/src/AppConfig.js index 9bf5e095..1b78e7a9 100644 --- a/src/AppConfig.js +++ b/src/AppConfig.js @@ -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) { diff --git a/src/military/fetch.js b/src/military/fetch.js index f9ec73f8..bbf41f03 100644 --- a/src/military/fetch.js +++ b/src/military/fetch.js @@ -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; diff --git a/src/military/notice/fetch.js b/src/military/notice/fetch.js index bede3805..07e20261 100644 --- a/src/military/notice/fetch.js +++ b/src/military/notice/fetch.js @@ -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); } ); diff --git a/src/military/task/taskEdit/index.jsx b/src/military/task/taskEdit/index.jsx index e442ae6d..3501a6e8 100644 --- a/src/military/task/taskEdit/index.jsx +++ b/src/military/task/taskEdit/index.jsx @@ -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: