Browse Source

1.搜索找资源找专家中咨询接口
2.专家信息中,科研资源中咨询接口

xiaoai_123 8 years ago
parent
commit
65f1cfeef2

+ 110 - 3
src/main/webapp/js/common.js

154
		$(countContainerId).text(count - $(TextAreaId).val().length); 
154
		$(countContainerId).text(count - $(TextAreaId).val().length); 
155
	} 
155
	} 
156
};
156
};
157
//咨询申请主题字数限制函数
158

157

158
//咨询申请主题字数限制函数
159
function titleLimitFontCountFn(){
159
function titleLimitFontCountFn(){
160
	var curLength= $("#consultTitle").val().length;
160
	var curLength= $("#consultTitle").val().length;
161

161

162
	if(curLength>20){
162
	if(curLength>20){
163
		var num = $("#consultTitle").val().substr(0,20); 
163
		var num = $("#consultTitle").val().substr(0,20); 
164
		$("#consultTitle").val(num);
164
		$("#consultTitle").val(num);
165
//		$.MsgBox.Alert('提醒',"咨询标题不超过20字");
166
	} 
165
	} 
167
	
166
	
168
} 
167
};
168

169
//咨询 专家信息接口函数
170
function concultProInfo(professorId){
171
	 $.ajax({
172
			url:"/ajax/professor/editBaseInfo/"+professorId,
173
			type:"get",
174
			data : {"id":professorId},
175
			contentType : "application/x-www-form-urlencoded",
176
			success:function(response){
177
				console.log(response);
178
				var myData = response["data"];
179
				
180
				$("#professorName").html(myData["name"]);
181
				$("#professorTitle").html(myData["title"]);
182
				$("#profDepartment").html(myData["department"]);
183
				$("#profOrganization").html(myData["orgName"]);
184
				$("#profAdress").html(myData["address"]);
185
				$("#byConsultConut").html(myData["consultCount"]);
186
				$("#sendConsultBtn").attr("proId",myData["id"]);
187
				
188
				//星级 
189
				var startConut = myData["starLevel"];
190
				for(var i = 0; i < startConut; i ++){
191
					$("#starLevel .evastar2").eq(i).addClass("addStar");
192
				}
193
				
194
				//是否认证
195
				if(myData["authentication"] == true){
196
					$("#proModify").removeClass("displayNone");
197
				}
198
				
199
				
200
				//没有头像
201
				if(myData["hasHeadImage"] == 0){
202
					$("#prohead").attr("src","images/default-photo.jpg");
203
				}
204
				//有头像
205
				else {
206
					$("#prohead").attr("src","images/head/"+myData["id"]+"_m.jpg");
207
				}
208
				
209
				
210
			},
211
			error:function(error){
212
				$.MsgBox.Alert("message","请求数据失败");
213
			}
214
		});
215
};
216

217
//发送咨询
218
function sendConsultHandler(professorId){
219

220
 	var professorId = professorId;
221
	var consult_type = $(".clicknow").text();//咨询类型
222
	var consult_title = $("#consultTitle").val();//咨询主题
223
	var consult_content = $("#consultcontent").val();//咨询内容
224
	var consultStr = {
225
			"consultType":consult_type,
226
			"consultTitle":consult_title,
227
			"consultContant":consult_content,
228
			"professorId":professorId,
229
			"consultantId":userid
230
	};
231
	
232
	if(consult_type == '' || consult_title == '' || consult_content == ''){
233
		$.MsgBox.Alert("message","请填写完整");
234
	};
235
	if(consult_type == ''){
236
		$.MsgBox.Alert("消息","请选择联系目的");
237
	}
238
	if(consult_title == ''){
239
		$.MsgBox.Alert("消息","请填写咨询目的");
240
	}
241
	if(consult_content == ''){
242
		$.MsgBox.Alert("消息","请填写咨询内容");
243
	}
244
	
245
	if(userid && userid != null && userid != "null" && consult_type != '' &&
246
			consult_title != '' && consult_content != ''
247
	){
248
		
249
		$.ajax({
250
			"url" :"/ajax/consult",
251
			"type" : "post",
252
			//传值:咨询类型、主题、内容、专家id、申请人id
253
			"data" : consultStr,				
254
			"contentType" : "application/x-www-form-urlencoded",
255
			"dataType" : "json",
256
			"success" : function(response) {
257
				consultId = response.data;//咨询id
258
				
259
				
260
			},
261
			"error":function (){
262
				$.MsgBox.Alert("消息","咨询申请失败");
263
			},
264
			
265
			"complete":function(){
266
				//$(".consultapply").remove();
267
				$(".blackcover").remove();
268
				$("body").css("position","static");
269
				$.MsgBox.Alert("消息","咨询申请成功");
270
			},
271
		});
272
	}
273

274

275
};
169

