zdlRank.html 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8" />
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
  6. <title>战斗力排行榜</title>
  7. <meta name="description" content="" />
  8. <meta name="keywords" content="" />
  9. <link rel="stylesheet" href="css/global.css" />
  10. <style>
  11. body { height: 527px; overflow: hidden; }
  12. .player-name{color:#408bcb;}
  13. </style>
  14. <!--[if IE 7]>
  15. <style>
  16. .heroRankCrumbs .fnMenu{margin-top:-23px;}
  17. .page-nav A.current{vertical-align:3px;}
  18. .hero-rank .search-input{margin-top:-4px!important;}
  19. .sever-select i{margin: -17px 9px 0!important;}
  20. </style>
  21. <![endif]-->
  22. <!--[if gt IE 6]><!-->
  23. <script type="text/javascript">
  24. !function(t){t.loadScript(["http://szhuodong.duowan.com/feq/lolbox/yy-f2e-header-lolbox.min"])}(function(){function t(t){var e=n(t);document.write(e)}function n(t){for(var n,r="",c=0;n=t[c];c++)r+=e(n);return r}function e(t){var n=[unescape("%3Cscript%20type%3D%22text/javascript%22%20src%3D%22"),"",unescape("%22%3E%3C/script%3E")],e=new Date;return e.setSeconds(0),e.setMilliseconds(0),e=e.getTime(),t+="?t_="+e,n[1]=t,n.join("")}return{loadScript:function(n){n&&n.length&&n instanceof Array&&t(n)}}}())
  25. </script>
  26. <!--<![endif]-->
  27. <script src="js/jquery-1.11.1.min.js"></script>
  28. <script src="js/jquery-migrate-1.2.1.min.js"></script>
  29. <script src="js/jquery.nicescroll.min.js"></script>
  30. </head>
  31. <body scroll="no" style="overflow:hidden;">
  32. <div class="heroRankCrumbs">
  33. <a href="playerSearch.html">战绩查询</a> &gt; 战斗力榜
  34. <div class="fnMenu">
  35. <a class="icons back" href="javascript:history.back();"><i></i></a>
  36. <a class="icons refresh" href="javascript:location.reload();"><i></i></a>
  37. </div>
  38. </div>
  39. <div class="box heroRanks-tc">
  40. <div class="box-bd">
  41. <div class="mod-tabs clearfix">
  42. <div class="mod-tabs-bd hero-rank">
  43. <div class="mod-tabs-content">
  44. <div class="choose-type">
  45. <ul class="mod-tabs-trigger">
  46. <li><a class="stat-sign" stat-sign="master" href="rankScoreRank.html" stat-desc="点击/排位高手榜">排位榜</a></li>
  47. <li class="selected"><a class="stat-sign" stat-sign="action list" href="zdlRank.html" stat-desc="点击/战斗力排行榜">战斗力榜</a></li>
  48. <!-- <li><a class="stat-sign" stat-sign="hero ace" href="heroesRank.html" stat-desc="点击/英雄高手榜">英雄胜率榜</a></li> -->
  49. </ul>
  50. <div class="fr">
  51. <div class="sever-select" id="serverFilter">
  52. <span>艾欧尼亚</span>
  53. <i></i>
  54. </div>
  55. <ul class="rank-ul server-ul" id="serverFilterUl">
  56. <li data-value="电信一" data-zone="dx1">艾欧尼亚</li>
  57. <li data-value="电信二" data-zone="dx2">祖安</li>
  58. <li data-value="电信三" data-zone="dx3">诺克萨斯</li>
  59. <li data-value="电信四" data-zone="dx4">班德尔城</li>
  60. <li data-value="电信五" data-zone="dx5">皮尔特沃夫</li>
  61. <li data-value="电信六" data-zone="dx6">战争学院</li>
  62. <li data-value="电信七" data-zone="dx7">巨神峰</li>
  63. <li data-value="电信八" data-zone="dx8">雷瑟守备</li>
  64. <li data-value="电信九" data-zone="dx9">裁决之地</li>
  65. <li data-value="电信十" data-zone="dx10">黑色玫瑰</li>
  66. <li data-value="电信十一" data-zone="dx11">暗影岛</li>
  67. <li data-value="电信十二" data-zone="dx12">钢铁烈阳</li>
  68. <li data-value="电信十三" data-zone="dx13">均衡教派</li>
  69. <li data-value="电信十四" data-zone="dx14">水晶之痕</li>
  70. <li data-value="电信十五" data-zone="dx15">影流</li>
  71. <li data-value="电信十六" data-zone="dx16">守望之海</li>
  72. <li data-value="电信十七" data-zone="dx17">征服之海</li>
  73. <li data-value="电信十八" data-zone="dx18">卡拉曼达</li>
  74. <li data-value="电信十九" data-zone="dx19">皮城警备</li>
  75. <li data-value="网通一" data-zone="wt1">比尔吉沃特</li>
  76. <li data-value="网通二" data-zone="wt2">德玛西亚</li>
  77. <li data-value="网通三" data-zone="wt3">弗雷尔卓德</li>
  78. <li data-value="网通四" data-zone="wt4">无畏先锋</li>
  79. <li data-value="网通五" data-zone="wt5">恕瑞玛</li>
  80. <li data-value="网通六" data-zone="wt6">扭曲丛林</li>
  81. <li data-value="网通七" data-zone="wt7">巨龙之巢</li>
  82. <li data-value="教育一" data-zone="jy1">教育网专区</li>
  83. <li data-value="全网一" data-zone="qw1">男爵领域</li>
  84. </ul>
  85. <!--<div class="search-input">
  86. <input class="text" type="text" value="搜索玩家名" onfocus="javascript:if(this.value=='搜索玩家名')this.value='';" id="searchKey">
  87. <i id="btnSearch"></i>
  88. </div>-->
  89. </div>
  90. </div>
  91. <!--<div style="width:100%;overflow:hidden;line-height:70px;text-align:center;font-size:14px;color:#666;">正在修复更新中,稍后开放</div>-->
  92. <div id="dataLists">
  93. <table cellspacing="0" cellpadding="0" border="0" width="100%">
  94. <thead>
  95. <th width="30">排名</th>
  96. <th width="200">玩家名称</th>
  97. <th width="180">服务器</th>
  98. <th width="100">战斗力</th>
  99. </thead>
  100. <tbody id="rankListBody" class="tbody">
  101. </tbody>
  102. </table>
  103. </div>
  104. <div id="pages" class="page-nav"></div>
  105. </div>
  106. <div class="mod-tabs-content hide">
  107. </div>
  108. </div>
  109. </div>
  110. </div>
  111. </div>
  112. <script type="text/template" id="dataListsTmpl">
  113. <% var rankIconBase = '<img src="http://img.lolbox.duowan.com/icon-herorank-top{{rank}}.jpg" />'; %>
  114. <%
  115. var zone = data.zone,
  116. sName = data.servername,
  117. sNickname = data.serverNickname;
  118. _.each(data.data, function(item, key){
  119. var player = item.player;
  120. %>
  121. <%
  122. var href = "generalRecord.html?userId=" + player.user_id + "&gameZone=" + zone + "&playerName=" + player.pn + "&serverName=" + sName;
  123. var rankVal = item.idx;
  124. switch(item.idx){
  125. case 1:
  126. rankVal = rankIconBase.replace('{{rank}}', 1);
  127. break;
  128. case 2:
  129. rankVal = rankIconBase.replace('{{rank}}', 2);
  130. break;
  131. case 3:
  132. rankVal = rankIconBase.replace('{{rank}}', 3);
  133. break;
  134. }
  135. %>
  136. <tr>
  137. <td align="center" class="type1"><%= rankVal %></td>
  138. <td align="center" class="type2"><a class="player-name" href="<%=href%>"><%= player.pn %></a></td>
  139. <td align="center" class="type3"><%= sNickname %>&nbsp;<%= sName %></td>
  140. <td align="center" class="type4"><%= player.box_score %></td>
  141. </tr>
  142. <% }); %>
  143. </script>
  144. <!-- <td align="center"><span class="win-green">374</span>-<span class="fail-red">241</span><span class="w-rate">(94%)</span></td> -->
  145. <script type="text/template" id="noDataTipsTmpl">
  146. <tr>
  147. <td colspan="4" class="errorTips">对不起,该玩家还没有上榜~~</td>
  148. </tr>
  149. </script>
  150. <script src="js/jquery-1.11.1.min.js"></script>
  151. <script src="js/jquery-migrate-1.2.1.min.js"></script>
  152. <script src="js/underscore.js"></script>
  153. <script type="text/javascript" src="http://sz.duowan.com/s/ya/ya.1.3.1-min.js"></script>
  154. <script src="js/new_stat.js"></script>
  155. <script src="js/jquery.nicescroll.min.js"></script>
  156. <script>
  157. var gPageIndex = 1;
  158. var gTotalItems = 0;
  159. var gTotalPages = 0;
  160. var ITEMS_PER_PAGE = 10;
  161. (function(exports){
  162. var App = function(){
  163. this.servername = '电信一';
  164. this.serverNickname = '艾欧尼亚';
  165. this.zone = 'dx1';
  166. this.page = 1;
  167. this.pageItems = 10;
  168. this.totalPages = 0;
  169. this.keywords = '';
  170. this.init();
  171. this.bindFilterEvent();
  172. }
  173. App.prototype.getData = function(){
  174. var baseUrl = "http://api.lolbox.duowan.com/api/v2/rank/box_score/";
  175. var url = baseUrl + this.zone +'?page_num=' + this.page + '&page_items=' + this.pageItems;
  176. return $.ajax({
  177. url: url,
  178. dataType: 'jsonp'
  179. });
  180. }
  181. App.prototype.process = function(playerName, page){
  182. page && (this.page = parseInt(page));
  183. if(page == 0) return;
  184. this.init();
  185. }
  186. App.prototype.init = function(){
  187. var self = this;
  188. this.getData().then(function(data){
  189. //初始化totalPages
  190. if(!self.totalPages) {
  191. gTotalPages = self.totalPages = Math.ceil(data.total_items / self.pageItems);
  192. }
  193. var list = data.results;
  194. if(list && list.length > 0) {
  195. self.render(list);
  196. } else {
  197. template = _.template($('#noDataTipsTmpl').html());
  198. gTotalPages = 0;
  199. $('#rankListBody').html(template({data: ''}));
  200. return;
  201. }
  202. });
  203. }
  204. App.prototype.render = function(data){
  205. var rData = {};
  206. rData.servername = this.servername;
  207. rData.serverNickname = this.serverNickname;
  208. rData.zone = this.zone;
  209. rData.page = this.page;
  210. rData.data = data;
  211. template = _.template($('#dataListsTmpl').html());
  212. $('#rankListBody').html(template({data: rData}));
  213. this.updatePaginator();
  214. }
  215. App.prototype.updatePaginator = function() {
  216. var output = '';
  217. if(gTotalPages){
  218. output += '<a>第' + gPageIndex + '/' + gTotalPages + '页</a>';
  219. if (gPageIndex > 1) {
  220. output += '<a title="上一页" class="pre-next" rel="prev" href="#" onclick="javascript:app.process(null, --gPageIndex);">上一页</a>';
  221. }
  222. if (gPageIndex < (gTotalPages - 1)) {
  223. output += '<a title="下一页" rel="next" class="pre-next" href="#" onclick="javascript:app.process(null, ++gPageIndex);">下一页</a>';
  224. }
  225. output += '<a class="current">第 <input type="text" id="go" size=1 value="' + (Number(gPageIndex)) + '"/>页 </a> <a class="page-go" href="#" onclick="javascript:paginatorJump();"> Go </a> ';
  226. }
  227. $('#pages').html(output);
  228. }
  229. App.prototype.bindFilterEvent = function(){
  230. var self = this;
  231. $("#serverFilter").on("click", function(e) {
  232. e.preventDefault();
  233. e.stopPropagation();
  234. $("#serverFilterUl").toggle();
  235. });
  236. $("#serverFilterUl>li").on('click', function(e) {
  237. e.preventDefault();
  238. var value = $(this).attr("data-value"),
  239. text = $(this).html(),
  240. zone = $(this).attr('data-zone');
  241. self.zone = zone;
  242. self.servername = value;
  243. self.serverNickname = text;
  244. self.page = 1;
  245. $('#serverFilter>span').html(text);
  246. $(this).parent().hide();
  247. self.init();
  248. });
  249. $('#searchKey').on('keyup', function(evt){
  250. if(evt.keyCode == 13) {
  251. self.process(this.value);
  252. }
  253. });
  254. $('#btnSearch').click(function(){
  255. var keywords = $('#searchKey');
  256. var val = $('#searchKey').val();
  257. self.process(val);
  258. });
  259. $('.fnMenu')
  260. .on('click', '.refresh', function(evt){
  261. evt.preventDefault();
  262. window.location.reload();
  263. })
  264. .on('click', '.back', function(evt){
  265. evt.preventDefault();
  266. window.history.back();
  267. });
  268. $("#scrollUl,#serverFilterUl").niceScroll({cursorcolor:"#D9D9D9",cursorwidth:"8",cursoropacitymin:1,cursorborder:'none'});
  269. $('body').delegate('#go', 'keyup', function(evt){
  270. if(evt.which == 13) {
  271. paginatorJump();
  272. }
  273. });
  274. }
  275. function paginatorJump() {
  276. var index = Number(document.getElementById('go').value);
  277. if (index > 0 && index <= gTotalPages) {
  278. gPageIndex = index;
  279. app.process(null, gPageIndex);
  280. } else {
  281. $('#rankListBody').html('<tr><td colspan="6" class="errorTips">输入页数不正确</td></tr>');
  282. }
  283. }
  284. var app = new App;
  285. // app.render();
  286. exports.app = app;
  287. exports.paginatorJump = paginatorJump;
  288. })(window);
  289. </script>
  290. <!--海度统计-->
  291. <script type="text/javascript">_hiido_no=0;_hiido_wid=["lbox"];</script>
  292. <script src="http://www.duowan.com/duowan.js" type="text/javascript"></script>
  293. <!--百度统计-->
  294. <script>
  295. var _hmt = _hmt || [];
  296. (function() {
  297. var hm = document.createElement("script");
  298. hm.src = "//hm.baidu.com/hm.js?72772dda37b1e926733138415981abcf";
  299. var s = document.getElementsByTagName("script")[0];
  300. s.parentNode.insertBefore(hm, s);
  301. })();
  302. </script>
  303. <!--[if gt IE 6]><!-->
  304. <script type="text/javascript">
  305. window.onerror = function(a,b,c){ return true};!function(t){t.loadScript(["http://szhuodong.duowan.com/feq/lolbox/yy-f2e-lolbox.min"])}(function(){function t(e,a){var n=a[e];if(n){e++;var o=document.createElement("script");o.type="text/javascript",o.setAttribute("async","async"),o.onload=o.onreadystatechange=function(){return o.readyState&&"complete"!==o.readyState&&"loaded"!==o.readyState?!1:(o.onload=o.onreadystatechange=null,void t(e,a))};var c=new Date;c.setSeconds(0),c.setMilliseconds(0),c=c.getTime(),o.async=!0,o.src=n+"?_="+c,document.getElementsByTagName("head")[0].appendChild(o)}}return{loadScript:function(e){e&&e.length&&e instanceof Array&&t(0,e)}}}());
  306. </script>
  307. <!--<![endif]-->
  308. </body>
  309. </html>