fd-gulp-convert-encoding
Version:
convert file to assigned charset
88 lines (71 loc) • 2.49 kB
JavaScript
/**
* 评价 组件
*/
define('detail.modules.offerRemarkList.View',
['jQuery', 'Class','lofty.ui.scroller','detail.core.Wing','detail.core.Event'],
function($, Class,Scroller,Wing,Event) {
return Class({
init: function(view, config) {
this.onEvent = $.os.supportsTouch ? 'tap' : 'click';
this.div = view;
this.config = config;
this.bindEvent();
this.initScroller();
this.page = 1;
},
//事件绑定
bindEvent:function(){
var self = this;
Event.on('refreshScroll',function(){
self.myScroll.refresh();
});
},
//初始化滚动
initScroller:function(){
var self = this,
pullUpEl = document.getElementById('pullUp'),
pullUpOffset = pullUpEl.offsetHeight;
this.myScroll = new Scroller({
container: '#m-detail-offer-remark-list',
useTransition: true,
topOffset: 0,
bottomSelector: '#pullUp',
bottomGapThreshold: 5
});
this.myScroll.on('pullUpChange', function() {
pullUpEl.className = 'flip';
pullUpEl.querySelector('.pullUpLabel').innerHTML = '释放刷新...';
}).on('pullUpRestore', function() {
pullUpEl.className = '';
pullUpEl.querySelector('.pullUpLabel').innerHTML = '向上拖动加载更多...';
}).on('infiniteScroll', function() {
pullUpEl.className = 'loading';
pullUpEl.querySelector('.pullUpLabel').innerHTML = '...';
self.page += 1;
self.getRemarkList(); // Execute custom function (ajax call?)
})
},
//获取评价列表
getRemarkList:function(data){
var self = this,
params ={
"receiveUserId":this.config.userId-0,
"starLevel":0,
"itemId":this.config.offerId-0,
"bizType":"trade",
"page":this.page,
"pageSize":5
};
$.extend(params,data);
Wing.load('offerRemarkList', {
data: params
}).done(function(elm, next) {
var node = elm.find('div.remark-item');
$(self.myScroll.container).find('div.remark-list').append(node);
elm = null;
self.myScroll.refresh();
});
},
end:0
});
});