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()
|
||||
{
|
||||
TranslatePage();
|
||||
|
||||
SendMsg_GetStaffPick();
|
||||
}
|
||||
|
||||
//------最佳打开文件的右键菜单功能----------
|
||||
|
|
|
@ -912,7 +912,10 @@ void WebViewPanel::OnNavigationRequest(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())
|
||||
{
|
||||
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
|
||||
|
@ -1252,6 +1255,7 @@ void WebViewPanel::OnError(wxWebViewEvent& evt)
|
|||
if (evt.GetInt() == wxWEBVIEW_NAV_ERR_CONNECTION && evt.GetId() == m_browserMW->GetId())
|
||||
{
|
||||
m_onlinefirst = false;
|
||||
m_online_LastUrl = m_browserMW->GetCurrentURL();
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
m_browser->LoadURL(UrlRight);
|
||||
m_browser->Show();
|
||||
m_browserMW->Hide();
|
||||
m_browserMW->LoadURL(UrlRight);
|
||||
|
||||
SetWebviewShow("online", true);
|
||||
SetWebviewShow("right", false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1319,9 +1324,13 @@ void WebViewPanel::SwitchWebContent(std::string modelname, int refresh)
|
|||
m_online_spec_id = "";
|
||||
} else {
|
||||
if (m_onlinefirst == false) {
|
||||
m_onlinefirst = true;
|
||||
refresh = 1; // Force Refresh
|
||||
|
||||
if (m_online_LastUrl != "") {
|
||||
m_browserMW->LoadURL(m_online_LastUrl);
|
||||
m_online_LastUrl = "";
|
||||
}
|
||||
else
|
||||
m_browserMW->Reload();
|
||||
} else {
|
||||
if (refresh == 1)
|
||||
|
@ -1352,8 +1361,10 @@ void WebViewPanel::SwitchWebContent(std::string modelname, int refresh)
|
|||
|
||||
WebView::RunScript(m_browser, strJS);
|
||||
|
||||
CallAfter([this]{
|
||||
SetWebviewShow("online", false);
|
||||
SetWebviewShow("right", true);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -138,6 +138,7 @@ private:
|
|||
bool m_onlinefirst; //Online Page First Load
|
||||
std::string m_online_spec_id; //Online Page Spec_ID
|
||||
wxString m_online_type; //recommend & browse
|
||||
wxString m_online_LastUrl; //PageLastError Url
|
||||
|
||||
wxBoxSizer *bSizer_toolbar;
|
||||
wxButton * m_button_back;
|
||||
|
|
Loading…
Reference in New Issue