From 5642586feb6048d0c5a8bbc6af14bb203c1364ad Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com>
Date: Tue, 15 Oct 2019 11:13:01 +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/App.js | 6 +-
public/react/src/AppConfig.js | 14 +-
.../react/src/modules/login/EducoderLogin.js | 6 +-
public/react/src/modules/tpm/NewHeader.js | 138 +++++++++---------
public/react/src/modules/tpm/TPMIndexHOC.js | 6 +-
5 files changed, 87 insertions(+), 83 deletions(-)
diff --git a/public/react/src/App.js b/public/react/src/App.js
index c771021bf..6aa615c3b 100644
--- a/public/react/src/App.js
+++ b/public/react/src/App.js
@@ -337,7 +337,7 @@ class App extends Component {
});
initAxiosInterceptors(this.props);
- this.getAppdata();
+ // this.getAppdata();
//
// axios.interceptors.response.use((response) => {
// // console.log("response"+response);
@@ -368,6 +368,8 @@ class App extends Component {
getAppdata=()=>{
let url = "/setting.json";
axios.get(url).then((response) => {
+ console.log("app.js开始请求/setting.json");
+ console.log("获取当前定制信息");
if(response){
if(response.data){
this.setState({
@@ -710,4 +712,4 @@ moment.defineLocale('zh-cn', {
doy: 4 // The week that contains Jan 4th is the first week of the year.
}
});
-export default SnackbarHOC()(App);
\ No newline at end of file
+export default SnackbarHOC()(App) ;
\ No newline at end of file
diff --git a/public/react/src/AppConfig.js b/public/react/src/AppConfig.js
index 0510cd293..aa986d867 100644
--- a/public/react/src/AppConfig.js
+++ b/public/react/src/AppConfig.js
@@ -94,13 +94,13 @@ export function initAxiosInterceptors(props) {
}
}
- // if (requestMap[config.url] === true) { // 避免重复的请求 导致页面f5刷新 也会被阻止
- // console.log(config);
- // console.log(JSON.parse(config));
- // console.log(config.url);
- // console.log("被阻止了是重复请求=================================");
- // return false;
- // }
+ if (requestMap[config.url] === true) { // 避免重复的请求 导致页面f5刷新 也会被阻止
+ console.log(config);
+ console.log(JSON.parse(config));
+ console.log(config.url);
+ console.log("被阻止了是重复请求=================================");
+ return false;
+ }
// 非file_update请求
if (config.url.indexOf('update_file') === -1) {
requestMap[config.url] = true;
diff --git a/public/react/src/modules/login/EducoderLogin.js b/public/react/src/modules/login/EducoderLogin.js
index c7a5a0cbf..4e35eb7e3 100644
--- a/public/react/src/modules/login/EducoderLogin.js
+++ b/public/react/src/modules/login/EducoderLogin.js
@@ -20,6 +20,7 @@ import {
} from "antd";
import {Link, Switch, Route, Redirect} from 'react-router-dom';
import { SnackbarHOC,getImageUrl } from 'educoder';
+import { TPMIndexHOC } from '../tpm/TPMIndexHOC';
import '../courses/css/members.css';
import "../courses/common/formCommon.css"
import '../courses/css/Courses.css';
@@ -28,7 +29,6 @@ import educodernet from '../../../src/images/login/educodernet.png';
import LoginRegisterComponent from '../user/LoginRegisterComponent';
import FindPasswordComponent from '../user/FindPasswordComponent';
import passopen from "../../images/login/passopen.png";
-import {TPMIndexHOC} from "../tpm/TPMIndexHOC";
//educoder登入页面
var sectionStyle = {
"height": "100%",
@@ -208,7 +208,9 @@ class EducoderLogin extends Component {
}
}
-export default SnackbarHOC() (TPMIndexHOC ( EducoderLogin ));
+// export default EducoderLogin ;
+export default TPMIndexHOC ( EducoderLogin );
+// SnackbarHOC() (TPMIndexHOC ( EducoderLogin ));
// showbool === 2 ?
//
{
// console.log("componentDidMount2");
- // console.log(this.state.mygetHelmetapi2);
- if(this.state.mygetHelmetapi2===undefined){
- this.getAppdata();
- }
+ // console.log(this.props.mygetHelmetapi);
+ // if(this.props.mygetHelmetapi===undefined){
+ // this.getAppdata();
+ // }
}
componentDidMount() {
console.log("componentDidMount1");
- this.getAppdata();
+ // this.getAppdata();
window._header_componentHandler = this;
//下拉框的显示隐藏
@@ -653,70 +653,70 @@ submittojoinclass=(value)=>{
headtypesonClickbool:bool,
})
}
- getAppdata=()=>{
- console.log("开始刷新数据了")
- let url = "/setting.json";
- axios.get(url).then((response) => {
- // console.log("axios.get");
- // console.log(response);
-
- if(response){
- if(response.data){
- this.setState({
- mygetHelmetapi2:response.data.setting
- });
- document.title = response.data.setting.name;
- var link = document.createElement('link'),
- oldLink = document.getElementById('dynamic-favicon');
- link.id = 'dynamic-favicon';
- link.rel = 'shortcut icon';
- link.href = '/'+response.data.setting.tab_logo_url;
- if (oldLink) {
- document.head.removeChild(oldLink);
- }
- document.head.appendChild(link);
- }else {
- document.title = "EduCoder";
- var link = document.createElement('link'),
- oldLink = document.getElementById('dynamic-favicon');
- link.id = 'dynamic-favicon';
- link.rel = 'shortcut icon';
- link.href = "/react/build/./favicon.ico";
- if (oldLink) {
- document.head.removeChild(oldLink);
- }
- document.head.appendChild(link);
- }
-
- }else{
- document.title = "EduCoder";
- var link = document.createElement('link'),
- oldLink = document.getElementById('dynamic-favicon');
- link.id = 'dynamic-favicon';
- link.rel = 'shortcut icon';
- link.href = "/react/build/./favicon.ico";
- if (oldLink) {
- document.head.removeChild(oldLink);
- }
- document.head.appendChild(link);
- }
-
- }).catch((error) => {
- console.log("开始刷新数据了但报错了");
- console.log(error);
-
- document.title = "EduCoder";
- var link = document.createElement('link'),
- oldLink = document.getElementById('dynamic-favicon');
- link.id = 'dynamic-favicon';
- link.rel = 'shortcut icon';
- link.href = "/react/build/./favicon.ico";
- if (oldLink) {
- document.head.removeChild(oldLink);
- }
- document.head.appendChild(link);
- });
- };
+ // getAppdata=()=>{
+ // console.log("开始刷新数据了")
+ // let url = "/setting.json";
+ // axios.get(url).then((response) => {
+ // // console.log("axios.get");
+ // // console.log(response);
+ //
+ // if(response){
+ // if(response.data){
+ // this.setState({
+ // mygetHelmetapi2:response.data.setting
+ // });
+ // document.title = response.data.setting.name;
+ // var link = document.createElement('link'),
+ // oldLink = document.getElementById('dynamic-favicon');
+ // link.id = 'dynamic-favicon';
+ // link.rel = 'shortcut icon';
+ // link.href = '/'+response.data.setting.tab_logo_url;
+ // if (oldLink) {
+ // document.head.removeChild(oldLink);
+ // }
+ // document.head.appendChild(link);
+ // }else {
+ // document.title = "EduCoder";
+ // var link = document.createElement('link'),
+ // oldLink = document.getElementById('dynamic-favicon');
+ // link.id = 'dynamic-favicon';
+ // link.rel = 'shortcut icon';
+ // link.href = "/react/build/./favicon.ico";
+ // if (oldLink) {
+ // document.head.removeChild(oldLink);
+ // }
+ // document.head.appendChild(link);
+ // }
+ //
+ // }else{
+ // document.title = "EduCoder";
+ // var link = document.createElement('link'),
+ // oldLink = document.getElementById('dynamic-favicon');
+ // link.id = 'dynamic-favicon';
+ // link.rel = 'shortcut icon';
+ // link.href = "/react/build/./favicon.ico";
+ // if (oldLink) {
+ // document.head.removeChild(oldLink);
+ // }
+ // document.head.appendChild(link);
+ // }
+ //
+ // }).catch((error) => {
+ // console.log("开始刷新数据了但报错了");
+ // console.log(error);
+ //
+ // document.title = "EduCoder";
+ // var link = document.createElement('link'),
+ // oldLink = document.getElementById('dynamic-favicon');
+ // link.id = 'dynamic-favicon';
+ // link.rel = 'shortcut icon';
+ // link.href = "/react/build/./favicon.ico";
+ // if (oldLink) {
+ // document.head.removeChild(oldLink);
+ // }
+ // document.head.appendChild(link);
+ // });
+ // };
render() {
const isLogin = true; // 这里不会出现未登录的情况,服务端在服务端路由时发现如果是未登录,则跳转到登录页了。
const {match,} = this.props;
diff --git a/public/react/src/modules/tpm/TPMIndexHOC.js b/public/react/src/modules/tpm/TPMIndexHOC.js
index ba94bbcc3..598ef4892 100644
--- a/public/react/src/modules/tpm/TPMIndexHOC.js
+++ b/public/react/src/modules/tpm/TPMIndexHOC.js
@@ -148,8 +148,8 @@ export function TPMIndexHOC(WrappedComponent) {
}
componentDidMount() {
- // console.log("TPMIndexHOC========");
- // console.log(this.props);
+ console.log("TPMIndexHOC========");
+ console.log(this.props);
window.addEventListener('keyup', this.keyupListener)
if(this.props.match.path==="/"){
@@ -212,7 +212,7 @@ export function TPMIndexHOC(WrappedComponent) {
}
}
});
- this.getAppdata();
+ this.getAppdata();
}
/**
课堂权限相关方法,暂时写这里了 ----------------------------------------START