123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167 |
- var scrollers = [],
- page = 1,
- pageSize = 10,
- docInfo;
-
- mui.init();
- mui.plusReady(function(){
- docInfo = JSON.parse(plus.storage.getItem("docInfo"));
-
- getTeamMembers();
- initScroller();
- bindEvents();
- templateHelper();
- mui('#slider').slider().setStopped(true);
- })
- function getTeamMembers(){
- var url = "/doctor/specialist/findDoctorTeamMenmber",
- params = {
- doctor: docInfo.code
- };
- plus.nativeUI.showWaiting();
- sendGet(url, params, null, function(res){
- if(res.status == 200){
- if(res.data.member.length == 0){
- $("#teamList").hide();
- $("#item1 .no-result-wrapper").show();
- }else{
- var html = template("team-tmp", res.data);
- $("#teamList").empty().append(html);
- }
- plus.nativeUI.closeWaiting();
- }else{
- plus.nativeUI.closeWaiting();
- mui.toast(res.msg);
- }
- }, true);
- }
- function getHospitalDoctorList(isInit){
- if(isInit){
- page = 1;
- }
- var url = "/doctor/specialist/getDoctorInHospital",
- params = {
- doctor: docInfo.code,
- page: page,
- size: pageSize
- };
- plus.nativeUI.showWaiting();
- sendGet(url, params, null, function(res){
- if(res.status == 200){
- var list = res.data;
- if(list.length == 0){
- if(isInit){
- $("#hosDocList").hide();
- $("#hosDocList").siblings().show();
- }else{
- scrollers[1].endPullupToRefresh(true);
- }
- }else{
- var html = template("member-tmp", {list: list});
- if(isInit){
- $("#hosDocList").empty().append(html);
- }else{
- $("#hosDocList").append(html);
- }
-
- if(list.length < pageSize){
- scrollers[1].endPullupToRefresh(true);
- }else{
- page ++;
- scrollers[1].endPullupToRefresh(false);
- }
- }
- plus.nativeUI.closeWaiting();
- }else{
- plus.nativeUI.closeWaiting();
- mui.toast(res.msg);
- }
- }, true);
- }
- function bindEvents(){
- $(".mui-control-item").on('tap', function(){
- var $this = $(this),
- index = $this.index();
- console.log(index);
- if(index == 1 && $("#hosDocList li").length == 0){
- getHospitalDoctorList(true);
- }
- });
-
- //查看团队成员信息
- $("#slider").on('tap', ".t-doctor", function(){
- var oCode = $(this).attr("data-code");
-
- openWebview("doctor-info.html", {docCode: oCode});
- });
-
- $(".lin-search").on('tap', function(){
- openWebview("search-doctor.html");
- })
- }
- function templateHelper(){
- template.helper("getPhoto", function(str){
- return getImgUrl(str);
- });
-
- template.helper("getLevelName", function(level){
- switch(parseInt(level)){
- case 1:
- return "专科医生";
- break;
- case 2:
- return "全科医生";
- break;
- case 3:
- return "健康管理师";
- break;
- default:
- return "";
- break;
- }
- })
- }
- function initScroller(){
- var deceleration = mui.os.ios?0.003:0.0009;
- mui('.mui-scroll-wrapper').scroll({
- bounce: false,
- indicators: true, //是否显示滚动条
- deceleration:deceleration
- });
-
- $.each(document.querySelectorAll('.mui-slider-group .mui-scroll-wrapper'), function(index, pullRefreshEl){
- //目前只有第3个tab的院内的医生需要分页,其他两个tab的页面不分页
- var scroller;
- if(index != 1){
- scroller = mui(pullRefreshEl).pullRefresh({
- down: {
- callback: function(){
- getTeamMembers();
- this.endPulldownToRefresh();
- }
- },
- });
- }else{
- scroller = mui(pullRefreshEl).pullRefresh({
- down: {
- callback: function(){
- getHospitalDoctorList(true);
- this.endPulldownToRefresh();
- }
- },
- up: {
- callback: function(){
- var self = this;
- getHospitalDoctorList(false);
- }
- }
- })
- }
- scrollers.push(scroller);
- })
- }
|