jack 8 years ago
parent
commit
7a5ad59b21
2 changed files with 59 additions and 21 deletions
  1. 5 0
      app/js/login.js
  2. 54 21
      app/js/professorArticle.js

+ 5 - 0
app/js/login.js

@ -100,6 +100,11 @@ mui.ready(function() {
100 100
					if(data.data != "null" && data.data != null) {
101 101
						var userId = data.data.id;
102 102
						plus.storage.setItem('userid', userId);
103
						var article = plus.webview.currentWebview();
104
						if(article.flag==1){
105
							var proAiticle =plus.webview.getWebviewById('professorArticle.html')
106
							mui.fire(proAiticle, "newId");
107
						}
103 108
						firstLogin();
104 109
						
105 110
						var consultPage = plus.webview.getWebviewById('consultlist.html');

+ 54 - 21
app/js/professorArticle.js

@ -177,7 +177,16 @@ mui.plusReady(function() {
177 177
	document.getElementById("leaveWord").addEventListener("tap", function() {
178 178
			var userid = plus.storage.getItem('userid');
179 179
			if(!userid) {
180
				goLoginFun();
180
				mui.openWindow({
181
			url: '../html/login.html',
182
			id: '../html/login.html',
183
			show: {
184
				aniShow: "slide-in-bottom"
185
			},
186
			extras: {
187
				flag: 1
188
			}
189
		});
181 190
				return;
182 191
			}
183 192
			var nwaiting = plus.nativeUI.showWaiting();
@ -222,22 +231,32 @@ mui.plusReady(function() {
222 231
			}
223 232
		})
224 233
	}
225
		document.getElementById("thumbsUp").addEventListener("tap",function(){
226
			var userid = plus.storage.getItem('userid');
227
			var oUrl;
228
			oThumsflag=this.getAttribute("oThumsflag");
229
			console.log(oThumsflag)
230
			if(!userid) {
231
				goLoginFun();
232
				return;
234
		document.getElementById("thumbsUp").addEventListener("tap", function() {
235
	var userid = plus.storage.getItem('userid');
236
	var oUrl;
237
	oThumsflag = this.getAttribute("oThumsflag");
238
	console.log(oThumsflag)
239
	if(!userid) {
240
		mui.openWindow({
241
			url: '../html/login.html',
242
			id: '../html/login.html',
243
			show: {
244
				aniShow: "slide-in-bottom"
245
			},
246
			extra: {
247
				flag: 1
233 248
			}
234
			(oThumsflag==0)?oUrl="/ajax/article/agree":oUrl="/ajax/article/unAgree";
235
			console.log(oUrl);
236
			thums(oUrl);
237
		})
249
		});
250
		return;
251
	}
252
	(oThumsflag == 0) ? oUrl = "/ajax/article/agree": oUrl = "/ajax/article/unAgree";
253
	console.log(oUrl);
254
	thums(oUrl);
255
})
238 256
		isAgreeArticle();
239 257
		/*查询登录者是否为这篇文章点过赞*/
240 258
		function isAgreeArticle(){
259
			var userid = plus.storage.getItem('userid');
241 260
			if(!userid){
242 261
				return;
243 262
			}
@ -319,18 +338,28 @@ mui.plusReady(function() {
319 338
			});
320 339
		}
321 340
	}
322
		document.getElementById("collect").addEventListener("click",function(){
323
			var userid = plus.storage.getItem('userid');
324
			oCollectFlag=this.getAttribute("collectFlag");
325
			if(!userid) {
326
				goLoginFun();
327
				return;
341
		document.getElementById("collect").addEventListener("click", function() {
342
	var userid = plus.storage.getItem('userid');
343
	oCollectFlag = this.getAttribute("collectFlag");
344
	if(!userid) {
345
		mui.openWindow({
346
			url: '../html/login.html',
347
			id: '../html/login.html',
348
			show: {
349
				aniShow: "slide-in-bottom"
350
			},
351
			extras: {
352
				flag: 1
328 353
			}
329
			collect();
330
		})
354
		});
355
		return;
356
	}
357
	collect();
358
})
331 359
		/*进入文章浏览页面判断是否收藏文章*/
332 360
		attentionArticle();
333 361
		function attentionArticle(){
362
			var userid = plus.storage.getItem('userid');
334 363
			if(!userid){
335 364
				return;
336 365
			}
@ -360,6 +389,10 @@ mui.plusReady(function() {
360 389
				}
361 390
			})
362 391
		}
392
		window.addEventListener("newId", function(event) {
393
			attentionArticle();
394
			isAgreeArticle();
395
		})
363 396
		/*微信及微信朋友圈分享专家*/
364 397
	var auths, shares;
365 398
	document.getElementById("shareBtn").addEventListener("tap", function() {