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:'
'+
'
+'+request.acquisition+' 积分
'+
'
'}).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;i1){
// 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";
}
})
}