jack 7 years ago
parent
commit
700af9a2df
1 changed files with 35 additions and 17 deletions
  1. 35 17
      js/paperShow.js

+ 35 - 17
js/paperShow.js

@ -326,25 +326,46 @@ $(document).ready(function() {
326 326
		var weibotitle = $da.name;
327 327
		var weibourl = window.location.href;
328 328
		$("#weibo").attr("href","http://service.weibo.com/share/share.php?appkey=3677230589&title="+encodeURIComponent(weibotitle)+"&url="+encodeURIComponent(weibourl)+"&pic="+encodeURIComponent(weibopic)+"&content=utf-8"+"&ralateUid=6242830109&searchPic=false&style=simple");
329
		if(userid) {
330
			isAgree($da.articleAgree) //文章点赞
331
		} else {
332
			$(".thumbBtn").html("赞 <span>" + $da.articleAgree + "</span>");
333
		}
334 329
	}
330
	isAgreeNum()
331
	function isAgreeNum() {
332
	var data = {"id": paperId}
333
	$.ajax({	.ajax({		
334
		url:"/ajax/ppaper/agreeCount",
335
		data:data,
336
		dataType: 'json', //数据格式类型
337
		type: 'get', //http请求类型
338
		timeout: 10000,
339
		async: true,
340
		success: function(data) {
341
			if(data.success){
342
				if(userid && userid != "null" && userid != null) {
343
					alert(1);
344
					isAgree(data.data) //文章点赞
345
				} else {
346
					alert(2)
347
					$(".thumbBtn").html("赞 <span>" + data.data + "</span>");
348
				}
349
			}
350
		},
351
		error: function() {
352
			$.MsgBox.Alert('提示',"服务器链接超时");
353
		}
354
	});
355
}
335 356
	/*判断论文是否被赞*/
336 357
function isAgree(articleAgree) {
337
	var data = {"operateId": userid,"paperId": paperId}
358
	var data = {"id": userid,"uid": paperId}
338 359
	$.ajax({		
339
		url:"/ajax/paper/isAgree",
360
		url:"/ajax/ppaper/agree",
340 361
		data:data,
341 362
		dataType: 'json', //数据格式类型
342 363
		type: 'get', //http请求类型
343 364
		timeout: 10000,
344
		async: false,
365
		async: true,
345 366
		success: function(data) {
346 367
			if(data.success){
347
				if(data.data!= null){
368
				if(data.data){
348 369
					$(".thumbBtn").html("已赞 <span>"+articleAgree+"</span>");
349 370
					$(".thumbBtn").addClass("thumbedBtn");
350 371
				}else{
@ -360,10 +381,7 @@ function isAgree(articleAgree) {
360 381
}
361 382
//论文点击点赞
362 383
$('.thumbBlock').on("click",".thunbgo",function(){
363
	alert(1);
364
	console.log(userid);
365
	if (userid) {
366
		alert(2)
384
	if (userid && userid != "null" && userid != null) {
367 385
		addAgree();
368 386
	}else{
369 387
		$.MsgBox.Alert('提示',"请先登录再进行点赞");
@ -383,14 +401,14 @@ $('.thumbBlock').on("click",".thunbgo",function(){
383 401
})
384 402
/*点赞*/
385 403
function addAgree() {
386
	var data = {"operateId": userid,"paperId": paperId}
404
	var data = {"uid": userid,"id": paperId}
387 405
	$.ajax({		
388
		url:"/ajax/paper/agree",
406
		url:"/ajax/ppaper/agree",
389 407
		data:data,
390 408
		dataType: 'json', //数据格式类型
391 409
		type: 'POST', //http请求类型
392 410
		timeout: 10000,
393
		async: false,
411
		async: true,
394 412
		success: function(data) {
395 413
			if(data.success){
396 414
				var articleAgreeval = $(".thumbBtn span").text();
@ -577,7 +595,7 @@ function articledel(commenid) {
577 595
							$itemlist = $(itemlist);
578 596
							$("#patentList").append($itemlist);
579 597
						}
580
							
598
					}		
581 599
				}
582 600
			},
583 601
			"error":function(){