index.html 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363
  1. {extend name="layout/base" /}
  2. {block name="header"}
  3. <link rel="stylesheet" href="__STATIC__/css/mobile/style.css">
  4. {/block}
  5. {block name="content"}
  6. <!-- header start -->
  7. <header class="top">
  8. <div class="header">
  9. <a href="javascript:history.back(-1)"><img src="__STATIC__/images/mobile/icon/left.png" class="back"></a>
  10. <div>
  11. <a href="javascript:;" onclick="window.location.replace('{:getMobileServerUrl('kf')}')" {eq name='kfkc' value='kf'} class="active" {/eq}>
  12. <h2 {eq name='kfkc' value='kf'} class="active type" {/eq} class="type" >开服</h2>
  13. </a>
  14. <a href="javascript:;" onclick="window.location.replace('{:getMobileServerUrl('kc')}')" {eq name='kfkc' value='kc'} class="active" {/eq}>
  15. <h2 {eq name='kfkc' value='kc'} class="active" {/eq}>开测</h2>
  16. </a>
  17. </div>
  18. <div>
  19. <div class="search-icon"><a href="{:getMobileSearchUrl()}"><img src="__STATIC__/images/mobile/icon/search.png"></a></div>
  20. <div class="menu"><img src="__STATIC__/images/mobile/icon/menu-bar.png"></div>
  21. </div>
  22. </div>
  23. </header>
  24. <!-- header end -->
  25. {empty name="list"}
  26. <!-- 无相关礼包 -->
  27. <div class="no_content" style="margin-top: 60%;">
  28. <div>
  29. <img src="/static/images/mobile/icon/no-gift.png">
  30. <p>暂无{if condition="$kfkc == 'kf'"}开服{else /}开测{/if}信息</p>
  31. </div>
  32. </div>
  33. <!-- 无相关礼包end-->
  34. {else/}
  35. <div class="warp-service">
  36. <div class="game-list">
  37. {foreach name="list" item="vo" key="k" }
  38. {if condition="count($vo) > 0"}
  39. <div class="service-date">
  40. <img src="__STATIC__/images/mobile/icon/date.png">
  41. {switch name="$k"}
  42. {case value="td"}<p>今日{if condition="$kfkc == 'kf'"}开服{else /}开测{/if}<span>{$today}</span></p>{/case}
  43. {case value="tm"}<p>明日{if condition="$kfkc == 'kf'"}开服{else /}开测{/if}<span>{$tomorrow}</span></p>{/case}
  44. {case value="fn"}<p>长期有效</p>{/case}
  45. {default /}<p>{$k}</p>
  46. {/switch}
  47. </div>
  48. {foreach $vo as $item}
  49. <div class="game-info">
  50. <!-- have gift -->
  51. {if condition='$item.libaonum > 0'}<a href=""><img src="__STATIC__/images/mobile/icon/gift.png" class="gift"></a>{/if}
  52. <a href="{:getMobileGameUrl($item['gameid'])}">
  53. <img src="{$item.mobileicon}">
  54. <div class="content">
  55. <h4 class="title">{$item.nickname}</h4>
  56. <p>{$item.typename}<span>|</span>{$item.subjectname}<span>|</span>{$item.size}</p>
  57. <P class="highlight">
  58. {switch name="$k"}
  59. {case value="td"}今日{:date('H:i',$item.sertime)}{/case}
  60. {case value="tm"}明日{:date('H:i',$item.sertime)}{/case}
  61. {case value="fn"}长期有效{/case}
  62. {default /}{:date('m-d H:i',$item.sertime)}
  63. {/switch}
  64. <span>|</span> {if condition="$kfkc == 'kf'"}{$item.sername}{else /}{$item.serstatusName}{/if}</P>
  65. </div>
  66. </a>
  67. {eq name="$item.subscribe" value="1"}
  68. {if condition="$kfkc == 'kf'"}
  69. <div class="order"><a href="javascript:kf_tip('{$item.id}','kf');">预约</a></div>
  70. {else /}
  71. <div class="order"><a href="javascript:kf_tip('{$item.id}','kc');">预约</a></div>
  72. {/if}
  73. {/eq}
  74. </div>
  75. {/foreach}
  76. {/if}
  77. {/foreach}
  78. </div>
  79. </div>
  80. {/empty}
  81. <div class="weui-loadmore">
  82. <i class="weui-loading"></i>
  83. <span class="weui-loadmore__tips">数据加载中,请稍等</span>
  84. </div>
  85. <div class="no-more-data"><span></span>已经到底啦(>_<)<span></span></div>
  86. {include file="layout/footer" /}
  87. {/block}
  88. {block name="detail_js"}
  89. <script>
  90. // 加载更多
  91. var currentPage = parseInt("{$listobj->currentPage()}");
  92. var lastPage = parseInt("{$listobj->lastPage()}");
  93. var total = parseInt("{$listobj->total()}");
  94. var url = window.location.href;
  95. var defaultImg = "__STATIC__/images/icon/150-150.png";
  96. var currentTag = 'td';
  97. {foreach name="list" item="vo" key="k" }
  98. {switch name="$k"}
  99. {case value="td"} currentTag = 'td'; {/case}
  100. {case value="tm"} currentTag = 'tm'; {/case}
  101. {case value="fn"} currentTag = 'fn'; {/case}
  102. {default /} currentTag = '{$k}';
  103. {/switch}
  104. {/foreach}
  105. $(".no-more-data").hide();
  106. var loading = false; //状态标记
  107. // alert(url);
  108. $(document.body).infinite(90).on("infinite", function() {
  109. // alert(total);
  110. if (loading) return;
  111. loading = true;
  112. // alert(currentPage);
  113. if (currentPage + 1 > lastPage) {
  114. $(".weui-loadmore").hide();
  115. if (currentPage > 1) {
  116. $(".no-more-data").show();
  117. }
  118. loading = false;
  119. return false;
  120. }
  121. $(".weui-loadmore").show();
  122. setTimeout(function() {
  123. currentPage += 1;
  124. $.ajax({
  125. type: "POST",
  126. timeOut: 10000,
  127. url: url,
  128. data: {
  129. "page": currentPage
  130. },
  131. async: false,
  132. success: function(res) {
  133. // console.log(res);
  134. var arr = res.data;
  135. console.log(arr);
  136. $.each(arr,function(key,item){
  137. html = '';
  138. if(item.length){
  139. if(!(currentTag && currentTag==key)){
  140. html += '<div class="service-date">'+
  141. '<img src="__STATIC__/images/mobile/icon/date.png">';
  142. if(key=='td'){
  143. currentTag = 'td';
  144. html += '<p>今日{if condition="$kfkc == 'kf'"}开服{else /}开测{/if}<span>{$today}</span></p>';
  145. }
  146. else if(key=='tm'){
  147. currentTag = 'tm';
  148. html += '<p>明日{if condition="$kfkc == 'kf'"}开服{else /}开测{/if}<span>{$tomorrow}</span></p>';
  149. }
  150. else if(key=='fn'){
  151. currentTag = 'fn';
  152. html += '<p>长期有效</p>';
  153. }
  154. else{
  155. currentTag = key;
  156. html += '<p>'+key+'</p>';
  157. }
  158. html += '</div>';
  159. }
  160. item.forEach(function(val, index) {
  161. var gameUrl = '{:getMobileGameUrl("'+val.gameid+'")}';
  162. html += '<div class="game-info">';
  163. if(val.libaonum > 0){
  164. html += '<a href=""><img src="__STATIC__/images/mobile/icon/gift.png" class="gift"></a>';
  165. }
  166. html += '<a href="'+gameUrl+'">'+
  167. '<img src="'+val.mobileicon+'">'+
  168. '<div class="content">'+
  169. '<h4 class="title">'+val.nickname+'</h4>'+
  170. '<p>'+val.typename+'<span>|</span>'+val.subjectname+'<span>|</span>'+val.size+'</p>'+
  171. '<P class="highlight">';
  172. if(key=='td'){
  173. html += '今日'+val.hsTime;
  174. }
  175. else if(key=='tm'){
  176. html += '明日'+val.hsTime;
  177. }
  178. else if(key=='fn'){
  179. html += '长期有效';
  180. }
  181. else{
  182. html += key;
  183. }
  184. html += '<span>|</span>'
  185. {if condition="$kfkc == 'kf'"}
  186. html += val.sername;
  187. {else /}
  188. html += val.serstatusName;
  189. {/if}
  190. html += '</P></div></a>';
  191. {if condition="$kfkc == 'kf'"}
  192. if(val.subscribe==1){
  193. html += "<div class='order'><a href=\"javascript:kf_tip("+val.id+",'kf');\">预约</a></div>";
  194. }
  195. {else /}
  196. if(val.subscribe==1){
  197. html += "<div class='order'><a href=\"javascript:kf_tip("+val.id+",'kc');\">预约</a></div>";
  198. }
  199. {/if}
  200. html += '</div>';
  201. });
  202. $(".game-list").append(html);
  203. }
  204. })
  205. },
  206. error: function() {
  207. $.alert("网络错误,请刷新页面重试");
  208. }
  209. });
  210. $.getScript("/static/js/mobile/reload.js");
  211. $(".weui-loadmore").hide();
  212. loading = false;
  213. }, 500); //模拟延迟
  214. });
  215. // 预约弹窗
  216. function kf_tip(id,kfkc){
  217. $.ajax({
  218. type: "POST",
  219. timeOut: 10000,
  220. url: '/service/subscribe',
  221. data: {
  222. "id": id,
  223. "type": kfkc
  224. },
  225. async: false,
  226. success: function (res) {
  227. // console.log(res);
  228. if (res.code == 1 || res.code == 4 || res.code == 5) {
  229. $.modal({
  230. title: "提示",
  231. text: res.msg,
  232. buttons: [{
  233. text: "确定",
  234. className: "pop-button",
  235. onClick: function() {}
  236. },
  237. {
  238. text: "关闭",
  239. className: "default",
  240. onClick: function() {}
  241. },
  242. ]
  243. });
  244. }
  245. else if (res.code == 2){
  246. window.location.href = res.data;
  247. }
  248. else if (res.code == 3){
  249. $.modal({
  250. title: "提示",
  251. text: res.msg,
  252. buttons: [{
  253. text: "去绑定",
  254. onClick: function() {
  255. // 跳转链接
  256. window.location.href = res.data;
  257. }
  258. },
  259. {
  260. text: "取消",
  261. className: "default",
  262. onClick: function() {}
  263. },
  264. ]
  265. });
  266. }else {
  267. alert(res.msg);
  268. }
  269. },
  270. error: function () {
  271. layer.msg('网络错误,请刷新页面重试');
  272. }
  273. });
  274. }
  275. /*
  276. $(".order").on("click", function() {
  277. $.modal({
  278. title: "提示",
  279. text: "请先绑定手机号",
  280. buttons: [{
  281. text: "去绑定",
  282. onClick: function() {
  283. // 跳转链接
  284. }
  285. },
  286. {
  287. text: "取消",
  288. className: "default",
  289. onClick: function() {}
  290. },
  291. ]
  292. });
  293. // $.modal({
  294. // title: "提示",
  295. // text: "离开测时间不足1小时,无法预约",
  296. // buttons: [{
  297. // text: "确定",
  298. // className: "pop-button",
  299. // onClick: function() {}
  300. // },
  301. // {
  302. // text: "关闭",
  303. // className: "default",
  304. // onClick: function() {}
  305. // },
  306. // ]
  307. // });
  308. // $.modal({
  309. // title: "提示",
  310. // text: "您已成功预约过该开测信息",
  311. // buttons: [{
  312. // text: "确定",
  313. // className: "pop-button",
  314. // onClick: function() {}
  315. // },
  316. // {
  317. // text: "关闭",
  318. // className: "default",
  319. // onClick: function() {}
  320. // },
  321. // ]
  322. // });
  323. // $.modal({
  324. // title: "提示",
  325. // text: "您已成功预约该开测信息,到时会以短信形式通知,请留意",
  326. // buttons: [{
  327. // text: "确定",
  328. // className: "pop-button",
  329. // onClick: function() {}
  330. // },
  331. // {
  332. // text: "关闭",
  333. // className: "default",
  334. // onClick: function() {}
  335. // },
  336. // ]
  337. // });
  338. })
  339. */
  340. </script>
  341. {/block}
  342. </body>
  343. </html>