|
|
|
|
@ -45,6 +45,7 @@
|
|
|
|
|
childrenType: '',
|
|
|
|
|
name: userLangConfig[locale].user.text_default_name,
|
|
|
|
|
background: '#fff',
|
|
|
|
|
textAlign: 'center',
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
color: '#333',
|
|
|
|
|
text: userLangConfig[locale].user.text_default_content,
|
|
|
|
|
@ -146,6 +147,13 @@
|
|
|
|
|
handleRemoveComponent(item);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
self['grid'].on('change', function (_event, itemArray) {
|
|
|
|
|
console.log(itemArray, '这里触发了布局的change事件');
|
|
|
|
|
itemArray.forEach((item) => {
|
|
|
|
|
handleChangeComponent(item, self);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 处理添加组件之后的操作
|
|
|
|
|
@ -246,6 +254,15 @@
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var handleChangeComponent = (component) => {
|
|
|
|
|
if (currentComponent && currentComponent.id === component.id) {
|
|
|
|
|
let width = component.w * (1920 / 24);
|
|
|
|
|
$('#width').val(width);
|
|
|
|
|
let height = component.h * cellHeight * 2;
|
|
|
|
|
$('#height').val(height);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var handleRemoveComponent = (component) => {
|
|
|
|
|
if (currentComponent && currentComponent.id === component.id) {
|
|
|
|
|
currentComponent = null;
|
|
|
|
|
@ -358,16 +375,24 @@
|
|
|
|
|
form.find('#background').parent().hide();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let width = isScreen(component.type) ? component.width : component.w * (1920 / 24);
|
|
|
|
|
form.find('#width').val(width);
|
|
|
|
|
let height = isScreen(component.type) ? component.height : component.h * cellHeight * 2;
|
|
|
|
|
form.find('#height').val(height);
|
|
|
|
|
|
|
|
|
|
if (component.type === 'text') {
|
|
|
|
|
form.find('#textAlign').val(component.textAlign);
|
|
|
|
|
form.find('#text').val(component.text);
|
|
|
|
|
form.find('#fontSize').val(component.fontSize);
|
|
|
|
|
initColorPicker('color', component);
|
|
|
|
|
form.find('#fontWeight').val(component.fontWeight);
|
|
|
|
|
form.find('#textAlign').parent().show();
|
|
|
|
|
form.find('#text').parent().show();
|
|
|
|
|
form.find('#fontSize').parent().show();
|
|
|
|
|
form.find('#color').parent().show();
|
|
|
|
|
form.find('#fontWeight').parent().show();
|
|
|
|
|
} else {
|
|
|
|
|
form.find('#textAlign').parent().hide();
|
|
|
|
|
form.find('#text').parent().hide();
|
|
|
|
|
form.find('#fontSize').parent().hide();
|
|
|
|
|
form.find('#color').parent().hide();
|
|
|
|
|
@ -416,6 +441,14 @@
|
|
|
|
|
|
|
|
|
|
// 定义组件设置配置策略
|
|
|
|
|
const componentStrategies = {
|
|
|
|
|
width: function (el, value, component) {
|
|
|
|
|
let width = isScreen(component.type) ? component.width : component.w * (1920 / 24);
|
|
|
|
|
$('#width').val(width);
|
|
|
|
|
},
|
|
|
|
|
height: function (el, value, component) {
|
|
|
|
|
let height = isScreen(component.type) ? component.height : component.h * cellHeight * 2;
|
|
|
|
|
$('#height').val(height);
|
|
|
|
|
},
|
|
|
|
|
background: function (el, value, component) {
|
|
|
|
|
initColorPicker('background', component);
|
|
|
|
|
|
|
|
|
|
@ -437,6 +470,10 @@
|
|
|
|
|
el.find('img').attr('src', value);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
textAlign: function (el, value) {
|
|
|
|
|
if (!value) return;
|
|
|
|
|
el.find('span').css('text-align', value);
|
|
|
|
|
},
|
|
|
|
|
fontSize: function (el, value) {
|
|
|
|
|
if (!value) return;
|
|
|
|
|
el.find('span').css('font-size', value + 'px');
|
|
|
|
|
@ -514,6 +551,7 @@
|
|
|
|
|
childrenType: { event: 'change', property: 'childrenType' },
|
|
|
|
|
background: { event: 'blur', property: 'background' },
|
|
|
|
|
image: { event: 'change', property: 'image' },
|
|
|
|
|
textAlign: { event: 'change', property: 'textAlign' },
|
|
|
|
|
fontSize: { event: 'blur', property: 'fontSize' },
|
|
|
|
|
color: { event: 'blur', property: 'color' },
|
|
|
|
|
text: { event: 'blur', property: 'text' },
|
|
|
|
|
|