123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- var page = 1,
- pagesize = 15;
- var $notext = $('#wushuju');
- var $scroll = $('.mui-scroll-wrapper');
- var $list = $('#show_content');
- mui.plusReady(function(){
- backParent()
- queryListData();
- bindEvents();
- })
- function backParent() {
- var old_back = mui.back;
- mui.back = function() {
- var self = plus.webview.currentWebview();
- if(self.opener && self.opener()) {
- mui.fire(self.opener(), "refresh");
- }
- old_back();
- }
- }
- function queryListData(fun,text){
- var params ={
- page:page,
- pagesize:pagesize
- }
- sendGet("doctor/pcCustomer/getCallServiceMes",params, function(){
- plus.nativeUI.closeWaiting();
- fun&&fun.call(this,false)
- mui.toast("请求失败");
- }, function(res){
- plus.nativeUI.closeWaiting();
- if(res.status == 200){
- var html = template('list_tmp',{list:res.data})
- if(page == 1 && res.data.length==0){
- $notext.show();
- $scroll.hide();
- }else{
- $notext.hide();
- $scroll.show();
- if(text == 'down'){
- $list.empty();
- fun&&fun.call(this,false)
- }else{
- if(res.data.length < pagesize){
- fun&&fun.call(this,true)
- }else{
- fun&&fun.call(this,false)
- }
- }
- $list.append(html);
- }
- }else{
- fun&&fun.call(this,false)
- mui.toast("获取数据失败");
- }
- })
- }
- mui.init({
- pullRefresh : {
- container:'.mui-scroll-wrapper',
- down : {
- height:50,
- auto: false,
- contentdown : "下拉可以刷新",
- contentover : "释放立即刷新",
- contentrefresh : "正在刷新...",
- callback: function() {
- var self = this;
- page = 1;
- queryListData(function(value){
- setTimeout(function(){
- self.endPulldownToRefresh(false);
- mui('.mui-scroll-wrapper').pullRefresh().enablePullupToRefresh();
- },500)
- },'down')
- }
- },
- up : {
- height:50,
- contentrefresh : "正在加载...",
- contentnomore:'没有更多数据了',
- callback: function() {
- var self = this;
- page++;
- queryListData(function(value){
- setTimeout(function(){
- self.endPullupToRefresh(value);
- },500)
- },'up')
- }
- }
- }
- })
-
- function bindEvents(){
- $(".mui-scroll").on('tap', '.list-item', function(){
- var $this = $(this),
- xtCode = $this.attr("data-code");
- openWebview("xietongfuwu-detail.html", {
- code: xtCode
- })
- })
- }
- //整体刷新
- function reloadPageData(){
- plus.nativeUI.showWaiting();
- page = 1;
- $list.empty();
- queryListData();
- }
- window.addEventListener("refreshXTmsg", function(){
- reloadPageData()
- })
|