Showing
2 changed files
with
55 additions
and
51 deletions
@@ -79,40 +79,46 @@ var Bll = { | @@ -79,40 +79,46 @@ var Bll = { | ||
79 | contentDatas: [], | 79 | contentDatas: [], |
80 | module: null, | 80 | module: null, |
81 | toast: function(index, module) { | 81 | toast: function(index, module) { |
82 | - var d = new common.dialog({ | ||
83 | - title: (!!~index ? "修改" : "添加") + module.template_intro, | ||
84 | - content: common.util.__template2($("#" + module.dialog).html(), module), | ||
85 | - width: '70%', | ||
86 | - button: [{ | ||
87 | - value: "保存", | ||
88 | - callback: function() { | ||
89 | - if (edit.validate()) { | ||
90 | - //TODO | ||
91 | - !!~index ? Bll.contentDatas[index] = module : Bll.contentDatas.push(module); | ||
92 | - console.log("Bll.contentDatas",Bll.contentDatas); | ||
93 | - Bll.rendContent(); | ||
94 | - console.log(Bll.contentDatas); | ||
95 | - | ||
96 | - d.close(); | ||
97 | - } | ||
98 | - | ||
99 | - return false; | ||
100 | - }, | ||
101 | - css: "btn-primary" | ||
102 | - }] | ||
103 | - }); | ||
104 | - edit.init(); | ||
105 | - edit.on("callback", function(obj) { | ||
106 | - if (/^file_onComplete/.test(obj.key)) { | ||
107 | - var names=obj.field; | ||
108 | - Bll.module.data=common.util.__buildobj(names, '.', Bll.module.data, function(o, name) { | ||
109 | - o[name] = obj.data; | ||
110 | - }); | ||
111 | - console.log(Bll.module.data); | ||
112 | - | ||
113 | - } | ||
114 | - }); | ||
115 | - }, | 82 | + var d = new common.dialog({ |
83 | + title: (!!~index ? "修改" : "添加") + module.contentData.template_intro, | ||
84 | + content: common.util.__template2($("#" + module.contentData.dialog).html(), module), | ||
85 | + width: '70%', | ||
86 | + button: [{ | ||
87 | + value: "保存", | ||
88 | + callback: function() { | ||
89 | + if (edit.validate()) { | ||
90 | + //TODO | ||
91 | + !!~index ? Bll.contentDatas[index] = module : Bll.contentDatas.push(module); | ||
92 | + Bll.__render("#add-content","template_content",{modules:Bll.contentDatas}); | ||
93 | + console.log(Bll.contentDatas); | ||
94 | + | ||
95 | + d.close(); | ||
96 | + } | ||
97 | + | ||
98 | + return false; | ||
99 | + }, | ||
100 | + css: "btn-primary" | ||
101 | + }] | ||
102 | + }); | ||
103 | + Bll.__editRender(); | ||
104 | + }, | ||
105 | + renderDialog:function(templater){ | ||
106 | + Bll.__render(".modal-body",templater,Bll.module); | ||
107 | + Bll.__editRender(); | ||
108 | + }, | ||
109 | + __editRender:function(){ | ||
110 | + edit.init(); | ||
111 | + edit.on("callback", function(obj) { | ||
112 | + if (/^file_onComplete/.test(obj.key)) { | ||
113 | + var names=obj.field; | ||
114 | + Bll.module.contentData.data=common.util.__buildobj(names, '.', Bll.module.contentData.data, function(o, name) { | ||
115 | + o[name] = obj.data; | ||
116 | + }); | ||
117 | + console.log(Bll.module.contentData.data); | ||
118 | + | ||
119 | + } | ||
120 | + }); | ||
121 | + }, | ||
116 | rendContent: function() { | 122 | rendContent: function() { |
117 | $("#add-content").html(common.util.__template2($("#template_content").html(), { | 123 | $("#add-content").html(common.util.__template2($("#template_content").html(), { |
118 | modules: Bll.contentDatas | 124 | modules: Bll.contentDatas |
@@ -328,8 +334,6 @@ $(document).on("click", ".del", function() { | @@ -328,8 +334,6 @@ $(document).on("click", ".del", function() { | ||
328 | $(document).on("change", ".observe", function() { | 334 | $(document).on("change", ".observe", function() { |
329 | var $this = $(this); | 335 | var $this = $(this); |
330 | var name = $this.data("field"); | 336 | var name = $this.data("field"); |
331 | - // index = $this.data("index"); | ||
332 | - // var module = (index == undefined) ? Bll.module.data : Bll.module.data[index]; | ||
333 | Bll.module.contentData.data=common.util.__buildobj(name, '.', Bll.module.contentData.data, function(obj, name) { | 337 | Bll.module.contentData.data=common.util.__buildobj(name, '.', Bll.module.contentData.data, function(obj, name) { |
334 | obj[name] = $this.val(); | 338 | obj[name] = $this.val(); |
335 | }); | 339 | }); |
@@ -265,24 +265,24 @@ | @@ -265,24 +265,24 @@ | ||
265 | [[each modules as module index]] | 265 | [[each modules as module index]] |
266 | <li class="custom-group" data-index="[[index]]"> | 266 | <li class="custom-group" data-index="[[index]]"> |
267 | [[if module.contentData.template_name=='text']] | 267 | [[if module.contentData.template_name=='text']] |
268 | - <div class="con">[[module.data.text]]</div> | ||
269 | - [[else if module.template_name=='singleImage']] | 268 | + <div class="con">[[module.contentData.data.text]]</div> |
269 | + [[else if module.contentData.template_name=='singleImage']] | ||
270 | <div class="list"> | 270 | <div class="list"> |
271 | - <img src="[[module.data[0].src]]?imageView/2/w/100/h/100" title="[[module.data[0].title]]"> | 271 | + <img src="[[module.contentData.data[0].src]]" title="[[module.contentData.data[0].title]]"> |
272 | </div> | 272 | </div> |
273 | - [[else if module.template_name=='smallPic']] | 273 | + [[else if module.contentData.template_name=='smallPic']] |
274 | <div class="small-pic"> | 274 | <div class="small-pic"> |
275 | <ul class="small-pic-list"> | 275 | <ul class="small-pic-list"> |
276 | - [[each module.data as item i]] | ||
277 | - <img src="[[item.src]]?imageView/2/w/100/h/100" title="[[item.title]]"> | 276 | + [[each module.contentData.data as item i]] |
277 | + <img src="[[item.src]]" title="[[item.title]]"> | ||
278 | [[/each]] | 278 | [[/each]] |
279 | </ul> | 279 | </ul> |
280 | </div> | 280 | </div> |
281 | - [[else if module.template_name=='goods']] | 281 | + [[else if module.contentData.template_name=='goods']] |
282 | <div class="small-pic"> | 282 | <div class="small-pic"> |
283 | <ul class="small-pic-list"> | 283 | <ul class="small-pic-list"> |
284 | - [[each module.data as item i]] | ||
285 | - <img src="[[item.src]]?imageView/2/w/100/h/100" title="[[item.id]]"> | 284 | + [[each module.contentData.data as item i]] |
285 | + <img src="[[item.src]]" title="[[item.id]]"> | ||
286 | [[/each]] | 286 | [[/each]] |
287 | </ul> | 287 | </ul> |
288 | </div> | 288 | </div> |
@@ -295,13 +295,13 @@ | @@ -295,13 +295,13 @@ | ||
295 | 295 | ||
296 | <div class="small-pic-list2"> | 296 | <div class="small-pic-list2"> |
297 | [[each module.data as items i]] | 297 | [[each module.data as items i]] |
298 | - <img src="[[items.cover.cover]]?imageView/2/w/100/h/100" > | 298 | + <img src="[[items.cover.cover]]" > |
299 | [[/each]] | 299 | [[/each]] |
300 | </div> | 300 | </div> |
301 | <div class="small-pic-list"> | 301 | <div class="small-pic-list"> |
302 | 302 | ||
303 | [[each module.data[0].list as item index]] | 303 | [[each module.data[0].list as item index]] |
304 | - <img src="[[item.src]]?imageView/2/w/100/h/100" title="[[item.id]]"> | 304 | + <img src="[[item.src]]" title="[[item.id]]"> |
305 | [[/each]] | 305 | [[/each]] |
306 | 306 | ||
307 | </ul> | 307 | </ul> |
@@ -322,7 +322,7 @@ | @@ -322,7 +322,7 @@ | ||
322 | <!-- 文本弹层 --> | 322 | <!-- 文本弹层 --> |
323 | <script type="text/template" id="template_dialog_text"> | 323 | <script type="text/template" id="template_dialog_text"> |
324 | <div class="rows"> | 324 | <div class="rows"> |
325 | - <textarea rows="2" class="form-control observe" placeholder="文章摘要" data-field="text" >[[data.text]]</textarea> | 325 | + <textarea rows="2" class="form-control observe" placeholder="文章摘要" data-field="text" >[[contentData.data.text]]</textarea> |
326 | </div> | 326 | </div> |
327 | </script> | 327 | </script> |
328 | 328 | ||
@@ -338,7 +338,7 @@ | @@ -338,7 +338,7 @@ | ||
338 | </tr> | 338 | </tr> |
339 | </thead> | 339 | </thead> |
340 | <tbody> | 340 | <tbody> |
341 | - [[each data as item index]] | 341 | + [[each contentData.data as item index]] |
342 | <tr> | 342 | <tr> |
343 | <td>[[index+1]]</td> | 343 | <td>[[index+1]]</td> |
344 | <td><input type="file" name="file" id="src-[[index]]" value="[[item.src]]" data-field="[[index]].src" data-index="[[index]]" /></td> | 344 | <td><input type="file" name="file" id="src-[[index]]" value="[[item.src]]" data-field="[[index]].src" data-index="[[index]]" /></td> |
@@ -356,11 +356,11 @@ | @@ -356,11 +356,11 @@ | ||
356 | <div class="form-group"> | 356 | <div class="form-group"> |
357 | <div class="col-sm-12"> | 357 | <div class="col-sm-12"> |
358 | <ul class="cover-image-list col-sm-10" id="goodspic"> | 358 | <ul class="cover-image-list col-sm-10" id="goodspic"> |
359 | - [[each data as item index]] | 359 | + [[each contentData.data as item index]] |
360 | <li class="cover-image-item image-list" data-index="2"> | 360 | <li class="cover-image-item image-list" data-index="2"> |
361 | <div class="goods-img"> | 361 | <div class="goods-img"> |
362 | <a class="fileinput-button-icon" href="javascript:void(0);"> | 362 | <a class="fileinput-button-icon" href="javascript:void(0);"> |
363 | - <img src="[[item.src]]?imageView/2/w/100/h/100"> | 363 | + <img src="[[item.src]]"> |
364 | </a> | 364 | </a> |
365 | <i class="remove-item-btn removepic glyphicon glyphicon-remove-circle" data-index="[[index]]"></i> | 365 | <i class="remove-item-btn removepic glyphicon glyphicon-remove-circle" data-index="[[index]]"></i> |
366 | </div> | 366 | </div> |
-
Please register or login to post a comment