123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145 |
- mui.init();
- var d = dialog({contentType:'load', skin:'bk-popup'});
- var pagetype=55;
- (function(mui) {
- checkUserAgent();
- var unUserPage=userPage=1;//初始化页数
- var loadMoreNumber=15;//一次加载几条
- var useAgent=JSON.parse(window.localStorage.getItem(agentName));
- getTemplateHelper();
- !function(){
- var deceleration = mui.os.ios?0.003:0.0009;
- mui('.mui-scroll-wrapper').scroll({
- bounce: false,
- indicators: false, //是否显示滚动条
- deceleration:deceleration
- });
- mui.each(document.querySelectorAll('.mui-slider-group .mui-scroll-wrapper'), function(index, pullRefreshEl) {
- mui(pullRefreshEl).pullRefresh({
- down: {
- callback: function() {
- getIntegralList.call(this,index, false)
- }
- },
- up: {
- auto:true,
- callback : function() {
- getIntegralList.call(this,index,true)
- }
- }
- });
- });
- var request=GetRequest();
- if('selectIndex'in request){
- var selectIndex=request['selectIndex']|0
- if($('.integral-type').find('a').length<=selectIndex) return ;
- $('.integral-type').find('a').eq(selectIndex).addClass('mui-active').siblings('a').removeClass('mui-active');
- $('.mui-slider-item').eq(selectIndex).addClass('mui-active').siblings('div').removeClass('mui-active');
- $('.mui-slider-group').css({'transform': ('translate3d(-'+($('.mui-scroll').width()*selectIndex)+'px, 0px, 0px) translateZ(0px)'),'transition-duration': '0ms'});
- }
- }()
- function getIntegralList(index, isLoadMore){
- var self= this;
- var tradeDirection,__page,templateName,_url;
- var useAgent=JSON.parse(window.localStorage.getItem(agentName));
- var accountId=window.localStorage.getItem("accountId");
- var params;
- if(index===0){
- tradeDirection=1;
- unUserPage=__page=isLoadMore?unUserPage:1;
- templateName='li_tmpl';
- _url='patient/healthBank/selectTask';
- params={
- page:__page,
- size:loadMoreNumber,
- task:JSON.stringify({})
- }
- }else{
- tradeDirection=-1;
- userPage=__page=isLoadMore?userPage:1;
- templateName='li_tmpl_cy';
- _url='patient/healthBank/selectByPatient';
- params={
- page:__page,
- size:loadMoreNumber
- }
- }
- sendPost(_url, params, 'json', 'post',function(){
- if(isLoadMore){
- self.endPullupToRefresh();
- }else{
- self.endPulldownToRefresh();
- }
- airDialog('服务器繁忙,请稍后再试!')
- },function(res){
- var _data = res.data && res.data.detailModelList || [];
- for(var i=0,len=_data.length;i<len;i++){
- _data[i].endTime=_data[i].endTime.substr(5,5).replace(/-/g,'.');
- _data[i].startTime=_data[i].startTime.substr(0,10).replace(/-/g,'.');
- }
- html = template(templateName,{list: _data});
- var ul=self.element.querySelector('.activity-list');
- var length=res.data && res.data.detailModelList && res.data.detailModelList.length || 0;
- if(isLoadMore){//是否是上拉加载
- ul.innerHTML+=html;
- //加载完新数据后,必须执行如下代码,true表示没有更多数据了:
- if(length==0&&unUserPage==1){
- $('.mui-pull-caption-refresh').hide();
- $(ul).hide();
- $(ul).parents(".mui-slider-item").find('.div-no-info').removeClass("c-hide");
- }else{
- if(index===0) unUserPage++;
- else userPage++;
- }
- //
- self.endPullupToRefresh(length<loadMoreNumber);
- }else{
- ul.innerHTML=html;
- self.endPulldownToRefresh();
- }
- })
- }
- $(".activity-list").on('tap','.activity-list-item',function(){
- var code=$(this).data('code');
- location.href="./activity-detail.html?activity_id="+code;
- })
- })(mui);
- function airDialog(content){
- dialog({contentType:'tipsbox',top:true, skin:'bk-popup' , content:content}).show();
- }
- function goUrl(url){
- if(url) location.href=url;
- else airDialog('功能开发中,敬请期待!')
- }
- function getTemplateHelper(){
- template.helper("getImage", function(str){
- if(str){
- return getImgUrl(str);
- }else{
- return "../images/morenhuodong_banner01_img.png";
- }
- });
-
- template.helper("getStatusClass", function(status){
- if(status == "-1"){
- return "i-btn-gray disabled";
- }else{
- return "i-btn-success";
- }
- });
-
- template.helper("getStatusName", function(status){
- switch(parseInt(status)){
- case -1:
- return "已结束";
- break;
- case 0:
- return "进行中";
- break;
- case 1:
- return "报名中";
- break;
- }
- })
- }
|