Browse Source

专利及论文导入及邀请

jack 7 years ago
parent
commit
6364815b8a
6 changed files with 532 additions and 132 deletions
  1. 16 2
      app/html/paperShow.html
  2. 13 0
      app/html/patentShow.html
  3. 1 0
      app/js/login.js
  4. 292 113
      app/js/paperShow.js
  5. 176 6
      app/js/patentShow.js
  6. 34 11
      app/js/searchListNew2.js

+ 16 - 2
app/html/paperShow.html

@ -12,6 +12,19 @@
12 12
		<style>
13 13
			html,body{height: 100%;margin:0;padding:0px;overflow: hidden;background: #FFFFFF;}
14 14
			.mui-content{height:100%;overflow: auto;background: #FFFFFF;}
15
			.invite{
16
   					margin-top: -13px;
17
    				border-radius: 4px;
18
				    display: inline-block;
19
				    line-height: normal;
20
				    position: absolute;
21
				    top: 50%;
22
				    right: 15px;
23
				    padding: 6px 8px;
24
				    background-color:#ff9900;
25
				    color: #fff;
26
				    font-size: 12px;
27
				}
15 28
		</style>
16 29
	</head>
17 30
@ -64,14 +77,15 @@
64 77
				<div class="madiaBlock">
65 78
					<div class="madiaTit">作者</div>
66 79
					<ul class="mui-table-view" id="aboutAuthors">
67
				        <!--<li class="mui-table-view-cell">
80
				       <!-- <li class="mui-table-view-cell">
68 81
				            <div class="flexCenter mui-clearfix">
69 82
				                <div class="madiaHead useHead"></div>
70 83
								<div class="madiaInfo">
71 84
									<p><span class="h1Font">张某某</span><em class="authicon authicon-pro" title="科袖认证专家"></em></p>
72 85
									<p class="mui-ellipsis h2Font">职称/职位,所在机构</p>
73 86
								</div>
74
				            </div>
87
				            </div>
88
				       
75 89
				        </li>-->
76 90
				        
77 91
				    </ul>

+ 13 - 0
app/html/patentShow.html

@ -12,6 +12,19 @@
12 12
		<style>
13 13
			html,body{height: 100%;margin:0;padding:0px;overflow: hidden;background: #FFFFFF;}
14 14
			.mui-content{height:100%;overflow: auto;background: #FFFFFF;}
15
			.invite{
16
   					margin-top: -13px;
17
    				border-radius: 4px;
18
				    display: inline-block;
19
				    line-height: normal;
20
				    position: absolute;
21
				    top: 50%;
22
				    right: 15px;
23
				    padding: 6px 8px;
24
				    background-color:#ff9900;
25
				    color: #fff;
26
				    font-size: 12px;
27
				}
15 28
		</style>
16 29
	</head>
17 30

+ 1 - 0
app/js/login.js

@ -111,6 +111,7 @@ mui.ready(function() {
111 111
					if(data.data != "null" && data.data != null) {
112 112
						var userId = data.data.id;
113 113
						plus.storage.setItem('userid', userId);
114
						plus.storage.setItem('name', data.data.name);
114 115
						plus.nativeUI.toast("登录成功", toastStyle);
115 116
						var article = plus.webview.currentWebview();
116 117
						if(article.flag==1){

+ 292 - 113
app/js/paperShow.js

@ -1,49 +1,50 @@
1 1
var ocollectBtn = document.getElementById("collectBtn"); //收藏按钮
2

3 2
var paperId;
4 3
mui.plusReady(function() {
5
	var userid = plus.storage.getItem('userid');
4
	var userid = plus.storage.getItem('userid');
5
	console.log(userid)
6 6
	var self = plus.webview.currentWebview();
7
	var userName = plus.storage.getItem('name');
7 8
	paperId = self.paperId;
8 9
	//paperId="FF6EFFA4D7474CC7B808D9BC08E88E79";
9
	getRecourceMe();/*获取资源信息*/
10
	getRecourceMe(); /*获取资源信息*/
10 11
	//关键词标签点击进去搜索
11
	mui(".tagList").on("tap","li",function(){
12
	mui(".tagList").on("tap", "li", function() {
12 13
		var tagText = this.getElementsByTagName("span")[0].innerText;
13 14
		plus.nativeUI.showWaiting();
14 15
		var web = plus.webview.create("../html/searchListNew2.html?content=5", "../html/searchListNew2.html", {}, {
15 16
			key: tagText,
16 17
			qiFlag: 5
17
		}); 
18
		});
18 19
	})
19 20
	//点击收藏按钮
20
	ifcollectionAbout(paperId,5);
21
	ifcollectionAbout(paperId, 5);
21 22
	ocollectBtn.addEventListener('tap', function() {
22 23
		if(userid && userid != null && userid != "null") {
23
			if(document.getElementById("ifCollect").className=='mui-icon iconfontnew icon-yishoucang'){
24
				cancelCollectionAbout(paperId,5)
24
			if(document.getElementById("ifCollect").className == 'mui-icon iconfontnew icon-yishoucang') {
25
				cancelCollectionAbout(paperId, 5)
25 26
			} else {
26
				collectionAbout(paperId,5);
27
				collectionAbout(paperId, 5);
27 28
			}
28
		}else{
29
		} else {
29 30
			isLogin();
30 31
		}
31 32
	});
32
	
33
	
34
	mui.ajax(baseUrl + '/ajax/ppaper/incPageViews',{
35
			"type": "POST",
36
			"dataType": "json",
37
			"data": {
38
				"id": paperId
39
			},
40
			"success": function(data) {
41
				if(data.success) {}
42
			},
43
			"error": function() {
44
				
45
			}
46
		});
33
34
	mui.ajax(baseUrl + '/ajax/ppaper/incPageViews', {
35
		"type": "POST",
36
		"dataType": "json",
37
		"data": {
38
			"id": paperId
39
		},
40
		"success": function(data) {
41
			if(data.success) {}
42
		},
43
		"error": function() {
44
45
		}
46
	});
47
47 48
	function getRecourceMe() {
48 49
		mui.plusReady(function() {
49 50
			mui.ajax(baseUrl + '/ajax/ppaper/qo', {
@ -58,7 +59,7 @@ mui.plusReady(function() {
58 59
						console.log(JSON.stringify(data))
59 60
						paperHtml(data.data);
60 61
						getPaperAuthors(data.data.id)
61
						
62
62 63
						plus.nativeUI.closeWaiting();
63 64
						plus.webview.currentWebview().show("slide-in-right", 150);
64 65
					}
@ -69,62 +70,68 @@ mui.plusReady(function() {
69 70
			});
70 71
		})
71 72
	}
73
72 74
	function paperHtml($da) {
73 75
		document.getElementById("paperTit").innerHTML = $da.name;
74 76
		document.getElementById("paperName").innerHTML = $da.name; //名字
75 77
		document.getElementById("paperAbstract").innerHTML = $da.summary; //摘要内容
76
		if(!$da.cn4periodical){
77
			$da.cn4periodical=""
78
		if(!$da.cn4periodical) {
79
			$da.cn4periodical = ""
78 80
		}
79
		if(!$da.en4periodical){
80
			$da.en4periodical=""
81
		if(!$da.en4periodical) {
82
			$da.en4periodical = ""
81 83
		}
82
		if(!$da.cn4periodical && !$da.en4periodical){
83
			document.getElementById("paperJournal").parentNode.parentNode.style.display="none";
84
		}else{
85
			document.getElementById("paperJournal").innerHTML = $da.cn4periodical  +" " +  $da.en4periodical;
84
		if(!$da.cn4periodical && !$da.en4periodical) {
85
			document.getElementById("paperJournal").parentNode.parentNode.style.display = "none";
86
		} else {
87
			document.getElementById("paperJournal").innerHTML = $da.cn4periodical + " " + $da.en4periodical;
86 88
		}
87 89
88
		if(!$da.pubDay){
89
			document.getElementById("paperVolume").parentNode.parentNode.style.display="none";
90
		}else{
90
		if(!$da.pubDay) {
91
			document.getElementById("paperVolume").parentNode.parentNode.style.display = "none";
92
		} else {
91 93
			document.getElementById("paperVolume").innerHTML = $da.pubDay;
92 94
		}
93
		if($da.keywords != undefined && $da.keywords.length != 0 ){
95
		if($da.keywords != undefined && $da.keywords.length != 0) {
94 96
			var subs = new Array();
95
			if($da.keywords.indexOf(',')){
97
			if($da.keywords.indexOf(',')) {
96 98
				subs = $da.keywords.split(',');
97
			}else{
99
			} else {
98 100
				subs[0] = $da.keywords;
99 101
			}
100
			var pstr=""
101
			if(subs.length>0){
102
				for (var i = 0; i < subs.length; i++) 
103
				{
104
					pstr+='<li><span class="h2Font">'+ subs[i] +'</span></li>'
102
			var pstr = ""
103
			if(subs.length > 0) {
104
				for(var i = 0; i < subs.length; i++) {
105
					pstr += '<li><span class="h2Font">' + subs[i] + '</span></li>'
105 106
				};
106
				document.getElementsByClassName("tagList")[0].innerHTML= pstr;
107
			}else{
108
				document.getElementsByClassName("tagList")[0].style.display="none";
107
				document.getElementsByClassName("tagList")[0].innerHTML = pstr;
108
			} else {
109
				document.getElementsByClassName("tagList")[0].style.display = "none";
109 110
			}
110
		}		
111
		}
111 112
	}
112 113
	/*获取论文作者信息*/
113 114
	function getPaperAuthors(stritrm) {
114
		mui.ajax(baseUrl +"/ajax/ppaper/authors",{
115
116
		mui.ajax(baseUrl + "/ajax/ppaper/authors", {
115 117
			"type": "GET",
116 118
			"success": function(data) {
119
				console.log(JSON.stringify(data))
117 120
				if(data.success) {
118
					if(data.data.length>0){
119
						for(var i=0;i<data.data.length;i++){
120
							var authTy="",authTit="",baseInfo="",imgbg="../images/default-photo.jpg";
121
							if(data.data[i].professorId.substring(0, 1) != "#"){
122
								mui.ajax(baseUrl +"/ajax/professor/editBaseInfo/" + data.data[i].professorId,{
123
									type:"get",
124
									async:true,
125
									success:function($proData){
121
					if(data.data.length > 0) {
122
						document.getElementById("aboutAuthors").innerHTML = ""
123
						for(var i = 0; i < data.data.length; i++) {
124
							var authTy = "",
125
								authTit = "",
126
								baseInfo = "",
127
								imgbg = "../images/default-photo.jpg";
128
							if(data.data[i].professorId.substring(0, 1) != "#") {
129
								mui.ajax(baseUrl + "/ajax/professor/editBaseInfo/" + data.data[i].professorId, {
130
									type: "get",
131
									async: true,
132
									success: function($proData) {
126 133
										console.log(JSON.stringify($proData))
127
										if($proData.success){
134
										if($proData.success) {
128 135
											var showPro = $proData.data;
129 136
											if(showPro.hasHeadImage == 1) {
130 137
												imgbg = "/images/head/" + showPro.id + "_l.jpg";
@ -132,59 +139,62 @@ mui.plusReady(function() {
132 139
												imgbg = "../images/default-photo.jpg";
133 140
											}
134 141
											//认证
135
											var oSty = autho(showPro.authType,showPro.orgAuth,showPro.authStatus);
142
											var oSty = autho(showPro.authType, showPro.orgAuth, showPro.authStatus);
136 143
											authTy = oSty.sty;
137 144
											authTit = oSty.title;
138
											
145
139 146
											var title = showPro.title || "";
140 147
											var orgName = showPro.orgName || "";
141 148
											var office = showPro.office || "";
142
											if(orgName!=""){
149
											if(orgName != "") {
143 150
												if(title != "") {
144 151
													baseInfo = title + "," + orgName;
145
												}else{
146
													if(office!=""){
147
														baseInfo = office  + "," + orgName;	
148
													}else{
149
														baseInfo = orgName;	
152
												} else {
153
													if(office != "") {
154
														baseInfo = office + "," + orgName;
155
													} else {
156
														baseInfo = orgName;
150 157
													}
151 158
												}
152
											}else{
159
											} else {
153 160
												if(title != "") {
154 161
													baseInfo = title;
155
												}else{
156
													if(office!=""){
157
														baseInfo = office;	
158
													}else{
159
														baseInfo = "";	
162
												} else {
163
													if(office != "") {
164
														baseInfo = office;
165
													} else {
166
														baseInfo = "";
160 167
													}
161 168
												}
162 169
											}
163 170
											var liItem = document.createElement("li");
164
											liItem.setAttribute("data-id",showPro.id);
171
											liItem.setAttribute("data-id", showPro.id);
172
											var odis = (userid == showPro.id) ? "none" : "block";
165 173
											liItem.className = "mui-table-view-cell"
166
											var oString = '<div class="flexCenter mui-clearfix">'
167
											oString += '<div class="madiaHead useHead" style="background-image:url('+ imgbg +')"></div>'
168
											oString += '<div class="madiaInfo"><p><span class="h1Font">'+ showPro.name +'</span><em class="authicon '+ authTy +'" title="'+ authTit +'"></em></p>'
169
											oString += '<p class="mui-ellipsis h2Font">'+ baseInfo +'</p>'
170
											oString += '</div></div>'
174
											var oString = '<div class="flexCenter mui-clearfix" style="width:80%;">'
175
											oString += '<div class="madiaHead useHead" style="background-image:url(' + imgbg + ')"></div>'
176
											oString += '<div class="madiaInfo"><p><span class="h1Font">' + showPro.name + '</span><em class="authicon ' + authTy + '" title="' + authTit + '"></em></p>'
177
											oString += '<p class="mui-ellipsis h2Font">' + baseInfo + '</p>'
178
											oString += '</div></div><span class="mui-icon attenSpan"  style="display:' + odis + ';" data-id="'+showPro.id+'">关注</span>'
171 179
											liItem.innerHTML = oString;
172 180
											document.getElementById("aboutAuthors").appendChild(liItem);
181
											ifcollectionAbout1.call(liItem.getElementsByClassName("attenSpan")[0],showPro.id,1);
173 182
										}
174 183
									}
175 184
								})
176
							}else{
185
							} else {
177 186
								var liItem = document.createElement("li");
178
								liItem.setAttribute("data-id",data.data[i].professorId);
187
								var otext = (userName == data.data[i].name) ? "是我本人" : "邀请ta加入";
188
								liItem.setAttribute("data-id", data.data[i].professorId);
179 189
								liItem.className = "mui-table-view-cell"
180
								var oString = '<div class="flexCenter mui-clearfix">'
181
								oString += '<div class="madiaHead useHead" style="background-image:url('+ imgbg +')"></div>'
182
								oString += '<div class="madiaInfo"><p><span class="h1Font">'+ data.data[i].name  +'</span></p>'
183
								oString += '</div></div>'
190
								var oString = '<div class="flexCenter mui-clearfix" style="width:80%;">'
191
								oString += '<div class="madiaHead useHead" style="background-image:url(' + imgbg + ')"></div>'
192
								oString += '<div class="madiaInfo"><p><span class="h1Font">' + data.data[i].name + '</span></p>'
193
								oString += '</div></div><span class="invite">' + otext + '</span>'
184 194
								liItem.innerHTML = oString;
185 195
								document.getElementById("aboutAuthors").appendChild(liItem);
186 196
							}
187
							
197
188 198
						}
189 199
					}
190 200
				}
@ -194,23 +204,191 @@ mui.plusReady(function() {
194 204
			},
195 205
			dataType: "json",
196 206
			'error': function(xhr, type, errorThrown) {
197
					plus.nativeUI.toast("服务器链接超时", toastStyle);
198
				}
207
				plus.nativeUI.toast("服务器链接超时", toastStyle);
208
			}
199 209
		});
200 210
	}
201
	
211
202 212
	//判断是否登录,登录才可咨询,关注,收藏
203 213
	function isLogin() {
204 214
		var userid = plus.storage.getItem('userid');
205
         if(userid==null || userid=='null'|userid == undefined |userid == 'undefined'){
215
		if(userid == null || userid == 'null' | userid == undefined | userid == 'undefined') {
206 216
			mui.openWindow({
207 217
				url: '../html/login.html',
208
				id: 'login.html'
209
			})
218
				id: '../html/login.html',
219
				show: {
220
					aniShow: "slide-in-right"
221
				},
222
				extras: {
223
					ourl: self.id
224
				}
225
			});
226
			return 1;
210 227
		}
211 228
	};
212
	
213
   /*微信及微信朋友圈分享专家*/
229
230
	window.addEventListener("newId", function(event) {
231
		userName = plus.storage.getItem('name');
232
		userid = plus.storage.getItem('userid');
233
		getRecourceMe();
234
		ifcollectionAbout(paperId, 5);
235
	});
236
237
	function leadIn(sel) {
238
		mui.ajax(baseUrl + "/ajax/ppaper/ass", {
239
			"type": "POST",
240
			"data": {
241
				id: paperId,
242
				uid: userid,
243
				author: userName
244
			},
245
			"success": function(data) {
246
				if(data.success) {
247
					if(data.data > 0) {
248
						plus.nativeUI.toast("导入成功", toastStyle);
249
						sel.style.display = "none";
250
					}
251
				}
252
			}
253
		});
254
	}
255
	mui("#aboutAuthors").on("tap", "li>span", function() {
256
		var that = this;
257
		if(this.innerHTML === "是我本人") {
258
			if(isLogin()) {
259
				return;
260
			}
261
			var btn = ["确定", "取消"];
262
			mui.confirm("确认这是您发表的论文?", "提示", btn, function(e) {
263
				if(e.index == 0) {
264
					leadIn(that);
265
				}
266
			})
267
		} else if(this.innerHTML === "邀请ta加入") {
268
			var share = buildShareService("weixin");
269
			if(share) {
270
				shareMessage(share, "WXSceneSession", {
271
					content: document.getElementById("paperAbstract").innerHTML.substring(0, 40),
272
					title: document.getElementById("paperName").innerHTML,
273
					href: baseUrl + "/e/l.html?id=" + paperId,
274
					thumbs: [baseUrl + "/images/logo180.png"]
275
				});
276
			}
277
		} else if(this.innerHTML === "关注") {
278
			if(isLogin()) {
279
				return;
280
			}
281
					collectionAbout1(this.getAttribute("data-id"), '1',this);
282
		} else if(this.innerHTML === "已关注") {
283
			if(isLogin()) {
284
				return;
285
			}
286
			cancelCollectionAbout1(this.getAttribute("data-id"), '1',this);
287
		}
288
	})
289
	
290
	/*判断是否收藏资源文章或者是否关注专家*/
291
	function ifcollectionAbout1(watchObject,num) {
292
		var that=this;
293
		mui.ajax(baseUrl + '/ajax/watch/hasWatch', {
294
			data: {
295
				"professorId": userid,
296
				"watchObject": watchObject
297
			},
298
			dataType: 'json', //数据格式类型
299
			type: 'get', //http请求类型
300
			timeout: 10000,
301
			async: false,
302
			success: function(data) {
303
				if(data.success && data.data != null) {
304
					if(num=="1"){//已关注专家
305
						that.classList.add("attenedSpan");
306
						that.innerText="已关注";
307
					}else{//已收藏资源或文章
308
						document.getElementById("ifCollect").classList.remove("icon-shoucang");
309
						document.getElementById("ifCollect").classList.add("icon-yishoucang");
310
					}
311
				} else {
312
					if(num=="1"){//关注专家
313
						that.classList.remove("attenedSpan");
314
						that.innerText="关注";
315
					}else{//收藏资源或文章
316
						document.getElementById("ifCollect").classList.add("icon-shoucang");
317
						document.getElementById("ifCollect").classList.remove("icon-yishoucang");
318
					}
319
				}
320
			},
321
			error: function() {
322
				plus.nativeUI.toast("服务器链接超时", toastStyle);
323
			}
324
		});
325
	}
326
327
	/*收藏资源、文章或者关注专家*/
328
	function collectionAbout1(watchObject, num,sel) {
329
		mui.ajax(baseUrl + '/ajax/watch', {
330
			data: {
331
				"professorId": userid,
332
				"watchObject": watchObject,
333
				"watchType": num
334
			},
335
			dataType: 'json', //数据格式类型
336
			type: 'POST', //http请求类型
337
			timeout: 10000,
338
			async: false,
339
			success: function(data) {
340
				if(data.success) {
341
					if(num=="1"){//关注专家
342
						sel.classList.add("attenedSpan");
343
						sel.innerText="已关注";
344
						plus.nativeUI.toast("关注成功", toastStyle);
345
					}else{//收藏资源或文章
346
						document.getElementById("ifCollect").classList.remove("icon-shoucang");
347
						document.getElementById("ifCollect").classList.add("icon-yishoucang");
348
						plus.nativeUI.toast("收藏成功", toastStyle);
349
					}
350
				}
351
			},
352
			error: function() {
353
				plus.nativeUI.toast("服务器链接超时", toastStyle);
354
			}
355
		});
356
	}
357
358
	/*取消收藏资源、文章或者取消关注专家*/
359
	function cancelCollectionAbout1(watchObject, num,sel) {
360
		mui.ajax({
361
			url: baseUrl + '/ajax/watch/delete',
362
			data: {
363
				professorId: userid,
364
				watchObject: watchObject
365
			},
366
			dataType: 'json', //数据格式类型
367
			type: 'post', //http请求类型
368
			timeout: 10000,
369
			async: true,
370
			success: function(data) {
371
				console.log(data.success)
372
				if(data.success) {
373
					if(num=="1"){//关注专家
374
						sel.classList.remove("attenedSpan");
375
						sel.innerText="关注";
376
						plus.nativeUI.toast("已取消关注", toastStyle);
377
					}else{//收藏资源或文章
378
						document.getElementById("ifCollect").classList.add("icon-shoucang");
379
						document.getElementById("ifCollect").classList.remove("icon-yishoucang");
380
						plus.nativeUI.toast("已取消收藏", toastStyle);
381
					}
382
					
383
				}
384
			},
385
			error: function(data) {
386
				plus.nativeUI.toast("服务器链接超时", toastStyle);
387
			}
388
		});
389
390
	}
391
	/*微信及微信朋友圈分享专家*/
214 392
	var auths, shares;
215 393
	plus.oauth.getServices(function(services) {
216 394
		auths = {};
@ -240,15 +418,15 @@ mui.plusReady(function() {
240 418
		document.getElementById("maskBlack").style.display = "none";
241 419
		var oFen = this.getElementsByTagName("span")[0].innerHTML;
242 420
243
		var oUrl=baseUrl + "/images/logo180.png";
244
		
421
		var oUrl = baseUrl + "/images/logo180.png";
422
245 423
		if(oFen == "微信好友") {
246 424
			var share = buildShareService("weixin");
247 425
			if(share) {
248 426
				shareMessage(share, "WXSceneSession", {
249
					content: document.getElementById("paperAbstract").innerHTML.substring(0,40),
427
					content: document.getElementById("paperAbstract").innerHTML.substring(0, 40),
250 428
					title: document.getElementById("paperName").innerHTML,
251
					href: baseUrl + "/e/l.html?id=" + paperId ,
429
					href: baseUrl + "/e/l.html?id=" + paperId,
252 430
					thumbs: [oUrl]
253 431
				});
254 432
			}
@ -256,9 +434,9 @@ mui.plusReady(function() {
256 434
			var share = buildShareService("weixin");
257 435
			if(share) {
258 436
				shareMessage(share, "WXSceneTimeline", {
259
					content: document.getElementById("paperAbstract").innerHTML.substring(0,40),
437
					content: document.getElementById("paperAbstract").innerHTML.substring(0, 40),
260 438
					title: document.getElementById("paperName").innerHTML,
261
					href: baseUrl + "/e/l.html?id=" + paperId ,
439
					href: baseUrl + "/e/l.html?id=" + paperId,
262 440
					thumbs: [oUrl]
263 441
				});
264 442
			}
@ -266,7 +444,7 @@ mui.plusReady(function() {
266 444
			var share = buildShareService("sinaweibo");
267 445
			if(share) {
268 446
				shareMessage(share, "sinaweibo", {
269
					content: document.getElementById("paperName").innerHTML+ baseUrl + "/e/l.html?id=" + paperId ,
447
					content: document.getElementById("paperName").innerHTML + baseUrl + "/e/l.html?id=" + paperId,
270 448
				});
271 449
			}
272 450
		}
@ -317,23 +495,24 @@ mui.plusReady(function() {
317 495
	/*图像预览*/
318 496
	mui.previewImage();
319 497
	moreMes();
320
	function moreMes(){
321
		document.getElementById("BtnMore").addEventListener("tap",function(){
322
			var oUrl=baseUrl + "/images/logo180.png";
498
499
	function moreMes() {
500
		document.getElementById("BtnMore").addEventListener("tap", function() {
501
			var oUrl = baseUrl + "/images/logo180.png";
323 502
			plus.nativeUI.showWaiting(); //显示原生等待框
324
		var webviewShow = plus.webview.create("../html/moreItem.html", 'moreItem.html', {}, {
325
			proid: paperId,
326
			name:"paper",
327
			data:{
328
					content: document.getElementById("paperAbstract").innerHTML.substring(0,40),
503
			var webviewShow = plus.webview.create("../html/moreItem.html", 'moreItem.html', {}, {
504
				proid: paperId,
505
				name: "paper",
506
				data: {
507
					content: document.getElementById("paperAbstract").innerHTML.substring(0, 40),
329 508
					title: document.getElementById("paperName").innerHTML,
330
					href: baseUrl + "/e/l.html?id=" + paperId ,
509
					href: baseUrl + "/e/l.html?id=" + paperId,
331 510
					thumbs: [oUrl]
332 511
				},
333
			weiboData:{
334
					content: document.getElementById("paperName").innerHTML+ baseUrl + "/e/l.html?id=" + paperId ,
512
				weiboData: {
513
					content: document.getElementById("paperName").innerHTML + baseUrl + "/e/l.html?id=" + paperId,
335 514
				}
336
		})
515
			})
337 516
		})
338 517
	}
339 518
});

+ 176 - 6
app/js/patentShow.js

@ -3,7 +3,8 @@ var ocollectBtn = document.getElementById("collectBtn"); //收藏按钮
3 3
var patentId;
4 4
mui.plusReady(function() {
5 5
	var userid = plus.storage.getItem('userid');
6
	var self = plus.webview.currentWebview();
6
	var self = plus.webview.currentWebview();
7
	var userName = plus.storage.getItem('name');
7 8
	patentId = self.patentId;
8 9
	//patentId="FE95F18DDCFA4E64BF62C014D67E95FB";
9 10
	getRecourceMe();/*获取资源信息*/
@ -120,11 +121,13 @@ mui.plusReady(function() {
120 121
			"type": "GET",
121 122
			"success": function(data) {
122 123
				if(data.success) {
124
					console.log(JSON.stringify(data))
123 125
					if(data.data.length>0){
124 126
						for(var i=0;i<data.data.length;i++){
125 127
							var authTy="",authTit="",baseInfo="",imgbg="../images/default-photo.jpg";
128
							console.log(data.data[i].professorId)
126 129
							if(data.data[i].professorId.substring(0, 1) != "#"){
127
								$.ajax(baseUrl +"/ajax/professor/editBaseInfo/" + data.data[i].professorId,{
130
								mui.ajax(baseUrl +"/ajax/professor/editBaseInfo/" + data.data[i].professorId,{
128 131
									type:"get",
129 132
									async:true,
130 133
									success:function($proData){
@ -166,26 +169,29 @@ mui.plusReady(function() {
166 169
												}
167 170
											}
168 171
											var liItem = document.createElement("li");
172
											var odis = (userid == showPro.id) ? "none" : "block";
169 173
											liItem.setAttribute("data-id",showPro.id);
170 174
											liItem.className = "mui-table-view-cell"
171 175
											var oString = '<div class="flexCenter mui-clearfix">'
172 176
											oString += '<div class="madiaHead useHead" style="background-image:url('+ imgbg +')"></div>'
173 177
											oString += '<div class="madiaInfo"><p><span class="h1Font">'+ showPro.name +'</span><em class="authicon '+ authTy +'" title="'+ authTit +'"></em></p>'
174 178
											oString += '<p class="mui-ellipsis h2Font">'+ baseInfo +'</p>'
175
											oString += '</div></div>'
179
											oString += '</div></div><span class="mui-icon attenSpan"  style="display:' + odis + ';" data-id="'+showPro.id+'">关注</span>'
176 180
											liItem.innerHTML = oString;
177 181
											document.getElementById("aboutAuthors").appendChild(liItem);
182
											ifcollectionAbout1.call(liItem.getElementsByClassName("attenSpan")[0],showPro.id,1);
178 183
										}
179 184
									}
180 185
								})
181 186
							}else{
182 187
								var liItem = document.createElement("li");
188
								var otext = (userName == data.data[i].name) ? "是我本人" : "邀请ta加入";
183 189
								liItem.setAttribute("data-id",data.data[i].professorId);
184 190
								liItem.className = "mui-table-view-cell"
185 191
								var oString = '<div class="flexCenter mui-clearfix">'
186 192
								oString += '<div class="madiaHead useHead" style="background-image:url('+ imgbg +')"></div>'
187 193
								oString += '<div class="madiaInfo"><p><span class="h1Font">'+ data.data[i].name  +'</span></p>'
188
								oString += '</div></div>'
194
								oString += '</div></div><span class="invite">' + otext + '</span>'
189 195
								liItem.innerHTML = oString;
190 196
								document.getElementById("aboutAuthors").appendChild(liItem);
191 197
							}
@ -210,11 +216,175 @@ mui.plusReady(function() {
210 216
         if(userid==null || userid=='null'|userid == undefined |userid == 'undefined'){
211 217
			mui.openWindow({
212 218
				url: '../html/login.html',
213
				id: 'login.html'
219
				id: 'login.html',
220
				extras: {
221
					ourl: self.id
222
				}
214 223
			})
224
			return 1;
215 225
		}
226
         return 0;
216 227
	};
217
	
228
	window.addEventListener("newId", function(event) {
229
		userName = plus.storage.getItem('name');
230
		userid = plus.storage.getItem('userid');
231
		getRecourceMe();
232
		ifcollectionAbout(patentId,4);
233
	});
234
	function leadIn(sel) {
235
		mui.ajax(baseUrl + "/ajax/ppatent/ass", {
236
			"type": "POST",
237
			"data": {
238
				id: patentId,
239
				uid: userid,
240
				author: userName
241
			},
242
			"success": function(data) {
243
				if(data.success) {
244
					if(data.data > 0) {
245
						plus.nativeUI.toast("导入成功", toastStyle);
246
						sel.style.display = "none";
247
					}
248
				}
249
			}
250
		});
251
	}
252
	mui("#aboutAuthors").on("tap", "li>span", function() {
253
		var that = this;
254
		if(this.innerHTML === "是我本人") {
255
			if(isLogin()) {
256
				return;
257
			}
258
			
259
			var btn = ["确定", "取消"];
260
			mui.confirm("确认这是您发表的专利?", "提示", btn, function(e) {
261
				if(e.index == 0) {
262
					leadIn(that);
263
				}
264
			})
265
		} else if(this.innerHTML === "邀请ta加入") {
266
			var share = buildShareService("weixin");
267
			if(share) {
268
				shareMessage(share, "WXSceneSession", {
269
					content: document.getElementById("paperAbstract").innerHTML.substring(0, 40),
270
					title: document.getElementById("paperName").innerHTML,
271
					href: baseUrl + "/e/l.html?id=" + paperId,
272
					thumbs: [baseUrl + "/images/logo180.png"]
273
				});
274
			}
275
		} else if(this.innerHTML === "关注") {
276
			if(isLogin()) {
277
				return;
278
			}
279
					collectionAbout1(this.getAttribute("data-id"), '1',this);
280
		} else if(this.innerHTML === "已关注") {
281
			if(isLogin()) {
282
				return;
283
			}
284
			cancelCollectionAbout1(this.getAttribute("data-id"), '1',this);
285
		}
286
	})
287
	/*判断是否收藏资源文章或者是否关注专家*/
288
	function ifcollectionAbout1(watchObject,num) {
289
		var that=this;
290
		mui.ajax(baseUrl + '/ajax/watch/hasWatch', {
291
			data: {
292
				"professorId": userid,
293
				"watchObject": watchObject
294
			},
295
			dataType: 'json', //数据格式类型
296
			type: 'get', //http请求类型
297
			timeout: 10000,
298
			async: false,
299
			success: function(data) {
300
				if(data.success && data.data != null) {
301
					if(num=="1"){//已关注专家
302
						that.classList.add("attenedSpan");
303
						that.innerText="已关注";
304
					}else{//已收藏资源或文章
305
						document.getElementById("ifCollect").classList.remove("icon-shoucang");
306
						document.getElementById("ifCollect").classList.add("icon-yishoucang");
307
					}
308
				} else {
309
					if(num=="1"){//关注专家
310
						that.classList.remove("attenedSpan");
311
						that.innerText="关注";
312
					}else{//收藏资源或文章
313
						document.getElementById("ifCollect").classList.add("icon-shoucang");
314
						document.getElementById("ifCollect").classList.remove("icon-yishoucang");
315
					}
316
				}
317
			},
318
			error: function() {
319
				plus.nativeUI.toast("服务器链接超时", toastStyle);
320
			}
321
		});
322
	}
323
324
	/*收藏资源、文章或者关注专家*/
325
	function collectionAbout1(watchObject, num,sel) {
326
		mui.ajax(baseUrl + '/ajax/watch', {
327
			data: {
328
				"professorId": userid,
329
				"watchObject": watchObject,
330
				"watchType": num
331
			},
332
			dataType: 'json', //数据格式类型
333
			type: 'POST', //http请求类型
334
			timeout: 10000,
335
			async: false,
336
			success: function(data) {
337
				if(data.success) {
338
					if(num=="1"){//关注专家
339
						sel.classList.add("attenedSpan");
340
						sel.innerText="已关注";
341
						plus.nativeUI.toast("关注成功", toastStyle);
342
					}else{//收藏资源或文章
343
						document.getElementById("ifCollect").classList.remove("icon-shoucang");
344
						document.getElementById("ifCollect").classList.add("icon-yishoucang");
345
						plus.nativeUI.toast("收藏成功", toastStyle);
346
					}
347
				}
348
			},
349
			error: function() {
350
				plus.nativeUI.toast("服务器链接超时", toastStyle);
351
			}
352
		});
353
	}
354
355
	/*取消收藏资源、文章或者取消关注专家*/
356
	function cancelCollectionAbout1(watchObject, num,sel) {
357
		mui.ajax({
358
			url: baseUrl + '/ajax/watch/delete',
359
			data: {
360
				professorId: userid,
361
				watchObject: watchObject
362
			},
363
			dataType: 'json', //数据格式类型
364
			type: 'post', //http请求类型
365
			timeout: 10000,
366
			async: true,
367
			success: function(data) {
368
				console.log(data.success)
369
				if(data.success) {
370
					if(num=="1"){//关注专家
371
						sel.classList.remove("attenedSpan");
372
						sel.innerText="关注";
373
						plus.nativeUI.toast("已取消关注", toastStyle);
374
					}else{//收藏资源或文章
375
						document.getElementById("ifCollect").classList.add("icon-shoucang");
376
						document.getElementById("ifCollect").classList.remove("icon-yishoucang");
377
						plus.nativeUI.toast("已取消收藏", toastStyle);
378
					}
379
					
380
				}
381
			},
382
			error: function(data) {
383
				plus.nativeUI.toast("服务器链接超时", toastStyle);
384
			}
385
		});
386
387
	}
218 388
   /*微信及微信朋友圈分享专家*/
219 389
	var auths, shares;
220 390
	plus.oauth.getServices(function(services) {

+ 34 - 11
app/js/searchListNew2.js

@ -35,7 +35,6 @@ function getViewportSize () {
35 35
        height: window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight
36 36
    };
37 37
}
38
console.log(oWidth)
39 38
for(var n=0;n<6;n++) {
40 39
	document.getElementsByClassName("mui-control-item")[n].style.paddingLeft=(oWidth-4.5*45)/9+"px";
41 40
	document.getElementsByClassName("mui-control-item")[n].style.paddingRight=(oWidth-4.5*45)/9+"px";
@ -334,7 +333,7 @@ for(var n=0;n<6;n++) {
334 333
						document.getElementById('arNoSearch').classList.remove("displayNone");
335 334
						return;
336 335
					}
337
					if(pageNo < Math.ceil(data.total / data.pageSize)) {
336
					if(data.pageNo < Math.ceil(data.total / data.pageSize)) {
338 337
						//mui('#pullrefresh').pullRefresh().endPullupToRefresh(false)
339 338
						key1[5].endPullUpToRefresh(false);
340 339

@ -350,7 +349,7 @@ for(var n=0;n<6;n++) {
350 349
						key1[5].endPullUpToRefresh(true);
351 350
						return;
352 351
					}
353
					if(pageNo < Math.ceil(data.total / data.pageSize)) {
352
					if(data.pageNo < Math.ceil(data.total / data.pageSize)) {
354 353
						//mui('#pullrefresh').pullRefresh().endPullupToRefresh(false)
355 354
						key1[5].endPullUpToRefresh(false);
356 355
					} else {
@ -405,6 +404,7 @@ for(var n=0;n<6;n++) {
405 404
				}
406 405
			},
407 406
			patent: function(data) {
407
				
408 408
				if(key2[3] == 1) {
409 409
					plus.nativeUI.closeWaiting();
410 410
					plus.webview.currentWebview().show("slide-in-right", 150);
@ -442,7 +442,7 @@ for(var n=0;n<6;n++) {
442 442
						document.getElementById('ptNoSearch').classList.remove("displayNone");
443 443
						return;
444 444
					}
445
					if(pageNo < Math.ceil(data.total / data.pageSize)) {
445
					if(data.pageNo < Math.ceil(data.total / data.pageSize)) {
446 446
						//mui('#pullrefresh').pullRefresh().endPullupToRefresh(false)
447 447
						key1[3].endPullUpToRefresh(false);
448 448

@ -458,7 +458,7 @@ for(var n=0;n<6;n++) {
458 458
						key1[3].endPullUpToRefresh(true);
459 459
						return;
460 460
					}
461
					if(pageNo < Math.ceil(data.total / data.pageSize)) {
461
					if(data.pageNo < Math.ceil(data.total / data.pageSize)) {
462 462
						//mui('#pullrefresh').pullRefresh().endPullupToRefresh(false)
463 463
						key1[3].endPullUpToRefresh(false);
464 464
					} else {
@ -467,6 +467,7 @@ for(var n=0;n<6;n++) {
467 467
					}
468 468
				}
469 469
				for(var i = 0; i < $data.length; i++) {
470
					console.log(JSON.stringify($data[i]));
470 471
					var li = document.createElement("li");
471 472
					li.setAttribute("data-id", $data[i].id);
472 473
					li.className = "mui-table-view-cell";
@ -518,7 +519,7 @@ for(var n=0;n<6;n++) {
518 519
						document.getElementById('ppNoSearch').classList.remove("displayNone");
519 520
						return;
520 521
					}
521
					if(pageNo < Math.ceil(data.total / data.pageSize)) {
522
					if(data.pageNo < Math.ceil(data.total / data.pageSize)) {
522 523
						//mui('#pullrefresh').pullRefresh().endPullupToRefresh(false)
523 524
						key1[4].endPullUpToRefresh(false);
524 525

@ -534,7 +535,7 @@ for(var n=0;n<6;n++) {
534 535
						key1[4].endPullUpToRefresh(true);
535 536
						return;
536 537
					}
537
					if(pageNo < Math.ceil(data.total / data.pageSize)) {
538
					if(data.pageNo < Math.ceil(data.total / data.pageSize)) {
538 539
						//mui('#pullrefresh').pullRefresh().endPullupToRefresh(false)
539 540
						key1[4].endPullUpToRefresh(false);
540 541
					} else {
@ -594,7 +595,7 @@ for(var n=0;n<6;n++) {
594 595
						document.getElementById('coNoSearch').classList.remove("displayNone");
595 596
						return;
596 597
					}
597
					if(pageNo < Math.ceil(data.total / data.pageSize)) {
598
					if(data.pageNo < Math.ceil(data.total / data.pageSize)) {
598 599
						//mui('#pullrefresh').pullRefresh().endPullupToRefresh(false)
599 600
						key1[1].endPullUpToRefresh(false);
600 601

@ -610,7 +611,7 @@ for(var n=0;n<6;n++) {
610 611
						key1[1].endPullUpToRefresh(true);
611 612
						return;
612 613
					}
613
					if(pageNo < Math.ceil(data.total / data.pageSize)) {
614
					if(data.pageNo < Math.ceil(data.total / data.pageSize)) {
614 615
						//mui('#pullrefresh').pullRefresh().endPullupToRefresh(false)
615 616
						key1[1].endPullUpToRefresh(false);
616 617
					} else {
@ -619,7 +620,6 @@ for(var n=0;n<6;n++) {
619 620
					}
620 621
				}
621 622
				for(var i = 0; i < $data.length; i++) {
622
					console.log(JSON.stringify($data[i]))
623 623
					var li = document.createElement("li");
624 624
					li.setAttribute("data-id", $data[i].id);
625 625
					var oimg = ($data[i].hasOrgLogo) ? baseUrl + "/images/org/" + $data[i].id + ".jpg" : "../images/default-icon.jpg";
@ -676,7 +676,8 @@ for(var n=0;n<6;n++) {
676 676
		} else if(webview.qiFlag == 4) {
677 677
			document.getElementById("searchval").setAttribute("placeholder", "输入专利名称、发明人、专利号或相关关键词");
678 678
			document.getElementById("sele").classList.add("displayNone");
679
			document.getElementById("searB").classList.remove("searchboxNewT");			
679
			document.getElementById("searB").classList.remove("searchboxNewT");	
680
			
680 681
			search.oAjaxGet(baseUrl + "/ajax/ppatent/pq", {
681 682
				"qw": obj.pt,
682 683
				"pageSize": pageSize,
@ -846,6 +847,7 @@ for(var n=0;n<6;n++) {
846 847
						}, "get", search.article);
847 848
					}
848 849
				} else if(tabFlag == 4) {
850
					
849 851
					if(obj.pt != searchval) {
850 852
						key1[3].refresh(true);
851 853
						pageNo.pt = 1;
@ -898,6 +900,10 @@ for(var n=0;n<6;n++) {
898 900
				document.getElementById("sele").classList.remove("displayNone");
899 901
				document.getElementById("searB").classList.add("searchboxNewT");
900 902
				if(key2[0] == 1) {
903
					if(obj.ex != searchval) {
904
						obj.ex = searchval;
905
					}
906
					flag = 1;
901 907
					pageNo.ex = 1;
902 908
					search.oAjaxGet(baseUrl + "/ajax/professor/pqAPP", {
903 909
						"key": obj.ex,
@ -934,6 +940,9 @@ for(var n=0;n<6;n++) {
934 940
				document.getElementById("sele").classList.add("displayNone");
935 941
				document.getElementById("searB").classList.remove("searchboxNewT");
936 942
				if(key2[2] == 1) {
943
					if(obj.rs != searchval) {
944
						obj.rs = searchval;
945
					}
937 946
					flag = 1;
938 947
					pageNo.rs = 1;
939 948
					search.oAjaxGet(baseUrl + "/ajax/resource/firstpq", {
@ -962,6 +971,9 @@ for(var n=0;n<6;n++) {
962 971
				document.getElementById("sele").classList.add("displayNone");
963 972
				document.getElementById("searB").classList.remove("searchboxNewT");
964 973
				if(key2[5] == 1) {
974
					if(obj.ar != searchval) {
975
						obj.ar = searchval;
976
					}
965 977
					flag = 1;
966 978
					pageNo.ar = 1;
967 979
					search.oAjaxGet(baseUrl + "/ajax/article/firstpq", {
@ -990,6 +1002,11 @@ for(var n=0;n<6;n++) {
990 1002
				document.getElementById("sele").classList.add("displayNone");
991 1003
				document.getElementById("searB").classList.remove("searchboxNewT");
992 1004
				if(key2[3] == 1) {
1005
					if(obj.pt != searchval) {
1006
						obj.pt = searchval;
1007
					}
1008
					console.log(obj.pt);
1009
					console.log(searchval);
993 1010
					flag = 1;
994 1011
					pageNo.pt = 1;
995 1012
					search.oAjaxGet(baseUrl + "/ajax/ppatent/pq", {
@ -1018,6 +1035,9 @@ for(var n=0;n<6;n++) {
1018 1035
				document.getElementById("sele").classList.add("displayNone");
1019 1036
				document.getElementById("searB").classList.remove("searchboxNewT");
1020 1037
				if(key2[4] == 1) {
1038
					if(obj.pp != searchval) {
1039
						obj.pp = searchval; 
1040
					}
1021 1041
					flag = 1;
1022 1042
					pageNo.pp = 1;
1023 1043
					search.oAjaxGet(baseUrl + "/ajax/ppaper/pq", {
@ -1046,6 +1066,9 @@ for(var n=0;n<6;n++) {
1046 1066
				document.getElementById("sele").classList.add("displayNone");
1047 1067
				document.getElementById("searB").classList.remove("searchboxNewT");
1048 1068
				if(key2[1] == 1) {
1069
					if(obj.co != searchval) {
1070
						obj.co = searchval;
1071
					}
1049 1072
					flag = 1;
1050 1073
					pageNo.co = 1;
1051 1074
					search.oAjaxGet(baseUrl + "/ajax/org/find/pq", {