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
16f47200
Commit
16f47200
authored
Dec 18, 2017
by
clone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
分页公共类
parent
da6eb1fd
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
97 additions
and
28 deletions
+97
-28
banner.html
application/index/view/banner/banner.html
+7
-12
footer_tpl.html
application/index/view/global/footer_tpl.html
+2
-2
frame_tpl.html
application/index/view/global/frame_tpl.html
+1
-0
banner.js
public/resource/js/banner.js
+27
-12
main.js
public/resource/js/main.js
+6
-2
zw.pagination.js
public/resource/js/zw.pagination.js
+52
-0
Pagination.js
public/resource/lib/js/Pagination.js
+2
-0
No files found.
application/index/view/banner/banner.html
View file @
16f47200
{layout name="global/frame_tpl" /}
<input
type=
"hidden"
class=
"page-load"
id=
"banner"
/>
<!--导航star-->
<!-- Sidebar -->
...
...
@@ -42,23 +43,17 @@
</tbody>
</table>
<!-- /#page-content-wrapper -->
<div
style=
"float:right"
id=
"pagediv"
>
</div>
</div>
</div>
</div>
</div>
<!-- /#page-content-wrapper -->
<div
class=
"page-cla"
>
<ul
class=
"pagination"
>
<li><a
href=
"#"
>
«
</a></li>
<li><a
href=
"#"
>
1
</a></li>
<li><a
href=
"#"
>
2
</a></li>
<li><a
href=
"#"
>
3
</a></li>
<li><a
href=
"#"
>
4
</a></li>
<li><a
href=
"#"
>
5
</a></li>
<li><a
href=
"#"
>
»
</a></li>
</ul>
</div>
</div>
</div>
</div>
...
...
application/index/view/global/footer_tpl.html
View file @
16f47200
<script
src=
'/resource/lib/js/require.min.js'
data-main=
'/resource/js/main?version=1122555'
charset=
'utf-8'
></script>
\ No newline at end of file
<script
src=
'/resource/lib/js/require.min.js'
data-main=
'/resource/js/main?version=11111'
charset=
'utf-8'
></script>
\ No newline at end of file
application/index/view/global/frame_tpl.html
View file @
16f47200
...
...
@@ -4,6 +4,7 @@
{include file="global/header_tpl" /}
<link
rel=
"stylesheet"
href=
"/resource/css/bootstrap.css"
type=
"text/css"
/>
<link
rel=
"stylesheet"
href=
"/resource/css/public.css"
type=
"text/css"
/>
<link
rel=
"stylesheet"
href=
"//qidian.gtimg.com/lulu/theme/peak/css/common/ui/Pagination.css"
>
</head>
<body>
...
...
public/resource/js/banner.js
View file @
16f47200
/**
* Created by zw on 2017/12/15.
*/
define
([
'doT'
,
'text!temp/banner_template_tpl.html'
,
'ckfinder'
,
'ckfinderStart'
,
'css!style/home.css'
,
'bootstrapJs'
],
function
(
doT
,
template
)
{
define
([
'doT'
,
'text!temp/banner_template_tpl.html'
,
'ckfinder'
,
'ckfinderStart'
,
'css!style/home.css'
,
'bootstrapJs'
,
'pagination'
],
function
(
doT
,
template
)
{
var
banner
=
{
pageNo
:
1
,
/*第几页*/
pageNum
:
15
,
/*每页显示多少条*/
init
:
function
()
{
//初始化dot
$
(
"body"
).
append
(
template
);
banner
.
event
();
banner
.
getBannerList
();
banner
.
getBannerList
(
1
);
},
event
:
function
()
{
/*上传图片控件*/
...
...
@@ -16,12 +19,13 @@ define (['doT', 'text!temp/banner_template_tpl.html', 'ckfinder', 'ckfinderStart
});
$
(
"#save_banner"
).
click
(
function
()
{
banner
.
addBanner
();
banner
.
addBanner
();
});
},
/*获取banner list*/
getBannerList
:
function
()
{
getBannerList
:
function
(
pageNo
)
{
banner
.
pageNo
=
pageNo
;
$
.
ajax
({
url
:
'/index/bannerList'
,
type
:
'POST'
,
...
...
@@ -31,19 +35,30 @@ define (['doT', 'text!temp/banner_template_tpl.html', 'ckfinder', 'ckfinderStart
success
:
function
(
data
)
{
var
temp
=
document
.
getElementById
(
'banner_list_tpl'
).
innerHTML
;
var
doTtmpl
=
doT
.
template
(
temp
);
$
(
"#banner_list"
).
append
(
doTtmpl
(
data
));
$
(
"#banner_list"
).
html
(
doTtmpl
(
data
));
console
.
log
(
data
.
data
.
length
);
/*分页代码*/
$
(
"#pagediv"
).
pagination
({
length
:
data
.
data
.
length
,
current
:
pageNo
,
every
:
banner
.
pageNum
,
onClick
:
function
(
el
)
{
banner
.
getBannerList
(
el
.
num
.
current
);
}
});
}
})
},
addBanner
:
function
()
{
addBanner
:
function
()
{
var
params
=
{};
params
.
title
=
$
(
"#title"
).
val
();
params
.
intro
=
$
(
"#intro"
).
val
();
params
.
url
=
$
(
"#url"
).
val
();
params
.
cover_image
=
$
(
"#cover_image"
).
val
();
params
.
sort
=
$
(
"#sort"
).
val
();
if
(
empty
(
params
.
title
))
{
params
.
title
=
$
(
"#title"
).
val
();
params
.
intro
=
$
(
"#intro"
).
val
();
params
.
url
=
$
(
"#url"
).
val
();
params
.
cover_image
=
$
(
"#cover_image"
).
val
();
params
.
sort
=
$
(
"#sort"
).
val
();
if
(
empty
(
params
.
title
))
{
}
...
...
public/resource/js/main.js
View file @
16f47200
...
...
@@ -12,7 +12,8 @@ require.config ({
'ckfinder'
:
'lib/Ckfinder/ckfinder'
,
'ckfinderStart'
:
'lib/js/ckfinderStart'
,
'bootstrapJs'
:
'lib/js/bootstrap.min'
,
'datetimepicker'
:
'lib/js/bootstrap-datetimepicker.min'
'datetimepicker'
:
'lib/js/bootstrap-datetimepicker.min'
,
'pagination'
:
'lib/js/pagination'
,
},
'shim'
:
{
'jquery'
:
{
...
...
@@ -32,6 +33,9 @@ require.config ({
},
'datetimepicker'
:
{
'exports'
:
'datetimepicker'
},
'pagination'
:
{
'exports'
:
'pagination'
}
},
'map'
:
{
...
...
@@ -43,4 +47,4 @@ require.config ({
}
});
require
([
'require'
,
'jquery'
,
'doT'
,
'app/public'
]);
require
([
'require'
,
'jquery'
,
'doT'
,
'app/public'
]);
public/resource/js/zw.pagination.js
0 → 100644
View file @
16f47200
/**
* Created by zw on 2017/12/18.
*/
var
pagination_page_no
=
1
;
//页码
var
pagination_pages
=
1
;
//总页数
var
pagination_totals
=
0
;
//总条数
var
pagination_pagesize
=
15
;
//每页显示多少条
function
addpage
(
methodName
)
{
if
(
pagination_page_no
>
pagination_pages
)
pagination_page_no
=
pagination_pages
;
$
(
'.pageinfo'
).
pagination
({
pages
:
pagination_pages
,
//总页数
//styleClass: ['pagination-large'],
showCtrl
:
true
,
displayPage
:
6
,
currentPage
:
pagination_page_no
,
//当前页码
onSelect
:
function
(
num
)
{
pagination_page_no
=
num
;
if
(
typeof
methodName
===
"function"
){
methodName
();
}
}
});
/* $('.pageinfo').find('span:contains(共)').append("(" + pagination_totals + "条记录)");
var pageselect = ' <select class="page_size_select" style="width:80px;">';
var pagearr = [15,30,50,100];
$.each(pagearr, function () {
if (this == pagination_pagesize) {
pageselect = pageselect + '<option value="' + this + '" selected>' + this + '</option>';
} else {
pageselect = pageselect + '<option value="' + this + '" >' + this + '</option>';
}
});
pageselect = pageselect + '</select> ';
if( !$('.page_size_select').val()){
$('.pageinfo').find('span:contains(共)').prepend(pageselect);
}
$('.page_size_select').one('change',function(){
pagination_pagesize = $(this).val();
methodName();
});*/
};
\ No newline at end of file
public/resource/lib/js/Pagination.js
0 → 100644
View file @
16f47200
!
function
(
e
,
a
){
"function"
==
typeof
define
&&
(
define
.
amd
||
define
.
cmd
)?
define
(
a
):
e
.
Pagination
=
a
()}(
this
,
function
(){
$
.
fn
.
pagination
=
function
(
a
){
return
$
(
this
).
each
(
function
(){
$
(
this
).
data
(
"pagination"
)
||
$
(
this
).
data
(
"pagination"
,
new
e
(
$
(
this
),
a
))})};
var
e
=
function
(
e
,
a
){
e
=
e
||
$
(),
a
=
a
||
{};
var
t
=
this
,
n
=
{
length
:
0
,
current
:
1
,
every
:
15
,
mode
:
"long"
,
onClick
:
$
.
noop
},
i
=
$
.
extend
({},
n
,
a
),
r
=
{};
this
.
el
=
r
,
r
.
container
=
e
;
var
s
=
{};
return
this
.
num
=
s
,
s
.
length
=
i
.
length
,
s
.
current
=
i
.
current
,
s
.
every
=
i
.
every
,
this
.
mode
=
i
.
mode
,
this
.
href
=
i
.
href
,
e
.
delegate
(
"a"
,
"click"
,
function
(
a
){
var
n
=
$
(
this
).
attr
(
"data-page"
);
t
.
num
.
current
=
1
*
n
;
var
r
,
s
=
this
.
className
;
t
.
show
();
var
o
=
(
r
=
/prev/
.
test
(
s
)?
e
.
find
(
".ui-page-prev"
):
/next/
.
test
(
s
)?
e
.
find
(
".ui-page-next"
):
e
.
find
(
".ui-page-current"
))[
0
];
o
&&
(
o
.
focus
(),
!
1
===
window
.
isKeyEvent
&&
o
.
blur
()),
i
.
onClick
.
call
(
o
,
t
,
n
),
/^javascript/
.
test
(
this
.
href
)
&&
a
.
preventDefault
()}),
this
.
show
(),
this
},
a
=
'<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="200" height="200" viewBox="0 0 200 200"><path d="M85.876,100.5l49.537-50.526c4.089-4.215,4.089-11.049,0-15.262 c-4.089-4.218-10.719-4.218-14.808,0L63.586,92.868c-4.089,4.215-4.089,11.049,0,15.264l57.018,58.156 c4.089,4.215,10.719,4.215,14.808,0c4.089-4.215,4.089-11.049,0-15.262L85.876,100.5z"/></svg>'
;
return
e
.
prototype
.
create
=
function
(
e
,
t
){
var
n
=
(
e
=
e
||
{}).
length
||
0
,
i
=
e
.
current
||
1
,
r
=
e
.
every
||
1
;
t
=
t
||
"long"
;
var
s
=
this
.
href
||
"javascript:"
,
o
=
function
(
e
){
return
"string"
==
typeof
s
?
s
:
"function"
==
typeof
s
?
s
(
e
):
void
0
},
l
=
"ui-page"
,
c
=
Math
.
ceil
(
n
/
r
)
||
1
,
h
=
""
,
p
=
[
l
,
"ui-page-prev"
].
join
(
" "
),
u
=
[
l
,
"ui-page-next"
].
join
(
" "
),
f
=
[
l
,
"ui-page-ellipsis"
].
join
(
" "
),
g
=
[
l
,
"ui-page-text"
].
join
(
" "
),
v
=
[
l
,
"ui-page-current"
].
join
(
" "
);
if
(
h
=
i
>
1
?
h
+
'<a href="'
+
o
(
i
-
1
)
+
'" class="'
+
p
+
'" data-page="'
+
(
i
-
1
)
+
'" aria-label="上一页,当前第'
+
i
+
'页">'
+
a
+
"</a>"
:
h
+
'<span class="'
+
p
+
'">'
+
a
+
"</span>"
,
"long"
==
t
){
var
d
=
function
(
e
){
h
=
e
==
i
?
h
+
'<span class="'
+
v
+
'" aria-label="第'
+
e
+
"页,共"
+
c
+
'页" aria-selected="true" role="option">'
+
e
+
"</span>"
:
h
+
'<a href="'
+
o
(
e
)
+
'" class="'
+
l
+
'" data-page="'
+
e
+
'" aria-label="第'
+
e
+
"页,共"
+
c
+
'页">'
+
e
+
"</a>"
};
if
(
c
<=
6
)
for
(
var
m
=
1
;
m
<=
c
;
m
++
)
d
(
m
);
else
if
(
i
<
.
5
*
c
&&
i
<
5
){
if
(
i
<
5
)
for
(
m
=
1
;
m
<
6
;
m
++
)
d
(
m
);
h
=
h
+
'<span class="'
+
f
+
'">...</span>'
,
d
(
c
)}
else
if
(
i
>
.
5
*
c
&&
i
>
c
-
6
+
2
)
for
(
d
(
1
),
h
=
h
+
'<span class="'
+
f
+
'">...</span>'
,
m
=
c
-
6
+
2
;
m
<=
c
;
m
++
)
d
(
m
);
else
d
(
1
),
h
=
h
+
'<span class="'
+
f
+
'">...</span>'
,
d
(
i
-
1
),
d
(
i
),
d
(
i
+
1
),
h
=
h
+
'<span class="'
+
f
+
'">...</span>'
,
d
(
c
)}
else
"short"
==
t
&&
(
h
=
h
+
'<span class="'
+
g
+
'" aria-label="第'
+
i
+
"页,共"
+
c
+
'页" role="option">'
+
[
i
,
c
].
join
(
"/"
)
+
"</span>"
);
return
'<div class="ui-page-x">'
+
(
h
=
i
<
c
?
h
+
'<a href="'
+
o
(
i
+
1
)
+
'" class="'
+
u
+
'" data-page="'
+
(
i
+
1
)
+
'" aria-label="下一页,当前第'
+
i
+
'页">'
+
a
+
"</a>"
:
h
+
'<span class="'
+
u
+
'">'
+
a
+
"</span>"
)
+
"</div>"
},
e
.
prototype
.
show
=
function
(){
var
e
=
this
.
num
;
e
.
length
=
Math
.
max
(
e
.
length
,
0
),
e
.
every
=
Math
.
max
(
e
.
every
,
1
);
var
a
=
Math
.
ceil
(
e
.
length
/
e
.
every
);
return
e
.
current
>
a
&&
(
e
.
current
=
a
),
e
.
current
=
Math
.
max
(
e
.
current
,
1
),
this
.
el
&&
this
.
el
.
container
&&
this
.
el
.
container
.
size
()
&&
this
.
el
.
container
.
html
(
this
.
create
(
e
,
this
.
mode
)),
this
},
e
});
\ No newline at end of file
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