增加难度分类按钮
This commit is contained in:
@@ -16,6 +16,20 @@
|
|||||||
<div class="results" style="width: 100%; "></div>
|
<div class="results" style="width: 100%; "></div>
|
||||||
</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'])): ?>
|
<?php if (isset($_SESSION[$OJ_NAME . '_' . 'administrator'])): ?>
|
||||||
<div class="ui search" style="width: 120px; height: 28px; margin-top: -5.3px; display: inline-block;">
|
<div class="ui search" style="width: 120px; height: 28px; margin-top: -5.3px; display: inline-block;">
|
||||||
<div class="ui icon input" style="width: 100%; ">
|
<div class="ui icon input" style="width: 100%; ">
|
||||||
@@ -72,6 +86,41 @@
|
|||||||
</div>
|
</div>
|
||||||
</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'])) { ?>
|
<?php if (!isset($_GET['list'])) { ?>
|
||||||
|
|
||||||
<div style="margin-bottom: 30px; ">
|
<div style="margin-bottom: 30px; ">
|
||||||
|
|||||||
Reference in New Issue
Block a user