refactor(super_manage/image_hosting): uoj_form_v2

This commit is contained in:
Baoshuo Ren 2023-01-16 22:14:43 +08:00
parent ac45c82f44
commit 7f97630abf
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A

View File

@ -1019,14 +1019,10 @@ if ($cur_tab == 'index') {
dieWithAlert('删除成功!'); dieWithAlert('删除成功!');
} }
$change_user_image_total_size_limit_form = new UOJBs4Form('change_user_image_total_size_limit'); $change_user_image_total_size_limit_form = new UOJForm('change_user_image_total_size_limit');
$change_user_image_total_size_limit_form->submit_button_config['align'] = 'compressed'; $change_user_image_total_size_limit_form->addInput('change_user_image_total_size_limit_username', [
$change_user_image_total_size_limit_form->addInput( 'label' => '用户名',
'change_user_image_total_size_limit_username', 'validator_php' => function ($x, &$vdata) {
'text',
'用户名',
'',
function ($x, &$vdata) {
if (!validateUsername($x)) { if (!validateUsername($x)) {
return '用户名不合法'; return '用户名不合法';
} }
@ -1039,14 +1035,13 @@ if ($cur_tab == 'index') {
return ''; return '';
}, },
null ]);
); $change_user_image_total_size_limit_form->addInput('change_user_image_total_size_limit_limit', [
$change_user_image_total_size_limit_form->addInput( 'div_class' => 'mt-3',
'change_user_image_total_size_limit_limit', 'label' => '存储限制',
'text', 'default_value' => '104857600',
'存储限制单位Byte', 'help' => '限制单位为 Byte。',
'104857600', 'validator_php' => function ($x, &$vdata) {
function ($x, &$vdata) {
if (!validateUInt($x, 10)) { if (!validateUInt($x, 10)) {
return '限制不合法'; return '限制不合法';
} }
@ -1059,8 +1054,7 @@ if ($cur_tab == 'index') {
return ''; return '';
}, },
null ]);
);
$change_user_image_total_size_limit_form->handle = function (&$vdata) { $change_user_image_total_size_limit_form->handle = function (&$vdata) {
DB::update([ DB::update([
"update user_info", "update user_info",
@ -1084,7 +1078,6 @@ if ($cur_tab == 'index') {
<?= UOJLocale::get('system manage') ?> <?= UOJLocale::get('system manage') ?>
</h1> </h1>
<div class="row mt-4"> <div class="row mt-4">
<!-- left col --> <!-- left col -->
<div class="col-md-3"> <div class="col-md-3">