Authored by xuqi

Merge branch 'release/saunter-home' of git.dev.yoho.cn:web/yohobuy-mobile into release/saunter-home

... ... @@ -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"
... ...
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);
});
... ...
... ... @@ -89,6 +89,7 @@
color: #000;
font-size: 40rem / $pxConvertRem;
font-weight:bold;
}
.tag-text {
... ...