main.html 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  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="../../image/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="../../image/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. // setTimeout(function(){
  114. // console.log($api.getStorage("kunnr"));
  115. // },3000)
  116. var header = $api.byId('aui-header');
  117. $api.fixStatusBar(header);
  118. var headerPos = $api.offset(header);
  119. var body_h = $api.offset($api.dom('body')).h;
  120. var footer_h = $api.offset($api.byId('footer')).h;
  121. var loginid = $api.getStorage("kunnr");
  122. // openFrameGroup(headerPos, body_h, footer_h);
  123. if (loginid == "" || typeof loginid == 'undefined') {
  124. /// 登录页面
  125. setTimeout(function() {
  126. openLogin(headerPos, body_h, footer_h);
  127. }, 200);
  128. } else {
  129. openFrameGroup(headerPos, body_h, footer_h);
  130. }
  131. api.addEventListener({
  132. name: 'keyback'
  133. }, function(ret, err){
  134. if( ret ){
  135. setTimeout(function(){
  136. api.confirm({
  137. title : "提醒",
  138. msg : "即将退回到登录页?",
  139. buttons : ["取消","确认"],
  140. }, function(ret, err) {
  141. if(ret.buttonIndex==2){
  142. api.sendEvent({
  143. name: 'rebacklogin'
  144. });
  145. $api.clearStorage();
  146. api.openWin({
  147. name : 'login',
  148. url : '../login.html',
  149. rect : {
  150. x : 0,
  151. y : 0,
  152. w : 'auto',
  153. h : 0
  154. },
  155. animation : {
  156. type : "none", //动画类型(详见动画类型常量)
  157. subType : "from_right", //动画子类型(详见动画子类型常量)
  158. duration : 200 //动画过渡时间,默认300毫秒
  159. }
  160. });
  161. }
  162. });
  163. },300);
  164. }else{
  165. alert( JSON.stringify( err ) );
  166. }
  167. });
  168. /// 打开页面组
  169. api.addEventListener({
  170. name : 'openFrameGroupTbr'
  171. }, function(ret, err) {
  172. //coding...
  173. openFrameGroup(headerPos, body_h, footer_h);
  174. setTimeout(function() {
  175. api.closeWin({
  176. name : 'login',
  177. animation : {
  178. type : "push", //动画类型(详见动画类型常量)
  179. subType : "from_right", //动画子类型(详见动画子类型常量)
  180. duration : 300
  181. }
  182. });
  183. }, 1200);
  184. });
  185. var tab = new auiTab({
  186. element : document.getElementById("footer"),
  187. }, function(ret) {
  188. if (ret.index == 1) {
  189. $api.attr($api.byId('index1'), 'src', '../../image/img/images/tabar_home_active.png');
  190. $api.attr($api.byId('index2'), 'src', '../../image/img/images/wode.png');
  191. } else {
  192. $api.attr($api.byId('index1'), 'src', '../../image/img/images/tabar_home_inactive.png');
  193. $api.attr($api.byId('index2'), 'src', '../../image/img/images/wode_active.png');
  194. };
  195. api.setFrameGroupIndex({
  196. name : 'indexGrouptbr',
  197. index : (ret.index - 1),
  198. });
  199. });
  200. };
  201. // 打开登陆页面
  202. function openLogin(headerPos, body_h, footer_h) {
  203. api.openWin({
  204. name : 'login',
  205. url : '../login.html',
  206. rect : {
  207. x : 0,
  208. y : 0,
  209. w : 'auto',
  210. h : body_h - footer_h - headerPos.h
  211. },
  212. animation : {
  213. type : "none", //动画类型(详见动画类型常量)
  214. subType : "from_right", //动画子类型(详见动画子类型常量)
  215. duration : 200 //动画过渡时间,默认300毫秒
  216. }
  217. });
  218. }
  219. // 打开页面组
  220. function openFrameGroup(headerPos, body_h, footer_h) {
  221. api.openFrameGroup({
  222. name : 'indexGrouptbr',
  223. scrollEnabled : false,
  224. rect : {
  225. x : 0,
  226. y : 0,
  227. w : 'auto',
  228. h : body_h - footer_h
  229. },
  230. index : 0,
  231. frames : [{
  232. name : 'home',
  233. url : 'pages/home/home.html',
  234. vScrollBarEnabled : false,
  235. hScrollBarEnabled : false,
  236. bounces : false,
  237. },{
  238. name : 'my',
  239. url : 'pages/mine/meber.html',
  240. vScrollBarEnabled : false,
  241. hScrollBarEnabled : false,
  242. bounces : false
  243. }],
  244. }, function(ret, err) {
  245. if(ret.index == 1){
  246. $api.addCls($api.byId('aui-header'),'myBg');
  247. }else{
  248. $api.removeCls($api.byId('aui-header'),'myBg');
  249. }
  250. });
  251. }
  252. </script>
  253. </html>