index.html 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  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,width=device-width,initial-scale=1.0" />
  6. <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
  7. <title>底部导航</title>
  8. <link rel="stylesheet" type="text/css" href="./css/api.css" />
  9. <link rel="stylesheet" type="text/css" href="./css/style.css" />
  10. <style>
  11. #header { height: 0.9rem; }
  12. header{ background-color: #f2f2f2; }
  13. header ul li { height: 1rem; line-height: 1rem; text-align: center; display: none; color: #323237; position: relative;font-size: 0.28rem; }
  14. header ul li.active{ display: block; }
  15. #footer ul li.active{ color: #D9251C; }
  16. #footer ul li:nth-child(1){ background-image: url(./image/bottombtn0101.png); }
  17. #footer ul li:nth-child(2){ background-image: url(./image/bottombtn0201.png); }
  18. #footer ul li:nth-child(3){ background-image: url(./image/bottombtn0301.png); }
  19. #footer ul li:nth-child(4){ background-image: url(./image/bottombtn0401.png); }
  20. #footer ul li:nth-child(1).active{ background-image: url(./image/bottombtn0102.png); }
  21. #footer ul li:nth-child(2).active{ background-image: url(./image/bottombtn0202.png); }
  22. #footer ul li:nth-child(3).active{ background-image: url(./image/bottombtn0302.png); }
  23. #footer ul li:nth-child(4).active{ background-image: url(./image/bottombtn0402.png); }
  24. .flex-con{
  25. overflow: auto
  26. }
  27. </style>
  28. <script>
  29. (function(w, d, m) {
  30. function r() {
  31. var t = 100,
  32. o = 750,
  33. e = d.documentElement.clientWidth || w.innerWidth,
  34. n = m.max(m.min(e, 480), 320),
  35. h = 50;
  36. 320 >= n && (h = m.floor(n / o * t * .99)),
  37. n > 320 && 362 >= n && (h = m.floor(n / o * t * 1)),
  38. n > 362 && 375 >= n && (h = m.floor(n / o * t * 1)),
  39. n > 375 && (h = m.floor(n / o * t * .97)),
  40. d.querySelector("html").style.fontSize = h + "px"
  41. };
  42. r();
  43. w.onresize = function() {
  44. r()
  45. }
  46. })(window, document, Math);
  47. </script>
  48. </head>
  49. <body>
  50. <div class="topbar"></div>
  51. <div id="wrap" class="flex-wrap flex-vertical">
  52. <header style="display: none;">
  53. <ul>
  54. <li class="border-b active"></li>
  55. <li class="border-b"></li>
  56. <li class="border-b"></li>
  57. <li class="border-b"></li>
  58. </ul>
  59. </header>
  60. <div id="main" class="flex-con">
  61. </div>
  62. <div id="footer" class="border-t">
  63. <ul class="flex-wrap">
  64. <li tapmode="hover" onclick="randomSwitchBtn( this );" class="flex-con active">首页</li>
  65. <li tapmode="hover" onclick="randomSwitchBtn( this );" class="flex-con">发现</li>
  66. <li tapmode="hover" onclick="randomSwitchBtn( this );" class="flex-con">订单</li>
  67. <li tapmode="hover" onclick="randomSwitchBtn( this );" class="flex-con">我的</li>
  68. </ul>
  69. </div>
  70. </div>
  71. </body>
  72. </html>
  73. <script type="text/javascript" src="./script/api.js"></script>
  74. <script type="text/javascript">
  75. var _adv_type = '0';
  76. var _adv_goods_id = '0';
  77. var _adv_store_id = '0';
  78. var _adv_article_id = '0';
  79. var _webinkeyid = '0';
  80. var _webinstoreid = '0';
  81. apiready = function() {
  82. var $header = $api.byId('footer');
  83. $api.fixTabBar($header);
  84. _webinkeyid = api.pageParam.keyid;
  85. _webinstoreid = api.pageParam.storeid;
  86. _adv_type = api.pageParam.advtype;
  87. _adv_goods_id = api.pageParam.advgoodsid;
  88. _adv_store_id = api.pageParam.advstoreid;
  89. _adv_article_id = api.pageParam.advarticleid;
  90. api.setStatusBarStyle({
  91. style: 'dark',
  92. color: '#ffffff'
  93. });
  94. // alert(JSON.stringify(_adv_type+'_'+_adv_goods_id+'_'+_adv_store_id+'_'+_adv_article_id));
  95. funIniGroup();
  96. // get_adv();
  97. setBackDisable();
  98. api.addEventListener({ name: 'appintent' }, function(ret, err) { //anz noticeclicked
  99. // alert(JSON.stringify(ret));
  100. /*api.openWin({
  101. name: 'msglist',
  102. url: 'html/home/msglist.html',
  103. bounces: false
  104. });*/
  105. })
  106. api.removeEventListener({
  107. name: 'noticeclicked'
  108. });
  109. }
  110. function funIniGroup() {
  111. var eHeaderLis = $api.domAll('header li'),
  112. frames = [];
  113. for (var i = 0, len = eHeaderLis.length; i < len; i++) {
  114. frames.push({
  115. name: 'frame' + i,
  116. url: './html/frame' + i + '.html',
  117. bgColor: 'rgba(0,0,0,.2)',
  118. bounces: false,
  119. vScrollBarEnabled: false,
  120. hScrollBarEnabled: false,
  121. slidBackEnabled: false,
  122. pageParam: {
  123. advtype: _adv_type,
  124. advgoodsid: _adv_goods_id,
  125. advstoreid: _adv_store_id,
  126. advarticleid: _adv_article_id
  127. }
  128. })
  129. }
  130. api.openFrameGroup({
  131. name: 'group',
  132. scrollEnabled: false,
  133. rect: {
  134. x: 0,
  135. y: $api.dom('header').offsetHeight,
  136. w: 'auto',//api.winWidth,
  137. h: 'auto'//$api.dom('#main').offsetHeight
  138. },
  139. index: 0,
  140. frames: frames
  141. }, function(ret, err) {
  142. api.setFrameAttr({
  143. name: 'frame0'
  144. });
  145. });
  146. }
  147. function set_height() {
  148. api.setFrameGroupAttr({
  149. name: 'group',
  150. rect: {
  151. x: 0,
  152. y: $api.dom('header').offsetHeight,
  153. w: api.winWidth,
  154. h: $api.dom('#main').offsetHeight
  155. }
  156. })
  157. }
  158. function get_adv() {
  159. //
  160. $.ajax({
  161. url: siteurl + 'v1/entry/poster',
  162. data: {},
  163. headers: { "X-TOKEN": $api.getStorage("accesstoken") },
  164. dataType: 'json',
  165. type: 'post',
  166. success: function(datas) {
  167. if (datas.result) {
  168. if (datas.data.enable == 1) {
  169. switch (datas.data.target.type) {
  170. case 'point':
  171. gallery_adv(siteurl + 'uploads/home/adv/' + datas.data.images, 'to_point');
  172. break;
  173. case 'goods':
  174. gallery_adv(siteurl + 'uploads/home/adv/' + datas.data.images, 'to_goods_id', datas.data.target.goods_id, datas.data.target.store_id);
  175. break;
  176. case 'store':
  177. gallery_adv(siteurl + 'uploads/home/adv/' + datas.data.images, 'to_store_id', datas.data.target.store_id);
  178. break;
  179. case 'article':
  180. gallery_adv(siteurl + 'uploads/home/adv/' + datas.data.images, 'to_article_id', datas.data.target.article_id);
  181. break;
  182. }
  183. }
  184. } else {
  185. errcode(datas, datas.code);
  186. }
  187. }
  188. })
  189. }
  190. function to_point() {
  191. // body...
  192. api.openWin({
  193. name: 'points',
  194. url: './html/my/points.html',
  195. bounces: false
  196. });
  197. $('.weui-gallery').hide();
  198. return false;
  199. }
  200. function to_article_id(_adv_article_id) {
  201. // body...
  202. api.openWin({
  203. name: 'finddetails',
  204. url: './html/find/finddetails.html',
  205. bounces: false,
  206. pageParam: {
  207. keyid: _adv_article_id
  208. }
  209. });
  210. $('.weui-gallery').hide();
  211. return false;
  212. }
  213. function to_goods_id(_adv_goods_id, _storeid) {
  214. // body...
  215. api.openWin({
  216. name: 'showgoods',
  217. url: './html/home/showgoods.html',
  218. bounces: false,
  219. pageParam: {
  220. keyid: _adv_goods_id,
  221. storeid: _storeid
  222. }
  223. });
  224. $('.weui-gallery').hide();
  225. return false;
  226. }
  227. function to_store_id(_adv_store_id) {
  228. // body...
  229. api.openWin({
  230. name: 'hoteldtl',
  231. url: './html/home/hoteldtl.html',
  232. bounces: false,
  233. pageParam: {
  234. keyid: _adv_store_id
  235. }
  236. });
  237. $('.weui-gallery').hide();
  238. return false;
  239. }
  240. // 随意切换按钮
  241. function randomSwitchBtn(tag) {
  242. if (tag == $api.dom('#footer li.active')) return;
  243. var eFootLis = $api.domAll('#footer li'),
  244. eHeaderLis = $api.domAll('header li'),
  245. index = 0;
  246. for (var i = 0, len = eFootLis.length; i < len; i++) {
  247. if (tag == eFootLis[i]) {
  248. index = i;
  249. } else {
  250. $api.removeCls(eFootLis[i], 'active');
  251. $api.removeCls(eHeaderLis[i], 'active');
  252. }
  253. }
  254. $api.addCls(eFootLis[index], 'active');
  255. $api.addCls(eHeaderLis[index], 'active');
  256. api.setFrameGroupIndex({
  257. name: 'group',
  258. index: index,
  259. });
  260. }
  261. </script>