feedback-detail.js 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. var feedbackType, //记录是申诉,还是反馈
  2. code;
  3. mui.init();
  4. mui.plusReady(function(){
  5. var self = plus.webview.currentWebview();
  6. feedbackType = self.type;
  7. code = self.code;
  8. getDetail();
  9. createTemplateHelper();
  10. bindEvents();
  11. });
  12. function getDetail(){
  13. var url = "";
  14. if(feedbackType == 1){
  15. url = "/doctorFeedback/feedback/findByCode";
  16. $("#header").text('申诉详情');
  17. }else if(feedbackType == 2){
  18. url = "/doctor/feedback/findByCode";
  19. $("#header").text('反馈详情');
  20. }
  21. plus.nativeUI.showWaiting();
  22. var params = {code : code};
  23. sendGet(url, params, null, function(res){
  24. if(res.status == 200){
  25. var feedbackName = "申诉";
  26. if(feedbackType == 2){
  27. feedbackName = "反馈";
  28. }
  29. if(res.data){
  30. $.extend(res.data, {feedbackName: feedbackName, feedbackType: feedbackType});
  31. if(res.data.images){
  32. var imgList = res.data.images.split(",");
  33. res.data.imgList = imgList;
  34. }
  35. var html = template('tmp', res.data);
  36. $("#content").empty().append(html);
  37. mui.previewImage();
  38. }else{
  39. mui.toast("程序出了点小问题")
  40. }
  41. }else{
  42. mui.toast(res.msg)
  43. }
  44. plus.nativeUI.closeWaiting();
  45. }, true)
  46. }
  47. function bindEvents(){
  48. $("#content").on('click', '#applyAgain', function(){
  49. if(feedbackType == 1){
  50. openWebview('account_back.html');
  51. }else{
  52. // openWebview('feedback.html');
  53. mui.openWindow({
  54. url: 'feedback.html',
  55. id: 'feedback2.html', //区分之前打开的反馈填写页面
  56. extras: {
  57. noList: true
  58. }
  59. })
  60. }
  61. })
  62. }
  63. function createTemplateHelper(){
  64. template.helper('getTypeValue', function(type){
  65. if(feedbackType == 1){
  66. switch(type){
  67. case 1:
  68. return "手机号变更";
  69. break;
  70. case 2:
  71. return "重置密码";
  72. break;
  73. case 3:
  74. return "其他";
  75. break;
  76. default:
  77. return "";
  78. break;
  79. }
  80. }else if(feedbackType == 2){
  81. switch(type){
  82. case 1:
  83. return "优化建议";
  84. break;
  85. case 2:
  86. return "提交bug";
  87. break;
  88. case 3:
  89. return "新功能建议";
  90. break;
  91. case 4:
  92. return "其他";
  93. break;
  94. default:
  95. return "";
  96. break;
  97. }
  98. }
  99. });
  100. template.helper("getStatus", function(status){
  101. switch(status){
  102. case 0:
  103. return "未读";
  104. break;
  105. case 1:
  106. return "待处理";
  107. break;
  108. case 2:
  109. return "已处理";
  110. break;
  111. }
  112. })
  113. template.helper('getImgUrl', function(url){
  114. return getImgUrl(url);
  115. })
  116. }