Commit 4c81a81a authored by xishifeng's avatar xishifeng

商铺列表跟进优化

parent a3db083c
...@@ -168,13 +168,14 @@ function loadMain(){ ...@@ -168,13 +168,14 @@ function loadMain(){
} }
//点击收藏按钮触发的事件 //点击收藏按钮触发的事件
var isAjaxIng = false;//是否正在执行请求操作
$('#mark_btn').click(function(e){ $('#mark_btn').click(function(e){
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
var _this = $(this); var _this = $(this);
var isMark = ((_this.attr('data-ismark')=='1')?true:false);//点击的时候,是否是已经收藏的状态,记录 var isMark = ((_this.attr('data-ismark')=='1')?true:false);//点击的时候,是否是已经收藏的状态,记录
var isAjaxIng = false;//是否正在执行请求操作
if(!isAjaxIng){ if(!isAjaxIng){
isAjaxIng = true;
//只有没有在执行请求操作的时候,才能进行请求 //只有没有在执行请求操作的时候,才能进行请求
$.ajax({ $.ajax({
type: 'GET', type: 'GET',
...@@ -187,12 +188,11 @@ function loadMain(){ ...@@ -187,12 +188,11 @@ function loadMain(){
}, },
timeout: 30000, timeout: 30000,
dataType: 'json', dataType: 'json',
beforeSend: function() { beforeSend: function() {},
isAjaxIng = true;
},
success: function(data) { success: function(data) {
if(typeof data === 'object') { if(typeof data === 'object') {
if (data.code == 200) { if (data.code == 200) {
isAjaxIng = false;
if(isMark){ if(isMark){
_this.attr('data-ismark', '0').find('img').attr('src', '/app/images/icon_collection@2x.png'); _this.attr('data-ismark', '0').find('img').attr('src', '/app/images/icon_collection@2x.png');
}else{ }else{
...@@ -209,7 +209,6 @@ function loadMain(){ ...@@ -209,7 +209,6 @@ function loadMain(){
layerTipsX('error'); layerTipsX('error');
}, },
complete: function(xhr, textStatus){ complete: function(xhr, textStatus){
isAjaxIng = false;
if(textStatus === 'timeout'){ if(textStatus === 'timeout'){
layerTipsX('请求超时'); layerTipsX('请求超时');
}; };
......
...@@ -21,6 +21,7 @@ define(['doT', 'text!temp/house_template_tpl.html', 'css!style/home.css', 'ckfin ...@@ -21,6 +21,7 @@ define(['doT', 'text!temp/house_template_tpl.html', 'css!style/home.css', 'ckfin
ldHtml: $('.phone_list'), ldHtml: $('.phone_list'),
boxphoto: '', boxphoto: '',
exclusive_id: 0, exclusive_id: 0,
isFollowupSaving: false,
init: function() { init: function() {
//初始化dot //初始化dot
$("body").append(template); $("body").append(template);
...@@ -741,6 +742,8 @@ define(['doT', 'text!temp/house_template_tpl.html', 'css!style/home.css', 'ckfin ...@@ -741,6 +742,8 @@ define(['doT', 'text!temp/house_template_tpl.html', 'css!style/home.css', 'ckfin
alert('内容不能为空'); alert('内容不能为空');
return false; return false;
}; };
if(!isFollowupSaving){
business.isFollowupSaving = true;
$.ajax({ $.ajax({
'type': 'post', 'type': 'post',
'url': '/broker/addShopFollowUp', 'url': '/broker/addShopFollowUp',
...@@ -756,6 +759,7 @@ define(['doT', 'text!temp/house_template_tpl.html', 'css!style/home.css', 'ckfin ...@@ -756,6 +759,7 @@ define(['doT', 'text!temp/house_template_tpl.html', 'css!style/home.css', 'ckfin
success: function(data) { success: function(data) {
if(data.code == 200) { if(data.code == 200) {
alert('添加成功'); alert('添加成功');
business.isFollowupSaving = false;
$("#modal_followup").modal('hide'); $("#modal_followup").modal('hide');
} else { } else {
alert('请登录!'); alert('请登录!');
...@@ -763,6 +767,8 @@ define(['doT', 'text!temp/house_template_tpl.html', 'css!style/home.css', 'ckfin ...@@ -763,6 +767,8 @@ define(['doT', 'text!temp/house_template_tpl.html', 'css!style/home.css', 'ckfin
} }
}); });
} }
}
}; };
return business; return business;
}); });
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment