index.html 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329
  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,
  14. html {
  15. width: 100%;
  16. height: 100%;
  17. }
  18. .aui-nav .aui-bar-tab {
  19. background: #fff;
  20. }
  21. .aui-bar {
  22. text-align: center;
  23. height: 3.3rem;
  24. }
  25. #footer {
  26. border-top: 1px solid #ddd;
  27. }
  28. .btn-icon {
  29. width: 1.2rem;
  30. margin: 0 auto;
  31. margin-bottom: 3px;
  32. }
  33. .aui-bar-tab .aui-bar-tab-item {
  34. padding: 10px 0;
  35. box-sizing: border-box;
  36. }
  37. .aui-bar1 {
  38. position: relative;
  39. top: 0;
  40. right: 0;
  41. left: 0;
  42. z-index: 10;
  43. width: 100%;
  44. min-height: 2.25rem;
  45. font-size: 0.9rem;
  46. text-align: center;
  47. display: table;
  48. }
  49. /*底部切换栏*/
  50. .aui-bar-tab1 {
  51. position: fixed;
  52. top: auto;
  53. bottom: 0;
  54. table-layout: fixed;
  55. background-color: #ffffff;
  56. color: #757575;
  57. }
  58. .aui-bar-tab1 .aui-bar-tab-item {
  59. display: table-cell;
  60. position: relative;
  61. width: 1%;
  62. height: 2.5rem;
  63. text-align: center;
  64. vertical-align: middle;
  65. padding: 5px 0;
  66. }
  67. .aui-bar-tab-label {
  68. font-size: 0.8rem;
  69. margin-top: -5px;
  70. }
  71. .myBg {
  72. background: linear-gradient(45deg, #005fa3, #00a0ea) !important;
  73. }
  74. .whitebar{
  75. background-color:#ffffff !important;
  76. color: #333333;
  77. }
  78. </style>
  79. </head>
  80. <body>
  81. <header class="aui-bar aui-bar-nav" id="aui-header">
  82. <div class="aui-title" id="aui-title">
  83. 赛轮商城门店端
  84. </div>
  85. </header>
  86. <footer class="aui-bar1 aui-bar-tab1" id="footer">
  87. <div class="aui-bar-tab-item aui-active" id="home" tapmode >
  88. <img src="./luntai/img/images/tabar_home_active.png" id="index1" class="btn-icon" />
  89. <div class="aui-bar-tab-label">
  90. 首页
  91. </div>
  92. </div>
  93. <!--<div class="aui-bar-tab-item aui-active" tapmode onclick="randomSwitchBtn(1,'find')">
  94. <img src="./luntai/img/images/faxian.png" id="index1" class="btn-icon"/>
  95. <div class="aui-bar-tab-label"aui-bar-tab-item>
  96. 发现
  97. </div>
  98. </div>-->
  99. <div class="aui-bar-tab-item" tapmode>
  100. <img src="./luntai/img/images/xiaoxi.png" id="index2" class="btn-icon" />
  101. <div class="aui-bar-tab-label">
  102. 消息
  103. </div>
  104. </div>
  105. <div class="aui-bar-tab-item" tapmode>
  106. <img src="./luntai/img/images/shop_inactive.png" id="index4" class="btn-icon" />
  107. <div class="aui-bar-tab-label">
  108. 购物车
  109. </div>
  110. </div>
  111. <div class="aui-bar-tab-item" tapmode>
  112. <img src="./luntai/img/images/wode.png" id="index3" class="btn-icon" />
  113. <div class="aui-bar-tab-label">
  114. 我的
  115. </div>
  116. </div>
  117. </footer>
  118. </body>
  119. <script type="text/javascript" src="./script/api.js"></script>
  120. <script type="text/javascript" src="./script/aui-tab.js"></script>
  121. <script type="text/javascript">
  122. apiready = function() {
  123. // $api.clearStorage();
  124. var header = $api.byId('aui-header');
  125. $api.fixStatusBar(header);
  126. var headerPos = $api.offset(header);
  127. var footer = $api.byId('footer');
  128. $api.fixTabBar(footer)
  129. var body_h = $api.offset($api.dom('body')).h;
  130. var footer_h = $api.offset($api.byId('footer')).h;
  131. var loginid = $api.getStorage("loginid");
  132. // openFrameGroup(headerPos, body_h, footer_h);
  133. if (loginid == "" || typeof loginid == 'undefined') {
  134. /// 登录页面
  135. setTimeout(function() {
  136. openLogin(headerPos, body_h, footer_h);
  137. }, 200);
  138. } else {
  139. openFrameGroup(headerPos, body_h, footer_h);
  140. }
  141. /// 打开页面组
  142. api.addEventListener({
  143. name: 'openFrameGroup'
  144. }, function(ret, err) {
  145. //coding...
  146. //alert(JSON.stringify(ret) );
  147. openFrameGroup(headerPos, body_h, footer_h);
  148. setTimeout(function() {
  149. api.closeWin({
  150. name: 'login',
  151. animation: {
  152. type: "push", //动画类型(详见动画类型常量)
  153. subType: "from_right", //动画子类型(详见动画子类型常量)
  154. duration: 300
  155. }
  156. });
  157. }, 1200);
  158. });
  159. api.addEventListener({
  160. name:'gotocart'
  161. }, function(ret){
  162. $api.attr($api.byId('index1'), 'src', './luntai/img/images/tabar_home_inactive.png');
  163. $api.attr($api.byId('index2'), 'src', './luntai/img/images/xiaoxi.png');
  164. $api.attr($api.byId('index3'), 'src', './luntai/img/images/wode.png');
  165. $api.attr($api.byId('index4'), 'src', './luntai/img/images/shop_active.png');
  166. api.setFrameGroupIndex({
  167. name: 'indexGroup',
  168. index:2,
  169. reload:true
  170. });
  171. var home= $api.byId('home');
  172. home.classList.remove("aui-active");
  173. // var _tab = tabItems[index-1];
  174. // if(_tab.parentNode.querySelector(".aui-active"))_tab.parentNode.querySelector(".aui-active").classList.remove("aui-active");
  175. // _tab.classList.add("aui-active");
  176. })
  177. var tab = new auiTab({
  178. element: document.getElementById("footer"),
  179. }, function(ret) {
  180. if (ret.index == 1) {
  181. $api.attr($api.byId('index1'), 'src', './luntai/img/images/tabar_home_active.png');
  182. $api.attr($api.byId('index2'), 'src', './luntai/img/images/xiaoxi.png');
  183. $api.attr($api.byId('index3'), 'src', './luntai/img/images/wode.png');
  184. $api.attr($api.byId('index4'), 'src', './luntai/img/images/shop_inactive.png');
  185. api.sendEvent({
  186. name: 'startLogin',
  187. extra: {}
  188. });
  189. } else if (ret.index == 2) {
  190. $api.attr($api.byId('index1'), 'src', './luntai/img/images/tabar_home_inactive.png');
  191. $api.attr($api.byId('index2'), 'src', './luntai/img/images/xiaoxi_active.png');
  192. $api.attr($api.byId('index3'), 'src', './luntai/img/images/wode.png');
  193. $api.attr($api.byId('index4'), 'src', './luntai/img/images/shop_inactive.png');
  194. api.sendEvent({
  195. name: 'refushMsg',
  196. extra: {}
  197. });
  198. }
  199. else if (ret.index == 3) {
  200. $api.attr($api.byId('index1'), 'src', './luntai/img/images/tabar_home_inactive.png');
  201. $api.attr($api.byId('index2'), 'src', './luntai/img/images/xiaoxi.png');
  202. $api.attr($api.byId('index3'), 'src', './luntai/img/images/wode.png');
  203. $api.attr($api.byId('index4'), 'src', './luntai/img/images/shop_active.png');
  204. api.sendEvent({
  205. name: 'refreshshopcart',
  206. extra: {}
  207. });
  208. }
  209. else {
  210. $api.attr($api.byId('index1'), 'src', './luntai/img/images/tabar_home_inactive.png');
  211. $api.attr($api.byId('index2'), 'src', './luntai/img/images/xiaoxi.png');
  212. $api.attr($api.byId('index3'), 'src', './luntai/img/images/wode_active.png');
  213. $api.attr($api.byId('index4'), 'src', './luntai/img/images/shop_inactive.png');
  214. api.sendEvent({
  215. name: 'refushMeber',
  216. extra: {}
  217. });
  218. }
  219. // if (ret.index == 1) {
  220. // $api.attr($api.byId('index1'), 'src', './luntai/img/images/tabar_home_active.png');
  221. // $api.attr($api.byId('index2'), 'src', './luntai/img/images/wode.png');
  222. // } else {
  223. // $api.attr($api.byId('index1'), 'src', './luntai/img/images/tabar_home_inactive.png');
  224. // $api.attr($api.byId('index2'), 'src', './luntai/img/images/wode_active.png');
  225. // api.sendEvent({
  226. // name: 'refushMeber',
  227. // extra: {
  228. // }
  229. // });
  230. //
  231. // }
  232. api.setFrameGroupIndex({
  233. name: 'indexGroup',
  234. index: (ret.index - 1),
  235. });
  236. });
  237. };
  238. // 打开登陆页面
  239. function openLogin(headerPos, body_h, footer_h) {
  240. api.openWin({
  241. name: 'login',
  242. url: 'luntai/login.html',
  243. rect: {
  244. x: 0,
  245. y: 0,
  246. w: 'auto',
  247. h: body_h - footer_h - headerPos.h
  248. },
  249. animation: {
  250. type: "none", //动画类型(详见动画类型常量)
  251. subType: "from_right", //动画子类型(详见动画子类型常量)
  252. duration: 200 //动画过渡时间,默认300毫秒
  253. }
  254. });
  255. }
  256. // 打开页面组
  257. function openFrameGroup(headerPos, body_h, footer_h) {
  258. api.openFrameGroup({
  259. name: 'indexGroup',
  260. scrollEnabled: false,
  261. rect: {
  262. x: 0,
  263. y: 0,
  264. w: 'auto',
  265. h: body_h - footer_h
  266. },
  267. index: 0,
  268. frames: [{
  269. name: 'main',
  270. url: 'luntai/index.html',
  271. vScrollBarEnabled: false,
  272. hScrollBarEnabled: false,
  273. bounces: false,
  274. }, {
  275. name: 'msg',
  276. url: 'luntai/msg.html',
  277. vScrollBarEnabled: false,
  278. hScrollBarEnabled: false,
  279. bounces: false,
  280. },
  281. {
  282. name: 'cart',
  283. url: 'luntai/cart.html',
  284. vScrollBarEnabled: false,
  285. hScrollBarEnabled: false,
  286. bounces: false
  287. },
  288. {
  289. name: 'my',
  290. url: 'luntai/meber.html',
  291. vScrollBarEnabled: false,
  292. hScrollBarEnabled: false,
  293. bounces: false
  294. }],
  295. }, function(ret, err) {
  296. if (ret.index == 1) {
  297. $api.addCls($api.byId('aui-header'), 'myBg');
  298. }
  299. else if (ret.index==2){
  300. $api.addCls($api.byId('aui-header'), 'whitebar');
  301. }
  302. else {
  303. $api.removeCls($api.byId('aui-header'), 'myBg');
  304. $api.removeCls($api.byId('aui-header'), 'whitebar');
  305. }
  306. });
  307. }
  308. </script>
  309. </html>