123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <title></title>
- <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
- <meta name="apple-mobile-web-app-capable" content="yes">
- <meta name="apple-mobile-web-app-status-bar-style" content="black">
- <link rel="stylesheet" href="css/mui.min.css">
- <style>
- html,
- body {
- background-color: #efeff4;
- }
- </style>
- </head>
- <body>
- <header class="mui-bar mui-bar-nav">
- <a id="search-id" class="mui-icon mui-icon-search mui-pull-right" style="display: none;"></a>
- <h1 id="title" class="mui-title"></h1>
- </header>
- <nav class="mui-bar mui-bar-tab">
- <a id="defaultTab" class="mui-tab-item mui-active" href="tab-webview-subpage-first.html">
- <span class="mui-icon mui-icon-contact" style="font-weight: bolder"></span>
- <!--<span class="mui-icon iconfont icon-dianzishu"></span>-->
- <span class="mui-tab-label" style="font-weight: bolder">书 吧</span>
- </a>
- <a search="true" class="mui-tab-item" href="tab-webview-subpage-second.html">
- <span class="mui-icon mui-icon-email" style="font-weight: bolder"></span>
- <span class="mui-tab-label" style="font-weight: bolder">书 架</span>
- </a>
- <a class="mui-tab-item" href="tab-webview-subpage-third.html">
- <span class="mui-icon mui-icon-gear" style="font-weight: bolder"></span>
- <span class="mui-tab-label" style="font-weight: bolder">设 置</span>
- </a>
- </nav>
- <!--
- 作者:HZC
- 时间:2015-09-04
- 描述:主页
- -->
- <script src="js/mui.min.js" type="text/javascript" charset="UTF-8"></script>
- <script src="js/app.js" type="text/javascript" charset="utf-8"></script>
- <script src="js/db/service.js" type="text/javascript" charset="utf-8"></script>
- <script type="text/javascript" charset="utf-8">
- //mui初始化
- mui.init();
- var subpages = ['tab-webview-subpage-first.html', 'tab-webview-subpage-second.html', 'tab-webview-subpage-third.html'];
- var subpage_style = {
- top: '46px',
- bottom: '50px'
- };
- var aniShow = {};
- mui.plusReady(function() {
- plus.screen.lockOrientation("portrait");
- //当前激活选项
- window.activeTab = subpages[0];
- window.title = document.getElementById("title");
- tapBar();
- myInit();
- doSearch();
- });
-
- /**
- * 初始化
- * 创建子页面,首个选项卡页面显示,其它均隐藏;
- */
- function myInit() {
- //模拟首页点击
- var defaultTab = document.getElementById("defaultTab");
- mui.trigger(defaultTab, 'tap');
- var self = plus.webview.currentWebview();
- for (var i = 0; i < 3; i++) {
- var temp = {};
- var sub = plus.webview.create(subpages[i], subpages[i], subpage_style);
- if (i > 0) {
- sub.hide();
- } else {
- temp[subpages[i]] = "true";
- mui.extend(aniShow, temp);
- }
- self.append(sub);
- }
- }
- /**
- * 选项卡点击事件
- */
- function tapBar() {
- mui('.mui-bar-tab').on('tap', 'a', function(e) {
- var targetTab = this.getAttribute('href');
- //更换标题
- window.title.innerHTML = this.querySelector('.mui-tab-label').innerHTML;;
- if (targetTab == window.activeTab) {
- return;
- }
- if (this.getAttribute('search') == 'true') {
- document.getElementById("search-id").style.display = 'block';
- } else {
- document.getElementById("search-id").style.display = 'none';
- }
- //显示目标选项卡
- if (mui.os.ios /*|| aniShow[targetTab]*/) {
- plus.webview.show(targetTab);
- } else {
- var temp = {};
- temp[targetTab] = "true";
- mui.extend(aniShow, temp);
- plus.webview.show(targetTab, "fade-in", 300);
- }
- //隐藏当前;
- plus.webview.hide(window.activeTab);
- //更改当前活跃的选项卡
- window.activeTab = targetTab;
- });
- }
- /**
- * 点击搜索
- */
- function doSearch() {
- document.getElementById("search-id").addEventListener('tap', function() {
- if (toastNetworkInfo('当前网络不可用')) {
- mui.openWindow({
- id: 'search-id',
- url: 'app/search.html',
- show: {
- duration: 200
- }
- });
- }
- });
- }
- //退出
- var backButtonPress = 0;
- mui.back = function(event) {
- backButtonPress++;
- if (backButtonPress > 1) {
- plus.runtime.quit();
- } else {
- plus.nativeUI.toast('再按一次退出应用');
- }
- setTimeout(function() {
- backButtonPress = 0;
- }, 1000);
- return false;
- };
- </script>
- </body>
- </html>
|