diff --git a/resources/web/homepage2/js/home.js b/resources/web/homepage2/js/home.js index 770562612..8ca7ae109 100644 --- a/resources/web/homepage2/js/home.js +++ b/resources/web/homepage2/js/home.js @@ -135,7 +135,7 @@ function HandleStudio( pVal ) else if( strCmd=="modelmall_model_advise_get") { //alert('hot'); - if( m_HotModelList!=null ) + if( m_HotModelList!=null && pVal['hits'].length>0 ) { let SS1=JSON.stringify(pVal['hits']); let SS2=JSON.stringify(m_HotModelList); @@ -143,17 +143,14 @@ function HandleStudio( pVal ) if( SS1==SS2 ) return; } - - $("#Online_Models_Bar").css('display','flex'); - $("#ForU_Models_Bar").css('display','none'); m_HotModelList=pVal['hits']; ShowStaffPick( m_HotModelList ); } else if( strCmd=="modelmall_model_customized_get") { - //alert('hot'); - if( m_ForUModelList!=null ) + //alert('For U'); + if( m_ForUModelList!=null && pVal['hits'].length>0 ) { let SS1=JSON.stringify(pVal['hits']); let SS2=JSON.stringify(m_ForUModelList); @@ -161,9 +158,6 @@ function HandleStudio( pVal ) if( SS1==SS2 ) return; } - - $("#Online_Models_Bar").css('display','none'); - $("#ForU_Models_Bar").css('display','flex'); m_ForUModelList=pVal['hits']; Show4UPick( m_ForUModelList ); @@ -574,6 +568,9 @@ function ShowStaffPick( ModelList ) return; } + $("#Online_Models_Bar").css('display','flex'); + $("#ForU_Models_Bar").css('display','none'); + let strPickHtml=''; for(let a=0;aset_str("homepage", "makerlab_clicked", "1"); wxGetApp().app_config->save(); - + wxGetApp().CallAfter([this] { ShowMenuNewTag("makerlab", "0"); }); + return; } else if (modelname.compare("online") == 0) { @@ -1329,6 +1332,7 @@ void WebViewPanel::SwitchWebContent(std::string modelname,int refresh) // conf save wxGetApp().app_config->set_str("homepage", "online_clicked", "1"); wxGetApp().app_config->save(); + wxGetApp().CallAfter([this] { ShowMenuNewTag("online", "0"); }); } else if (modelname.compare("home") == 0 || modelname.compare("recent") == 0 || modelname.compare("manual") == 0 ) { @@ -1377,10 +1381,17 @@ void WebViewPanel::OpenOneMakerlab(std::string url) { void WebViewPanel::CheckMenuNewTag() { std::string sClick = wxGetApp().app_config->get("homepage", "online_clicked"); - ShowMenuNewTag("online", sClick); + if (sClick.compare("1")==0) + ShowMenuNewTag("online", "0"); + else + ShowMenuNewTag("online", "1"); + sClick = wxGetApp().app_config->get("homepage", "makerlab_clicked"); - ShowMenuNewTag("makerlab", sClick); + if (sClick.compare("1") == 0) + ShowMenuNewTag("makerlab", "0"); + else + ShowMenuNewTag("makerlab", "1"); } void WebViewPanel::ShowMenuNewTag(std::string menuname, std::string show) @@ -1395,7 +1406,7 @@ void WebViewPanel::ShowMenuNewTag(std::string menuname, std::string show) m_Res["menu"] = menuname; - if (show != "1") + if (show.compare("1") == 0) m_Res["show"] = 1; else m_Res["show"] = 0;