var articleId = null; // 是否显示底部“收藏、分享”按钮 var showHandleBar = true; var patient = null; var patientName = ""; var pCodes = [], referrer, isfromAdmin; mui.init(); mui.plusReady(function() { self = plus.webview.currentWebview(); articleId = self.articleId; patient = self.patient; var userAgent = JSON.parse(plus.storage.getItem("userAgent")); if(userAgent.observer){ isfromAdmin=true; } patientName = self.patientName; pCodes = self.pCodes; referrer = self.referrer; showHandleBar = self.showHandleBar; initPage(); bindEvents(); }) function initPage() { var url = "/third/jkEdu/Article/getArticalById", params = { articleId: articleId, userType: 1 }; plus.nativeUI.showWaiting(); sendGet(url, params, null, function(res) { if(res.status == 200) { var content = res.data.articleContent; var reg=/group1\//g; content = content.replace(reg,imgUrlDomain+ 'group1/'); var html = template("article_tmpl", { it: res.data, content: content, showHandleBar: showHandleBar}); $("#xiangqing-content").html(html); //禁止超链接执行默认行为 $("#xiangqing-content a").attr("onclick","return false"); } else { queryFailed(res); } plus.nativeUI.closeWaiting(); }); } function queryFailed(res) { if(res.msg) { plus.nativeUI.toast(res.msg); } else { plus.nativeUI.toast("加载文章失败!"); } } /* * 收藏文章 */ function collectionArticle(code,$this){ plus.nativeUI.showWaiting(); var params = {}; params.articleId = code; params.userType = 1; //1医生,2居民 sendPost("/third/jkEdu/Article/saveArticleCollection",params,function(res){ plus.nativeUI.closeWaiting(); if(res.msg){ plus.nativeUI.toast(res.msg); }else{ plus.nativeUI.toast("收藏失败!"); } },function(res){ plus.nativeUI.closeWaiting(); if(res.status==200){ $this.attr("data-status", 1); $this.find("img").attr("src", "../images/shoucang_pre.png"); var span = $this.find("span"); span.html('已收藏'); plus.nativeUI.toast("收藏成功"); }else{ if(res.msg){ plus.nativeUI.toast(res.msg); }else{ plus.nativeUI.toast("收藏失败!"); } } }) } /* * 取消收藏文章 */ function unCollectionArticle(code,$this){ plus.nativeUI.showWaiting(); var params = {}; params.articleId=code; params.userType = 1; //1医生,2居民 sendPost("/third/jkEdu/Article/cancelArticleCollection",params,function(res){ plus.nativeUI.closeWaiting(); if(res.msg){ plus.nativeUI.toast(res.msg); }else{ plus.nativeUI.toast("取消收藏失败!"); } },function(res){ plus.nativeUI.closeWaiting(); if(res.status==200){ $this.attr("data-status", 0); $this.find("img").attr("src", "../images/shoucang_button.png"); var span = $this.find("span"); span.html('收藏'); plus.nativeUI.toast("取消收藏成功"); }else{ if(res.msg){ plus.nativeUI.toast(res.msg); }else{ plus.nativeUI.toast("取消收藏失败!"); } } }) } //弹框提示是否发送给居民 function showDialog(article,title,patientName) { dialog({ title: '