Authored by weiqingting

提交

... ... @@ -143,13 +143,16 @@ var util = {
return trim.replace(/^\/if/, '};')
} else if (/^else$/.test(trim)) {
return trim.replace(/else/, '}else{');
} else {
} else if(/^console\.[^\(]+\([^\)*]\)$/.test(trim)){
return trim+";";
}
else {
return "result.push(" + code + ")";
}
}
// var PARAMS={};
var OBJECT = /\.\w+|'.*'|".*"/g;
var KEYWORDS = 'for,if,else,each,as';
var KEYWORDS = 'for,if,else,each,as,console';
var SPECHAR = /\W/g;
var NUMBER = /^\d[^,]*|,\d[^,]*/g;
... ...
... ... @@ -45,6 +45,24 @@ var Bll={
});
$("#addBrands").parent("div").parent("li").prevAll().remove();
$("#addPic").prepend(common.util.__template2($("#template3").html(),{Brands:Brands2}));
},
contentDatas:[],
toast:function(module){
var d=new common.dialog({
title:module.text,
content:common.util.__template2($("#"+module.dialog).html(),module),
width:'80%',
button:[
{
value: "保存",
callback: function(){
Bll.contentDatas.push(module);
$("#add-content").html(common.util.__template2($("#template_content").html(),{modules:Bll.contentDatas}));
},
css: "btn-primary"
}
]
});
}
}
//获取品牌
... ... @@ -114,7 +132,7 @@ $(document).on("click","#submit",function(){
});
});
var contentDatas=[];
var Button=[
{
text:"文本",
... ... @@ -155,34 +173,22 @@ $("#content_btns").html(common.util.__template2($("#template_content_btns").html
var module=null;
$(document).on("click",".add_btn",function(){
var item=Button[$(this).data("index")];
item.i=contentDatas.length;
item=$.extend({},item);
module=item;
var d=new common.dialog({
title:item.text,
content:common.util.__template2($("#"+item.dialog).html(),item),
width:'80%',
button:[
{
value: "保存",
callback: function(){
contentDatas.push(module);
$("#add-content").html(common.util.__template2($("#template_content").html(),{modules:contentDatas}));
},
css: "btn-primary"
}
]
});
Bll.toast(module);
});
$(document).on("click",".del",function(){
contentDatas.splice($(this).data("index"),1);
Bll.contentDatas.splice($(this).data("index"),1);
$("#add-content").html(common.util.__template2($("#template_content").html(),contentDatas));
});
$(document).on("change",".observe",function(){
var index=$(this).data("i");
var name=$(this).data("field");
module[name]=$(this).val();
module.data[name]=$(this).val();
});
$(document).on("click",".edit",function(){
// var item=Button[$(this).data("index")];
// Bll.toast(module);
});
\ No newline at end of file
... ...
... ... @@ -295,14 +295,13 @@
<!-- 文本内容 -->
[[each modules as module index]]
[[console.log(module)]]
[[if module.template_name=='text']]
<li class="custom-group text" data-index="20">
<div class="con">[[module.data.text]]</div>
<div class="actions-box">
<div class="actions-wrap">
<span class="edit" data-value="text" data-index="20">编辑</span>
<span class="del" data-value="text" data-id="" data-index="20">删除</span>
<span class="edit" data-index="[[index]]">编辑</span>
<span class="del" data-index="[[index]]">删除</span>
</div>
</div>
</li>
... ... @@ -314,6 +313,6 @@
<!-- 文本弹层 -->
<script type="text/template" id="template_dialog_text">
<div class="rows">
<textarea rows="2" class="form-control observe" placeholder="文章摘要" data-index='[[data.i]]' data-field="text" >[[data.text]]</textarea>
<textarea rows="2" class="form-control observe" placeholder="文章摘要" data-field="text" >[[data.text]]</textarea>
</div>
</script>
\ No newline at end of file
... ...