276

170

277


+ 29 - 33
src/main/webapp/js/consult.js

238
		data :params,
238
		data :params,
239
		dataType: "json",
239
		dataType: "json",
240
		contentType: "application/x-www-form-urlencoded",
240
		contentType: "application/x-www-form-urlencoded",
241
		"success":function(response){
242
			$("#workContainer2 .workselectitem").remove();	
241
		success:function(response){
243
			if(response["data"]["data"] == null || response["data"]["data"] == undefined || response["data"]["data"] == ""){
242
			if(response["data"]["data"] == null || response["data"]["data"] == undefined || response["data"]["data"] == ""){
244

245
				return false;
243
				return false;
246
			}
244
			}
247
			else{
245
			else{
250
				var allData = response.data;
248
				var allData = response.data;
251
				var myData = allData.data;
249
				var myData = allData.data;
252
				
250
				
251
				$("#workContainer2 .workselectitem").remove();	
253
				if(myData.length != 0 &&  myData.length != null){
252
				if(myData.length != 0 &&  myData.length != null){
254
					replyStr = handleData(myData,"consultId","lookBtn");
253
					replyStr = handleData(myData,"consultId","lookBtn");
255
					$("#workContainer2").prepend(replyStr);
254
					$("#workContainer2").prepend(replyStr);
256
					
255
					
257
//					$("#workContainer2 .workselectitem").find(".lookBtn").bind("click",clickLookBtn);
258
					
259
					if(isbind == true){
260
						$(".getReplyPage").createPage({
261
					        pageCount:Math.ceil(allData.total/pageSize),
262
					        current:allData.pageNo,
263
					        backFn:function(p){
264
					        	getMyData(url,pageSize,p,false,status,timeType,sortType);
265
					        }
266
					    });
267
					}
268
					
269
				}else{
256
				}else{
270
					return false;
257
					return false;
271
				}	
258
				};
259
				//分页
260
				if(isbind == true){
261
					$(".getReplyPage").createPage({
262
				        pageCount:Math.ceil(allData.total/pageSize),
263
				        current:allData.pageNo,
264
				        backFn:function(p){
265
				        	getMyData(url,pageSize,p,false,status,timeType,sortType);
266
				        }
267
				    });
268
				}
269
				
272
			}
270
			}
273
			
271
			
274
		},
272
		},
275
		"error":function(response){
273
		error:function(response){
276
			//收到回复错误返回
274
			//收到回复错误返回
277
			$.MsgBox.Alert('提示',"收到回复数据请求失败");
275
			$.MsgBox.Alert('提示',"收到回复数据请求失败");
278
		},
276
		},
300
		contentType: "application/x-www-form-urlencoded",
298
		contentType: "application/x-www-form-urlencoded",
