...
|
...
|
@@ -37,14 +37,14 @@ $('#saleTime').on('change', function() { |
|
|
console.log($(this).val());
|
|
|
})
|
|
|
|
|
|
var $editor = $('#editor');
|
|
|
$('body').on('click', '#textDialog', function() {
|
|
|
common.dialog.confirm("添加文本",'<textarea id="text-editor"></textarea>',function(){
|
|
|
|
|
|
var textStr = $('#text-editor').val();
|
|
|
var $oText = $('<div class="quota-content quota-text" data-type="3"><span>' + textStr + '</span><a href="javascript:;" class="editor-delete btn btn-default">删除</a></div>');
|
|
|
|
|
|
$('.quota-text').html(textStr);
|
|
|
|
|
|
console.log(textStr);
|
|
|
$oText.appendTo($editor);
|
|
|
|
|
|
});
|
|
|
$('#text-editor').wysihtml5();
|
...
|
...
|
@@ -54,17 +54,19 @@ $('#saleTime').on('change', function() { |
|
|
common.dialog.confirm("添加图片",common.util.__template($("#picDialogTemp").html(),{name:"图片"}),function(){
|
|
|
|
|
|
var imgStr = '<img src="http://img11.static.yhbimg.com/goodsimg/2015/07/07/08/01315b5bbfd72bc5b59fa2fda6c28b9ae6.jpg">';
|
|
|
var $oImg = $('<div class="quota-content quota-img" data-type="1">' + imgStr + '<a href="javascript:;" class="editor-delete btn btn-default">删除</a></div>');
|
|
|
|
|
|
$('.quota-img').html(imgStr);
|
|
|
$oImg.appendTo($editor);
|
|
|
});
|
|
|
return false;
|
|
|
});
|
|
|
$('body').on('click', '#videoDialog', function() {
|
|
|
common.dialog.confirm("添加视频",common.util.__template($("#picDialogTemp").html(),{name:"视频"}),function(){
|
|
|
|
|
|
var imgStr = '<img src="http://img11.static.yhbimg.com/goodsimg/2015/07/07/08/01315b5bbfd72bc5b59fa2fda6c28b9ae6.jpg">';
|
|
|
/*var imgStr = '<img src="http://img11.static.yhbimg.com/goodsimg/2015/07/07/08/01315b5bbfd72bc5b59fa2fda6c28b9ae6.jpg">';
|
|
|
var $oVideo = $('<div class="quota-imf"><img src="' + imgStr + '" alt="" /></div>');
|
|
|
|
|
|
$('.quota-video').html(imgStr);
|
|
|
$('.quota-video').html(imgStr);*/
|
|
|
});
|
|
|
return false;
|
|
|
});
|
...
|
...
|
@@ -79,7 +81,7 @@ $('.limit-add-btn').click(function () { |
|
|
|
|
|
var $this = $(this);
|
|
|
|
|
|
limitAddForm.submit('/limit/product/new', function(option, that) {
|
|
|
limitAddForm.submit($('#limit-add-form').attr('action'), function(option, that) {
|
|
|
option.beforeSend = function () {
|
|
|
$this.attr('disabled', 'disabled');
|
|
|
};
|
...
|
...
|
@@ -89,7 +91,7 @@ $('.limit-add-btn').click(function () { |
|
|
if (res.data.code == 200) {
|
|
|
|
|
|
limitAddForm.$tip('提交成功',function(){
|
|
|
window.location.href = '/limit/product/index';
|
|
|
//window.location.href = '/limit/product/index';
|
|
|
}, 'growl-success');
|
|
|
$this.removeAttr('disabled');
|
|
|
|
...
|
...
|
@@ -101,6 +103,7 @@ $('.limit-add-btn').click(function () { |
|
|
limitAddForm.$tip(res.message);
|
|
|
$this.removeAttr('disabled');
|
|
|
};
|
|
|
//option.data.time = $('#saleTime').val();
|
|
|
option.data.attachmentContent = [];
|
|
|
option.data.attachmentContent.push({
|
|
|
attachUrl:option.data.coverImg,
|
...
|
...
|
@@ -108,10 +111,43 @@ $('.limit-add-btn').click(function () { |
|
|
attachType: 1,
|
|
|
orderBy: 0
|
|
|
});
|
|
|
if ($('.quota-content').size() > 0) {
|
|
|
$('.quota-content').each(function(i) {
|
|
|
var type = $(this).data('type'),
|
|
|
content = '',
|
|
|
obj = {
|
|
|
attachType: type,
|
|
|
isDefault: 0,
|
|
|
orderBy: i
|
|
|
}
|
|
|
|
|
|
if (type == 3) {
|
|
|
content = $(this).find('span').text();
|
|
|
obj.intro = content;
|
|
|
} else if (type == 1) {
|
|
|
content = $(this).find('img').attr('src');
|
|
|
obj.attachUrl = content;
|
|
|
}
|
|
|
option.data.attachmentContent.push(obj)
|
|
|
});
|
|
|
}
|
|
|
console.log(option.data);
|
|
|
option.data.attachmentContent = JSON.stringify(option.data.attachmentContent);
|
|
|
|
|
|
|
|
|
option.data.saleTime = new Date(option.data.saleTime.replace('-',',')).getTime() / 1000;
|
|
|
console.log(option.data);
|
|
|
|
|
|
});
|
|
|
});
|
|
|
|
|
|
$('#saleTime').val(function() {
|
|
|
if ($(this).data('time')) {
|
|
|
var date = new Date($(this).data('time') * 1000);
|
|
|
return date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate();
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
$('#limit-add-form').on('click', '.editor-delete', function() {
|
|
|
$(this).parents('.quota-content').remove();
|
|
|
}); |
...
|
...
|
|