| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <title></title>
- <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=0, minimum-scale=1, maximum-scale=1, viewport-fit=cover">
- <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">
- <link rel="stylesheet" href="css/iconfont.css" />
- <style>
- html,
- body {
- background-color: #efeff4;
- }
-
- .mui-bar-nav {
- background-color: #cd0000!important;
- padding-right: 15px;
- }
- .mui-bar .mui-icon {
- font-size: 20px!important;
-
- }
- .mui-bar-tab{
- bottom: 0;
- display: table;
- width: 100%;
-
- z-index: 111111;
- }
- </style>
- </head>
- <body>
- <header class="mui-bar mui-bar-nav" style="height: 45px !important;">
- <h1 id="title" class="mui-title" style="color: #FFFFFF;">我的任务</h1>
- </header>
- <div class="mui-content">
- <div id="topPopover" class="mui-popover">
- <div class="mui-popover-arrow"></div>
- <div class="mui-scroll-wrapper">
- <div class="mui-scroll">
- <ul class="mui-table-view">
- <li class="mui-table-view-cell">
- <a href="#">Item1</a>
- </li>
- <li class="mui-table-view-cell">
- <a href="#">Item2</a>
- </li>
- <li class="mui-table-view-cell">
- <a href="#">Item3</a>
- </li>
- <li class="mui-table-view-cell">
- <a href="#">Item4</a>
- </li>
- <li class="mui-table-view-cell">
- <a href="#">Item5</a>
- </li>
- <li class="mui-table-view-cell">
- <a href="#">Item6</a>
- </li>
- <li class="mui-table-view-cell">
- <a href="#">Item7</a>
- </li>
- <li class="mui-table-view-cell">
- <a href="#">Item8</a>
- </li>
- <li class="mui-table-view-cell">
- <a href="#">Item9</a>
- </li>
- <li class="mui-table-view-cell">
- <a href="#">Item10</a>
- </li>
- </ul>
- </div>
- </div>
- </div>
- </div>
- <nav class="mui-bar mui-bar-tab">
- <a id="defaultTab" class="mui-tab-item mui-active" href="personal.html">
- <span class="mui-icon iconfont icon-gongzuojiaoban"></span>
- <span class="mui-tab-label">我的任务</span>
- </a>
- <a class="mui-tab-item" href="tab-phone.html">
- <span class="mui-icon iconfont icon-tongxunlu"></span>
- <span class="mui-tab-label">通讯录</span>
- </a>
- <a class="mui-tab-item" href="Setting-1.html">
- <span class="mui-icon iconfont icon-yonghu"></span>
- <span class="mui-tab-label">我的</span>
- </a>
- </nav>
- <script src="js/mui.min.js"></script>
- <script src="js/index.js"></script>
- <script type="text/javascript" charset="utf-8">
- //mui初始化
- mui.init();
- var subpages = ['personal.html', 'tab-phone.html', 'Setting-1.html'];
- var nav = document.querySelector(".mui-bar-tab");
- var aniShow = {};
- if (isIPhoneX()) {
- subpage_style = {
- top: '45px',
- bottom: '70px', //34px
- //styles: {height: '150px',top: '44px',bottom: '44px'}
- styles: {
- "render": "always"
- }
- };
- nav.style.cssText="bottom: -1px; height: 85px; background-color: #efeef3; border-top: 1px solid #000;";
- }else{
- var subpage_style = {
- top: '45px',
- bottom: '51px'
- };
- }
- //创建子页面,首个选项卡页面显示,其它均隐藏;
- mui.plusReady(function() {
- // alert(isIPhoneX())
- var self = plus.webview.currentWebview();
- //alert(plus.device.model);
- self.show('slide-in-right', 300);
- plus.nativeUI.closeWaiting();
- for (var i = 0; i < 4; 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);
- }
- });
- //当前激活选项
- var activeTab = subpages[0];
- var title = document.getElementById("title");
- //选项卡点击事件
- mui('.mui-bar-tab').on('tap', 'a', function(e) {
- var targetTab = this.getAttribute('href');
- if (targetTab == activeTab) {
- return;
- }
- //更换标题
- title.innerHTML = this.querySelector('.mui-tab-label').innerHTML;
- //显示目标选项卡
- //若为iOS平台或非首次显示,则直接显示
- if (mui.os.ios || aniShow[targetTab]) {
- plus.webview.show(targetTab, 1000);
- } else {
- //否则,使用fade-in动画,且保存变量
- var temp = {};
- temp[targetTab] = "true";
- mui.extend(aniShow, temp);
- plus.webview.show(targetTab, "fade-in", 1000);
- }
- //隐藏当前;
- plus.webview.hide(activeTab);
- //更改当前活跃的选项卡
- activeTab = targetTab;
- });
- //自定义事件,模拟点击“首页选项卡”
- document.addEventListener('gohome', function() {
- var defaultTab = document.getElementById("defaultTab");
- //模拟首页点击
- 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');
- }
- });
- //点击两次就退出软件
- var backcount = 0;
- mui.back = function() {
- if (mui.os.ios) return;
- if (backcount > 0) {
- if (window.plus) plus.runtime.quit();
- return;
- };
- mui.toast('再按一次退出应用');
- backcount++;
- setTimeout(function() {
- backcount = 0;
- }, 2000);
- };
- function isIPhoneX() {
- if (plus.device.model.indexOf('iPhone') > -1 && screen.height >= 812) {
- return true;
- } else {
- return false;
- }
- }
- </script>
- </body>
- </html>
|