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}`; } } }