...
|
...
|
@@ -79,40 +79,46 @@ var Bll = { |
|
|
contentDatas: [],
|
|
|
module: null,
|
|
|
toast: function(index, module) {
|
|
|
var d = new common.dialog({
|
|
|
title: (!!~index ? "修改" : "添加") + module.template_intro,
|
|
|
content: common.util.__template2($("#" + module.dialog).html(), module),
|
|
|
width: '70%',
|
|
|
button: [{
|
|
|
value: "保存",
|
|
|
callback: function() {
|
|
|
if (edit.validate()) {
|
|
|
//TODO
|
|
|
!!~index ? Bll.contentDatas[index] = module : Bll.contentDatas.push(module);
|
|
|
console.log("Bll.contentDatas",Bll.contentDatas);
|
|
|
Bll.rendContent();
|
|
|
console.log(Bll.contentDatas);
|
|
|
|
|
|
d.close();
|
|
|
}
|
|
|
|
|
|
return false;
|
|
|
},
|
|
|
css: "btn-primary"
|
|
|
}]
|
|
|
});
|
|
|
edit.init();
|
|
|
edit.on("callback", function(obj) {
|
|
|
if (/^file_onComplete/.test(obj.key)) {
|
|
|
var names=obj.field;
|
|
|
Bll.module.data=common.util.__buildobj(names, '.', Bll.module.data, function(o, name) {
|
|
|
o[name] = obj.data;
|
|
|
});
|
|
|
console.log(Bll.module.data);
|
|
|
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
var d = new common.dialog({
|
|
|
title: (!!~index ? "修改" : "添加") + module.contentData.template_intro,
|
|
|
content: common.util.__template2($("#" + module.contentData.dialog).html(), module),
|
|
|
width: '70%',
|
|
|
button: [{
|
|
|
value: "保存",
|
|
|
callback: function() {
|
|
|
if (edit.validate()) {
|
|
|
//TODO
|
|
|
!!~index ? Bll.contentDatas[index] = module : Bll.contentDatas.push(module);
|
|
|
Bll.__render("#add-content","template_content",{modules:Bll.contentDatas});
|
|
|
console.log(Bll.contentDatas);
|
|
|
|
|
|
d.close();
|
|
|
}
|
|
|
|
|
|
return false;
|
|
|
},
|
|
|
css: "btn-primary"
|
|
|
}]
|
|
|
});
|
|
|
Bll.__editRender();
|
|
|
},
|
|
|
renderDialog:function(templater){
|
|
|
Bll.__render(".modal-body",templater,Bll.module);
|
|
|
Bll.__editRender();
|
|
|
},
|
|
|
__editRender:function(){
|
|
|
edit.init();
|
|
|
edit.on("callback", function(obj) {
|
|
|
if (/^file_onComplete/.test(obj.key)) {
|
|
|
var names=obj.field;
|
|
|
Bll.module.contentData.data=common.util.__buildobj(names, '.', Bll.module.contentData.data, function(o, name) {
|
|
|
o[name] = obj.data;
|
|
|
});
|
|
|
console.log(Bll.module.contentData.data);
|
|
|
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
rendContent: function() {
|
|
|
$("#add-content").html(common.util.__template2($("#template_content").html(), {
|
|
|
modules: Bll.contentDatas
|
...
|
...
|
@@ -328,8 +334,6 @@ $(document).on("click", ".del", function() { |
|
|
$(document).on("change", ".observe", function() {
|
|
|
var $this = $(this);
|
|
|
var name = $this.data("field");
|
|
|
// index = $this.data("index");
|
|
|
// var module = (index == undefined) ? Bll.module.data : Bll.module.data[index];
|
|
|
Bll.module.contentData.data=common.util.__buildobj(name, '.', Bll.module.contentData.data, function(obj, name) {
|
|
|
obj[name] = $this.val();
|
|
|
});
|
...
|
...
|
|