// TODO 临时构造plus对象,使得能够在浏览器中进行调试 // var plus = null; // 基本信息(包括userAgent、上个页面传递的数据) var baseInfo = null, // 基础环境信息(包括当前webview) baseEnv = null, pages = {}, //记录个分组内数据页数 docInfo; var $searchbarInput = $('.searchbar .search-input'), // 搜索无结果时显示 $noResultWrap = $('#no_result_wrap'), // 页面顶部分类标签列表(四个列表项) $groupLabelList = $('#group_label_list'), patientInfo = null; // 获取基本信息(包括userAgent、上个页面传递的数据) var getBaseInfoPromise = function() { // 登录的相关信息 var userAgent = plus && JSON.parse(plus.storage.getItem("userAgent")) return { userAgent: userAgent } }, // 获取基础环境信息 getBaseEnvPromise = function () { var env = { webview: plus&&plus.webview.currentWebview() }; return Promise.resolve().then(function(res) { return env; }); }, //获取分组信息 getGroupData = function(){ docInfo = JSON.parse(plus.storage.getItem("docInfo")); var url = "doctor/patient_label_info/label_patient_amount", params = { labelType: 1, //labelType:1是服务类型,3是疾病类型 4自定义标签 teamCode: docInfo.adminTeamCode }; plus.nativeUI.showWaiting(); sendPost(url, params, null,function(res){ if(res.status == 200){ for(i=0; i 0){ $opened.removeClass('current').find(".group-info").hide(); $opened.find(".ui-arrow").removeClass("ui-arrow-t"); $opened.find(".ui-arrow").addClass("ui-arrow-b"); } if(amount > 0){ $groupInfo.show(); var liLen = $el.find('ul.n-list li').length; if(liLen == 0){ initPatientListByGroup(code, true); } } } }); $("#groupList").on('tap', ".load-more", function(e){ e.stopPropagation(); var $this = $(this), code = $this.attr("data-group"); // mui('.mui-scroll-wrapper').refresh(); initPatientListByGroup(code, false); }); $groupLabelList.on('tap',"li.group-item",function() { openWebview("../../huanzhe/html/huanzhe-by-type.html",{ type: self.type, accessData: { labelType: $(this).attr("data-type"), typeName: $(this).find(".item-label").text(), teamCode: docInfo.adminTeamCode }, }); }) $searchbarInput.on('tap',function() { mui.openWindow({ id: "searchhuanzhe2", url: "../../huanzhe/html/searchhuanzhe.html", extras: {} }) }); $(".header-link").on('click', function(){ openWebview("../../huanzhe/html/biaoqianguanli.html",{ teamCode: docInfo.adminTeamCode }); }) /*刷新事件*/ window.addEventListener("refresh", function group(e) { getGroupData(); }); }; // 页面业务处理流程开始 new Promise(function(resolve, reject) { // TODO 临时放开 //resolve(true); mui.plusReady(function() { // plus已经准备好,可以往下执行 resolve(true); }); }).then(function() { // 获取基础环境信息 return getBaseEnvPromise().then(function(env) { baseEnv = env; }).then(function() { // 获取登录医生信息 baseInfo = getBaseInfoPromise(); initScroller(); // searchByPaging(true); getGroupData(); // 绑定页面事件 bindEvents(); if(baseEnv.webview.origin){//“随访”功能,需要返回按钮 $(".mui-action-back").show(); } }) }).catch(function(e) { plus.nativeUI.closeWaiting(); console && console.error(e); }); function setAge(age) { if(age == 0) { return "<1"; } if(age == -1) return "未知"; return age; } template.helper("setAge", setAge); function setSex(s) { if(s == 1) { return "男"; } else if(s == 2) { return "女"; } } template.helper("setSex", setSex); template.helper("getPhoto", function(str){ return getImgUrl(str); })