12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- var isLeader = false,
- level,
- docCode = '',
- docInfo;
-
- var request = getRequest(),
- target_url = request.target_url
- $(function(){
- var height = window.innerHeight;
- $("#content-main").css("height", height-51+"px");
- //获取医生基本信息
- 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 = '<li><a class="J_menuItem" href="order-list-jg.html?type=1" data-index="0">需跟踪订单</a></li>'+
- '<li><a class="J_menuItem" href="order-list-jg.html?type=2" data-index="0">已接收订单</a></li>';
- }
- for(var i=0; i<res.data.length; i++){
- var item = res.data[i];
- if(item.leaderCode == docInfo.code){
- isLeader2 = true;
- }else{
- isLeader2 = false;
- }
- console.log(isLeader2);
- manageTeams += '<li><a class="J_menuItem" href="prescription-management.html?id='+item.id+'" data-index="0" data-id="'+item.id+'">'+item.name+'</a></li>';
- orderTeams += '<li><a class="J_menuItem" href="order-list.html?id='+item.id+'&isLeader='+isLeader2+'" data-index="0">'+item.name+'</a></li>';
- }
- $("#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 登录成功");
- })
- }
|