mirror of
https://github.com/renbaoshuo/S2OJ.git
synced 2024-11-22 16:08:42 +00:00
refactor(contest/self_review): uoj_form_v2
This commit is contained in:
parent
382ac27d63
commit
948d44ba8d
@ -238,8 +238,8 @@ if ($cur_tab == 'dashboard') {
|
|||||||
}
|
}
|
||||||
} elseif ($cur_tab == 'self_reviews') {
|
} elseif ($cur_tab == 'self_reviews') {
|
||||||
if (UOJContest::cur()->userHasMarkedParticipated(Auth::user())) {
|
if (UOJContest::cur()->userHasMarkedParticipated(Auth::user())) {
|
||||||
$self_reviews_update_form = new UOJBs4Form('self_review_update');
|
$self_reviews_update_form = new UOJForm('self_review_update');
|
||||||
$self_reviews_update_form->ctrl_enter_submit = true;
|
$self_reviews_update_form->config['ctrl_enter_submit'] = true;
|
||||||
|
|
||||||
$contest_problems = DB::selectAll([
|
$contest_problems = DB::selectAll([
|
||||||
"select problem_id",
|
"select problem_id",
|
||||||
@ -261,20 +261,18 @@ if ($cur_tab == 'dashboard') {
|
|||||||
"poster" => Auth::id(),
|
"poster" => Auth::id(),
|
||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
$self_reviews_update_form->addVTextArea(
|
$self_reviews_update_form->addTextArea('self_review_update__problem_' . $contest_problems[$i]['problem']->getLetter(), [
|
||||||
'self_review_update__problem_' . $contest_problems[$i]['problem']->getLetter(),
|
'div_class' => 'mb-3',
|
||||||
'<b>' . $contest_problems[$i]['problem']->getLetter() . '</b>: ' . $contest_problems[$i]['problem']->info['title'],
|
'label' => '<b>' . $contest_problems[$i]['problem']->getLetter() . '</b>: ' . $contest_problems[$i]['problem']->info['title'],
|
||||||
$content,
|
'default_value' => $content,
|
||||||
function ($content) {
|
'validator_php' => function ($content) {
|
||||||
if (strlen($content) > 200) {
|
if (strlen($content) > 200) {
|
||||||
return '总结不能超过200字';
|
return '总结不能超过200字';
|
||||||
}
|
}
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
},
|
},
|
||||||
null,
|
]);
|
||||||
true
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$content = DB::selectSingle([
|
$content = DB::selectSingle([
|
||||||
@ -286,20 +284,17 @@ if ($cur_tab == 'dashboard') {
|
|||||||
"poster" => Auth::id(),
|
"poster" => Auth::id(),
|
||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
$self_reviews_update_form->addVTextArea(
|
$self_reviews_update_form->addTextArea('self_review_update__overall', [
|
||||||
'self_review_update__overall',
|
'label' => '比赛总结',
|
||||||
'比赛总结',
|
'default_value' => $content,
|
||||||
$content,
|
'validator_php' => function ($content) {
|
||||||
function ($content) {
|
|
||||||
if (strlen($content) > 200) {
|
if (strlen($content) > 200) {
|
||||||
return '总结不能超过200字';
|
return '总结不能超过200字';
|
||||||
}
|
}
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
},
|
},
|
||||||
null,
|
]);
|
||||||
true
|
|
||||||
);
|
|
||||||
|
|
||||||
$self_reviews_update_form->handle = function () use ($contest, $contest_problems) {
|
$self_reviews_update_form->handle = function () use ($contest, $contest_problems) {
|
||||||
for ($i = 0; $i < count($contest_problems); $i++) {
|
for ($i = 0; $i < count($contest_problems); $i++) {
|
||||||
|
Loading…
Reference in New Issue
Block a user