Authored by 梁志锋

product desc

///**
// * 商品详情
// * @author: liangzhifeng<zhifeng.liang@yoho.cn>
// * @date: 2015/11/18
// */
//var $ = require('jquery'),
// Hammer = require('yoho.hammer'),
// lazyLoad = require('yoho.lazyload');
//
//var loading = require('../../plugin/loading');
//
//var navHammer,
// winH = $(window).height(),
// searching = false,
// num,
// url;
//
//function scrollHandler() {
// if ($(window).scrollTop() + winH >= $(document).height() - 50) {
// //search();
// }
//}
//
//function search() {
// if (searching) {
// return;
// }
// searching = true;
//
// loading.showLoadingMask();
//
// //num = $goodList.find('.good-info').length;
// $.ajax({
// type: 'GET',
// url: url,
// data: {
// page: page + 1
// },
// success: function(data) {
//
// num = $goodList.find('.good-info').length;
//
// $goodList.append(data);
//
// // 2015/10/31 fei.hong: 修复第一页分页不显示图片的问题
// if (num === 0) {
// lazyLoad($goodList.find('.good-info').find('img.lazy'));
// } else {
// lazyLoad($goodList.find('.good-info:gt(' + (num - 1) + ')').find('img.lazy'));
// }
//
// searching = false;
// loading.hideLoadingMask();
// page++;
// },
// error: function() {
// tip.show('网络断开连接了~');
// searching = false;
// loading.hideLoadingMask();
// }
// });
//}
//
////srcoll to load more
//$(window).scroll(function () {
// window.requestAnimationFrame(scrollHandler);
//});
//
/**
* 商品详情
* @author: liangzhifeng<zhifeng.liang@yoho.cn>
* @date: 2015/11/18
*/
var $ = require('jquery'),
Hammer = require('yoho.hammer'),
lazyLoad = require('yoho.lazyload');
var loading = require('../../plugin/loading');
tip = require('../../plugin/tip');
var introUrl = $('#introUrl').val(),
winH = $(window).height(),
searching = false,
end = false,
num;
function scrollHandler() {
if ($(window).scrollTop() + winH >= $(document).height() - 50) {
search();
}
}
function search() {
if (searching || end) {
return;
}
searching = true;
loading.showLoadingMask();
$.ajax({
type: 'GET',
url: introUrl,
success: function(data) {
var $productDesc = $('#productDesc');
$productDesc.append(data);
lazyLoad($productDesc.find('img.lazy'));
searching = false;
end = true;
loading.hideLoadingMask();
},
error: function() {
tip.show('网络断开连接了~');
searching = false;
loading.hideLoadingMask();
}
});
}
//srcoll to load more
$(window).scroll(function () {
window.requestAnimationFrame(scrollHandler);
});
... ...
... ... @@ -76,7 +76,7 @@
<div class="gap-block"></div>
{{# enterStore}}
<div class="enter-store page-block">
<div id="enter-store" class="enter-store page-block">
<a class="store-logo" href="{{url}}" style="">
<img class="lazy" data-original="{{img}}" alt="{{storeName}}">
</a>
... ... @@ -87,6 +87,8 @@
<div class="gap-block"></div>
<div id="productDesc"></div>
{{#cartInfo}}
<div class="cart-bar">
<span class="num-tag">{{numInCart}}</span>
... ... @@ -100,5 +102,9 @@
</div>
{{/cartInfo}}
{{#if introUrl}}
<input id="introUrl" type="hidden" value={{introUrl}}>
{{/if}}
</div>
{{> layout/footer}}
\ No newline at end of file
... ...
... ... @@ -7,11 +7,9 @@
</h1>
{{#detail}}
<ul class="detail table clearfix">
<!-- <li class="row"> -->
{{#list}}
<div class="column">{{param}}</div>
{{/list}}
<!-- </li> -->
</ul>
{{/detail}}
<div class="desc-text">{{desc}}</div>
... ...