dev_auth
杨树林 5 years ago
parent a3dc1d6adf
commit 8dc47a2157

@ -357,15 +357,40 @@ class App extends Component {
let url = "/setting.json"; let url = "/setting.json";
axios.get(url).then((response) => { axios.get(url).then((response) => {
if(response){ if(response){
this.setState({ if(response.data){
getHelmetapi:response.data.setting this.setState({
}); getHelmetapi:response.data.setting
document.title = response.data.setting.name; });
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.nav_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'), var link = document.createElement('link'),
oldLink = document.getElementById('dynamic-favicon'); oldLink = document.getElementById('dynamic-favicon');
link.id = 'dynamic-favicon'; link.id = 'dynamic-favicon';
link.rel = 'shortcut icon'; link.rel = 'shortcut icon';
link.href = response.data.setting.nav_logo_url; link.href = "/react/build/./favicon.ico";
if (oldLink) { if (oldLink) {
document.head.removeChild(oldLink); document.head.removeChild(oldLink);
} }
@ -373,7 +398,16 @@ class App extends Component {
} }
}).catch((error) => { }).catch((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);
}); });
}; };

@ -285,17 +285,40 @@ export function TPMIndexHOC(WrappedComponent) {
let url = "/setting.json"; let url = "/setting.json";
axios.get(url).then((response) => { axios.get(url).then((response) => {
if(response){ if(response){
this.setState({ if(response.data){
mygetHelmetapi:response.data.setting, this.setState({
}); getHelmetapi:response.data.setting
// console.log("获取当前定制信息"); });
// console.log(response.data.setting); document.title = response.data.setting.name;
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.nav_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'), var link = document.createElement('link'),
oldLink = document.getElementById('dynamic-favicon'); oldLink = document.getElementById('dynamic-favicon');
link.id = 'dynamic-favicon'; link.id = 'dynamic-favicon';
link.rel = 'shortcut icon'; link.rel = 'shortcut icon';
link.href = response.data.setting.nav_logo_url; link.href = "/react/build/./favicon.ico";
if (oldLink) { if (oldLink) {
document.head.removeChild(oldLink); document.head.removeChild(oldLink);
} }
@ -303,7 +326,16 @@ export function TPMIndexHOC(WrappedComponent) {
} }
}).catch((error) => { }).catch((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);
}); });
}; };
/** /**

Loading…
Cancel
Save