jack 8 years ago
parent
commit
be1ecc5c8f
2 changed files with 34 additions and 1 deletions
  1. 1 1
      app/html/professorArticle.html
  2. 33 0
      app/js/professorArticle.js

+ 1 - 1
app/html/professorArticle.html

38
					<span class="mui-pull-left">留言</span> 
38
					<span class="mui-pull-left">留言</span> 
39
				</div>
39
				</div>
40
			</div>
40
			</div>
41
			<div class="attentbtn mui-pull-left" id="collect" collectFlag="1">
41
			<div class="attentbtn mui-pull-left" id="collect">
42
				<em class="mui-iocn iconfont icon-favor" id="yesExpert"></em>
42
				<em class="mui-iocn iconfont icon-favor" id="yesExpert"></em>
43
				<em class="mui-iocn iconfont icon-favorfill" style="display:none;" id="noExpert"></em>
43
				<em class="mui-iocn iconfont icon-favorfill" style="display:none;" id="noExpert"></em>
44
				<!--已经关注icon-favorfill-->
44
				<!--已经关注icon-favorfill-->

+ 33 - 0
app/js/professorArticle.js

247
				beforeSend: function() {},
247
				beforeSend: function() {},
248
				success: function(data, textState) {
248
				success: function(data, textState) {
249
					if(data.success) {
249
					if(data.success) {
250
						plus.nativeUI.toast("收藏成功", toastStyle);
250
						document.getElementById("collect").setAttribute("collectFlag","1");
251
						document.getElementById("collect").setAttribute("collectFlag","1");
251
						document.getElementById("yesExpert").style.display="none";
252
						document.getElementById("yesExpert").style.display="none";
252
						document.getElementById("noExpert").style.display="block";
253
						document.getElementById("noExpert").style.display="block";
289
			}
290
			}
290
			collect();
291
			collect();
291
		})
292
		})
293
		/*进入文章浏览页面判断是否收藏文章*/
294
		attentionArticle();
295
		function attentionArticle(){
296
			if(!userid){
297
				return;
298
			}
299
			mui.ajax(baseUrl + "/ajax/watch/hasWatch", {
300
				type: "GET",
301
				timeout: 10000,
302
				dataType: "json",
303
				data: {
304
					"professorId": userid,
305
					"watchObject": proId
306
				},
307
				success: function(data) {
308
					if(data.success) {
309
						if(data.data==null){
310
							document.getElementById("collect").setAttribute("collectFlag","0");
311
							document.getElementById("yesExpert").style.display="block";
312
							document.getElementById("noExpert").style.display="none";
313
						}else{
314
						document.getElementById("collect").setAttribute("collectFlag","1");
315
						document.getElementById("yesExpert").style.display="none";
316
						document.getElementById("noExpert").style.display="block";
317
						}
318
					}
319
				},
320
				error: function(XMLHttpRequest, textStats, errorThrown) {
321
					console.log(JSON.stringify(XMLHttpRequest));
322
				}
323
			})
324
		}
292
		/*微信及微信朋友圈分享专家*/
325
		/*微信及微信朋友圈分享专家*/
293
	var auths, shares;
326
	var auths, shares;
294
	document.getElementById("shareBtn").addEventListener("tap", function() {
327
	document.getElementById("shareBtn").addEventListener("tap", function() {