index.html 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
  6. <title></title>
  7. <link href="css/mui.min.css" rel="stylesheet"/>
  8. <link href="css/main.css" rel="stylesheet"/>
  9. </head>
  10. <body>
  11. <header class="mui-bar mui-bar-nav">
  12. <h1 class="mui-title">新农宝盒V2</h1>
  13. </header>
  14. <div class="mui-content maze-content">
  15. <a type="button" class="mui-btn mui-btn-block mui-btn-outlined maze-login" id="login" style="display:;">登 录</a>
  16. <div id="main" style="display:none;">
  17. <a type="button" id="main_device" class="mui-btn mui-btn-block mui-btn-outlined maze-login" style="display:;">设备管理</a>
  18. </div>
  19. <div class="mui-slider">
  20. <div class="mui-slider-group">
  21. <div class="mui-slider-item"><a href="#"><img src="img/focus/1.jpg" /></a></div>
  22. <div class="mui-slider-item"><a href="#"><img src="img/focus/2.jpg" /></a></div>
  23. <div class="mui-slider-item"><a href="#"><img src="img/focus/3.jpg" /></a></div>
  24. </div>
  25. </div>
  26. <ul class="mui-table-view maze-foot">
  27. <li class="mui-table-view-cell">客服电话:187-0113-9598</li>
  28. </ul>
  29. </div>
  30. <script src="js/mui.min.js"></script>
  31. <script src="js/main.js"></script>
  32. <script src="js/login.js"></script>
  33. <script type="text/javascript" charset="utf-8">
  34. (function($, self) {
  35. $.init({
  36. preloadPages:[{
  37. id:'login',
  38. url:'login.html'
  39. }
  40. ]
  41. });
  42. $.plusReady(function()
  43. {
  44. var state = app.getState();
  45. if(state.token)
  46. {
  47. //self.getElementById('main_user').innerText = state.account + ',您好!';
  48. self.getElementById('login').style.display = 'none';
  49. self.getElementById('main').style.display = 'block';
  50. }
  51. else
  52. {
  53. self.getElementById('login').style.display = 'block';
  54. self.getElementById('main').style.display = 'none';
  55. }
  56. //获得slider插件对象
  57. var gallery = $('.mui-slider');
  58. gallery.slider({
  59. interval:1000//自动轮播周期,若为0则不自动播放,默认为0;
  60. });
  61. var loginButton = self.getElementById('login');
  62. loginButton.addEventListener('tap', function(event)
  63. {
  64. $.openWindow({
  65. url: 'login.html',
  66. id: 'login',
  67. preload: true,
  68. show: {
  69. aniShow: 'pop-in'
  70. },
  71. styles: {
  72. popGesture: 'hide'
  73. },
  74. waiting: {
  75. autoShow: false
  76. }
  77. });
  78. }, false);
  79. var mainButton = self.getElementById('main');
  80. mainButton.addEventListener('tap', function(event)
  81. {
  82. var v = plus.webview.getWebviewById('main');
  83. $.openWindow({
  84. url: 'main.html',
  85. id: 'main',
  86. //preload: true,
  87. show: {
  88. aniShow: 'pop-in'
  89. },
  90. styles: {
  91. popGesture: 'hide'
  92. },
  93. waiting: {
  94. autoShow: true
  95. }
  96. });
  97. }, false);
  98. window.addEventListener('resize', function() {
  99. oauthArea.style.display = document.body.clientHeight > 400 ? 'block' : 'none';
  100. }, false);
  101. //
  102. //处理逻辑:1秒内,连续两次按返回键,则退出应用;
  103. var first = null;
  104. plus.key.addEventListener('backbutton', function(){
  105. //首次按键,提示‘再按一次退出应用’
  106. if(!first){
  107. first = new Date().getTime();
  108. mui.toast('再按一次退出应用');
  109. setTimeout(function(){
  110. first = null;
  111. },1000);
  112. }else{
  113. if(new Date().getTime()-first<1000){
  114. plus.runtime.quit();
  115. }
  116. }
  117. }, false);
  118. });
  119. }(mui, document));
  120. </script>
  121. </body>
  122. </html>