Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
YOHOBUYWAP
·
Commits
Go to a project
GitLab
Go to group
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
Plain Diff
Browse Files
Authored by
梁志锋
9 years ago
Commit
86319e0cf6f6578ed5304ee0bacd37f8adb56b48
2 parents
a60eef4f
fb21da1b
Merge branch 'develop' of git.dev.yoho.cn:web/yohobuy into develop
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
121 additions
and
38 deletions
static/js/guang/home.js
static/js/guang/info.js
static/js/guang/list.js
static/sass/index.scss
template/m.yohobuy.com/actions/guang/list/index.phtml
template/m.yohobuy.com/actions/guang/list/list.phtml
template/m.yohobuy.com/partials/layout/footer.phtml
template/m.yohobuy.com/partials/layout/header.phtml
static/js/guang/home.js
View file @
86319e0
...
...
@@ -11,8 +11,12 @@ var info = require('./info'),
setLazyLoadAndMellipsis
=
info
.
setLazyLoadAndMellipsis
,
loadMore
=
info
.
loadMore
;
var
$loadMoreInfo
=
$
(
'#load-more-info'
);
var
$loading
=
$
(
''
),
$noMore
=
$
(
''
);
var
winH
=
$
(
window
).
height
(),
loadMoreH
=
$
(
'#load-more'
)
.
height
();
loadMoreH
=
$
loadMoreInfo
.
height
();
var
$infoList
=
$
(
'#info-list'
),
$infos
=
$infoList
.
children
(
'.info-list'
),
...
...
@@ -24,6 +28,11 @@ var state = {};
var
mySwiper
;
if
(
$loadMoreInfo
.
length
>
0
)
{
$loading
=
$loadMoreInfo
.
children
(
'.loading'
);
$noMore
=
$loadMoreInfo
.
children
(
'.no-more'
);
}
mySwiper
=
new
Swiper
(
'.swiper-container'
,
{
lazyLoading
:
true
,
pagination
:
'.swiper-pagination'
...
...
@@ -33,13 +42,16 @@ info.initInfosEvt($infoList);
//初始化各Nav下资讯加载的状态
(
function
()
{
var
gender
=
$
(
'#gender'
).
val
();
$nav
.
children
(
'.guang-nav-item'
).
each
(
function
()
{
var
type
=
$
(
this
).
data
(
'type'
);
state
[
type
]
=
{
page
:
1
,
end
:
false
,
type
:
type
gender
:
gender
,
type
:
type
,
end
:
false
};
});
}());
...
...
@@ -68,10 +80,19 @@ $nav.delegate('.guang-nav-item', 'touchstart', function() {
$curNav
=
$this
;
curType
=
$this
.
data
(
'type'
);
//重置当前Tab的load-more
if
(
state
[
curType
].
end
)
{
$loading
.
addClass
(
'hide'
);
$noMore
.
removeClass
(
'hide'
);
}
else
{
$loading
.
removeClass
(
'hide'
);
$noMore
.
addClass
(
'hide'
);
}
});
$
(
document
).
scroll
(
function
()
{
if
(
$
(
window
).
scrollTop
()
+
winH
>=
$
(
document
).
height
()
-
loadMoreH
&&
!
state
[
curType
].
end
)
{
if
(
$
(
window
).
scrollTop
()
+
winH
>=
$
(
document
).
height
()
-
loadMoreH
)
{
loadMore
(
$infos
,
state
[
curType
]);
}
});
\ No newline at end of file
...
...
static/js/guang/info.js
View file @
86319e0
...
...
@@ -10,10 +10,19 @@ var $ = require('yoho.zepto'),
var
tip
=
require
(
'../plugin/tip'
);
var
$loadMoreInfo
=
$
(
'#load-more-info'
);
var
$loading
=
$
(
''
),
$noMore
=
$
(
''
);
var
loading
=
false
;
ellipsis
.
init
();
if
(
$loadMoreInfo
.
length
>
0
)
{
$loading
=
$loadMoreInfo
.
children
(
'.loading'
);
$noMore
=
$loadMoreInfo
.
children
(
'.no-more'
);
}
/**
* 设置指定资讯项的Lazyload和文字截取
* @params $infos 资讯项
...
...
@@ -43,17 +52,19 @@ function initInfosEvt($container) {
url
:
'/guang/info/prise'
,
//TODO:cancelPrise
data
:
{
id
:
$info
.
data
(
'id'
)
},
success
:
function
(
data
)
{
var
code
=
data
.
code
;
if
(
code
===
200
)
{
$likeBtn
.
next
(
'.like-count'
).
text
(
data
.
data
);
}
else
if
(
code
===
400
)
{
tip
.
show
(
'未登录'
);
}
},
error
:
function
()
{
tip
.
show
(
'网络断开连接了~'
);
}
}).
then
(
function
(
data
)
{
var
code
=
data
.
code
;
if
(
code
===
200
)
{
$likeBtn
.
next
(
'.like-count'
).
text
(
data
.
data
);
}
else
if
(
code
===
400
)
{
tip
.
show
(
'未登录'
);
}
},
function
()
{
tip
.
show
(
'网络断开连接了~'
);
});
});
...
...
@@ -70,30 +81,42 @@ function loadMore($container, opt) {
return
;
}
if
(
opt
.
end
)
{
return
;
}
loading
=
true
;
$
.
ajax
({
type
:
'GET'
,
url
:
'/infos/get'
,
data
:
opt
}).
then
(
function
(
data
)
{
var
res
,
$newInfos
;
type
:
'POST'
,
url
:
' /guang/list/page'
,
data
:
opt
,
success
:
function
(
data
)
{
var
$newInfos
;
//请求结束
if
(
data
===
' '
)
{
opt
.
end
=
true
;
loading
=
false
;
if
(
data
.
code
===
200
)
{
res
=
data
.
data
;
//
$loading
.
addClass
(
'hide'
);
$noMore
.
removeClass
(
'hide'
);
if
(
res
.
end
)
{
opt
.
end
=
true
;
return
;
}
$container
.
append
(
res
.
infos
);
$container
.
append
(
data
);
$newInfos
=
$container
.
find
(
'.guang-info:gt('
+
(
infosNum
-
1
)
+
')'
);
setLazyLoadAndMellipsis
(
$newInfos
);
opt
.
page
++
;
}
loading
=
false
;
loading
=
false
;
},
error
:
function
()
{
tip
.
show
(
'网络断开连接了~'
);
loading
=
false
;
}
});
}
...
...
static/js/guang/list.js
View file @
86319e0
...
...
@@ -12,6 +12,9 @@ var info = require('./info'),
var
winH
=
$
(
window
).
height
(),
loadMoreH
=
$
(
'#load-more'
).
height
();
var
$author
=
$
(
'#author-infos'
);
var
$tag
=
$
(
'#tag'
);
var
setting
=
{
page
:
1
,
end
:
false
...
...
@@ -21,11 +24,19 @@ var $infos = $('#info-list');
info
.
initInfosEvt
(
$infos
);
$
(
document
).
scroll
(
function
()
{
if
(
setting
.
end
)
{
return
;
}
if
(
$author
.
length
>
0
)
{
$
.
extend
(
setting
,
{
authorId
:
$author
.
data
(
'id'
)
});
}
if
(
$tag
.
length
>
0
)
{
$
.
extend
(
setting
,
{
tag
:
$tag
.
val
()
});
}
$
(
document
).
scroll
(
function
()
{
if
(
$
(
window
).
scrollTop
()
+
winH
>=
$
(
document
).
height
()
-
loadMoreH
)
{
loadMore
(
$infos
,
setting
);
}
...
...
static/sass/index.scss
View file @
86319e0
...
...
@@ -51,6 +51,10 @@ a {
outline
:
none
;
}
.hide
{
display
:
none
;
}
@font-face
{
font-family
:
"iconfont"
;
src
:
font-url
(
'iconfont.eot'
);
/* IE9*/
...
...
template/m.yohobuy.com/actions/guang/list/index.phtml
View file @
86319e0
...
...
@@ -51,6 +51,7 @@
</div>
<span
class=
"no-more status hide"
>没有更多啦</span>
</div>
<input
id=
"gender"
type=
"hidden"
value=
{
{gender
}
}>
{
{/
guang
}
}
</div>
{
{>
layout/footer
}
}
\ No newline at end of file
...
...
template/m.yohobuy.com/actions/guang/list/list.phtml
View file @
86319e0
...
...
@@ -25,6 +25,9 @@
</div>
<span
class=
"no-more status hide"
>没有更多啦</span>
</div>
{
{#if
tag
}
}
<input
id=
"tag"
type=
"hidden"
value=
{
{tag
}
}>
{
{/if
}
}
{
{/
guang
}
}
</div>
{
{>
layout/footer
}
}
\ No newline at end of file
...
...
template/m.yohobuy.com/partials/layout/footer.phtml
View file @
86319e0
{
{>
layout/page_footer
}
}
<script
src=
"http://localhost:8000/static/js/sea.js?nowrap"
></script>
<script>
seajs.config(
{
base:
'http://localhost:8000/'
}
);
</script>
{
{#if
rlsEnv
}
}
<link
rel=
"stylesheet"
href=
"http://cdn.yoho.cn/myohobuy/{{version}}/lib.js"
>
<link
rel=
"stylesheet"
href=
"http://cdn.yoho.cn/myohobuy/{{version}}/index.js"
>
{
{/if
}
}
{
{#if
rlsEnv
}
}
{
{/if
}
}
{
{#if
devEnv
}
}
<script
src=
"http://localhost:8000/static/js/sea.js?nowrap"
></script>
<script>
seajs.config(
{
base:
'http://localhost:8000/'
}
);
</script>
{
{/if
}
}
{
{>
layout/use
}
}
</body>
</html>
\ No newline at end of file
...
...
template/m.yohobuy.com/partials/layout/header.phtml
View file @
86319e0
...
...
@@ -22,7 +22,17 @@
}());
})(
document
,
window
);
</script>
<link
rel=
"stylesheet"
href=
"http://static.dev.yohobuy.com/css/index.css"
>
{{#if rlsEnv}}
<link
rel=
"stylesheet"
href=
"http://cdn.yoho.cn/myohobuy/{{version}}/index.css"
>
{{/if}}
{{#if rlsEnv}}
{{/if}}
{{#if devEnv}}
<link
rel=
"stylesheet"
href=
"http://static.dev.yohobuy.com/css/index.css"
>
{{/if}}
</head>
<body
{{#
if
isPassportPage
}}
class=
passport-body{{/if}}
>
{{> layout/page_header}}
\ No newline at end of file
...
...
Please
register
or
login
to post a comment