Переглянути джерело

2020/2/7 疫情发热任务

chenyue 4 роки тому
батько
коміт
7384e86180

+ 89 - 0
html/yszx/html/select-consult-doctor-fare.html

@ -0,0 +1,89 @@
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <title>选择咨询医生</title>
        <meta name="format-detection" content="telephone=no" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0" />
        <meta name="apple-mobile-web-app-capable" content="yes" />
        <meta name="apple-mobile-web-app-status-bar-style" content="black" />
        <link rel="stylesheet" type="text/css" href="../../../css/mui.min.css"/>
        <link rel="stylesheet" href="../../../css/cross.css" type="text/css" />
        <link rel="stylesheet" href="../../../css/cross.ui.css" type="text/css" />
        <link rel="stylesheet" type="text/css" href="../../../iconfont/iconfont.css" />
        <link rel="stylesheet" type="text/css" href="../../../widget/artDialog/6.0.5/css/ui-dialog.min.css">
        <link rel="stylesheet" href="../css/search-bar.css" type="text/css" />
        <link rel="stylesheet" href="../css/mingyi-homepage.css" type="text/css" />
    </head>
    <body>
        <div class="main">
            <div class="searchbar searchbar-init">
                <div class="searchbar-input">
                    <input type="text" placeholder="请输入科室或医生" class="inp-search">
                    <a href="javascript:void(0);" class="searchbar-clear"></a>
                </div>
                <a class="searchbar-cancel">取消</a>
            </div>
            <div id="search_suggest_text" class="f-dn"></div>
            <div class="div-content">
                <div class="ui-grid plr10 pb10 c-border-b">
                    <div class="ui-col-0 c-50 c-f14 c-border-r">医生列表</div>
                    <div class="ui-col-1 c-f14 pl15">科室分类</div>
                    <div class="ui-col-0"><a class="c-f14 c-17b3ec" id="select_dept">请选择</a></div>
                </div>
                <div class="mui-scroll-wrapper bgc-f2f4f6" style="top: 85px; bottom: 40px;">
                    <div class="mui-scroll">
                        <ul class="plr10 pb30" id="docList">
    
                        </ul>
                    </div>
                </div>
                <div class="focused" id='focused'>已关注的医生</div>
            </div>
            <div class="div-no-search-info f-dn">
                <div class="div-img"></div>
                <div class="div-search-content" style=" vertical-align: middle; margin: 15px auto 30px;text-align: center;">
                    今天无医坐诊哦,请改天再来~</div>
            </div>
        </div>
        
        
        <script type="text/html" id="doc-tmp">
            {{each list as it}}
            <li class="ui-grid ui-grid-middle plr10 ptb10 bgc-fff c-border c-border-radius mt10" data-code="{{it.code}}">
                <div class="ui-col-0 mr10">
                    <img src="{{it.photo | getImgUrl}}" width="45" height="45" class="c-images-cycle">
                </div>
                <div class="ui-col-1">
                    <div class="c-nowrap">
                        <span class="c-bold c-f16 mr10">{{#it.name | highlightKeyword}}</span>
                        <span class="c-f14 mr10">{{#it.dept_name | highlightKeyword}}</span>
                        <span class="c-f14">{{it.job_name}}</span>
                    </div>
                    <div class="c-f14">{{it.hospital_name}}</div>
                    <div class="c-nowrap c-f12 c-909090">{{it.expertise}}</div>
                    <div class="c-f12 c-323232 pt10 clearfix"> 
                        <div class="fl w-33"><span class="pr5">关注</span>{{it.concernNum}}</div>
                        <div class="fl w-33"><span class="pr5">咨询</span>{{it.consultNum}}</div>
                    </div>
                </div>
            </li>
            {{/each}}
        </script>
        
         <!--<div class="fl w-33"><span class="pr5">文章</span>{{it.articleNum}}</div>-->
         
        <script src="../../../js/jquery/2.1.3/jquery.js"></script>
        <script src="../../../widget/artDialog/6.0.5/js/dialog-plus.min.js"></script>
        <script type="text/javascript" src="../../../js/weixin_common.js"></script>
        <script type="text/javascript" src="../../../js/common_http.js"></script>
        <script src="../../../js/underscore.js"></script>
        <script src="../../../js/es6-promise.js"></script>
        <script src="../../../js/mui.js" type="text/javascript" charset="utf-8"></script>
        <script src="../../../js/template.js" type="text/javascript" charset="utf-8"></script>
        <script src="../js/select-consult-doctor-fare.js"></script>
    </body>
</html>

+ 231 - 0
html/yszx/js/select-consult-doctor-fare.js

@ -0,0 +1,231 @@
var d = dialog({contentType:'load', skin:'bk-popup'});
var page = 1,
    pageSize = 10,
    pagetype = 3;
// 搜索框 
var $searchbar = $('.searchbar'),
    // 搜索输入框
    $searchbarInput = $('.searchbar input'),
    // 搜索取消按钮
    $searchCancelBtn = $('.searchbar-cancel'),
    // 搜索框下面悬浮的搜索提示
    $searchSuggest = $('#search_suggest_text'),
    // 搜索结果展示容器
    $searchtResult = $('.div-content');
    // 搜索框初始化
    $searchbar.addClass("searchbar-active");
// 获取链接带参
var request =  GetRequest(),
    deptId = request["deptId"] || null,
    deptName = decodeURI(request["deptName"]) || "";
    
if(request["deptId"] === undefined) {
	deptId = 3
	deptName = "发热门诊(呼吸消化科)"
}
    
$(function(){
    checkUserAgent();
})
function queryInit(){
	
	// 验证居民信息是否完善
	checkBaseInfo()
	
    initScroller();
    if(deptId){
        $(".inp-search").val(deptName);
    }
    getDoctorList(true);
    bindEvents();
    getTemplateHelper();
}
function getDoctorList(isInit){
    d.show();
    if(isInit){
        page = 1;
    }
    var url = "patient/consult/doctorList",
        params = {
            dept: deptId,
            page: page,
            pagesize: pageSize,
            name: $(".inp-search").val()
        };
    sendPost(url, params, 'JSON', 'GET', queryFailed, function(res){
        if(res.status == 200){
            d.close();
            var list = res.list;
            if(list.length>0){
                page ++;
                var html = template("doc-tmp", {list: list});
                if(isInit){
                    $(".div-content").show();
                    $(".div-no-search-info").hide();
                    $("#docList").empty().append(html);
                }else{
                    $("#docList").append(html);
                }
                if(list.length < pageSize){
                    mui(".mui-scroll-wrapper").pullRefresh().endPullupToRefresh(true);
                }else{
                    mui(".mui-scroll-wrapper").pullRefresh().endPullupToRefresh(false);
                }
            }else{
                if(isInit){
                    $(".div-content").hide();
                    $(".div-no-search-info").show();
                    mui(".mui-scroll-wrapper").pullRefresh().endPullupToRefresh(true);
                }else{
                    mui(".mui-scroll-wrapper").pullRefresh().endPullupToRefresh(true);
                }
            }
        }else{
            queryFailed(res);
        }
    })
}
function bindEvents(){
    //搜索框事件
    $(".inp-search").on('compositionstart', function(){
        $(this).prop('comstart', true);
        //console.log('中文输入:开始');
    }).on('compositionend', function(){
        $(this).prop('comstart', false);
       // console.log('中文输入:结束');
    }).on("input",function(e){
        var $this = $(this);
        setTimeout(function(){
            if($this.prop('comstart')) {
                //console.log("true");
                return;
            }
            var text = $this.val().trim();
            $searchtResult.hide();
            showSearchSuggest(text);
            //如果有部门信息
            if(text != deptName){
                deptId = '';
            }
            if(text){
                $searchCancelBtn.show();
                $searchCancelBtn.css("opacity","1");
            }else{
                $searchCancelBtn.hide();
                $searchCancelBtn.css("opacity","0");
                mui(".mui-scroll-wrapper").pullRefresh().refresh(true);
                getDoctorList(true);
            }
        }, 0)
        
    })
    
    //取消事件
    $searchCancelBtn.on('click',function() {
        $(this).hide();
        $searchSuggest.text('');
        $searchSuggest.hide();
        $searchtResult.show();
    });
    
    $searchSuggest.on('click',function() {
        $searchCancelBtn.hide();
        $searchCancelBtn.css("opacity","0");
        $searchSuggest.hide();
        $searchtResult.show();
        getDoctorList(true);
    });
    
    // 选择科室
    $('#select_dept').on('click', function() {
        window.location.href = 'hospital-dept.html'
    })
    
    // 已关注医生列表
    $('#focused').on('click', function() {
        window.location.href = 'focused-doctor.html'
    })
    
    //单个医生点击
    $("#docList").on("tap", "li", function(){
        var doctorCode = $(this).attr("data-code");
        window.location.href = "doctor-homepage.html?doctor="+doctorCode;
    })
}
function getTemplateHelper(){
    template.helper("getImgUrl", function(str){
        return getImgUrl(str);
    });
    
    template.helper("highlightKeyword", function(str){
        var kw = $(".inp-search").val(),
            reg = new RegExp(kw+"(?!>)","gi"),
            html = str;
        if(kw){
            html = str.replace(reg,'<em>'+kw+'</em>');
        }
        return html;
    })
}
function initScroller(){
    //阻尼系数
    var deceleration = mui.os.ios?0.003:0.0009;
    mui('.mui-scroll-wrapper').scroll({
        bounce: false,
        indicators: true, //是否显示滚动条
        deceleration:deceleration
    });
    mui.ready(function() {
        mui(".mui-scroll-wrapper").pullRefresh({
            down:{
                callback: function(){
                    getDoctorList(true);
                    this.endPulldownToRefresh();
                }
            },
            up: {
                callback: function() {
                    var self = this;
                    setTimeout(function() {
                        getDoctorList(false);
//                      self.endPullupToRefresh();
                    }, 1000);
                }
            }
        });
    });
}
function showSearchSuggest(text) {
    var suggestText = '搜索“'+text+'”';
    // 如果text不为空,则显示;否则隐藏
    if(text&&text.trim().length) {
            $searchSuggest.text(suggestText);
            $searchSuggest.show();
    } else {
        $searchSuggest.text('');
        $searchSuggest.hide();
    }
}
//请求失败处理事件
function queryFailed(res, message){
    d.close();
    if(message){
        dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content: message}).show();
    }else{
        if (res && res.msg) {
            dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:res.msg}).show();
        } else {
            dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'加载失败'}).show();
        }
    }
    
}