jack 8 years ago
parent
commit
793684c6dd
1 changed files with 55 additions and 70 deletions
  1. 55 70
      app/js/articleShow.js

+ 55 - 70
app/js/articleShow.js

36
				console.log(JSON.stringify(data))
36
				console.log(JSON.stringify(data))
37
				if(data.success) {
37
				if(data.success) {
38
					/*if(af == 1) {*/
38
					/*if(af == 1) {*/
39
						document.getElementsByClassName('commentBlock')[0].innerHTML = ""
40
						if(data.data.length == 0) {
41
							//mui('#pullrefresh').pullRefresh().disablePullupToRefresh(true);
42
							return;
43
						}
39
					document.getElementsByClassName('commentBlock')[0].innerHTML = ""
40
					if(data.data.length == 0) {
41
						//mui('#pullrefresh').pullRefresh().disablePullupToRefresh(true);
42
						return;
43
					}
44
					/*} else {
44
					/*} else {
45
						if(data.data.length == 0) {
45
						if(data.data.length == 0) {
46
							mui('#pullrefresh').pullRefresh().endPullupToRefresh(true);
46
							mui('#pullrefresh').pullRefresh().endPullupToRefresh(true);
68
						var li = document.createElement("li");
68
						var li = document.createElement("li");
69
						li.className = "mui-table-view-cell";
69
						li.className = "mui-table-view-cell";
70
						li.innerHTML = '<div class="flexCenter mui-clearfix">' +
70
						li.innerHTML = '<div class="flexCenter mui-clearfix">' +
71
							'<div class="madiaHead useHead" style="background-image:url(' + baImg + ')" data-id="'+data.data[i].professor.id+'"></div>' +
71
							'<div class="madiaHead useHead" style="background-image:url(' + baImg + ')" data-id="' + data.data[i].professor.id + '"></div>' +
72
							'<div class="madiaInfo">' +
72
							'<div class="madiaInfo">' +
73
							'<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>' +
73
							'<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>' +
74
							'</div>' +
74
							'</div>' +
75
							'</div>' +
75
							'</div>' +
76
							'<div class="madiaInfo">' +
76
							'<div class="madiaInfo">' +
83
						document.getElementsByClassName("commentBlock")[0].appendChild(li);
83
						document.getElementsByClassName("commentBlock")[0].appendChild(li);
84
					}
84
					}
85

85

86
				}else{
86
				} else {
87
					/*mui('#pullrefresh').pullRefresh().endPullupToRefresh(true);*/
87
					/*mui('#pullrefresh').pullRefresh().endPullupToRefresh(true);*/
88
				}
88
				}
89
			},
89
			},
190
				}, "get", oArticleModule.correlationArticle);
190
				}, "get", oArticleModule.correlationArticle);
191
			}
191
			}
192

192

193
			document.getElementById("oTime").innerHTML= commenTime($data.publishTime);
193
			document.getElementById("oTime").innerHTML = commenTime($data.publishTime);
194
		},
194
		},
