Merge branch 'develop' of http://git.dev.yoho.cn/platform/yohobuy-portal-fe into develop
Conflicts: server/views/pages/guang/contentEdit.html
Showing
4 changed files
with
106 additions
and
45 deletions
@@ -539,8 +539,8 @@ var Button=[ | @@ -539,8 +539,8 @@ var Button=[ | ||
539 | "title": "", | 539 | "title": "", |
540 | "more": "", | 540 | "more": "", |
541 | "more_url": "", | 541 | "more_url": "", |
542 | - "show_num": "", | ||
543 | - "image_style": "", | 542 | + "show_num": "0", |
543 | + "image_style": "imageList", | ||
544 | "T1F2": true, | 544 | "T1F2": true, |
545 | "list": [ | 545 | "list": [ |
546 | { | 546 | { |
@@ -618,45 +618,45 @@ var Button=[ | @@ -618,45 +618,45 @@ var Button=[ | ||
618 | "url": "" | 618 | "url": "" |
619 | } | 619 | } |
620 | }, | 620 | }, |
621 | - "top_image": { | ||
622 | - "0": { | 621 | + "top_image": [ |
622 | + { | ||
623 | "src": "", | 623 | "src": "", |
624 | "url": { | 624 | "url": { |
625 | "action": "", | 625 | "action": "", |
626 | "url": "" | 626 | "url": "" |
627 | } | 627 | } |
628 | }, | 628 | }, |
629 | - "1": { | 629 | + { |
630 | "src": "", | 630 | "src": "", |
631 | "url": { | 631 | "url": { |
632 | "action": "", | 632 | "action": "", |
633 | "url": "" | 633 | "url": "" |
634 | } | 634 | } |
635 | } | 635 | } |
636 | - }, | ||
637 | - "list": { | ||
638 | - "0": { | 636 | + ], |
637 | + "list": [ | ||
638 | + { | ||
639 | "src": "", | 639 | "src": "", |
640 | "url": { | 640 | "url": { |
641 | "action": "", | 641 | "action": "", |
642 | "url": "" | 642 | "url": "" |
643 | } | 643 | } |
644 | }, | 644 | }, |
645 | - "1": { | 645 | + { |
646 | "src": "", | 646 | "src": "", |
647 | "url": { | 647 | "url": { |
648 | "action": "", | 648 | "action": "", |
649 | "url": "" | 649 | "url": "" |
650 | } | 650 | } |
651 | }, | 651 | }, |
652 | - "2": { | 652 | + { |
653 | "src": "", | 653 | "src": "", |
654 | "url": { | 654 | "url": { |
655 | "action": "", | 655 | "action": "", |
656 | "url": "" | 656 | "url": "" |
657 | } | 657 | } |
658 | } | 658 | } |
659 | - } | 659 | + ] |
660 | } | 660 | } |
661 | }, | 661 | }, |
662 | ]; | 662 | ]; |
@@ -14,6 +14,10 @@ common.util.__ajax({ | @@ -14,6 +14,10 @@ common.util.__ajax({ | ||
14 | ViewModel = res.data; | 14 | ViewModel = res.data; |
15 | },true); | 15 | },true); |
16 | 16 | ||
17 | +/*配置模块*/ | ||
18 | +var edit = new common.edit(".modal-body", { | ||
19 | + bucket: "goodsimg" | ||
20 | +}); | ||
17 | 21 | ||
18 | var Bll={ | 22 | var Bll={ |
19 | __render:function(selecter,templater,data){ | 23 | __render:function(selecter,templater,data){ |
@@ -43,21 +47,28 @@ var Bll={ | @@ -43,21 +47,28 @@ var Bll={ | ||
43 | css: "btn-primary" | 47 | css: "btn-primary" |
44 | }] | 48 | }] |
45 | }); | 49 | }); |
50 | + Bll.__editRender(); | ||
51 | + }, | ||
52 | + renderDialog:function(templater){ | ||
53 | + Bll.__render(".modal-body",templater,Bll.module); | ||
54 | + Bll.__editRender(); | ||
55 | + }, | ||
56 | + __editRender:function(){ | ||
46 | edit.init(); | 57 | edit.init(); |
47 | edit.on("callback", function(obj) { | 58 | edit.on("callback", function(obj) { |
48 | if (/^file_onComplete/.test(obj.key)) { | 59 | if (/^file_onComplete/.test(obj.key)) { |
49 | - //(!!~index?index:0) | ||
50 | - var _field = obj.key.replace(/^file_onComplete_file__/, '').split('-'); | ||
51 | - Bll.module.contentData.data[_field[1]].src = obj.data; | 60 | + var names=obj.field; |
61 | + Bll.module.contentData.data=common.util.__buildobj(names, '.', Bll.module.contentData.data, function(o, name) { | ||
62 | + o[name] = obj.data; | ||
63 | + }); | ||
64 | + console.log(Bll.module.contentData.data); | ||
65 | + | ||
52 | } | 66 | } |
53 | }); | 67 | }); |
54 | } | 68 | } |
55 | } | 69 | } |
56 | 70 | ||
57 | -/*配置模块*/ | ||
58 | -var edit = new common.edit(".modal-body", { | ||
59 | - bucket: "goodsimg" | ||
60 | -}); | 71 | + |
61 | 72 | ||
62 | /*第一步,基础模板*/ | 73 | /*第一步,基础模板*/ |
63 | Bll.__render("#content-list","content-template",ViewModel); | 74 | Bll.__render("#content-list","content-template",ViewModel); |
@@ -68,7 +79,7 @@ ViewModel.contentData.forEach(function(item,index){ | @@ -68,7 +79,7 @@ ViewModel.contentData.forEach(function(item,index){ | ||
68 | item.contentData=common.util.__ObjToArray(JSON.parse(item.contentData)); | 79 | item.contentData=common.util.__ObjToArray(JSON.parse(item.contentData)); |
69 | Bll.contentDatas.push(item); | 80 | Bll.contentDatas.push(item); |
70 | }); | 81 | }); |
71 | -console.log("1",ViewModel.contentData); | 82 | +console.log("Bll.contentDatas",Bll.contentDatas); |
72 | //console.log(Bll.contentDatas); | 83 | //console.log(Bll.contentDatas); |
73 | 84 | ||
74 | /*第三部解析楼层*/ | 85 | /*第三部解析楼层*/ |
@@ -125,14 +136,60 @@ $(document).on("change", ".observe", function() { | @@ -125,14 +136,60 @@ $(document).on("change", ".observe", function() { | ||
125 | }); | 136 | }); |
126 | }); | 137 | }); |
127 | 138 | ||
139 | +$(document).on("click", '#multiLabelImage-addImage', function() { | ||
140 | + Bll.module.contentData.data.image.push({ | ||
141 | + "src": "", | ||
142 | + "url": { | ||
143 | + "action": "", | ||
144 | + "url": "" | ||
145 | + } | ||
146 | + }); | ||
147 | + Bll.renderDialog("multiLabelImage-template"); | ||
148 | +}); | ||
149 | + | ||
150 | +$(document).on("click", '#multiLabelImage-addOne', function() { | ||
151 | + Bll.module.contentData.data.label_list.push({ | ||
152 | + "src": "", | ||
153 | + "url": { | ||
154 | + "action": "", | ||
155 | + "url": "" | ||
156 | + } | ||
157 | + }); | ||
158 | + Bll.renderDialog("multiLabelImage-template"); | ||
159 | +}); | ||
160 | + | ||
128 | $(document).on("click", '#matchImage-addOne', function() { | 161 | $(document).on("click", '#matchImage-addOne', function() { |
129 | - var length = Bll.module.contentData.data.list.length;//获得长度 | ||
130 | Bll.module.contentData.data.list.push({ | 162 | Bll.module.contentData.data.list.push({ |
131 | - "src": "", | 163 | + "title": "", |
132 | "url": { | 164 | "url": { |
133 | "action": "", | 165 | "action": "", |
134 | "url": "" | 166 | "url": "" |
135 | } | 167 | } |
136 | }); | 168 | }); |
137 | - Bll.__render("#add-content","template_content",{modules:Bll.contentDatas}); | 169 | + Bll.renderDialog("matchImage-template"); |
170 | +}); | ||
171 | + | ||
172 | +$(document).on("click", "#sub_btn", function() { | ||
173 | + var data = { | ||
174 | + "content": {}, | ||
175 | + "data_id": {}, | ||
176 | + "rId": "" | ||
177 | + }; | ||
178 | + for(var i = 0; i < Bll.contentDatas.length; i++) { | ||
179 | + data.content[i]=JSON.stringify(common.util.__ArrayToObj(Bll.contentDatas[i].contentData)); | ||
180 | + if(Bll.contentDatas[i].id) { | ||
181 | + data.data_id[i] = "id_"+Bll.contentDatas[i].id; | ||
182 | + } | ||
183 | + } | ||
184 | + data.rId = param; | ||
185 | + data.content = JSON.stringify(data.content); | ||
186 | + data.data_id = JSON.stringify(data.data_id); | ||
187 | + console.log(data); | ||
188 | + common.util.__ajax({ | ||
189 | + url: "/resource/content/addResContent", | ||
190 | + data: data | ||
191 | + },function(res) { | ||
192 | + console.log(res.data); | ||
193 | + window.location.href=window.location.href; | ||
194 | + }); | ||
138 | }); | 195 | }); |
@@ -58,7 +58,7 @@ | @@ -58,7 +58,7 @@ | ||
58 | <script type="text/template" id="multiLabelImage-template"> | 58 | <script type="text/template" id="multiLabelImage-template"> |
59 | <div class="panel-body" id="multiLabelImage-baseFrom"> | 59 | <div class="panel-body" id="multiLabelImage-baseFrom"> |
60 | <div class="form-group"> | 60 | <div class="form-group"> |
61 | - [[each contentData.data.label_list as item index]] | 61 | + [[each contentData.data.label as item index]] |
62 | <label class="control-label">标签[[index+1]]:</label> | 62 | <label class="control-label">标签[[index+1]]:</label> |
63 | <input type="text" class="observe" value="[[item.title]]" data-field="label_list.[[index]].title" required="required" style="width: 100px"> | 63 | <input type="text" class="observe" value="[[item.title]]" data-field="label_list.[[index]].title" required="required" style="width: 100px"> |
64 | <label class="control-label">跳转目的</label> | 64 | <label class="control-label">跳转目的</label> |
@@ -66,10 +66,10 @@ | @@ -66,10 +66,10 @@ | ||
66 | [[layout action_template]] | 66 | [[layout action_template]] |
67 | </select> | 67 | </select> |
68 | <label>跳转地址</label> | 68 | <label>跳转地址</label> |
69 | - <input type="text" class="observe" value="[[item.url.url]]" data-field="label_list.[[index]].url.url" required="required" style="width: 120px" /> | 69 | + <input type="text" class="observe" value="[[item.url.url]]" data-field="label_list.[[index]].url.url" required="required" style="width: 120px" /><br> |
70 | [[/each]] | 70 | [[/each]] |
71 | </div> | 71 | </div> |
72 | - <a href="JavaScript:;" id="multiLabelImage-addOne" class="btn btn-primary btn-xs">添加一个</a> | 72 | + <a href="JavaScript:;" id="multiLabelImage-addOne" class="btn btn-primary btn-xs">添加标签</a> |
73 | <div> | 73 | <div> |
74 | <table class="table table-hover table-bordered responsive dataTable no-footer"> | 74 | <table class="table table-hover table-bordered responsive dataTable no-footer"> |
75 | <thead> | 75 | <thead> |
@@ -100,6 +100,7 @@ | @@ -100,6 +100,7 @@ | ||
100 | </tbody> | 100 | </tbody> |
101 | </table> | 101 | </table> |
102 | </div> | 102 | </div> |
103 | + <a href="JavaScript:;" id="multiLabelImage-addImage" class="btn btn-primary btn-xs">添加图片</a> | ||
103 | </div> | 104 | </div> |
104 | </script> | 105 | </script> |
105 | <!--搭配(2T-nF)--> | 106 | <!--搭配(2T-nF)--> |
@@ -249,7 +250,7 @@ | @@ -249,7 +250,7 @@ | ||
249 | [[/if]] | 250 | [[/if]] |
250 | [[each contentData.data.list as item index]] | 251 | [[each contentData.data.list as item index]] |
251 | <tr> | 252 | <tr> |
252 | - <td>[[index+3]]</td> | 253 | + <td>[[index+2]]</td> |
253 | <td><input type="file" name="file" value="[[item.src]]" class="observe" data-field="list.[[index]].src"/></td> | 254 | <td><input type="file" name="file" value="[[item.src]]" class="observe" data-field="list.[[index]].src"/></td> |
254 | <td> | 255 | <td> |
255 | <div class="col-sm-12"> | 256 | <div class="col-sm-12"> |
@@ -276,19 +277,19 @@ | @@ -276,19 +277,19 @@ | ||
276 | 更多链接 : <input type="text" value="[[contentData.data.more_url]]" class="observe" required="required" data-field="more_url" /> | 277 | 更多链接 : <input type="text" value="[[contentData.data.more_url]]" class="observe" required="required" data-field="more_url" /> |
277 | </p> | 278 | </p> |
278 | <p>样式设置: | 279 | <p>样式设置: |
279 | - <select name="image_style" data-element="imageGroup" value="[[contentData.data.image_style]]" data-field="image_style" class="observe"> | 280 | + <select name="image_style" value="[[contentData.data.image_style]]" data-field="image_style" class="observe"> |
280 | <option value="default">默认(一张图片)</option> | 281 | <option value="default">默认(一张图片)</option> |
281 | <option value="T1F2">T1+F2</option> | 282 | <option value="T1F2">T1+F2</option> |
282 | <option value="L1R2">L1+R2</option> | 283 | <option value="L1R2">L1+R2</option> |
283 | - <option value="imageList" selected="">图片列表</option> | 284 | + <option value="imageList" selected="selected">图片列表</option> |
284 | </select> | 285 | </select> |
285 | 每行显示数量: | 286 | 每行显示数量: |
286 | - <select name="show_num" value="[[show_num]]" data-element="imageGroup" data-field="image_style" class="observe"> | ||
287 | - <option value="0">一行显示</option> | 287 | + <select name="show_num" value="[[contentData.data.show_num]]" data-element="imageGroup" data-field="show_num" class="observe"> |
288 | + <option value="0" selected="selected">一行显示</option> | ||
288 | <option value="1">一行一个</option> | 289 | <option value="1">一行一个</option> |
289 | <option value="2">一行两个</option> | 290 | <option value="2">一行两个</option> |
290 | <option value="4">一行四个</option> | 291 | <option value="4">一行四个</option> |
291 | - <option value="6" selected="">一行六个</option> | 292 | + <option value="6">一行六个</option> |
292 | </select> <font color="#999">注:只有图片列表是选择才会有效</font></p> | 293 | </select> <font color="#999">注:只有图片列表是选择才会有效</font></p> |
293 | <div id="imageGroup-bottom"> | 294 | <div id="imageGroup-bottom"> |
294 | <table class="table table-hover table-bordered responsive dataTable no-footer"> | 295 | <table class="table table-hover table-bordered responsive dataTable no-footer"> |
@@ -300,21 +301,21 @@ | @@ -300,21 +301,21 @@ | ||
300 | </tr> | 301 | </tr> |
301 | </thead> | 302 | </thead> |
302 | <tbody> | 303 | <tbody> |
303 | - [[each data.list as item index]] | 304 | + [[each contentData.data.list as item index]] |
304 | <tr> | 305 | <tr> |
305 | <td>[[index+1]]</td> | 306 | <td>[[index+1]]</td> |
306 | - <td><input type="file" name="file" value="[[item.src]]" class="recommendContent-observe" data-rows="[[__index]]" data-index="[[index]]" data-observe="list-src" /></td> | 307 | + <td><input type="file" name="file" value="[[item.src]]" data-field="list.[[index]].src" class="observe"/></td> |
307 | <td> | 308 | <td> |
308 | <div class="col-sm-12"> | 309 | <div class="col-sm-12"> |
309 | - <select name="goTo" class="form-control recommendContent-observe" value="[[item.url.action]]" data-rows="[[__index]]" data-index="[[index]]" data-observe="list-action" > | 310 | + <select name="goTo" class="form-control observe" value="[[item.url.action]]" data-field="list.[[index]].url.action"> |
310 | [[layout action_template]] | 311 | [[layout action_template]] |
311 | </select> | 312 | </select> |
312 | </div> | 313 | </div> |
313 | <div class="col-sm-12"> | 314 | <div class="col-sm-12"> |
314 | - <input value="[[item.url.url]]" class="form-control recommendContent-observe" required="required" data-rows="[[__index]]" data-index="[[index]]" data-observe="list-url" /> | 315 | + <input value="[[item.url.url]]" class="form-control observe" required="required" data-field="list.[[index]].url.url"/> |
315 | </div> | 316 | </div> |
316 | <div class="col-sm-12"> | 317 | <div class="col-sm-12"> |
317 | - <input placeholder="图片描述" value="[[item.url.title]]" class="form-control recommendContent-observe" required="required" data-rows="[[__index]]" data-index="[[index]]" data-observe="list-url" /> | 318 | + <input placeholder="图片描述" value="[[item.url.title]]" data-field="list.[[index]].url.title" class="form-control observe" required="required" /> |
318 | </div> | 319 | </div> |
319 | </td> | 320 | </td> |
320 | </tr> | 321 | </tr> |
@@ -183,13 +183,16 @@ | @@ -183,13 +183,16 @@ | ||
183 | </div> | 183 | </div> |
184 | </div> | 184 | </div> |
185 | [[else if module.contentData.template_name=='imageGroup']] | 185 | [[else if module.contentData.template_name=='imageGroup']] |
186 | -<div class="custom-group-list"> | ||
187 | - <div class="hot-brand-title" style="margin:0px auto; text-align:center;">[[module.contentData.data.title]]</div> | ||
188 | - <ul class="custom-pic clearfix image-list-box resource-row li[[12/module.contentData.data.title.column_num]]"> | ||
189 | - [[each module.contentData.data.list as item index]] | ||
190 | - <li><img src="[[item.src]]"></li> | ||
191 | - [[/each]] | ||
192 | - </ul> | 186 | +<div class="custom-group-list focus"> |
187 | + <div class="custom-group-box"> | ||
188 | + <div class="row"> | ||
189 | + [[each module.contentData.data.list as item index]] | ||
190 | + <div class="col-lg-[[12/(module.contentData.data.show_num?module.contentData.data.show_num:4)]]"> | ||
191 | + <img src="[[item.src]]" class="image-group-box-[[module.contentData.data.show_num==1?'big':'small']]"> | ||
192 | + </div> | ||
193 | + [[/each]] | ||
194 | + </div> | ||
195 | + </div> | ||
193 | </div> | 196 | </div> |
194 | [[else if module.contentData.template_name=='paramsGroup']] | 197 | [[else if module.contentData.template_name=='paramsGroup']] |
195 | <div class="custom-group-list"> | 198 | <div class="custom-group-list"> |
@@ -212,10 +215,10 @@ | @@ -212,10 +215,10 @@ | ||
212 | [[else if module.contentData.template_name=='multiLabelImage']] | 215 | [[else if module.contentData.template_name=='multiLabelImage']] |
213 | <div class="editorTalk_content"> | 216 | <div class="editorTalk_content"> |
214 | <div class="editor-info"> | 217 | <div class="editor-info"> |
215 | - [[each module.contentData.data.label_list as item index]] | 218 | + [[each module.contentData.data.label as item index]] |
216 | <span class="title">[[item.title]]</span> | 219 | <span class="title">[[item.title]]</span> |
217 | [[/each]] | 220 | [[/each]] |
218 | - <img src="[[module.contentData.data.image.src]]" style="width:99%"> | 221 | + <img src="[[module.contentData.data.image[0].src]]" style="width:99%"> |
219 | </div> | 222 | </div> |
220 | </div> | 223 | </div> |
221 | [[else if module.contentData.template_name=='matchImage']] | 224 | [[else if module.contentData.template_name=='matchImage']] |
-
Please register or login to post a comment