|
|
|
@ -10,7 +10,7 @@
|
|
|
|
let currentComponent = null;
|
|
|
|
let currentComponent = null;
|
|
|
|
let currentScreen = 'welcome';
|
|
|
|
let currentScreen = 'welcome';
|
|
|
|
let cellHeight = 30;
|
|
|
|
let cellHeight = 30;
|
|
|
|
let locale = 'en';
|
|
|
|
let locale = 'en_US';
|
|
|
|
|
|
|
|
|
|
|
|
var initGridStack = () => {
|
|
|
|
var initGridStack = () => {
|
|
|
|
// 让gridstack知道如何渲染,组件children中的content直接渲染html
|
|
|
|
// 让gridstack知道如何渲染,组件children中的content直接渲染html
|
|
|
|
@ -322,6 +322,13 @@
|
|
|
|
$('#page-prop').hide();
|
|
|
|
$('#page-prop').hide();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 设置复制按钮
|
|
|
|
|
|
|
|
if (isScreen(component.type)) {
|
|
|
|
|
|
|
|
$('#copy-component').hide();
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
$('#copy-component').show();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const form = $('#props-panel').find('form');
|
|
|
|
const form = $('#props-panel').find('form');
|
|
|
|
if (component.hasOwnProperty('childrenType')) {
|
|
|
|
if (component.hasOwnProperty('childrenType')) {
|
|
|
|
form.find('#childrenType').val(component.childrenType);
|
|
|
|
form.find('#childrenType').val(component.childrenType);
|
|
|
|
@ -586,17 +593,22 @@
|
|
|
|
localStorage.setItem('mainData', JSON.stringify(conputedInitData('save', main)));
|
|
|
|
localStorage.setItem('mainData', JSON.stringify(conputedInitData('save', main)));
|
|
|
|
localStorage.setItem('welcomeData', JSON.stringify(conputedInitData('save', welcome)));
|
|
|
|
localStorage.setItem('welcomeData', JSON.stringify(conputedInitData('save', welcome)));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let id = getQueryParam('id');
|
|
|
|
|
|
|
|
let data = {
|
|
|
|
|
|
|
|
name: $('#templateName').val(),
|
|
|
|
|
|
|
|
content: JSON.stringify({
|
|
|
|
|
|
|
|
mainData: conputedInitData('save', main),
|
|
|
|
|
|
|
|
welcomeData: conputedInitData('save', welcome),
|
|
|
|
|
|
|
|
}),
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
if (id) {
|
|
|
|
|
|
|
|
data.id = id;
|
|
|
|
|
|
|
|
}
|
|
|
|
requestFN(
|
|
|
|
requestFN(
|
|
|
|
{
|
|
|
|
{
|
|
|
|
type: 'POST',
|
|
|
|
type: 'POST',
|
|
|
|
url: getQueryParam('id') ? 'update' : 'save',
|
|
|
|
url: id ? 'update' : 'save',
|
|
|
|
data: {
|
|
|
|
data,
|
|
|
|
name: $('#templateName').val(),
|
|
|
|
|
|
|
|
content: JSON.stringify({
|
|
|
|
|
|
|
|
mainData: conputedInitData('save', main),
|
|
|
|
|
|
|
|
welcomeData: conputedInitData('save', welcome),
|
|
|
|
|
|
|
|
}),
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
function () {}
|
|
|
|
function () {}
|
|
|
|
);
|
|
|
|
);
|
|
|
|
@ -713,16 +725,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
var i18n = function () {
|
|
|
|
var i18n = function () {
|
|
|
|
return new Promise((resolve) => {
|
|
|
|
return new Promise((resolve) => {
|
|
|
|
setTimeout(() => {
|
|
|
|
requestFN({ url: 'getLanguage', hasPreFix: false }, function (data) {
|
|
|
|
locale = 'zh-CN';
|
|
|
|
data.language = 'zh_CN';
|
|
|
|
// locale = 'en';
|
|
|
|
locale = data.language;
|
|
|
|
// 设置语言
|
|
|
|
// 设置语言
|
|
|
|
layui.i18n.set({
|
|
|
|
layui.i18n.set({
|
|
|
|
locale: locale,
|
|
|
|
locale: locale,
|
|
|
|
messages: {
|
|
|
|
messages: {
|
|
|
|
// 扩展其他语言包
|
|
|
|
// 扩展其他语言包
|
|
|
|
en: userLangConfig.en,
|
|
|
|
en_US: userLangConfig['en_US'],
|
|
|
|
'zh-CN': userLangConfig['zh-CN'],
|
|
|
|
zh_CN: userLangConfig['zh_CN'],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|
|
|
|
});
|
|
|
|
// 渲染页面模板
|
|
|
|
// 渲染页面模板
|
|
|
|
@ -730,7 +742,7 @@
|
|
|
|
const html = layui.laytpl(template, { tagStyle: 'modern' }).render();
|
|
|
|
const html = layui.laytpl(template, { tagStyle: 'modern' }).render();
|
|
|
|
$('#root').html(html);
|
|
|
|
$('#root').html(html);
|
|
|
|
resolve();
|
|
|
|
resolve();
|
|
|
|
}, 500);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|