195
		professorMess: function($data) {
195
		professorMess: function($data) {
196
			//console.log(JSON.stringify($data));
196
			//console.log(JSON.stringify($data));
404
		attentionGetExpert: function($data) {
404
		attentionGetExpert: function($data) {
405
			if($data) {
405
			if($data) {
406
				document.getElementsByClassName("attenSpan")[0].classList.add("attenedSpan");
406
				document.getElementsByClassName("attenSpan")[0].classList.add("attenedSpan");
407
				document.getElementsByClassName("attenSpan")[0].innerText="已关注";
407
				document.getElementsByClassName("attenSpan")[0].innerText = "已关注";
408
			}
408
			}
409
		},
409
		},
410
		attentionPostExpert: function($data) {
410
		attentionPostExpert: function($data) {
411
			document.getElementsByClassName("attenSpan")[0].classList.add("attenedSpan");
411
			document.getElementsByClassName("attenSpan")[0].classList.add("attenedSpan");
412
			document.getElementsByClassName("attenSpan")[0].innerText="已关注";
412
			document.getElementsByClassName("attenSpan")[0].innerText = "已关注";
413
		},
413
		},
414
		attentionNoPostExpert: function($data) {
414
		attentionNoPostExpert: function($data) {
415
			document.getElementsByClassName("attenSpan")[0].classList.remove("attenedSpan");
415
			document.getElementsByClassName("attenSpan")[0].classList.remove("attenedSpan");
416
			document.getElementsByClassName("attenSpan")[0].innerText="关注";
416
			document.getElementsByClassName("attenSpan")[0].innerText = "关注";
417
		},
417
		},
418
		storeGetUp: function($data) {
418
		storeGetUp: function($data) {
419
			if($data) {
419
			if($data) {
491
		var datatype = this.getAttribute("data-type");
491
		var datatype = this.getAttribute("data-type");
492
		var ownerid = this.getAttribute("owner-id");
492
		var ownerid = this.getAttribute("owner-id");
493
		if(datatype == 1) {
493
		if(datatype == 1) {
494
			mui.openWindow({
495
				url: '../html/professorArticle.html',
496
				id: '../html/professorArticle.html',
497
				show: {
498
					autoShow: false,
499
					aniShow: "slide-in-right",
500
				},
501
				extras: {
502
					articleId: id,
503
					ownerid: ownerid,
504
				}
494
			plus.nativeUI.showWaiting();
495
			plus.webview.create("../html/professorArticle.html", '../html/professorArticle.html', {}, {
496
				articleId: id,
497
				ownerid: ownerid,
505
			});
498
			});
506
		} else if(datatype == 2) {
499
		} else if(datatype == 2) {
507
			mui.openWindow({
508
				url: '../html/professorArticle.html',
509
				id: '../html/professorArticle.html',
510
				show: {
511
					autoShow: false,
512
					aniShow: "slide-in-right",
513
				},
514
				extras: {
515
					articleId: id,
516
					ownerid: ownerid,
517
					oFlag: 1
518
				}
500
			plus.nativeUI.showWaiting();
501
			plus.webview.create("../html/professorArticle.html", '../html/professorArticle.html', {}, {
502
				articleId: id,
503
				ownerid: ownerid,
504
				oFlag: 1
519
			});
505
			});
520
		}
506
		}
521
	});
507
	});
631
	})
617
	})
