jack vor 8 Jahren
Ursprung
Commit
be1ecc5c8f
2 geänderte Dateien mit 34 neuen und 1 gelöschten Zeilen
  1. 1 1
      app/html/professorArticle.html
  2. 33 0
      app/js/professorArticle.js

+ 1 - 1
app/html/professorArticle.html

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

+ 33 - 0
app/js/professorArticle.js

@ -247,6 +247,7 @@ mui.plusReady(function() {
247 247
				beforeSend: function() {},
248 248
				success: function(data, textState) {
249 249
					if(data.success) {
250
						plus.nativeUI.toast("收藏成功", toastStyle);
250 251
						document.getElementById("collect").setAttribute("collectFlag","1");
251 252
						document.getElementById("yesExpert").style.display="none";
252 253
						document.getElementById("noExpert").style.display="block";
@ -289,6 +290,38 @@ mui.plusReady(function() {
289 290
			}
290 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 326
	var auths, shares;
294 327
	document.getElementById("shareBtn").addEventListener("tap", function() {