index.html 8.6 KB

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