632
	document.getElementsByClassName("mui-btn")[0].addEventListener("tap", function() {
618
	document.getElementsByClassName("mui-btn")[0].addEventListener("tap", function() {
633
		mui.ajax(baseUrl + "/ajax/leaveWord", {
619
		mui.ajax(baseUrl + "/ajax/leaveWord", {
634
			data:{
620
			data: {
635
				"articleId": plus.webview.currentWebview().articleId,
621
				"articleId": plus.webview.currentWebview().articleId,
636
				"sender": plus.storage.getItem('userid'),
622
				"sender": plus.storage.getItem('userid'),
637
				"content": document.getElementById("textInputThis").value
623
				"content": document.getElementById("textInputThis").value
642
			success: function(data) {
628
			success: function(data) {
643
				if(data.success) {
629
				if(data.success) {
644
					document.getElementById("textInputThis").value = "";
630
					document.getElementById("textInputThis").value = "";
645
//					createTime = "";
646
//					orderKey = "";
647
//					mui('#pullrefresh').pullRefresh().enablePullupToRefresh();
648
					document.getElementById('textInput').style.display="none";
649
					document.getElementById('operCol').style.display="block";
631
					//					createTime = "";
632
					//					orderKey = "";
633
					//					mui('#pullrefresh').pullRefresh().enablePullupToRefresh();
634
					document.getElementById('textInput').style.display = "none";
635
					document.getElementById('operCol').style.display = "block";
650
					leword(1, 1);
636
					leword(1, 1);
651
					oArticleModule.oAjaxGet(baseUrl + "/ajax/leaveWord/lwCount", {
637
					oArticleModule.oAjaxGet(baseUrl + "/ajax/leaveWord/lwCount", {
652
						"articleId": oArticleModule.articleId
638
						"articleId": oArticleModule.articleId
657
				//异常处理;
643
				//异常处理;
658
				console.log(type);
644
				console.log(type);
659
			},
645
			},
660
			beforeSend:function(data) {
646
			beforeSend: function(data) {
661
				console.log(JSON.stringify(data));
647
				console.log(JSON.stringify(data));
662
			}
648
			}
663
		});
649
		});
674
			success: function(data) {
660
			success: function(data) {
675
				if(data.success) {
661
				if(data.success) {
676
					document.getElementsByClassName("commentBlock")[0].removeChild($this.parentNode.parentNode.parentNode);
662
					document.getElementsByClassName("commentBlock")[0].removeChild($this.parentNode.parentNode.parentNode);
677
//					createTime = "";
678
//					orderKey = "";
679
//					mui('#pullrefresh').pullRefresh().enablePullupToRefresh();
663
					//					createTime = "";
664
					//					orderKey = "";
665
					//					mui('#pullrefresh').pullRefresh().enablePullupToRefresh();
680
					leword(1, 1);
666
					leword(1, 1);
681
					oArticleModule.oAjaxGet(baseUrl + "/ajax/leaveWord/lwCount", {
667
					oArticleModule.oAjaxGet(baseUrl + "/ajax/leaveWord/lwCount", {
682
						"articleId": oArticleModule.articleId
668
						"articleId": oArticleModule.articleId
689
			}
675
			}
690
		});
676
		});
691
	})
677
	})
692
		mui(".artfoot").on("tap",".inputShow",function(){
693
			if(!plus.storage.getItem('userid')) {
694
				oCurren.login();
695
				return;
696
			}
697
		    	document.getElementById("textInput").style.display="block";
698
		    	document.getElementById("operCol").style.display="none";
699
		    	document.getElementById("textInputThis").focus();
700
		    })
701
		
702
		
678
	mui(".artfoot").on("tap", ".inputShow", function() {
679
		if(!plus.storage.getItem('userid')) {
680
			oCurren.login();
681
			return;
682
		}
683
		document.getElementById("textInput").style.display = "block";
684
		document.getElementById("operCol").style.display = "none";
685
		document.getElementById("textInputThis").focus();
686
	})
687

703
	/*微信及微信朋友圈分享专家*/
688
	/*微信及微信朋友圈分享专家*/
704
	var auths, shares;
689
	var auths, shares;
705
	plus.oauth.getServices(function(services) {
690
	plus.oauth.getServices(function(services) {
754
			if(share) {
739
			if(share) {
755
				shareMessage(share, "sinaweibo", {
740
				shareMessage(share, "sinaweibo", {
756
					href: baseUrl + "/ekexiu/shareArticalinfor.html?articleId=" + oArticleModule.articleId,
741
					href: baseUrl + "/ekexiu/shareArticalinfor.html?articleId=" + oArticleModule.articleId,
757
					content:document.getElementById("articleName").innerHTML
742
					content: document.getElementById("articleName").innerHTML
758
				});
743
				});
759
			}
744
			}
760
		}
745
		}
792
			if(plus.storage.getItem('userid')) {
777
			if(plus.storage.getItem('userid')) {
793
				shareAddIntegral(3);
778
				shareAddIntegral(3);
794
			}
779
			}
795
			
780

796
		}, function(e) {
781
		}, function(e) {
797
			console.log(JSON.stringify(e))
782
			console.log(JSON.stringify(e))
798
			plus.nativeUI.closeWaiting();
783
			plus.nativeUI.closeWaiting();
804
		});
789
		});
805
	}
790
	}
806

791

807
	mui(".tagList").on("tap","li",function(){
792
	mui(".tagList").on("tap", "li", function() {
808
		mui.openWindow({
793
		mui.openWindow({
809
					url: '../html/searchListNew.html',
810
					id: '../html/searchListNew.html',
811
					show:{
812
				      autoShow:false,
813
				      aniShow:"fade-in",
814
				    },
815
					extras:{
816
				      key:this.getElementsByTagName("span")[0].innerHTML,
817
				      qiFlag:3
818
				    }
819
				});
794
			url: '../html/searchListNew.html',
795
			id: '../html/searchListNew.html',
796
			show: {
797
				autoShow: false,
798
				aniShow: "fade-in",
799
			},
800
			extras: {
801
				key: this.getElementsByTagName("span")[0].innerHTML,
802
				qiFlag: 3
803
			}
804
		});
820
	})
805
	})
821
});
806
});