index.html 5.9 KB

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