From 0316830bd0a7c733431cff646ca24abb94d2ef45 Mon Sep 17 00:00:00 2001 From: Baoshuo Date: Sun, 5 Feb 2023 18:52:22 +0800 Subject: [PATCH] fix(problem/manage/data/configure): point_score layout --- web/app/models/UOJProblemConfigure.php | 23 +++++++++++++++++++++-- web/js/uoj.js | 6 +++--- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/web/app/models/UOJProblemConfigure.php b/web/app/models/UOJProblemConfigure.php index 79e1303..bfa9a87 100644 --- a/web/app/models/UOJProblemConfigure.php +++ b/web/app/models/UOJProblemConfigure.php @@ -101,7 +101,7 @@ class UOJProblemConfigure { $this->simple_form->appendHTML(<< 展开/收起全部 -
+
EOD); @@ -115,8 +115,27 @@ class UOJProblemConfigure { }); $('#input-score_type').change(function() { - problem_conf['score_type'] = $(this).val(); + var score_type = $(this).val(); + var step = '1'; + problem_conf['score_type'] = score_type; + + if (score_type == 'int') { + step = '1'; + } else { + var decimal_places = parseInt(score_type.substring(5)); + + if (decimal_places == 0) { + step = '1'; + } else { + step = (0).toFixed(decimal_places - 1) + '1'; + } + } + + $('.uoj-problem-configure-point-score-input', $('#div-point-score-container')).attr('step', step); $('.uoj-problem-configure-point-score-input', $('#div-point-score-container')).first().trigger('change'); + + $('.uoj-problem-configure-subtask-score-input', $('#div-point-score-container')).attr('step', step); + $('.uoj-problem-configure-subtask-score-input', $('#div-point-score-container')).first().trigger('change'); }); $('#div-point-score-container').problem_configure_point_scores(problem_conf); diff --git a/web/js/uoj.js b/web/js/uoj.js index a100769..2d20714 100644 --- a/web/js/uoj.js +++ b/web/js/uoj.js @@ -1236,9 +1236,9 @@ $.fn.problem_configure_point_scores = function(problem_conf) { $(this).append( $('
').append( - $('
') - .append($('
').append('')) - .append($('
').append(input_point_score)) + $('
') + .append($('
').append('')) + .append($('
').append(input_point_score)) ) ); }