Quellcode durchsuchen

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

luyanan vor 8 Jahren
Ursprung
Commit
f008d9b982
1 geänderte Dateien mit 45 neuen und 31 gelöschten Zeilen
  1. 45 31
      src/main/webapp/search.html

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

@ -19,17 +19,7 @@
19 19
<script src="js/jquery.page.js"></script>
20 20
<script type="text/javascript" src="js/jquery.similar.msgbox.js"></script>
21 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 24
	$(function(){
35 25
		/*loginStatus();*/
@ -48,7 +38,7 @@ $.get("/ajax/org/qa",function($da) {
48 38

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

52 42
 		var getData = function (key,subject,industry,pageSize,pageNo,isbind){
53 43
 			$("#professorList").html("");
54 44
			$.ajax({"url" : "/ajax/professor/pq",
@ -56,12 +46,13 @@ $.get("/ajax/org/qa",function($da) {
56 46
						"data" : {"key":key,"subject":subject,"industry":industry,"pageSize":pageSize,"pageNo":pageNo},
57 47
						"contentType" : "application/x-www-form-urlencoded",
58 48
						"success" : function($data) {
49
							
59 50
							if ($data.success) {
60 51
								for(var i = 0 ; i < $data.data.data.length ; i++){
61 52
									//创建HTML标签  
62 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 58
									dataHtml += "<div class='synopsis'>";
@ -79,16 +70,7 @@ $.get("/ajax/org/qa",function($da) {
79 70
										dataHtml += $data.data.data[i].department;
80 71
									}
81 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 74
									dataHtml += "</div>";
93 75
									dataHtml += "<div class='science'>";
94 76
									if(typeof($data.data.data[i].subject) !== "undefined"){
@ -99,6 +81,10 @@ $.get("/ajax/org/qa",function($da) {
99 81
									if(typeof($data.data.data[i].industry) !== "undefined"){
100 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 88
									dataHtml += "</div>";
103 89
									dataHtml += "</div>";	
104 90

@ -118,7 +104,7 @@ $.get("/ajax/org/qa",function($da) {
118 104
									{
119 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,27 +167,55 @@ $.get("/ajax/org/qa",function($da) {
181 167
    			}
182 168
    		})
183 169
 		}
184

170
		var  subject;
171
		var key;
172
		var industry;
173
		var pageSize;
185 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 179
			getData(key,subject,industry,pageSize,1,true);
191 180
		}
192 181
		$("#search").on("click",function(){
193 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 187
			findProfessor();
195 188
		})
196 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 195
			findProfessor();
199 196
		})
200 197

201 198
		subjectList();
202 199
 		industryList();
203 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 221
</script>