...
|
...
|
@@ -69,7 +69,6 @@ $('body').on('click', '#videoDialog', function() { |
|
|
var limitAddForm = new common.edit("#limit-add-form");
|
|
|
limitAddForm.init();
|
|
|
|
|
|
|
|
|
limitAddForm.on("validate", function(){
|
|
|
var param = {
|
|
|
batchNo: $('#batchNo').val()
|
...
|
...
|
@@ -77,78 +76,100 @@ limitAddForm.on("validate", function(){ |
|
|
if (type == 'update') {
|
|
|
param.id = $('#batchNo').data('id');
|
|
|
}
|
|
|
common.util.__ajax2({
|
|
|
url:'/limit/checkBatch',
|
|
|
async: false,
|
|
|
data: param
|
|
|
});
|
|
|
/*common.util.__ajax2({
|
|
|
|
|
|
});*/
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
//表单提交
|
|
|
$('.limit-add-btn').click(function () {
|
|
|
var $this = $(this);
|
|
|
var param = {
|
|
|
batchNo: $('#batchNo').val()
|
|
|
}
|
|
|
if (type == 'update') {
|
|
|
param.id = $('#batchNo').data('id');
|
|
|
}
|
|
|
|
|
|
limitAddForm.submit($('#limit-add-form').attr('action'), function(option, that) {
|
|
|
option.beforeSend = function () {
|
|
|
$this.attr('disabled', 'disabled');
|
|
|
};
|
|
|
|
|
|
option.success=function(res){
|
|
|
if (res.data.code == 200) {
|
|
|
//成功返回列表页
|
|
|
limitAddForm.$tip('提交成功',function(){
|
|
|
window.location.href = '/limit/product/index';
|
|
|
}, 'growl-success');
|
|
|
$this.removeAttr('disabled');
|
|
|
} else {
|
|
|
limitAddForm.$tip(res.data.message);
|
|
|
$this.removeAttr('disabled');
|
|
|
}
|
|
|
return false;
|
|
|
};
|
|
|
|
|
|
option.error=function(res){
|
|
|
limitAddForm.$tip(res.message);
|
|
|
$this.removeAttr('disabled');
|
|
|
};
|
|
|
|
|
|
//文字,图片,视频上传数据
|
|
|
option.data.attachmentContent = [];
|
|
|
option.data.attachmentContent.push({
|
|
|
attachUrl:option.data.coverImg,
|
|
|
isDefault: 1,
|
|
|
attachType: 1,
|
|
|
orderBy: 0
|
|
|
});
|
|
|
if ($('.quota-content').size() > 0) {
|
|
|
$('.quota-content').each(function(i) {
|
|
|
var editType = $(this).data('type'),
|
|
|
content = '',
|
|
|
obj = {
|
|
|
attachType: editType, //上传内容类型,1:图片, 2:视频,3:文字
|
|
|
isDefault: 0, //是否封面图
|
|
|
orderBy: i //排序
|
|
|
};
|
|
|
|
|
|
if (editType == 3) {
|
|
|
content = $(this).find('span').text();
|
|
|
obj.intro = content; //文字key为intro
|
|
|
} else if (editType == 1) {
|
|
|
content = $(this).find('img').attr('src');
|
|
|
obj.attachUrl = content; //图片key为attachUrl
|
|
|
common.util.__ajax2({
|
|
|
url:'/limit/checkBatch',
|
|
|
data: param
|
|
|
}, function(res) {
|
|
|
if (res.code == 200) {
|
|
|
limitAddForm.submit($('#limit-add-form').attr('action'), function(option, that) {
|
|
|
option.beforeSend = function () {
|
|
|
$this.attr('disabled', 'disabled');
|
|
|
var param = {
|
|
|
batchNo: $('#batchNo').val()
|
|
|
}
|
|
|
if (type == 'update') {
|
|
|
param.id = $('#batchNo').data('id');
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
option.success=function(res){
|
|
|
if (res.data.code == 200) {
|
|
|
//成功返回列表页
|
|
|
limitAddForm.$tip('提交成功',function(){
|
|
|
//window.location.href = '/limit/product/index';
|
|
|
}, 'growl-success');
|
|
|
$this.removeAttr('disabled');
|
|
|
} else {
|
|
|
limitAddForm.$tip(res.data.message);
|
|
|
$this.removeAttr('disabled');
|
|
|
}
|
|
|
return false;
|
|
|
};
|
|
|
|
|
|
option.error=function(res){
|
|
|
limitAddForm.$tip(res.message);
|
|
|
$this.removeAttr('disabled');
|
|
|
};
|
|
|
|
|
|
//文字,图片,视频上传数据
|
|
|
option.data.attachmentContent = [];
|
|
|
option.data.attachmentContent.push({
|
|
|
attachUrl:option.data.coverImg,
|
|
|
isDefault: 1,
|
|
|
attachType: 1,
|
|
|
orderBy: 0
|
|
|
});
|
|
|
if ($('.quota-content').size() > 0) {
|
|
|
$('.quota-content').each(function(i) {
|
|
|
var editType = $(this).data('type'),
|
|
|
content = '',
|
|
|
obj = {
|
|
|
attachType: editType, //上传内容类型,1:图片, 2:视频,3:文字
|
|
|
isDefault: 0, //是否封面图
|
|
|
orderBy: i //排序
|
|
|
};
|
|
|
|
|
|
if (editType == 3) {
|
|
|
content = $(this).find('span').text();
|
|
|
obj.intro = content; //文字key为intro
|
|
|
} else if (editType == 1) {
|
|
|
content = $(this).find('img').attr('src');
|
|
|
obj.attachUrl = content; //图片key为attachUrl
|
|
|
}
|
|
|
option.data.attachmentContent.push(obj)
|
|
|
});
|
|
|
}
|
|
|
option.data.attachmentContent.push(obj)
|
|
|
});
|
|
|
}
|
|
|
|
|
|
//因为只能传字符串,转换为字符串
|
|
|
option.data.attachmentContent = JSON.stringify(option.data.attachmentContent);
|
|
|
//因为只能传字符串,转换为字符串
|
|
|
option.data.attachmentContent = JSON.stringify(option.data.attachmentContent);
|
|
|
|
|
|
//时间上传为时间戳
|
|
|
option.data.saleTime = new Date(option.data.saleTime.replace('-',',')).getTime() / 1000;
|
|
|
console.log(option.data);
|
|
|
|
|
|
//时间上传为时间戳
|
|
|
option.data.saleTime = new Date(option.data.saleTime.replace('-',',')).getTime() / 1000;
|
|
|
console.log(option.data);
|
|
|
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
//编辑页,时间戳转换
|
...
|
...
|
|