Authored by 陶雨

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

@@ -149,6 +149,12 @@ var util = { @@ -149,6 +149,12 @@ var util = {
149 }); 149 });
150 }else if(/^console\.[^\(]+\([^\)*]\)$/.test(trim)){ 150 }else if(/^console\.[^\(]+\([^\)*]\)$/.test(trim)){
151 return trim+";"; 151 return trim+";";
  152 + }else if(/^layout\s+/.test(trim)){
  153 + // var items=/^layout\s+(\w*)/.exec(trim);
  154 + var items=trim.split(/\s+/g);
  155 + items[2]=source[items[2]]||source;
  156 + console.error(items[2]);
  157 + return "result.push('"+util.__template2(document.getElementById(items[1]).innerHTML,items[2]).replace(/\n/g,'')+ "')";
152 } 158 }
153 else { 159 else {
154 return "result.push(" + code + ")"; 160 return "result.push(" + code + ")";
@@ -156,7 +162,7 @@ var util = { @@ -156,7 +162,7 @@ var util = {
156 } 162 }
157 // var PARAMS={}; 163 // var PARAMS={};
158 var OBJECT = /\.\w+|'.*'|".*"/g; 164 var OBJECT = /\.\w+|'.*'|".*"/g;
159 - var KEYWORDS = 'for,if,else,each,as,console'; 165 + var KEYWORDS = 'for,if,else,each,as,console,layout';
160 var SPECHAR = /\W/g; 166 var SPECHAR = /\W/g;
161 var NUMBER = /^\d[^,]*|,\d[^,]*/g; 167 var NUMBER = /^\d[^,]*|,\d[^,]*/g;
162 168
@@ -9,6 +9,8 @@ var ENUM={}; @@ -9,6 +9,8 @@ var ENUM={};
9 // }); 9 // });
10 console.log(ENUM); 10 console.log(ENUM);
11 11
  12 +var edit=new common.edit(".modal-body",{bucket:"goodsimg"});
  13 +
12 var Bll={ 14 var Bll={
13 Brands:[], 15 Brands:[],
14 Brands1:{}, 16 Brands1:{},
@@ -63,6 +65,7 @@ var Bll={ @@ -63,6 +65,7 @@ var Bll={
63 } 65 }
64 ] 66 ]
65 }); 67 });
  68 + edit.init();
66 }, 69 },
67 rendContent:function(){ 70 rendContent:function(){
68 $("#add-content").html(common.util.__template2($("#template_content").html(),{modules:Bll.contentDatas})); 71 $("#add-content").html(common.util.__template2($("#template_content").html(),{modules:Bll.contentDatas}));
@@ -139,24 +142,20 @@ $(document).on("click","#submit",function(){ @@ -139,24 +142,20 @@ $(document).on("click","#submit",function(){
139 var Button=[ 142 var Button=[
140 { 143 {
141 text:"文本", 144 text:"文本",
142 - template:"template_content_text",  
143 dialog:"template_dialog_text", 145 dialog:"template_dialog_text",
144 data:{text:""}, 146 data:{text:""},
145 template_name:"text" 147 template_name:"text"
146 }, 148 },
147 { 149 {
148 text:"一张大图", 150 text:"一张大图",
149 - template:"template_1",  
150 - dialog:"dialog_1", 151 + dialog:"template_dialog_grid",
151 template_name:"singleImage", 152 template_name:"singleImage",
152 - "data": {  
153 - "0": {  
154 - "url": {}, 153 + data:[{
  154 + "url": "",
155 "alt": "", 155 "alt": "",
156 - "src": "http://img11.static.yhbimg.com/yhb-img01/2016/03/31/03/01076e3caed758a1c18c91a0e9cae3368f.jpg?imageView/{mode}/w/{width}/h/{height}", 156 + "src": "",
157 "imgId": "0" 157 "imgId": "0"
158 - }  
159 - } 158 + }],
160 }, 159 },
161 { 160 {
162 text:"两张小图", 161 text:"两张小图",
@@ -305,9 +305,9 @@ @@ -305,9 +305,9 @@
305 </div> 305 </div>
306 </div> 306 </div>
307 </li> 307 </li>
308 - [[else if module.template_name=='text']] 308 + [[else if module.template_name=='singleImage']]
309 309
310 - stringify 310 + [[/if]]
311 [[/each]] 311 [[/each]]
312 312
313 </script> 313 </script>
@@ -317,4 +317,32 @@ @@ -317,4 +317,32 @@
317 <div class="rows"> 317 <div class="rows">
318 <textarea rows="2" class="form-control observe" placeholder="文章摘要" data-field="text" >[[data.text]]</textarea> 318 <textarea rows="2" class="form-control observe" placeholder="文章摘要" data-field="text" >[[data.text]]</textarea>
319 </div> 319 </div>
  320 + [[layout template_dialog_grid]]
  321 +</script>
  322 +
  323 +<!-- 一张图片 -->
  324 +<script type="text/template" id="template_dialog_grid">
  325 + <div class="rows">
  326 + <div id="grid-baseFrom">
  327 + <table class="table table-hover table-bordered responsive dataTable no-footer">
  328 + <thead>
  329 + <tr>
  330 + <th>序号</th>
  331 + <th>资源位</th>
  332 + <th>选项</th>
  333 + </tr>
  334 + </thead>
  335 + <tbody>
  336 + [[each data as item index]]
  337 + <tr>
  338 + <td>[[index+1]]</td>
  339 + <td><input type="file" name="file" data-prefix="aaa.imgs" data-field="src" id="titleImage-image-src[[index]]" value="[[item.src]]" data-index="[[index]]" /></td>
  340 + <td>
  341 + </td>
  342 + </tr>
  343 + [[/each]]
  344 + </tbody>
  345 + </table>
  346 + </div>
  347 + </div>
320 </script> 348 </script>