dev_tpm_ui
杨树明 5 years ago
parent 61ccc059c7
commit 7c45fd9185

@ -8,6 +8,8 @@ import { notification } from 'antd';
import './index.css';
const $ = window.$;
const opens ="79e33abd4b6588941ab7622aed1e67e8";
let timestamp;
let checkSubmitFlg = false;
broadcastChannelOnmessage('refreshPage', () => {
window.location.reload()
})
@ -19,7 +21,7 @@ function locationurl(list){
window.location.href=list
}
}
let hashTimeout
// TODO 开发期多个身份切换
let debugType =""
@ -39,7 +41,29 @@ if (isDev) {
//ebugType="teacher";
// 学生
//debugType="student";
window.railsgettimes = function(proxy) {
if(timestamp&&checkSubmitFlg===false){
$.ajax({url:proxy,async:false,success:function(data){
if(data.status===0){
timestamp=data.message;
}
}})
checkSubmitFlg=true
window.setTimeout(function () {
checkSubmitFlg=false;
}, 3500);
}else if(checkSubmitFlg===false){
$.ajax({url:proxy,async:false,success:function(data){
if(data.status===0){
timestamp=data.message;
}
}})
checkSubmitFlg=true
window.setTimeout(function () {
checkSubmitFlg=false;
}, 3500);
}
}
window._debugType = debugType;
export function initAxiosInterceptors(props) {
initOnlineOfflineListener()
@ -62,17 +86,10 @@ 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;
}
axios.interceptors.request.use(
config => {
@ -102,8 +119,7 @@ export function initAxiosInterceptors(props) {
}
if(`${config[0]}`!=`true`){
if (window.location.port === "3007") {
let timestamp=railsgettimes(proxy);
console.log(timestamp)
railsgettimes(`${proxy}/api/main/first_stamp.json`);
let newopens=md5(opens+timestamp)
config.url = `${proxy}${url}`;
if (config.url.indexOf('?') == -1) {
@ -113,6 +129,7 @@ export function initAxiosInterceptors(props) {
}
} else {
// 加api前缀
railsgettimes(`/api/main/first_stamp.json`);
config.url = url;
if (config.url.indexOf('?') == -1) {
config.url = `${config.url}?&randomcode=${timestamp}&client_key=${newopens}`;

@ -31,13 +31,15 @@ class ShixunsHome extends Component {
}
}
componentDidMount(){
configShareForIndex()
configShareForIndex()
const upsystem=`/users/system_update.json`;
axios.get(upsystem).then((response)=>{
let updata=response.data;
this.setState({
updata:updata
})
if(response.data){
let updata=response.data;
this.setState({
updata:updata
})
}
}).catch((error)=>{
console.log(error);
})
@ -50,7 +52,7 @@ class ShixunsHome extends Component {
})
}
}).catch((error)=>{
console.log(error)
// console.log(error)
});
}

@ -1100,9 +1100,6 @@ submittojoinclass=(value)=>{
{/*<a href={this.props.Headertop===undefined?"":this.props.Headertop.course_url}>课堂</a>*/}
<Link to={this.props.Headertop===undefined?"":'/courses'}>翻转课堂</Link>
</li>
{}
{console.log(activeShixuns)}
<li className={`${activeShixuns === true ? 'pr active' : 'pr'}`}>
<Link to="/shixuns">实训项目</Link>
{/*<img src={getImageUrl("images/educoder/hot-h.png")} className="nav-img">*/}

Loading…
Cancel
Save