Ver código fonte

Merge branch 'master' of http://192.168.1.220:10080/raolu/sr-iHealthApp

lulihong 6 anos atrás
pai
commit
af7980a566

+ 9 - 0
.project

@ -75,5 +75,14 @@
				<arguments>1.0-name-matches-false-false-node_modules</arguments>
			</matcher>
		</filter>
		<filter>
			<id>1530096473919</id>
			<name></name>
			<type>26</type>
			<matcher>
				<id>org.eclipse.ui.ide.multiFilter</id>
				<arguments>1.0-name-matches-false-false-node_modules</arguments>
			</matcher>
		</filter>
	</filteredResources>
</projectDescription>

Diferenças do arquivo suprimidas por serem muito extensas
+ 118 - 0
html/hzzd/css/search-bar.css


+ 142 - 0
html/hzzd/css/searchhuanzhe.css

@ -0,0 +1,142 @@
.searchbar { border-bottom: 1px solid #CCC; }
#search_suggest_text { position: absolute; top: 50px; left: 8px; color: #17b3ec; font-size: 18px;z-index: 10;}
.locate-city { background-color: #F2F3F5; }
.locate-city img { width: 15px; height: 20px; }
.list-wrap { border-top: 1px solid #CCC; /*background-color: #FFF;*/ }
.more-result { display: block; height: 35px; line-height: 35px; margin-left: -10px; border-top: 1px solid #E7E7E7; border-bottom: 1px solid #E7E7E7; }
.more-result>span { position: relative; color: #666; }
.more-result .fa-angle-right { position: absolute; top: -3px; right: -10px;font-size: 22px; }
.search-target-text em { font-weight: bold; color: #75BF00; }
.scroll-wrapper { top: 0px; }
#search_suggest_text { left: 0; width: 100%; padding-left: 8px; box-sizing: border-box; }
.no-result-img { display: block; width: 320px; height: 184px; margin: 0 auto; margin-top: 160px; }
.j-text-ellipsis em { font-weight: bold; color: #23AFFF; }
#jumin_wrapper .c-list > li { margin-left: 0; }
.l-sanshi-ico { width: 150px; }
.lin-search{
	height: 30px;
	padding: 8px 10px;
	background-color: #fff;
}
.lin-search img{
	width: 29px;
}
.lin-search div{
	text-align: center;
	border-radius: 5px;
	line-height: 29px;
	background-color: #f2f4f6;
	color: #999;
}
.lin-search-ipt{
	height: 30px;
	padding: 8px 10px;
	background-color: #17b3ec;
	display: -webkit-box;
}
.lin-search-ipt .div-input{
	border-radius: 5px;
	line-height: 29px;
	background-color: #f2f4f6;
	color: #999;
	text-align: left; 
	-webkit-box-flex: 1;
}
.lin-search-ipt input{
	background-color: #f2f4f6 ;
	border-radius: 5px;
	height: 30px;
	color: #999;
	text-align: left;
	padding-left: 30px;
	background: url(../../../images/sousuo_icon.png) no-repeat;
	background-size: 30px 30px;
	width: 88%;
}
.lin-search-ipt a{
	font-size: 16px;
	display: block;
	width: 32px;
	padding: 4px 6px 4px 12px;
	color: #fff;
}	
.f-fs12{font-size: 12px;}
.search-his .title{
	padding:0 12px;
	height: 44px;
	border-bottom: solid 1px #dcdcdc;
}
.search-his .cler{
	float: right;
	padding: 10px 0;
	color: #999;
	font-size: 16px;
}
.search-his .his{
	float: left;
	padding: 10px 0;
	font-size: 16px;
	font-weight: bold;
	color: #333;
}
.search-his .his-list{
	box-sizing: border-box;
	border-bottom: solid 1px #f1f1f1;
	padding: 10px 12px;
	font-size: 16px;
	color: #333;
	text-overflow: ellipsis;
	overflow: hidden;
	white-space: nowrap;
}
.search-his .his-list:first-child{
	border-top: none;
}
.search-his .his-list:last-child{
	border-bottom: solid 1px #dcdcdc;
}
.his-list-ul{
	background-color: #fff;
}
.arrow-right{position: absolute; top: 50%; right: 10px; margin-top: -5px;}
.lin-search-ipt{height: 50px;padding: 8px 10px;background-color: #17b3ec;display: -webkit-box;border-bottom: 1px solid #dcdcdc;}
.lin-search-ipt .div-input{padding-top: 2px;border-radius: 5px;line-height: 29px;background-color: #f2f4f6;color: #999;text-align: left; -webkit-box-flex: 1;}
.lin-search-ipt input{background-color: #f2f4f6 ;border-radius: 5px;height: 30px;text-align: left;padding-left: 30px;background: url(../../../images/sousuo_icon.png) no-repeat;background-size: 30px 30px;width: 98%;}
.lin-search-ipt input[type=text]{border: none!important;}
.lin-search-ipt a{font-size: 16px;display: block;width: 50px;padding: 4px 4px 4px 0px;color: #fff;text-align: right;}	
.mb-em{color: #909090;font-size: 12px;display: inline-block;margin-left: 6px;}
.mj-flex{display: flex;align-items: center;display: -webkit-flex;-webkit-align-items: center;padding-top: 5px;}
.weixin-icon { width: 20px; height: 17px; margin-top: 0px; margin-right: 5px; }
.xuetang-icon { width: 12px; height: 21px; margin-top: 0px; margin-right: 0px; }
.xueya-icon { width: 15px; height: 18px; margin-top: 0px; margin-right: 5px; }
.mb-icon-round{width: 40px;height: 40px;border-radius: 50%;text-align: center;line-height: 39px;font-size: 16px;}
.mb-icon-round.red{border: solid 1px #FF4c4c;color: #FF4c4c;}
.mb-icon-round.orange{border: solid 1px #FFc691;color: #FFc691;}
.mb-icon-round.green{border: solid 1px #06bf04;color: #06bf04;}
.mb-icon-flex{display: flex;display: -webkit-flex;justify-content: flex-end;-webkit-justify-content: flex-end;align-items: center;-webkit-align-items: center;}
#pati_list li{padding-right: 10px;padding-left: 10px}
.mb-yu{ width: 36px; height: 18px;margin-left: 5px;}
.checboxImg{display: flex;align-items: center}
.checboxImg img{width: 30px}
.bodybottom{position: absolute;
	height: 45px;
	bottom: 0;
	background: #fff;
	left: 0;
	height: 55px;
	right: 0;
	z-index: 99;
	display: flex;
	padding: 5px;
	justify-content: center;
	border-top: 1px solid #ccc;}
.bgc-17b3ec{background-color: #17b3ec;}

+ 106 - 0
html/hzzd/html/guidance_searchhuanzhe.html

@ -0,0 +1,106 @@
<!DOCTYPE html>
<html>
	<head>
		<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
		<meta charset="utf-8">
		<title>搜索医生居民</title>
		<link rel="stylesheet" type="text/css" href="../../../css/mui.min.css"/>
		<link rel="stylesheet" type="text/css" href="../../../common/cross/css/cross.css">
		<link rel="stylesheet" href="../../../common/cross/css/cross.ui.css" type="text/css" />
		<link rel="stylesheet" type="text/css" href="../../../common/css/jy-style.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/searchhuanzhe.css" type="text/css"/>
	</head>
	<body>
		<div class="c-main">
			<section style="position: fixed;top: 0px;left: 0px;width: 100%;z-index: 5;">
				<div class="lin-search-ipt" style="border-bottom: 1px solid #dcdcdc;">
					<div class="div-input">
						<input id="searchPut" placeholder="输入姓名搜索" class="f-fs12"/>
					</div>
					<a href="javascript:;" class="searchbar-cancel">取消</a>
				</div>
				
				<div id="search_suggest_text" class="c-dn"></div>
				
	        </section>
            <div class="search-his c-hide" id="history_search" style="position: absolute;top:45px;z-index:3;width: 100%;">
				<div class="title">
					<div class="his">历史搜索</div>
					<div id="clear_his_data" class="cler">清空</div>
				</div>
				<div id="his_scroll" class="mui-scroll-wrapper" style="top: 44px;">
            		<div class="mui-scroll">
						<ul class="his-list-ul" id="his_sear_list">
							
						</ul>
					</div>
				</div>
            </div>
           
			<div id="search_result" class="c-hide">
				<div id="jumin_wrapper" class="mui-scroll-wrapper" style="top: 50px;bottom: 55px">
	                <div class="mui-scroll">
						<ul id="pati_list" class="c-list">
							
						</ul>
					</div>
				</div>
			</div>
			<div  class="bodybottom">
				<div class="c-50 c-t-center pr10 display-none">
					<a class="c-btn c-f16 bgc-17b3ec c-btn-full c-btn-radius send_btn">立即发送</a>
				</div>
			</div>
			<div id="no_result_wrap" class="c-hide">
				<img class="no-result-img" src="../../../images/shujuweikong_img.png" />
				<div class="f-fs14 c-323232 c-t-center">抱歉,暂未找到符合条件的结果</div>
			</div>
		</div>
		<script type="text/html" id="pati_list_tmpl">
			{{each list as value j}}
			<li class="n-list-link list-arrow-r n-list-cover" data-patient-code="{{value.code}}" data-patient-phone="{{value.phone}}" data-patient-address="{{value.address}}">
				<div class="checboxImg" >
					<img src="../images/checbox-false.png"> 
				</div>
				<div class="patient-face patient-face-new">
					<img src="{{value.photo}}"> 
				</div>
				<div class="n-list-info">
					<h4 class="c-nowrap c-f16 mt5">{{value.name}}
						<em class="mb-em">({{value.sex | setSex}} {{value.age | setAge}}岁 )</em>
					</h4>
					<div class="mj-flex">
						{{if value.isWX}}
						<img class="weixin-icon" src="../../../images/weixing_icon2.png"/>
						{{else}}
						<img class="weixin-icon" src="../../../images/weixing_zihui_icon.png"/>
						{{/if}}
					</div>
				</div>
			</li>
			{{/each}}
		</script>
		
		<script type="text/html" id="his_list_tmpl">
			{{each list as v}}
				<li class="his-list">{{v}}</li>
			{{/each}}
		</script>
		<script type="text/javascript" src="../../../js/jquery/2.1.3/jquery.js"></script>
		<script type="text/javascript" src="../../../js/mui.min.js"></script>
		<script src="../../../widget/artDialog/6.0.5/js/dialog-plus.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="../../../js/es6-promise.js" type="text/javascript" charset="utf-8"></script>
		<script src="../../../js/underscore.js" type="text/javascript" charset="utf-8"></script>
		<script src="../../../js/common_http.js" type="text/javascript" charset="utf-8"></script>
		<script src="../../../js/template.js" type="text/javascript" charset="utf-8"></script>
		<script src="../../js/common.js" type="text/javascript" charset="utf-8"></script>
		<script src="../../../js/app.js" type="text/javascript" charset="utf-8"></script>
		<!--<script src="../../js/android.js" type="text/javascript" charset="utf-8"></script>-->
		<script src="../js/search-bar.js" type="text/javascript" charset="utf-8"></script>
		<script src="../../js/templateHelp.js" type="text/javascript" charset="utf-8"></script>
		<script src="../js/guidance_searchhuanzhe.js" type="text/javascript" charset="utf-8"></script>
	</body>
</html>

+ 14 - 5
html/hzzd/js/guidance_huanzhe.js

@ -192,6 +192,8 @@ bindEvents = function () {
				sendPost(url, params, null, function(res){
					if (res.status == 200) {
						mui.toast("发送成功!");
						var main =plus.webview.getWebviewById('guidance_list');
							mui.fire(main,'refresh');
						var self = plus.webview.currentWebview(),
							opener = self.opener(),
							pre_opener = self.opener().opener();
@ -290,11 +292,18 @@ bindEvents = function () {
	});
	
	$searchbarInput.on('tap',function() {
		mui.openWindow({
			id: "searchhuanzhe2",
			url: "../../huanzhe/html/searchhuanzhe.html",
			extras: {}
		})	
		openWebview('guidance_searchhuanzhe.html',{
			content: content,
			modelCode: modelCode,
			images: images
		});
		// mui.openWindow({
		// 	id: "searchhuanzhe2",
		// 	url: "../../huanzhe/html/searchhuanzhe.html?isIndex=true",
		// 	extras: {}
		// })	
	});
	
	$(".header-link").on('click', function(){

+ 501 - 0
html/hzzd/js/guidance_searchhuanzhe.js

@ -0,0 +1,501 @@
	// 基本信息(包括userAgent)
var baseInfo = null,
	// 基础环境信息(包括当前webview)
	baseEnv = null;
	
	// 搜索框
var $searchbar = $('.searchbar'),
	// 搜索输入框
	$searchbarInput = $('.lin-search-ipt input'),
	// 搜索取消按钮
	$searchCancelBtn = $('.searchbar-cancel'),
	// 搜索框下面悬浮的搜索提示
	$searchSuggest = $('#search_suggest_text'),
	// 搜索结果展示容器
	$searchtResult = $('#search_result'),
	// 搜索无结果时显示
	$noResultWrap = $('#no_result_wrap'),
	$patiList = $('#pati_list'),
	// 分页查询最后一页
	$history = $('#history_search'),//历史搜索
	$hisSearList = $('#his_sear_list');
var page = 0,
    search_keyword = "", //记录搜索框的内容
	lastTeamId,// 从缓存取出所选团队
	pagesize = 15,
	historyData=[],//历史数据
	historyStr,
	content,  //要发送的模板参数
	modelCode,
	images;
var self;
mui.plusReady(function() {
//	initKeyboardAndroid();
	docInfo = JSON.parse(plus.storage.getItem("docInfo"));
	historyStr = plus.storage.getItem("juminSearchHis"+docInfo.code);
	if(historyStr){
		historyStr = JSON.parse(historyStr).join(',');
		historyData = historyStr.split(',');
	}else{
		historyData = [];
	}
})
window.addEventListener("initSearch", function(e){
//	openSoftKeyboard();
	baseInfo = getBaseInfo();
	$("#searchAll").show();
	setTimeout(function(){
		$("#searchPut").focus();
	},100)
	if(historyData.length){
		$history.show();
	}
    lastTeamId = plus.storage.getItem("selectedTeamId");
})
// 获取登录相关信息
var getBaseInfo = function() {
		// 登录的相关信息
	var userAgent = JSON.parse(plus.storage.getItem("userAgent"))
	return {
		userAgent: userAgent
	}
},
// 获取基础环境信息
getBaseEnvPromise = function () {
	var env = {
		webview: plus.webview.currentWebview()
	}
	return Promise.resolve().then(function(res) {
		return env;
	})
},
historyList = function(){
	historyStr = plus.storage.getItem("juminSearchHis"+docInfo.code);
	if(historyStr){
		historyStr = JSON.parse(historyStr).join(',');
		historyData = historyStr.split(',');
	}else{
		historyData = [];
	}
	var html = template('his_list_tmpl',{list:historyData});
	$hisSearList.html('');
	$hisSearList.append(html);
},
// 初始化“患者”视图列表
initPatientViewList = function(data,keyword,isAppend) {
	data = _.map(data,function(item){
		item.photo = getImgUrl(item.photo);
		return item;
	})
	var html = template("pati_list_tmpl", {list: data});
	searchText = $searchbarInput.val().trim();
	if(isAppend == true){
		$patiList.append(html)
	}else{
		mui('#jumin_wrapper').pullRefresh().scrollTo(0,0)
		$patiList.empty().append(html)
		mui('#jumin_wrapper').pullRefresh().refresh(true);//重置
	}
	ellipsisText($patiList.find('li'),searchText);
},
// $el: $('.c-content-warp')
getRowProps = function ($el) {
	var $textEllipsis = $el,
		$text = $textEllipsis.eq(0),
		$chart = $text.text('a'),
		enWidth = $chart.width(),
		$chart = $text.text('中'),
		zhWidth = $chart.width(),
		lineHeight = parseFloat($chart.css("lineHeight"), 10),
		rowHeight = $chart.height();
	$chart.text('');
	return {
		chartWidth: {
			zh: zhWidth,
			en: enWidth
		},
		rowHeight: Math.max(rowHeight, lineHeight),
		rowWidth: $el.width()
	};
},
replaceAll = function (text, arr) {
	var html = text;
	_.each(arr,function(kw) {
		var reg = new RegExp(kw+"(?!>)","gi");
		html = html.replace(reg,'<em>'+kw+'</em>');
	});
	return html;
},
highlineKeyword = function ($el,searchText) {
	var props = getRowProps($el),
		chartWidth = props.chartWidth,
		rowHeight = props.rowHeight,
		rowWidth = props.rowWidth,
		// 每行显示字符数(以中文字符为标准计算)
		chartNum = Math.floor(rowWidth / chartWidth.zh),
		// 排除指定数量字符所占宽度
		exceptNum = 0,
		// 行数
		rowNum = 1,
		// 预计显示总字符数
		expectedNum = chartNum * rowNum - exceptNum,
		$target = $el,
		// 目标文本
		text = $.trim($target.attr('data-text')),
		length = text.length,
		// 关键字数组
		kws = $.trim(searchText).replace(/\s+/g," ").split(" ");
	var fidx = 0,preFidx,diff = 0;
	$target.html(replaceAll(text, kws));
	if(Math.floor($target.height() / rowHeight) <= rowNum) {
		return ;
	}
	if(text.length > expectedNum) {
		fidx = text.indexOf(kws[0])+kws[0].length-1;
		diff = fidx - expectedNum + 1;
		preFidx =  fidx;
		diff = (diff<0)?0:diff;
		var preChar = (diff>0)?"...":"";
		$target.html(preChar+replaceAll(text.slice(diff,preFidx+1), kws)+"...");
		while((Math.floor($target.height() / rowHeight) <= rowNum) && (preFidx < length)) {
			preFidx++;
			$target.html(preChar+replaceAll(text.slice(diff,preFidx+1), kws)+"...");
		}
		if(preFidx == length && (Math.floor($target.height() / rowHeight) <= rowNum)) {
			diff = diff>0?(diff - 1):0;
			$target.html(preChar+replaceAll(text.slice(diff,preFidx), kws));
		} else if((Math.floor($target.height() / rowHeight) > rowNum)) {
			$target.html(preChar+replaceAll(text.slice(diff,preFidx), kws)+"...");
		}
	}
},
ellipsisText = function ($elements, searchText) {
	_.each($elements,function(el) {
	    var $textEl = $(el).find(".j-text-ellipsis");
	    _.each($textEl, function(t){
	        highlineKeyword($(t),searchText)
	    })
	});
},
// 控制搜索关键字悬浮提示的显示
showSearchSuggest = function(text) {
	var suggestText = '搜索“'+text+'”';
	// 如果text不为空,则显示;否则隐藏
	if(text&&text.trim().length) {
		$searchSuggest.text(suggestText);
		$searchSuggest.show();
	} else {
		$searchSuggest.text('');
		$searchSuggest.hide();
	}
},
// 分页查询列表
searchByPaging = function (isAppend,fun) {
	$history.hide();
	$("#searchPut").blur();
	search_keyword = $searchbarInput.val();
	if(!$.trim(search_keyword)) {
		return ;
	}
	plus.nativeUI.showWaiting();
	var url = "/doctor/concern/getConcernPatients",
	 params = { page:page,pageSize:pagesize,patientName:search_keyword};
	getReqPromise(url,params, "GET").then(function(res){
 		if(res.status == 200) {
			if((page==0 && !res.data) || (page==0 && !res.data.length)) {
				$searchtResult.hide();
				$noResultWrap.show();
			} else {
				$noResultWrap.hide();
				$searchtResult.show();
				initPatientViewList(res.data,search_keyword,isAppend);
				if(res.data.length < pagesize){
					fun&&fun.call(this,true)
				}else{
					fun&&fun.call(this,false)
				}
			}
 		}else{
 			mui.toast("搜索失败");
 		}
 		plus.nativeUI.closeWaiting();
	}).catch(function(e) {
		plus.nativeUI.closeWaiting();
		console && console.error(e)
	})
},
// 绑定页面事件
bindEvents = function (){
	mui.init({
		pullRefresh : {
		    container:'#jumin_wrapper',
		    up : {
			    height:50,
			    contentinit: '',
				contentdown: '',
			    contentrefresh : "正在加载...",
			    contentnomore:'没有更多数据了',
			    callback: function() {
			    	var self = this;
			    	page++;
			    	searchByPaging(true,function(value){
			    		setTimeout(function(){
			    			self.endPullupToRefresh(value);
			    		},500)
			    	})
				}
		    }
		}
	})
	
	$('#his_scroll').css({
		'height':$(window).height()-158
	})
	mui('#his_scroll').scroll({
    	bounce: true, //是否启用回弹
   })
	
	$searchbarInput.on('input', function() {
		var text = $(this).val().trim();
		$searchtResult.hide();
		$('#no_result_wrap').hide();
		if(text.length > 0){
		    $("#searchAll").hide();
		    $history.hide();
		}else{
		    $("#searchAll").show();
		    $history.show();
		}
		showSearchSuggest(text);
	}).on('keydown',function(e) {
		if (e.which === 13) {
		    page = 0;
		    $searchSuggest.hide();
			searchByPaging(false);
			//保存历史数据20个
			saveHisData();
		}
	});
	
	$('#clear_his_data').on('tap', function(){
		plus.storage.removeItem("juminSearchHis"+docInfo.code);
		historyList();
		$history.hide();
	})
	
	$hisSearList.on('click','.his-list',function(){
		var $that = $(this);
		page = 0;
		$("#searchAll").hide();
	    $searchSuggest.hide();
	    $history.hide();
	    $searchbarInput.val($that.text())
		searchByPaging(false);
	})
	
	$('.lin-search-ipt a').on('tap', function(){
		plus.webview.currentWebview().hide();
		mui.later(function(){
			$('#search_result').hide();
			$('#no_result_wrap').hide();
			$('#searchPut').val("");
			$("#search_suggest_text").html("").hide();
			$("#searchPut").blur();
		}, 50)
	})
	
	$searchSuggest.on('click',function() {
	    page = 0;
		$searchSuggest.hide();
		searchByPaging(false);
		
		//保存历史数据20个
		saveHisData()
	});
	var acTiveId='activeId';//选中的ID
	$patiList.on('tap','li[data-patient-code]',function(e) {
		var code = $(this).attr("data-patient-code");
		var mobile = $(this).attr("data-patient-phone");
		var address = $(this).attr("data-patient-address");
		var isCheck = $(this).attr("check");
		var id = $(this).attr('id');
		if(id != acTiveId ){ //如果点击的不是之前选中的 
			$('#'+acTiveId).find('.checboxImg').find('img').attr('src','../images/checbox-false.png');	
			$('#'+acTiveId).removeAttr('id');
			$(this).find('.checboxImg').find('img').attr('src','../images/checbox-true.png');
			$(this).attr('check','yes');
			$(this).attr('id',acTiveId);
		}
		else {   //如果点击的是自己的话
			if(isCheck == 'no'){
				$(this).find('.checboxImg').find('img').attr('src','../images/checbox-true.png');
				$(this).attr('check','yes');
			}
			else {
				$(this).find('.checboxImg').find('img').attr('src','../images/checbox-false.png');
				$(this).attr('check','no');
				$(this).removeAttr('id',acTiveId);
			}
		}
	
		// if(baseEnv.webview.origin=="suifang") {//“随访”功能
		// 	if(baseEnv.webview.follow_type == 1){
	    //         openWebview("../../suifang/html/add_plan.html",{patientInfo: {code:code,mobile:mobile,address:address},chooseDate:baseEnv.webview.chooseDate});
	    //         return false;
	    //     }
	    //     if(baseEnv.webview.follow_type == 2){
	    //         openWebview("../../suifang/html/follow_way.html",{patientInfo: {code:code,mobile:mobile,address:address}});
	    //         return false;
	    //     }
		// }else{
		// 	openWebview("../../huanzhe/html/huanzhexinxi.html",{
		// 		patiCode: code
		// 	});
		// }
		return false;
	})
	
	$(".send_btn").on('tap', function(){
		var	patiCode =$('#'+acTiveId).attr('data-patient-code');
		if(!patiCode) {mui.toast("请选择居民再进行发送");return};
		dialog({
			content: "发出后无法变更,是否确认发送给居民?",
			okValue: "继续发送",
			ok: function(){
				var url = "doctor/health/guidance/add",
					params = {
						patient: patiCode,
						content: content,
						modelCode: modelCode,
						images: images
					};
					console.log(params)
				plus.nativeUI.showWaiting();
				sendPost(url, params, null, function(res){
					if (res.status == 200) {
						mui.toast("发送成功!");
						var main =plus.webview.getWebviewById('guidance_list');
						mui.fire(main,'refresh');
						var self = plus.webview.currentWebview(),
							opener = self.opener(),
							pre_opener = self.opener().opener();
						if(opener.id == "jkzd"){ //自己的模板详情
							if(pre_opener.id == "guidance_info"){
								mui.fire(pre_opener.opener(), "update");
								pre_opener.opener().show();
								mui.later(function(){
									pre_opener.close('none');
									opener.close('none');
									self.close('none');
								}, 300);
							}else{
								mui.fire(pre_opener, "update");
								pre_opener.show();
								mui.later(function(){
									opener.close('none');
									self.close('none');
								}, 300);
							}
						}else{ //系统模板详情
							var pre_pre_opener = pre_opener.opener();
							if(pre_pre_opener.id == "guidance_info"){
								mui.fire(pre_pre_opener.opener(), "update");
								pre_pre_opener.opener().show();
								mui.later(function(){
									pre_pre_opener.close('none');
									opener.close('none');
									pre_opener.close('none');
									self.close('none');
								}, 300);
							}else{
								mui.fire(pre_pre_opener, "update");
								pre_pre_opener.show();
								mui.later(function(){
									opener.close('none');
									pre_opener.close('none');
									self.close('none');
								}, 300);
							}
							
						}
					}else{
						mui.toast(res.msg)
					}
					plus.nativeUI.closeWaiting();
				}, 'POST', '', true);
			},
			cancelValue: "不了,谢谢",
			cancel: function(){}
		}).showModal();
	});
	function saveHisData(){
		//保存历史数据20个
		var value = $searchbarInput.val().trim();
		if(value){
			if(historyData.length>19){
				historyData.pop();
			}
			if(historyData.indexOf(value)>-1){
				historyData =  _.filter(historyData, function(o){ return o != value; });
			}
			historyData.unshift(value);
			var str = JSON.stringify(historyData)
			plus.storage.setItem("juminSearchHis"+docInfo.code,str);
			historyList();
		}
	}
	
	$searchCancelBtn.on('click',function() {
		mui.back()
	})
	
	//搜索全部居民的绑定事件
	$("#searchAll").on('click', function(){
	    openWebview("search_all.html");
	});
};
// 页面业务处理流程开始
new Promise(function(resolve, reject) {
	mui.plusReady(function() {
		resolve(true);
	})
}).then(function() {
	// 获取基础环境信息
	return getBaseEnvPromise().then(function(env) {
		baseEnv = env;
	}).then(function() {
		// 获取登录基本信息
		baseInfo = getBaseInfo();
		lastTeamId = plus.storage.getItem("selectedTeamId");
		self = plus.webview.currentWebview();
		content =self.content;
		modelCode =self.modelCode;
		images =self.images;
		$searchbar.searchBar();
//		openSoftKeyboard();
		$searchbarInput.focus();
		historyList();
		if(historyData.length){
			$history.show();
		}
		// 绑定页面事件
		bindEvents();
	})
}).catch(function(e) {
	plus.nativeUI.closeWaiting();
	console && console.error(e);
});

+ 21 - 0
html/hzzd/js/search-bar.js

@ -0,0 +1,21 @@
$.fn.searchBar = function() {
	var $input = this.find('input[type=search]'),
	$cancelBtn = this.find('a.searchbar-cancel'),
	$ele = this;
	$input.off('click.searchinput').on('click.searchinput',function() {
		$ele.addClass('searchbar-active');
		$cancelBtn.css({
			display: 'block',
			'margin-right': 0
		});
	});
	$cancelBtn.off('click.searchbtn').on('click.searchbtn',function() {
		$ele.removeClass('searchbar-active');
		$cancelBtn.css({
			'margin-right': (function(){
				return -$cancelBtn[0].offsetWidth + 'px'
			})()
		})
	});
}