Преглед на файлове

Merge remote-tracking branch 'origin/dev' into dev

XMTT преди 7 години
родител
ревизия
27c767bb7d

+ 22 - 2
app/html/consultlistNew.html

@ -7,14 +7,34 @@
7 7
    <link href="../css/mui.min.css" rel="stylesheet"/>
8 8
    <link rel="stylesheet" type="text/css" href="../css/iconfont.css"/>
9 9
    <link href="../css/app.css" rel="stylesheet"/>
10
    <style>
11
    	#tongzhi>li:after{
12
    		height:1px;
13
    	}
14
    	.h2Font.mui-ellipsis>span {
15
    		color:#ff9900
16
    	}
17
    </style>
10 18
</head>
11 19
<body>
12 20
    <!-- 主页面内容容器 -->
13
    <div id="logined">
21
    <div id="">
14 22
		<div id="zixunpullrefresh" class="mui-content mui-scroll-wrapper" >
15 23
		  	<div class="mui-scroll">
16 24
		  		<div class="infocon madiaBlock">
17
				    <ul class="mui-table-view consultList" id="consultList">
25
		  			<ul class="mui-table-view consultList1" id="tongzhi" style=" margin-bottom:0px;">
26
				    	<li class="mui-table-view-cell" id='hh'>
27
							<div class="madiaHead useHead" style="background-image:url(../images/default-photo.jpg)"><span class="mui-icon icon-messagenew displayNone" id="iconT"><span class="mui-badge" id="iconNum">0</span></span></div>
28
							<div class="madiaInfo">
29
								<div class="h1Font mui-ellipsis">
30
									<span>通知</span>
31
								</div>
32
								<div class="h2Font mui-ellipsis" id="inf">这里显示对话的<span>最后一条消息,天</span>个人似乎突然今天个人似乎突然今天跟i</div>
33
							</div>
34
						</li>
35
						
36
				    </ul>
37
				    <ul class="mui-table-view consultList" id="consultList" style="margin-top:0px;">
18 38
				    	<!--<li class="mui-table-view-cell" id='hh'>
19 39
							<div class="madiaHead useHead" style="background-image:url(../images/default-photo.jpg)"></div>
20 40
							<div class="madiaInfo">

+ 98 - 0
app/html/guide.html

@ -0,0 +1,98 @@
1
<!DOCTYPE html>
2
<html>
3

4
	<head>
5
		<meta charset="UTF-8">
6
		<title></title>
7
		<style>
8
			.box {
9
				position: absolute;
10
				z-index: 2;
11
				top: 0;
12
				bottom: 0;
13
				left: 0;
14
				overflow: hidden;
15
				width: 100%;
16
				background-color: #ffffff;
17
			}
18
			
19
			.header {
20
				width: 100%;
21
			}
22
			
23
			.header img {
24
				width: 100%;
25
			}
26
			
27
			.footer {
28
				background-color: #ffffff;
29
				height: 370px;
30
				width: 100%;
31
				display: flex;
32
				align-items: center;
33
				justify-content: center;
34
				position: absolute;
35
				bottom: 0;
36
			}
37
			
38
			.footer img {
39
				width: 180px;
40
				height: 120px;
41
			}
42
			
43
			.skip {
44
				position: fixed;
45
				top: 42px;
46
				right: 28px;
47
				height: 60px;
48
				width: 180px;
49
				background: rgba(0, 0, 0, 0.15);
50
				text-align: center;
51
				line-height: 60px;
52
				color: #fff;
53
				z-index: 2;
54
				font-size: 30px;
55
				border-radius: 40px;
56
			}
57
		</style>
58
	</head>
59

60
	<body>
61
		<div class="box">
62
			<div class="header">
63
				<img src="../images/20171220113002.jpg" />
64
			</div>
65
			<div class="footer">
66
				<img src="../images/logo.png" alt="" />
67
			</div>
68
		</div>
69
		<div class="skip" id="close">跳过广告</div>
70
	</body>
71
	<script src="../js/public/mui.min.js"></script>
72
	<script>
73
		mui.init();
74
		mui.ready(function() {
75
			mui.plusReady(function() {
76
				plus.navigator.setFullscreen(true);
77
				plus.navigator.closeSplashscreen();
78
			});
79
			document.getElementById("close").addEventListener('tap', function(event) {
80
				plus.navigator.setFullscreen(false);
81
				plus.webview.currentWebview().close();
82
			}, false);
83
			//setTimeMiu(5)
84

85
			function setTimeMiu(n) {
86
				var i = 0;
87
				var Timer = setInterval(function() {
88
					i++;
89
					if(i == n - 1) {
90
						plus.webview.currentWebview().close();
91
						clearInterval(Timer);
92
					}
93
				}, 1000);
94
			}
95
		})
96
	</script>
97

98
</html>

+ 53 - 0
app/html/inform-sub.html

@ -0,0 +1,53 @@
1
<!DOCTYPE html>
2
<html>
3

4
	<head>
5
		<meta charset="utf-8">
6
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
7
		<title>通知</title>
8
		<link href="../css/mui.min.css" rel="stylesheet" />
9
		<link rel="stylesheet" type="text/css" href="../css/iconfont.css" />
10
		<link href="../css/app.css" rel="stylesheet" />
11
		<style>
12
			.h2Font.mui-ellipsis-2>span{
13
				color:#FF9900;
14
			}
15
		</style>
16
	</head>
17

18
	<body>
19
		<div id="pullrefresh" class="mui-content mui-scroll-wrapper">
20
			<div class="mui-scroll">
21
				<div class="infocon madiaBlock">
22
					<ul class="mui-table-view consultList" id="consultList">
23
						<!--<li class="mui-table-view-cell" style="height:80px;">
24
							<div class="madiaHead useHead" style="background-image:url(../images/default-photo.jpg)"></div>
25
							<div class="madiaInfo">
26

27
								<div class="h2Font mui-ellipsis-2" style="color: #333;font-weight: 400;">这里显示对话的最后一条消息,天个人似乎突然今天个人似<span style="color:#ff9900">记得记得就到家</span>乎突然今天跟顶顶顶顶付付毒贩夫妇付付i</div>
28
								<div class="h3Font" style="margin: 5px 0;">
29
									8月17日 18:00
30
								</div>
31
							</div>
32
						</li>
33
						<li class="mui-table-view-cell" style="height:80px;">
34
							<div class="madiaHead useHead" style="background-image:url(../images/default-photo.jpg)"></div>
35
							<div class="madiaInfo">
36

37
								<div class="h2Font mui-ellipsis-2" style="color: #333;font-weight: 400;">这里显示对话的最后一条消息,天个人似乎突然今天个人似<span style="color:#ff9900">记得记得就到家</span>乎突然今天跟顶顶顶顶付付毒贩夫妇付付i</div>
38
								<div class="h3Font" style="margin: 5px 0;">
39
									8月17日 18:00
40
								</div>
41
							</div>
42
						</li>-->
43
					</ul>
44
				</div>
45
			</div>
46
			<div style="position:absolute;top:50%;width:100%;text-align:center;" class="displayNone" id="nodatalist">暂无通知</div>
47
		</div>
48
		<script src="../js/public/mui.min.js"></script>
49
		<script src="../js/public/base.js"></script>
50
		<script src="../js/inform.js"></script>
51
	</body>
52

53
</html>

+ 38 - 0
app/html/inform.html

@ -0,0 +1,38 @@
1
<!doctype html>
2
<html>
3

4
	<head>
5
		<meta charset="UTF-8">
6
		<title>通知</title>
7
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
8
		<meta name="apple-mobile-web-app-capable" content="yes">
