boxContent.tmpl 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <% if(data.length > 0) { %>
  2. <ul class="recent-list">
  3. <%
  4. var matchHistory = data;
  5. for(var i=0;i<matchHistory.length;i++) {
  6. var item = matchHistory[i];
  7. var champion = item.champion;
  8. var imgSrc = staticImg + '/champions/' + champion.name + '_40x40.jpg';
  9. // 时间计算
  10. var localTime = moment.utc(item.created).toDate();
  11. localTime = moment(localTime).format('YYYY-MM-DD HH:mm:ss');
  12. var timeArr = localTime.split(' ');
  13. var monDayArr = timeArr[0].split('-');
  14. var hourMinArr = timeArr[1].split(':');
  15. var time = monDayArr[1] + '-' + monDayArr[2] + ' ' + hourMinArr[0] + ':' + hourMinArr[1];
  16. var winHtml = "";
  17. if(item.battle_result) {
  18. winHtml = '<em class="green">' + (item.lastday == 1 ? '算你狠' : '胜利') + '</em>';
  19. } else {
  20. winHtml = '<em class="red">' + (item.lastday == 0 ? '失败' : '失败') + '</em>';
  21. }
  22. var name = champion.display_name.concat(champion.title);
  23. %>
  24. <li data-id="<%=item.game_id%>" data-name="<%=name%>" data-enname="<%=champion.name%>">
  25. <%if (item.flag_mvp_carry == 1) {%>
  26. <i class='item--mvp'></i>
  27. <%} else if (item.flag_mvp_carry == 2) {%>
  28. <i class='item--stronger'></i>
  29. <%} %>
  30. <span class="avatar">
  31. <img src="<%=imgSrc%>" alt="<%=champion.name%>" title="<%=champion.title%>"/>
  32. </span>
  33. <p>
  34. <%=winHtml%>
  35. </p>
  36. <p class="info">
  37. <span class="game" style="width:48px;height:25px;overflow:hidden;text-align: left" title="<%=item.game_type.name_cn%>"><%=item.game_type.name_cn%></span><span style="padding-left:2px;"><%=time%></span>
  38. </p>
  39. <!-- <%
  40. if (data.isSelf) {
  41. if (!item.collected) {
  42. %>
  43. <i data-time="<%=item.time%>" class="add-fav fav-btn" data-id="<%=item.game_id%>" title="点击收藏比赛"></i>
  44. <% } else { %>
  45. <i data-time='<%=item.time%>' title="点击删除此收藏" class="fav fav-btn" data-id="<%=item.game_id%>"></i>
  46. <%}}%> -->
  47. </li>
  48. <%}%>
  49. </ul>
  50. <%
  51. var p = parseInt(data.p);
  52. var totalPage = data.totalPage;
  53. var prevClass = p == 1 ? "disable" : "";
  54. var nextClass = p == totalPage ? "disable" : "";
  55. var prevPage = p - 1;
  56. var nextPage = p + 1;
  57. %>
  58. <div class="zj-page">
  59. <a class="zj-prev zj-s <%=prevClass%>" title="上一页" data-page="<%=prevPage%>"></a> <input type="text" class="zj-cur"
  60. value="<%=p%>"> <span class="page-num"> / <%=totalPage%></span>
  61. <a class="go-page" style="cursor:pointer;">GO</a> <a class="zj-next zj-s <%=nextClass%>" title="下一页" data-page="<%=nextPage%>"></a>
  62. </div>
  63. <% } else { %>
  64. <%
  65. $('.box-bd').html('<p class="no-records">盒子没有保存过此玩家的对战记录。</p>');
  66. %>
  67. <%}%>