增加难度分类按钮
This commit is contained in:
@@ -15,6 +15,20 @@
|
||||
</div>
|
||||
<div class="results" style="width: 100%; "></div>
|
||||
</div>
|
||||
|
||||
<!-- 添加难度按钮 -->
|
||||
<div style="display: inline-block; margin-left: 10px; vertical-align: top;">
|
||||
<?php for ($i = 1; $i <= 8; $i++): ?>
|
||||
<button
|
||||
type="button"
|
||||
class="ui mini basic button difficulty-btn"
|
||||
data-difficulty="<?php echo $i; ?>"
|
||||
style="margin-right: 5px; margin-bottom: 5px;"
|
||||
>
|
||||
难度<?php echo $i; ?>
|
||||
</button>
|
||||
<?php endfor; ?>
|
||||
</div>
|
||||
|
||||
<?php if (isset($_SESSION[$OJ_NAME . '_' . 'administrator'])): ?>
|
||||
<div class="ui search" style="width: 120px; height: 28px; margin-top: -5.3px; display: inline-block;">
|
||||
@@ -72,6 +86,41 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// 添加难度按钮点击事件
|
||||
document.querySelectorAll('.difficulty-btn').forEach(button => {
|
||||
button.addEventListener('click', function() {
|
||||
const difficulty = this.getAttribute('data-difficulty');
|
||||
|
||||
// 创建隐藏表单提交
|
||||
const form = document.createElement('form');
|
||||
form.method = 'get';
|
||||
form.action = '';
|
||||
|
||||
// 添加难度参数
|
||||
const input = document.createElement('input');
|
||||
input.type = 'hidden';
|
||||
input.name = 'difficulty';
|
||||
input.value = difficulty;
|
||||
form.appendChild(input);
|
||||
|
||||
// 保留现有搜索参数
|
||||
const existingSearch = document.querySelector('input[name="search"]');
|
||||
if (existingSearch && existingSearch.value) {
|
||||
const searchInput = document.createElement('input');
|
||||
searchInput.type = 'hidden';
|
||||
searchInput.name = 'search';
|
||||
searchInput.value = existingSearch.value;
|
||||
form.appendChild(searchInput);
|
||||
}
|
||||
|
||||
// 提交表单
|
||||
document.body.appendChild(form);
|
||||
form.submit();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<?php if (!isset($_GET['list'])) { ?>
|
||||
|
||||
<div style="margin-bottom: 30px; ">
|
||||
@@ -230,4 +279,4 @@
|
||||
<script type="text/javascript" src="include/jquery.tablesorter.js"></script>
|
||||
|
||||
</div>
|
||||
<?php include("template/$OJ_TEMPLATE/footer.php"); ?>
|
||||
<?php include("template/$OJ_TEMPLATE/footer.php"); ?>
|
||||
|
||||
Reference in New Issue
Block a user