jianjiaotuisong_yituisong.js 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. var page = 1,//第几页
  2. pageNum = 10,//每页显示的数量
  3. $eventListWrapper = $('#view_wrap'),
  4. $noResultWrap = $('#no_result_wrap');
  5. mui.plusReady(function() {
  6. getYituisongList(page,pageNum,true);
  7. })
  8. mui("#jktj_list").on("tap", ".list-arrow-r1", function(e) {
  9. });
  10. // 滚动条实例初始化
  11. function initScroller() {
  12. //阻尼系数
  13. var deceleration = mui.os.ios?0.003:0.0009;
  14. mui('.mui-scroll-wrapper').scroll({
  15. bounce: false,
  16. indicators: true, //是否显示滚动条
  17. deceleration:deceleration
  18. });
  19. iscroller = mui(".mui-scroll").pullToRefresh({
  20. up: {
  21. callback: function() {
  22. page++;
  23. getYituisongList(page,pageNum);
  24. }
  25. },
  26. down: {
  27. callback: function() {
  28. var self = this;
  29. page = 0;
  30. getYituisongList(1,pageNum,true);
  31. self.endPullDownToRefresh();
  32. }
  33. }
  34. });
  35. }
  36. function getYituisongList(pageNum,pageSize,isInit){
  37. var url = "/wlyygc/doctor/edu/article/pushArticleLogs",
  38. params = {page: pageNum,pagesize: pageSize};
  39. plus.nativeUI.showWaiting();
  40. sendGet(url, params, null, function(res){
  41. if(res.status==10000){
  42. plus.nativeUI.closeWaiting();
  43. var list = res.result;
  44. if(list.length == 0) {
  45. if(isInit){
  46. $eventListWrapper.hide();
  47. $noResultWrap.show();
  48. }else{
  49. iscroller.endPullUpToRefresh(true);
  50. }
  51. } else {
  52. $noResultWrap.hide();
  53. $eventListWrapper.show();
  54. var html = template('yituisong-tmp', {list:list});
  55. if(isInit) {
  56. $("#jktj_list").html(html);
  57. if(res.result.length == pageSize){
  58. iscroller.finished = false;
  59. }
  60. } else {
  61. $("#jktj_list").append(html)
  62. }
  63. if(res.result && res.result.length < pageSize) {
  64. iscroller.endPullUpToRefresh(true);
  65. }else{
  66. iscroller.endPullUpToRefresh(false);
  67. }
  68. }
  69. initScroller();
  70. } else {
  71. plus.nativeUI.closeWaiting();
  72. mui.toast("数据获取失败");
  73. }
  74. });
  75. }