...
|
...
|
@@ -14,6 +14,10 @@ common.util.__ajax({ |
|
|
ViewModel = res.data;
|
|
|
},true);
|
|
|
|
|
|
/*配置模块*/
|
|
|
var edit = new common.edit(".modal-body", {
|
|
|
bucket: "goodsimg"
|
|
|
});
|
|
|
|
|
|
var Bll={
|
|
|
__render:function(selecter,templater,data){
|
...
|
...
|
@@ -43,21 +47,28 @@ var Bll={ |
|
|
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)) {
|
|
|
//(!!~index?index:0)
|
|
|
var _field = obj.key.replace(/^file_onComplete_file__/, '').split('-');
|
|
|
Bll.module.contentData.data[_field[1]].src = obj.data;
|
|
|
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);
|
|
|
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/*配置模块*/
|
|
|
var edit = new common.edit(".modal-body", {
|
|
|
bucket: "goodsimg"
|
|
|
});
|
|
|
|
|
|
|
|
|
/*第一步,基础模板*/
|
|
|
Bll.__render("#content-list","content-template",ViewModel);
|
...
|
...
|
@@ -68,7 +79,7 @@ ViewModel.contentData.forEach(function(item,index){ |
|
|
item.contentData=common.util.__ObjToArray(JSON.parse(item.contentData));
|
|
|
Bll.contentDatas.push(item);
|
|
|
});
|
|
|
console.log("1",ViewModel.contentData);
|
|
|
console.log("Bll.contentDatas",Bll.contentDatas);
|
|
|
//console.log(Bll.contentDatas);
|
|
|
|
|
|
/*第三部解析楼层*/
|
...
|
...
|
@@ -125,14 +136,60 @@ $(document).on("change", ".observe", function() { |
|
|
});
|
|
|
});
|
|
|
|
|
|
$(document).on("click", '#multiLabelImage-addImage', function() {
|
|
|
Bll.module.contentData.data.image.push({
|
|
|
"src": "",
|
|
|
"url": {
|
|
|
"action": "",
|
|
|
"url": ""
|
|
|
}
|
|
|
});
|
|
|
Bll.renderDialog("multiLabelImage-template");
|
|
|
});
|
|
|
|
|
|
$(document).on("click", '#multiLabelImage-addOne', function() {
|
|
|
Bll.module.contentData.data.label_list.push({
|
|
|
"src": "",
|
|
|
"url": {
|
|
|
"action": "",
|
|
|
"url": ""
|
|
|
}
|
|
|
});
|
|
|
Bll.renderDialog("multiLabelImage-template");
|
|
|
});
|
|
|
|
|
|
$(document).on("click", '#matchImage-addOne', function() {
|
|
|
var length = Bll.module.contentData.data.list.length;//获得长度
|
|
|
Bll.module.contentData.data.list.push({
|
|
|
"src": "",
|
|
|
"title": "",
|
|
|
"url": {
|
|
|
"action": "",
|
|
|
"url": ""
|
|
|
}
|
|
|
});
|
|
|
Bll.__render("#add-content","template_content",{modules:Bll.contentDatas});
|
|
|
Bll.renderDialog("matchImage-template");
|
|
|
});
|
|
|
|
|
|
$(document).on("click", "#sub_btn", function() {
|
|
|
var data = {
|
|
|
"content": {},
|
|
|
"data_id": {},
|
|
|
"rId": ""
|
|
|
};
|
|
|
for(var i = 0; i < Bll.contentDatas.length; i++) {
|
|
|
data.content[i]=JSON.stringify(common.util.__ArrayToObj(Bll.contentDatas[i].contentData));
|
|
|
if(Bll.contentDatas[i].id) {
|
|
|
data.data_id[i] = "id_"+Bll.contentDatas[i].id;
|
|
|
}
|
|
|
}
|
|
|
data.rId = param;
|
|
|
data.content = JSON.stringify(data.content);
|
|
|
data.data_id = JSON.stringify(data.data_id);
|
|
|
console.log(data);
|
|
|
common.util.__ajax({
|
|
|
url: "/resource/content/addResContent",
|
|
|
data: data
|
|
|
},function(res) {
|
|
|
console.log(res.data);
|
|
|
window.location.href=window.location.href;
|
|
|
});
|
|
|
}); |
|
|
\ No newline at end of file |
...
|
...
|
|