var isLeader = false, level, docCode = '', docInfo; var request = getRequest(), target_url = request.target_url $(function(){ //获取医生基本信息 getDoctorInfo(); }); function getDoctorInfo(){ APIService.getDoctorInfo().then(function(res){ if(res.status == 200){ docInfo = res.data; docCode = docInfo.code; isLeader = docInfo.isLeader == '1' ? true : false; level = docInfo.level; window.localStorage.setItem('docInfo', JSON.stringify(docInfo)); if(isLeader){ $("#consultMenu").removeClass("hidden"); } //先获取团队信息显示 getTeamInfo(); }else{ showWarningMsg(res.msg) } }) } function getTeamInfo(){ APIService.getTeamInfo(docCode).then(function(res){ if(res.status == 200){ var manageTeams = '', orderTeams = ''; var isLeader2 = false; if(level == 3){ //健管师,则续方订单中需要加上额外的两个菜单 orderTeams = '
  • 需跟踪订单
  • '+ '
  • 已接收订单
  • '; } for(var i=0; i'+item.name+''; orderTeams += '
  • '+item.name+'
  • '; } $("#manageTeams").empty().append(manageTeams); $("#orderTeams").empty().append(orderTeams); //如果有显示咨询,则登录IM if(isLeader){ loginIm(); } if(target_url) { var url = decodeURIComponent(target_url) $('#content-main .J_iframe').eq(0).attr('src', url) } else { var $adminLink = $('#manageTeams a[data-id="'+docInfo.adminTeamCode+'"]'); if($adminLink.length) { $adminLink.trigger('click') } else { $("#manageTeams li").eq(0).trigger('click') } } }else{ showWarningMsg(res.msg) } }); } function loginIm(){ var params = { user_id: docInfo.code, token: '', client_id: '', platform: 4 } APIService.loginIm({data: params}).then(function(res){ console.log("im 登录成功"); }) }