123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332 |
- <!doctype html>
- <html>
- <head>
- <meta charset="utf-8">
- <title>公共咨询</title>
- <meta name="author" content="yihu.com"/>
- <meta name="format-detection" content="telephone=no"/>
- <meta name="viewport"
- content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0"/>
- <meta name="apple-mobile-web-app-capable" content="yes"/>
- <meta name="apple-mobile-web-app-status-bar-style" content="black"/>
- <link rel="stylesheet" type="text/css" href="../../../css/cross.css" />
- <link rel="stylesheet" type="text/css" href="../../../css/cross.ui.css">
- <link rel="stylesheet" type="text/css" href="../../../iconfont/iconfont.css" />
- <link rel="stylesheet" type="text/css" href="../../../css/ss-style.css" />
- <style>
- .discus.c-list > li.c-list-label { margin-left: 15px }
- </style>
- <script type="text/javascript" src="../../../js/jquery/2.1.3/jquery.js"></script>
- <script src="../js/ui_search_one.js"></script>
- <link rel="stylesheet" type="text/css" href="../../../widget/mobiscroll/2.15.1/css/mobiscroll.css">
- <script src="../../../widget/mobiscroll/2.15.1/js/mobiscroll.js"></script>
- <link rel="stylesheet" type="text/css" href="../../../widget/artDialog/6.0.5/css/ui-dialog.min.css">
- <script src="../../../widget/artDialog/6.0.5/js/dialog-plus.min.js"></script>
- <script src="../../../js/mui.min.js"></script>
- <script src="../../../js/app.js"></script>
- <script src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
- <script src="../../../js/common_http.js"></script>
- <script type="text/javascript" src="../../../js/weixin_common.js" ></script>
- </head>
- <body>
- <div class="mt10 pb10">
- <div class="">
- <ul class="c-list c-border-tb zx-timper">
- <li class="">
- <div class=" c-avatar-m"><img id="photo" src=""></div>
- <div class="c-list-info">
- <h4 class="c-nowrap" id="name"></h4>
- <p class="c-nowrap" id="czrq"></p>
- </div>
- </li>
- <li class="c-list-label">
- <h2 class="c-333 c-f17 c-bold mb5" id="title" style="word-break: break-word;"></h2>
- <!--<p class="c-333 c-f15">发病时间:<span id="when"></span></p>-->
- <p class="c-333 c-f15">疾病类型:<span id="diseaseName"></span></p>
- <p class="c-333 c-f15" style="word-break: break-word;">主要症状:<span id="content"></span></p>
- <p class="mt10 soper-pic" id="imageList"></p>
- </li>
- </ul>
- <div id="ulReply"></div>
- <a href="javascript:;" class="view-more c-37a6ed" id="view_more">点击查看更多</a>
- </div>
- </div>
- <div class="timper-addfix" onclick="add()"><i class="iconfont icon-jia"></i></div>
- <!-- 放置要缩放的图片的容器 -->
- <section class="imgzoom-pack">
- <div class="imgzoom-x">关闭</div>
- <div class="imgzoom-del"></div>
- <div class="imgzoom-img"><img src="" /></div>
- </section>
- <script>
- var d = dialog({contentType:'load', skin:'bk-popup'});
- var userAgent = window.localStorage.getItem(agentName);
- var Request = new Object();
- Request = GetRequest();
- var code = Request["code"];
- var toUser = Request["toUser"];
- var toName = decodeURIComponent(Request["toName"]);
- var openid = Request["openid"];
- var represented = Request["represented"];
- var id = 0;
- var pagesize = 10;
- var total = 0;
- var pagetype = 36;
- $(function(){
- if(!userAgent) {
- localStorage.setItem("toUser",toUser);
- window.location.href = server + "wx/html/home/html/zhmm-login.html?type=" + pagetype + "&openid=" + openid;
- return false;
- }
- var newUaObj = JSON.parse(window.localStorage.getItem(agentName))
- //判断关系
- function hasFamilyRelation(a,b){
- return new Promise(function(resolve, reject) {
- var data={
- patient:a,
- familyMember:b
- }
- sendPost("patient/family/is_authorize", data, "json", "get", function(res){
- dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'请求家庭成员关系失败'}).show();
- }, function(res){
- if(res.status == 200) {
- window.localStorage.setItem('nowPatientName',res.data.name);
- resolve(res)
- }else if(res.status == 100) {
- dialog({
- content:'对不起,'+res.data.name+'未授权给您,如需查看,请切换'+res.data.name+'账号登录',
- okValue:'切换账号',
- ok: function() {
- window.localStorage.setItem(pageName, JSON.stringify({pageurl: location.href}))
- window.location.href = "../../grzx/html/change-login.html?type=0&openid="+ Request["openid"];
- },
- cancelValue: '我不看了',
- cancel: function () {
- wx.closeWindow();
- }
- }).showModal();
- }else{
- relogin();
- }
-
- })
- })
- }
- //重新登录操作
- function relogin(){
- dialog({
- content:'对不起,该消息是发给'+toName+',如需查看,请切换'+toName+'账号登录',
- okValue:'切换账号',
- ok: function() {
- window.localStorage.setItem(pageName, JSON.stringify({pageurl: location.href}))
- window.location.href = "../../grzx/html/change-login.html?type=0&openid="+ Request["openid"];
- },
- cancelValue: '我不看了',
- cancel: function () {
- wx.closeWindow();
- }
- }).showModal();
- }
- //保存信息
- function saveUserInfo(a,b){
- Promise.all([hasFamilyRelation(a,b)]).then(function () {
- newUaObj.represented = represented;
- window.localStorage.setItem(agentName,JSON.stringify(newUaObj));
- userAgent = window.localStorage.getItem(agentName);
- detailInfo();
- })
- }
-
- function initFamilyData () {
- //从微信模板消息进入
- if(represented && userAgent && toUser){
- if(toUser == represented){
- saveUserInfo(represented,newUaObj.uid)
- }else if(toUser != represented && represented == newUaObj.uid){
- //本人代理
- saveUserInfo(represented,newUaObj.uid)
- }else if(toUser != represented && toUser == newUaObj.uid){
- //需要判定关系 200有授权 100家人 1无关系
- saveUserInfo(represented,newUaObj.uid)
- }else{
- //重新登录
- relogin();
- }
- }else{
- detailInfo();
- }
- }
- initFamilyData();
-
- document.getElementById('view_more').addEventListener("tap", function() {
- reply();
- });
- });
- //填充咨询详情
- function detailInfo() {
- d.show();
- var data = {};
- data.consult = code;
- $.ajax(server + "patient/consult/public/info", {
- data: data,
- type: 'POST',
- dataType: 'json',
- beforeSend: function(request) {
- request.setRequestHeader("userAgent", userAgent);
- },
- error: function(res) {
- d.close();
- if(res.status == 999 || res.status == 998 || res.status == 997){
- loginUrl(res.status);
- return;
- }
- dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'加载失败'}).show();
- },
- success: function(res) {
- if(res.status == 999 || res.status == 998 || res.status == 997){
- loginUrl(res.status);
- }
- else if (res.status == 200) {
- var photo = getImgUrl(res.data.photo);
- var name = res.data.name;
- var title = res.data.question;
- var when = res.data.when;
- var diseaseName = res.data.diseaseName;
- var content = res.data.content;
- var images = res.data.images;
- var czrq = res.data.czrq;
-
- var url1 = "../../../images/p-default.png";
- if(photo) url1 = photo;
- if(!name) name = "";
- if(!title) title = "";
- if(!when) when = "";
- if(!content) content = "";
- if(!diseaseName) diseaseName = "";
- if(!images) images = "";
- var imageList = images.split(',');
- if(!czrq) czrq = "";
-
- document.getElementById("photo").src = url1;
- document.getElementById("name").innerHTML = name;
- document.getElementById("czrq").innerHTML = czrq;
- document.getElementById("title").innerHTML = title;
- //document.getElementById("when").innerHTML = when;
- document.getElementById("diseaseName").innerHTML = diseaseName;
- document.getElementById("content").innerHTML = content;
- if(imageList.length > 0){
- var html = "";
- for(var i=0; i<imageList.length; i++){
- if(imageList[i] != ""){
- html += "<img src='" + getImgUrl(imageList[i]) + "' onclick='viewImg(this)'>";
- }
- }
- document.getElementById("imageList").innerHTML = html;
- }
- d.close();
- reply();
- } else {
- d.close();
- dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'加载失败'}).show();
- }
- }
- });
- }
- //获取回复信息
- function reply() {
- d.show();
- var data = {};
- data.consult = code;
- data.id = id;
- data.pagesize = pagesize;
- $.ajax(server + "patient/consult/public/reply_list", {
- data: data,
- type: 'POST',
- dataType: 'json',
- beforeSend: function(request) {
- request.setRequestHeader("userAgent", userAgent);
- },
- error: function(res) {
- d.close();
- if(res.status == 999 || res.status == 998 || res.status == 997){
- loginUrl(res.status);
- return;
- }
- dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'加载失败'}).show();
- document.querySelector("#view_more").innerText = "数据加载失败";
- },
- success: function(res) {
- if(res.status == 999 || res.status == 998 || res.status == 997){
- loginUrl(res.status);
- }
- else if (res.status == 200) {
- if(res.isFirst){
- total = res.total;
- }
- if (res.list.length > 0) {
- var list = res.list;
- var $list = document.querySelector("#ulReply");
- for (var i = 0; i < list.length; i++) {
- id = list[i].id;
- var $ul = document.createElement("ul");
- $ul.className = "c-list discus";
- var photo = getImgUrl(list[i].photo);
- if(photo == null || photo == ""){
- photo = "../../../images/p-default.png";
- }
- var content = '<li class="">';
- content += '<div class=" c-avatar-m"><img src="' + photo + '"></div>';
- content += '<div class="c-list-info"><h4 class="c-nowrap">' + list[i].name + '</h4>';
- content += '<p class="c-nowrap">' + list[i].czrq + '</p></div>';
- content += '<div class="c-list-action"><span>' + total + 'F</span></div>';
- content += '</li><li class="c-list-label c-333"><div class="c-list-info">'
- content += '<p class="c-333 c-f15" style="word-break: break-word;">' + list[i].content + "</p>";
- content += '<p class="mt10">';
- var images = list[i].images;
- if(images == null) images = "";
- var imageList = images.split(',');
- if(imageList.length > 0){
- for(var j=0; j<imageList.length; j++){
- if(imageList[j] != ""){
- content += "<img style='height: 60px; width: 60px; margin: 0 5px;' src='" + getImgUrl(imageList[j]) + "' onclick='viewImg(this)'>";
- }
- }
- }
- content += "</p></div></li>";
- $ul.innerHTML = content;
- $list.appendChild($ul);
- total = total - 1;
- }
- } else {
- document.querySelector("#view_more").innerText = "已无更多回复";
- }
- d.close();
- } else {
- d.close();
- dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'加载失败'}).show();
- document.querySelector("#view_more").innerText = "数据加载失败";
- }
- }
- });
- }
-
- function add(){
- window.location.href = "public-consult-reply.html?code=" + code;
- }
-
- //查看图片
- function viewImg(dom) {
- var $img = $(dom);
- var thissrc = getImgUrl($img.attr("src"));
- var mWid = $(window).width();
- var mHei = $(window).height();
- var nHtml = '<div class="delimgpop"><div class="del-img-box"><div class="del-img-con"><img class="del-pop-img" src="' + thissrc + '" style="max-width:' + mWid + 'px; max-height:' + mHei + 'px;"></div></div></div>';
- $("body").append(nHtml);
- $(".delimgpop").click(function() {
- $(this).remove()
- });
- };
- </script>
- </body>
- </html>
|