Authored by 陶雨

Merge branch 'develop' of http://git.dev.yoho.cn/platform/yohobuy-portal-fe into develop

Conflicts:
	server/views/pages/guang/contentEdit.html
... ... @@ -539,8 +539,8 @@ var Button=[
"title": "",
"more": "",
"more_url": "",
"show_num": "",
"image_style": "",
"show_num": "0",
"image_style": "imageList",
"T1F2": true,
"list": [
{
... ... @@ -618,45 +618,45 @@ var Button=[
"url": ""
}
},
"top_image": {
"0": {
"top_image": [
{
"src": "",
"url": {
"action": "",
"url": ""
}
},
"1": {
{
"src": "",
"url": {
"action": "",
"url": ""
}
}
},
"list": {
"0": {
],
"list": [
{
"src": "",
"url": {
"action": "",
"url": ""
}
},
"1": {
{
"src": "",
"url": {
"action": "",
"url": ""
}
},
"2": {
{
"src": "",
"url": {
"action": "",
"url": ""
}
}
}
]
}
},
];
... ...
... ... @@ -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
... ...
... ... @@ -58,7 +58,7 @@
<script type="text/template" id="multiLabelImage-template">
<div class="panel-body" id="multiLabelImage-baseFrom">
<div class="form-group">
[[each contentData.data.label_list as item index]]
[[each contentData.data.label as item index]]
<label class="control-label">标签[[index+1]]:</label>
<input type="text" class="observe" value="[[item.title]]" data-field="label_list.[[index]].title" required="required" style="width: 100px">
<label class="control-label">跳转目的</label>
... ... @@ -66,10 +66,10 @@
[[layout action_template]]
</select>
<label>跳转地址</label>
<input type="text" class="observe" value="[[item.url.url]]" data-field="label_list.[[index]].url.url" required="required" style="width: 120px" />
<input type="text" class="observe" value="[[item.url.url]]" data-field="label_list.[[index]].url.url" required="required" style="width: 120px" /><br>
[[/each]]
</div>
<a href="JavaScript:;" id="multiLabelImage-addOne" class="btn btn-primary btn-xs">添加一个</a>
<a href="JavaScript:;" id="multiLabelImage-addOne" class="btn btn-primary btn-xs">添加标签</a>
<div>
<table class="table table-hover table-bordered responsive dataTable no-footer">
<thead>
... ... @@ -100,6 +100,7 @@
</tbody>
</table>
</div>
<a href="JavaScript:;" id="multiLabelImage-addImage" class="btn btn-primary btn-xs">添加图片</a>
</div>
</script>
<!--搭配(2T-nF)-->
... ... @@ -249,7 +250,7 @@
[[/if]]
[[each contentData.data.list as item index]]
<tr>
<td>[[index+3]]</td>
<td>[[index+2]]</td>
<td><input type="file" name="file" value="[[item.src]]" class="observe" data-field="list.[[index]].src"/></td>
<td>
<div class="col-sm-12">
... ... @@ -276,19 +277,19 @@
更多链接 : <input type="text" value="[[contentData.data.more_url]]" class="observe" required="required" data-field="more_url" />
</p>
<p>样式设置:
<select name="image_style" data-element="imageGroup" value="[[contentData.data.image_style]]" data-field="image_style" class="observe">
<select name="image_style" value="[[contentData.data.image_style]]" data-field="image_style" class="observe">
<option value="default">默认(一张图片)</option>
<option value="T1F2">T1+F2</option>
<option value="L1R2">L1+R2</option>
<option value="imageList" selected="">图片列表</option>
<option value="imageList" selected="selected">图片列表</option>
</select>
每行显示数量:
<select name="show_num" value="[[show_num]]" data-element="imageGroup" data-field="image_style" class="observe">
<option value="0">一行显示</option>
<select name="show_num" value="[[contentData.data.show_num]]" data-element="imageGroup" data-field="show_num" class="observe">
<option value="0" selected="selected">一行显示</option>
<option value="1">一行一个</option>
<option value="2">一行两个</option>
<option value="4">一行四个</option>
<option value="6" selected="">一行六个</option>
<option value="6">一行六个</option>
</select> <font color="#999">注:只有图片列表是选择才会有效</font></p>
<div id="imageGroup-bottom">
<table class="table table-hover table-bordered responsive dataTable no-footer">
... ... @@ -300,21 +301,21 @@
</tr>
</thead>
<tbody>
[[each data.list as item index]]
[[each contentData.data.list as item index]]
<tr>
<td>[[index+1]]</td>
<td><input type="file" name="file" value="[[item.src]]" class="recommendContent-observe" data-rows="[[__index]]" data-index="[[index]]" data-observe="list-src" /></td>
<td><input type="file" name="file" value="[[item.src]]" data-field="list.[[index]].src" class="observe"/></td>
<td>
<div class="col-sm-12">
<select name="goTo" class="form-control recommendContent-observe" value="[[item.url.action]]" data-rows="[[__index]]" data-index="[[index]]" data-observe="list-action" >
<select name="goTo" class="form-control observe" value="[[item.url.action]]" data-field="list.[[index]].url.action">
[[layout action_template]]
</select>
</div>
<div class="col-sm-12">
<input value="[[item.url.url]]" class="form-control recommendContent-observe" required="required" data-rows="[[__index]]" data-index="[[index]]" data-observe="list-url" />
<input value="[[item.url.url]]" class="form-control observe" required="required" data-field="list.[[index]].url.url"/>
</div>
<div class="col-sm-12">
<input placeholder="图片描述" value="[[item.url.title]]" class="form-control recommendContent-observe" required="required" data-rows="[[__index]]" data-index="[[index]]" data-observe="list-url" />
<input placeholder="图片描述" value="[[item.url.title]]" data-field="list.[[index]].url.title" class="form-control observe" required="required" />
</div>
</td>
</tr>
... ...
... ... @@ -183,13 +183,16 @@
</div>
</div>
[[else if module.contentData.template_name=='imageGroup']]
<div class="custom-group-list">
<div class="hot-brand-title" style="margin:0px auto; text-align:center;">[[module.contentData.data.title]]</div>
<ul class="custom-pic clearfix image-list-box resource-row li[[12/module.contentData.data.title.column_num]]">
[[each module.contentData.data.list as item index]]
<li><img src="[[item.src]]"></li>
[[/each]]
</ul>
<div class="custom-group-list focus">
<div class="custom-group-box">
<div class="row">
[[each module.contentData.data.list as item index]]
<div class="col-lg-[[12/(module.contentData.data.show_num?module.contentData.data.show_num:4)]]">
<img src="[[item.src]]" class="image-group-box-[[module.contentData.data.show_num==1?'big':'small']]">
</div>
[[/each]]
</div>
</div>
</div>
[[else if module.contentData.template_name=='paramsGroup']]
<div class="custom-group-list">
... ... @@ -212,10 +215,10 @@
[[else if module.contentData.template_name=='multiLabelImage']]
<div class="editorTalk_content">
<div class="editor-info">
[[each module.contentData.data.label_list as item index]]
[[each module.contentData.data.label as item index]]
<span class="title">[[item.title]]</span>
[[/each]]
<img src="[[module.contentData.data.image.src]]" style="width:99%">
<img src="[[module.contentData.data.image[0].src]]" style="width:99%">
</div>
</div>
[[else if module.contentData.template_name=='matchImage']]
... ...