Browse Source

论文专利关注

luyanan 7 years ago
parent
commit
8f721f474e
4 changed files with 160 additions and 7 deletions
  1. 1 1
      js/information.js
  2. 79 3
      js/paperShow.js
  3. 79 2
      js/patentShow.js
  4. 1 1
      js/userInforShow.js

+ 1 - 1
js/information.js

@ -809,7 +809,7 @@ $(function() {
809 809
					}
810 810
				}
811 811
				var string ='<li>'
812
				string += ' <div class="showBx"><div class="h4Font h4tit">' + data[i].company + '-' + data[i].title + '' + dep + '<small class="h6Font">';
812
				string += ' <div class="showBx"><div class="h4Font h4tit">' + data[i].company + '-' + dep + '' + data[i].title + '<small class="h6Font">';
813 813
					string += sDate;
814 814
					if(eDate) string += (" - " + eDate);
815 815
					string += '</small><em class="btnClick exitlist">编辑</em></div></div>';

+ 79 - 3
js/paperShow.js

@ -58,9 +58,9 @@ $(document).ready(function() {
58 58
		var pId=$(this).parent().siblings("a").attr("data-id");
59 59
		if(userid && userid != null && userid != "null") {
60 60
			if($(this).is('.attenedSpan')){
61
				cancelCollectionAbout(pId, 1)
61
				cancelCollectionAboutP(pId,$(this))
62 62
			} else {
63
				collectionAbout(pId, 1);
63
				collectionAboutP(pId,$(this));
64 64
			}
65 65
		}else{
66 66
			$.MsgBox.Alert("提示", "请先登录再进行关注");
@ -175,7 +175,7 @@ $(document).ready(function() {
175 175
											var $str=$(str);
176 176
											$("#aboutAuthors .lastBtn").before($str);
177 177
											if(showPro.id!=userid){
178
												ifcollectionAbout(showPro.id, 1)
178
												ifcollectionAboutP(showPro.id,$str.find(".attenSpan"));
179 179
											}
180 180
										}
181 181
									}
@ -377,4 +377,80 @@ $(document).ready(function() {
377 377
	})
378 378
	
379 379
	
380
	/*判断是否收藏资源文章或者是否关注专家*/
381
	function ifcollectionAboutP(watchObject, sel) {
382
		var that=sel;
383
		$.ajax('/ajax/watch/hasWatch', {
384
			data: {
385
				"professorId": userid,
386
				"watchObject": watchObject
387
			},
388
			dataType: 'json', //数据格式类型
389
			type: 'get', //http请求类型
390
			timeout: 10000,
391
			async: false,
392
			success: function(data) {
393
				if(data.success && data.data != null) {
394
						$(that).addClass("attenedSpan");
395
						$(that).text("已关注");
396
				} else {
397
						$(that).removeClass("attenedSpan");
398
						$(that).text("关注");
399
				}
400
			},
401
			error: function(data) {
402
				$.MsgBox.Alert('提示', "服务器链接超时");
403
			}
404
		});
405
	}
406
	/*收藏资源、文章或者关注专家*/
407
	function collectionAboutP(watchObject,sel) {
408
		var that=sel;
409
		$.ajax('/ajax/watch', {
410
			data: {
411
				"professorId": userid,
412
				"watchObject": watchObject
413
			},
414
			dataType: 'json', //数据格式类型
415
			type: 'POST', //http请求类型
416
			timeout: 10000,
417
			async: false,
418
			success: function(data) {
419
				if(data.success) {
420
					$(that).addClass("attenedSpan");
421
					$(that).text("已关注");
422
				}
423
			},
424
			error: function(data) {
425
				$.MsgBox.Alert('提示', "服务器链接超时");
426
			}
427
		});
428
	}
429
	/*取消收藏资源、文章或者取消关注专家*/
430
	function cancelCollectionAboutP(watchObject,sel) {
431
		var that=sel;
432
		$.ajax({
433
			url: '/ajax/watch/delete',
434
			data: {
435
				professorId: userid,
436
				watchObject: watchObject
437
			},
438
			dataType: 'json', //数据格式类型
439
			type: 'post', //http请求类型
440
			timeout: 10000,
441
			async: true,
442
			success: function(data) {
443
				console.log(data.success)
444
				if(data.success) {
445
					$(that).removeClass("attenedSpan");
446
					$(that).text("关注");
447
				}
448
			},
449
			error: function(data) {
450
				$.MsgBox.Alert('提示', "服务器链接超时");
451
			}
452
		});
453
	}
454
	
455
	
380 456
})

+ 79 - 2
js/patentShow.js

@ -246,7 +246,9 @@ $(document).ready(function() {
246 246
				 otr += '<div class="goSpan"><span class="attenSpan">关注</span></div>'
247 247
			}
248 248
			otr += '</li>'
249
			var $otr=$(otr);
249 250
		$("#faM .lastBtn").before(otr);
251
		ifcollectionAboutP(oId,$otr.find(".attenSpan"));
250 252
	}
251 253
	Patent.prototype.bindEvent = function($obj) {
252 254
		$("#faM").on("click", "li>a", function() {
@ -309,9 +311,9 @@ $(document).ready(function() {
309 311
			var pId=$(this).parent().siblings("a").attr("data-id");
310 312
			if(userid && userid != null && userid != "null") {
311 313
				if($(this).is('.attenedSpan')){
312
					cancelCollectionAbout(pId, 1)
314
					cancelCollectionAboutP(pId, $(this))
313 315
				} else {
314
					collectionAbout(pId, 1);
316
					collectionAboutP(pId, $(this));
315 317
				}
316 318
			}else{
317 319
				$.MsgBox.Alert("提示", "请先登录再进行关注");
@ -426,4 +428,79 @@ $(document).ready(function() {
426 428
		
427 429
	}
428 430
	
431
	/*判断是否收藏资源文章或者是否关注专家*/
432
	function ifcollectionAboutP(watchObject, sel) {
433
		var that=sel;
434
		$.ajax('/ajax/watch/hasWatch', {
435
			data: {
436
				"professorId": userid,
437
				"watchObject": watchObject
438
			},
439
			dataType: 'json', //数据格式类型
440
			type: 'get', //http请求类型
441
			timeout: 10000,
442
			async: false,
443
			success: function(data) {
444
				if(data.success && data.data != null) {
445
						$(that).addClass("attenedSpan");
446
						$(that).text("已关注");
447
				} else {
448
						$(that).removeClass("attenedSpan");
449
						$(that).text("关注");
450
				}
451
			},
452
			error: function(data) {
453
				$.MsgBox.Alert('提示', "服务器链接超时");
454
			}
455
		});
456
	}
457
	/*收藏资源、文章或者关注专家*/
458
	function collectionAboutP(watchObject,sel) {
459
		var that=sel;
460
		$.ajax('/ajax/watch', {
461
			data: {
462
				"professorId": userid,
463
				"watchObject": watchObject
464
			},
465
			dataType: 'json', //数据格式类型
466
			type: 'POST', //http请求类型
467
			timeout: 10000,
468
			async: false,
469
			success: function(data) {
470
				if(data.success) {
471
					$(that).addClass("attenedSpan");
472
					$(that).text("已关注");
473
				}
474
			},
475
			error: function(data) {
476
				$.MsgBox.Alert('提示', "服务器链接超时");
477
			}
478
		});
479
	}
480
	/*取消收藏资源、文章或者取消关注专家*/
481
	function cancelCollectionAboutP(watchObject,sel) {
482
		var that=sel;
483
		$.ajax({
484
			url: '/ajax/watch/delete',
485
			data: {
486
				professorId: userid,
487
				watchObject: watchObject
488
			},
489
			dataType: 'json', //数据格式类型
490
			type: 'post', //http请求类型
491
			timeout: 10000,
492
			async: true,
493
			success: function(data) {
494
				console.log(data.success)
495
				if(data.success) {
496
					$(that).removeClass("attenedSpan");
497
					$(that).text("关注");
498
				}
499
			},
500
			error: function(data) {
501
				$.MsgBox.Alert('提示', "服务器链接超时");
502
			}
503
		});
504
	}
505
	
429 506
})

+ 1 - 1
js/userInforShow.js

@ -406,7 +406,7 @@ $(function() {
406 406
					}
407 407
				}
408 408
				var JobHtml = '<li>';
409
				JobHtml += '<div class="h4Font h4tit">' + data[i].company + '-' + data[i].title + '' + dep + '<small class="h6Font">' + sDate + eDate + '</small></div>';
409
				JobHtml += '<div class="h4Font h4tit">' + data[i].company + '-' + dep + '' + data[i].title + '<small class="h6Font">' + sDate + eDate + '</small></div>';
410 410
				JobHtml += '</li>';
411 411
				$("#timeJobShow").append(JobHtml);
412 412
			}