main.html 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,initial-scale=1.0,width=device-width" />
  6. <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
  7. <title>APP</title>
  8. <link rel="stylesheet" type="text/css" href="../../css/api.css" />
  9. <!--<link rel="stylesheet" type="text/css" href="./css/aui.css" />-->
  10. <link rel="stylesheet" type="text/css" href="../../css/aui-win.css" />
  11. <link rel="stylesheet" type="text/css" href="../../css/iconfont.css" />
  12. <style type="text/css">
  13. body, html {
  14. width: 100%;
  15. height: 100%;
  16. }
  17. .aui-nav .aui-bar-tab {
  18. background: #fff;
  19. }
  20. .aui-bar {
  21. text-align: center;
  22. height: 3.3rem;
  23. }
  24. #footer {
  25. border-top: 1px solid #ddd;
  26. }
  27. .btn-icon {
  28. width: 1.2rem;
  29. margin: 0 auto;
  30. margin-bottom: 3px;
  31. }
  32. .aui-bar-tab .aui-bar-tab-item {
  33. padding: 10px 0;
  34. box-sizing: border-box;
  35. }
  36. .aui-bar1 {
  37. position: relative;
  38. top: 0;
  39. right: 0;
  40. left: 0;
  41. z-index: 10;
  42. width: 100%;
  43. min-height: 2.25rem;
  44. font-size: 0.9rem;
  45. text-align: center;
  46. display: table;
  47. }
  48. /*底部切换栏*/
  49. .aui-bar-tab1 {
  50. position: fixed;
  51. top: auto;
  52. bottom: 0;
  53. table-layout: fixed;
  54. background-color: #ffffff;
  55. color: #757575;
  56. }
  57. .aui-bar-tab1 .aui-bar-tab-item {
  58. display: table-cell;
  59. position: relative;
  60. width: 1%;
  61. height: 2.5rem;
  62. text-align: center;
  63. vertical-align: middle;
  64. padding: 5px 0;
  65. }
  66. .aui-bar-tab-label {
  67. font-size: 0.8rem;
  68. margin-top: -5px;
  69. }
  70. .myBg {
  71. background: linear-gradient(45deg, #005fa3, #00a0ea) !important;
  72. }
  73. </style>
  74. </head>
  75. <body>
  76. </body>
  77. <script type="text/javascript" src="../../script/api.js"></script>
  78. <script type="text/javascript" src="../../script/aui-tab.js" ></script>
  79. <script type="text/javascript">
  80. apiready = function() {
  81. var loginid = $api.getStorage("pertel");
  82. var body_h = $api.offset($api.dom('body')).h;
  83. // openFrameGroup(headerPos, body_h, footer_h);
  84. if (loginid == "" || typeof loginid == 'undefined') {
  85. /// 登录页面
  86. setTimeout(function() {
  87. openLogin(0, body_h,0);
  88. }, 200);
  89. } else {
  90. openFrame(0, body_h,0);
  91. };
  92. api.addEventListener({
  93. name: 'keyback'
  94. }, function(ret, err){
  95. if( ret ){
  96. setTimeout(function(){
  97. api.confirm({
  98. title : "提醒",
  99. msg : "即将退回到登录页?",
  100. buttons : ["取消","确认"],
  101. }, function(ret, err) {
  102. if(ret.buttonIndex==2){
  103. api.sendEvent({
  104. name: 'rebacklogin'
  105. });
  106. $api.clearStorage();
  107. api.openWin({
  108. name : 'login',
  109. url : '../login.html',
  110. rect : {
  111. x : 0,
  112. y : 0,
  113. w : 'auto',
  114. h : 0
  115. },
  116. animation : {
  117. type : "none", //动画类型(详见动画类型常量)
  118. subType : "from_right", //动画子类型(详见动画子类型常量)
  119. duration : 200 //动画过渡时间,默认300毫秒
  120. }
  121. });
  122. }
  123. });
  124. },300);
  125. }else{
  126. alert( JSON.stringify( err ) );
  127. }
  128. });
  129. /// 打开页面组
  130. api.addEventListener({
  131. name : 'openFrame'
  132. }, function(ret, err) {
  133. //coding...
  134. openFrame(0, body_h,0);
  135. setTimeout(function() {
  136. api.closeWin({
  137. name : 'login',
  138. animation : {
  139. type : "push", //动画类型(详见动画类型常量)
  140. subType : "from_right", //动画子类型(详见动画子类型常量)
  141. duration : 300
  142. }
  143. });
  144. }, 1200);
  145. });
  146. var tab = new auiTab({
  147. element : document.getElementById("footer"),
  148. }, function(ret) {
  149. if (ret.index == 1) {
  150. $api.attr($api.byId('index1'), 'src', '../../image/img/images/tabar_home_active.png');
  151. $api.attr($api.byId('index2'), 'src', '../../image/img/images/wode.png');
  152. } else {
  153. $api.attr($api.byId('index1'), 'src', '../../image/img/images/tabar_home_inactive.png');
  154. $api.attr($api.byId('index2'), 'src', '../../image/img/images/wode_active.png');
  155. }
  156. api.setFrameGroupIndex({
  157. name : 'indexGroup',
  158. index : (ret.index - 1),
  159. });
  160. });
  161. };
  162. // 打开登陆页面
  163. function openLogin(headerPos, body_h, footer_h) {
  164. api.openWin({
  165. name : 'login',
  166. url : '../login.html',
  167. rect : {
  168. x : 0,
  169. y : 0,
  170. w : 'auto',
  171. h : body_h - footer_h - headerPos.h
  172. },
  173. animation : {
  174. type : "none", //动画类型(详见动画类型常量)
  175. subType : "from_right", //动画子类型(详见动画子类型常量)
  176. duration : 200 //动画过渡时间,默认300毫秒
  177. }
  178. });
  179. }
  180. // 打开页面组
  181. function openFrame(headerPos, body_h, footer_h) {
  182. console.log(body_h)
  183. api.openFrame({
  184. name : 'tmslist',
  185. url : './pages/home/tms/tmsList.html',
  186. rect : {
  187. x : 0,
  188. y : 0,
  189. w : 'auto',
  190. h : body_h
  191. },
  192. animation : {
  193. type : "none", //动画类型(详见动画类型常量)
  194. subType : "from_right", //动画子类型(详见动画子类型常量)
  195. duration : 200 //动画过渡时间,默认300毫秒
  196. }
  197. });
  198. }
  199. </script>
  200. </html>