Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yohobuy-mobile
·
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
xuqi
10 years ago
Commit
eb052ae47ac1b398311b08dd5685960117d5243d
2 parents
4e197e0c
20961df3
Merge branch 'release/saunter-home' of git.dev.yoho.cn:web/yohobuy-mobile into release/saunter-home
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
25 deletions
mobile/package.json
mobile/public/js/saunter-home.js
mobile/public/sass/common/_tag-content.scss
mobile/package.json
View file @
eb052ae
...
...
@@ -17,10 +17,10 @@
"yoho.mustache"
:
"2.1.3"
,
"yoho.iswiper"
:
"3.0.6"
,
"yoho.lazyload"
:
"1.0.0"
,
"mlellipsis"
:
"0.0.6"
,
"iscroll"
:
"5.1.2"
,
"underscore"
:
"1.6.0"
,
"import-style"
:
"1.0.0"
"import-style"
:
"1.0.0"
,
"yoho.dotdotdot"
:
"1.0.0"
},
"devDependencies"
:
{
"expect.js"
:
"0.3.1"
...
...
mobile/public/js/saunter-home.js
View file @
eb052ae
var
$
=
require
(
'yoho.jquery'
),
lazyLoad
=
require
(
'yoho.lazyload'
),
Mlellipsis
=
require
(
'mlellipsis'
),
Mustache
=
require
(
'yoho.mustache'
),
Swiper
=
require
(
'yoho.iswiper'
);
...
...
@@ -20,15 +19,18 @@ var $nav = $('#saunter-nav'),
clientType
=
$
(
'#client-type'
).
val
(),
tpl
,
swiper
;
swiper
,
baseFontSize
,
baseFont
;
require
(
'./wxshare'
)();
require
(
'yoho.dotdotdot'
);
//初始化focus
$
(
'.saunter-nav > li:first-child'
).
addClass
(
'focus'
);
//初始化cached
$
(
'.saunter-nav li'
).
each
(
function
()
{
$
(
'.saunter-nav li'
).
each
(
function
()
{
var
$el
=
$
(
this
),
page
=
$el
.
index
()
===
0
?
1
:
0
;
...
...
@@ -49,16 +51,23 @@ swiper = new Swiper('.swiper-container', {
lazyLoad
();
//相关文章截取文字
Mlellipsis
.
init
();
$
(
'.tag-title'
).
each
(
function
()
{
this
.
mlellipsis
(
2
);
});
$
(
'.tag-text'
).
each
(
function
()
{
this
.
mlellipsis
(
3
);
});
baseFont
=
getComputedStyle
(
document
.
documentElement
,
null
).
fontSize
;
baseFontSize
=
baseFont
.
substring
(
0
,
baseFont
.
length
-
2
);
function
dot
(
$container
)
{
$container
.
find
(
'.tag-title'
).
dotdotdot
({
height
:
2.2
*
baseFontSize
,
wrap
:
'letter'
}).
end
().
find
(
'.tag-text'
).
dotdotdot
({
height
:
3.4
*
baseFontSize
,
wrap
:
'letter'
});
}
//dotdotdot
dot
(
$msgList
);
//读取模板
$
.
get
(
'/common/tagtpl'
,
function
(
data
)
{
$
.
get
(
'/common/tagtpl'
,
function
(
data
)
{
tpl
=
data
;
Mustache
.
parse
(
tpl
);
});
...
...
@@ -78,7 +87,7 @@ function getMsgHtml(msgs) {
return
html
;
}
$nav
.
delegate
(
'li'
,
'click'
,
function
()
{
$nav
.
delegate
(
'li'
,
'click'
,
function
()
{
var
$el
=
$
(
this
),
type
=
$el
.
data
(
'type'
);
...
...
@@ -106,7 +115,7 @@ $nav.delegate('li', 'click', function() {
gender
:
gender
,
client_type
:
clientType
}
}).
then
(
function
(
data
)
{
}).
then
(
function
(
data
)
{
var
res
;
if
(
data
.
code
===
200
)
{
...
...
@@ -162,7 +171,7 @@ function loadMore() {
gender
:
gender
,
client_type
:
clientType
}
}).
then
(
function
(
data
)
{
}).
then
(
function
(
data
)
{
var
res
,
msgs
,
html
,
$newContent
;
...
...
@@ -189,11 +198,7 @@ function loadMore() {
$newContent
=
$msgList
.
children
(
'.tag-content:gt('
+
(
num
-
1
)
+
')'
);
}
lazyLoad
(
$newContent
.
find
(
'img.lazy'
));
$newContent
.
find
(
'.tag-title'
).
each
(
function
()
{
this
.
mlellipsis
(
2
);
}).
end
().
find
(
'.tag-text'
).
each
(
function
()
{
this
.
mlellipsis
(
3
);
});
dot
(
$newContent
);
}
loading
=
false
;
});
...
...
@@ -202,7 +207,7 @@ function loadMore() {
$
(
window
).
scroll
(
loadMore
);
//资讯点赞和取消点赞
$
(
'.msg-list'
).
delegate
(
'.like-btn'
,
'touchstart'
,
function
(
e
)
{
$
(
'.msg-list'
).
delegate
(
'.like-btn'
,
'touchstart'
,
function
(
e
)
{
var
$cur
=
$
(
e
.
currentTarget
),
$info
=
$cur
.
closest
(
'.tag-content'
),
id
=
$info
.
data
(
'id'
),
...
...
@@ -223,7 +228,7 @@ $('.msg-list').delegate('.like-btn', 'touchstart', function(e) {
id
:
id
,
udid
:
udid
}
}).
then
(
function
(
data
)
{
}).
then
(
function
(
data
)
{
if
(
data
.
code
===
200
)
{
//更新点赞数
...
...
@@ -231,8 +236,8 @@ $('.msg-list').delegate('.like-btn', 'touchstart', function(e) {
}
else
if
(
data
.
code
===
400
)
{
//提示登录信息
$
(
'#login-tip'
).
fadeIn
(
500
,
function
()
{
setTimeout
(
function
()
{
$
(
'#login-tip'
).
fadeIn
(
500
,
function
()
{
setTimeout
(
function
()
{
$
(
'#login-tip'
).
fadeOut
(
500
);
},
1000
);
});
...
...
mobile/public/sass/common/_tag-content.scss
View file @
eb052ae
...
...
@@ -89,6 +89,7 @@
color
:
#000
;
font-size
:
40rem
/
$pxConvertRem
;
font-weight
:bold
;
}
.tag-text
{
...
...
Please
register
or
login
to post a comment