home.html 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  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?v=1.2" />
  10. <style>
  11. html,body{height:100%;padding:0px;margin: 0 auto;text-align: center;}
  12. .adv {
  13. height: 100vh;
  14. background-size: auto 100%;
  15. background-repeat: no-repeat;
  16. background-position: center;
  17. }
  18. .weui-btn {
  19. position: relative;
  20. display: block;
  21. width: 184px;
  22. margin-left: auto;
  23. margin-right: auto;
  24. padding: 8px 24px;
  25. box-sizing: border-box;
  26. font-weight: 700;
  27. font-size: 17px;
  28. text-align: center;
  29. text-decoration: none;
  30. color: #FFFFFF;
  31. line-height: 1.41176471;
  32. border-radius: 4px;
  33. -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
  34. overflow: hidden;
  35. }
  36. .weui-btn_mini {
  37. display: inline-block;
  38. width: auto;
  39. padding: 0 0.75em;
  40. line-height: 2;
  41. font-size: 0.32rem;
  42. background: rgba(0, 0, 0, 0.4);
  43. position: fixed;
  44. z-index: 1;
  45. top: 1.2rem;
  46. right: 0.3rem;
  47. border: 1px solid rgba(255, 255, 255, 0.6);
  48. font-weight: normal;
  49. color: rgba(255, 255, 255);
  50. }
  51. </style>
  52. <script>
  53. (function(w, d, m) {
  54. function r() {
  55. var t = 100,
  56. o = 750,
  57. e = d.documentElement.clientWidth || w.innerWidth,
  58. n = m.max(m.min(e, 480), 320),
  59. h = 50;
  60. 320 >= n && (h = m.floor(n / o * t * .99)),
  61. n > 320 && 362 >= n && (h = m.floor(n / o * t * 1)),
  62. n > 362 && 375 >= n && (h = m.floor(n / o * t * 1)),
  63. n > 375 && (h = m.floor(n / o * t * .97)),
  64. d.querySelector("html").style.fontSize = h + "px"
  65. };
  66. r();
  67. w.onresize = function() {
  68. r()
  69. }
  70. })(window, document, Math);
  71. </script>
  72. </head>
  73. <body>
  74. <div class="topbar"></div>
  75. <div class="adv" style=""></div>
  76. <a href="javascript:redirectIndex();" class="weui-btn weui-btn_mini">跳 过</a>
  77. </body>
  78. <script type="text/javascript" src="./script/api.js"></script>
  79. <script type="text/javascript" src="./script/jquery.min.js"></script>
  80. <script type="text/javascript" src="./script/jquery.tap.js"></script>
  81. <script type="text/javascript">
  82. var _myalias = '';
  83. var myVar;
  84. apiready = function() {
  85. var memberLogin = $api.getStorage("memberid");
  86. var storeLogin = $api.getStorage("storeid");
  87. var agentLogin = $api.getStorage("agent_id");
  88. var isSlide = $api.getStorage("isSlide");
  89. api.removeLaunchView({
  90. animation: {
  91. type: 'fade',
  92. duration: 2000
  93. }
  94. });
  95. if (isSlide == 1) {
  96. if ( storeLogin > 0 ) {
  97. redirectHotIndex();
  98. } else if (memberLogin > 0) {
  99. redirectAdv();
  100. } else if (agentLogin > 0 ) {
  101. redirectagent();
  102. } else {
  103. redirectAdv();
  104. }
  105. } else {
  106. redirectSlide();
  107. }
  108. setTimeCloseWin("home");
  109. };
  110. function redirectAdv() {
  111. $.ajax({
  112. url: siteurl + 'v2/entry/boot_adv',
  113. dataType: 'json',
  114. type: 'post',
  115. success: function(datas) {
  116. if (datas.result) {
  117. if (datas.data.enable == 1) {
  118. $('.adv').attr('style', 'background-image: url('+siteurl+'/uploads/home/adv/'+datas.data.images+')');
  119. $('.adv').attr('type', datas.data.target.type);
  120. $('.adv').attr('store_id', datas.data.target.store_id);
  121. $('.adv').attr('goods_id', datas.data.target.goods_id);
  122. $('.adv').attr('article_id', datas.data.target.article_id);
  123. return false;
  124. } else {
  125. redirectIndex();
  126. }
  127. } else {
  128. errcode(datas, datas.code);
  129. return false;
  130. }
  131. }
  132. });
  133. myVar = setTimeout(function(){
  134. redirectIndex();
  135. setTimeCloseWin("home");
  136. }, 4000);
  137. }
  138. $(".adv").on("tap", function() {
  139. var _type = $('.adv').attr('type');
  140. // redirectIndex();
  141. clearTimeout(myVar);
  142. switch (_type) {
  143. case 'goods':
  144. var _goods_id = $('.adv').attr('goods_id');
  145. var _store_id = $('.adv').attr('store_id');
  146. console.log(_goods_id, _store_id)
  147. api.openWin({
  148. name: 'index',
  149. url: 'index.html',
  150. bounces: false,
  151. pageParam: {
  152. advtype: 'goods',
  153. advgoodsid: _goods_id,
  154. advstoreid: _store_id
  155. }
  156. });
  157. break;
  158. case 'store':
  159. var _store_id = $('.adv').attr('store_id');
  160. console.log(_store_id);
  161. api.openWin({
  162. name: 'index',
  163. url: 'index.html',
  164. bounces: false,
  165. pageParam: {
  166. advtype: 'store',
  167. advstoreid: _store_id
  168. }
  169. });
  170. break;
  171. case 'article':
  172. var _article_id = $('.adv').attr('article_id');
  173. console.log(_article_id);
  174. api.openWin({
  175. name: 'index',
  176. url: 'index.html',
  177. bounces: false,
  178. pageParam: {
  179. advtype: 'article',
  180. advarticleid: _article_id
  181. }
  182. });
  183. break;
  184. }
  185. });
  186. function redirectSlide() {
  187. api.openWin({
  188. name: 'slide',
  189. url: 'slide.html',
  190. bounces: false
  191. });
  192. }
  193. function redirectLogin() {
  194. api.openWin({
  195. name: 'login',
  196. url: 'login.html',
  197. bounces: false
  198. });
  199. }
  200. function redirectIndex() {
  201. api.openWin({
  202. name: 'index',
  203. url: 'index.html',
  204. bounces: false
  205. });
  206. }
  207. function redirectHotIndex() {
  208. api.openWin({
  209. name: 'hotelindex',
  210. url: './html/hotel/index.html',
  211. bounces: false
  212. });
  213. }
  214. function redirectagent() {
  215. api.openWin({
  216. name: 'agentindex',
  217. url: './html/agent/index.html',
  218. bounces: false
  219. });
  220. }
  221. </script>
  222. </html>