Browse Source

1、关键字搜索 2、增加地址字段 3、解决机构名称时显时不显问题

luyanan 8 years ago
parent
commit
f008d9b982
1 changed files with 45 additions and 31 deletions
  1. 45 31
      src/main/webapp/search.html

+ 45 - 31
src/main/webapp/search.html

19
<script src="js/jquery.page.js"></script>
19
<script src="js/jquery.page.js"></script>
20
<script type="text/javascript" src="js/jquery.similar.msgbox.js"></script>
20
<script type="text/javascript" src="js/jquery.similar.msgbox.js"></script>
21
<script type="text/javascript">
21
<script type="text/javascript">
22
var arr=[];
23
var arr1=[];
24
$.get("/ajax/org/qa",function($da) {
25
	    			if ($da.success) {
26
						var $info = $da.data;
27
						for(var i=0;i<$info.length;i++){
28
							arr.push($info[i].name);
29
							arr1.push($info[i].id);
30
						}
31
					}
32
	    });
22

33
						
23
						
34
	$(function(){
24
	$(function(){
35
		/*loginStatus();*/
25
		/*loginStatus();*/
48

38

49
		$("#searchContent").val(GetQueryString("searchContent")); 
39
		$("#searchContent").val(GetQueryString("searchContent")); 
50
		$("#hsearchContent").val(GetQueryString("searchContent")); 
40
		$("#hsearchContent").val(GetQueryString("searchContent")); 
51
		var servPath = "http://121.42.53.174:80";
41

52
 		var getData = function (key,subject,industry,pageSize,pageNo,isbind){
42
 		var getData = function (key,subject,industry,pageSize,pageNo,isbind){
53
 			$("#professorList").html("");
43
 			$("#professorList").html("");
54
			$.ajax({"url" : "/ajax/professor/pq",
44
			$.ajax({"url" : "/ajax/professor/pq",
56
						"data" : {"key":key,"subject":subject,"industry":industry,"pageSize":pageSize,"pageNo":pageNo},
46
						"data" : {"key":key,"subject":subject,"industry":industry,"pageSize":pageSize,"pageNo":pageNo},
57
						"contentType" : "application/x-www-form-urlencoded",
47
						"contentType" : "application/x-www-form-urlencoded",
58
						"success" : function($data) {
48
						"success" : function($data) {
49
							
59
							if ($data.success) {
50
							if ($data.success) {
60
								for(var i = 0 ; i < $data.data.data.length ; i++){
51
								for(var i = 0 ; i < $data.data.data.length ; i++){
61
									//创建HTML标签  
52
									//创建HTML标签  
62
									var dataHtml = "<div class='item'>";
53
									var dataHtml = "<div class='item'>";
63
									
54
									
64
									dataHtml += "<a  id='infoi'  href='information-brow.html?professorId="+$data.data.data[i].id+"' ><div class='photo1'><img class='images' style='width:100%;'  src='"+servPath+"/images/head/"+$data.data.data[i].id+"_l.jpg'/></div></a>";
55
									dataHtml += "<a  class='infoi'  href='information-brow.html?professorId="+$data.data.data[i].id+"' ><div class='photo1'><img class='images' style='width:100%;'  src='"+servPath+"/images/head/"+$data.data.data[i].id+"_l.jpg'/></div></a>";
65

56

66

57

67
									dataHtml += "<div class='synopsis'>";
58
									dataHtml += "<div class='synopsis'>";
79
										dataHtml += $data.data.data[i].department;
70
										dataHtml += $data.data.data[i].department;
80
									}
71
									}
81
									dataHtml += ",";
72
									dataHtml += ",";
82
									if(typeof($data.data.data[i].orgId) !== "undefined"){
83
										for(var j=0;j<arr1.length;j++){
84
											if($data.data.data[i].orgId==arr1[j]){
85
												$data.data.data[i].orgId=arr[j];
86
												dataHtml += $data.data.data[i].orgId;
87
											}
88
										}
89
										
90
										
91
									}
73
									dataHtml += $data.data.data[i].organization.name;
92
									dataHtml += "</div>";
74
									dataHtml += "</div>";
93
									dataHtml += "<div class='science'>";
75
									dataHtml += "<div class='science'>";
94
									if(typeof($data.data.data[i].subject) !== "undefined"){
76
									if(typeof($data.data.data[i].subject) !== "undefined"){
99
									if(typeof($data.data.data[i].industry) !== "undefined"){
81
									if(typeof($data.data.data[i].industry) !== "undefined"){
100
										dataHtml += $data.data.data[i].industry;
82
										dataHtml += $data.data.data[i].industry;
101
									}
83
									}
84
									if(typeof($data.data.data[i].address) !== "undefined"){
85
										dataHtml +=	"<p>"+$data.data.data[i].address+"</p>";
86
									}
87
						
102
									dataHtml += "</div>";
88
									dataHtml += "</div>";
103
									dataHtml += "</div>";	
89
									dataHtml += "</div>";	
104

90

118
									{
104
									{
119
										if(userid==$data.data.data[i].id)
105
										if(userid==$data.data.data[i].id)
120
										{
106
										{
121
											$("#infoi").attr("href","information.html");	
107
											$(".infoi").attr("href","information.html");	
122
										}										
108
										}										
123
									})
109
									})
124
									}
110
									}
181
    			}
167
    			}
182
    		})
168
    		})
183
 		}
169
 		}
184

170
		var  subject;
171
		var key;
172
		var industry;
173
		var pageSize;
185
		var findProfessor = function (){
174
		var findProfessor = function (){
186
			var key = $("#searchContent").val();
187
			var subject = $("#subject .colorbg")[0].title;
188
			var industry = $("#industry .colorbg")[0].title;
189
			var pageSize = 4;
175
			key = $("#searchContent").val();
176
			subject = $("#subject .colorbg")[0].title;
177
			industry = $("#industry .colorbg")[0].title;
178
			pageSize = 4;
190
			getData(key,subject,industry,pageSize,1,true);
179
			getData(key,subject,industry,pageSize,1,true);
191
		}
180
		}
192
		$("#search").on("click",function(){
181
		$("#search").on("click",function(){
193
			$("#hsearchContent").val($("#searchContent").val());  
182
			$("#hsearchContent").val($("#searchContent").val());  
183
			$("#professorList").remove();
184
			$(".about").append('<div class="about-in" id="professorList"></div>')
185
			$(".tcdPageCode").remove();
186
			$(".about").append('<div class="tcdPageCode"></div>');
194
			findProfessor();
187
			findProfessor();
195
		})
188
		})
196
		$("#hsearch").on("click",function(){
189
		$("#hsearch").on("click",function(){
197
			$("#searchContent").val($("#hsearchContent").val());  
190
			$("#searchContent").val($("#hsearchContent").val()); 
191
			$("#professorList").remove();
192
			$(".about").append('<div class="about-in" id="professorList"></div>')
193
			$(".tcdPageCode").remove();
194
			$(".about").append('<div class="tcdPageCode"></div>');
198
			findProfessor();
195
			findProfessor();
199
		})
196
		})
200

197

201
		subjectList();
198
		subjectList();
202
 		industryList();
199
 		industryList();
203
		findProfessor();
200
		findProfessor();
204
		
201
		$(".class1").eq(0).on("click","a",function (){
202
			$(this).addClass("colorbg").siblings().removeClass("colorbg");
203
			subject = $(this).attr('title');	
204
			$("#professorList").remove();
205
			$(".about").append('<div class="about-in" id="professorList"></div>')
206
			$(".tcdPageCode").remove();
207
			$(".about").append('<div class="tcdPageCode"></div>');
208
			findProfessor();
209
		});	
210
		$(".class1").eq(1).on("click","a",function (){
211
			$(this).addClass("colorbg").siblings().removeClass("colorbg");
212
			industry = $(this).attr('title');	
213
			$("#professorList").remove();
214
			$(".about").append('<div class="about-in" id="professorList"></div>')
215
			$(".tcdPageCode").remove();
216
			$(".about").append('<div class="tcdPageCode"></div>');
217
			findProfessor();		
218
    });		
205
    });
219
    });
206

220

207
</script>
221
</script>