FIX: Homepage bug when network disconnect
JIRA: none Change-Id: I93bb0028332fb167bacabf9b5dc285c73e1870d8
This commit is contained in:
parent
4cb8bac4e2
commit
c11d3c5110
|
@ -36,8 +36,6 @@ function OnRecentInit()
|
||||||
function OnLineInit()
|
function OnLineInit()
|
||||||
{
|
{
|
||||||
TranslatePage();
|
TranslatePage();
|
||||||
|
|
||||||
SendMsg_GetStaffPick();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//------最佳打开文件的右键菜单功能----------
|
//------最佳打开文件的右键菜单功能----------
|
||||||
|
|
|
@ -912,8 +912,11 @@ void WebViewPanel::OnNavigationRequest(wxWebViewEvent& evt)
|
||||||
*/
|
*/
|
||||||
void WebViewPanel::OnNavigationComplete(wxWebViewEvent& evt)
|
void WebViewPanel::OnNavigationComplete(wxWebViewEvent& evt)
|
||||||
{
|
{
|
||||||
if (m_browserMW!=nullptr && evt.GetId() == m_browserMW->GetId()) {
|
if (m_browserMW!=nullptr && evt.GetId() == m_browserMW->GetId())
|
||||||
m_onlinefirst = true;
|
{
|
||||||
|
auto host = wxGetApp().get_model_http_url(wxGetApp().app_config->get_country_code());
|
||||||
|
if(m_browserMW->GetCurrentURL().Contains(host))
|
||||||
|
m_onlinefirst = true;
|
||||||
|
|
||||||
if (m_contentname == "online") { // conf save
|
if (m_contentname == "online") { // conf save
|
||||||
SetWebviewShow("right", false);
|
SetWebviewShow("right", false);
|
||||||
|
@ -1252,6 +1255,7 @@ void WebViewPanel::OnError(wxWebViewEvent& evt)
|
||||||
if (evt.GetInt() == wxWEBVIEW_NAV_ERR_CONNECTION && evt.GetId() == m_browserMW->GetId())
|
if (evt.GetInt() == wxWEBVIEW_NAV_ERR_CONNECTION && evt.GetId() == m_browserMW->GetId())
|
||||||
{
|
{
|
||||||
m_onlinefirst = false;
|
m_onlinefirst = false;
|
||||||
|
m_online_LastUrl = m_browserMW->GetCurrentURL();
|
||||||
|
|
||||||
if (m_contentname == "online")
|
if (m_contentname == "online")
|
||||||
{
|
{
|
||||||
|
@ -1264,9 +1268,10 @@ void WebViewPanel::OnError(wxWebViewEvent& evt)
|
||||||
UrlRight = wxString::Format("file://%s/web/homepage3/disconnect.html?lang=%s", from_u8(resources_dir()), strlang);
|
UrlRight = wxString::Format("file://%s/web/homepage3/disconnect.html?lang=%s", from_u8(resources_dir()), strlang);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_browser->LoadURL(UrlRight);
|
m_browserMW->LoadURL(UrlRight);
|
||||||
m_browser->Show();
|
|
||||||
m_browserMW->Hide();
|
SetWebviewShow("online", true);
|
||||||
|
SetWebviewShow("right", false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1319,10 +1324,14 @@ void WebViewPanel::SwitchWebContent(std::string modelname, int refresh)
|
||||||
m_online_spec_id = "";
|
m_online_spec_id = "";
|
||||||
} else {
|
} else {
|
||||||
if (m_onlinefirst == false) {
|
if (m_onlinefirst == false) {
|
||||||
m_onlinefirst = true;
|
|
||||||
refresh = 1; // Force Refresh
|
refresh = 1; // Force Refresh
|
||||||
|
|
||||||
m_browserMW->Reload();
|
if (m_online_LastUrl != "") {
|
||||||
|
m_browserMW->LoadURL(m_online_LastUrl);
|
||||||
|
m_online_LastUrl = "";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
m_browserMW->Reload();
|
||||||
} else {
|
} else {
|
||||||
if (refresh == 1)
|
if (refresh == 1)
|
||||||
m_browserMW->Reload();
|
m_browserMW->Reload();
|
||||||
|
@ -1352,8 +1361,10 @@ void WebViewPanel::SwitchWebContent(std::string modelname, int refresh)
|
||||||
|
|
||||||
WebView::RunScript(m_browser, strJS);
|
WebView::RunScript(m_browser, strJS);
|
||||||
|
|
||||||
SetWebviewShow("online", false);
|
CallAfter([this]{
|
||||||
SetWebviewShow("right", true);
|
SetWebviewShow("online", false);
|
||||||
|
SetWebviewShow("right", true);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -138,6 +138,7 @@ private:
|
||||||
bool m_onlinefirst; //Online Page First Load
|
bool m_onlinefirst; //Online Page First Load
|
||||||
std::string m_online_spec_id; //Online Page Spec_ID
|
std::string m_online_spec_id; //Online Page Spec_ID
|
||||||
wxString m_online_type; //recommend & browse
|
wxString m_online_type; //recommend & browse
|
||||||
|
wxString m_online_LastUrl; //PageLastError Url
|
||||||
|
|
||||||
wxBoxSizer *bSizer_toolbar;
|
wxBoxSizer *bSizer_toolbar;
|
||||||
wxButton * m_button_back;
|
wxButton * m_button_back;
|
||||||
|
|
Loading…
Reference in New Issue