1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- var page = 1,//第几页
- pageNum = 10,//每页显示的数量
- $eventListWrapper = $('#view_wrap'),
- $noResultWrap = $('#no_result_wrap');
- mui.plusReady(function() {
- getYituisongList(page,pageNum,true);
-
- })
- mui("#jktj_list").on("tap", ".list-arrow-r1", function(e) {
-
- });
- // 滚动条实例初始化
- function initScroller() {
- //阻尼系数
- var deceleration = mui.os.ios?0.003:0.0009;
- mui('.mui-scroll-wrapper').scroll({
- bounce: false,
- indicators: true, //是否显示滚动条
- deceleration:deceleration
- });
-
- iscroller = mui(".mui-scroll").pullToRefresh({
- up: {
- callback: function() {
- page++;
- getYituisongList(page,pageNum);
- }
- },
- down: {
- callback: function() {
- var self = this;
- page = 0;
- getYituisongList(1,pageNum,true);
- self.endPullDownToRefresh();
- }
- }
- });
- }
- function getYituisongList(pageNum,pageSize,isInit){
- var url = "/wlyygc/doctor/edu/article/pushArticleLogs",
- params = {page: pageNum,pagesize: pageSize};
- plus.nativeUI.showWaiting();
- sendGet(url, params, null, function(res){
- if(res.status==10000){
- plus.nativeUI.closeWaiting();
- var list = res.result;
- if(list.length == 0) {
- if(isInit){
- $eventListWrapper.hide();
- $noResultWrap.show();
- }else{
- iscroller.endPullUpToRefresh(true);
- }
- } else {
- $noResultWrap.hide();
- $eventListWrapper.show();
- var html = template('yituisong-tmp', {list:list});
- if(isInit) {
- $("#jktj_list").html(html);
- if(res.result.length == pageSize){
- iscroller.finished = false;
- }
- } else {
- $("#jktj_list").append(html)
- }
- if(res.result && res.result.length < pageSize) {
- iscroller.endPullUpToRefresh(true);
- }else{
- iscroller.endPullUpToRefresh(false);
- }
- }
- initScroller();
- } else {
- plus.nativeUI.closeWaiting();
- mui.toast("数据获取失败");
- }
-
- });
- }
|