作者 654550265

重复评价BUG修改

@@ -60,27 +60,34 @@ @@ -60,27 +60,34 @@
60 $('#wordage').html(pattern); 60 $('#wordage').html(pattern);
61 } 61 }
62 ); 62 );
  63 + var click_num = 0;
63 $('.btn_ping').click(function () { 64 $('.btn_ping').click(function () {
64 - var str_len = $('#wordtext').val().length;  
65 - if (str_len ==0) {  
66 - layer.msg('评价不能为空!')  
67 - } else {  
68 - $.ajax({  
69 - url: "{:url('pingjia_by_coach_do')}",  
70 - data: {  
71 - uid: {$uid},  
72 - yuyue_id: {$yuyue_id},  
73 - comment: $('#wordtext').val()  
74 - },  
75 - success: function (res) {  
76 - console.log(res);  
77 - if (res.code == '1') {  
78 - layer.msg(res.msg);  
79 - window.location.href="/user/profile/percenter"; 65 + if(click_num == 0){
  66 + click_num++;
  67 + var str_len = $('#wordtext').val().length;
  68 + if (str_len ==0) {
  69 + layer.msg('评价不能为空!')
  70 + } else {
  71 + $.ajax({
  72 + url: "{:url('pingjia_by_coach_do')}",
  73 + data: {
  74 + uid: {$uid},
  75 + yuyue_id: {$yuyue_id},
  76 + comment: $('#wordtext').val()
  77 + },
  78 + success: function (res) {
  79 + console.log(res);
  80 + if (res.code == '1') {
  81 + layer.msg(res.msg);
  82 + window.location.href="/user/profile/percenter";
  83 + }
80 } 84 }
81 - }  
82 - }); 85 + });
  86 + }
  87 + }else{
  88 + layer.msg("请勿重复评价");
83 } 89 }
  90 +
84 }); 91 });
85 })(window, jQuery) 92 })(window, jQuery)
86 </script> 93 </script>