Authored by chaogeng

Merge branch 'dev-guang' into test5.7

@@ -98,10 +98,10 @@ @@ -98,10 +98,10 @@
98 <label class="col-sm-2 control-label">图片类型:</label> 98 <label class="col-sm-2 control-label">图片类型:</label>
99 99
100 <div class="col-sm-8" style="padding-top: 6px"> 100 <div class="col-sm-8" style="padding-top: 6px">
  101 + <input type="radio" value="2" name="coverImageType" checked>
  102 + <label>长形</label>
101 <input type="radio" value="1" name="coverImageType"> 103 <input type="radio" value="1" name="coverImageType">
102 <label>方形</label> 104 <label>方形</label>
103 - <input type="radio" value="2" name="coverImageType">  
104 - <label>长形</label>  
105 <input type="hidden" id="coverImageType" value="[[coverImageType]]" for="radio"/> 105 <input type="hidden" id="coverImageType" value="[[coverImageType]]" for="radio"/>
106 </div> 106 </div>
107 </div> 107 </div>
@@ -421,6 +421,67 @@ @@ -421,6 +421,67 @@
421 </div> 421 </div>
422 </div> 422 </div>
423 </script> 423 </script>
  424 +<!-- 一张图片 -->
  425 +<script type="text/template" id="template_dialog_grid2">
  426 + <div class="rows">
  427 + <div id="grid-baseFrom">
  428 + <table class="table table-hover table-bordered responsive dataTable no-footer">
  429 + <thead>
  430 + <tr>
  431 + <th>序号</th>
  432 + <th>资源位</th>
  433 + <th>关联商品</th>
  434 + </tr>
  435 + </thead>
  436 + <tbody>
  437 + <tr id="relatGoods">
  438 + [[layout template_dialog_relatGoods]]
  439 + </tr>
  440 + </tbody>
  441 + </table>
  442 + </div>
  443 + <div class="form-group">
  444 + <div class="col-sm-2">
  445 + <button class="btn btn-info" type="button" id="imgsSelectBtn">上传多张图片</button>
  446 + </div>
  447 + </div>
  448 + </div>
  449 +</script>
  450 +<script type="text/template" id="template_dialog_relatGoods">
  451 + [[each contentData.data as datas index]]
  452 + <td>[[index+1]]</td>
  453 + <!-- multiple="true" -->
  454 + <td>
  455 + <input type="file" name="file" id="url-[[index]]" value="[[datas.src]]"
  456 + data-field="[[index]].src" data-index="[[index]]"/>
  457 + </td>
  458 + <td>
  459 + <div class="form-group">
  460 + [[each datas.tagList as item i]]
  461 + <div class="form-group">
  462 + <div class="col-sm-2">
  463 + <a class="fileinput-button-icon" href="javascript:void(0);">
  464 + <img src="[[item.pic_src]]" width="100px" height="100px">
  465 + </a>
  466 + </div>
  467 + <div class="col-sm-6">
  468 + <input class="form-control observe" value="[[item.tagName]]" placeholder="商品标题"
  469 + data-field='[[index]].tagList.[[i]].tagName'/>
  470 + </div>
  471 + <div class="col-sm-2">
  472 + <button class="btn btn-info" type="button" value="[[i]]" id="delRelProductBtn">删除</button>
  473 + </div>
  474 + </div>
  475 + [[/each]]
  476 + </div>
  477 + <div class="form-group">
  478 + <div class="col-sm-2">
  479 + <button class="btn btn-info" type="button" id="relGoodsSelectBtn">添加关联商品</button>
  480 + </div>
  481 + </div>
  482 + </td>
  483 + [[/each]]
  484 +</script>