301
		success:function(response){
299
		success:function(response){
302
			
300
			
303
			//拿到收到咨询数据
304
			$("#workContainer .workselectitem").remove();	
301
			
305
			if(response["data"]["data"] == null || response["data"]["data"] == undefined || response["data"]["data"] == ""){
302
			if(response["data"]["data"] == null || response["data"]["data"] == undefined || response["data"]["data"] == ""){
306
//				$("#workContainer").prepend("<div style='text-align: center;font-weight: 700;color: blue;'>没有咨询</div>");
307
				return false;
303
				return false;
308
			}
304
			}
309
			else{
305
			else{
310
				var consultStr;
306
				var consultStr;
311
				var allData = response.data;
307
				var allData = response.data;
312
				var myData = allData["data"];
308
				var myData = allData["data"];
313
				
309
				//拿到收到咨询数据
310
				$("#workContainer .workselectitem").remove();
314
				if(myData.length != 0 &&  myData.length != null){
311
				if(myData.length != 0 &&  myData.length != null){
315
					consultStr = handleData(myData,"professorId","lookBtn");
312
					consultStr = handleData(myData,"professorId","lookBtn");
316

313

317
					$("#workContainer").prepend(consultStr);
314
					$("#workContainer").prepend(consultStr);
318

315

319
					
320
					if(isbind == true){
321
						$(".getConsultPage").createPage({
322
					        pageCount:Math.ceil(allData.total/pageSize),
323
					        current:allData.pageNo,
324
					        backFn:function(p){
325
					        	getConsultData(url,pageSize,p,false,status,timeType,sortType);
326
					        }
327
					    });
328
					}
329
					
330
				}else{
316
				}else{
331
					return false;
317
					return false;
332
				}	
318
				}
319
				//分页
320
				if(isbind == true){
321
					$(".getConsultPage").createPage({
322
				        pageCount:Math.ceil(allData.total/pageSize),
323
				        current:allData.pageNo,
324
				        backFn:function(p){
325
				        	getConsultData(url,pageSize,p,false,status,timeType,sortType);
326
				        }
327
				    });
328
				}
333
			}
329
			}
334
			
330
			
335
		},
331
		},

+ 8 - 115
src/main/webapp/js/information.brow.js

604
		
604
		
605
	};
605
	};
606
	
606
	
607
	
608
	
609
	
610

607

611

608

612
	
613

614
	//===============点击咨询==============
609
	//===============点击咨询==============
615
	var userid = $.cookie("userid");//登陆人id====重复代码
610
	var userid = $.cookie("userid");//登陆人id====重复代码
616
 	var professorId = GetQueryString("professorId");//专家id====重复代码
611
 	var professorId = GetQueryString("professorId");//专家id====重复代码
617
	//点击咨询
612
	//点击科研资源的咨询
618
 	$("#consultbtn").bind('click',consultHandler);	
613
 	$("#consultbtn").bind('click',consultHandler);	
619
	
614
	
620

615

621
 	
616
 	
622
	function consultHandler(){
617
	function consultHandler(){
623
		ConsultApply();
618
		ConsultApply();
624

625
		//点击的发送
619
		//点击的发送
626
		$("#sendConsultBtn").on("click",sendConsultHandler);
620
		$("#sendConsultBtn").click(function(){
621
			sendConsultHandler($(this).attr("proId"));
622
		});
627
		
623
		
628
		if(userid && userid != null && userid != "null"){
624
		if(userid && userid != null && userid != "null"){
629
			$.ajax({
630
				"url" :"/ajax/professor/editBaseInfo/"+professorId,
631
				"type" : "get",
632
				"data" : {"id":professorId},
633
				"contentType" : "application/x-www-form-urlencoded",
634
				"success" : function(response) {
635
					console.log(response);
636
					if (response.success) {
637
						var myData = response["data"];
638
						
639
						$("#professorName").html(myData["name"]);
640
						$("#professorTitle").html(myData["title"]);
641
						$("#profDepartment").html(myData["department"]);
642
						$("#profOrganization").html(myData["orgName"]);
643
						$("#profAdress").html(myData["address"]);
644
						$("#byConsultConut").html(myData["consultCount"]);
645
						//星级 
646
						var startConut = myData["starLevel"];
647
						for(var i = 0; i < startConut; i ++){
648
							$("#starLevel .evastar2").eq(i).addClass("addStar");
649
						}
650
						
651
						
652
						//是否认证
653
						if(myData["authentication"] == true){
654
							$("#proModify").removeClass("displayNone");
655
						}
656
						
657
						console.log(myData["hasHeadImage"]);
658
						//没有头像
659
						if(myData["hasHeadImage"] == 0){alert("wu")
660
							$("#prohead").attr("src","images/default-photo.jpg");
661
						}
662
						//有头像
663
						else {alert("you")
664
							$("#prohead").attr("src","images/head/"+myData["id"]+"_m.jpg");
665
						}
666
						
667

668
						
669

670
						
671
					} else {
672
						$.MsgBox.Alert("message","请登录");
673
					}
674
				},
675
				"complete":function(){
676
					
677
				}
678
			});
625
			concultProInfo(professorId);
626
			
627
		}else{
628
			$.MsgBox.Alert("message","请登录");
679
		}
629
		}
680
	};
630
	};
