1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- 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 = '<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 登录成功");
- })
- }
|