没logo时会将setting重置为空

This commit is contained in:
caishi 2021-03-31 12:02:38 +08:00
parent 49ebe450be
commit 8429effe16
1 changed files with 3 additions and 29 deletions

View File

@ -404,41 +404,14 @@ class NewHeader extends Component {
})
}
getAppdata = () => {
try {
var chromesettingArray = JSON.parse(localStorage.getItem('chromesetting'));
var chromesettingresponseArray = JSON.parse(localStorage.getItem('chromesettingresponse'));
this.setState({
settings: chromesettingArray
});
if (chromesettingArray.tab_logo_url) {
this.gettablogourldata(chromesettingresponseArray);
} else {
this.gettablogourlnull();
}
} catch (e) {
this.geturlsdata();
}
};
geturlsdata = () => {
let url = "/setting.json";
axios.get(url).then((response) => {
if (response && response.data) {
this.setState({ settings: response.data.setting });
// localStorage.setItem('chromesetting', JSON.stringify(response.data.setting));
// localStorage.setItem('chromesettingresponse', JSON.stringify(response));
try {
if (response.data.setting.tab_logo_url) {
this.gettablogourldata(response);
} else {
this.gettablogourlnull();
}
} catch (e) {
this.gettablogourlnull();
if (response.data.setting.tab_logo_url) {
this.gettablogourldata(response);
}
} else {
this.gettablogourlnull();
}
}).catch((error) => {
this.gettablogourlnull();
@ -579,6 +552,7 @@ class NewHeader extends Component {
let search_url = settings && settings.common && settings.common.length> 0 && settings.common.filter(item=>item.name==="搜索");
let notice_url = settings && settings.common && settings.common.length> 0 && settings.common.filter(item=>item.name==="通知");
return (
<div className="newHeaders" id="nHeader">
<div className="headerContent">