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
153248f9
authored
Sep 02, 2019
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
添加日期范围选择presenter和添加时间筛选
parent
40026aed
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
43 additions
and
3 deletions
app/Http/Controllers/Api/IntegralsApiController.php
app/Presenters/TimeIntervalPresenter.php
public/js/web/integralList.js
resources/views/web/integralList.blade.php
app/Http/Controllers/Api/IntegralsApiController.php
View file @
153248f9
...
@@ -31,16 +31,17 @@ class IntegralsApiController extends Controller
...
@@ -31,16 +31,17 @@ class IntegralsApiController extends Controller
private
function
transformer
(
$data
)
private
function
transformer
(
$data
)
{
{
if
(
isset
(
$data
[
'data'
])
&&
$data
[
'data'
])
{
foreach
(
$data
[
'data'
]
as
&
$item
)
{
foreach
(
$data
[
'data'
]
as
&
$item
)
{
$item
[
'status'
]
=
$item
[
'status'
]
?
'使用中'
:
'已停用'
;
$item
[
'status'
]
=
$item
[
'status'
]
?
'使用中'
:
'已停用'
;
$item
[
'add_time'
]
=
date
(
'Y-m-d H:i:s'
,
$item
[
'add_time'
]);
$item
[
'add_time'
]
=
date
(
'Y-m-d H:i:s'
,
$item
[
'add_time'
]);
$item
[
'update_time'
]
=
$item
[
'update_time'
]
?
date
(
'Y-m-d H:i:s'
,
$item
[
'update_time'
])
:
'暂无更新'
;
$item
[
'update_time'
]
=
$item
[
'update_time'
]
?
date
(
'Y-m-d H:i:s'
,
$item
[
'update_time'
])
:
'暂无更新'
;
$item
[
'daily_limit'
]
=
"每日
{
$item
[
'daily_limit'
]
}
次"
;
$item
[
'daily_limit'
]
=
"每日
{
$item
[
'daily_limit'
]
}
次"
;
}
}
}
unset
(
$item
);
unset
(
$item
);
return
$data
;
return
$data
;
}
}
public
function
storeIntegralApi
(
IntegralApiRequest
$request
,
IntegralService
$service
)
public
function
storeIntegralApi
(
IntegralApiRequest
$request
,
IntegralService
$service
)
...
...
app/Presenters/TimeIntervalPresenter.php
0 → 100644
View file @
153248f9
<?php
namespace
App\Presenters
;
class
TimeIntervalPresenter
{
public
function
render
(
$name
,
$text
)
{
$time
=
request
()
->
get
(
$name
);
$html
=
<<<EOF
<label class="layui-form-label">$text</label>
<div class="layui-input-inline" style="min-width: 300px">
<input type="text" name="{$name}" autocomplete="off" class="layui-input">
</div>
<script>
$(window).load(function(){
var laydate = layui.laydate;
laydate.render({
elem: 'input[name=$name]'
,type: 'datetime'
,trigger:'click'
,range: '~' //或 range: '~' 来自定义分割字符
,value: '$time'
});
});
</script>
EOF;
return
$html
;
}
}
\ No newline at end of file
public/js/web/integralList.js
View file @
153248f9
...
@@ -46,6 +46,7 @@ layui.use(['table', 'form', 'laydate', 'layer'], function () {
...
@@ -46,6 +46,7 @@ layui.use(['table', 'form', 'laydate', 'layer'], function () {
var
table
=
layui
.
table
;
var
table
=
layui
.
table
;
var
form
=
layui
.
form
;
var
form
=
layui
.
form
;
table
.
render
({
table
.
render
({
elem
:
'#list'
elem
:
'#list'
,
url
:
'/integrals/api/integralList'
,
url
:
'/integrals/api/integralList'
...
@@ -59,8 +60,8 @@ layui.use(['table', 'form', 'laydate', 'layer'], function () {
...
@@ -59,8 +60,8 @@ layui.use(['table', 'form', 'laydate', 'layer'], function () {
,
defaultToolbar
:
[
'filter'
]
,
defaultToolbar
:
[
'filter'
]
,
loading
:
true
,
loading
:
true
,
cols
:
[[
,
cols
:
[[
{
type
:
'checkbox'
}
{
type
:
'checkbox'
}
,{
field
:
'id'
,
title
:
'序号'
}
,
{
field
:
'id'
,
title
:
'序号'
}
,
{
field
:
'name'
,
title
:
'红包名称'
}
,
{
field
:
'name'
,
title
:
'红包名称'
}
,
{
field
:
'amount'
,
title
:
'奖励金额'
}
,
{
field
:
'amount'
,
title
:
'奖励金额'
}
,
{
field
:
'daily_limit'
,
title
:
'每个用户日限'
,
templet
:
'#title'
}
,
{
field
:
'daily_limit'
,
title
:
'每个用户日限'
,
templet
:
'#title'
}
...
...
resources/views/web/integralList.blade.php
View file @
153248f9
...
@@ -15,6 +15,10 @@
...
@@ -15,6 +15,10 @@
{!! $statusPresenter->render('status','配置状态',request()->get('status'),[0=>'已停用',1=>'使用中']) !!}
{!! $statusPresenter->render('status','配置状态',request()->get('status'),[0=>'已停用',1=>'使用中']) !!}
</div>
</div>
<div
class=
"layui-inline"
>
<div
class=
"layui-inline"
>
@inject('timeInterval','App\Presenters\TimeIntervalPresenter')
{!! $timeInterval->render('add_time','添加时间') !!}
</div>
<div
class=
"layui-inline"
>
<button
type=
"submit"
class=
"layui-btn"
>
<button
type=
"submit"
class=
"layui-btn"
>
<i
class=
"layui-icon layui-icon-search layuiadmin-button-btn"
></i>
<i
class=
"layui-icon layui-icon-search layuiadmin-button-btn"
></i>
</button>
</button>
...
...
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