var date = new FormData(); //存储文件格式流数据
var $files = $("input[isture=0]");
for(var i = 0; i < $files.length; i++) {
var $tag = $files.eq(i);
var tag = $tag[0]
date.append('file', tag.files[0]);
}
$http({
method: 'post',
params: $scope.addCFormData,
data: date, //仅仅存放的是文件流数据
headers: {
'Content-Type': undefined //angularjs设置文件上传的content-type修改方式
},
transformRequest: angular.identity,
url: geturlpath + '/h5crm/wj_addCustomer.do',
withCredentials: true
}).then(function successCallback(response) {
if(response.data.status == 2) {
$window.location.href = '/Air_conditioner_CRM/CRMlogin.html';
} else if(response.data.status == 1) {
layer.msg('保存成功', { time: 1000 });
setTimeout(function() {
$state.go('clientList', {
'currentPage': '1',
'showCount': '20',
});
}, 1000)
} else {
$("#saveclient").attr("disabled", false);
$("#saveclient").css("background", "#7cbaff")
layer.msg(response.data.message);
}
}, function errorCallback() {
layer.msg('服务器请求失败')
})