jack 7 years ago
parent
commit
75764a035c
2 changed files with 70 additions and 1 deletions
  1. 1 1
      app/html/patentShow.html
  2. 69 0
      app/js/patentShow.js

+ 1 - 1
app/html/patentShow.html

@ -34,7 +34,7 @@
34 34
					<div class="inputShow"><span>说点什么吧…</span></div>
35 35
				</div>
36 36
				<div class="mui-col-xs-1" id="listenClick">
37
					<span class="mui-icon iconfontnew icon-liuyan"><em class="mui-badge"></em></span>
37
					<span class="mui-icon iconfontnew icon-liuyan"><em class="mui-badge">0</em></span>
38 38
				</div>
39 39
				<div class="mui-col-xs-2" id="collectBtn">
40 40
					<span class="mui-icon iconfontnew icon-shoucang" id="ifCollect"></span><!--已收藏 icon-yishoucang-->

+ 69 - 0
app/js/patentShow.js

@ -641,4 +641,73 @@ mui.plusReady(function() {
641 641
		})
642 642
		})
643 643
	}
644
	isAgreeNum()
645
	function isAgreeNum() {
646
	var data = {"id": patentId}
647
	mui.ajax(baseUrl+"/ajax/ppatent/agreeCount",{		
648
		data:data,
649
		dataType: 'json', //数据格式类型
650
		type: 'get', //http请求类型
651
		timeout: 10000,
652
		async: true,
653
		success: function(data) {
654
			if(data.success){
655
					document.getElementById("snum").innerHTML=data.data;
656
			}
657
		},
658
		error: function() {
659
			$.MsgBox.Alert('提示',"服务器链接超时");
660
		}
661
	});
662
}
663
	if(userid && userid != "null" && userid != null) {
664
					isAgree() //文章点赞
665
				} 
666
	/*判断论文是否被赞*/
667
function isAgree() {
668
	var data = {"id": patentId,"uid":userid }
669
	mui.ajax({		
670
		url:"/ajax/ppatent/agree",
671
		data:data,
672
		dataType: 'json', //数据格式类型
673
		type: 'get', //http请求类型
674
		timeout: 10000,
675
		async: true,
676
		success: function(data) {
677
			if(data.success){
678
				if(data.data){
679
					document.getElementsByClassName("thumbBtn")[0].classList.add("thumbedBtn");
680
				}
681
			}
682
		},
683
		error: function() {
684
			$.MsgBox.Alert('提示',"服务器链接超时");
685
		}
686
	});
687
}
688
$('.thumbBlock').on("click",".thunbgo",function(){
689
	if (!isLogin) {
690
		addAgree();
691
	}
692
})
693
/*点赞*/
694
function addAgree() {
695
	var data = {"uid": userid,"id": patentId}
696
	mui.ajax(baseUrl+"/ajax/ppatent/agree",{		
697
		data:data,
698
		dataType: 'json', //数据格式类型
699
		type: 'POST', //http请求类型
700
		timeout: 10000,
701
		async: true,
702
		success: function(data) {
703
			if(data.success){
704
			document.getElementById("snum").innerHTML = Number(document.getElementById("snum").innerHTML) + 1;
705
			document.getElementsByClassName("thumbBtn")[0].classList.add("thumbedBtn");
706
			}
707
		},
708
		error: function() {
709
			$.MsgBox.Alert('提示',"服务器链接超时");
710
		}
711
	});
712
}
644 713
});