Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
杨树贤
/
ic_welfare
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
19589fc5
authored
Aug 15, 2019
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
添加前后端的表单验证
parent
1a39378c
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
45 additions
and
8 deletions
app/Http/Controllers/Api/IntegralsApiController.php
app/Http/Requests/IntegralApiRequest.php
public/js/web/updateIntegral.js
resources/views/web/updateIntegral.blade.php
app/Http/Controllers/Api/IntegralsApiController.php
View file @
19589fc5
...
...
@@ -4,6 +4,7 @@
namespace
App\Http\Controllers\Api
;
use
App\Http\Controllers\Controller
;
use
App\Http\Requests\IntegralApiRequest
;
use
App\Http\Services\IntegralService
;
use
GuzzleHttp\Client
;
use
Illuminate\Http\Request
;
...
...
@@ -36,14 +37,14 @@ class IntegralsApiController extends Controller
}
public
function
storeIntegralApi
(
Request
$request
,
IntegralService
$service
)
public
function
storeIntegralApi
(
IntegralApi
Request
$request
,
IntegralService
$service
)
{
$result
=
$service
->
storeIntegral
(
'/integrals'
,
$request
->
all
());
return
$result
;
}
public
function
updateIntegralApi
(
Request
$request
,
IntegralService
$service
)
public
function
updateIntegralApi
(
IntegralApi
Request
$request
,
IntegralService
$service
)
{
$result
=
$service
->
updateIntegral
(
'/integrals/'
.
$request
->
id
,
$request
->
all
());
...
...
app/Http/Requests/IntegralApiRequest.php
0 → 100644
View file @
19589fc5
<?php
namespace
App\Http\Requests
;
use
Illuminate\Foundation\Http\FormRequest
;
class
IntegralApiRequest
extends
FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public
function
authorize
()
{
return
true
;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public
function
rules
()
{
return
[
'name'
=>
'required'
,
'daily_limit'
=>
'required'
,
'integral_amount'
=>
'required'
,
];
}
}
public/js/web/updateIntegral.js
View file @
19589fc5
...
...
@@ -12,7 +12,7 @@ layui.use('form', function () {
data
:
data
.
field
,
success
:
function
(
result
)
{
if
(
result
.
errcode
===
0
)
{
layer
.
msg
(
'
新增
成功'
);
layer
.
msg
(
'
修改
成功'
);
window
.
location
=
'/integrals/integralList'
;
}
}
...
...
resources/views/web/updateIntegral.blade.php
View file @
19589fc5
...
...
@@ -5,14 +5,16 @@
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
红包名称
</label>
<div
class=
"layui-input-block"
>
<input
type=
"text"
name=
"name"
value=
"{{$integral['name']}}"
lay-verify=
"title"
autocomplete=
"off"
placeholder=
"请输入红包名称"
<input
type=
"text"
name=
"name"
value=
"{{$integral['name']}}"
lay-verify=
"required"
autocomplete=
"off"
placeholder=
"请输入红包名称"
class=
"layui-input"
>
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
奖励金额
</label>
<div
class=
"layui-input-block"
>
<input
type=
"text"
name=
"integral_amount"
value=
"{{$integral['integral_amount']}}"
lay-verify=
"title"
autocomplete=
"off"
<input
type=
"text"
name=
"integral_amount"
value=
"{{$integral['integral_amount']}}"
lay-verify=
"required"
autocomplete=
"off"
placeholder=
"请输入奖励金额"
class=
"layui-input"
>
</div>
...
...
@@ -21,7 +23,8 @@
<div
class=
"layui-inline"
>
<label
class=
"layui-form-label"
>
每个用户日限
</label>
<div
class=
"layui-input-inline"
>
<input
type=
"text"
name=
"daily_limit"
value=
"{{$integral['daily_limit']}}"
autocomplete=
"off"
class=
"layui-input"
>
<input
type=
"text"
name=
"daily_limit"
value=
"{{$integral['daily_limit']}}"
lay-verify=
"required"
autocomplete=
"off"
class=
"layui-input"
>
</div>
</div>
</div>
...
...
@@ -29,9 +32,10 @@
<label
class=
"layui-form-label"
>
配置状态
</label>
<div
class=
"layui-input-block"
>
@php
$check = $integral['status']?'checked':'';
$check = $integral['status']?'checked':'';
@endphp
<input
type=
"checkbox"
{{$
check
}}
value=
"{{$integral['status']}}"
name=
"status"
lay-skin=
"switch"
lay-filter=
"switchStatus"
<input
type=
"checkbox"
{{$
check
}}
value=
"{{$integral['status']}}"
name=
"status"
lay-skin=
"switch"
lay-filter=
"switchStatus"
lay-text=
"使用中|已停用"
>
<div
class=
"layui-unselect layui-form-switch layui-form-onswitch"
lay-skin=
"_switch"
>
<em>
使用中
</em><i></i>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment