Commit 711f256d by 宁成龙

完善输入体验

parent b170e545
...@@ -32,6 +32,7 @@ class SaveUserAddressHandle extends Form implements LazyRenderable ...@@ -32,6 +32,7 @@ class SaveUserAddressHandle extends Form implements LazyRenderable
if (empty($address)) { if (empty($address)) {
return $this->response()->error("地址不存在"); return $this->response()->error("地址不存在");
} }
$input['is_default'] = $input['is_default'] ?? 0;
$input = array_filter($input, function ($value) { $input = array_filter($input, function ($value) {
return $value !== null; return $value !== null;
}); });
...@@ -58,7 +59,7 @@ class SaveUserAddressHandle extends Form implements LazyRenderable ...@@ -58,7 +59,7 @@ class SaveUserAddressHandle extends Form implements LazyRenderable
"city" => $input["city"] ?? "", "city" => $input["city"] ?? "",
"post_code" => $input["post_code"] ?? "", "post_code" => $input["post_code"] ?? "",
"detail_address" => $input["detail_address"] ?? "", "detail_address" => $input["detail_address"] ?? "",
"is_default" => $input["is_default"] ?? "", "is_default" => $input["is_default"] ?? 0,
"create_time" => time(), "create_time" => time(),
"update_time" => time(), "update_time" => time(),
]; ];
...@@ -104,7 +105,7 @@ class SaveUserAddressHandle extends Form implements LazyRenderable ...@@ -104,7 +105,7 @@ class SaveUserAddressHandle extends Form implements LazyRenderable
$row->width(12)->textarea('detail_address')->required(); $row->width(12)->textarea('detail_address')->required();
}); });
$this->row(function (Row $row) { $this->row(function (Row $row) {
$row->width(3)->switch('is_default')->required(); $row->width(3)->switch('is_default');
}); });
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment