Toggle navigation
Toggle navigation
This project
Loading...
Sign in
wangshusheng
/
YOHOBUYPC
·
Commits
Go to a project
GitLab
Go to dashboard
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
xuqi
9 years ago
Commit
0e987d4081e8bff9667e4494161b6f83e7d2a794
1 parent
33c92d52
guang home loading
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
15 deletions
static/js/guang/home.js
static/js/guang/info.js
static/js/guang/home.js
View file @
0e987d4
...
...
@@ -8,7 +8,6 @@ var $ = require('yoho.zepto'),
Swiper
=
require
(
'yoho.iswiper'
);
var
info
=
require
(
'./info'
),
setLazyLoadAndMellipsis
=
info
.
setLazyLoadAndMellipsis
,
loadMore
=
info
.
loadMore
;
var
$loadMoreInfo
=
$
(
'#load-more-info'
);
...
...
@@ -45,10 +44,11 @@ info.initInfosEvt($infoList);
var
gender
=
$
(
'#gender'
).
val
();
$nav
.
children
(
'.guang-nav-item'
).
each
(
function
()
{
var
type
=
$
(
this
).
data
(
'type'
);
var
type
=
$
(
this
).
data
(
'type'
),
focus
=
$
(
this
).
hasClass
(
'focus'
);
state
[
type
]
=
{
page
:
1
,
page
:
focus
?
1
:
0
,
gender
:
gender
,
type
:
type
,
end
:
false
...
...
@@ -65,6 +65,9 @@ $nav.delegate('.guang-nav-item', 'tap', function() {
return
;
}
$curNav
=
$this
;
curType
=
$this
.
data
(
'type'
);
index
=
$this
.
index
();
$this
.
addClass
(
'focus'
);
...
...
@@ -75,11 +78,7 @@ $nav.delegate('.guang-nav-item', 'tap', function() {
$content
=
$infos
.
eq
(
index
);
$content
.
removeClass
(
'hide'
);
//lazyload & mellipsis
setLazyLoadAndMellipsis
(
$content
.
children
(
'.guang-info'
));
$curNav
=
$this
;
curType
=
$this
.
data
(
'type'
);
loadMore
(
$content
,
state
[
curType
]);
//重置当前Tab的load-more
if
(
state
[
curType
].
end
)
{
...
...
@@ -93,6 +92,6 @@ $nav.delegate('.guang-nav-item', 'tap', function() {
$
(
document
).
scroll
(
function
()
{
if
(
$
(
window
).
scrollTop
()
+
winH
>=
$
(
document
).
height
()
-
loadMoreH
)
{
loadMore
(
$infos
,
state
[
curType
]);
loadMore
(
$infos
.
not
(
'hide'
)
,
state
[
curType
]);
}
});
\ No newline at end of file
...
...
static/js/guang/info.js
View file @
0e987d4
...
...
@@ -9,12 +9,13 @@ var $ = require('yoho.zepto'),
lazyLoad
=
require
(
'yoho.zeptolazyload'
);
var
tip
=
require
(
'../plugin/tip'
);
var
loading
=
require
(
'../plugin/loading'
);
var
$loadMoreInfo
=
$
(
'#load-more-info'
);
var
$loading
=
$
(
''
),
$noMore
=
$
(
''
);
var
load
ing
=
false
;
var
search
ing
=
false
;
ellipsis
.
init
();
...
...
@@ -84,7 +85,7 @@ function initInfosEvt($container) {
* 资讯LoadMore
*/
function
loadMore
(
$container
,
opt
)
{
if
(
load
ing
)
{
if
(
search
ing
)
{
return
;
}
...
...
@@ -92,7 +93,13 @@ function loadMore($container, opt) {
return
;
}
loading
=
true
;
if
(
opt
.
page
===
0
)
{
//显示loading
loading
.
showLoadingMask
();
}
searching
=
true
;
$
.
ajax
({
type
:
'GET'
,
url
:
' /guang/index/page'
,
...
...
@@ -100,7 +107,7 @@ function loadMore($container, opt) {
success
:
function
(
data
)
{
if
(
data
===
' '
)
{
opt
.
end
=
true
;
load
ing
=
false
;
search
ing
=
false
;
//
$loading
.
addClass
(
'hide'
);
...
...
@@ -112,13 +119,17 @@ function loadMore($container, opt) {
setLazyLoadAndMellipsis
(
$container
.
find
(
'.guang-info'
));
if
(
opt
.
page
===
0
)
{
loading
.
hideLoadingMask
();
}
opt
.
page
++
;
load
ing
=
false
;
search
ing
=
false
;
},
error
:
function
()
{
tip
.
show
(
'网络断开连接了~'
);
load
ing
=
false
;
search
ing
=
false
;
}
});
}
...
...
Please
register
or
login
to post a comment