jack 7 jaren geleden
bovenliggende
commit
6a0484c71a
1 gewijzigde bestanden met toevoegingen van 151 en 3 verwijderingen
  1. 151 3
      app/js/patentShow.js

+ 151 - 3
app/js/patentShow.js

@ -249,6 +249,7 @@ mui.plusReady(function() {
249 249
		userid = plus.storage.getItem('userid');
250 250
		getRecourceMe();
251 251
		ifcollectionAbout(patentId,4);
252
		isAgree();
252 253
	});
253 254
	function leadIn(sel) {
254 255
		mui.ajax(baseUrl + "/ajax/ppatent/ass", {
@ -656,7 +657,7 @@ mui.plusReady(function() {
656 657
			}
657 658
		},
658 659
		error: function() {
659
			$.MsgBox.Alert('提示',"服务器链接超时");
660
			plus.nativeUI.toast("服务器链接超时", toastStyle);
660 661
		}
661 662
	});
662 663
}
@ -681,7 +682,7 @@ function isAgree() {
681 682
			}
682 683
		},
683 684
		error: function() {
684
			$.MsgBox.Alert('提示',"服务器链接超时");
685
			plus.nativeUI.toast("服务器链接超时", toastStyle);
685 686
		}
686 687
	});
687 688
}
@ -706,8 +707,155 @@ function addAgree() {
706 707
			}
707 708
		},
708 709
		error: function() {
709
			$.MsgBox.Alert('提示',"服务器链接超时");
710
			plus.nativeUI.toast("服务器链接超时", toastStyle);
710 711
		}
711 712
	});
712 713
}
714
mui(".artfoot").on("tap", ".inputShow", function() {
715
		if(!isLogin) {
716
			document.getElementById("textInput").style.display = "block";
717
			document.getElementById("operCol").style.display = "none";
718
			document.getElementById("textInputThis").focus();
719
		}
720
		
721
	})
722
leword();
723
724
function leword() {
725
		var data = {"patentId": patentId,"rows": 500}	
726
		mui.ajax(baseUrl + "/ajax/leaveWord/ql/patent", {
727
			data: obj,
728
			dataType: 'json', //服务器返回json格式数据
729
			type: 'get', //HTTP请求类型
730
			timeout: 10000, //超时时间设置为10秒;
731
			traditional: true,
732
			success: function(data) {
733
				console.log(JSON.stringify(data))
734
				if(data.success) {
735
					document.getElementsByClassName('commentBlock')[0].innerHTML = ""
736
					if(data.data.length == 0) {
737
						return;
738
					}
739
					var id = plus.storage.getItem('userid');
740
					for(var i = 0; i < data.data.length; i++) {
741
						var oText = ""
742
						if(id == data.data[i].professor.id) {
743
							oText = "删除"
744
						}
745
						var userType = autho(data.data[i].professor.authType, data.data[i].professor.orgAuth, data.data[i].professor.authStatus);
746
						var baImg = "../images/default-photo.jpg";
747
						if(data.data[i].professor.hasHeadImage == 1) {
748
							baImg = baseUrl + "/images/head/" + data.data[i].professor.id + "_l.jpg";
749
						}
750
						var li = document.createElement("li");
751
						li.className = "mui-table-view-cell";
752
						li.innerHTML = '<div class="flexCenter mui-clearfix">' +
753
							'<div class="madiaHead useHead" style="background-image:url(' + baImg + ')" data-id="' + data.data[i].professor.id + '"></div>' +
754
							'<div class="madiaInfo">' +
755
							'<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>' +
756
							'</div>' +
757
							'</div>' +
758
							'<div class="madiaInfo">' +
759
							'<p class="h2Font">' + data.data[i].content + '</p>' +
760
							'<p class="operateSpan">' +
761
							'<span class="commenttime">' + commenTime(data.data[i].createTime) + '</span>' +
762
							'<span data-id="' + data.data[i].id + '" class="dele">' + oText + '</span>' +
763
							'</p>' +
764
							'</div>'
765
						document.getElementsByClassName("commentBlock")[0].appendChild(li);
766
					}
767
768
				} else {
769
				}
770
			},
771
			error: function(xhr, type, errorThrown) {
772
				//异常处理;
773
				plus.nativeUI.toast("服务器链接超时", toastStyle);
774
			}
775
		});
776
}
777
lewordNum();
778
function lewordNum() {
779
		var data = {"patentId": patentId}	
780
		mui.ajax(baseUrl + "/ajax/leaveWord/lwCount/patent", {
781
			data: obj,
782
			dataType: 'json', //服务器返回json格式数据
783
			type: 'get', //HTTP请求类型
784
			timeout: 10000, //超时时间设置为10秒;
785
			traditional: true,
786
			success: function(data) {
787
				if(data.success) {
788
					document.getElementsByClassName("mui-badge")[0].innerHTML=data.data;
789
					}
790
791
				
792
			},
793
			error: function(xhr, type, errorThrown) {
794
				//异常处理;
795
				plus.nativeUI.toast("服务器链接超时", toastStyle);
796
			}
797
		});
798
}
799
function trim(str) { //删除左右两端的空格
800
		  
801
		return str.replace(/(^\s*)|(\s*$)/g, "");  
802
	}
803
document.getElementById("textInputThis").addEventListener("input", function() {
804
		var length = trim(this.value);
805
		if(length) {
806
			document.getElementsByClassName("mui-btn")[0].removeAttribute("disabled")
807
		} else {
808
			document.getElementsByClassName("mui-btn")[0].setAttribute("disabled", "true")
809
		}
810
	})
811
document.getElementsByClassName("mui-btn")[0].addEventListener("tap", function() {
812
		mui.ajax(baseUrl + "/ajax/leaveWord/patent", {
813
			data: {
814
				"patentId": patentId,
815
				"sender": plus.storage.getItem('userid'),
816
				"content": document.getElementById("textInputThis").value
817
			},
818
			dataType: 'json', //服务器返回json格式数据
819
			type: 'post', //HTTP请求类型
820
			timeout: 10000, //超时时间设置为10秒;
821
			success: function(data) {
822
				if(data.success) {
823
					document.getElementById("textInputThis").value = "";
824
					document.getElementById('textInput').style.display = "none";
825
					document.getElementById('operCol').style.display = "block";
826
					leword();
827
					lewordNum();
828
				}
829
			},
830
			error: function(xhr, type, errorThrown) {
831
				//异常处理;
832
				plus.nativeUI.toast("服务器链接超时", toastStyle);
833
			},
834
			beforeSend: function(data) {
835
				console.log(JSON.stringify(data));
836
			}
837
		});
838
	})
839
mui(".commentBlock").on("tap", ".dele", function() {
840
		var $this = this;
841
		mui.ajax(baseUrl + "/ajax/leaveWord/delete", {
842
			data: {
843
				"id": this.getAttribute("data-id"),
844
			},
845
			dataType: 'json', //服务器返回json格式数据
846
			type: 'post', //HTTP请求类型
847
			timeout: 10000, //超时时间设置为10秒;
848
			success: function(data) {
849
				if(data.success) {
850
					document.getElementsByClassName("commentBlock")[0].removeChild($this.parentNode.parentNode.parentNode);
851
					leword();
852
					lewordNum();
853
				}
854
			},
855
			error: function(xhr, type, errorThrown) {
856
				//异常处理;
857
				plus.nativeUI.toast("服务器链接超时", toastStyle);
858
			}
859
		});
860
	})
713 861
});