qiuzhu_common.js 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. template.helper("isAsk", function(a){
  2. if(a){
  3. return "已经";
  4. }
  5. return "立即";
  6. })
  7. function openFqzx(doctor, docName, $li){
  8. openWebviewExtras("faqizixun.html",{
  9. openId: self.opener().id,
  10. aa: self.aa,
  11. type: 2,
  12. doctor: doctor,
  13. doctorName: docName,
  14. doctorPhoto: $li.attr('data-photo'),
  15. doctorSex: $li.attr('data-sex'),
  16. doctorType: $li.attr('data-level'),
  17. consultInfo: self.consultInfo
  18. });
  19. }
  20. function openP2p(extras){
  21. var wv = mui.openWindow({
  22. url:"../../message/html/p2p.html",
  23. id: "p2p",
  24. extras: extras
  25. })
  26. }
  27. $(document).on('click',"li .div-lijizixun-btn", function(){
  28. if($(this).hasClass("disabled"))
  29. return;
  30. var $li = $(this).parent();
  31. var doctor = $li.attr('data-code');
  32. var docName = $li.attr('data-name');
  33. var extras = {
  34. otherCode: doctor,
  35. otherName: docName,
  36. otherSex: $li.attr('data-sex'),
  37. otherPhoto: $li.attr('data-photo')
  38. }
  39. service.hasUnfinishedConsult(doctor, function(res){
  40. extras.consultData = res.data;
  41. if(res.data.isCommonTeam){
  42. //同一团队
  43. openP2p(extras);
  44. return;
  45. }
  46. if(res.data.consult){
  47. mui.confirm("您与"+ docName +"医生当前有进行中咨询,不可发起求助,您可直接进入咨询提问",
  48. "提示", ["查看咨询", "我知道了"], function(e){
  49. if(e.index==0){
  50. openP2p(extras);
  51. }
  52. })
  53. } else if(isConsulted){
  54. mui.confirm("针对本次咨询,您已求助过。是否继续向其他人求助?",
  55. "提示", ["不了,谢谢", "继续求助"], function(e){
  56. if(e.index==1){
  57. openFqzx(doctor, docName, $li);
  58. }
  59. })
  60. } else
  61. openFqzx(doctor, docName, $li);
  62. })
  63. return;
  64. });
  65. template.helper("setPhoto", function(p) {
  66. return getImgUrl(p);
  67. });