123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129 |
- var pagetype=54;
- var useAgent=JSON.parse(window.localStorage.getItem(agentName));
- var accountId=window.localStorage.getItem("accountId");
- var page=1;
- var loadMoreNumber=15;
- var __that;
- var __index=-1;
- window.localStorage.removeItem('activeteCode');
- !function(){
- mui.init({
- pullRefresh : {
- container:"#refreshContainer",//下拉刷新容器标识,querySelector能定位的css选择器均可,比如:id、.class等
- down : {
- style:'circle',//必选,下拉刷新样式,目前支持原生5+ ‘circle’ 样式
- color:'#2BD009', //可选,默认“#2BD009” 下拉刷新控件颜色
- height:'50px',//可选,默认50px.下拉刷新控件的高度,
- range:'100px', //可选 默认100px,控件可下拉拖拽的范围
- offset:'0px', //可选 默认0px,下拉刷新控件的起始位置
- height:50,//可选,默认50.触发下拉刷新拖动距离,
- contentdown : "下拉可以刷新",//可选,在下拉可刷新状态时,下拉刷新控件上显示的标题内容
- contentover : "释放立即刷新",//可选,在释放可刷新状态时,下拉刷新控件上显示的标题内容
- contentrefresh : "正在刷新...",//可选,正在刷新状态时,下拉刷新控件上显示的标题内容
- callback :function(){
- getMoreList.call(this,false) //必选,刷新函数,根据具体业务来编写,比如通过ajax从服务
- }
- },
- up : {
- height:50,//可选.默认50.触发上拉加载拖动距离
- auto:true,//可选,默认false.自动上拉加载一次
- contentrefresh : "正在加载...",//可选,正在加载状态时,上拉加载控件上显示的标题内容
- contentnomore:'没有更多数据了',//可选,请求完毕若没有更多数据时显示的提醒内容;
- callback :function(){
- __that=this;
- getMoreList.call(this,true) //必选,刷新函数,根据具体业务来编写,比如通过ajax从服务器获取新数据;
- }
- }
- }
- });
- }()
- function togglemenu(obj,id){
- if(obj!==undefined){
- if(__index==obj) return $('.i-dropdown-menu').toggleClass('i-dropdown-menu-open');
- __index=obj;
- page=1;
- var current=$((event || window.event).target);
- current.addClass('activity-active').siblings().removeClass('activity-active');
- $('#pageTitle').html(obj>=0?current.html():'选择活动')
- if(obj>=0){
- $('.activity-nav').removeClass('is-show-nav');
- window.localStorage.setItem('activeteCode',id)
- }else{
- $('.activity-nav').addClass('is-show-nav');
- window.localStorage.removeItem('activeteCode')
- }
- getMoreList.call(__that,false);
- }
- $('.i-dropdown-menu').toggleClass('i-dropdown-menu-open');
- }
- function getMoreList(isLoadMore) {
- var self=this;
- var __page=page=isLoadMore?page:1;
- var _url,params;
- var code=window.localStorage.getItem('activeteCode');
- $('.div-no-info').addClass('c-hide');
- if(code){
- $('.mui-pull-bottom-pocket').addClass('mui-block mui-visibility')
- _url='patient/healthBank/selectByActivity';
- params={
- creditsLogDo : JSON.stringify({"accountId":accountId}),
- page : __page,
- activityId:code,
- patientId:useAgent.uid,
- size : loadMoreNumber
- };
- }else{
- params={
- creditsLogDo : JSON.stringify({"accountId":accountId}),
- page : __page,
- size : loadMoreNumber
- };
- }
- sendPost((_url || 'patient/healthBank/selectDetails'), params, 'json', 'post',function(){
- if(isLoadMore){
- self.endPullupToRefresh();
- }else{
- self.endPulldownToRefresh();
- }
- },function(res){
- html = template('li_tmpl',{list: res.data.detailModelList});
- var ul=self.element.querySelector('.integral-list');
- var length=res.data.detailModelList.length || 0;
- !length && $('.div-no-info').removeClass('c-hide') && (__page==1 && $('.mui-pull-bottom-pocket').removeClass('mui-block mui-visibility'));
- if(isLoadMore){//是否是上拉加载
- //加载完新数据后,必须执行如下代码,true表示没有更多数据了:
- var noData=(length<loadMoreNumber);
- ul.innerHTML+=html;
- self.endPullupToRefresh(noData);
- }else{
- ul.innerHTML=html;
- self.endPulldownToRefresh();
- }
- })
- }
- function pullfresh() {
- var that=this;
- setTimeout(function(){
-
- //没有更多内容了,endPulldown 传入true, 不再执行下拉刷新
- that.endPulldownToRefresh();
- },1000)
- }
- // 活动列表
- !function(){
- var params={
- page:1,
- size:10,
- task:JSON.stringify({}),
- }
- sendPost('patient/healthBank/selectTask', params, 'json', 'post',function(){
- airDialog("系统繁忙,请稍后再试!")
- },function(res){
- if(res.status==200){
- var _data = res.data && res.data.detailModelList || [];
- $(".dropdown-list").append(template('activity_list_tmpl',{list: _data}));
- }else{
- $('.activity-swiper').find('.div-no-info').removeClass('c-hide');
- }
- })
- }()
|