index.html 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  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. _webinkeyid = api.pageParam.keyid;
  83. _webinstoreid = api.pageParam.storeid;
  84. _adv_type = api.pageParam.advtype;
  85. _adv_goods_id = api.pageParam.advgoodsid;
  86. _adv_store_id = api.pageParam.advstoreid;
  87. _adv_article_id = api.pageParam.advarticleid;
  88. api.setStatusBarStyle({
  89. style: 'dark',
  90. color: '#ffffff'
  91. });
  92. // alert(JSON.stringify(_adv_type+'_'+_adv_goods_id+'_'+_adv_store_id+'_'+_adv_article_id));
  93. funIniGroup();
  94. // get_adv();
  95. setBackDisable();
  96. api.addEventListener({ name: 'appintent' }, function(ret, err) { //anz noticeclicked
  97. // alert(JSON.stringify(ret));
  98. /*api.openWin({
  99. name: 'msglist',
  100. url: 'html/home/msglist.html',
  101. bounces: false
  102. });*/
  103. })
  104. api.removeEventListener({
  105. name: 'noticeclicked'
  106. });
  107. }
  108. function funIniGroup() {
  109. var eHeaderLis = $api.domAll('header li'),
  110. frames = [];
  111. for (var i = 0, len = eHeaderLis.length; i < len; i++) {
  112. frames.push({
  113. name: 'frame' + i,
  114. url: './html/frame' + i + '.html',
  115. bgColor: 'rgba(0,0,0,.2)',
  116. bounces: false,
  117. vScrollBarEnabled: false,
  118. hScrollBarEnabled: false,
  119. slidBackEnabled: false,
  120. pageParam: {
  121. advtype: _adv_type,
  122. advgoodsid: _adv_goods_id,
  123. advstoreid: _adv_store_id,
  124. advarticleid: _adv_article_id
  125. }
  126. })
  127. }
  128. api.openFrameGroup({
  129. name: 'group',
  130. scrollEnabled: false,
  131. rect: {
  132. x: 0,
  133. y: $api.dom('header').offsetHeight,
  134. w: 'auto',//api.winWidth,
  135. h: 'auto'//$api.dom('#main').offsetHeight
  136. },
  137. index: 0,
  138. frames: frames
  139. }, function(ret, err) {
  140. api.setFrameAttr({
  141. name: 'frame0'
  142. });
  143. });
  144. }
  145. function set_height() {
  146. api.setFrameGroupAttr({
  147. name: 'group',
  148. rect: {
  149. x: 0,
  150. y: $api.dom('header').offsetHeight,
  151. w: api.winWidth,
  152. h: $api.dom('#main').offsetHeight
  153. }
  154. })
  155. }
  156. function get_adv() {
  157. //
  158. $.ajax({
  159. url: siteurl + 'v1/entry/poster',
  160. data: {},
  161. headers: { "X-TOKEN": $api.getStorage("accesstoken") },
  162. dataType: 'json',
  163. type: 'post',
  164. success: function(datas) {
  165. if (datas.result) {
  166. if (datas.data.enable == 1) {
  167. switch (datas.data.target.type) {
  168. case 'point':
  169. gallery_adv(siteurl + 'uploads/home/adv/' + datas.data.images, 'to_point');
  170. break;
  171. case 'goods':
  172. gallery_adv(siteurl + 'uploads/home/adv/' + datas.data.images, 'to_goods_id', datas.data.target.goods_id, datas.data.target.store_id);
  173. break;
  174. case 'store':
  175. gallery_adv(siteurl + 'uploads/home/adv/' + datas.data.images, 'to_store_id', datas.data.target.store_id);
  176. break;
  177. case 'article':
  178. gallery_adv(siteurl + 'uploads/home/adv/' + datas.data.images, 'to_article_id', datas.data.target.article_id);
  179. break;
  180. }
  181. }
  182. } else {
  183. errcode(datas, datas.code);
  184. }
  185. }
  186. })
  187. }
  188. function to_point() {
  189. // body...
  190. api.openWin({
  191. name: 'points',
  192. url: './html/my/points.html',
  193. bounces: false
  194. });
  195. $('.weui-gallery').hide();
  196. return false;
  197. }
  198. function to_article_id(_adv_article_id) {
  199. // body...
  200. api.openWin({
  201. name: 'finddetails',
  202. url: './html/find/finddetails.html',
  203. bounces: false,
  204. pageParam: {
  205. keyid: _adv_article_id
  206. }
  207. });
  208. $('.weui-gallery').hide();
  209. return false;
  210. }
  211. function to_goods_id(_adv_goods_id, _storeid) {
  212. // body...
  213. api.openWin({
  214. name: 'showgoods',
  215. url: './html/home/showgoods.html',
  216. bounces: false,
  217. pageParam: {
  218. keyid: _adv_goods_id,
  219. storeid: _storeid
  220. }
  221. });
  222. $('.weui-gallery').hide();
  223. return false;
  224. }
  225. function to_store_id(_adv_store_id) {
  226. // body...
  227. api.openWin({
  228. name: 'hoteldtl',
  229. url: './html/home/hoteldtl.html',
  230. bounces: false,
  231. pageParam: {
  232. keyid: _adv_store_id
  233. }
  234. });
  235. $('.weui-gallery').hide();
  236. return false;
  237. }
  238. // 随意切换按钮
  239. function randomSwitchBtn(tag) {
  240. if (tag == $api.dom('#footer li.active')) return;
  241. var eFootLis = $api.domAll('#footer li'),
  242. eHeaderLis = $api.domAll('header li'),
  243. index = 0;
  244. for (var i = 0, len = eFootLis.length; i < len; i++) {
  245. if (tag == eFootLis[i]) {
  246. index = i;
  247. } else {
  248. $api.removeCls(eFootLis[i], 'active');
  249. $api.removeCls(eHeaderLis[i], 'active');
  250. }
  251. }
  252. $api.addCls(eFootLis[index], 'active');
  253. $api.addCls(eHeaderLis[index], 'active');
  254. api.setFrameGroupIndex({
  255. name: 'group',
  256. index: index
  257. });
  258. }
  259. </script>