Parcourir la Source

搜索列表中,若为本人或本人发布的资源,则隐藏咨询按钮,点击进入后隐藏点赞按钮、咨询按钮。

jack 8 ans auparavant
Parent
commit
b083d65e60
2 fichiers modifiés avec 638 ajouts et 653 suppressions
  1. 6 0
      js/information.brow.js
  2. 632 653
      js/search.js

+ 6 - 0
js/information.brow.js

@ -3,6 +3,9 @@ loginStatus();//读取用户头像
3 3
	 	var userid = $.cookie("userid");
4 4
	 	var professorId = GetQueryString("professorId");
5 5
	 	var name;
6
	 	if(userid==professorId){
7
	 		$("span:contains('咨询')").hide();
8
	 	}
6 9
	 	if(professorId){
7 10
8 11
	 		var subjectShow = function (data){
@ -207,10 +210,13 @@ loginStatus();//读取用户头像
207 210
							if(userid == $photos[j].id)
208 211
								isAgree++;
209 212
						}
213
						if(professorId != userid){
210 214
						if(isAgree) {
211 215
							var showDiv = "<div class='listbox listbox-browse clear'><div class='list-browse'><span class='like'>" + $data.count + "</span>" + $data.caption + "</div><span class='plus ' data-pid='" + $data.professorId + "' data-caption='" + $data.caption + "' data-isagree='" + isAgree + "' ></span><div class='like-num'>";
212 216
						} else {
213 217
							var showDiv = "<div class='listbox listbox-browse clear'><div class='list-browse'><span class='like'>" + $data.count + "</span>" + $data.caption + "</div><span class='plus' style=' background-position-y:-26px' data-pid='" + $data.professorId + "' data-caption='" + $data.caption + "' data-isagree='" + isAgree + "' ></span><div class='like-num'>";
218
						}}else{
219
							var showDiv = "<div class='listbox listbox-browse clear'><div class='list-browse'><span class='like'>" + $data.count + "</span>" + $data.caption + "</div><div class='like-num'>";
214 220
						}
215 221
						if($photos.length < 6) {
216 222
							for(var j = 0; j < $photos.length; ++j) {

+ 632 - 653
js/search.js

@ -1,7 +1,7 @@
1
$(function(){
1
$(function() {
2 2
	var userid = $.cookie("userid");
3
	if (userid && userid != "null" && userid != null) {
4
		$(".myWorkspace").attr("href","workspaces.html?"+userid);
3
	if(userid && userid != "null" && userid != null) {
4
		$(".myWorkspace").attr("href", "workspaces.html?" + userid);
5 5
		loginStatus();
6 6
	}
7 7
@ -12,8 +12,8 @@ $(function(){
12 12
		$(".personal-infor").stop(true, false).slideUp(500);
13 13
	});
14 14
	$(document).scroll(function() {
15
		var top = $(document).scrollTop();		
16
		if (top != 0) {
15
		var top = $(document).scrollTop();
16
		if(top != 0) {
17 17
			$(".searchbox").fadeIn(1000);
18 18
19 19
		} else {
@ -21,7 +21,7 @@ $(function(){
21 21
		}
22 22
	});
23 23
	var newc = GetQueryString("lookFor");
24
	if (newc == 0 || newc == "") {
24
	if(newc == 0 || newc == "") {
25 25
		var c = 0;
26 26
	} else {
27 27
		var c = 1;
@ -50,312 +50,293 @@ $(function(){
50 50
	$("#hsearchContent").val(GetQueryString("searchContent"));
51 51
	var key = $("#searchContent").val();
52 52
	var getData = function(key, subject, industry, pageSize, pageNo, isbind,
53
			add) {
54
		if (c == 0) {
53
		add) {
54
		if(c == 0) {
55 55
			$
56
					.ajax({
57
						"url" : "/ajax/professor/pqBaseInfo",
58
						"type" : "GET",
59
						"data" : {
60
							"key" : key,
61
							"subject" : subject,
62
							"industry" : industry,
63
							"pageSize" : pageSize,
64
							"pageNo" : pageNo,
65
							"address" : add
66
						},
67
						"contentType" : "application/x-www-form-urlencoded",
68
						"success" : function($data) {
69
							if ($data.success) {
70
								// console.log($data);
71
								$("#professorList").html("");
72
								for (var i = 0; i < $data.data.data.length; i++) {
73
									// 创建HTML标签
74
									var dataHtml = "<div class='item'>";
75
									dataHtml += "<a  class='infoi'  href='information-brow.html?professorId="
76
											+ $data.data.data[i].id
77
											+ "' ><div class='photo1 headRadius'>"
78
									if ($data.data.data[i].hasHeadImage) {
79
										dataHtml += "<img class='images' style='width:100%;'  src='/images/head/"
80
												+ $data.data.data[i].id
81
												+ "_l.jpg'/></div></a>";
82
									} else {
83
										dataHtml += "<img class='images' style='width:100%;'  src='/images/default-photo.jpg'/></div></a>";
84
									}
85
									dataHtml += "<div class='synopsis'>";
86
									dataHtml += "<a href='javascript:void();' class='named'>";
87
									if (typeof ($data.data.data[i].name) !== "undefined") {
88
										dataHtml += $data.data.data[i].name;
89
									}
90
									dataHtml += "</a><a href='information-brow.html?professorId="
91
											+ $data.data.data[i].id
92
											+ "' class='modify'></a>";
93
									dataHtml += "<div class='position'>";
94
									if ($data.data.data[i].office) {
95
										dataHtml += $data.data.data[i].office
96
												+ ", ";
97
									}
98
									if ($data.data.data[i].title) {
99
										dataHtml += $data.data.data[i].title
100
												+ ", ";
101
									}
102
									if ($data.data.data[i].department) {
103
										dataHtml += $data.data.data[i].department
104
												+ ", ";
105
									}
106
									if ($data.data.data[i].orgName) {
107
										dataHtml += $data.data.data[i].orgName;
108
									}
109
									if ($data.data.data[i].address) {
110
										dataHtml += " | "
111
												+ $data.data.data[i].address;
112
									}
113
									dataHtml += "</div>";
114
									dataHtml += "<div class='ellipsisbox science'>";
115
									if (typeof ($data.data.data[i].subject) !== "undefined") {
116
										dataHtml += "<p>学术领域:"
117
												+ $data.data.data[i].subject
118
												+ "</p>";
119
									}
120
									dataHtml += "</div>";
121
									dataHtml += "<div class='ellipsisbox industry'>";
122
									if (typeof ($data.data.data[i].industry) !== "undefined") {
123
										dataHtml += "<p>应用行业:"
124
												+ $data.data.data[i].industry
125
												+ "</p>";
126
									}
127
									if ($data.data.data[i].researchAreas.length) {
128
										dataHtml += "<p>研究方向:"
129
												+ $data.data.data[i].researchAreas[0].caption
130
												+ "</p>";
131
										// console.log($data.data.data[i].researchAreas[0].caption);
132
									}
56
				.ajax({
57
					"url": "/ajax/professor/pqBaseInfo",
58
					"type": "GET",
59
					"data": {
60
						"key": key,
61
						"subject": subject,
62
						"industry": industry,
63
						"pageSize": pageSize,
64
						"pageNo": pageNo,
65
						"address": add
66
					},
67
					"contentType": "application/x-www-form-urlencoded",
68
					"success": function($data) {
69
						if($data.success) {
70
							// console.log($data);
71
							$("#professorList").html("");
72
							for(var i = 0; i < $data.data.data.length; i++) {
73
								// 创建HTML标签
74
								var dataHtml = "<div class='item'>";
75
								dataHtml += "<a  class='infoi'  href='information-brow.html?professorId=" +
76
									$data.data.data[i].id +
77
									"' ><div class='photo1 headRadius'>"
78
								if($data.data.data[i].hasHeadImage) {
79
									dataHtml += "<img class='images' style='width:100%;'  src='/images/head/" +
80
										$data.data.data[i].id +
81
										"_l.jpg'/></div></a>";
82
								} else {
83
									dataHtml += "<img class='images' style='width:100%;'  src='/images/default-photo.jpg'/></div></a>";
84
								}
85
								dataHtml += "<div class='synopsis'>";
86
								dataHtml += "<a href='javascript:void();' class='named'>";
87
								if(typeof($data.data.data[i].name) !== "undefined") {
88
									dataHtml += $data.data.data[i].name;
89
								}
90
								dataHtml += "</a><a href='information-brow.html?professorId=" +
91
									$data.data.data[i].id +
92
									"' class='modify'></a>";
93
								dataHtml += "<div class='position'>";
94
								if($data.data.data[i].office) {
95
									dataHtml += $data.data.data[i].office +
96
										", ";
97
								}
98
								if($data.data.data[i].title) {
99
									dataHtml += $data.data.data[i].title +
100
										", ";
101
								}
102
								if($data.data.data[i].department) {
103
									dataHtml += $data.data.data[i].department +
104
										", ";
105
								}
106
								if($data.data.data[i].orgName) {
107
									dataHtml += $data.data.data[i].orgName;
108
								}
109
								if($data.data.data[i].address) {
110
									dataHtml += " | " +
111
										$data.data.data[i].address;
112
								}
113
								dataHtml += "</div>";
114
								dataHtml += "<div class='ellipsisbox science'>";
115
								if(typeof($data.data.data[i].subject) !== "undefined") {
116
									dataHtml += "<p>学术领域:" +
117
										$data.data.data[i].subject +
118
										"</p>";
119
								}
120
								dataHtml += "</div>";
121
								dataHtml += "<div class='ellipsisbox industry'>";
122
								if(typeof($data.data.data[i].industry) !== "undefined") {
123
									dataHtml += "<p>应用行业:" +
124
										$data.data.data[i].industry +
125
										"</p>";
126
								}
127
								if($data.data.data[i].researchAreas.length) {
128
									dataHtml += "<p>研究方向:" +
129
										$data.data.data[i].researchAreas[0].caption +
130
										"</p>";
131
									// console.log($data.data.data[i].researchAreas[0].caption);
132
								}
133 133
134
									dataHtml += "</div>";
135
									dataHtml += "</div>";
136
									if ($data.data.data[i].id != userid) {
137
										dataHtml += "<div class='operbox'><span class='operbtn onlyConsultbtn' id='"
138
												+ $data.data.data[i]['id']
139
												+ "'>咨询</span></div>";
140
									}
141
										
142
											
143
									$("#professorList").append(dataHtml);
144
									var photoHeight=$(".photo1").eq(i).height();
145
									var middleHeight=$(".synopsis").eq(i).height();									
146
									if(middleHeight<photoHeight) {										
147
										$(".synopsis").eq(i).height(photoHeight);
148
									}
149
									if($data.data.data[i].authType) {
150
										$(".modify").eq(i).addClass("authicon authicon-cu");								
151
									} else {
152
										if($data.data.data[i].authStatus) {
153
											if($data.data.data[i].authentication == 1) {
154
												$(".modify").eq(i).addClass("authicon2 authicon-mana");
155
												//$(".modify").eq(i).html("<span>科研</span>");										
156
											} else if($data.data.data[i].authentication == 2) {
157
												$(".modify").eq(i).addClass("authicon2 authicon-staff");
158
												//$(".modify").eq(i).html("<span>企业</span>");										
159
											} else {
160
												$(".modify").eq(i).addClass("authicon2 authicon-stu");
161
												//$(".modify").eq(i).html("<span>学生</span>");										
162
											}
134
								dataHtml += "</div>";
135
								dataHtml += "</div>";
136
								if($data.data.data[i].id != userid) {
137
									dataHtml += "<div class='operbox'><span class='operbtn onlyConsultbtn' id='" +
138
										$data.data.data[i]['id'] +
139
										"'>咨询</span></div>";
140
								}
141
								var $datahtml = $(dataHtml);
142
								$("#professorList").append(dataHtml);
143
								var photoHeight = $(".photo1").eq(i).height();
144
								var middleHeight = $(".synopsis").eq(i).height();
145
								if(middleHeight < photoHeight) {
146
									$(".synopsis").eq(i).height(photoHeight);
147
								}
148
								if($data.data.data[i].authType) {
149
									$(".modify").eq(i).addClass("authicon authicon-cu");
150
								} else {
151
									if($data.data.data[i].authStatus) {
152
										if($data.data.data[i].authentication == 1) {
153
											$(".modify").eq(i).addClass("authicon2 authicon-mana");
154
											//$(".modify").eq(i).html("<span>科研</span>");										
155
										} else if($data.data.data[i].authentication == 2) {
156
											$(".modify").eq(i).addClass("authicon2 authicon-staff");
157
											//$(".modify").eq(i).html("<span>企业</span>");										
158
										} else {
159
											$(".modify").eq(i).addClass("authicon2 authicon-stu");
160
											//$(".modify").eq(i).html("<span>学生</span>");										
163 161
										}
164
									}						
165
									// 点击查看当前信息
166
									(function(i) {
167
										$('.photo1')
168
												.click(
169
														function() {
170
															if (userid == $data.data.data[i].id) {
171
																$(".infoi")
172
																		.attr(
173
																				"href",
174
																				"information.html");
175
															}
176
														})
177 162
									}
178
179
									)(i);
180
									// 点击查看当前信息
181
									(function(i) {
163
								}
164
								// 点击查看当前信息
165
								(function(i) {
182 166
										$('.synopsis')
183
												.eq(i)
184
												.click(
185
														function() {
186
															if (userid == $data.data.data[i].id) {
187
																location.href = 'information.html';
188
															} else {
189
																location.href = 'information-brow.html?professorId='
190
																		+ $data.data.data[i].id;
191
															}
192
193
														})
167
											.eq(i)
168
											.click(
169
												function() {
170
													location.href = 'information-brow.html?professorId=' +
171
														$data.data.data[i].id;
172
												})
194 173
									}
195 174
196
									)(i);
175
								)(i);
197 176
198 177
							}
199 178
							//找专家点击咨询
200
							$(".onlyConsultbtn").bind("click",clickSeachProConsultHandler);
201
							
202
							if(isbind == true){
179
							$(".onlyConsultbtn").bind("click", clickSeachProConsultHandler);
180
181
							if(isbind == true) {
203 182
								$(".tcdPageCode").createPage({
204
							        pageCount:Math.ceil($data.data.total/pageSize),
205
							        current:$data.data.pageNo,
206
							        backFn:function(p){
207
							        	getData(key,subject,industry,pageSize,p,false);
208
							        }
209
							    });
183
									pageCount: Math.ceil($data.data.total / pageSize),
184
									current: $data.data.pageNo,
185
									backFn: function(p) {
186
										getData(key, subject, industry, pageSize, p, false);
187
									}
188
								});
210 189
							}
211
							
190
212 191
						} else {
213
							$.MsgBox.Alert("message",$data.msg);
192
							$.MsgBox.Alert("message", $data.msg);
214 193
						}
215 194
					}
216 195
				});
217
 			}
218
 			else
219
 			{
220
 				//查询我的所有资源
221
 				$.ajax({
222
 					"url" :"/ajax/resource/pq",
223
 					"type" : "get",	
224
 					"data" : {"key":key,"subject":subject,"industry":industry,"pageSize":pageSize,"pageNo":pageNo,"address":add},
225
 					"contentType" : "application/x-www-form-urlencoded",
226
 					"success" : function(data) 
227
 					{console.log(data);
228
 						if (data.success) 
229
 						{
230
 							$("#professorList").html("");	
231
 							var $da=data.data.data;
232
 							for(var i=0;i<$da.length;i++)
233
 							{
234
 								var add='<div class="item"><div class="remess" resourceId='+$da[i].resourceId+'>'
235
 			                    add+='<a class="resourcephoto headRadius" ><img src="" class="resourceImg" width="100%" height="100%" ></a>'
236
 			                    add+='<div class="synopsis" style="width:66%;">' 			                  
237
 			                     add+='<div class="cousultName"><a class="resouname" href="javascript:void();">'+$da[i].resourceName+'</a></div>'
238
 			                     if($da[i].professor.name){
239
 			                    	 add+='<div class="belongname"><a style="float:left;display:block;">'+$da[i].professor.name+'</a><a class="modicon" style="display:block;top:4px;left:2px;"></a></div>'  
240
 			                    		  } 			                   
241
 			                   if($da[i].professor.title==undefined){
242
 			                	  $da[i].professor.title="";
243
 			                   }
244
 			                  if($da[i].professor.department==undefined){
245
 			                	 $da[i].professor.department="";
246
 			                   }
247
 			                 if($da[i].professor.orgName==undefined){
248
 			                	$da[i].professor.orgName="";
249
			                   }
250
 			                add+='<div style="clear:both"></div><div class="positionbox">'
251
 			                	if($da[i].professor.title&&$da[i].professor.department&&$da[i].professor.orgName){
252
 			                		add+=$da[i].professor.title+","+$da[i].professor.department+","+$da[i].professor.orgName;
253
 			                	}else if(!$da[i].professor.title&&$da[i].professor.department&&$da[i].professor.orgName){
254
 			                		add+=$da[i].professor.department+","+$da[i].professor.orgName;
255
 			                	}else if($da[i].professor.title&&!$da[i].professor.department&&$da[i].professor.orgName){
256
 			                		add+=$da[i].professor.title+","+$da[i].professor.orgName;
257
 			                	}else if($da[i].professor.title&&$da[i].professor.department&&!$da[i].professor.orgName){
258
 			                		add+=$da[i].professor.title+","+$da[i].professor.department;
259
 			                	}else if(!$da[i].professor.title&&!$da[i].professor.department&&$da[i].professor.orgName){
260
 			                		add+=$da[i].professor.orgName
261
 			                	}else if(!$da[i].professor.title&&$da[i].professor.department&&!$da[i].professor.orgName){
262
 			                		add+=$da[i].professor.department
263
 			                	}else if($da[i].professor.title&&!$da[i].professor.department&&!$da[i].professor.orgName){
264
 			                		add+=$da[i].professor.title
265
 			                	}			                	
266
 			                	add+='</div>'
267
 			                    if($da[i].subject)
268
 			                    {
269
 			                    	add+='<div class="ellipsisbox sciencebox"><p>学术领域:'+$da[i].subject+'</p></div>'
270
 			    				}	
271
 								if($da[i].industry)
272
 								{
273
 									add+='<div class="ellipsisbox industrybox"><p>应用行业:'+$da[i].industry+'</p></div>'
274
 								}	
275
 								if($da[i].supportedServices)
276
 								{
277
 									 add+='<div class="ellipsisbox provideservice"><p>应用用途:'+$da[i].supportedServices+'</p></div></div>' 
278
 								}	                                              
279
 			                    add+='<div class="operbox"><span class="operbtn consultbtn" id="'+$da[i]["professor"]["id"]+'">咨询</span><span style="display: none;" class="operbtn applybtn appl" resourceId='+$da[i].resourceId+' resourceName='+$da[i].resourceName+' professor='+$da[i].professor.name+'>申请</span></div>'
280
 			                	add+='</div></div>'
281
 			                		var $add=$(add);
282
 			                	$("#professorList").append($add);			                	
283
 			                	if($da[i].professor.authType) {
284
 			                		$add.find(".modicon").addClass("authicon authicon-cu");								
285
 								} else {
286
 									if($da[i].professor.authStatus) {
287
 										if($da[i].professor.authentication == 1) {
288
 											$add.find(".modicon").addClass("authicon2 authicon-mana");
289
 											//$add.find(".modicon").html("<span style='top:35%'>科研</span>");										
290
 										} else if($da[i].professor.authentication == 2) {
291
 											$add.find(".modicon").addClass("authicon2 authicon-staff");
292
 											//$add.find(".modicon").html("<span style='top:35%'>企业</span>");										
293
 										} else {
294
 											$add.find(".modicon").addClass("authicon2 authicon-stu");
295
 											//$add.find(".modicon").html("<span style='top:35%'>学生</span>");										
296
 										}
297
 									}
298
 								}
299
 			                   if(data.data.data[i].images.length)
300
 								{
301
 								$add.find(".resourceImg").attr("src","/images/resource/"+$da[i].resourceId+".jpg");
302
 								}
303
 								else{
304
 									$add.find(".resourceImg").attr("src","/images/default-resource.jpg");
305
 								}			                 
306
 							}
307
 							if(isbind == true){
308
								$(".tcdPageCode").createPage({
309
							        pageCount:Math.ceil(data.data.total/pageSize),
310
							        current:data.data.pageNo,
311
							        backFn:function(p){
312
							        	getData(key,subject,industry,pageSize,p,false);
313
							        }
314
							    });
196
		} else {
197
			//查询我的所有资源
198
			$.ajax({
199
				"url": "/ajax/resource/pq",
200
				"type": "get",
201
				"data": {
202
					"key": key,
203
					"subject": subject,
204
					"industry": industry,
205
					"pageSize": pageSize,
206
					"pageNo": pageNo,
207
					"address": add
208
				},
209
				"contentType": "application/x-www-form-urlencoded",
210
				"success": function(data) {
211
					console.log(data);
212
					if(data.success) {
213
						$("#professorList").html("");
214
						var $da = data.data.data;
215
						for(var i = 0; i < $da.length; i++) {
216
							var add = '<div class="item"><div class="remess" resourceId=' + $da[i].resourceId + '>'
217
							add += '<a class="resourcephoto headRadius" ><img src="" class="resourceImg" width="100%" height="100%" ></a>'
218
							add += '<div class="synopsis" style="width:66%;">'
219
							add += '<div class="cousultName"><a class="resouname" href="javascript:void();">' + $da[i].resourceName + '</a></div>'
220
							if($da[i].professor.name) {
221
								add += '<div class="belongname"><a style="float:left;display:block;">' + $da[i].professor.name + '</a><a class="modicon" style="display:block;top:4px;left:2px;"></a></div>'
315 222
							}
316
 						}
317
 						 else
318
 						 {
319
 							$.MsgBox.Alert("消息提醒","请先登录再进行咨询");
320
 							$("#mb_btn_ok").val("去登录");
321
 							
322
 						}
323
 						
324
 						//资源中点击咨询
325
						//$(".consultbtn").bind("click",clickResouceConsultHandler);
326
						$(".about").on("click",'.consultbtn',function(e){
327
							
328
							e.stopPropagation();//阻止事件冒泡,影响点击咨询
329
							e.cancelBubble = true;// ie下阻止冒泡
330
							clickResouceConsultHandler($(this),$(this).attr('id'));
331
							
332
						});
333
 					},				
334
 				});	
335
 			}
336
			
337
 		}
338
		
339
 		var subjectList = function (){
340
		$.get("../ajax/dataDict/qaDictCode",{dictCode:"SUBJECT"}, function(data) {
341
			if (data.success) {
223
							if($da[i].professor.title == undefined) {
224
								$da[i].professor.title = "";
225
							}
226
							if($da[i].professor.department == undefined) {
227
								$da[i].professor.department = "";
228
							}
229
							if($da[i].professor.orgName == undefined) {
230
								$da[i].professor.orgName = "";
231
							}
232
							add += '<div style="clear:both"></div><div class="positionbox">'
233
							if($da[i].professor.title && $da[i].professor.department && $da[i].professor.orgName) {
234
								add += $da[i].professor.title + "," + $da[i].professor.department + "," + $da[i].professor.orgName;
235
							} else if(!$da[i].professor.title && $da[i].professor.department && $da[i].professor.orgName) {
236
								add += $da[i].professor.department + "," + $da[i].professor.orgName;
237
							} else if($da[i].professor.title && !$da[i].professor.department && $da[i].professor.orgName) {
238
								add += $da[i].professor.title + "," + $da[i].professor.orgName;
239
							} else if($da[i].professor.title && $da[i].professor.department && !$da[i].professor.orgName) {
240
								add += $da[i].professor.title + "," + $da[i].professor.department;
241
							} else if(!$da[i].professor.title && !$da[i].professor.department && $da[i].professor.orgName) {
242
								add += $da[i].professor.orgName
243
							} else if(!$da[i].professor.title && $da[i].professor.department && !$da[i].professor.orgName) {
244
								add += $da[i].professor.department
245
							} else if($da[i].professor.title && !$da[i].professor.department && !$da[i].professor.orgName) {
246
								add += $da[i].professor.title
247
							}
248
							add += '</div>'
249
							if($da[i].subject) {
250
								add += '<div class="ellipsisbox sciencebox"><p>学术领域:' + $da[i].subject + '</p></div>'
251
							}
252
							if($da[i].industry) {
253
								add += '<div class="ellipsisbox industrybox"><p>应用行业:' + $da[i].industry + '</p></div>'
254
							}
255
							if($da[i].supportedServices) {
256
								add += '<div class="ellipsisbox provideservice"><p>应用用途:' + $da[i].supportedServices + '</p></div></div>'
257
							}
258
							if(userid==$da[i]["professor"]["id"]){
259
								add += '<div class="operbox"><span class="operbtn consultbtn" id="' + $da[i]["professor"]["id"] + '" style="display:none;">咨询</span><span style="display: none;" class="operbtn applybtn appl" resourceId=' + $da[i].resourceId + ' resourceName=' + $da[i].resourceName + ' professor=' + $da[i].professor.name + '>申请</span></div>'
260
							}else{
261
								add += '<div class="operbox"><span class="operbtn consultbtn" id="' + $da[i]["professor"]["id"] + '">咨询</span><span style="display: none;" class="operbtn applybtn appl" resourceId=' + $da[i].resourceId + ' resourceName=' + $da[i].resourceName + ' professor=' + $da[i].professor.name + '>申请</span></div>'
262
							}
263
							add += '</div></div>'
264
							var $add = $(add);
265
							$("#professorList").append($add);
266
							if($da[i].professor.authType) {
267
								$add.find(".modicon").addClass("authicon authicon-cu");
268
							} else {
269
								if($da[i].professor.authStatus) {
270
									if($da[i].professor.authentication == 1) {
271
										$add.find(".modicon").addClass("authicon2 authicon-mana");
272
										//$add.find(".modicon").html("<span style='top:35%'>科研</span>");										
273
									} else if($da[i].professor.authentication == 2) {
274
										$add.find(".modicon").addClass("authicon2 authicon-staff");
275
										//$add.find(".modicon").html("<span style='top:35%'>企业</span>");										
276
									} else {
277
										$add.find(".modicon").addClass("authicon2 authicon-stu");
278
										//$add.find(".modicon").html("<span style='top:35%'>学生</span>");										
279
									}
280
								}
281
							}
282
							if(data.data.data[i].images.length) {
283
								$add.find(".resourceImg").attr("src", "/images/resource/" + $da[i].resourceId + ".jpg");
284
							} else {
285
								$add.find(".resourceImg").attr("src", "/images/default-resource.jpg");
286
							}
287
						}
288
						if(isbind == true) {
289
							$(".tcdPageCode").createPage({
290
								pageCount: Math.ceil(data.data.total / pageSize),
291
								current: data.data.pageNo,
292
								backFn: function(p) {
293
									getData(key, subject, industry, pageSize, p, false);
294
								}
295
							});
296
						}
297
					} else {
298
						$.MsgBox.Alert("消息提醒", "请先登录再进行咨询");
299
						$("#mb_btn_ok").val("去登录");
300
301
					}
302
303
					//资源中点击咨询
304
					//$(".consultbtn").bind("click",clickResouceConsultHandler);
305
					$(".about").on("click", '.consultbtn', function(e) {
306
307
						e.stopPropagation(); //阻止事件冒泡,影响点击咨询
308
						e.cancelBubble = true; // ie下阻止冒泡
309
						clickResouceConsultHandler($(this), $(this).attr('id'));
310
311
					});
312
				},
313
			});
314
		}
315
316
	}
317
318
	var subjectList = function() {
319
		$.get("../ajax/dataDict/qaDictCode", {
320
			dictCode: "SUBJECT"
321
		}, function(data) {
322
			if(data.success) {
342 323
				console.log(data);
343 324
				/*if (data.data.length <= 10) {
344 325
					$(".andmore").eq(0).hide();
345 326
				}*/
346 327
				$("#subject").find(".sub").remove();
347
				for (var i = 0; i < data.data.length; i++) {
328
				for(var i = 0; i < data.data.length; i++) {
348 329
					$("#subject").append(
349
							"<a href='#' class='sub'title='"
350
									+ data.data[i].caption + "'>"
351
									+ data.data[i].caption + "</a>");
352
					if (subb) {
353
						if (subb == data.data[i].caption) {
330
						"<a href='#' class='sub'title='" +
331
						data.data[i].caption + "'>" +
332
						data.data[i].caption + "</a>");
333
					if(subb) {
334
						if(subb == data.data[i].caption) {
354 335
							$('.sub').eq(i).addClass('colorbg').siblings()
355
									.removeClass("colorbg");
336
								.removeClass("colorbg");
356 337
						}
357 338
					}
358
					if (i > 20)
339
					if(i > 20)
359 340
						break;
360 341
				}
361 342
			} else {
@ -364,18 +345,20 @@ $(function(){
364 345
		})
365 346
	}
366 347
	var Address = function() {
367
		$.get("../ajax/dataDict/qaCity",{dictCode:"ADDRESS"}, function(data) {
368
			if (data.success) {	
348
		$.get("../ajax/dataDict/qaCity", {
349
			dictCode: "ADDRESS"
350
		}, function(data) {
351
			if(data.success) {
369 352
				$("#address").empty();
370 353
				$("#address").prepend('<a href="#" class="colorbg no3" title="">不限</a>');
371 354
				/*if (data.data.length <= 10) {
372 355
					$(".andmore").eq(2).hide();
373 356
				}*/
374
				for (var i = 0; i < data.data.length; i++) {
357
				for(var i = 0; i < data.data.length; i++) {
375 358
					$("#address").append(
376
							"<a href='#' title='" + data.data[i].caption + "'>"
377
									+ data.data[i].caption + "</a>");
378
					if (i > 20)
359
						"<a href='#' title='" + data.data[i].caption + "'>" +
360
						data.data[i].caption + "</a>");
361
					if(i > 20)
379 362
						break;
380 363
				}
381 364
			} else {
@ -384,19 +367,21 @@ $(function(){
384 367
		})
385 368
	}
386 369
	var industryList = function() {
387
		$.get("../ajax/dataDict/qaDictCode",{dictCode:"INDUSTRY"}, function(data) {
370
		$.get("../ajax/dataDict/qaDictCode", {
371
			dictCode: "INDUSTRY"
372
		}, function(data) {
388 373
			console.log(data);
389
			if (data.success) {
374
			if(data.success) {
390 375
				/*if (data.data.length <= 10) {
391 376
					$(".andmore").eq(1).hide();
392 377
				}*/
393 378
				$("#industry").find(".indu").remove();
394
				for (var i = 0; i < data.data.length; i++) {
379
				for(var i = 0; i < data.data.length; i++) {
395 380
					$("#industry").append(
396
							"<a href='#' class='indu'title='"
397
									+ data.data[i].caption + "'>"
398
									+ data.data[i].caption + "</a>");
399
					if (i > 20)
381
						"<a href='#' class='indu'title='" +
382
						data.data[i].caption + "'>" +
383
						data.data[i].caption + "</a>");
384
					if(i > 20)
400 385
						break;
401 386
				}
402 387
			} else {
@ -405,18 +390,18 @@ $(function(){
405 390
		})
406 391
	}
407 392
	var findProfessor = function() {
408
		if (subb) {
409
			subject = subb;
410
		} else {
411
			subject = $("#subject .colorbg")[0].title;
393
			if(subb) {
394
				subject = subb;
395
			} else {
396
				subject = $("#subject .colorbg")[0].title;
397
			}
398
			industry = $("#industry .colorbg")[0].title;
399
			pageSize = 10;
400
			getData(key, subject, industry, pageSize, 1, true, address);
412 401
		}
413
		industry = $("#industry .colorbg")[0].title;
414
		pageSize = 10;
415
		getData(key, subject, industry, pageSize, 1, true, address);
416
	}
417
	// enter键搜索
402
		// enter键搜索
418 403
	function synContent(type) {
419
		if (type == 1) {
404
		if(type == 1) {
420 405
			$("#searchContent").val($("#hsearchContent").val());
421 406
		} else {
422 407
			$("#hsearchContent").val($("#searchContent").val());
@ -428,439 +413,435 @@ $(function(){
428 413
	$("#searchContent").blur(function() {
429 414
		synContent(2);
430 415
	});
431
	$("#searchContent").keydown(function(e){
432
		if(e.which==13) {
433
			synContent(2);		
416
	$("#searchContent").keydown(function(e) {
417
		if(e.which == 13) {
418
			synContent(2);
434 419
			key = $("#searchContent").val();
435 420
			$("#professorList").remove();
436 421
			$(".aboutpro").append(
437
					'<div class="about-in" id="professorList"></div>')
422
				'<div class="about-in" id="professorList"></div>')
438 423
			$(".tcdPageCode").remove();
439 424
			$(".aboutpro").append('<div class="tcdPageCode"></div>');
440 425
			getData(key, subject, industry, 10, 1, true, address);
441 426
		}
442
		
427
443 428
	})
444
	$("#hsearchContent").keydown(function(e){
445
		if(e.which==13) {
429
	$("#hsearchContent").keydown(function(e) {
430
		if(e.which == 13) {
446 431
			synContent(1);
447 432
			key = $("#searchContent").val();
448 433
			$("#professorList").remove();
449 434
			$(".aboutpro").append(
450
					'<div class="about-in" id="professorList"></div>')
435
				'<div class="about-in" id="professorList"></div>')
451 436
			$(".tcdPageCode").remove();
452 437
			$(".aboutpro").append('<div class="tcdPageCode"></div>');
453 438
			getData(key, subject, industry, 10, 1, true, address);
454 439
		}
455 440
	})
456 441
	$("#search1").on(
457
			"click",
458
			function() {
459
				$("#hsearchContent").val($("#searchContent").val());
460
				key = $("#searchContent").val();
461
				$("#professorList").remove();
462
				$(".aboutpro").append(
463
						'<div class="about-in" id="professorList"></div>')
464
				$(".tcdPageCode").remove();
465
				$(".aboutpro").append('<div class="tcdPageCode"></div>');
466
				getData(key, subject, industry, 10, 1, true, address);
467
			})
442
		"click",
443
		function() {
444
			$("#hsearchContent").val($("#searchContent").val());
445
			key = $("#searchContent").val();
446
			$("#professorList").remove();
447
			$(".aboutpro").append(
448
				'<div class="about-in" id="professorList"></div>')
449
			$(".tcdPageCode").remove();
450
			$(".aboutpro").append('<div class="tcdPageCode"></div>');
451
			getData(key, subject, industry, 10, 1, true, address);
452
		})
468 453
	$("#hsearch1").on(
469
			"click",
470
			function() {
471
				$("#searchContent").val($("#hsearchContent").val());
472
				key = $("#hsearchContent").val();
473
				$("#professorList").remove();
474
				$(".aboutpro").append(
475
						'<div class="about-in" id="professorList"></div>')
476
				$(".tcdPageCode").remove();
477
				$(".aboutpro").append('<div class="tcdPageCode"></div>');
478
				getData(key, subject, industry, 10, 1, true, address);
479
			})
454
		"click",
455
		function() {
456
			$("#searchContent").val($("#hsearchContent").val());
457
			key = $("#hsearchContent").val();
458
			$("#professorList").remove();
459
			$(".aboutpro").append(
460
				'<div class="about-in" id="professorList"></div>')
461
			$(".tcdPageCode").remove();
462
			$(".aboutpro").append('<div class="tcdPageCode"></div>');
463
			getData(key, subject, industry, 10, 1, true, address);
464
		})
480 465
481 466
	subjectList();
482 467
	industryList();
483 468
	findProfessor();
484 469
	Address();
485 470
	$(".class1").eq(0).on(
486
			"click",
487
			"a",
488
			function() {
489
				$(this).addClass("colorbg").siblings().removeClass("colorbg");
490
				key = $("#searchContent").val();
491
				subject = $(this).attr('title');
492
				$("#professorList").remove();
493
				$(".aboutpro").append(
494
						'<div class="about-in" id="professorList"></div>')
495
				$(".tcdPageCode").remove();
496
				$(".aboutpro").append('<div class="tcdPageCode"></div>');
497
				getData(key, subject, industry, 10, 1, true, address);
471
		"click",
472
		"a",
473
		function() {
474
			$(this).addClass("colorbg").siblings().removeClass("colorbg");
475
			key = $("#searchContent").val();
476
			subject = $(this).attr('title');
477
			$("#professorList").remove();
478
			$(".aboutpro").append(
479
				'<div class="about-in" id="professorList"></div>')
480
			$(".tcdPageCode").remove();
481
			$(".aboutpro").append('<div class="tcdPageCode"></div>');
482
			getData(key, subject, industry, 10, 1, true, address);
498 483
499
			});
484
		});
500 485
	$(".class1").eq(1).on(
501
			"click",
502
			"a",
503
			function() {
504
				$(this).addClass("colorbg").siblings().removeClass("colorbg");
505
				industry = $(this).attr('title');
506
				key = $("#searchContent").val();
507
				$("#professorList").remove();
508
				$(".aboutpro").append(
509
						'<div class="about-in" id="professorList"></div>')
510
				$(".tcdPageCode").remove();
511
				$(".aboutpro").append('<div class="tcdPageCode"></div>');
512
				getData(key, subject, industry, 10, 1, true, address);
513
			});
486
		"click",
487
		"a",
488
		function() {
489
			$(this).addClass("colorbg").siblings().removeClass("colorbg");
490
			industry = $(this).attr('title');
491
			key = $("#searchContent").val();
492
			$("#professorList").remove();
493
			$(".aboutpro").append(
494
				'<div class="about-in" id="professorList"></div>')
495
			$(".tcdPageCode").remove();
496
			$(".aboutpro").append('<div class="tcdPageCode"></div>');
497
			getData(key, subject, industry, 10, 1, true, address);
498
		});
514 499
	$(".class1").eq(2).on(
515
			"click",
516
			"a",
517
			function() {
518
				$(this).addClass("colorbg").siblings().removeClass("colorbg");
519
				address = $(this).attr('title');
520
				key = $("#searchContent").val();
521
				$("#professorList").remove();
522
				$(".aboutpro").append(
523
						'<div class="about-in" id="professorList"></div>')
524
				$(".tcdPageCode").remove();
525
				$(".aboutpro").append('<div class="tcdPageCode"></div>');
526
				getData(key, subject, industry, 10, 1, true, address);
527
			});
500
		"click",
501
		"a",
502
		function() {
503
			$(this).addClass("colorbg").siblings().removeClass("colorbg");
504
			address = $(this).attr('title');
505
			key = $("#searchContent").val();
506
			$("#professorList").remove();
507
			$(".aboutpro").append(
508
				'<div class="about-in" id="professorList"></div>')
509
			$(".tcdPageCode").remove();
510
			$(".aboutpro").append('<div class="tcdPageCode"></div>');
511
			getData(key, subject, industry, 10, 1, true, address);
512
		});
528 513
	/* 搜索分类展开 */
529 514
	var listi = 0;
530 515
	$(".andmore").click(function() {
531 516
		$(this).find(".updown").css("background-position", "left");
532 517
		$(this).parent().css("height", "48px");
533
		if (listi % 2 == 0) {
534
	
518
		if(listi % 2 == 0) {
519
535 520
		} else {
536 521
			$(this).find(".updown").css("background-position", "right");
537 522
			$(this).parent().css("height", "auto");
538
	
523
539 524
		}
540 525
		listi++;
541
	 })
542
	 
526
	})
527
543 528
	/*搜索分类背景切换*/
544
	$(".class1").on("click","a",function (){
529
	$(".class1").on("click", "a", function() {
545 530
		$(this).addClass("colorbg").siblings().removeClass("colorbg");
546
	}) 
547
	
531
	})
532
548 533
	/*专家、资源菜单切换*/
549
//	$(".lookwho").change(function(){
550
//		//$(this).addClass("tabcurrent").siblings().removeClass("tabcurrent");
551
//		//$(".aboutcon").eq($(this).index()).show().siblings().hide();
552
//		if($(this).value == "0"){
553
//			$(".aboutpro").show();
554
//			$(".aboutresou").hide();	
555
//		}
556
//		else{
557
//			$(".aboutresou").show();
558
//			$(".aboutpro").hide();
559
//		}
560
//		
561
//	})
562
	
563
	 //判断是搜寻专家还是资源
534
	//	$(".lookwho").change(function(){
535
	//		//$(this).addClass("tabcurrent").siblings().removeClass("tabcurrent");
536
	//		//$(".aboutcon").eq($(this).index()).show().siblings().hide();
537
	//		if($(this).value == "0"){
538
	//			$(".aboutpro").show();
539
	//			$(".aboutresou").hide();	
540
	//		}
541
	//		else{
542
	//			$(".aboutresou").show();
543
	//			$(".aboutpro").hide();
544
	//		}
545
	//		
546
	//	})
547
548
	//判断是搜寻专家还是资源
564 549
	$(".lishow li").on(
565
			"click",
566
			function() {
567
				c = $(this).index();
568
569
				$("#industry").find(".no2").addClass("colorbg").siblings()
570
						.removeClass("colorbg");
571
				$("#subject").find(".nox").addClass("colorbg").siblings()
572
						.removeClass("colorbg");
573
				key = $("#searchContent").val();
574
				industry = "";
575
				subject = "";
576
				address = "";
577
				if (c == 0) {
578
					sub = "SUBJECT";
579
					indu = "INDUSTRY";
580
				} else {
581
					sub = "SUBJECT";
582
					indu = "INDUSTRY";
550
		"click",
551
		function() {
552
			c = $(this).index();
583 553
584
				}
585
				industryList();
586
				subjectList();
587
				Address();
588
				$("#professorList").remove();
589
				$(".aboutpro").append(
590
						'<div class="about-in" id="professorList"></div>')
591
				$(".tcdPageCode").remove();
592
				$(".aboutpro").append('<div class="tcdPageCode"></div>');
593
				getData(key, subject, industry, pageSize, 1, true, address);
594
			});
554
			$("#industry").find(".no2").addClass("colorbg").siblings()
555
				.removeClass("colorbg");
556
			$("#subject").find(".nox").addClass("colorbg").siblings()
557
				.removeClass("colorbg");
558
			key = $("#searchContent").val();
559
			industry = "";
560
			subject = "";
561
			address = "";
562
			if(c == 0) {
563
				sub = "SUBJECT";
564
				indu = "INDUSTRY";
565
			} else {
566
				sub = "SUBJECT";
567
				indu = "INDUSTRY";
568
569
			}
570
			industryList();
571
			subjectList();
572
			Address();
573
			$("#professorList").remove();
574
			$(".aboutpro").append(
575
				'<div class="about-in" id="professorList"></div>')
576
			$(".tcdPageCode").remove();
577
			$(".aboutpro").append('<div class="tcdPageCode"></div>');
578
			getData(key, subject, industry, pageSize, 1, true, address);
579
		});
595 580
	// 查询资源详细信息
596 581
	$('.about')
597
			.on(
598
					"click",
599
					'.remess',
600
					function() {
601
						var resourceID = $(this).attr("resourceId");
602
						ResourceMessage();
603
						$
604
								.ajax({
605
									"url" : "/ajax/resource/" + resourceID,
606
									"type" : "get",
607
									"async" : true,
608
									"success" : function(info) {
609
										if (info.success) {
610
											$("#resourceName").text(
611
													info.data.resourceName);
612
											$("#supportedServices")
613
													.text(
614
															info.data.supportedServices);
615
											$("#hopePayMethod").text(
616
													info.data.hopePayMethod);
617
											$("#cooperationNotes").text(
618
													info.data.cooperationNotes);
619
											$("#subject").text(
620
													info.data.subject);
621
											$("#industry").text(
622
													info.data.industry);
623
											$("#descp").text(info.data.descp);
624
											$("#professor").text(
625
													info.data.professor.name);
626
											$(".resouImage").attr(
582
		.on(
583
			"click",
584
			'.remess',
585
			function() {
586
				var resourceID = $(this).attr("resourceId");
587
				ResourceMessage();
588
				$
589
					.ajax({
590
						"url": "/ajax/resource/" + resourceID,
591
						"type": "get",
592
						"async": true,
593
						"success": function(info) {
594
							if(info.success) {
595
								$("#resourceName").text(
596
									info.data.resourceName);
597
								$("#supportedServices")
598
									.text(
599
										info.data.supportedServices);
600
								$("#hopePayMethod").text(
601
									info.data.hopePayMethod);
602
								$("#cooperationNotes").text(
603
									info.data.cooperationNotes);
604
								$("#subject").text(
605
									info.data.subject);
606
								$("#industry").text(
607
									info.data.industry);
608
								$("#descp").text(info.data.descp);
609
								$("#professor").text(
610
									info.data.professor.name);
611
								$(".resouImage").attr(
612
									"src",
613
									"/images/resource/" +
614
									resourceID +
615
									".jpg");
616
								$(".resouImage")
617
									.load(function() {})
618
									.error(
619
										function() {
620
											$(this)
621
												.attr(
627 622
													"src",
628
													"/images/resource/"
629
															+ resourceID
630
															+ ".jpg");
631
											$(".resouImage")
632
													.load(function() {
633
													})
634
													.error(
635
															function() {
636
																$(this)
637
																		.attr(
638
																				"src",
639
																				"/images/default-resource.jpg");
640
															});
641
											limitHeight();
642
										} else {
643
											$.MsgBox.Alert('消息提醒', "系统异常!");
644
										}
645
									},
646
									"error" : function() {
647
										$.MsgBox.Alert('message', 'failed')
648
									}
649
								});
650
					})
651
	// 资源申请
623
													"/images/default-resource.jpg");
624
										});
625
								limitHeight();
626
							} else {
627
								$.MsgBox.Alert('消息提醒', "系统异常!");
628
							}
629
						},
630
						"error": function() {
631
							$.MsgBox.Alert('message', 'failed')
632
						}
633
					});
634
			})
635
		// 资源申请
652 636
	function getIdentity(professorId) {
653 637
		$
654
				.ajax({
655
					"url" : "ajax/professor/" + professorId,
656
					"type" : "get",
657
					"async" : false,
658
					"success" : function(data) {
659
						if (data.success) {
660
							$(".frmtype option")[0].value = data.data.name;
661
							$(".frmtype option")[1].value = data.data.organization.name;
662
						} else {
663
							$.MsgBox.Alert("消息提醒", "系统异常!");
664
						}
665
					},
666
					"error" : function() {
667
						$.MsgBox.Alert('message', 'failddd')
638
			.ajax({
639
				"url": "ajax/professor/" + professorId,
640
				"type": "get",
641
				"async": false,
642
				"success": function(data) {
643
					if(data.success) {
644
						$(".frmtype option")[0].value = data.data.name;
645
						$(".frmtype option")[1].value = data.data.organization.name;
646
					} else {
647
						$.MsgBox.Alert("消息提醒", "系统异常!");
668 648
					}
669
				})
649
				},
650
				"error": function() {
651
					$.MsgBox.Alert('message', 'failddd')
652
				}
653
			})
670 654
	}
655
671 656
	function replaceStr(s) {
672 657
		var pattern = new RegExp("-");
673 658
		var rs = "";
674
		for (var i = 0; i < s.length; i++) {
659
		for(var i = 0; i < s.length; i++) {
675 660
			rs = rs + s.substr(i, 1).replace(pattern, '');
676 661
		}
677 662
		return rs;
678 663
	}
679 664
	$('.aboutpro')
680
			.on(
681
					"click",
682
					'.appl',
683
					function() {
684
						ResourceApply();// 调用资源申请HTML创建函数
685
						$(".limitBox").removeClass("limitBox");
686
						$(".limitwords").removeClass("limitwords");
687
						$(".limitwordbox").removeClass("limitwordbox");
688
						// 获取当前时间并且格式化时间
689
						var myDate = new Date();
690
						var nowYear = myDate.getFullYear();
691
						var nowMonth = myDate.getMonth() + 1;
692
						var nowDate = myDate.getDate();
693
						if (nowMonth < 10) {
694
							nowMonth = "0" + nowMonth.toString();
695
						}
696
						if (nowDate < 10) {
697
							nowDate = "0" + nowDate.toString();
665
		.on(
666
			"click",
667
			'.appl',
668
			function() {
669
				ResourceApply(); // 调用资源申请HTML创建函数
670
				$(".limitBox").removeClass("limitBox");
671
				$(".limitwords").removeClass("limitwords");
672
				$(".limitwordbox").removeClass("limitwordbox");
673
				// 获取当前时间并且格式化时间
674
				var myDate = new Date();
675
				var nowYear = myDate.getFullYear();
676
				var nowMonth = myDate.getMonth() + 1;
677
				var nowDate = myDate.getDate();
678
				if(nowMonth < 10) {
679
					nowMonth = "0" + nowMonth.toString();
680
				}
681
				if(nowDate < 10) {
682
					nowDate = "0" + nowDate.toString();
683
				}
684
				var now = nowYear + "-" + nowMonth + "-" + nowDate;
685
				$("#datepicker").val(now);
686
				$("#datepicker").datepicker({
687
					"dateFormat": " yy-mm-dd"
688
				});
689
				$(".timelo").css("display", "none");
690
				var resName = $(this).attr("resourcename");
691
				var name = $(this).attr("professor");
692
				var resourceID = $(this).attr("resourceId");
693
				$
694
					.ajax({
695
						"url": "/ajax/resource/" + resourceID,
696
						"type": "get",
697
						"async": false,
698
						"success": function(info) {
699
							if(info.success) {
700
								if(info.data.images.length) {
701
									$(".resouImage").attr(
702
										"src",
703
										"/images/resource/" +
704
										resourceID +
705
										".jpg");
706
								} else {
707
									$(".resouImage")
708
										.attr("src",
709
											"/images/default-resource.jpg");
710
								}
711
							}
698 712
						}
699
						var now = nowYear + "-" + nowMonth + "-" + nowDate;
700
						$("#datepicker").val(now);
701
						$("#datepicker").datepicker({
702
							"dateFormat" : " yy-mm-dd"
703
						});
704
						$(".timelo").css("display", "none");
705
						var resName = $(this).attr("resourcename");
706
						var name = $(this).attr("professor");
707
						var resourceID = $(this).attr("resourceId");
708
						$
713
					})
714
				$(".namecon").text(name);
715
				$(".applysure").hide();
716
				$(".btnboxup").hide();
717
				$(".log").text(resName);
718
				getIdentity(userid);
719
				$("#deliver")
720
					.on(
721
						"click",
722
						function() {
723
							var $data = {};
724
							$data.demandId = userid;
725
							$data.resourceId = resourceID;
726
							$data.detailDemand = $(".detail")
727
								.val();
728
							// 去除时间里面的- 和字符串前后的空格
729
							$data.deliverTime = replaceStr($
730
								.trim($(".dealTime").val()));
731
							$data.operationStatus = 1;
732
							$data.applysquare = $(
733
									".frmtype option:selected")
734
								.val();
735
							$
709 736
								.ajax({
710
									"url" : "/ajax/resource/" + resourceID,
711
									"type" : "get",
712
									"async" : false,
713
									"success" : function(info) {
714
										if (info.success) {
715
											if (info.data.images.length) {
716
												$(".resouImage").attr(
717
														"src",
718
														"/images/resource/"
719
																+ resourceID
720
																+ ".jpg");
721
											} else {
722
												$(".resouImage")
723
														.attr("src",
724
																"/images/default-resource.jpg");
725
											}
737
									"url": "/ajax/operation",
738
									"type": "POST",
739
									"success": function(
740
										rdata) {
741
										if(rdata.success) {
742
											$.MsgBox
743
												.Alert(
744
													'消息提醒',
745
													'资源"' +
746
													resName +
747
													'"申请发送成功!');
748
											$(".blackcover")
749
												.remove();
750
											$("body")
751
												.css(
752
													"position",
753
													"static");
754
											// location.reload(true);
755
										} else {
756
											$.MsgBox
757
												.Alert(
758
													'消息提醒',
759
													'资源"' +
760
													resName +
761
													'"申请发送失败,请重新申请!');
726 762
										}
727
									}
728
								})
729
						$(".namecon").text(name);
730
						$(".applysure").hide();
731
						$(".btnboxup").hide();
732
						$(".log").text(resName);
733
						getIdentity(userid);
734
						$("#deliver")
735
								.on(
736
										"click",
737
										function() {
738
											var $data = {};
739
											$data.demandId = userid;
740
											$data.resourceId = resourceID;
741
											$data.detailDemand = $(".detail")
742
													.val();
743
											// 去除时间里面的- 和字符串前后的空格
744
											$data.deliverTime = replaceStr($
745
													.trim($(".dealTime").val()));
746
											$data.operationStatus = 1;
747
											$data.applysquare = $(
748
													".frmtype option:selected")
749
													.val();
750
											$
751
													.ajax({
752
														"url" : "/ajax/operation",
753
														"type" : "POST",
754
														"success" : function(
755
																rdata) {
756
															if (rdata.success) {
757
																$.MsgBox
758
																		.Alert(
759
																				'消息提醒',
760
																				'资源"'
761
																						+ resName
762
																						+ '"申请发送成功!');
763
																$(".blackcover")
764
																		.remove();
765
																$("body")
766
																		.css(
767
																				"position",
768
																				"static");
769
																// location.reload(true);
770
															} else {
771
																$.MsgBox
772
																		.Alert(
773
																				'消息提醒',
774
																				'资源"'
775
																						+ resName
776
																						+ '"申请发送失败,请重新申请!');
777
															}
778
														},
779
														"data" : $data,
780
														"beforeSend" : function() {/* console.log(this.data) */
781
														},
782
														"contentType" : "application/x-www-form-urlencoded",
783
														dataType : "json"
784
													});
785
										});
786
					});
763
									},
764
									"data": $data,
765
									"beforeSend": function() { /* console.log(this.data) */ },
766
									"contentType": "application/x-www-form-urlencoded",
767
									dataType: "json"
768
								});
769
						});
770
			});
787 771
788 772
	// 找专家中 点击咨询处理函数
789 773
	function clickSeachProConsultHandler() {
790 774
791
		if (userid != null && userid != 'null' && userid != undefined && userid != 'undefined') {
775
		if(userid != null && userid != 'null' && userid != undefined && userid != 'undefined') {
792 776
			var professorId = $(this).attr("id");
793
			
777
794 778
			ConsultApply();
795 779
			//点击的发送
796
			$("#sendConsultBtn").click(function(){
780
			$("#sendConsultBtn").click(function() {
797 781
				sendConsultHandler($(this).attr("proId"))
798 782
			});
799 783
			concultProInfo(professorId);
800
			
801
		}else {
802
			$.MsgBox.Alert("消息提醒","请先登录再进行咨询");
784
785
		} else {
786
			$.MsgBox.Alert("消息提醒", "请先登录再进行咨询");
803 787
			$("#mb_btn_ok").val("去登录");
804 788
			var aele = document.createElement('a');
805 789
			$("#mb_btnbox").append(aele);
806 790
			$("#mb_btnbox a").css({
807
				'display':"block",
808
				'width':'100%',
809
				'height':'40px',
810
				'position':'absolute',
811
				'bottom':'-6px',
812
				'left':'0'
813
				});
791
				'display': "block",
792
				'width': '100%',
793
				'height': '40px',
794
				'position': 'absolute',
795
				'bottom': '-6px',
796
				'left': '0'
797
			});
814 798
			aele.setAttribute('href', '../login.html');
815 799
		}
816
			
817
	 };
818
	 
819
	 
820
	 
821
	 //找资源中 点击咨询 obj点击对象
822
	 function clickResouceConsultHandler(obj,professorId){
823
		
824
		if(userid && userid != null && userid != 'null' && userid != undefined && userid != 'undefined'){
825
			
826
//			var professorId = $(this).attr("id");
800
801
	};
802
803
	//找资源中 点击咨询 obj点击对象
804
	function clickResouceConsultHandler(obj, professorId) {
805
806
		if(userid && userid != null && userid != 'null' && userid != undefined && userid != 'undefined') {
807
808
			//			var professorId = $(this).attr("id");
827 809
			ConsultApply();
828 810
			//默认选中资源咨询和标题
829
			for(var i = 0; i < $("ul.menucon").children().length;i++){
811
			for(var i = 0; i < $("ul.menucon").children().length; i++) {
830 812
				$("ul.menucon").children().eq(i).removeClass("clicknow");
831 813
				$("ul.menucon").children().eq(1).addClass("clicknow");
832 814
			}
833
			
815
834 816
			var item = obj.parent().parent().parent();
835 817
			var consultTitleVal = item.find(".resouname").text();
836
			
837
			$("#consultTitle").val("关于"+consultTitleVal+"的咨询");
818
819
			$("#consultTitle").val("关于" + consultTitleVal + "的咨询");
838 820
			//点击的发送
839
			$("#sendConsultBtn").click(function(){
840
				sendConsultHandler($(this).attr("proId"));//common.js中
821
			$("#sendConsultBtn").click(function() {
822
				sendConsultHandler($(this).attr("proId")); //common.js中
841 823
			});
842
			concultProInfo(professorId);//common.js中
843
					
844
		}else {
845
			
846
			$.MsgBox.Alert("消息提醒","请先登录再进行咨询");
824
			concultProInfo(professorId); //common.js中
825
826
		} else {
827
828
			$.MsgBox.Alert("消息提醒", "请先登录再进行咨询");
847 829
			$("#mb_btn_ok").val("去登录");
848 830
			var aele = document.createElement('a');
849 831
			$("#mb_btnbox").append(aele);
850 832
			$("#mb_btnbox a").css({
851
				'display':"block",
852
				'width':'100%',
853
				'height':'40px',
854
				'position':'absolute',
855
				'bottom':'-6px',
856
				'left':'0'
857
				});
833
				'display': "block",
834
				'width': '100%',
835
				'height': '40px',
836
				'position': 'absolute',
837
				'bottom': '-6px',
838
				'left': '0'
839
			});
858 840
			aele.setAttribute('href', '../login.html');
859 841
		}
860
		 
861
	 };
862 842
863
	 
843
	};
844
864 845
	/* function sendConsultHandler(){
865 846
		 	var professorId = $(this).attr("proId");
866 847
			var consult_type = $(".clicknow").text();//咨询类型
@ -917,7 +898,5 @@ $(function(){
917 898
			}
918 899
919 900
		}*/
920
	 
921
	 
922
});
923
 
901
902
});