...
|
...
|
@@ -222,6 +222,14 @@ webpackJsonp([178],{ |
|
|
} else {
|
|
|
module.moduleData = JSON.parse(module.moduleData);
|
|
|
}
|
|
|
if(module.moduleType == 'DivideCarouselImage'){
|
|
|
$.each(module.moduleData.data, function(index, data) {
|
|
|
var _index = data.pic.indexOf("?imageView2");
|
|
|
if(_index != -1) {
|
|
|
data.pic = data.pic.substring(0, _index);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
Bll.moduleDataList = moduleList;
|
|
|
}
|
...
|
...
|
@@ -793,6 +801,61 @@ webpackJsonp([178],{ |
|
|
Bll.moduleGrid.__rows = Bll.getModuleData(module);
|
|
|
Bll.moduleGrid.init(Bll.moduleGrid.__rows);
|
|
|
break;
|
|
|
case "DivideCarouselImage":
|
|
|
// 添加一行
|
|
|
$('.editorTitle').append('<div><a class="btn btn-primary add-moduledata-btn" javascript=":;" >添加一行</div>');
|
|
|
$('.editorTitle').append(common.util.__template2($('#divide-carousel-image').html(), {date: Bll.getDivideProperties(module)}));
|
|
|
Bll.moduleGrid = new grid({
|
|
|
hash: false,
|
|
|
el: selector,
|
|
|
columns: [
|
|
|
{
|
|
|
display: '关联类型',
|
|
|
width:150,
|
|
|
render: function(item) {
|
|
|
return common.util.__template2($('#link-type-template').html(), {data: item, index: item.__index});
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
display: '关联到',
|
|
|
width:150,
|
|
|
render: function(item) {
|
|
|
return common.util.__template2($('#link-resource-template').html(), {data: item, index: item.__index, categoryList: Bll.shopCategoryList});
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
display: '图片地址',
|
|
|
render: function(item) {
|
|
|
return common.util.__template2($('#upload-image-template').html(), {item: item});
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
display: '分组',
|
|
|
width:150,
|
|
|
render: function(item) {
|
|
|
return common.util.__template2($('#divide-group').html(), {item: item});
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
display: '操作',
|
|
|
render: function(item) {
|
|
|
if(item.__index == 0) {
|
|
|
return '';
|
|
|
} else {
|
|
|
return '<a href="javascript:;" class="del-moduledata-btn" data-index="' + item.__index+ '" title="删除数据"><span class="glyphicon glyphicon-remove"></span></a>';
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
],
|
|
|
// onBodyLoad: function() {
|
|
|
// $('.upload-image').each(function() {
|
|
|
// $(this).attr('spec', '750*234');
|
|
|
// });
|
|
|
// }
|
|
|
});
|
|
|
Bll.moduleGrid.__rows = Bll.getModuleData(module);
|
|
|
Bll.moduleGrid.init(Bll.moduleGrid.__rows);
|
|
|
break;
|
|
|
case "CarouselImage":
|
|
|
// 添加一行
|
|
|
$('.editorTitle').append('<div><a class="btn btn-primary add-moduledata-btn" javascript=":;" data-limit="5">添加一行</div>');
|
...
|
...
|
@@ -1121,6 +1184,13 @@ webpackJsonp([178],{ |
|
|
$('.editorTitle').append(common.util.__template2($('#module-margin-template').html(), {isModuleMargin: Bll.getModuleMargin(module)}));
|
|
|
},
|
|
|
|
|
|
getDivideProperties: function (module) {
|
|
|
if(module.moduleData && module.moduleData.properties) {
|
|
|
return module.moduleData.properties
|
|
|
}
|
|
|
return "";
|
|
|
},
|
|
|
|
|
|
// 获取是否设置模块间间距,默认是1
|
|
|
getModuleMargin: function(module) {
|
|
|
if(module.moduleData && module.moduleData.properties) {
|
...
|
...
|
@@ -1253,6 +1323,16 @@ webpackJsonp([178],{ |
|
|
}else if(moduleType == 'DoubleImage'){
|
|
|
Bll.moduleDataList[index].moduleData.properties.isModuleMargin = 0;
|
|
|
}
|
|
|
if(moduleType == 'DivideCarouselImage'){
|
|
|
if($('#divideWidth').val() == "" || $('#divideHigh').val() == "" || $('#divideRow').val() == "" || $('#divideColumn').val() == "") {
|
|
|
common.util.__tip('均分轮播图模块中宽、高、行、列不可为空!', 'warning');
|
|
|
return false;
|
|
|
}
|
|
|
Bll.moduleDataList[index].moduleData.properties.divideWidth = $('#divideWidth').val();
|
|
|
Bll.moduleDataList[index].moduleData.properties.divideHigh = $('#divideHigh').val();
|
|
|
Bll.moduleDataList[index].moduleData.properties.divideRow = $('#divideRow').val();
|
|
|
Bll.moduleDataList[index].moduleData.properties.divideColumn = $('#divideColumn').val();
|
|
|
}
|
|
|
if(moduleType == 'RecommendProduct' || moduleType == 'AppRecommendProduct') {
|
|
|
validation = Bll.validator.validateModule(moduleType, Bll.recommendProduct);
|
|
|
Bll.saveRecommendProduct(index);
|
...
|
...
|
@@ -1448,6 +1528,12 @@ webpackJsonp([178],{ |
|
|
case "SingleImage":
|
|
|
// 轮播图
|
|
|
case "CarouselImage":
|
|
|
case "DivideCarouselImage":
|
|
|
moduleData = {
|
|
|
data: [{text: "", pic: "", linkType: "", resource: "", group: ""}],
|
|
|
properties: {}
|
|
|
};
|
|
|
break;
|
|
|
// 标题模块
|
|
|
case "Title":
|
|
|
// PC端,整图模块
|
...
|
...
|
@@ -1612,6 +1698,8 @@ webpackJsonp([178],{ |
|
|
return "请上传尺寸为750*234,不大于500KB的图片,支持GIF、JPG、JPEG格式!";
|
|
|
case "CarouselImage":
|
|
|
return "请上传尺寸为750*234,不大于500KB的图片,最多五张,支持GIF、JPG、JPEG格式!";
|
|
|
case "DivideCarouselImage":
|
|
|
return "请上传不大于500KB的图片,支持GIF、JPG、JPEG格式!";
|
|
|
case "SingleImage":
|
|
|
return "请上传宽度为750,不大于500KB的图片,图片高度不限,支持GIF、JPG、JPEG格式!";
|
|
|
case "DoubleImage":
|
...
|
...
|
@@ -1709,6 +1797,15 @@ webpackJsonp([178],{ |
|
|
}
|
|
|
});
|
|
|
break;
|
|
|
case "DivideCarouselImage":
|
|
|
// 轮播图,限制图片尺寸为 750 * 234
|
|
|
$.each(module.moduleData.data, function(index, data) {
|
|
|
var _index = data.pic.indexOf(imageView);
|
|
|
if(_index != -1) {
|
|
|
data.pic = data.pic.substring(0, _index) + imageView + '/1/w/750/h/234';
|
|
|
}
|
|
|
});
|
|
|
break;
|
|
|
case "TripleImage":
|
|
|
var displayType = Bll.moduleGrid.displayType;
|
|
|
if(displayType == undefined) {
|
...
|
...
|
@@ -1885,6 +1982,40 @@ webpackJsonp([178],{ |
|
|
if(Bll.templateType == null || Bll.templateType == undefined){
|
|
|
Bll.templateType = 1;
|
|
|
}
|
|
|
$.each(Bll.moduleDataList, function(index, data) {
|
|
|
if(data.moduleType == 'DivideCarouselImage'){
|
|
|
var group = [];
|
|
|
$.each(data.moduleData.data, function(index, module) {
|
|
|
var _index = module.pic.indexOf("?imageView2");
|
|
|
if(_index != -1) {
|
|
|
module.pic = module.pic.substring(0, _index) + '?imageView2/{mode}/w/{width}/h/{height}';
|
|
|
}else if(module.pic != ""){
|
|
|
module.pic = module.pic + '?imageView2/{mode}/w/{width}/h/{height}';
|
|
|
}
|
|
|
if(group.indexOf(module.group) == -1){
|
|
|
group.push(module.group);
|
|
|
}
|
|
|
});
|
|
|
var groupList = []
|
|
|
for(var i=0;i<group.length;i++){
|
|
|
var arr = [];
|
|
|
var obj = {};
|
|
|
var src = "";
|
|
|
$.each(data.moduleData.data, function(index, module) {
|
|
|
if(group[i] == module.group){
|
|
|
arr.push(module);
|
|
|
if(src == ""){
|
|
|
src = module.pic;
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
obj.list = arr;
|
|
|
obj.src = src;
|
|
|
groupList.push(obj);
|
|
|
}
|
|
|
data.moduleData.groupList = groupList;
|
|
|
}
|
|
|
})
|
|
|
common.util.__ajax({
|
|
|
url: '/shop/ModularDecoratorRest/saveDecoratorTemplate',
|
|
|
data: {
|
...
|
...
|
@@ -1989,7 +2120,40 @@ webpackJsonp([178],{ |
|
|
if(! result) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
$.each(Bll.moduleDataList, function(index, data) {
|
|
|
if(data.moduleType == 'DivideCarouselImage'){
|
|
|
var group = [];
|
|
|
$.each(data.moduleData.data, function(index, module) {
|
|
|
var _index = module.pic.indexOf("?imageView2");
|
|
|
if(_index != -1) {
|
|
|
module.pic = module.pic.substring(0, _index) + '?imageView2/{mode}/w/{width}/h/{height}';
|
|
|
}else if(module.pic != ""){
|
|
|
module.pic = module.pic + '?imageView2/{mode}/w/{width}/h/{height}';
|
|
|
}
|
|
|
if(group.indexOf(module.group) == -1){
|
|
|
group.push(module.group);
|
|
|
}
|
|
|
});
|
|
|
var groupList = []
|
|
|
for(var i=0;i<group.length;i++){
|
|
|
var arr = [];
|
|
|
var obj = {};
|
|
|
var src = "";
|
|
|
$.each(data.moduleData.data, function(index, module) {
|
|
|
if(group[i] == module.group){
|
|
|
arr.push(module);
|
|
|
if(src == ""){
|
|
|
src = module.pic;
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
obj.list = arr;
|
|
|
obj.src = src;
|
|
|
groupList.push(obj);
|
|
|
}
|
|
|
data.moduleData.groupList = groupList;
|
|
|
}
|
|
|
})
|
|
|
common.util.__ajax({
|
|
|
url: "/shop/ModularDecoratorRest/updateDecoratorTemplate",
|
|
|
data: {
|
...
|
...
|
@@ -2208,7 +2372,6 @@ webpackJsonp([178],{ |
|
|
Bll.moduleGrid.__rows[index].pic = pic;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
Bll.moduleGrid.__rows[index].resource = resource;
|
|
|
Bll.moduleGrid.reload();
|
|
|
});
|
...
|
...
|
@@ -2219,6 +2382,11 @@ webpackJsonp([178],{ |
|
|
Bll.moduleGrid.__rows[index].showProductInfo = $(this).context.checked;
|
|
|
|
|
|
});
|
|
|
$(document).on('change', '.divide-group-class', function() {
|
|
|
var index = $(this).data("index");
|
|
|
Bll.moduleGrid.__rows[index].group = $(this).val();
|
|
|
|
|
|
});
|
|
|
|
|
|
// 标题输入框变化
|
|
|
$(document).on('change', '.title-text', function() {
|
...
|
...
|
@@ -2596,6 +2764,8 @@ webpackJsonp([178],{ |
|
|
return this.validateMultiImage(moduleData, '双图模块');
|
|
|
case "CarouselImage":
|
|
|
return this.validateMultiImage(moduleData, '轮播图模块');
|
|
|
case "DivideCarouselImage":
|
|
|
return this.validateMultiImage(moduleData, '均分轮播图模块');
|
|
|
case "TripleImage":
|
|
|
return this.validateMultiImage(moduleData, '三张图模块');
|
|
|
case "FourImage":
|
...
|
...
|
@@ -2718,12 +2888,18 @@ webpackJsonp([178],{ |
|
|
var linkType = data.linkType;
|
|
|
var resource = data.resource;
|
|
|
|
|
|
if(!data.pic) {
|
|
|
if(!data.pic && moduleName != '均分轮播图模块') {
|
|
|
common.util.__tip(moduleName + '中,第' + (index + 1) + '条装修内容中图片地址为空,请确认!', 'warning');
|
|
|
validateResult = false;
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if(moduleName == '均分轮播图模块'){
|
|
|
if(data.group == "" || data.group == undefined || data.group == null){
|
|
|
common.util.__tip(moduleName + "中,第" + (index + 1) + "条装修内容中分组值为空,请确认!", 'warning');
|
|
|
validateResult = false;
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
if(!linkType) {
|
|
|
return;
|
|
|
}
|
...
|
...
|
@@ -3368,6 +3544,10 @@ webpackJsonp([178],{ |
|
|
name: '轮播图',
|
|
|
description: '添加一张或者多张图片,最多五张,图片多于一张的话,支持轮播。',
|
|
|
type: 'CarouselImage'
|
|
|
},{
|
|
|
name: '均分轮播图',
|
|
|
description: '添加一张或者多张图片,图片多于一张的话,支持轮播。',
|
|
|
type: 'DivideCarouselImage'
|
|
|
},
|
|
|
{
|
|
|
name: '单图',
|
...
|
...
|
|