zdlRank.html 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338
  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. </ul>
  84. <div class="search-input">
  85. <input class="text" type="text" value="搜索英雄" onfocus="javascript:if(this.value=='搜索英雄')this.value='';" id="searchKey">
  86. <i id="btnSearch"></i>
  87. </div>
  88. </div>
  89. </div>
  90. <div id="dataLists">
  91. <table cellspacing="0" cellpadding="0" border="0" width="100%">
  92. <thead>
  93. <th width="30">排名</th>
  94. <th width="200">玩家名称</th>
  95. <th width="180">服务器</th>
  96. <th width="100">战斗力</th>
  97. <!-- <th width="100">胜率</th> -->
  98. </thead>
  99. <tbody id="rankListBody" class="tbody">
  100. </tbody>
  101. </table>
  102. </div>
  103. <div id="pages" class="page-nav"></div>
  104. </div>
  105. <div class="mod-tabs-content hide">
  106. </div>
  107. </div>
  108. </div>
  109. </div>
  110. </div>
  111. <script type="text/template" id="dataListsTmpl">
  112. <% var rankIconBase = '<img src="http://img.lolbox.duowan.com/icon-herorank-top{{rank}}.jpg" />'; %>
  113. <%
  114. var zone = data.zone,
  115. sName = data.servername,
  116. sNickname = data.serverNickname;
  117. _.each(data.data, function(item, key){
  118. var player = item.player;
  119. %>
  120. <%
  121. var href = "generalRecord.html?userId=" + player.user_id + "&gameZone=" + zone + "&playerName=" + player.pn + "&serverName=" + sName;
  122. var rankVal = item.idx;
  123. switch(item.idx){
  124. case 1:
  125. rankVal = rankIconBase.replace('{{rank}}', 1);
  126. break;
  127. case 2:
  128. rankVal = rankIconBase.replace('{{rank}}', 2);
  129. break;
  130. case 3:
  131. rankVal = rankIconBase.replace('{{rank}}', 3);
  132. break;
  133. }
  134. %>
  135. <tr>
  136. <td align="center" class="type1"><%= rankVal %></td>
  137. <td align="center" class="type2"><a class="player-name" href="<%=href%>"><%= player.pn %></a></td>
  138. <td align="center" class="type3"><%= sNickname %>&nbsp;<%= sName %></td>
  139. <td align="center" class="type4"><%= player.box_score %></td>
  140. </tr>
  141. <% }); %>
  142. </script>
  143. <!-- <td align="center"><span class="win-green">374</span>-<span class="fail-red">241</span><span class="w-rate">(94%)</span></td> -->
  144. <script type="text/template" id="noDataTipsTmpl">
  145. <tr>
  146. <td colspan="4" class="errorTips">对不起,该玩家还没有上榜~~</td>
  147. </tr>
  148. </script>
  149. <script src="js/jquery-1.11.1.min.js"></script>
  150. <script src="js/jquery-migrate-1.2.1.min.js"></script>
  151. <script src="js/underscore.js"></script>
  152. <script type="text/javascript" src="http://sz.duowan.com/s/ya/ya.1.3.1-min.js"></script>
  153. <script src="js/new_stat.js"></script>
  154. <script src="js/jquery.nicescroll.min.js"></script>
  155. <script>
  156. var gPageIndex = 1;
  157. var gTotalItems = 0;
  158. var gTotalPages = 0;
  159. var ITEMS_PER_PAGE = 10;
  160. (function(exports){
  161. var App = function(){
  162. this.servername = '电信一';
  163. this.serverNickname = '艾欧尼亚';
  164. this.zone = 'dx1';
  165. this.page = 1;
  166. this.pageItems = 10;
  167. this.totalPages = 0;
  168. this.keywords = '';
  169. this.init();
  170. this.bindFilterEvent();
  171. }
  172. App.prototype.getData = function(){
  173. var baseUrl = "http://api.lolbox.duowan.com/api/v2/rank/box_score/";
  174. var url = baseUrl + this.zone +'?page_num=' + this.page + '&page_items=' + this.pageItems;
  175. return $.ajax({
  176. url: url,
  177. dataType: 'jsonp'
  178. });
  179. }
  180. App.prototype.process = function(playerName, page){
  181. page && (this.page = parseInt(page));
  182. if(page == 0) return;
  183. this.init();
  184. }
  185. App.prototype.init = function(){
  186. var self = this;
  187. this.getData().then(function(data){
  188. //初始化totalPages
  189. if(!self.totalPages) {
  190. gTotalPages = self.totalPages = Math.ceil(data.total_items / self.pageItems);
  191. }
  192. var list = data.results;
  193. if(list && list.length > 0) {
  194. self.render(list);
  195. } else {
  196. template = _.template($('#noDataTipsTmpl').html());
  197. gTotalPages = 0;
  198. $('#rankListBody').html(template({data: ''}));
  199. return;
  200. }
  201. });
  202. }
  203. App.prototype.render = function(data){
  204. var rData = {};
  205. rData.servername = this.servername;
  206. rData.serverNickname = this.serverNickname;
  207. rData.zone = this.zone;
  208. rData.page = this.page;
  209. rData.data = data;
  210. template = _.template($('#dataListsTmpl').html());
  211. $('#rankListBody').html(template({data: rData}));
  212. this.updatePaginator();
  213. }
  214. App.prototype.updatePaginator = function() {
  215. var output = '';
  216. if(gTotalPages){
  217. output += '<a>第' + gPageIndex + '/' + gTotalPages + '页</a>';
  218. if (gPageIndex > 1) {
  219. output += '<a title="上一页" class="pre-next" rel="prev" href="#" onclick="javascript:app.process(null, --gPageIndex);">上一页</a>';
  220. }
  221. if (gPageIndex < (gTotalPages - 1)) {
  222. output += '<a title="下一页" rel="next" class="pre-next" href="#" onclick="javascript:app.process(null, ++gPageIndex);">下一页</a>';
  223. }
  224. 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> ';
  225. }
  226. $('#pages').html(output);
  227. }
  228. App.prototype.bindFilterEvent = function(){
  229. var self = this;
  230. $("#serverFilter").on("click", function(e) {
  231. e.preventDefault();
  232. e.stopPropagation();
  233. $("#serverFilterUl").toggle();
  234. });
  235. $("#serverFilterUl>li").on('click', function(e) {
  236. e.preventDefault();
  237. var value = $(this).attr("data-value"),
  238. text = $(this).html(),
  239. zone = $(this).attr('data-zone');
  240. self.zone = zone;
  241. self.servername = value;
  242. self.serverNickname = text;
  243. self.page = 1;
  244. $('#serverFilter>span').html(text);
  245. $(this).parent().hide();
  246. self.init();
  247. });
  248. $('#searchKey').on('keyup', function(evt){
  249. if(evt.keyCode == 13) {
  250. self.process(this.value);
  251. }
  252. });
  253. $('#btnSearch').click(function(){
  254. var keywords = $('#searchKey');
  255. var val = $('#searchKey').val();
  256. self.process(val);
  257. });
  258. $('.fnMenu')
  259. .on('click', '.refresh', function(evt){
  260. evt.preventDefault();
  261. window.location.reload();
  262. })
  263. .on('click', '.back', function(evt){
  264. evt.preventDefault();
  265. window.history.back();
  266. });
  267. $("#scrollUl,#serverFilterUl").niceScroll({cursorcolor:"#D9D9D9",cursorwidth:"8",cursoropacitymin:1,cursorborder:'none'});
  268. $('body').delegate('#go', 'keyup', function(evt){
  269. if(evt.which == 13) {
  270. paginatorJump();
  271. }
  272. });
  273. }
  274. function paginatorJump() {
  275. var index = Number(document.getElementById('go').value);
  276. if (index > 0 && index <= gTotalPages) {
  277. gPageIndex = index;
  278. app.process(null, gPageIndex);
  279. } else {
  280. $('#rankListBody').html('<tr><td colspan="6" class="errorTips">输入页数不正确</td></tr>');
  281. }
  282. }
  283. var app = new App;
  284. // app.render();
  285. exports.app = app;
  286. exports.paginatorJump = paginatorJump;
  287. })(window);
  288. </script>
  289. <!--海度统计-->
  290. <script type="text/javascript">_hiido_no=0;_hiido_wid=["lbox"];</script>
  291. <script src="http://www.duowan.com/duowan.js" type="text/javascript"></script>
  292. <!--百度统计-->
  293. <script>
  294. var _hmt = _hmt || [];
  295. (function() {
  296. var hm = document.createElement("script");
  297. hm.src = "//hm.baidu.com/hm.js?72772dda37b1e926733138415981abcf";
  298. var s = document.getElementsByTagName("script")[0];
  299. s.parentNode.insertBefore(hm, s);
  300. })();
  301. </script>
  302. <!--[if gt IE 6]><!-->
  303. <script type="text/javascript">
  304. 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)}}}());
  305. </script>
  306. <!--<![endif]-->
  307. </body>
  308. </html>