681
	
631
	
682
	var consultId;
683
	//发送咨询申请处理函数
684
	function sendConsultHandler(){
685
		var consult_type = $(".clicknow").text();//咨询类型
686
		var consult_title = $("#consultTitle").val();//咨询主题
687
		var consult_content = $("#consultContent").val();//咨询内容
688
		var consultStr = {
689
				"consultType":consult_type,
690
				"consultTitle":consult_title,
691
				"consultContant":consult_content,
692
				"professorId":professorId,
693
				"consultantId":userid
694
		};
695
		
696
		if(consult_type == ''){
697
			$.MsgBox.Alert("消息","请选择联系目的");
698
		}
699
		if(consult_title == ''){
700
			$.MsgBox.Alert("消息","请填写咨询目的");
701
		}
702
		if(consult_content == ''){
703
			$.MsgBox.Alert("消息","请填写咨询内容");
704
		}
705
		
706
		if(userid && userid != null && userid != "null" && consult_type != '' &&
707
				consult_title != '' && consult_content != ''
708
		){
709
			
710
			$.ajax({
711
				"url" :"/ajax/consult",
712
				"type" : "post",
713
				//传值:咨询类型、主题、内容、专家id、申请人id
714
				"data" : consultStr,				
715
				"contentType" : "application/x-www-form-urlencoded",
716
				"beforeSend":function(){/*console.log(this.data)*/},
717
				"dataType" : "json",
718
				"success" : function(response) {
719
					
720
					
721
					consultId = response.data;//咨询id
722
					
723
					
724
				},
725
				"error":function (){
726
					$.MsgBox.Alert("消息","咨询申请失败");
727
				},
728
				
729
				"complete":function(){
730
					//$(".consultapply").remove();
731
					$(".blackcover").remove();
732
					$("body").css("position","static");
733
					$.MsgBox.Alert("消息","咨询申请成功");
734
				},
735
			});
736
		}
737

738
	}
739

632

740

633

741
})
634
})

+ 47 - 106
src/main/webapp/js/search.js

103

103

104
							}
104
							}
105
							//找专家点击咨询
105
							//找专家点击咨询
106
							$(".onlyConsultbtn").bind("click",clickConsultFn);
107
							
106
							$(".onlyConsultbtn").bind("click",clickSeachProConsultHandler);
108
							
107
							
