feat(web/problem): problem info card

This commit is contained in:
Baoshuo Ren 2022-12-04 20:44:51 +08:00
parent dbdc49e73a
commit 720db7727a
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A
4 changed files with 122 additions and 12 deletions

View File

@ -250,8 +250,6 @@ if (UOJContest::cur()) {
时间限制: <?= $time_limit ? "$time_limit s" : "N/A" ?> 时间限制: <?= $time_limit ? "$time_limit s" : "N/A" ?>
&emsp; &emsp;
空间限制: <?= $memory_limit ? "$memory_limit MB" : "N/A" ?> 空间限制: <?= $memory_limit ? "$memory_limit MB" : "N/A" ?>
&emsp;
上传者: <?= UOJProblem::cur()->getUploaderLink() ?>
</div> </div>
<hr> <hr>
@ -381,9 +379,46 @@ if (UOJContest::cur()) {
</li> </li>
<?php endif ?> <?php endif ?>
</ul> </ul>
<div class="card-footer bg-transparent"> </div>
评价:<?= UOJProblem::cur()->getZanBlock() ?>
</div> <!-- 题目信息卡片 -->
<div class="card mb-2">
<ul class="list-group list-group-flush">
<li class="list-group-item d-flex justify-content-between align-items-center">
<span>上传者</span>
<span><?= UOJProblem::cur()->getUploaderLink() ?></span>
</li>
<li class="list-group-item d-flex justify-content-between align-items-center">
<span>难度</span>
<span><?= UOJProblem::getDifficultyHTML(UOJProblem::info('difficulty')) ?></span>
</li>
<?php if (Auth::check()) : ?>
<li class="list-group-item d-flex justify-content-between align-items-center">
<span>历史分数</span>
<?php $his_score = DB::selectSingle(["select max(score)", "from submissions", "where", ["problem_id" => UOJProblem::info('id'), "submitter" => Auth::id()]]) ?>
<a class="<?= is_null($his_score) ? '' : 'uoj-score' ?>" href="<?= HTML::url('/submissions', ['params' => ['problem_id' => UOJProblem::info('id'), 'submitter' => Auth::id()]]) ?>">
<?= is_null($his_score) ? '无' : $his_score ?>
</a>
</li>
<?php endif ?>
<li class="list-group-item d-flex justify-content-between align-items-center">
<span>标签</span>
<span>
<?php foreach (UOJProblem::cur()->queryTags() as $tag) : ?>
<a class="uoj-problem-tag">
<span class="badge bg-secondary">
<?= HTML::escape($tag) ?>
</span>
</a>
<?php endforeach ?>
</span>
</li>
<li class="list-group-item d-flex justify-content-between align-items-center">
<span>评价</span>
<span><?= UOJProblem::cur()->getZanBlock() ?></span>
</li>
</ul>
</div> </div>
<!-- 附件 --> <!-- 附件 -->
@ -411,6 +446,7 @@ if (UOJContest::cur()) {
if (UOJContest::cur() && UOJContest::cur()->progress() <= CONTEST_IN_PROGRESS) { if (UOJContest::cur() && UOJContest::cur()->progress() <= CONTEST_IN_PROGRESS) {
$sidebar_config['upcoming_contests_hidden'] = ''; $sidebar_config['upcoming_contests_hidden'] = '';
} }
uojIncludeView('sidebar', $sidebar_config); uojIncludeView('sidebar', $sidebar_config);
?> ?>
</aside> </aside>

View File

@ -656,7 +656,6 @@ $info_form->runAtServer();
<div class="row"> <div class="row">
<!-- left col --> <!-- left col -->
<div class="col-12 col-lg-9"> <div class="col-12 col-lg-9">
<h1> <h1>
#<?= $problem['id'] ?>. <?= $problem['title'] ?> 管理 #<?= $problem['id'] ?>. <?= $problem['title'] ?> 管理
</h1> </h1>

View File

@ -206,6 +206,7 @@ $pag = new Paginator($pag_config);
<!-- right col --> <!-- right col -->
<aside class="col-lg-3 mt-3 mt-lg-0"> <aside class="col-lg-3 mt-3 mt-lg-0">
<!-- 题目导航 -->
<div class="card card-default mb-2"> <div class="card card-default mb-2">
<ul class="nav nav-pills nav-fill flex-column" role="tablist"> <ul class="nav nav-pills nav-fill flex-column" role="tablist">
<li class="nav-item text-start"> <li class="nav-item text-start">
@ -241,9 +242,46 @@ $pag = new Paginator($pag_config);
</li> </li>
<?php endif ?> <?php endif ?>
</ul> </ul>
<div class="card-footer bg-transparent"> </div>
评价:<?= UOJProblem::cur()->getZanBlock() ?>
</div> <!-- 题目信息卡片 -->
<div class="card mb-2">
<ul class="list-group list-group-flush">
<li class="list-group-item d-flex justify-content-between align-items-center">
<span>上传者</span>
<span><?= UOJProblem::cur()->getUploaderLink() ?></span>
</li>
<li class="list-group-item d-flex justify-content-between align-items-center">
<span>难度</span>
<span><?= UOJProblem::getDifficultyHTML(UOJProblem::info('difficulty')) ?></span>
</li>
<?php if (Auth::check()) : ?>
<li class="list-group-item d-flex justify-content-between align-items-center">
<span>历史分数</span>
<?php $his_score = DB::selectSingle(["select max(score)", "from submissions", "where", ["problem_id" => UOJProblem::info('id'), "submitter" => Auth::id()]]) ?>
<a class="<?= is_null($his_score) ? '' : 'uoj-score' ?>" href="<?= HTML::url('/submissions', ['params' => ['problem_id' => UOJProblem::info('id'), 'submitter' => Auth::id()]]) ?>">
<?= is_null($his_score) ? '无' : $his_score ?>
</a>
</li>
<?php endif ?>
<li class="list-group-item d-flex justify-content-between align-items-center">
<span>标签</span>
<span>
<?php foreach (UOJProblem::cur()->queryTags() as $tag) : ?>
<a class="uoj-problem-tag">
<span class="badge bg-secondary">
<?= HTML::escape($tag) ?>
</span>
</a>
<?php endforeach ?>
</span>
</li>
<li class="list-group-item d-flex justify-content-between align-items-center">
<span>评价</span>
<span><?= UOJProblem::cur()->getZanBlock() ?></span>
</li>
</ul>
</div> </div>
<div class="card card-default mb-2"> <div class="card card-default mb-2">

View File

@ -314,9 +314,46 @@ $submissions_sort_by_choice = !isset($_COOKIE['submissions-sort-by-code-length']
</li> </li>
<?php endif ?> <?php endif ?>
</ul> </ul>
<div class="card-footer bg-transparent"> </div>
评价:<?= UOJProblem::cur()->getZanBlock() ?>
</div> <!-- 题目信息卡片 -->
<div class="card mb-2">
<ul class="list-group list-group-flush">
<li class="list-group-item d-flex justify-content-between align-items-center">
<span>上传者</span>
<span><?= UOJProblem::cur()->getUploaderLink() ?></span>
</li>
<li class="list-group-item d-flex justify-content-between align-items-center">
<span>难度</span>
<span><?= UOJProblem::getDifficultyHTML(UOJProblem::info('difficulty')) ?></span>
</li>
<?php if (Auth::check()) : ?>
<li class="list-group-item d-flex justify-content-between align-items-center">
<span>历史分数</span>
<?php $his_score = DB::selectSingle(["select max(score)", "from submissions", "where", ["problem_id" => UOJProblem::info('id'), "submitter" => Auth::id()]]) ?>
<a class="<?= is_null($his_score) ? '' : 'uoj-score' ?>" href="<?= HTML::url('/submissions', ['params' => ['problem_id' => UOJProblem::info('id'), 'submitter' => Auth::id()]]) ?>">
<?= is_null($his_score) ? '无' : $his_score ?>
</a>
</li>
<?php endif ?>
<li class="list-group-item d-flex justify-content-between align-items-center">
<span>标签</span>
<span>
<?php foreach (UOJProblem::cur()->queryTags() as $tag) : ?>
<a class="uoj-problem-tag">
<span class="badge bg-secondary">
<?= HTML::escape($tag) ?>
</span>
</a>
<?php endforeach ?>
</span>
</li>
<li class="list-group-item d-flex justify-content-between align-items-center">
<span>评价</span>
<span><?= UOJProblem::cur()->getZanBlock() ?></span>
</li>
</ul>
</div> </div>
<?php uojIncludeView('sidebar') ?> <?php uojIncludeView('sidebar') ?>