|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180 |
- <!DOCTYPE html>
- <html>
-
- <head>
- <meta charset="utf-8">
- <title>Hello MUI</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">
- <link rel="stylesheet" href="css/style.css">
- <link rel="stylesheet" href="css/icons-extra.css">
-
- <style>
- html,
- body {
- background-color: #efeff4;
- }
-
- .mui-bar {
- background-color: #c70f1a;
- }
-
- .mui-title {
- color: #FFFFFF;
- }
- </style>
- </head>
-
- <body>
-
- <style>
- .mui-control-content .mui-loading {
- margin-top: 50px;
- }
- </style>
-
- <header class="mui-bar mui-bar-nav">
- <h1 id="title" class="mui-title"><img style="max-width:220px; height: 33px; padding-top: 8px;" src="images/h_logo.png"></h1>
- </header>
- <nav class="mui-bar mui-bar-tab">
- <a id="defaultTab" class="mui-tab-item mui-active" href="index.html">
- <span class="mui-icon mui-icon-extra mui-icon-extra-class"></span>
- <span class="mui-tab-label">学院</span>
- </a>
-
- <a id="applyTab" class="mui-tab-item " href="apply.html">
- <span class="mui-icon mui-icon mui-icon-compose"></span>
- <span class="mui-tab-label">报名</span>
- </a>
- <a class="mui-tab-item " href="interact.html">
- <span class="mui-icon mui-icon mui-icon-chat"></span>
- <span class="mui-tab-label">互动</span>
- </a>
-
- <a class="mui-tab-item" href="personage.html">
- <span class="mui-icon mui-icon-person"></span>
- <span class="mui-tab-label">个人</span>
- </a>
-
- </nav>
-
- <script src="js/mui.min.js"></script>
- <script type="text/javascript" charset="utf-8">
- //打开校区tab
- function GoScholldTab() {
- 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');
- }
- }
- //mui初始化
- mui.init();
- var subpages = ['index.html', 'apply.html', 'interact.html', 'personage.html'];
- var subpage_style = {
- top: '45px',
- bottom: '51px'
- };
-
- var aniShow = {};
-
- //创建子页面,首个选项卡页面显示,其它均隐藏;
- mui.plusReady(function() {
- try {
- plus.webview.currentWebview().opener().close();
- } catch (e) {}
- var B = window.plus.bridge;
- var Yuntx = {
- Logout: function(successCallback, errorCallback) {
- var success = typeof successCallback !== 'function' ? null : function(args) {
- successCallback(args);
- },
- fail = typeof errorCallback !== 'function' ? null : function(code) {
- errorCallback(code);
- },
- callbackID = B.callbackId(success, fail);
- return B.exec("Yuntx", "Logout", [callbackID]);
- }
- };
- window.plus.Yuntx = Yuntx;
- var self = plus.webview.currentWebview();
- 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 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 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);
- } else {
- //否则,使用fade-in动画,且保存变量
- var temp = {};
- temp[targetTab] = "true";
- mui.extend(aniShow, temp);
- plus.webview.show(targetTab);
- }
- //隐藏当前;
- plus.webview.hide(activeTab);
- //更改当前活跃的选项卡
- activeTab = targetTab;
- });
-
- var backButtonPress = 0;
- mui.back = function(event) {
- backButtonPress++;
- if (backButtonPress > 1) {
- //logout yuntx
- plus.Yuntx.Logout(
- function(contact) { //成功
- },
- function(status) { //失败
-
- });
- plus.runtime.quit();
- } else {
- plus.nativeUI.toast('再按一次退出应用');
- }
- setTimeout(function() {
- backButtonPress = 0;
- }, 1000);
- return false;
- };
- </script>
- </body>
-
- </html>
|