123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164 |
- var d = dialog({contentType:'load', skin:'bk-popup'});
- var pagetype=51;
- var regionalRestrictions="350205";//地区限制,开放所有就改为空字符串
- (function(){
- var swiperLength=$(".fuwu-swiper .swiper-wrapper").children().length;
- if(swiperLength>1){
- var swiper = new Swiper('.fuwu-swiper', {
- pagination: '.swiper-pagination',
- paginationClickable: true,
- spaceBetween: 10,
- centeredSlides: true,
- autoplay: 500,
- autoplayDisableOnInteraction: false
- });
- }
- if(!$(".health-shop").parents(".i-panel").hasClass("c-hide")){
- var inifateLeft = (function(){//水平滚动代码
- var scrollDiv=$('.new-news-scroll');
- var speend=40
- var obj=$(".new-news-list")
- var html=obj.html();
- obj.html(html+html);
- var maxLeft=obj.width();
- var left=0;
- return function(){
- setTimeout(function(){
- left++;
- if(left==maxLeft/2) left=0;
- scrollDiv.scrollLeft(left)
- inifateLeft();
- },speend)
- }
- })()
- inifateLeft()
- var mySwiper = new Swiper ('.health-shop', {
- direction: 'horizontal',
- loop: true,
- slidesPerView: 1.5,
- centeredSlides:true,
- spaceBetween: 15,
- })
- }
-
- })();
- (function(){
- checkUserAgent();
- var request=GetRequest();
- if(('acquisition' in request)&&(location.hash.indexOf("acquisitionFlag")===-1)){//判断是推送消息过来的,并且防止用户刷新页面
- dialog({quickClose: true,skin:'bk-transparent', content:'<div style="position: relative;background:#fff url(../images/icon_jifen.png) no-repeat -10px 0;border-radius: 5px;background-size: 65% auto;height: 136px;">'+
- '<p style="position: absolute;right: 26px;top: 0;line-height: 136px;font-size: 25px;color: #ffa53e;">+'+request.acquisition+' 积分</p>'+
- '</div>'}).width(255).show();
- location.hash+="acquisitionFlag"
- }
- var useAgent=JSON.parse(window.localStorage.getItem(agentName));
- var accountId=window.localStorage.getItem("accountId");
-
- getTemplateHelper();
-
- // 获取用户积分
- !function(){
- var params={
- creditsDetail:JSON.stringify({patientId:useAgent.uid,tradeDirection:-1}),
- };
- sendPost('patient/healthBank/selectAccount', params, 'json', 'post',function(){
- airDialog("系统繁忙,请稍后再试!");
- $('body').addClass('opened');
- },function(res){
- var hospital=res.data&&res.data.obj&&res.data.obj.hospital || '';
- var isOpen=!regionalRestrictions || regionalRestrictions.indexOf(hospital)!==-1;
- // if(isOpen)
- $('body').addClass('opened');
- // else location.replace("./unopened.html");//替换当前页面
- if(res.status==200){
- var accountId=res.data&&res.data.obj&&res.data.obj.id || "";
- if(accountId){
- window.localStorage.setItem("accountId",accountId);
- }else{
- airDialog("获取用户账户信息失败")
- }
- $("#total").text(res.data&&res.data.obj&&res.data.obj.total||0);
- $("#useTotal").text(res.data&&res.data.obj&&res.data.obj.usedTotal||0);
- }else if(res.status==-1){
- //商城未开放 先注释
- // location.replace("./unopened.html");
- }
- else{
- airDialog(res.msg)
- }
- })
- }()
- // 获得积分列表
- !function(){
- var params={
- task:JSON.stringify({"taskCode":["BP_BIND","GLU_BIND","BP_MEASURE","GLU_MEASURE"],"patientId":useAgent.uid}),
- page:1,
- size:10
- };
- sendPost('patient/healthBank/selectTasks', params, 'json', 'post',function(){
- airDialog("系统繁忙,请稍后再试!")
- },function(res){
- if((res.status==200)&&res.data){
- html = template('action_tmpl',{data: res.data.detailModelList||[]});
- $(".get-integral-act-list").html(html);
- }else{
- $('.get-integral').find('.div-no-info').removeClass('c-hide');
- }
- })
- }()
- // 活动列表
- !function(){
- var params={
- page:1,
- size:3, //默认初始只显示3个活动
- 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 || [];
- for(var i=0,len=_data.length;i<len;i++){
- _data[i].endTime=_data[i].endTime.substr(0,10).replace(/-/g,'.');
- _data[i].startTime=_data[i].startTime.substr(0,10).replace(/-/g,'.');
- }
- $("#activity_list").html(template('activity_tmpl',{data: _data}));
- if(_data.length>1){
- // setTimeout(function(){
- var swiper = new Swiper('.activity-swiper', {
- pagination: '.swiper-pagination',
- paginationClickable: true,
- spaceBetween: 10,
- centeredSlides: true,
- autoplayDisableOnInteraction: false,
- autoplay: 2500
- });
- // },100)
- }
- }else{
- $('.activity-swiper').find('.div-no-info').removeClass('c-hide');
- }
- })
- }()
- $("#activity_list").on('click','.ckxq',function(){
- var code=$(this).data('code');
- location.href="./activity-detail.html?activity_id="+code;
- })
-
- })()
- function airDialog(content){
- dialog({contentType:'tipsbox',top:true, skin:'bk-popup' , content:content}).show();
- }
- function goUrl(url){
- location.href=url
- }
- function getTemplateHelper(){
- template.helper("getImageUrl", function(str){
- if(str){
- return getImgUrl(str);
- }else{
- return "../images/morenhuodong_banner01_img.png";
- }
- })
- }
|