diff --git a/fangija-zsyf/main.html b/fangija-zsyf/main.html index b0b0305..7ac35c6 100644 --- a/fangija-zsyf/main.html +++ b/fangija-zsyf/main.html @@ -35,17 +35,17 @@ 首页 - + 行情 - + 评估 - + 我的 @@ -72,8 +72,6 @@ localStorage.removeItem("user_token"); localStorage.removeItem("user_token_add_time"); } - //document.getElementById("quotations").setAttribute("href", BASE_PATH + '/quotations/index'); - //document.getElementById("selfInfo").setAttribute("href", BASE_PATH + '/selfInfo/index'); //mui初始化 mui.init(); var subpages = ['yfindex.html', 'views/house/houseDetail.html', 'views/house/houseManageList.html', 'views/user/userInfo.html']; @@ -217,6 +215,43 @@ } }) } + + + // 推送消息跳转页面 + window.addEventListener('switchView',function(event){ + console.log(event.detail.name) + plus.webview.show(plus.webview.getWebviewById("HBuilder")); + var targetTab = event.detail.name; + if (targetTab == activeTab) { + return; + } + //若为iOS平台或非首次显示,则直接显示 + if(mui.os.ios||aniShow[targetTab]){ + if(plus.webview.getWebviewById(targetTab)==null){ + plus.webview.create(targetTab, targetTab, subpage_style) + } + plus.webview.show(targetTab); + }else{ + //否则,使用fade-in动画,且保存变量 + var temp = {}; + temp[targetTab] = "true"; + mui.extend(aniShow,temp); + plus.webview.show(targetTab,"fade-in",300); + } + //隐藏当前; + plus.webview.hide(activeTab); + //更改当前活跃的选项卡 + activeTab = targetTab; + var defaultTab = document.getElementById(targetTab); + //模拟首页点击 + mui.trigger(defaultTab, 'tap'); + //切换选项卡高亮 + var current = document.querySelector(".mui-bar-tab>.mui-tab-item.mui-active"); + if (defaultTab !== current) { + current.classList.remove('mui-active'); + defaultTab.classList.add('mui-active'); + } + });