main.html 6.8 KB

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