424 <script type="text/template" id="template_dialog_imgmodule"> 485 <script type="text/template" id="template_dialog_imgmodule">
425 <div class="rows" id="moduleimgs"> 486 <div class="rows" id="moduleimgs">
426 <div class="form-group"> 487 <div class="form-group">
@@ -112,7 +112,7 @@ gulp.task('server', function () { @@ -112,7 +112,7 @@ gulp.task('server', function () {
112 'index.js', 112 'index.js',
113 "./apps/**/controllers/*.js", 113 "./apps/**/controllers/*.js",
114 "./apps/**/interfaces/*.js", 114 "./apps/**/interfaces/*.js",
115 - "./apps/**/views/**.html" 115 + "./apps/**/views/**/*.html"
116 ], server.restart); 116 ], server.restart);
117 117
118 }); 118 });
@@ -135,7 +135,7 @@ var Bll = { @@ -135,7 +135,7 @@ var Bll = {
135 } 135 }
136 136
137 // 对于图片资源位,增加图片的原始尺寸 137 // 对于图片资源位,增加图片的原始尺寸
138 - if(module.contentData.dialog == 'template_dialog_grid') { 138 + if(module.contentData.dialog == 'template_dialog_grid' || module.contentData.dialog == 'template_dialog_grid2') {
139 $.each(module.contentData.data, function(index, data) { 139 $.each(module.contentData.data, function(index, data) {
140 Bll.getPicNaturalSize(data); 140 Bll.getPicNaturalSize(data);
141 }); 141 });
@@ -307,8 +307,8 @@ var Button = [ @@ -307,8 +307,8 @@ var Button = [
307 template_name: "text" 307 template_name: "text"
308 }, 308 },
309 { 309 {
310 - template_intro: "一张大图",  
311 - dialog: "template_dialog_grid", 310 + template_intro: "单张大图",
  311 + dialog: "template_dialog_grid2",
312 template_name: "singleImage", 312 template_name: "singleImage",
313 data: [{ 313 data: [{
314 "url": { 314 "url": {
@@ -317,7 +317,9 @@ var Button = [ @@ -317,7 +317,9 @@ var Button = [
317 }, 317 },
318 "alt": "", 318 "alt": "",
319 "src": "", 319 "src": "",
320 - "imgId": "" 320 + "imgId": "",
  321 + "tagList":[
  322 + ]
321 }] 323 }]
322 }, 324 },
323 { 325 {
@@ -362,7 +364,7 @@ var Button = [ @@ -362,7 +364,7 @@ var Button = [
362 template_name: "goods", 364 template_name: "goods",
363 data: [] 365 data: []
364 }, 366 },
365 - { 367 + /*{
366 template_intro: "推荐商品组", 368 template_intro: "推荐商品组",
367 dialog: "template_dialog_remgoods", 369 dialog: "template_dialog_remgoods",
368 template_name: "goodsGroup", 370 template_name: "goodsGroup",
@@ -373,9 +375,9 @@ var Button = [ @@ -373,9 +375,9 @@ var Button = [
373 }, 375 },
374 list: [] 376 list: []
375 }] 377 }]
376 - }, 378 + },*/
377 { 379 {
378 - template_intro: "一个链接", 380 + template_intro: "链接",
379 dialog: "template_dialog_link", 381 dialog: "template_dialog_link",
380 template_name: "link", 382 template_name: "link",
381 data: [{ 383 data: [{
@@ -772,6 +774,42 @@ var goodsgird = new common.grid({ @@ -772,6 +774,42 @@ var goodsgird = new common.grid({
772 name: "storage_num" 774 name: "storage_num"
773 }] 775 }]
774 }); 776 });
  777 +//点击“添加商品”按钮(一张大图)
  778 +$(document).on("click", "#relGoodsSelectBtn", function () {
  779 + new common.dialog({
  780 + title: "选择商品",
  781 + zIndex: 52,
  782 + content: $("#template_dialog_goodsgird").html(),
  783 + width: '80%',
  784 + button: [{
  785 + value: "确定",
  786 + callback: function () {
  787 + var gs = goodsgird.selected.map(function (item, index) {
  788 + return {
  789 + pic_src: item.images_url,
  790 + product_skn: item.product_skn,
  791 + tagName: item.product_name,
  792 + }
  793 + })
  794 + Bll.module.contentData.data[0].tagList = Bll.module.contentData.data[0].tagList.concat(gs);
  795 + //Bll.module.contentData.data = Unique(Bll.module.contentData.data, "product_skc")
  796 + Bll.__render("#relatGoods", "template_dialog_relatGoods", Bll.module);
  797 + components.init();
  798 + Bll2.moveDrag();
  799 +
  800 + },
  801 + css: "btn-primary"
  802 + }]
  803 + });
  804 + goodsgird.grid = null;
  805 +});
  806 +//点击“删除”按钮,删除添加商品(一张大图)
  807 +$(document).on("click", "#delRelProductBtn", function () {
  808 + var index = $(this).val();;
  809 + Bll.module.contentData.data[0].tagList.splice(index, 1);
  810 + Bll.__render("#relatGoods", "template_dialog_relatGoods", Bll.module);
  811 + components.init();
  812 +});
775 //点击“选择标签”按钮(添加商品) 813 //点击“选择标签”按钮(添加商品)
776 $(document).on("click", "#goodsSelectBtn", function () { 814 $(document).on("click", "#goodsSelectBtn", function () {
777 new common.dialog({ 815 new common.dialog({
@@ -802,7 +840,6 @@ $(document).on("click", "#goodsSelectBtn", function () { @@ -802,7 +840,6 @@ $(document).on("click", "#goodsSelectBtn", function () {
802 }); 840 });
803 goodsgird.grid = null; 841 goodsgird.grid = null;
804 }); 842 });
805 -  
806 //点击“添加组”按钮(添加商品组) 843 //点击“添加组”按钮(添加商品组)
807 $(document).on("click", "#goodsaddBtn", function () { 844 $(document).on("click", "#goodsaddBtn", function () {
808 var item = $.extend(true, {}, Button[4].data[0]); 845 var item = $.extend(true, {}, Button[4].data[0]);