Authored by weiqingting

... ... @@ -115,35 +115,74 @@ $(document).on("click","#submit",function(){
});
var contentDatas=[];
var Button={
btn1:{
var Button=[
{
text:"文本",
template:"template_1",
dialog:"dialog_1"
template:"template_content_text",
dialog:"template_dialog_text",
data:{text:""},
template_name:"text"
},
btn2:{
{
text:"一张大图",
template:"template_1",
dialog:"dialog_1"
},
btn3:{
{
text:"两张小图",
template:"template_1",
dialog:"dialog_1"
},
btn4:{
{
text:"添加商品",
template:"template_1",
dialog:"dialog_1"
},
btn5:{
{
text:"推荐商品组",
template:"template_1",
dialog:"dialog_1"
},
btn5:{
{
text:"一个连接",
template:"template_1",
dialog:"dialog_1"
}
}
\ No newline at end of file
];
$("#content_btns").html(common.util.__template2($("#template_content_btns").html(),{btns:Button}));
var module=null;
$(document).on("click",".add_btn",function(){
var item=Button[$(this).data("index")];
item.index=contentDatas.length;
item=$.extend({},item);
module=item.data;
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);
$("#taglist").html(common.util.__template2($("#template_dialog_text").html(),{modules:contentDatas}));
},
css: "btn-primary"
}
]
});
});
$(document).on("click",".del",function(){
contentDatas.splice($(this).data("index"),1);
$("#taglist").html(common.util.__template2($("#template_dialog_text").html(),contentDatas));
});
$(document).on("change",".observe",function(){
var index=$(this).data("index");
var name=$(this).data("field");
module[name]=$(this).val();
});
\ No newline at end of file
... ...
... ... @@ -142,8 +142,26 @@
<div class="form-group">
<label class="col-sm-2 control-label">文章内容:</label>
<div class="col-sm-8">
<select class="form-control"></select>
<div class="col-sm-6">
<div id="base-form">
<div class="source-content" id="source-m">
<!-- left -->
<div class="content-left" id="contentLeft">
<h4 class="title" data-type="title" style="text-align: center">文章内容</h4>
<ul class="add-box showContain ui-sortable" id="add-content">
</ul>
<nav>
<em><i></i></em>
<ul class="contents" id="content_btns">
</ul>
</nav>
</div>
</div>
</div>
</div>
<div class="col-sm-1">
<button class="btn btn-info" type="button" id="ContentBtn">保存</button>
</div>
</div>
<div class="form-group">
... ... @@ -223,7 +241,6 @@
</script>
<script type="text/template" id="template3">
[[each Brands as brand index]]
<li class="cover-image-item image-list" data-index="2">
<div class="goods-img">
... ... @@ -234,7 +251,6 @@
</div>
</li>
[[/each]]
</script>
<script type="text/template" id="template4">
... ... @@ -266,5 +282,37 @@
</div>
<input type="hidden" id="brandCheckBox" for="checkbox" value="[[Brdata]]" />
</div>
</script>
<script type="text/template" id="template_content_btns">
[[each btns as btn index]]
<li><a href="javascript:void(0)" name="text" class="add_btn" data-index="[[index]]">[[btn.text]]</a></li>
[[/each]]
</script>
<script type="text/template" id="template_content">
<!-- 文本内容 -->
[[each modules as module index]]
[[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>
</div>
</div>
</li>
[[/if]]
[[/each]]
</script>
<!-- 文本弹层 -->
<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>
</div>
</script>
\ No newline at end of file
... ...