109
							if(isbind == true){
108
							if(isbind == true){
110
								$(".tcdPageCode").createPage({
109
								$(".tcdPageCode").createPage({
141
 								var add='<div class="item">'
140
 								var add='<div class="item">'
142
 			                    add+='<a class="resourcephoto" ><img src="" class="resourceImg remess" width="100%" height="100%" resourceId='+$da[i].resourceId+'></a>'
141
 			                    add+='<a class="resourcephoto" ><img src="" class="resourceImg remess" width="100%" height="100%" resourceId='+$da[i].resourceId+'></a>'
143
 			                    add+='<div class="synopsis">' 			                  
142
 			                    add+='<div class="synopsis">' 			                  
144
 			                     add+='<div><a class="resouname" href="">'+$da[i].resourceName+'</a></div>'
143
 			                     add+='<div class="cousultName"><a class="resouname" href="">'+$da[i].resourceName+'</a></div>'
145
 			                     if($da[i].professor.name){
144
 			                     if($da[i].professor.name){
146
 			                    	 add+='<div class="belongname">'+$da[i].professor.name+'<img class="modicon" src="images/rz.png" width="28" ></div>'  
145
 			                    	 add+='<div class="belongname">'+$da[i].professor.name+'<img class="modicon" src="images/rz.png" width="28" ></div>'  
147
 			                    		  } 			                   
146
 			                    		  } 			                   
195
 						}
194
 						}
196
 						
195
 						
197
 						//找资源中点击咨询
196
 						//找资源中点击咨询
198
						$(".consultbtn").bind("click",clickFindResourceConsult);
197
						$(".consultbtn").bind("click",clickResouceConsultHandler);
199
 					},				
198
 					},				
200
 				});	
199
 				});	
201
 			}
200
 			}
506
				});
505
				});
507
		});
506
		});
508
	 
507
	 
509
	
510
	 
508
	 
511
	 //找资源中咨询处理函数
512
	 function clickFindResourceConsult(){
513
			var professorId = $(this).attr("id");
514
			ConsultApply();
515
			
516
			
517
			if(userid && userid != null && userid != "null"){
518
				$.ajax({
519
					"url" :"/ajax/professor/"+ professorId,
520
					"type" : "get",
521
					"data" : {"professorId":professorId},
522
					"success" : function(response) {
523
						if (response.success) {
524
//							console.log(response);
525
							$("#professorName").text(response.data["name"]);
526
							$("#professorName").attr("professorId",response.data["id"]);
527
							$("#professorTitle").text(response.data["title"]);
528
							
529
							if(response.data["department"] == "" || response.data["department"] == null){
530
								$("#profOrganization").text(response.data["organization"]["name"]);
531
							}else{
532
								$("#profDepartment").text(response.data["department"]+",");
533
								$("#profOrganization").text(response.data["organization"]["name"]);
534
								
535
							}
536
							if(response.data["adress"] == "" || response.data["adress"] == null ){
537
								$("#adress").html("");
538
							}else{
539
								$("#profAdress").text(response.data["adress"]);
540
							}
541

542
							
543
						} else {
544
							return false;
545
						}
546
					},
547
					"error":function(error){
548
						$.MsgBox.Alert("message","咨询失败");
549
					}
550
				});
551
			}
552
			else{
553
				
554
				$.MsgBox.Alert("message","请登录");
555
			}
509
	 //找专家中 点击咨询处理函数
510
	 function clickSeachProConsultHandler (){
511
		 
512
		var professorId = $(this).attr("id");
513
		ConsultApply();
514
		//点击的发送
515
		$("#sendConsultBtn").click(function(){
516
			sendConsultHandler($(this).attr("proId"))
517
		});
518
		
519
		if(userid && userid != null && userid != "null"){
520
			concultProInfo(professorId);
556
			
521
			
557
			//点击的发送
558
			$("#sendConsultBtn").on("click",sendConsultHandler);
559
			$("ul.menucon").children().eq(1).addClass("clicknow");
560
			var consultTitleVal = $(this).parent().prev().find(".resouname").text();
561
			$("#consultTitle").val("关于"+consultTitleVal+"的咨询");
522
		}else {
523
			$.MsgBox.Alert("message","请登录");
524
		}
562
			
525
			
563
	};
564
	 
526
	 };
565
	 
527
	 
566
	 
528
	 
567
	// 点击咨询处理函数
