feedback-detail.js 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. var d = dialog({contentType:'load', skin:'bk-popup'});
  2. var request = GetRequest(),
  3. type = request.type, // 1-申诉,2-反馈
  4. code = request.fdCode;
  5. var pagetype = 0;
  6. if(type == 1){
  7. document.title = "申诉详情";
  8. }else{
  9. document.title = "反馈详情";
  10. }
  11. $(function(){
  12. if(type == 2){
  13. checkUserAgent();
  14. }else{
  15. queryInit();
  16. }
  17. });
  18. function queryInit(){
  19. getDetail();
  20. getTemplateHelper();
  21. bindEvents()
  22. }
  23. function getDetail(){
  24. d.show();
  25. var url = "/patient/feedback/findByCode";
  26. if(type == 1){
  27. url = "/patientFeedback/feedback/findByCode";
  28. }
  29. var params = {code: code};
  30. sendPost(url, params, 'json', 'get', queryFailed, function(res){
  31. if(res.status == 200){
  32. var feedbackName = "申诉";
  33. if(type == 2){
  34. feedbackName = "反馈";
  35. }
  36. $.extend(res.data, {feedbackName: feedbackName, feedbackType: type});
  37. if(res.data.images){
  38. var imgList = res.data.images.split(",");
  39. res.data.imgList = imgList;
  40. }
  41. var html = template('tmp', res.data);
  42. $("#content").empty().append(html);
  43. d.close();
  44. }else{
  45. queryFailed(res);
  46. }
  47. });
  48. }
  49. //查看图片
  50. function viewImg(dom) {
  51. var $img = $(dom);
  52. var thissrc = $img.attr("src");
  53. var mWid = $(window).width();
  54. var mHei = $(window).height();
  55. 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>';
  56. $("body").append(nHtml);
  57. $(".delimgpop").click(function() {
  58. $(this).remove()
  59. });
  60. }
  61. function bindEvents(){
  62. $("#content").on("click", "#applyAgain", function(){
  63. if(type == 1){
  64. window.location.href = "account_back.html";
  65. }else{
  66. window.location.href = "feedback.html";
  67. }
  68. });
  69. }
  70. function getTemplateHelper(){
  71. template.helper('getTypeValue', function(type, fdType){
  72. if(fdType == 1){
  73. switch(type){
  74. case 1:
  75. return "手机号变更";
  76. break;
  77. case 2:
  78. return "重置密码";
  79. break;
  80. case 3:
  81. return "其他";
  82. break;
  83. default:
  84. return "";
  85. break;
  86. }
  87. }else if(fdType == 2){
  88. switch(type){
  89. case 1:
  90. return "优化建议";
  91. break;
  92. case 2:
  93. return "提交bug";
  94. break;
  95. case 3:
  96. return "新功能建议";
  97. break;
  98. case 4:
  99. return "其他";
  100. break;
  101. case 5:
  102. return "举报";
  103. break;
  104. case 6:
  105. return "投诉";
  106. break;
  107. case 7:
  108. return "建议";
  109. break;
  110. default:
  111. return "";
  112. break;
  113. }
  114. }
  115. });
  116. template.helper("getStatus", function(status){
  117. switch(status){
  118. case 0:
  119. return "未读";
  120. break;
  121. case 1:
  122. return "待处理";
  123. break;
  124. case 2:
  125. return "已处理";
  126. break;
  127. }
  128. })
  129. template.helper('getImgUrl', function(url){
  130. return getImgUrl(url);
  131. })
  132. }
  133. function queryFailed(res){
  134. d.close();
  135. if (res && res.msg) {
  136. dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:res.msg}).show();
  137. }else{
  138. dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'请求失败'}).show();
  139. }
  140. }