算法评测平台前端。
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

188 lines
7.6 KiB

<% this.title = '首页'; %>
<% include header %>
<div class="padding">
<div class="ui three column grid">
<div class="eleven wide column">
<h4 class="ui top attached block header">公告</h4>
<div class="ui bottom attached segment">
<table class="ui very basic table">
<thead>
<tr>
<th>标题</th>
<th>时间</th>
</tr>
</thead>
<tbody>
<% for (let item of notices) { %>
<tr>
<td><a href="<%= item.url %>"><%= item.title %></a></td>
<td><%= item.date %></td>
</tr>
<% } %>
</tbody>
</table>
</div>
<h4 class="ui top attached block header">排名</h4>
<div class="ui bottom attached segment">
<table class="ui very basic center aligned table">
<thead>
<tr>
<th>#</th>
<th>昵称</th>
<th>个性签名</th>
</tr>
</thead>
<tbody>
<%
let i = 0;
for (let user of ranklist) {
++i;
%>
<tr>
<td><%= i %></td>
<td><a href="<%= syzoj.utils.makeUrl(['user', user.id]) %>"><%= user.username %></a><% if (user.nameplate) { %><%- user.nameplate %><% } %></td>
<td>
<div style="max-height: 70px; overflow: hidden; ">
<table width="100%"><tr style="border: none; "><td style="padding: 0; ">
<%- user.information %>
</td></table>
</div>
</td>
</tr>
<%
} %>
</tbody>
</table>
</div>
</div>
<div class="right floated five wide column">
<% if (hitokoto) { %>
<h4 class="ui top attached block header">一言(ヒトコト)</h4>
<div class="ui bottom attached center aligned segment">
<div style="font-size: 1em; line-height: 1.5em; "><%= hitokoto.hitokoto %></div>
<% if (hitokoto.source) { %><div style="text-align: right; margin-top: 15px; font-size: 0.9em; color: #666; ">——<%= hitokoto.source %></div><% } %>
</div>
<% } %>
<%
if (fortune) {
let color;
if (fortune.fortune.indexOf('吉') != -1) color = '#1fb752';
else if (fortune.fortune.indexOf('凶') != -1) color = '#f25e65';
else color = '#444';
%>
<h4 class="ui top attached block header">今日运势</h4>
<div class="ui bottom attached segment">
<div style="height: 15px; "></div>
<div class="ui two column center aligned padded grid">
<div class="one column row">
<div style="text-align: center; ">
<div style="color: <%= color %>; font-size: 49px;"><%- (user.sex == -1 ? '♀ ' : '♂ ') + fortune.fortune + (user.sex == 1 ? ' <span style="transform: scaleX(-1); display: inline-block; ">♂</span>' : ' ♀') %></div>
</div>
</div>
<div class="two column row">
<div class="column">
<div style="color: #1fb752; ">
<% if (fortune.good.length) { %>
<strong>宜:</strong><%= fortune.good[0].title %>
<br>
<span style="color: #888; font-size: 0.7em; "><%= fortune.good[0].detail %></span>
<div style="margin-top: 10px; "></div>
<strong>宜:</strong><%= fortune.good[1].title %>
<br>
<span style="color: #888; font-size: 0.7em; "><%= fortune.good[1].detail %></span>
<% } else { %>
<strong>诸事不宜<br>
</strong>
<% } %>
</div>
</div>
<div class="column">
<div style="color: #f25e65; ">
<% if (fortune.bad.length) { %>
<strong>忌:</strong><%= fortune.bad[0].title %>
<br>
<span style="color: #888; font-size: 0.7em; "><%= fortune.bad[0].detail %></span>
<div style="margin-top: 10px; "></div>
<strong>忌:</strong><%= fortune.bad[1].title %>
<br>
<span style="color: #888; font-size: 0.7em; "><%= fortune.bad[1].detail %></span>
<% } else { %>
<strong>万事皆宜<br>
</strong>
<% } %>
</div>
</div>
</div>
</div>
</div>
<% } %>
<h4 class="ui top attached block header">搜索题目</h4>
<div class="ui bottom attached segment">
<div class="ui search" style="width: 100%; ">
<div class="ui left icon input" style="width: 100%; ">
<input class="prompt" style="width: 100%; " type="text" placeholder="ID / 题目名 …">
<i class="search icon"></i>
</div>
<div class="results" style="width: 100%; "></div>
</div>
</div>
<h4 class="ui top attached block header">近期比赛</h4>
<div class="ui bottom attached <% if (!contests || !contests.length) { %>center aligned <% } %>segment">
<% if (!contests || !contests.length) { %>
还没有举行过任何比赛
<% } else { %>
<table class="ui very basic center aligned table">
<thead>
<tr>
<th>比赛名称</th>
<th>开始时间</th>
</tr>
</thead>
<tbody>
<%
for (let contest of contests) {
let now = syzoj.utils.getCurrentDate();
let tag = '';
%>
<tr>
<% if (now < contest.start_time) { %>
<% tag = '<span class="ui header"><div class="ui mini grey label">未开始</div></span>' %>
<% } else if (now >= contest.start_time && now < contest.end_time) { %>
<% tag = '<span class="ui header"><div class="ui mini green label">进行中</div></span>' %>
<% } else { %>
<% tag = '<span class="ui header"><div class="ui mini red label">已结束</div></span>' %>
<% } %>
<td><a href="<%= syzoj.utils.makeUrl(['contest', contest.id]) %>"><%= contest.title %> <%- tag %></a></td>
<td><%= syzoj.utils.formatDate(contest.start_time) %></td>
</tr>
<% } %>
</tbody>
</table>
<% } %>
</div>
<h4 class="ui top attached block header">信息栏</h4>
<div class="ui bottom attached <% if (!syzoj.config.announcement) { %>center aligned <% } %>segment">
<% if (!syzoj.config.announcement) { %>
无任何信息
<% } else { %>
<p><%- syzoj.config.announcement %></p>
<% } %>
</div>
</div>
</div>
</div>
<script>
$(function () {
$('.ui.search').search({
debug: true,
apiSettings: {
url: '/api/v2/search/problems/{query}',
cache: false
},
fields: {
title: 'name'
}
});
});
</script>
<% include footer %>