568
	 function clickConsultFn(){
569
		 	ConsultApply();
570
//		 	$("#consultcontent").bind("keyup",limitFontCountFn);
571
			//点击的发送
572
			$("#sendConsultBtn").on("click",sendConsultHandler);
573
			var professorId = $(this).attr("id");
574
			
575
			if(userid && userid != null && userid != "null"){
576
				$.ajax({
577
					"url" :"/ajax/professor/"+ professorId,
578
					"type" : "get",
579
					"data" : {"professorId":professorId},
580
					"contentType" : "application/x-www-form-urlencoded",
581
					"success" : function(response) {
582
						if (response.success) {
583
//							console.log(response);
584
							$("#professorName").text(response.data["name"]);
585
							$("#professorName").attr("professorId",response.data["id"]);
586
							$("#professorTitle").text(response.data["title"]);
587
							
588
							if(response.data["department"] == "" || response.data["department"] == null){
589
								$("#profOrganization").text(response.data["organization"]["name"]);
590
							}else{
591
								$("#profDepartment").text(response.data["department"]+",");
592
								$("#profOrganization").text(response.data["organization"]["name"]);
593
								
594
							}
595
							if(response.data["adress"] == "" || response.data["adress"] == null ){
596
								$("#adress").html("");
597
							}else{
598
								$("#profAdress").text(response.data["adress"]);
599
							}
600

601
							
602
						} else {
603
							$.MsgBox.Alert("message","请登录");
604
						}
605
					}
606
				});
607
			}
608
			else{
609
				return false;
610
			}
529
	 //找资源中 点击咨询
530
	 function clickResouceConsultHandler(){
531
		var professorId = $(this).attr("id");
532
		ConsultApply();
533
		//默认选中资源咨询和标题
534
		$("ul.menucon").children().eq(1).addClass("clicknow");
535
		var consultTitleVal = $(this).parent().prev().find("a").text();
536
		console.log($(this).parent());
537
		console.log($(this).parent().prev());
538
		alert(consultTitleVal);
539
		$("#consultTitle").val("关于"+consultTitleVal+"的咨询");
540
		//点击的发送
541
		$("#sendConsultBtn").click(function(){
542
			sendConsultHandler($(this).attr("proId"));
543
		});
611
		
544
		
545
		if(userid && userid != null && userid != "null"){
546
			concultProInfo(professorId);
547

548
		}else {
549
			$.MsgBox.Alert("message","请登录");
550
		}
551
		 
612
	 };
552
	 };
553

613
	 
554
	 
614
	 function sendConsultHandler(){
615
		 	var professorId = $("#professorName").attr("professorId");
555
	/* function sendConsultHandler(){
556
		 	var professorId = $(this).attr("proId");
616
			var consult_type = $(".clicknow").text();//咨询类型
557
			var consult_type = $(".clicknow").text();//咨询类型
617
			var consult_title = $("#consultTitle").val();//咨询主题
558
			var consult_title = $("#consultTitle").val();//咨询主题
618
			var consult_content = $("#consultcontent").val();//咨询内容
559
			var consult_content = $("#consultcontent").val();//咨询内容
624
					"consultantId":userid
565
					"consultantId":userid
625
			};
566
			};
626
			
567
			
627
			/*if(consult_type == '' || consult_title == '' || consult_content == ''){
568
			if(consult_type == '' || consult_title == '' || consult_content == ''){
628
				$.MsgBox.Alert("message","请填写完整");
569
				$.MsgBox.Alert("message","请填写完整");
629
			};*/
570
			};
630
			if(consult_type == ''){
571
			if(consult_type == ''){
631
				$.MsgBox.Alert("消息","请选择联系目的");
572
				$.MsgBox.Alert("消息","请选择联系目的");
632
			}
573
			}
666
				});
607
				});
667
			}
608
			}
668

609

669
		}
610
		}*/
670
	 
611
	 
671
	 
612
	 
672
});
613
});