From defc90c139b5dc96ca52417eb3bd123005cf02e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Mon, 30 Dec 2019 18:50:52 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/AppConfig.js | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/public/react/src/AppConfig.js b/public/react/src/AppConfig.js index 9350001e4..859b5f579 100644 --- a/public/react/src/AppConfig.js +++ b/public/react/src/AppConfig.js @@ -6,6 +6,7 @@ import { requestProxy } from "./indexEduplus2RequestProxy"; import { broadcastChannelOnmessage ,SetAppModel, isDev, queryString } from 'educoder'; import { notification } from 'antd'; import './index.css'; +const $ = window.$; const opens ="79e33abd4b6588941ab7622aed1e67e8"; broadcastChannelOnmessage('refreshPage', () => { window.location.reload() @@ -61,6 +62,14 @@ export function initAxiosInterceptors(props) { // 如果需要支持重复的请求,考虑config里面自定义一个allowRepeat参考来控制 const requestMap = {}; + window.railsgettimes = function(proxy) { + $.ajax({url:`${proxy}/api/main/first_stamp.json`,async:false,success:function(data,status){ + if(data.status===0){ + return data.message; + } + }}); + } + window.setfalseInRequestMap = function(keyName) { requestMap[keyName] = false; } @@ -92,22 +101,23 @@ export function initAxiosInterceptors(props) { } } if(`${config[0]}`!=`true`){ - let timestamp = Date.parse(new Date())/1000; - let newopens=md5(opens+timestamp) if (window.location.port === "3007") { + let timestamp=railsgettimes(proxy); + console.log(timestamp) + let newopens=md5(opens+timestamp) config.url = `${proxy}${url}`; if (config.url.indexOf('?') == -1) { - config.url = `${config.url}?debug=${debugType}×tamp=${timestamp}&client_key=${newopens}`; + config.url = `${config.url}?debug=${debugType}&randomcode=${timestamp}&client_key=${newopens}`; } else { - config.url = `${config.url}&debug=${debugType}×tamp=${timestamp}&client_key=${newopens}`; + config.url = `${config.url}&debug=${debugType}&randomcode=${timestamp}&client_key=${newopens}`; } } else { // 加api前缀 config.url = url; if (config.url.indexOf('?') == -1) { - config.url = `${config.url}?×tamp=${timestamp}&client_key=${newopens}`; + config.url = `${config.url}?&randomcode=${timestamp}&client_key=${newopens}`; } else { - config.url = `${config.url}×tamp=${timestamp}&client_key=${newopens}`; + config.url = `${config.url}&randomcode=${timestamp}&client_key=${newopens}`; } } }