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")
|
else if( strCmd=="modelmall_model_advise_get")
|
||||||
{
|
{
|
||||||
//alert('hot');
|
//alert('hot');
|
||||||
if( m_HotModelList!=null )
|
if( m_HotModelList!=null && pVal['hits'].length>0 )
|
||||||
{
|
{
|
||||||
let SS1=JSON.stringify(pVal['hits']);
|
let SS1=JSON.stringify(pVal['hits']);
|
||||||
let SS2=JSON.stringify(m_HotModelList);
|
let SS2=JSON.stringify(m_HotModelList);
|
||||||
|
@ -143,17 +143,14 @@ function HandleStudio( pVal )
|
||||||
if( SS1==SS2 )
|
if( SS1==SS2 )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$("#Online_Models_Bar").css('display','flex');
|
|
||||||
$("#ForU_Models_Bar").css('display','none');
|
|
||||||
|
|
||||||
m_HotModelList=pVal['hits'];
|
m_HotModelList=pVal['hits'];
|
||||||
ShowStaffPick( m_HotModelList );
|
ShowStaffPick( m_HotModelList );
|
||||||
}
|
}
|
||||||
else if( strCmd=="modelmall_model_customized_get")
|
else if( strCmd=="modelmall_model_customized_get")
|
||||||
{
|
{
|
||||||
//alert('hot');
|
//alert('For U');
|
||||||
if( m_ForUModelList!=null )
|
if( m_ForUModelList!=null && pVal['hits'].length>0 )
|
||||||
{
|
{
|
||||||
let SS1=JSON.stringify(pVal['hits']);
|
let SS1=JSON.stringify(pVal['hits']);
|
||||||
let SS2=JSON.stringify(m_ForUModelList);
|
let SS2=JSON.stringify(m_ForUModelList);
|
||||||
|
@ -161,9 +158,6 @@ function HandleStudio( pVal )
|
||||||
if( SS1==SS2 )
|
if( SS1==SS2 )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$("#Online_Models_Bar").css('display','none');
|
|
||||||
$("#ForU_Models_Bar").css('display','flex');
|
|
||||||
|
|
||||||
m_ForUModelList=pVal['hits'];
|
m_ForUModelList=pVal['hits'];
|
||||||
Show4UPick( m_ForUModelList );
|
Show4UPick( m_ForUModelList );
|
||||||
|
@ -574,6 +568,9 @@ function ShowStaffPick( ModelList )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$("#Online_Models_Bar").css('display','flex');
|
||||||
|
$("#ForU_Models_Bar").css('display','none');
|
||||||
|
|
||||||
let strPickHtml='';
|
let strPickHtml='';
|
||||||
for(let a=0;a<PickTotal;a++)
|
for(let a=0;a<PickTotal;a++)
|
||||||
{
|
{
|
||||||
|
@ -629,6 +626,9 @@ function Show4UPick( ModelList )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$("#Online_Models_Bar").css('display','none');
|
||||||
|
$("#ForU_Models_Bar").css('display','flex');
|
||||||
|
|
||||||
let strPickHtml='';
|
let strPickHtml='';
|
||||||
for(let a=0;a<PickTotal;a++)
|
for(let a=0;a<PickTotal;a++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -529,6 +529,8 @@ void WebViewPanel::SendDesignStaffpick(bool on)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
CallAfter([this, body] {
|
CallAfter([this, body] {
|
||||||
|
if (!wxGetApp().has_model_mall()) return;
|
||||||
|
|
||||||
auto body2 = from_u8(body);
|
auto body2 = from_u8(body);
|
||||||
body2.insert(1, "\"command\": \"modelmall_model_advise_get\", ");
|
body2.insert(1, "\"command\": \"modelmall_model_advise_get\", ");
|
||||||
RunScript(wxString::Format("window.postMessage(%s)", body2));
|
RunScript(wxString::Format("window.postMessage(%s)", body2));
|
||||||
|
@ -546,6 +548,8 @@ void WebViewPanel::SendDesignStaffpick(bool on)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
CallAfter([this, body] {
|
CallAfter([this, body] {
|
||||||
|
if (!wxGetApp().has_model_mall()) return;
|
||||||
|
|
||||||
auto body2 = from_u8(body);
|
auto body2 = from_u8(body);
|
||||||
body2.insert(1, "\"command\": \"modelmall_model_customized_get\", ");
|
body2.insert(1, "\"command\": \"modelmall_model_customized_get\", ");
|
||||||
RunScript(wxString::Format("window.postMessage(%s)", body2));
|
RunScript(wxString::Format("window.postMessage(%s)", body2));
|
||||||
|
@ -569,6 +573,8 @@ void WebViewPanel::SendDesignStaffpick(bool on)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
CallAfter([this, body] {
|
CallAfter([this, body] {
|
||||||
|
if (!wxGetApp().has_model_mall()) return;
|
||||||
|
|
||||||
auto body2 = from_u8(body);
|
auto body2 = from_u8(body);
|
||||||
body2.insert(1, "\"command\": \"modelmall_model_advise_get\", ");
|
body2.insert(1, "\"command\": \"modelmall_model_advise_get\", ");
|
||||||
RunScript(wxString::Format("window.postMessage(%s)", body2));
|
RunScript(wxString::Format("window.postMessage(%s)", body2));
|
||||||
|
@ -1261,11 +1267,7 @@ void WebViewPanel::SwitchWebContent(std::string modelname,int refresh)
|
||||||
{
|
{
|
||||||
m_contentname = modelname;
|
m_contentname = modelname;
|
||||||
|
|
||||||
static bool bFirst = false;
|
CheckMenuNewTag();
|
||||||
if (bFirst == false) {
|
|
||||||
bFirst = true;
|
|
||||||
CheckMenuNewTag();
|
|
||||||
}
|
|
||||||
|
|
||||||
wxString strlang = wxGetApp().current_language_code_safe();
|
wxString strlang = wxGetApp().current_language_code_safe();
|
||||||
|
|
||||||
|
@ -1287,7 +1289,8 @@ void WebViewPanel::SwitchWebContent(std::string modelname,int refresh)
|
||||||
//conf save
|
//conf save
|
||||||
wxGetApp().app_config->set_str("homepage", "makerlab_clicked", "1");
|
wxGetApp().app_config->set_str("homepage", "makerlab_clicked", "1");
|
||||||
wxGetApp().app_config->save();
|
wxGetApp().app_config->save();
|
||||||
|
wxGetApp().CallAfter([this] { ShowMenuNewTag("makerlab", "0"); });
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (modelname.compare("online") == 0) {
|
else if (modelname.compare("online") == 0) {
|
||||||
|
@ -1329,6 +1332,7 @@ void WebViewPanel::SwitchWebContent(std::string modelname,int refresh)
|
||||||
// conf save
|
// conf save
|
||||||
wxGetApp().app_config->set_str("homepage", "online_clicked", "1");
|
wxGetApp().app_config->set_str("homepage", "online_clicked", "1");
|
||||||
wxGetApp().app_config->save();
|
wxGetApp().app_config->save();
|
||||||
|
wxGetApp().CallAfter([this] { ShowMenuNewTag("online", "0"); });
|
||||||
}
|
}
|
||||||
else if (modelname.compare("home") == 0 || modelname.compare("recent") == 0 || modelname.compare("manual") == 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() {
|
void WebViewPanel::CheckMenuNewTag() {
|
||||||
std::string sClick = wxGetApp().app_config->get("homepage", "online_clicked");
|
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");
|
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)
|
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;
|
m_Res["menu"] = menuname;
|
||||||
|
|
||||||
|
|
||||||
if (show != "1")
|
if (show.compare("1") == 0)
|
||||||
m_Res["show"] = 1;
|
m_Res["show"] = 1;
|
||||||
else
|
else
|
||||||
m_Res["show"] = 0;
|
m_Res["show"] = 0;
|
||||||
|
|
Loading…
Reference in New Issue