ENH: Optimize Some Feature
1, Show/Hide OnlineModels When Quick Switch in Perference 2, Fix New Tag show of Left Menu JIRA: none Change-Id: Ie52c5b4a178d049259f9762c05dfb3decc5b5ca9
This commit is contained in:
parent
d9e47bd9a9
commit
82775a1a59
|
@ -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);
|
||||
|
@ -144,16 +144,13 @@ function HandleStudio( pVal )
|
|||
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);
|
||||
|
@ -162,9 +159,6 @@ function HandleStudio( pVal )
|
|||
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;a<PickTotal;a++)
|
||||
{
|
||||
|
@ -629,6 +626,9 @@ function Show4UPick( ModelList )
|
|||
return;
|
||||
}
|
||||
|
||||
$("#Online_Models_Bar").css('display','none');
|
||||
$("#ForU_Models_Bar").css('display','flex');
|
||||
|
||||
let strPickHtml='';
|
||||
for(let a=0;a<PickTotal;a++)
|
||||
{
|
||||
|
|
|
@ -529,6 +529,8 @@ void WebViewPanel::SendDesignStaffpick(bool on)
|
|||
return;
|
||||
}
|
||||
CallAfter([this, body] {
|
||||
if (!wxGetApp().has_model_mall()) return;
|
||||
|
||||
auto body2 = from_u8(body);
|
||||
body2.insert(1, "\"command\": \"modelmall_model_advise_get\", ");
|
||||
RunScript(wxString::Format("window.postMessage(%s)", body2));
|
||||
|
@ -546,6 +548,8 @@ void WebViewPanel::SendDesignStaffpick(bool on)
|
|||
return;
|
||||
}
|
||||
CallAfter([this, body] {
|
||||
if (!wxGetApp().has_model_mall()) return;
|
||||
|
||||
auto body2 = from_u8(body);
|
||||
body2.insert(1, "\"command\": \"modelmall_model_customized_get\", ");
|
||||
RunScript(wxString::Format("window.postMessage(%s)", body2));
|
||||
|
@ -569,6 +573,8 @@ void WebViewPanel::SendDesignStaffpick(bool on)
|
|||
return;
|
||||
}
|
||||
CallAfter([this, body] {
|
||||
if (!wxGetApp().has_model_mall()) return;
|
||||
|
||||
auto body2 = from_u8(body);
|
||||
body2.insert(1, "\"command\": \"modelmall_model_advise_get\", ");
|
||||
RunScript(wxString::Format("window.postMessage(%s)", body2));
|
||||
|
@ -1261,11 +1267,7 @@ void WebViewPanel::SwitchWebContent(std::string modelname,int refresh)
|
|||
{
|
||||
m_contentname = modelname;
|
||||
|
||||
static bool bFirst = false;
|
||||
if (bFirst == false) {
|
||||
bFirst = true;
|
||||
CheckMenuNewTag();
|
||||
}
|
||||
CheckMenuNewTag();
|
||||
|
||||
wxString strlang = wxGetApp().current_language_code_safe();
|
||||
|
||||
|
@ -1287,6 +1289,7 @@ void WebViewPanel::SwitchWebContent(std::string modelname,int refresh)
|
|||
//conf save
|
||||
wxGetApp().app_config->set_str("homepage", "makerlab_clicked", "1");
|
||||
wxGetApp().app_config->save();
|
||||
wxGetApp().CallAfter([this] { ShowMenuNewTag("makerlab", "0"); });
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue