var d = dialog({contentType:'load', skin:'bk-popup'}); var dd = dialog({contentType:'load', skin:'bk-popup', content:'提交中...'}); var id = 0; var openid =null; var userUid =null; //var firstUid = window.localStorage.getItem("firstUid"); //var firstName = window.localStorage.getItem("firstName"); var userAgent = window.localStorage.getItem(agentName); var username = ""; var userphoto = "../../../images/p-default.png"; var index = 0; var usercode = ""; var chooseName = ""; var pagetype=11; if(userAgent){ var jsonstr = $.parseJSON(userAgent); openid = jsonstr.openid; userUid = jsonstr.uid; } var scroller1 = new IScrollPullUpDown('wrapper',{ probeType:2, bounceTime: 250, bounceEasing: 'quadratic', mouseWheel:false, scrollbars:true, fadeScrollbars:true, click:true, interactiveScrollbars:false }, pullDownAction, null); $(function(){ $(".tips a").on("click", function () { window.location.href = server + "wx/html/home/html/zhmm-login.html?type=11&openid=" + openid; }); // 判断是否登录 checkUserAgent(); // 点击咨询详情 $("body").on("tap", ".n-list", function () { index = $(this).parents("li").index(); if ($(this).is(".list-last")) { window.location.href = "../../jtgx/html/add-step1.html"; } else if ($(this).is(".on")) { return ; } else { dd.show(); chooseName = $(this).find("h2").html(); var data = {}; data.family = $(this).data("code"); data.openid = openid; sendPost("patient/switch_account", data, "json", "post", changeFailed, changeSuccesss); } }); // 点击登录 $("#login").on("click", function () { clearAgent(); window.location.href = "../../home/html/login.html?type=11&openid="+openid; }); }); //下拉刷新 function pullDownAction(theScrollerTemp) { $(".pullDown").show(); setTimeout(function () { $("#ul_family").html(""); queryInit(); }, 1000); } //上拉加载数据 function pullUpAction(theScrollerTemp) { $(".pullUp").show(); setTimeout(function () { queryInit(); }, 1000); } // 禁止拖动 document.addEventListener('touchmove', function (e) { e.preventDefault(); }, false); /** * 界面数据初始化 */ function queryInit() { d.show(); var data={}; sendPost('patient/baseinfo', data, 'json', 'post', queryFailed, querySuccess); } function queryFailed(res) { d.close(); if (res && res.msg) { var d1 = dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:res.msg}).show(); } else { var d2 = dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'加载失败'}).show(); } } function querySuccess(res) { if (res.status == 200) { var resData = res.data; if (resData.name) { username = resData.name; // 提示 // var text; // if (userUid == firstUid) { // text = '您可在首次登录账号的家人中自由切换,若需切换到其他账号,请直接登录其账号。登陆其他账号' // } else { // text = '因您通过' + firstName + '账号切换过来,故只可切换至与' + firstName + '有家庭关系的账号,已自动过滤不可切换的账号。若想切换到' + username + '的其他家人账号,请直接登录' + username + '账号后切换。登陆其他账号'; // } // $("#tip").html(text); } if (resData.photo && resData.photo != "") { userphoto = getImgUrl(resData.photo); } var data = {}; data.patient = userUid; usercode = resData.code; data.isAgree = 1;//已经同意授权 sendPost("patient/family/members", data, "json", "get", queryListFailed, queryAppoListSuccesss); } else { //非200则为失败 queryFailed(res); } } function queryListFailed(res) { d.close(); if (res && res.msg) { var d1 = dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:res.msg}).show(); } else { var d2 = dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'加载失败'}).show(); } } function queryAppoListSuccesss(res) { if (res.status == 200) { var $list = document.querySelector("#ul_family"); var $liFirst = document.createElement("li"); firstContent = '
自己
'+ '' + familyRelationName + '
'+ '添加家人
'+ // '添加家人
'+ // '