作者 lianghiu

多次点击BUG修改

@@ -103,36 +103,39 @@ @@ -103,36 +103,39 @@
103 $(this).removeClass('ping_active'); 103 $(this).removeClass('ping_active');
104 } 104 }
105 }); 105 });
  106 + var click_num = 0;
106 $('.btn_tijiao').click(function(){ 107 $('.btn_tijiao').click(function(){
107 - var pingTxt=$('#wordtext').val();  
108 - var data_type=$('.choose_ping').attr("data-type");  
109 - var pingTab=$('.pingList .ping_active');  
110 - var data_id = '';  
111 - for(var i=0;i<pingTab.length;i++){  
112 - data_id+=pingTab[i].getAttribute("data-id")+',';  
113 - }  
114 - if(data_id==""&&pingTxt==""){  
115 - layer.msg("评价不能为空")  
116 - }else{  
117 - $.ajax({  
118 - url:"{:url('/user/comment/comment_do_by_stu')}",  
119 - type:"post",  
120 - data:{  
121 - teach_id:{$teach_id},  
122 - comment:pingTxt,  
123 - comment_tag:data_id,  
124 - yuyue_id:{$yuyue_id},  
125 - type:data_type 108 + if(click_num == 0){
  109 + click_num++;
  110 + var pingTxt=$('#wordtext').val();
  111 + var data_type=$('.choose_ping').attr("data-type");
  112 + var pingTab=$('.pingList .ping_active');
  113 + var data_id = '';
  114 + for(var i=0;i<pingTab.length;i++){
  115 + data_id+=pingTab[i].getAttribute("data-id")+',';
  116 + }
  117 + if(data_id==""&&pingTxt==""){
  118 + layer.msg("评价不能为空")
  119 + }else{
  120 + $.ajax({
  121 + url:"{:url('/user/comment/comment_do_by_stu')}",
  122 + type:"post",
  123 + data:{
  124 + teach_id:{$teach_id},
  125 + comment:pingTxt,
  126 + comment_tag:data_id,
  127 + yuyue_id:{$yuyue_id},
  128 + type:data_type
126 129
127 - },success:function(res){  
128 - console.log(res);  
129 - tankuang();  
130 - },error:function(err){  
131 - console.log(err);  
132 - }  
133 - }) 130 + },success:function(res){
  131 + tankuang();
  132 + click_num = 0;
  133 + },error:function(err){
  134 + console.log(err);
  135 + }
  136 + })
  137 + }
134 } 138 }
135 -  
136 }); 139 });
137 $('.btn_qr').click(function(){ 140 $('.btn_qr').click(function(){
138 window.location.href="{:url('user/comment/show_stu',array('yuyue_id'=>$yuyue_id))}"; 141 window.location.href="{:url('user/comment/show_stu',array('yuyue_id'=>$yuyue_id))}";