var d = dialog({contentType:'load', skin:'bk-popup'}); var d1 = dialog({contentType:'load', skin:'bk-popup', content:'提交中...'}); var pagetype = 7; var doctor = ""; $(function (){ checkUserAgent(); }) //判断是否有家庭签约信息 function queryInit() { d.show(); sendPost('patient/family_contract/checkOpenid', {}, 'json', 'post', queryFailed, openidSuccess2); } function queryFailed(res) { d.close(); if (res && res.msg) { dialog({contentType:'tipsbox', skin:'bk-popup' , content:res.msg}).show(); } else { dialog({contentType:'tipsbox', skin:'bk-popup' , content:'加载失败'}).show(); } } //成功 function openidSuccess2(res) { if (res.status == 200) { if(res.data == null || res.data == ""){ $("#div-area").show(); checkTeacter(); } else{ $("#div-doctorPage").show(); doctor = res.data; queryDoctor(); } } else { queryFailed(res); } } function closeWindow(){ var Request = new Object(); Request = GetRequest(); var code = Request["code"]; //从后台那边获取签名等信息 var params = {}; params.pageUrl = server + "wx/html/ssgg/html/choose-region.html?code=" + code + "&state=STATE"; $.ajax(server + "weixin/getSign", { data: params, dataType: "json", type: "post", success: function(res){ if (res.status == 200) { var t = res.data.timestamp; var noncestr = res.data.noncestr; var signature = res.data.signature; wx.config({ //debug: true, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。 appId: appId, // 必填,公众号的唯一标识 timestamp: t, // 必填,生成签名的时间戳 nonceStr: noncestr, // 必填,生成签名的随机串 signature: signature,// 必填,签名,见附录1 jsApiList: [ 'closeWindow' ] // 必填,需要使用的JS接口列表,所有JS接口列表见附录2 }); } } }); wx.ready(function(){ wx.closeWindow(); }); } //判断是否有三师信息 function checkTeacter(){ var data = {}; sendPost('patient/teachers', data, 'json', 'post', queryFailed, querySuccess); } function querySuccess(res) { if (res.status == 200) { d.close(); var list = res.data.list; if(list.length > 0){ var doctor = ""; var doctorName = ""; for(var i=0; i