今天是团队开发的第六天:
昨天完成了代码的测试,召开了会议,整理代码。
今天的任务是首页的开发,完成首页的基本布局和一些简单的功能,为队友的开发留出一些位置,以便和队友的代码相结合。
有效编程时间3h,代码行数:140
1 <% this.title = '首页'; %> 2 <% include header %> 3 <div class="padding"> 4 <div class="ui three column grid"> 5 <div class="eleven wide column"> 6 <h4 class="ui top attached block header"><i class="ui info icon"></i>公告</h4> 7 <div class="ui bottom attached segment"> 8 <table class="ui very basic table"> 9 <thead> 10 <tr> 11 <th>标题</th> 12 <th>时间</th> 13 </tr> 14 </thead> 15 <tbody> 16 <% for (let item of notices) { %> 17 <tr> 18 <td><a href="<%= item.url %>"><%= item.title %></a></td> 19 <td><%= item.date %></td> 20 </tr> 21 <% } %> 22 </tbody> 23 </table> 24 </div> 25 <h4 class="ui top attached block header"><i class="ui signal icon"></i>排名</h4> 26 <div class="ui bottom attached segment"> 27 <table class="ui very basic center aligned table" style="table-layout: fixed; "> 28 <thead> 29 <tr> 30 <th style=" 50px; ">#</th> 31 <th style=" 170px; ">用户名</th> 32 <th>个性签名</th> 33 </tr> 34 </thead> 35 <script data-cfasync="false"> 36 var lineHeight = 0; 37 (function () { 38 var div = document.createElement('div'); 39 div.style.position = 'fixed'; 40 div.style.left = -10000; 41 div.style.visibility = 'hidden'; 42 div.innerText = '测试,Test.'; 43 document.body.appendChild(div); 44 lineHeight = div.clientHeight; 45 })(); 46 </script> 47 <tbody> 48 <% 49 let i = 0; 50 for (let user of ranklist) { 51 ++i; 52 %> 53 <tr> 54 <td><b><%= i %></b></td> 55 <td><a href="#"><%= user.username %></a>#</td> 56 <td style="font-content"> 57 <script id="user-infomation-script-<%= i %>" data-cfasync="false"> 58 (function () { 59 var html = <%- serializejs(user.information) %>; 60 var elem = document.createElement('div'); 61 elem.style = 'overflow: hidden; 100%; position: relative; '; 62 elem.style.maxHeight = lineHeight + 'px'; 63 elem.innerHTML = html; 64 var imgs = Array.prototype.slice.call(elem.getElementsByTagName('img')); 65 for (var i in imgs) imgs[i].parentNode.removeChild(imgs[i]); 66 var script = document.getElementById('user-infomation-script-<%= i %>'); 67 script.parentNode.replaceChild(elem, script); 68 })(); 69 </script> 70 </td> 71 </tr> 72 <% 73 } %> 74 </tbody> 75 </table> 76 </div> 77 </div> 78 <div class="right floated five wide column"> 79 <h4 class="ui top attached block header"><i class="ui quote left icon"></i>最近更新</h4> 80 <div class="ui bottom attached center aligned segment"> 81 <table class="ui very basic center aligned table"> 82 <thead> 83 <tr> 84 <th width="70%">题目</th> 85 <th width="30%">更新时间</th> 86 </tr> 87 </thead> 88 <tbody> 89 <% 90 for (let problem of problems) { 91 %> 92 <tr> 93 <td><a href="#"><%= problem.title %></a></td> 94 <td><%= problem.time %></td> 95 </tr> 96 <% } %> 97 </tbody> 98 </table> 99 </div> 100 <h4 class="ui top attached block header"><i class="ui rss icon"></i>搜素题目</h4> 101 <div class="ui bottom attached segment"> 102 <form action="#" method="get"> 103 <div class="ui search" style=" 100%; "> 104 <div class="ui left icon input" style=" 100%; "> 105 <input class="prompt" style=" 100%; " type="text" placeholder="ID / 题目名 …" name="keyword"> 106 <i class="search icon"></i> 107 </div> 108 <div class="results" style=" 100%; "></div> 109 </div> 110 </form> 111 </div> 112 113 <% if (typeof links !== 'undefined' && links && links.length) { %> 114 <h4 class="ui top attached block header font-content"><i class="ui linkify icon"></i>友情链接</h4> 115 <div class="ui bottom attached segment"> 116 <ul style="margin: 0; padding-left: 20px; "> 117 <% for (let link of links) { %> 118 <li><a href="<%= link.url %>"><%= link.title %></a></li> 119 <% } %> 120 </ul> 121 </div> 122 <% } %> 123 </div> 124 </div> 125 </div> 126 <script> 127 $(function () { 128 $('.ui.search').search({ 129 debug: true, 130 apiSettings: { 131 url: '/api/v2/search/problems/{query}', 132 cache: false 133 }, 134 fields: { 135 title: 'name' 136 } 137 }); 138 }); 139 </script> 140 <% include footer %>