|
@ -669,4 +669,313 @@ mui.plusReady(function() {
|
669
|
669
|
document.getElementById("operCol").style.display = "none";
|
670
|
670
|
document.getElementById("textInputThis").focus();
|
671
|
671
|
})
|
|
672
|
isAgreeNum()
|
|
673
|
function isAgreeNum() {
|
|
674
|
var data = {"id": paperId}
|
|
675
|
mui.ajax(baseUrl+"/ajax/ppaper/agreeCount",{
|
|
676
|
data:data,
|
|
677
|
dataType: 'json', //数据格式类型
|
|
678
|
type: 'get', //http请求类型
|
|
679
|
timeout: 10000,
|
|
680
|
async: true,
|
|
681
|
success: function(data) {
|
|
682
|
if(data.success){
|
|
683
|
document.getElementById("snum").innerHTML=data.data;
|
|
684
|
}
|
|
685
|
},
|
|
686
|
error: function() {
|
|
687
|
plus.nativeUI.toast("服务器链接超时", toastStyle);
|
|
688
|
}
|
|
689
|
});
|
|
690
|
}
|
|
691
|
if(userid && userid != "null" && userid != null) {
|
|
692
|
isAgree() //文章点赞
|
|
693
|
}
|
|
694
|
/*判断论文是否被赞*/
|
|
695
|
function isAgree() {
|
|
696
|
var data = {"id": paperId,"uid":userid }
|
|
697
|
mui.ajax(baseUrl+"/ajax/ppaper/agree",{
|
|
698
|
data:data,
|
|
699
|
dataType: 'json', //数据格式类型
|
|
700
|
type: 'get', //http请求类型
|
|
701
|
timeout: 10000,
|
|
702
|
async: true,
|
|
703
|
success: function(data) {
|
|
704
|
if(data.success){
|
|
705
|
if(data.data){
|
|
706
|
document.getElementsByClassName("thumbBtn")[0].classList.add("thumbedBtn");
|
|
707
|
}
|
|
708
|
}
|
|
709
|
},
|
|
710
|
error: function() {
|
|
711
|
plus.nativeUI.toast("服务器链接超时", toastStyle);
|
|
712
|
}
|
|
713
|
});
|
|
714
|
}
|
|
715
|
mui('.thumbBlock').on("tap",".thumbBtn",function(){
|
|
716
|
if (!isLogin()) {
|
|
717
|
if(this.className=="thumbBtn thumbedBtn"){
|
|
718
|
return;
|
|
719
|
}
|
|
720
|
addAgree();
|
|
721
|
}
|
|
722
|
})
|
|
723
|
/*点赞*/
|
|
724
|
function addAgree() {
|
|
725
|
var data = {"uid": userid,"id": paperId}
|
|
726
|
mui.ajax(baseUrl+"/ajax/ppaper/agree",{
|
|
727
|
data:data,
|
|
728
|
dataType: 'json', //数据格式类型
|
|
729
|
type: 'POST', //http请求类型
|
|
730
|
timeout: 10000,
|
|
731
|
async: true,
|
|
732
|
success: function(data) {
|
|
733
|
if(data.success){
|
|
734
|
document.getElementById("snum").innerHTML = Number(document.getElementById("snum").innerHTML) + 1;
|
|
735
|
document.getElementsByClassName("thumbBtn")[0].classList.add("thumbedBtn");
|
|
736
|
}
|
|
737
|
},
|
|
738
|
error: function() {
|
|
739
|
plus.nativeUI.toast("服务器链接超时", toastStyle);
|
|
740
|
}
|
|
741
|
});
|
|
742
|
}
|
|
743
|
mui(".artfoot").on("tap", ".inputShow", function() {
|
|
744
|
|
|
745
|
if(!isLogin()) {
|
|
746
|
document.getElementById("textInput").style.display = "block";
|
|
747
|
document.getElementById("operCol").style.display = "none";
|
|
748
|
document.getElementById("textInputThis").focus();
|
|
749
|
}
|
|
750
|
|
|
751
|
})
|
|
752
|
leword();
|
|
753
|
|
|
754
|
function leword() {
|
|
755
|
var data = {"paperId": paperId,"rows": 500}
|
|
756
|
mui.ajax(baseUrl + "/ajax/leaveWord/ql/paper", {
|
|
757
|
data: data,
|
|
758
|
dataType: 'json', //服务器返回json格式数据
|
|
759
|
type: 'get', //HTTP请求类型
|
|
760
|
timeout: 10000, //超时时间设置为10秒;
|
|
761
|
traditional: true,
|
|
762
|
success: function(data) {
|
|
763
|
if(data.success) {
|
|
764
|
document.getElementsByClassName('commentBlock')[0].innerHTML = ""
|
|
765
|
if(data.data.length == 0) {
|
|
766
|
return;
|
|
767
|
}
|
|
768
|
var id = plus.storage.getItem('userid');
|
|
769
|
for(var i = 0; i < data.data.length; i++) {
|
|
770
|
var oText = ""
|
|
771
|
if(id == data.data[i].professor.id) {
|
|
772
|
oText = "删除"
|
|
773
|
}
|
|
774
|
var userType = autho(data.data[i].professor.authType, data.data[i].professor.orgAuth, data.data[i].professor.authStatus);
|
|
775
|
var baImg = "../images/default-photo.jpg";
|
|
776
|
if(data.data[i].professor.hasHeadImage == 1) {
|
|
777
|
baImg = baseUrl + "/images/head/" + data.data[i].professor.id + "_l.jpg";
|
|
778
|
}
|
|
779
|
var li = document.createElement("li");
|
|
780
|
li.className = "mui-table-view-cell";
|
|
781
|
li.innerHTML = '<div class="flexCenter mui-clearfix">' +
|
|
782
|
'<div class="madiaHead useHead" style="background-image:url(' + baImg + ')" data-id="' + data.data[i].professor.id + '"></div>' +
|
|
783
|
'<div class="madiaInfo">' +
|
|
784
|
'<p><span class="h1Font" data-id="' + data.data[i].professor.id + '">' + data.data[i].professor.name + '</span><em class="authicon ' + userType.sty + '" title="科袖认证专家"></em></p>' +
|
|
785
|
'</div>' +
|
|
786
|
'</div>' +
|
|
787
|
'<div class="madiaInfo">' +
|
|
788
|
'<p class="h2Font">' + data.data[i].content + '</p>' +
|
|
789
|
'<p class="operateSpan">' +
|
|
790
|
'<span class="commenttime">' + commenTime(data.data[i].createTime) + '</span>' +
|
|
791
|
'<span data-id="' + data.data[i].id + '" class="dele">' + oText + '</span>' +
|
|
792
|
'</p>' +
|
|
793
|
'</div>'
|
|
794
|
document.getElementsByClassName("commentBlock")[0].appendChild(li);
|
|
795
|
}
|
|
796
|
|
|
797
|
} else {
|
|
798
|
}
|
|
799
|
},
|
|
800
|
error: function(xhr, type, errorThrown) {
|
|
801
|
//异常处理;
|
|
802
|
plus.nativeUI.toast("服务器链接超时", toastStyle);
|
|
803
|
}
|
|
804
|
});
|
|
805
|
}
|
|
806
|
lewordNum();
|
|
807
|
function lewordNum() {
|
|
808
|
var data = {"paperId": paperId}
|
|
809
|
mui.ajax(baseUrl + "/ajax/leaveWord/lwCount/paper", {
|
|
810
|
data: data,
|
|
811
|
dataType: 'json', //服务器返回json格式数据
|
|
812
|
type: 'get', //HTTP请求类型
|
|
813
|
timeout: 10000, //超时时间设置为10秒;
|
|
814
|
traditional: true,
|
|
815
|
success: function(data) {
|
|
816
|
if(data.success) {
|
|
817
|
document.getElementsByClassName("mui-badge")[0].innerHTML=data.data;
|
|
818
|
}
|
|
819
|
|
|
820
|
|
|
821
|
},
|
|
822
|
error: function(xhr, type, errorThrown) {
|
|
823
|
//异常处理;
|
|
824
|
plus.nativeUI.toast("服务器链接超时", toastStyle);
|
|
825
|
}
|
|
826
|
});
|
|
827
|
}
|
|
828
|
function trim(str) { //删除左右两端的空格
|
|
829
|
|
|
830
|
return str.replace(/(^\s*)|(\s*$)/g, "");
|
|
831
|
}
|
|
832
|
document.getElementById("textInputThis").addEventListener("input", function() {
|
|
833
|
var length = trim(this.value);
|
|
834
|
if(length) {
|
|
835
|
document.getElementsByClassName("mui-btn")[0].removeAttribute("disabled")
|
|
836
|
} else {
|
|
837
|
document.getElementsByClassName("mui-btn")[0].setAttribute("disabled", "true")
|
|
838
|
}
|
|
839
|
})
|
|
840
|
document.getElementsByClassName("mui-btn")[0].addEventListener("tap", function() {
|
|
841
|
mui.ajax(baseUrl + "/ajax/leaveWord/paper", {
|
|
842
|
data: {
|
|
843
|
"paperId": paperId,
|
|
844
|
"sender": plus.storage.getItem('userid'),
|
|
845
|
"content": document.getElementById("textInputThis").value
|
|
846
|
},
|
|
847
|
dataType: 'json', //服务器返回json格式数据
|
|
848
|
type: 'post', //HTTP请求类型
|
|
849
|
timeout: 10000, //超时时间设置为10秒;
|
|
850
|
success: function(data) {
|
|
851
|
if(data.success) {
|
|
852
|
document.getElementById("textInputThis").value = "";
|
|
853
|
document.getElementById('textInput').style.display = "none";
|
|
854
|
document.getElementById('operCol').style.display = "block";
|
|
855
|
leword();
|
|
856
|
lewordNum();
|
|
857
|
}
|
|
858
|
},
|
|
859
|
error: function() {
|
|
860
|
//异常处理;
|
|
861
|
plus.nativeUI.toast("服务器链接超时", toastStyle);
|
|
862
|
}
|
|
863
|
});
|
|
864
|
})
|
|
865
|
mui(".commentBlock").on("tap", ".dele", function() {
|
|
866
|
var $this = this;
|
|
867
|
mui.ajax(baseUrl + "/ajax/leaveWord/delete", {
|
|
868
|
data: {
|
|
869
|
"id": this.getAttribute("data-id"),
|
|
870
|
},
|
|
871
|
dataType: 'json', //服务器返回json格式数据
|
|
872
|
type: 'post', //HTTP请求类型
|
|
873
|
timeout: 10000, //超时时间设置为10秒;
|
|
874
|
success: function(data) {
|
|
875
|
if(data.success) {
|
|
876
|
document.getElementsByClassName("commentBlock")[0].removeChild($this.parentNode.parentNode.parentNode);
|
|
877
|
leword();
|
|
878
|
lewordNum();
|
|
879
|
}
|
|
880
|
},
|
|
881
|
error: function(xhr, type, errorThrown) {
|
|
882
|
//异常处理;
|
|
883
|
plus.nativeUI.toast("服务器链接超时", toastStyle);
|
|
884
|
}
|
|
885
|
});
|
|
886
|
})
|
|
887
|
mui('.commentBlock').on('tap', '.useHead,.h1Font', function() {
|
|
888
|
var id = this.getAttribute("data-id");
|
|
889
|
plus.nativeUI.showWaiting(); //显示原生等待框
|
|
890
|
plus.webview.create("../html/userInforShow.html", 'userInforShow.html', {}, {
|
|
891
|
proid: id
|
|
892
|
});
|
|
893
|
})
|
|
894
|
//您可能感兴趣的论文
|
|
895
|
paperInterestingList()
|
|
896
|
function paperInterestingList(){
|
|
897
|
mui.ajax(baseUrl+"/ajax/ppaper/ralatePapers",{
|
|
898
|
"type" : "GET" ,
|
|
899
|
"dataType" : "json",
|
|
900
|
"data" :{
|
|
901
|
"paperId":paperId
|
|
902
|
},
|
|
903
|
"traditional": true, //传数组必须加这个
|
|
904
|
"success" : function(data) {
|
|
905
|
if(data.success) {
|
|
906
|
console.log(data);
|
|
907
|
var $data = data.data;
|
|
908
|
if($data.length > 0){
|
|
909
|
document.getElementById("paperModule").style.display="block";
|
|
910
|
for(var i = 0; i < $data.length; i++) {
|
|
911
|
var li = document.createElement("li");
|
|
912
|
li.setAttribute("data-id", $data[i].id);
|
|
913
|
li.className = "mui-table-view-cell";
|
|
914
|
li.innerHTML = '<div class="flexCenter OflexCenter mui-clearfix">' +
|
|
915
|
'<div class="madiaHead paperHead"></div>' +
|
|
916
|
'<div class="madiaInfo OmadiaInfo">' +
|
|
917
|
'<p class="mui-ellipsis h1Font">' + $data[i].name + '</p>' +
|
|
918
|
'<p class="mui-ellipsis h2Font">' + $data[i].authors.substring(0, $data[i].authors.length - 1) + '</p>' +
|
|
919
|
'</div>' +
|
|
920
|
'</div>'
|
|
921
|
document.getElementById("paperList").appendChild(li);
|
|
922
|
}
|
|
923
|
}
|
|
924
|
}
|
|
925
|
},
|
|
926
|
"error":function(){
|
|
927
|
plus.nativeUI.toast("服务器链接超时", toastStyle);
|
|
928
|
}
|
|
929
|
});
|
|
930
|
}
|
|
931
|
//根据关键词查询查找相关专利
|
|
932
|
function patentRelatedList(array){
|
|
933
|
mui.ajax(baseUrl+"/ajax/ppatent/assPatents",{
|
|
934
|
"type" : "GET" ,
|
|
935
|
"dataType" : "json",
|
|
936
|
"data" :{
|
|
937
|
"kws":array
|
|
938
|
},
|
|
939
|
"traditional": true, //传数组必须加这个
|
|
940
|
"success" : function(data) {
|
|
941
|
if(data.success) {
|
|
942
|
console.log(data);
|
|
943
|
var $data = data.data;
|
|
944
|
if($data.length > 0){
|
|
945
|
document.getElementById("paperModule").style.display="block";
|
|
946
|
for(var i = 0; i < $data.length; i++) {
|
|
947
|
var li = document.createElement("li");
|
|
948
|
li.setAttribute("data-id", $data[i].id);
|
|
949
|
li.className = "mui-table-view-cell";
|
|
950
|
li.innerHTML = '<div class="flexCenter OflexCenter mui-clearfix">' +
|
|
951
|
'<div class="madiaHead patentHead"></div>' +
|
|
952
|
'<div class="madiaInfo OmadiaInfo">' +
|
|
953
|
'<p class="mui-ellipsis h1Font">' + $data[i].name + '</p>' +
|
|
954
|
'<p class="mui-ellipsis h2Font">作者:' + $data[i].authors.substring(0, $data[i].authors.length - 1) + '</p>' +
|
|
955
|
'</div>' +
|
|
956
|
'</div>'
|
|
957
|
document.getElementById("patentList").appendChild(li);
|
|
958
|
}
|
|
959
|
}
|
|
960
|
}
|
|
961
|
},
|
|
962
|
"error":function(){
|
|
963
|
plus.nativeUI.toast("服务器链接超时", toastStyle);
|
|
964
|
}
|
|
965
|
});
|
|
966
|
}
|
|
967
|
mui("#paperList").on("tap", "li", function() {
|
|
968
|
var id = this.getAttribute("data-id");
|
|
969
|
plus.nativeUI.showWaiting();
|
|
970
|
plus.webview.create("../html/paperShow.html", 'paperShow.html', {}, {
|
|
971
|
"paperId": id
|
|
972
|
});
|
|
973
|
})
|
|
974
|
mui("#patentList").on("tap", "li", function() {
|
|
975
|
var id = this.getAttribute("data-id");
|
|
976
|
plus.nativeUI.showWaiting();
|
|
977
|
plus.webview.create("../html/patentShow.html", 'patentShow.html', {}, {
|
|
978
|
"patentId": id
|
|
979
|
});
|
|
980
|
})
|
672
|
981
|
});
|