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,27 +742,32 @@ define(['doT', 'text!temp/house_template_tpl.html', 'css!style/home.css', 'ckfin ...@@ -741,27 +742,32 @@ define(['doT', 'text!temp/house_template_tpl.html', 'css!style/home.css', 'ckfin
alert('内容不能为空'); alert('内容不能为空');
return false; return false;
}; };
$.ajax({ if(!isFollowupSaving){
'type': 'post', business.isFollowupSaving = true;
'url': '/broker/addShopFollowUp', $.ajax({
data: { 'type': 'post',
'house_id': business.id, 'url': '/broker/addShopFollowUp',
'AuthToken': business.AuthToken, data: {
'agent_id': business.agent_id, 'house_id': business.id,
'agent_phone': business.agent_phone, 'AuthToken': business.AuthToken,
'agent_name': business.agent_name, 'agent_id': business.agent_id,
'follow_up_info': _tareaObjVal 'agent_phone': business.agent_phone,
}, 'agent_name': business.agent_name,
dataType: "json", 'follow_up_info': _tareaObjVal
success: function(data) { },
if(data.code == 200) { dataType: "json",
alert('添加成功'); success: function(data) {
$("#modal_followup").modal('hide'); if(data.code == 200) {
} else { alert('添加成功');
alert('请登录!'); business.isFollowupSaving = false;
$("#modal_followup").modal('hide');
} else {
alert('请登录!');
}
} }
} });
}); }
} }
}; };
return business; return business;
......
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