9
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
10
		<link href="../css/mui.min.css" rel="stylesheet" />
11
		<link href="../css/iconfont.css" rel="stylesheet" />
12
		<link href="../css/app.css" rel="stylesheet" />
13
	</head>
14

15
	<body>
16
		<header class="mui-bar mui-bar-nav toptitbox">
17
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left topback"></a>
18
			<h1 class="mui-title toptit">通知</h1>
19
		</header>
20
		<div class="mui-content"></div>
21

22
		<script src="../js/public/mui.min.js"></script>
23
		<script type="text/javascript">
24
			//启用双击监听
25
			mui.init({
26
				subpages: [{
27
					url: '../html/inform-sub.html',
28
					id: 'inform-sub.html',
29
					styles: {
30
						top: '44px',
31
						bottom: '0px',
32
					}
33
				}]
34
			});
35
		</script>
36
	</body>
37

38
</html>

+ 2 - 4
app/html/paperShow.html

@ -150,6 +150,7 @@
150 150
		<script src="../js/public/mui.previewimage.js" type="text/javascript" charset="utf-8"></script>
151 151
		<script src="../js/public/base.js"></script>
152 152
		<script src="../js/public/jquery-1.11.1.js"></script>
153
		<script type="text/javascript" src="../js/leaveWords.js"></script>
153 154
		<script src="../js/paperShow.js"></script>
154 155
		<script type="text/javascript"> 
155 156
			//处理iOS下弹出软键盘后头部会随页面的滚动条消失问题
@ -158,10 +159,7 @@
158 159
			})
159 160
			//处理iOS下弹出软键盘后头部会随页面的滚动条消失问题
160 161
		    iosheader();
161
		    mui("body").on("tap",".mui-content",function(){
162
		    	document.getElementById("textInput").style.display="none";
163
		    	document.getElementById("operCol").style.display="block";
164
		    })
162
		    
165 163
		    
166 164
		    //var BtnMore=document.getElementById("BtnMore");
167 165
		    var shareOut=document.getElementById("shareOut");

+ 1 - 4
app/html/patentShow.html

@ -157,6 +157,7 @@
157 157
		<script src="../js/public/mui.previewimage.js" type="text/javascript" charset="utf-8"></script>
158 158
		<script src="../js/public/base.js"></script>
159 159
		<script src="../js/public/jquery-1.11.1.js"></script>
160
		<script type="text/javascript" src="../js/leaveWords.js"></script>
160 161
		<script src="../js/patentShow.js"></script>
161 162
		<script type="text/javascript"> 
162 163
			document.getElementById("listenClick").addEventListener("tap",function(){
@ -164,10 +165,6 @@
164 165
			})
165 166
			//处理iOS下弹出软键盘后头部会随页面的滚动条消失问题
166 167
		    iosheader();
167
		    mui("body").on("tap",".mui-content",function(){
168
		    	document.getElementById("textInput").style.display="none";
169
		    	document.getElementById("operCol").style.display="block";
170
		    })
171 168
		    
172 169
		    //var BtnMore=document.getElementById("BtnMore");
173 170
		    var shareOut=document.getElementById("shareOut");

+ 1 - 5
app/html/professorArticle.html

@ -151,11 +151,6 @@
151 151
			})
152 152
			//处理iOS下弹出软键盘后头部会随页面的滚动条消失问题
153 153
		    iosheader();
154
		    mui("body").on("tap",".mui-content",function(){
155
		    	document.getElementById("textInput").style.display="none";
156
		    	document.getElementById("operCol").style.display="block";
157
		    })
158
		    
159 154
		    //var BtnMore=document.getElementById("BtnMore");
160 155
		    var shareOut=document.getElementById("shareOut");
161 156
		    var cancelShare=document.getElementById("cancelShare");
@ -180,6 +175,7 @@
180 175
		    	shareBlock.style.display="none";
181 176
		    })
182 177
		</script>
178
		<script type="text/javascript" src="../js/leaveWords.js"></script>
183 179
		<script type="text/javascript" src="../js/articleShow.js"></script>
184 180
	</body>
185 181


+ 14 - 1
app/index.html

@ -39,7 +39,20 @@
39 39
	};
40 40
	var aniShow = {};
41 41
	//创建子页面,首个选项卡页面显示,其它均隐藏;
42
	mui.plusReady(function() {
42
	mui.plusReady(function() {
43
		mui.openWindow({
44
						id: 'guide.html',
45
						url: '/html/guide.html',
46
						styles: {
47
							popGesture: "none"
48
						},
49
						show: {
50
							aniShow: 'none'
51
						},
52
						waiting: {
53
							autoShow: false
54
						}
55
					});
43 56
		var self = plus.webview.currentWebview();
44 57
		for(var i = 0; i < 4; i++) {
45 58
			var temp = {};

+ 12 - 196
app/js/articleShow.js

@ -1,104 +1,14 @@
1
//var createTime = "",
2
//	orderKey = "";
3
//mui.init({
4
//	pullRefresh: {
5
//		container: '#pullrefresh',
6
//		up: {
7
//			contentrefresh: '正在加载...',
8
//			callback: pullupRefresh
9
//		}
10
//	}
11
//});
12
//
13
//function pullupRefresh() {
14
//	setTimeout(function() {
15
//		leword(1, 0);
16
//	}, 1000);
17
//}
18
leword(500, 1);
1

2

19 3
var stt;
20
function leword(row, aa) {
21
	mui.plusReady(function() {
22
		var af = aa,
23
			stt;
24
		var obj = {};
25
		obj.articleId = plus.webview.currentWebview().articleId;
26
		/*obj.createTime = createTime;
27
		obj.orderKey = orderKey;*/
28
		obj.rows = row;
29
		mui.ajax(baseUrl + "/ajax/leaveWord/ql", {
30
			data: obj,
31
			dataType: 'json', //服务器返回json格式数据
32
			type: 'get', //HTTP请求类型
33
			timeout: 10000, //超时时间设置为10秒;
34
			traditional: true,
35
			success: function(data) {
36
				console.log(JSON.stringify(data))
37
				if(data.success) {
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
					}
44
					/*} else {
45
						if(data.data.length == 0) {
46
							mui('#pullrefresh').pullRefresh().endPullupToRefresh(true);
47
							return;
48
						}
49
					}*/
50
					var id = plus.storage.getItem('userid');
51
					/*createTime = data.data[data.data.length - 1].createTime;
52
					orderKey = data.data[data.data.length - 1].orderKey;*/
53
					/*if(data.data.length == row) {
54
						mui('#pullrefresh').pullRefresh().endPullupToRefresh(false);
55
					} else {
56
						mui('#pullrefresh').pullRefresh().endPullupToRefresh(true);
57
					}*/
58
					for(var i = 0; i < data.data.length; i++) {
59
						var oText = ""
60
						if(id == data.data[i].professor.id) {
61
							oText = "删除"
62
						}
63
						var userType = autho(data.data[i].professor.authType, data.data[i].professor.orgAuth, data.data[i].professor.authStatus);
64
						var baImg = "../images/default-photo.jpg";
65
						if(data.data[i].professor.hasHeadImage == 1) {
66
							baImg = baseUrl + "/images/head/" + data.data[i].professor.id + "_l.jpg";
67
						}
68
						var li = document.createElement("li");
69
						li.className = "mui-table-view-cell";
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>' +
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>' +
74
							'</div>' +
75
							'</div>' +
76
							'<div class="madiaInfo">' +
77
							'<p class="h2Font">' + data.data[i].content + '</p>' +
78
							'<p class="operateSpan">' +
79
							'<span class="commenttime">' + commenTime(data.data[i].createTime) + '</span>' +
80
							'<span data-id="' + data.data[i].id + '" class="dele">' + oText + '</span>' +
81
							'</p>' +
82
							'</div>'
83
						document.getElementsByClassName("commentBlock")[0].appendChild(li);
84
					}
85 4

86
				} else {
87
					/*mui('#pullrefresh').pullRefresh().endPullupToRefresh(true);*/
88
				}
89
			},
90
			error: function(xhr, type, errorThrown) {
91
				//异常处理;
92
				plus.nativeUI.toast("服务器链接超时", toastStyle);
93
			}
94
		});
95
	})
96
}
97 5

98 6
mui.plusReady(function() {
7
	console.log(JSON.stringify(module))
99 8
	mui('#articleContent').on('tap','a',function(){
100 9
		plus.runtime.openURL( this.href);
101 10
	});
11
	module.lWord(plus.webview.currentWebview().articleId, 1);
102 12
	var ffl=false;
103 13
	var oCurren = {
104 14
		self: plus.webview.currentWebview(),
@ -122,11 +32,6 @@ mui.plusReady(function() {
122 32
		},
123 33
		sendLeaveWord: function($data) {
124 34
			console.log(JSON.stringify($data));
125
		},
126
		leaveWordTotal: function($data) {
127
			if($data>0){
128
				document.getElementsByClassName('mui-badge')[0].innerHTML = $data
129
			}
130 35
		}
131 36
	}
132 37
	
@ -601,7 +506,7 @@ mui.plusReady(function() {
601 506
		});
602 507
	})
603 508
	/*留言*/
604
	mui('.commentBlock').on('tap', '.useHead,.h1Font', function() {
509
	mui('.commentBlock').on('tap', '.useHead', function() {
605 510
		var id = this.getAttribute("data-id");
606 511
		plus.nativeUI.showWaiting(); //显示原生等待框
607 512
		plus.webview.create("../html/userInforShow.html", 'userInforShow.html', {}, {
@ -636,7 +541,8 @@ mui.plusReady(function() {
636 541
		if(oCurren.userid) {
637 542
			oArticleModule.oAjaxGet(baseUrl + "/ajax/article/agree", {
638 543
				"articleId": oArticleModule.articleId,
639
				'operateId': oCurren.userid
544
				'operateId': oCurren.userid,
545
				"uname":plus.storage.getItem('name')
640 546
			}, "post", oArticleModule.thumbsUp);
641 547
		} else {
642 548
			oCurren.login();
@ -672,14 +578,12 @@ mui.plusReady(function() {
672 578
			"articleId": oArticleModule.articleId,
673 579
			'operateId': oCurren.userid
674 580
		}, "get", oArticleModule.thumbs);
675

676
		
677

678 581
		/*查询是否收藏文章*/
679 582
		oArticleModule.oAjaxGet(baseUrl + "/ajax/watch/hasWatch", {
680 583
			"watchObject": oArticleModule.articleId,
681 584
			'professorId': oCurren.userid
682 585
		}, "get", oArticleModule.storeGetUp);
586
		module.init.init();
683 587
	})
684 588

685 589
	document.getElementsByClassName("attenSpan")[0].addEventListener("tap", function() {
@ -701,6 +605,7 @@ mui.plusReady(function() {
701 605
			if(oClsNm == 'mui-icon attenSpan attenedSpan') {
702 606
				oArticleModule.oAjaxGet(baseUrl + "/ajax/watch/delete",$info , "post", oArticleModule.attentionNoPostExpert);
703 607
			} else {
608
				$info.uname=plus.storage.getItem('name');
704 609
				if(oArticleModule.oFlag == 1) {
705 610
					$info.watchType=6;
706 611
				}else{
@ -727,7 +632,8 @@ mui.plusReady(function() {
727 632
				oArticleModule.oAjaxGet(baseUrl + "/ajax/watch", {
728 633
					"watchObject": oArticleModule.articleId,
729 634
					'professorId': oCurren.userid,
730
					"watchType": 3
635
					"watchType": 3,
636
					"uname": plus.storage.getItem('name')
731 637
				}, "post", oArticleModule.storePostUp);
732 638
			}
733 639
		} else {
@ -735,97 +641,7 @@ mui.plusReady(function() {
735 641
		}
736 642
	})
737 643
	/*留言总数*/
738
	function trim(str) { //删除左右两端的空格
739
		  
740
		return str.replace(/(^\s*)|(\s*$)/g, "");  
741
	}
742
	oArticleModule.oAjaxGet(baseUrl + "/ajax/leaveWord/lwCount", {
743
		"articleId": oArticleModule.articleId
744
	}, "get", leaveWord.leaveWordTotal);
745
	document.getElementById("textInputThis").addEventListener("input", function() {
746
		var length = trim(this.value);
747
		if(length) {
748
			document.getElementsByClassName("mui-btn")[0].removeAttribute("disabled");
749
			
750
		} else {
751
			document.getElementsByClassName("mui-btn")[0].setAttribute("disabled", "true")
752
		}
753
		
754
	})
755
	document.getElementsByClassName("mui-btn")[0].addEventListener("tap", function() {
756
		if(document.getElementById("textInputThis").value.length>200) {
757
				plus.nativeUI.toast("留言不得超过200个字", toastStyle);
758
				return;
759
			}
760
		mui.ajax(baseUrl + "/ajax/leaveWord", {
761
			data: {
762
				"articleId": plus.webview.currentWebview().articleId,
763
				"sender": plus.storage.getItem('userid'),
764
				"content": document.getElementById("textInputThis").value
765
			},
766
			dataType: 'json', //服务器返回json格式数据
767
			type: 'post', //HTTP请求类型
768
			timeout: 10000, //超时时间设置为10秒;
769
			success: function(data) {
770
				if(data.success) {
771
					document.getElementById("textInputThis").value = "";
772
					//					createTime = "";
773
					//					orderKey = "";
774
					//					mui('#pullrefresh').pullRefresh().enablePullupToRefresh();
775
					document.getElementById('textInput').style.display = "none";
776
					document.getElementById('operCol').style.display = "block";
777
					leword(500, 1);
778
					oArticleModule.oAjaxGet(baseUrl + "/ajax/leaveWord/lwCount", {
779
						"articleId": oArticleModule.articleId
780
					}, "get", leaveWord.leaveWordTotal)
781
				}
782
			},
783
			error: function(xhr, type, errorThrown) {
784
				//异常处理;
785
				plus.nativeUI.toast("服务器链接超时", toastStyle);
786
			},
787
			beforeSend: function(data) {
788
				console.log(JSON.stringify(data));
789
			}
790
		});
791
	})
792
	mui(".commentBlock").on("tap", ".dele", function() {
793
		var $this = this;
794
		mui.ajax(baseUrl + "/ajax/leaveWord/delete", {
795
			data: {
796
				"id": this.getAttribute("data-id"),
797
			},
798
			dataType: 'json', //服务器返回json格式数据
799
			type: 'post', //HTTP请求类型
800
			timeout: 10000, //超时时间设置为10秒;
801
			success: function(data) {
802
				if(data.success) {
803
					document.getElementsByClassName("commentBlock")[0].removeChild($this.parentNode.parentNode.parentNode);
804
					//					createTime = "";
805
					//					orderKey = "";
806
					//					mui('#pullrefresh').pullRefresh().enablePullupToRefresh();
807
					leword(500, 1);
808
					oArticleModule.oAjaxGet(baseUrl + "/ajax/leaveWord/lwCount", {
809
						"articleId": oArticleModule.articleId
810
					}, "get", leaveWord.leaveWordTotal)
811
				}
812
			},
813
			error: function(xhr, type, errorThrown) {
814
				//异常处理;
815
				plus.nativeUI.toast("服务器链接超时", toastStyle);
816
			}
817
		});
818
	})
819
	mui(".artfoot").on("tap", ".inputShow", function() {
820
		if(!plus.storage.getItem('userid')) {
821
			oCurren.login();
822
			return;
823
		}
824
		document.getElementById("textInput").style.display = "block";
825
		document.getElementById("operCol").style.display = "none";
826
		document.getElementById("textInputThis").focus();
827
	})
828

644
	
829 645
	/*微信及微信朋友圈分享专家*/
830 646
	var auths, shares;
831 647
	plus.oauth.getServices(function(services) {

+ 48 - 3
app/js/consultlistNew.js

@ -8,7 +8,7 @@ mui.ready(function() {
8 8
			content1.style.display = 'none';
9 9
		} else {
10 10
			content2.style.display = 'none';
11
			messageList(true)
11
			messageList(true);
12 12
		}
13 13
		/*登陆*/
14 14
		window.addEventListener('logined', function(event) {
@ -60,17 +60,32 @@ mui.ready(function() {
60 60
			});
61 61
62 62
		});
63
		mui("#tongzhi").on("tap", "li", function() {
64
			mui.openWindow({
65
					url: '../html/inform.html',
66
					id: 'inform.html',
67
					show: {
68
						autoShow: true,
69
						aniShow: "slide-in-right",
70
					}
71
				})
72
		})
63 73
		websocket1()
64 74
65 75
		function websocket1() {
66
			var ws = new WebSocket("ws://www.ekexiu.com:8080/portal/websocket/msg?id=" + userid + "&pm=app");
76
			var ws = new WebSocket("ws://192.168.3.233:8081/portal/websocket/msg?id=" + userid + "&pm=app");
67 77
			ws.onopen = function() {
68 78
69 79
			};
70 80
			ws.onmessage = function(a) {
71 81
				var fol = true;
72 82
				var $info = JSON.parse(a.data);
73
83
				if(!$info.sender) {
84
				document.getElementById("inf").innerHTML=$info.cnt;	
85
				document.getElementById("iconT").style.display="block";
86
				document.getElementById("iconNum").innerHTML=parseInt(document.getElementById("iconNum").innerHTML)+1;
87
				return;
88
				}
74 89
				var li = $("#consultList").find("li");
75 90
				var cf = 1;
76 91
				$.each(li, function() {
@ -197,6 +212,36 @@ mui.ready(function() {
197 212
				}
198 213
			});
199 214
		}
215
		inform();
216
		/*通知*/
217
		function inform() {
218
			mui.ajax(baseUrl + '/ajax/notify/idx', {
219
				"type": "GET",
220
				"async": true,
221
				"data": {
222
					id:userid
223
				},
224
				"success": function(data) {
225
					console.log(JSON.stringify(data));
226
					//return;
227
					if(data.success) {
228
						document.getElementById("inf").innerHTML=data.data.lastCnt;
229
						if(data.data.unRead) {
230
							document.getElementById("iconT").style.display="block";
231
							document.getElementById("iconNum").innerHTML=data.data.unRead;
232
						}else{
233
							document.getElementById("iconT").style.display="none";
234
							document.getElementById("iconNum").innerHTML=0;
235
						}
236
						
237
					}
238
				},
239
				"error": function(x) {
240
					console.log(x)
241
					plus.nativeUI.toast("服务器链接超时", toastStyle);
242
				}
243
			});
244
		}
200 245
		var btnArray = ['确认', '取消'];
201 246
		mui('#consultList').on('tap', '.mui-btn', function(event) {
202 247
			var elem = this;

+ 132 - 0
app/js/inform.js

@ -0,0 +1,132 @@
1
mui.init({
2
	pullRefresh: {
3
		container: '#pullrefresh',
4
		down: {
5
			callback: pulldownRefresh
6
		},
7
		up: {
8
			contentrefresh: '正在加载...',
9
			callback: pullupRefresh,
10
			auto:true
11
		}
12
	}
13
});
14
/**
15
 * 下拉刷新具体业务实现
16
 */
17
function pulldownRefresh() {
18
	mui('#pullrefresh').pullRefresh().refresh(true);
19
	count = 1;
20
	setTimeout(function() {
21
		mui.plusReady(function() {
22
			for(var i in obj) {
23
				if(obj.uid == obj[i] || obj.rows == obj[i]) {
24
					continue;
25
				}
26
				if(obj.time == obj[i] || obj.mid == obj[i])
27
					delete obj[i];
28

29
			}
30
			informList(obj);
31
		})
32
	}, 1000);
33
}
34
var count,
35
	obj = {
36
		rows: 20
37
	};
38
/**
39
 * 上拉加载具体业务实现
40
 */
41

42
function pullupRefresh() {
43
	
44
	mui.plusReady(function() {
45
		if(!obj.uid) {
46
				obj.uid = plus.storage.getItem('userid');
47
			}
48
		setTimeout(function() {
49
			informList(obj);
50
		}, 1000);
51
	})
52

53
}
54

55
function informList(objec) {
56
	console.log(JSON.stringify(objec));
57
	mui.ajax(baseUrl + '/ajax/notify', {
58
		data: objec,
59
		async: true,
60
		dataType: 'json', //服务器返回json格式数据
61
		type: 'GET', //HTTP请求类型
62
		traditional: true, //传数组必须加这个
63
		success: function(data) {
64
			if(data.success) {
65
				var $info = data.data;
66
				console.log($info.length)
67
				if($info.length == 0) {
68
					if(count) {
69
						document.getElementById("nodatalist").style.display = "block";
70
						mui('#pullrefresh').pullRefresh().disablePullupToRefresh(true);
71
						return;
72
					} else {
73
						mui('#pullrefresh').pullRefresh().endPullupToRefresh(true); /*不能上拉*/
74
						return;
75
					}
76
				}
77
				if(count) {
78
					document.getElementById("consultList").innerHTML="";
79
					mui('#pullrefresh').pullRefresh().endPulldownToRefresh();
80
				}
81
				count = 0;
82
				informHtml($info);
83
				if(data.data.length == obj.rows) {
84
					mui('#pullrefresh').pullRefresh().endPullupToRefresh(false); /*能上拉*/
85
					obj.time = $info[$info.length-1].createTime;
86
					obj.mid = $info[$info.length-1].id;
87
				} else {
88
					mui('#pullrefresh').pullRefresh().endPullupToRefresh(true);
89
				}
90

91
			}
92

93
		},
94
		error: function(x) {
95
			plus.nativeUI.toast("服务器链接超时", toastStyle);
96
		}
97
	});
98
}
99

100
function informHtml($data) {
101
	for(var i = 0; i < $data.length; i++) {
102
		var li = document.createElement("li");
103
		li.className = "mui-table-view-cell";
104
		li.style.height = "80px";
105
		li.innerHTML = '<div class="madiaHead useHead" style="../images/default-photo.jpg"></div>' +
106
			'<div class="madiaInfo">' +
107
			'<div class="h2Font mui-ellipsis-2" style="color: #333;font-weight: 400;">' + $data[i].cnt + '</div>' +
108
			'<div class="h3Font" style="margin: 5px 0;">' + commenTime($data[i].createTime) + '</div></div>'
109
		document.getElementById("consultList").appendChild(li);
110
		uinfo(li, $data[i].uid)
111
	}
112
}
113

114
function uinfo(li, uid) {
115
	mui.ajax(baseUrl + "/ajax/professor/editBaseInfo/" + uid, {
116
		async: true,
117
		dataType: 'json', //服务器返回json格式数据
118
		type: 'GET', //HTTP请求类型
119
		traditional: true, //传数组必须加这个
120
		success: function(data) {
121
			if(data.success) {
122
				var $data = data.data;
123
				if($data.hasHeadImage == 1) {
124
					li.getElementsByClassName("useHead")[0].style.backgroundImage = "url(" + baseUrl + "/images/head/" + $data.id + "_l.jpg" + ")";
125
				}
126
			}
127
		},
128
		error: function(x) {
129
			plus.nativeUI.toast("服务器链接超时", toastStyle);
130
		}
131
	});
132
}

+ 294 - 0
app/js/leaveWords.js

@ -0,0 +1,294 @@
1
(function(window) {
2
	function ajaxRequist(url, obj, type, fn) {
3
		mui.ajax(url, {
4
			data: obj,
5
			dataType: 'json', //服务器返回json格式数据
6
			type: type, //支持'GET'和'POST'
7
			traditional: true,
8
			success: function(data) {
9
				if(data.success) {
10
					fn(data.data)
11
				}
12
			},
13
			error: function(xhr, type, errorThrown) {
14
				plus.nativeUI.toast("服务器链接超时", toastStyle);
15
			}
16
		});
17
	}
18

19
	function trim(str) { //删除左右两端的空格
20
		  
21
		return str.replace(/(^\s*)|(\s*$)/g, "");  
22
	}
23
	var LeaveWord = function() {
24
		var self = this;
25
		self.sid = module.sid;
26
		self.stype = module.stype;
27
		self.init();
28
		self.bindEvent();
29
		self.LwordTotal();
30
	}
31

32
	function lgin() {
33
		if(plus.storage.getItem('userid')) {
34
			return true;
35
		}
36
		mui.openWindow({
37
			url: '../html/login.html',
38
			id: '../html/login.html',
39
			show: {
40
				aniShow: "slide-in-bottom"
41
			},
42
			extras: {
43
				ourl: plus.webview.currentWebview().id
44
			}
45
		});
46
		return false;
47
	}
48
	LeaveWord.prototype.init = function() {
49
		console.log(JSON.stringify(this))
50
		var self = this;
51
		ajaxRequist(baseUrl + "/ajax/leavemsg/subject", {
52
			sid: self.sid,
53
			stype: self.stype,
54
			time: 0,
55
			id: 0,
56
			rows: 500
57
		}, "GET", function(data) {
58
			document.getElementsByClassName('commentBlock')[0].innerHTML = ""
59
			if(data.length == 0) {
60
				return;
61
			}
62
			var id = plus.storage.getItem('userid');
63
			for(var i = 0; i < data.length; i++) {
64
				var oText = "",
65
					reply = "",
66
					re = '<span class="replyLew" style="margin-right:10px;" data-id="' + data[i].id + '">回复</span>' + '<span class="mui-icon iconfont plusbtn icon-appreciate"style="padding-left:10px;margin-right:10px;font-size:14px;" data-id="' + data[i].id + '" data-num="' + data[i].agreeCount + '"></span><span  class="zan"style="display:' + (data[i].agreeCount ? "inline-block" : "none") + '">' + data[i].agreeCount + ' 赞 </span>';
67
				if(id == data[i].sender) {
68
					oText = "删除";
69
					re = "";
70
				}
71
				if(data[i].reciver) {
72
					reply = " 回复 " + "<span class='reply2'></span>"
73
				}
74
				var baImg = "../images/default-photo.jpg";
75
				var li = document.createElement("li");
76
				li.className = "mui-table-view-cell";
77
				li.innerHTML = '<div class="flexCenter mui-clearfix">' +
78
					'<div class="madiaHead useHead" style="background-image:url(' + baImg + ')" data-id="' + data[i].sender + '"></div>' +
79
					'<div class="madiaInfo">' +
80
					'<p><span class="replay1"></span>' + reply + '</p>' +
81
					'</div>' +
82
					'</div>' +
83
					'<div class="madiaInfo">' +
84
					'<p class="h2Font">' + data[i].cnt + '</p>' +
85
					'<p class="operateSpan">' +
86
					'<span class="commenttime">' + commenTime(data[i].createTime) + '</span>' + re +
87
					'<span data-id="' + data[i].id + '" class="dele">' + oText + '</span>' +
88
					'</p>' +
89
					'</div>'
90
				document.getElementsByClassName("commentBlock")[0].appendChild(li);
91
				if(data[i].reciver) {
92
					self.userInfo(data[i].sender, li, 1);
93
					self.userInfo(data[i].reciver, li, 2)
94
				} else {
95
					self.userInfo(data[i].sender, li, 1);
96
				}
97
				if(data[i].agreeCount)
98
					self.referThup(data[i].id, li, data[i].agreeCount);
99
			}
100
		})
101
	}
102
	LeaveWord.prototype.userInfo = function(uId, li, parNum) {
103
		ajaxRequist(baseUrl + "/ajax/professor/editBaseInfo/" + uId, {}, "GET", function($data) {
104
			if(parNum == 1) {
105
				if($data.hasHeadImage == 1) {
106
					li.getElementsByClassName("useHead")[0].style.backgroundImage = "url(" + baseUrl + "/images/head/" + $data.id + "_l.jpg" + ")";
107
				}
108
			}
109
			var userType = autho($data.authType, $data.orgAuth, $data.authStatus);
110
			var str = '<span class="h1Font" >' + $data.name + '</span><em class="authicon ' + userType.sty + '" title="科袖认证专家"></em>'
111
			if(parNum == 1) {
112
				li.getElementsByClassName("replay1")[0].innerHTML = str;
113
			} else {
114
				li.getElementsByClassName("reply2")[0].innerHTML = str;
115
			}
116
			if(li.getElementsByClassName("replyLew")[0])
117
				li.getElementsByClassName("replyLew")[0].setAttribute("name", "回复 " + $data.name + ":");
118
		})
119
	}
120
	LeaveWord.prototype.size = function() {
121
		if(document.getElementById("textInputThis").value.length > 200) {
122
			plus.nativeUI.toast("留言不得超过200个字", toastStyle);
123
			return false;
124
		}
125
		return true;
126
	}
127
	LeaveWord.prototype.topLw = function() {
128
		var self = this;
129
		if(!self.size) {
130
			return;
131
		}
132
		ajaxRequist(baseUrl + "/ajax/leavemsg", {
133
			cnt: document.getElementById("textInputThis").value,
134
			refId: self.sid,
135
			refType: self.stype,
136
			sender: plus.storage.getItem('userid'),
137
			uname: plus.storage.getItem('name')
138
		}, "POST", function() {
139
			document.getElementById("textInputThis").value = "";
140
			document.getElementById('textInput').style.display = "none";
141
			document.getElementById('operCol').style.display = "block";
142
			self.init({
143
				sid: self.sid,
144
				stype: self.stype,
145
				time: 0,
146
				id: 0,
147
				rows: 500
148
			});
149
		})
150
	}
151
	LeaveWord.prototype.bindEvent = function() {
152
		var self = this;
153
		document.getElementsByClassName("mui-btn")[0].addEventListener("tap", function() {
154
			if(!lgin()) {
155
				return;
156
			}
157
			if(document.getElementById("textInputThis").getAttribute("oid")) {
158
				self.replyLword(document.getElementById("textInputThis").getAttribute("oid"));
159
				return;
160
			}
161
			self.topLw();
162
		});
163
		mui(".commentBlock").on("tap", ".plusbtn", function() {
164
			if(!lgin()) {
165
				return;
166
			}
167
			if(this.classList.contains('icon-appreciatefill') == true) {
168
				return;
169
			}
170
			self.thub.call(this, this.getAttribute("data-id"));
171
		})
172
		mui(".commentBlock").on("tap", ".replyLew", function() {
173
			if(!lgin()) {
174
				return;
175
			}
176
			var oid = this.getAttribute("data-id")
177
			document.getElementById("operCol").style.display = "none";
178
			document.getElementById("textInput").style.display = "block";
179
			document.getElementById("textInputThis").focus();
180
			document.getElementById("textInputThis").placeholder = this.getAttribute("name");
181
			document.getElementById("textInputThis").setAttribute("oid", oid);
182
			return false;
183
		})
184
		mui("body").on("tap", ".mui-content", function() {
185
			document.getElementById("textInput").style.display = "none";
186
			document.getElementById("operCol").style.display = "block";
187
			document.getElementById("textInputThis").placeholder = "说点什么吧...";
188
			if(document.getElementById("textInputThis").getAttribute("oid")) {
189
				document.getElementById("textInputThis").removeAttribute("oid")
190
			}
191
		})
192
		mui(".commentBlock").on("tap", ".dele", function() {
193
			self.LwordDel(this, this.getAttribute("data-id"));
194
		});
195
		mui(".artfoot").on("tap", ".inputShow", function() {
196
			if(!lgin()) {
197
				return;
198
			}
199
			if(document.getElementById("textInputThis").getAttribute("oid")) {
200
				document.getElementById("textInputThis").removeAttribute("oid")
201
			}
202
			document.getElementById("textInput").style.display = "block";
203
			document.getElementById("operCol").style.display = "none";
204
			document.getElementById("textInputThis").focus();
205
		})
206
		document.getElementById("textInputThis").addEventListener("input", function() {
207
			var length = trim(this.value);
208
			if(length) {
209
				document.getElementsByClassName("mui-btn")[0].removeAttribute("disabled");
210
			} else {
211
				document.getElementsByClassName("mui-btn")[0].setAttribute("disabled", "true")
212
			}
213
		})
214
	}
215
	LeaveWord.prototype.referThup = function(lid, li, num) {
216
		ajaxRequist(baseUrl + "/ajax/leavemsg/agree", {
217
			id: lid,
218
			uid: plus.storage.getItem('userid')
219
		}, "GET", function(data) {
220
			if(data) {
221
				li.getElementsByClassName("plusbtn")[0].classList.add("icon-appreciatefill");
222
				li.getElementsByClassName("zan")[0].innerHTML = "已赞" + num;
223
			}
224
		})
225
	}
226
	LeaveWord.prototype.thub = function(lid) {
227
		var self = this;
228
		ajaxRequist(baseUrl + "/ajax/leavemsg/agree", {
229
			id: lid,
230
			uid: plus.storage.getItem('userid'),
231
			uname: plus.storage.getItem('name')
232
		}, "POST", function(data) {
233
			self.classList.add("icon-appreciatefill");
234
			self.nextElementSibling.innerHTML = "已赞" + (Number(self.getAttribute("data-num")) + 1);
235
			self.nextElementSibling.style.display = "inline-block";
236
		})
237
	}
238
	LeaveWord.prototype.replyLword = function(lid) {
239
		var self = this;
240
		if(!self.size) {
241
			return;
242
		}
243
		ajaxRequist(baseUrl + "/ajax/leavemsg/reply", {
244
			cnt: document.getElementById("textInputThis").value,
245
			id: lid,
246
			uid: plus.storage.getItem('userid'),
247
			uname: plus.storage.getItem('name')
248
		}, "POST", function(data) {
249
			document.getElementById("textInputThis").value = "";
250
			document.getElementById('textInput').style.display = "none";
251
			document.getElementById('operCol').style.display = "block";
252
			document.getElementById("textInputThis").removeAttribute("oid");
253
			document.getElementById("textInputThis").placeholder = "说点什么吧...";
254
			self.init({
255
				sid: self.sid,
256
				stype: self.stype,
257
				time: 0,
258
				id: 0,
259
				rows: 500
260
			});
261
			self.LwordTotal();
262
		})
263
	}
264
	LeaveWord.prototype.LwordDel = function($this, lid) {
265
		var self = this;
266
		ajaxRequist(baseUrl + "/ajax/leavemsg/del", {
267
			id: lid
268
		}, "GET", function(data) {
269
			document.getElementsByClassName("commentBlock")[0].removeChild($this.parentNode.parentNode.parentNode);
270
			self.LwordTotal();
271
		})
272
	}
273
	LeaveWord.prototype.LwordTotal = function() {
274
		var self = this;
275
		ajaxRequist(baseUrl + "/ajax/leavemsg/count", {
276
			sid: self.sid,
277
			stype: self.stype
278
		}, "get", function($data) {
279
			if($data > 0) {
280
				document.getElementsByClassName('mui-badge')[0].innerHTML = $data;
281
			}
282
		})
283
	}
284

285
	var module = {
286
		lWord: function(sid, stype) {
287
			this.sid = sid;
288
			this.stype = stype;
289
			var lw = new LeaveWord();
290
			this.init = lw.init;
291
		}
292
	}
293
	window.module = module;
294
})(window)

+ 4 - 151
app/js/paperShow.js

@ -9,6 +9,7 @@ mui.plusReady(function() {
9 9
	//paperId="FF6EFFA4D7474CC7B808D9BC08E88E79";
10 10
	getRecourceMe(); /*获取资源信息*/
11 11
	//关键词标签点击进去搜索
12
	module.lWord(paperId, 2);
12 13
	mui(".tagList").on("tap", "li", function() {
13 14
		var tagText = this.getElementsByTagName("span")[0].innerText;
14 15
		plus.nativeUI.showWaiting();
@ -255,6 +256,7 @@ mui.plusReady(function() {
255 256
		userid = plus.storage.getItem('userid');
256 257
		getRecourceMe();
257 258
		ifcollectionAbout(paperId,oifCollect, 5);
259
		module.init.init();
258 260
	});
259 261
260 262
	function leadIn(sel) {
@ -669,7 +671,7 @@ mui('.thumbBlock').on("tap",".thumbBtn",function(){
669 671
})
670 672
/*点赞*/
671 673
function addAgree() {
672
	var data = {"uid": userid,"id": paperId}
674
	var data = {"uid": userid,"id": paperId,"uname":plus.storage.getItem('name')}
673 675
	mui.ajax(baseUrl+"/ajax/ppaper/agree",{		
674 676
		data:data,
675 677
		dataType: 'json', //数据格式类型
@ -687,157 +689,8 @@ function addAgree() {
687 689
		}
688 690
	});
689 691
}
690
mui(".artfoot").on("tap", ".inputShow", function() {
691
	
692
		if(!isLogin()) {
693
			document.getElementById("textInput").style.display = "block";
694
			document.getElementById("operCol").style.display = "none";
695
			document.getElementById("textInputThis").focus();
696
		}
697
		
698
	})
699
leword();
700 692
701
mmentBlock').on('tap', '.useHead', function leword() {
702
		var data = {"paperId": paperId,"rows": 500}	
703
		mui.ajax(baseUrl + "/ajax/leaveWord/ql/paper", {
704
			data: data,
705
			dataType: 'json', //服务器返回json格式数据
706
			type: 'get', //HTTP请求类型
707
			timeout: 10000, //超时时间设置为10秒;
708
			traditional: true,
709
			success: function(data) {
710
				if(data.success) {
711
					document.getElementsByClassName('commentBlock')[0].innerHTML = ""
712
					if(data.data.length == 0) {
713
						return;
714
					}
715
					var id = plus.storage.getItem('userid');
716
					for(var i = 0; i < data.data.length; i++) {
717
						var oText = ""
718
						if(id == data.data[i].professor.id) {
719
							oText = "删除"
720
						}
721
						var userType = autho(data.data[i].professor.authType, data.data[i].professor.orgAuth, data.data[i].professor.authStatus);
722
						var baImg = "../images/default-photo.jpg";
723
						if(data.data[i].professor.hasHeadImage == 1) {
724
							baImg = baseUrl + "/images/head/" + data.data[i].professor.id + "_l.jpg";
725
						}
726
						var li = document.createElement("li");
727
						li.className = "mui-table-view-cell";
728
						li.innerHTML = '<div class="flexCenter mui-clearfix">' +
729
							'<div class="madiaHead useHead" style="background-image:url(' + baImg + ')" data-id="' + data.data[i].professor.id + '"></div>' +
730
							'<div class="madiaInfo">' +
731
							'<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>' +
732
							'</div>' +
733
							'</div>' +
734
							'<div class="madiaInfo">' +
735
							'<p class="h2Font">' + data.data[i].content + '</p>' +
736
							'<p class="operateSpan">' +
737
							'<span class="commenttime">' + commenTime(data.data[i].createTime) + '</span>' +
738
							'<span data-id="' + data.data[i].id + '" class="dele">' + oText + '</span>' +
739
							'</p>' +
740
							'</div>'
741
						document.getElementsByClassName("commentBlock")[0].appendChild(li);
742
					}
743
744
				} else {
745
				}
746
			},
747
			error: function(xhr, type, errorThrown) {
748
				//异常处理;
749
				plus.nativeUI.toast("服务器链接超时", toastStyle);
750
			}
751
		});
752
}
753
lewordNum();
754
function lewordNum() {
755
		var data = {"paperId": paperId}	
756
		mui.ajax(baseUrl + "/ajax/leaveWord/lwCount/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
					if(data.data > 0) {
765
						document.getElementsByClassName("mui-badge")[0].innerHTML = data.data;
766
					}
767
				}
768
769
				
770
			},
771
			error: function(xhr, type, errorThrown) {
772
				//异常处理;
773
				plus.nativeUI.toast("服务器链接超时", toastStyle);
774
			}
775
		});
776
}
777
function trim(str) { //删除左右两端的空格
778
		  
779
		return str.replace(/(^\s*)|(\s*$)/g, "");  
780
	}
781
document.getElementById("textInputThis").addEventListener("input", function() {
782
		var length = trim(this.value);
783
		if(length) {
784
			document.getElementsByClassName("mui-btn")[0].removeAttribute("disabled");
785
		} else {
786
			document.getElementsByClassName("mui-btn")[0].setAttribute("disabled", "true")
787
		}
788
	})
789
document.getElementsByClassName("mui-btn")[0].addEventListener("tap", function() {
790
	if(document.getElementById("textInputThis").value.length>200) {
791
				plus.nativeUI.toast("留言不得超过200个字", toastStyle);
792
				return;
793
			}
794
		mui.ajax(baseUrl + "/ajax/leaveWord/paper", {
795
			data: {
796
				"paperId": paperId,
797
				"sender": plus.storage.getItem('userid'),
798
				"content": document.getElementById("textInputThis").value
799
			},
800
			dataType: 'json', //服务器返回json格式数据
801
			type: 'post', //HTTP请求类型
802
			timeout: 10000, //超时时间设置为10秒;
803
			success: function(data) {
804
				if(data.success) {
805
					document.getElementById("textInputThis").value = "";
806
					document.getElementById('textInput').style.display = "none";
807
					document.getElementById('operCol').style.display = "block";
808
					leword();
809
					lewordNum();
810
				}
811
			},
812
			error: function() {
813
				//异常处理;
814
				plus.nativeUI.toast("服务器链接超时", toastStyle);
815
			}
816
		});
817
	})
818
mui(".commentBlock").on("tap", ".dele", function() {
819
		var $this = this;
820
		mui.ajax(baseUrl + "/ajax/leaveWord/delete", {
821
			data: {
822
				"id": this.getAttribute("data-id"),
823
			},
824
			dataType: 'json', //服务器返回json格式数据
825
			type: 'post', //HTTP请求类型
826
			timeout: 10000, //超时时间设置为10秒;
827
			success: function(data) {
828
				if(data.success) {
829
					document.getElementsByClassName("commentBlock")[0].removeChild($this.parentNode.parentNode.parentNode);
830
					leword();
831
					lewordNum();
832
				}
833
			},
834
			error: function(xhr, type, errorThrown) {
835
				//异常处理;
836
				plus.nativeUI.toast("服务器链接超时", toastStyle);
837
			}
838
		});
839
	})
840
mui('.commentBlock').on('tap', '.useHead,.h1Font', function() {
693
mui('.commentBlock').on('tap', '.useHead', function() {
841 694
		var id = this.getAttribute("data-id");
842 695
		plus.nativeUI.showWaiting(); //显示原生等待框
843 696
		plus.webview.create("../html/userInforShow.html", 'userInforShow.html', {}, {

+ 5 - 155
app/js/patentShow.js

@ -7,6 +7,7 @@ mui.plusReady(function() {
7 7
	var userName = plus.storage.getItem('name');
8 8
	patentId = self.patentId;
9 9
	getRecourceMe();/*获取资源信息*/
10
	module.lWord(patentId, 3);
10 11
	//关键词标签点击进去搜索
11 12
	mui(".tagList").on("tap","li",function(){
12 13
		var tagText = this.getElementsByTagName("span")[0].innerText;
@ -253,6 +254,7 @@ mui.plusReady(function() {
253 254
		getRecourceMe();
254 255
		ifcollectionAbout(patentId,oifCollect,4);
255 256
		isAgree();
257
		module.init.init();
256 258
	});
257 259
	function leadIn(sel) {
258 260
		mui.ajax(baseUrl + "/ajax/ppatent/ass", {
@ -614,7 +616,7 @@ mui.plusReady(function() {
614 616
				} 
615 617
	/*判断论文是否被赞*/
616 618
function isAgree() {
617
	var data = {"id": patentId,"uid":userid }
619
	var data = {"id": patentId,"uid":userid}
618 620
	mui.ajax(baseUrl+"/ajax/ppatent/agree",{	
619 621
		data:data,
620 622
		dataType: 'json', //数据格式类型
@ -644,7 +646,7 @@ mui('.thumbBlock').on("tap",".thumbBtn",function(){
644 646
})
645 647
/*点赞*/
646 648
function addAgree() {
647
	var data = {"uid": userid,"id": patentId}
649
	var data = {"uid": userid,"id": patentId,"uname":plus.storage.getItem('name') }
648 650
	mui.ajax(baseUrl+"/ajax/ppatent/agree",{		
649 651
		data:data,
650 652
		dataType: 'json', //数据格式类型
@ -662,159 +664,7 @@ function addAgree() {
662 664
		}
663 665
	});
664 666
}
665
mui(".artfoot").on("tap", ".inputShow", function() {
666
	
667
		if(!isLogin()) {
668
			document.getElementById("textInput").style.display = "block";
669
			document.getElementById("operCol").style.display = "none";
670
			document.getElementById("textInputThis").focus();
671
		}
672
		
673
	})
674
leword();
675
676
function leword() {
677
		var data = {"patentId": patentId,"rows": 500}	
678
		mui.ajax(baseUrl + "/ajax/leaveWord/ql/patent", {
679
			data: data,
680
			dataType: 'json', //服务器返回json格式数据
681
			type: 'get', //HTTP请求类型
682
			timeout: 10000, //超时时间设置为10秒;
683
			traditional: true,
684
			success: function(data) {
685
				console.log(JSON.stringify(data))
686
				if(data.success) {
687
					document.getElementsByClassName('commentBlock')[0].innerHTML = ""
688
					if(data.data.length == 0) {
689
						return;
690
					}
691
					var id = plus.storage.getItem('userid');
692
					for(var i = 0; i < data.data.length; i++) {
693
						var oText = ""
694
						if(id == data.data[i].professor.id) {
695
							oText = "删除"
696
						}
697
						var userType = autho(data.data[i].professor.authType, data.data[i].professor.orgAuth, data.data[i].professor.authStatus);
698
						var baImg = "../images/default-photo.jpg";
699
						if(data.data[i].professor.hasHeadImage == 1) {
700
							baImg = baseUrl + "/images/head/" + data.data[i].professor.id + "_l.jpg";
701
						}
702
						var li = document.createElement("li");
703
						li.className = "mui-table-view-cell";
704
						li.innerHTML = '<div class="flexCenter mui-clearfix">' +
705
							'<div class="madiaHead useHead" style="background-image:url(' + baImg + ')" data-id="' + data.data[i].professor.id + '"></div>' +
706
							'<div class="madiaInfo">' +
707
							'<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>' +
708
							'</div>' +
709
							'</div>' +
710
							'<div class="madiaInfo">' +
711
							'<p class="h2Font">' + data.data[i].content + '</p>' +
712
							'<p class="operateSpan">' +
713
							'<span class="commenttime">' + commenTime(data.data[i].createTime) + '</span>' +
714
							'<span data-id="' + data.data[i].id + '" class="dele">' + oText + '</span>' +
715
							'</p>' +
716
							'</div>'
717
						document.getElementsByClassName("commentBlock")[0].appendChild(li);
718
					}
719
720
				} else {
721
				}
722
			},
723
			error: function(xhr, type, errorThrown) {
724
				//异常处理;
725
				plus.nativeUI.toast("服务器链接超时", toastStyle);
726
			}
727
		});
728
}
729
lewordNum();
730
function lewordNum() {
731
		var data = {"patentId": patentId}	
732
		mui.ajax(baseUrl + "/ajax/leaveWord/lwCount/patent", {
733
			data: data,
734
			dataType: 'json', //服务器返回json格式数据
735
			type: 'get', //HTTP请求类型
736
			timeout: 10000, //超时时间设置为10秒;
737
			traditional: true,
738
			success: function(data) {
739
				if(data.success) {
740
					if(data.data > 0) {
741
						document.getElementsByClassName("mui-badge")[0].innerHTML = data.data;
742
					}
743
				
744
				}
745
746
				
747
			},
748
			error: function(xhr, type, errorThrown) {
749
				//异常处理;
750
				plus.nativeUI.toast("服务器链接超时", toastStyle);
751
			}
752
		});
753
}
754
function trim(str) { //删除左右两端的空格
755
		  
756
		return str.replace(/(^\s*)|(\s*$)/g, "");  
757
	}
758
document.getElementById("textInputThis").addEventListener("input", function() {
759
		var length = trim(this.value);
760
		if(length) {
761
			document.getElementsByClassName("mui-btn")[0].removeAttribute("disabled");
762
		} else {
763
			document.getElementsByClassName("mui-btn")[0].setAttribute("disabled", "true")
764
		}
765
	})
766
document.getElementsByClassName("mui-btn")[0].addEventListener("tap", function() {
767
	if(document.getElementById("textInputThis").value.length>200) {
768
				plus.nativeUI.toast("留言不得超过200个字", toastStyle);
769
				return;
770
			}
771
		mui.ajax(baseUrl + "/ajax/leaveWord/patent", {
772
			data: {
773
				"patentId": patentId,
774
				"sender": plus.storage.getItem('userid'),
775
				"content": document.getElementById("textInputThis").value
776
			},
777
			dataType: 'json', //服务器返回json格式数据
778
			type: 'post', //HTTP请求类型
779
			timeout: 10000, //超时时间设置为10秒;
780
			success: function(data) {
781
				if(data.success) {
782
					document.getElementById("textInputThis").value = "";
783
					document.getElementById('textInput').style.display = "none";
784
					document.getElementById('operCol').style.display = "block";
785
					leword();
786
					lewordNum();
787
				}
788
			},
789
			error: function() {
790
				//异常处理;
791
				plus.nativeUI.toast("服务器链接超时", toastStyle);
792
			}
793
		});
794
	})
795
mui(".commentBlock").on("tap", ".dele", function() {
796
		var $this = this;
797
		mui.ajax(baseUrl + "/ajax/leaveWord/delete", {
798
			data: {
799
				"id": this.getAttribute("data-id"),
800
			},
801
			dataType: 'json', //服务器返回json格式数据
802
			type: 'post', //HTTP请求类型
803
			timeout: 10000, //超时时间设置为10秒;
804
			success: function(data) {
805
				if(data.success) {
806
					document.getElementsByClassName("commentBlock")[0].removeChild($this.parentNode.parentNode.parentNode);
807
					leword();
808
					lewordNum();
809
				}
810
			},
811
			error: function(xhr, type, errorThrown) {
812
				//异常处理;
813
				plus.nativeUI.toast("服务器链接超时", toastStyle);
814
			}
815
		});
816
	})
817
mui('.commentBlock').on('tap', '.useHead,.h1Font', function() {
667
mui('.commentBlock').on('tap', '.useHead', function() {
818 668
		var id = this.getAttribute("data-id");
819 669
		plus.nativeUI.showWaiting(); //显示原生等待框
820 670
		plus.webview.create("../html/userInforShow.html", 'userInforShow.html', {}, {

+ 2 - 1
app/js/professorArticle.js

@ -288,7 +288,8 @@ mui.plusReady(function() {
288 288
				data: {
289 289
					"professorId": userid,
290 290
					"watchObject": proId,
291
					"watchType": 3
291
					"watchType": 3,
292
					"uname": plus.storage.getItem('name')
292 293
				},
293 294
				beforeSend: function() {},
294 295
				success: function(data, textState) {

+ 2 - 1
app/js/public/base.js

@ -325,7 +325,8 @@ function collectionAbout(watchObject,sel, num,flag) {
325 325
		data: {
326 326
			"professorId": plus.storage.getItem('userid'),
327 327
			"watchObject": watchObject,
328
			"watchType": num
328
			"watchType": num,
329
			"uname": plus.storage.getItem('name')
329 330
		},
330 331
		dataType: 'json', //数据格式类型
331 332
		type: 'POST', //http请求类型

+ 2 - 1
app/js/researcherProw.js

@ -224,7 +224,8 @@ mui.plusReady(function() {
224 224
			data: {
225 225
				"professorId": userid,
226 226
				"watchObject": proId,
227
				"watchType": 1
227
				"watchType": 1,
228
				"uname": plus.storage.getItem('name')
228 229
			},
229 230
			dataType: 'json', //数据格式类型
230 231
			type: 'POST', //http请求类型

+ 2 - 1
app/js/userInforShow.js

@ -750,7 +750,8 @@ mui.plusReady(function() {
750 750
				"data": {
751 751
					"targetId": this.getAttribute("data-pid"),
752 752
					"targetCaption": this.getAttribute("data-caption"),
753
					"opId": userid
753
					"opId": userid,
754
					"uname":plus.storage.getItem('name')
754 755
				},
755 756
				"contentType": "application/x-www-form-urlencoded",
756 757
				"success": function($data) {