Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tl_estate
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hujun
tl_estate
Commits
a603b028
Commit
a603b028
authored
Dec 18, 2017
by
clone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
分页代码
parent
1d124e6e
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
50 additions
and
28 deletions
+50
-28
Banner.php
application/index/controller/Banner.php
+6
-2
footer_tpl.html
application/index/view/global/footer_tpl.html
+2
-2
BannerModel.php
application/model/BannerModel.php
+12
-0
banner.js
public/resource/js/banner.js
+11
-6
banner_template_tpl.html
public/resource/template/banner_template_tpl.html
+19
-18
No files found.
application/index/controller/Banner.php
View file @
a603b028
...
@@ -35,8 +35,12 @@ class Banner extends Basic
...
@@ -35,8 +35,12 @@ class Banner extends Basic
public
function
getBannerList
(){
public
function
getBannerList
(){
$field
=
"id,title,pic_path,url,sort,hits,is_show,up_user,create_time,update_time"
;
$field
=
"id,title,pic_path,url,sort,hits,is_show,up_user,create_time,update_time"
;
$params
[
'is_show'
]
=
array
(
"eq"
,
0
);
$params
[
'is_show'
]
=
array
(
"eq"
,
0
);
$result
=
$this
->
bannerModel
$pageNo
=
empty
(
$_POST
[
'pageNo'
])
?
1
:
$_POST
[
'pageNo'
];
->
getBannerList
(
1
,
15
,
"sort desc"
,
$field
,
$params
);
$pageSize
=
empty
(
$_POST
[
'pageSize'
])
?
15
:
$_POST
[
'pageSize'
];
$result
[
"list"
]
=
$this
->
bannerModel
->
getBannerList
(
$pageNo
,
$pageSize
,
"sort desc"
,
$field
,
$params
);
$result
[
"total"
]
=
$this
->
bannerModel
->
getBannerTotal
(
$params
);
return
$this
->
response
(
"200"
,
"request success"
,
$result
);
return
$this
->
response
(
"200"
,
"request success"
,
$result
);
}
}
...
...
application/index/view/global/footer_tpl.html
View file @
a603b028
<script
src=
'/resource/lib/js/require.min.js'
data-main=
'/resource/js/main?version=11111'
charset=
'utf-8'
></script>
<script
src=
'/resource/lib/js/require.min.js'
data-main=
'/resource/js/main?version=111'
charset=
'utf-8'
></script>
\ No newline at end of file
\ No newline at end of file
application/model/BannerModel.php
View file @
a603b028
...
@@ -124,4 +124,15 @@ class BannerModel extends Model
...
@@ -124,4 +124,15 @@ class BannerModel extends Model
->
page
(
$pageNo
)
->
page
(
$pageNo
)
->
select
();
->
select
();
}
}
/**
* 获取总记录
* @param $params
* @return int|string
*/
function
getBannerTotal
(
$params
){
return
$this
->
db
->
where
(
$params
)
->
count
();
}
}
}
\ No newline at end of file
public/resource/js/banner.js
View file @
a603b028
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
define
([
'doT'
,
'text!temp/banner_template_tpl.html'
,
'ckfinder'
,
'ckfinderStart'
,
'css!style/home.css'
,
'bootstrapJs'
,
'pagination'
],
function
(
doT
,
template
)
{
define
([
'doT'
,
'text!temp/banner_template_tpl.html'
,
'ckfinder'
,
'ckfinderStart'
,
'css!style/home.css'
,
'bootstrapJs'
,
'pagination'
],
function
(
doT
,
template
)
{
var
banner
=
{
var
banner
=
{
pageNo
:
1
,
/*第几页*/
pageNo
:
1
,
/*第几页*/
page
Num
:
15
,
/*每页显示多少条*/
page
Size
:
15
,
/*每页显示多少条*/
init
:
function
()
{
init
:
function
()
{
//初始化dot
//初始化dot
...
@@ -26,22 +26,27 @@ define (['doT', 'text!temp/banner_template_tpl.html', 'ckfinder', 'ckfinderStart
...
@@ -26,22 +26,27 @@ define (['doT', 'text!temp/banner_template_tpl.html', 'ckfinder', 'ckfinderStart
/*获取banner list*/
/*获取banner list*/
getBannerList
:
function
(
pageNo
)
{
getBannerList
:
function
(
pageNo
)
{
banner
.
pageNo
=
pageNo
;
banner
.
pageNo
=
pageNo
;
var
params
=
{};
params
.
pageNo
=
banner
.
pageNo
;
params
.
pageSize
=
banner
.
pageSize
;
$
.
ajax
({
$
.
ajax
({
url
:
'/index/bannerList'
,
url
:
'/index/bannerList'
,
type
:
'POST'
,
type
:
'POST'
,
async
:
true
,
async
:
true
,
data
:
{
id
:
1
}
,
data
:
params
,
dataType
:
'json'
,
dataType
:
'json'
,
success
:
function
(
data
)
{
success
:
function
(
data
)
{
console
.
log
(
data
.
data
);
var
temp
=
document
.
getElementById
(
'banner_list_tpl'
).
innerHTML
;
var
temp
=
document
.
getElementById
(
'banner_list_tpl'
).
innerHTML
;
var
doTtmpl
=
doT
.
template
(
temp
);
var
doTtmpl
=
doT
.
template
(
temp
);
$
(
"#banner_list"
).
html
(
doTtmpl
(
data
));
$
(
"#banner_list"
).
html
(
doTtmpl
(
data
.
data
.
list
));
console
.
log
(
data
.
data
.
length
);
/*分页代码*/
/*分页代码*/
$
(
"#pagediv"
).
pagination
({
$
(
"#pagediv"
).
pagination
({
length
:
data
.
data
.
length
,
length
:
data
.
data
.
total
,
current
:
pageNo
,
current
:
pageNo
,
every
:
banner
.
page
Num
,
every
:
banner
.
page
Size
,
onClick
:
function
(
el
)
{
onClick
:
function
(
el
)
{
banner
.
getBannerList
(
el
.
num
.
current
);
banner
.
getBannerList
(
el
.
num
.
current
);
}
}
...
...
public/resource/template/banner_template_tpl.html
View file @
a603b028
<script
id=
"banner_list_tpl"
type=
"text/template"
>
<script
id=
"banner_list_tpl"
type=
"text/template"
>
[
%
if
(
it
.
data
.
length
>
0
)
{
%
]
[
%
if
(
it
)
{
%
]
[
%
for
(
var
i
=
0
,
len
=
it
.
data
.
length
;
i
<
len
;
i
++
){
%
]
[
%
for
(
var
i
tem
in
it
){
%
]
<
tr
>
<
tr
>
<
td
>
[
%=
it
.
data
[
i
][
"title"
]
%
]
<
/td
>
<
td
>
[
%=
it
[
item
][
"title"
]
%
]
<
/td
>
<
td
>
<
td
>
<
img
src
=
"[%= it
.data[i
]['pic_path'] %]"
class
=
"diagram-image"
>
<
img
src
=
"[%= it
[item
]['pic_path'] %]"
class
=
"diagram-image"
>
<
/td
>
<
/td
>
<
td
>
[
%=
it
.
data
[
i
][
"url"
]
%
]
<
/td
>
<
td
>
[
%=
it
[
item
][
"url"
]
%
]
<
/td
>
<
td
>
[
%=
it
.
data
[
i
][
"sort"
]
%
]
<
/td
>
<
td
>
[
%=
it
[
item
][
"sort"
]
%
]
<
/td
>
<
td
>
[
%=
it
.
data
[
i
][
"hits"
]
%
]
<
/td
>
<
td
>
[
%=
it
[
item
][
"hits"
]
%
]
<
/td
>
<
td
>
[
%=
it
.
data
[
i
][
"up_user"
]
%
]
<
/td
>
<
td
>
[
%=
it
[
item
][
"up_user"
]
%
]
<
/td
>
<
td
>
<
td
>
<
a
class
=
"btn1 btn-success "
href
=
"#modal-do"
data
-
toggle
=
"modal"
>
<
a
class
=
"btn1 btn-success "
href
=
"#modal-do"
data
-
toggle
=
"modal"
>
编辑
编辑
...
@@ -36,7 +36,7 @@
...
@@ -36,7 +36,7 @@
<button
type=
"button"
class=
"close"
data-dismiss=
"modal"
aria-hidden=
"true"
>
<button
type=
"button"
class=
"close"
data-dismiss=
"modal"
aria-hidden=
"true"
>
×
×
</button>
</button>
<h4
class=
"modal-title"
>
<h4
class=
"modal-title"
>
删除
删除
</h4>
</h4>
</div>
</div>
...
@@ -61,41 +61,42 @@
...
@@ -61,41 +61,42 @@
<div
class=
"modal-dialog"
role=
"document"
>
<div
class=
"modal-dialog"
role=
"document"
>
<div
class=
"modal-content"
>
<div
class=
"modal-content"
>
<div
class=
"modal-header"
>
<div
class=
"modal-header"
>
<button
type=
"button"
class=
"close"
data-dismiss=
"modal"
aria-label=
"Close"
><span
aria-hidden=
"true"
>
×
</span></button>
<button
type=
"button"
class=
"close"
data-dismiss=
"modal"
aria-label=
"Close"
><span
aria-hidden=
"true"
>
×
</span>
</button>
<h4
class=
"modal-title"
>
新增广告
</h4>
<h4
class=
"modal-title"
>
新增广告
</h4>
</div>
</div>
<div
class=
"modal-body"
>
<div
class=
"modal-body"
>
<form
class=
"form-horizontal"
>
<form
class=
"form-horizontal"
>
<div
class=
"form-group"
>
<div
class=
"form-group"
>
<label
class=
"col-sm-3 control-label"
>
标题:
</label>
<label
class=
"col-sm-3 control-label"
>
标题:
</label>
<div
class=
"col-sm-9"
>
<div
class=
"col-sm-9"
>
<input
type=
"text"
class=
"form-control btn6"
name=
"title"
id=
"title"
placeholder=
"请输入标题"
>
<input
type=
"text"
class=
"form-control btn6"
name=
"title"
id=
"title"
placeholder=
"请输入标题"
>
</div>
</div>
</div>
</div>
<div
class=
"form-group"
>
<div
class=
"form-group"
>
<label
class=
"col-sm-3 control-label"
>
备注:
</label>
<label
class=
"col-sm-3 control-label"
>
备注:
</label>
<div
class=
"col-sm-9"
>
<div
class=
"col-sm-9"
>
<input
type=
"text"
class=
"form-control btn6"
name=
"title"
id=
"intro"
placeholder=
"请输入备注"
>
<input
type=
"text"
class=
"form-control btn6"
name=
"title"
id=
"intro"
placeholder=
"请输入备注"
>
</div>
</div>
</div>
</div>
<div
class=
"form-group"
>
<div
class=
"form-group"
>
<label
class=
"col-sm-3 control-label"
>
链接:
</label>
<label
class=
"col-sm-3 control-label"
>
链接:
</label>
<div
class=
"col-sm-9"
>
<div
class=
"col-sm-9"
>
<input
type=
"text"
class=
"form-control btn6"
name=
"title"
id=
"url"
autocomplete=
"off"
>
<input
type=
"text"
class=
"form-control btn6"
name=
"title"
id=
"url"
autocomplete=
"off"
>
</div>
</div>
</div>
</div>
<div
class=
"form-group"
>
<div
class=
"form-group"
>
<label
class=
"col-sm-3 control-label"
>
图片:
</label>
<label
class=
"col-sm-3 control-label"
>
图片:
</label>
<div
class=
"col-sm-9"
>
<div
class=
"col-sm-9"
>
<input
readonly=
"readonly"
type=
"text"
name=
"cover_image"
id=
"cover_image"
class=
"require"
/>
<input
readonly=
"readonly"
type=
"text"
name=
"cover_image"
id=
"cover_image"
class=
"require"
/>
<button
class=
"button6 banner_img"
type=
"button"
>
选择图片
</button>
<button
class=
"button6 banner_img"
type=
"button"
>
选择图片
</button>
<span
class=
"tip"
>
建议尺寸288x320
</span>
<span
class=
"tip"
>
建议尺寸288x320
</span>
</div>
</div>
</div>
</div>
<div
class=
"form-group"
>
<div
class=
"form-group"
>
<label
class=
"col-sm-3 control-label"
>
排序:
</label>
<label
class=
"col-sm-3 control-label"
>
排序:
</label>
<div
class=
"col-sm-9"
>
<div
class=
"col-sm-9"
>
<input
type=
"text"
class=
"form-control btn6"
name=
"title"
id
=
"sort"
autocomplete=
"off"
>
<input
type=
"text"
class=
"form-control btn6"
name=
"title"
id
=
"sort"
autocomplete=
"off"
>
</div>
</div>
</div>
</div>
...
...
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