index.html 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  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. </style>
  71. </head>
  72. <body>
  73. <!--<header class="aui-bar aui-bar-nav aui-bar-info theme1" id="aui-header">
  74. <div class="aui-title">
  75. 金宇轮胎门店端
  76. </div>
  77. </header>-->
  78. <header class="aui-bar aui-bar-nav aui-bar-info" id="aui-header">
  79. <div class="aui-title" id="aui-title">
  80. 赛轮商城经销商APP
  81. </div>
  82. </header>
  83. <footer class="aui-bar1 aui-bar-tab1" id="footer">
  84. <div class="aui-bar-tab-item aui-active" tapmode onclick="randomSwitchBtn(0,'main')">
  85. <img src="image/drawable-xhdpi/main_active.png" id="index1" class="btn-icon"/>
  86. <div class="aui-bar-tab-label">
  87. 首页
  88. </div>
  89. </div>
  90. <div class="aui-bar-tab-item" tapmode onclick="randomSwitchBtn(1,'may')">
  91. <img src="image/drawable-xhdpi/my.png" id="index2" class="btn-icon"/>
  92. <div class="aui-bar-tab-label">
  93. 我的
  94. </div>
  95. </div>
  96. </footer>
  97. </body>
  98. <script type="text/javascript" src="./script/api.js"></script>
  99. <script type="text/javascript" src="./script/aui-tab.js" ></script>
  100. <script type="text/javascript">
  101. apiready = function() {
  102. // $api.clearStorage();
  103. var header = $api.byId('aui-header');
  104. $api.fixStatusBar(header);
  105. var headerPos = $api.offset(header);
  106. var body_h = $api.offset($api.dom('body')).h;
  107. var footer_h = $api.offset($api.byId('footer')).h;
  108. var loginid = $api.getStorage("loginid");
  109. // openFrameGroup(headerPos, body_h, footer_h);
  110. if (loginid == "" || typeof loginid == 'undefined') {
  111. /// 登录页面
  112. setTimeout(function() {
  113. openLogin(headerPos, body_h, footer_h);
  114. }, 200);
  115. } else {
  116. openFrameGroup(headerPos, body_h, footer_h);
  117. }
  118. /// 打开页面组
  119. api.addEventListener({
  120. name : 'openFrameGroup'
  121. }, function(ret, err) {
  122. //coding...
  123. api.closeWin({
  124. name : 'login',
  125. animation : {
  126. type : "push", //动画类型(详见动画类型常量)
  127. subType : "from_right", //动画子类型(详见动画子类型常量)
  128. duration : 300
  129. }
  130. });
  131. openFrameGroup(headerPos, body_h, footer_h);
  132. });
  133. var tab = new auiTab({
  134. element : document.getElementById("footer"),
  135. }, function(ret) {
  136. if(ret.index == 1){
  137. $api.attr($api.byId('index1'), 'src', 'image/drawable-xhdpi/main_active.png');
  138. $api.attr($api.byId('index2'), 'src', 'image/drawable-xhdpi/my.png');
  139. }else{
  140. $api.attr($api.byId('index1'), 'src', 'image/drawable-xhdpi/main.png');
  141. $api.attr($api.byId('index2'), 'src', 'image/drawable-xhdpi/my_active.png');
  142. }
  143. api.setFrameGroupIndex({
  144. name : 'indexGroup',
  145. index : (ret.index - 1),
  146. });
  147. });
  148. };
  149. // 打开登陆页面
  150. function openLogin(headerPos, body_h, footer_h) {
  151. api.openWin({
  152. name : 'login',
  153. url : 'html/user/login.html',
  154. rect : {
  155. x : 0,
  156. y : headerPos.h,
  157. w : 'auto',
  158. h : body_h - footer_h - headerPos.h
  159. },
  160. animation : {
  161. type : "none", //动画类型(详见动画类型常量)
  162. subType : "from_right", //动画子类型(详见动画子类型常量)
  163. duration : 200 //动画过渡时间,默认300毫秒
  164. }
  165. });
  166. }
  167. // 打开页面组
  168. function openFrameGroup(headerPos, body_h, footer_h) {
  169. api.openFrameGroup({
  170. name : 'indexGroup',
  171. scrollEnabled : false,
  172. rect : {
  173. x : 0,
  174. y : headerPos.h,
  175. w : 'auto',
  176. h : body_h - footer_h - headerPos.h
  177. },
  178. index : 0,
  179. frames : [{
  180. name : 'main',
  181. url : 'html/main.html',
  182. vScrollBarEnabled : false,
  183. hScrollBarEnabled : false,
  184. bounces : false,
  185. }, {
  186. name : 'my',
  187. url : 'html/my.html',
  188. vScrollBarEnabled : false,
  189. hScrollBarEnabled : false,
  190. bounces : false
  191. }],
  192. }, function(ret, err) {
  193. });
  194. }
  195. </script>
  196. </html>