Commit 4c81a81a authored by xishifeng's avatar xishifeng

商铺列表跟进优化

parent a3db083c
......@@ -168,13 +168,14 @@ function loadMain(){
}
//点击收藏按钮触发的事件
var isAjaxIng = false;//是否正在执行请求操作
$('#mark_btn').click(function(e){
e.preventDefault();
e.stopPropagation();
var _this = $(this);
var isMark = ((_this.attr('data-ismark')=='1')?true:false);//点击的时候,是否是已经收藏的状态,记录
var isAjaxIng = false;//是否正在执行请求操作
if(!isAjaxIng){
isAjaxIng = true;
//只有没有在执行请求操作的时候,才能进行请求
$.ajax({
type: 'GET',
......@@ -187,12 +188,11 @@ function loadMain(){
},
timeout: 30000,
dataType: 'json',
beforeSend: function() {
isAjaxIng = true;
},
beforeSend: function() {},
success: function(data) {
if(typeof data === 'object') {
if (data.code == 200) {
isAjaxIng = false;
if(isMark){
_this.attr('data-ismark', '0').find('img').attr('src', '/app/images/icon_collection@2x.png');
}else{
......@@ -209,7 +209,6 @@ function loadMain(){
layerTipsX('error');
},
complete: function(xhr, textStatus){
isAjaxIng = false;
if(textStatus === 'timeout'){
layerTipsX('请求超时');
};
......
......@@ -21,6 +21,7 @@ define(['doT', 'text!temp/house_template_tpl.html', 'css!style/home.css', 'ckfin
ldHtml: $('.phone_list'),
boxphoto: '',
exclusive_id: 0,
isFollowupSaving: false,
init: function() {
//初始化dot
$("body").append(template);
......@@ -741,27 +742,32 @@ define(['doT', 'text!temp/house_template_tpl.html', 'css!style/home.css', 'ckfin
alert('内容不能为空');
return false;
};
$.ajax({
'type': 'post',
'url': '/broker/addShopFollowUp',
data: {
'house_id': business.id,
'AuthToken': business.AuthToken,
'agent_id': business.agent_id,
'agent_phone': business.agent_phone,
'agent_name': business.agent_name,
'follow_up_info': _tareaObjVal
},
dataType: "json",
success: function(data) {
if(data.code == 200) {
alert('添加成功');
$("#modal_followup").modal('hide');
} else {
alert('请登录!');
if(!isFollowupSaving){
business.isFollowupSaving = true;
$.ajax({
'type': 'post',
'url': '/broker/addShopFollowUp',
data: {
'house_id': business.id,
'AuthToken': business.AuthToken,
'agent_id': business.agent_id,
'agent_phone': business.agent_phone,
'agent_name': business.agent_name,
'follow_up_info': _tareaObjVal
},
dataType: "json",
success: function(data) {
if(data.code == 200) {
alert('添加成功');
business.isFollowupSaving = false;
$("#modal_followup").modal('hide');
} else {
alert('请登录!');
}
}
}
});
});
}
}
};
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