Commit 7d6ab3d6e22da39a7e4c7d7381afae7dc6f062eb

Authored by F5VT98DI7XY4X12\Administrator
1 parent 46ab4175

点赞避免重复点击

pages/goods/goodsInfo/goodsInfo.js
@@ -201,6 +201,9 @@ Page({ @@ -201,6 +201,9 @@ Page({
201 is_show_pp:0, //是否品牌 201 is_show_pp:0, //是否品牌
202 is_show_gb:0, //是否国别 202 is_show_gb:0, //是否国别
203 is_closecoupon:0, 203 is_closecoupon:0,
  204 +
  205 + //是否点赞中
  206 + iszaning: 0,
204 }, 207 },
205 208
206 //------初始化加载---------- 209 //------初始化加载----------
@@ -2070,6 +2073,9 @@ Page({ @@ -2070,6 +2073,9 @@ Page({
2070 } 2073 }
2071 2074
2072 var iszan=th.data.comments[item_id].userZanNum; 2075 var iszan=th.data.comments[item_id].userZanNum;
  2076 + if(this.data.iszaning) return false;
  2077 + this.data.iszaning=1;
  2078 +
2073 2079
2074 app.request.post("/api/weshop/commentZan/save",{ 2080 app.request.post("/api/weshop/commentZan/save",{
2075 data:{store_id:o.stoid,user_id:app.globalData.user_id,goods_id:th.data.gid,comment_id:com_id}, 2081 data:{store_id:o.stoid,user_id:app.globalData.user_id,goods_id:th.data.gid,comment_id:com_id},
@@ -2077,11 +2083,11 @@ Page({ @@ -2077,11 +2083,11 @@ Page({
2077 2083
2078 if (ee.data.code == "-1") { 2084 if (ee.data.code == "-1") {
2079 app.my_warnning("不能给自己点赞", 0, th); 2085 app.my_warnning("不能给自己点赞", 0, th);
  2086 + th.data.iszaning=0;
2080 return; 2087 return;
2081 } 2088 }
2082 2089
2083 if(ee.data.code==0 && iszan!=1){ 2090 if(ee.data.code==0 && iszan!=1){
2084 -  
2085 var num=th.data.comments[item_id].zan_num; num++; 2091 var num=th.data.comments[item_id].zan_num; num++;
2086 var text="comments["+item_id+"].zan_num"; 2092 var text="comments["+item_id+"].zan_num";
2087 var text1="comments["+item_id+"].userZanNum"; 2093 var text1="comments["+item_id+"].userZanNum";
@@ -2089,6 +2095,7 @@ Page({ @@ -2089,6 +2095,7 @@ Page({
2089 _errObj[text]=num; 2095 _errObj[text]=num;
2090 _errObj[text1]=1; 2096 _errObj[text1]=1;
2091 th.setData(_errObj); 2097 th.setData(_errObj);
  2098 +
2092 }else{ 2099 }else{
2093 var num=th.data.comments[item_id].zan_num; num--; 2100 var num=th.data.comments[item_id].zan_num; num--;
2094 var text="comments["+item_id+"].zan_num"; 2101 var text="comments["+item_id+"].zan_num";
@@ -2098,6 +2105,11 @@ Page({ @@ -2098,6 +2105,11 @@ Page({
2098 _errObj[text1]=0; 2105 _errObj[text1]=0;
2099 th.setData(_errObj); 2106 th.setData(_errObj);
2100 } 2107 }
  2108 +
  2109 + setTimeout(function(){
  2110 + th.data.iszaning = 0;
  2111 + },500)
  2112 +
2101 } 2113 }
2102 }) 2114 })
2103 }, 2115 },