Authored by wangwei

好店推荐楼层

@@ -2006,102 +2006,103 @@ @@ -2006,102 +2006,103 @@
2006 </div> 2006 </div>
2007 <div class="form-group"> 2007 <div class="form-group">
2008 <div class="col-sm-6"> 2008 <div class="col-sm-6">
2009 - <label style="cursor: pointer;"><input type="checkbox" name="isShopRecommend" value="N" [[contentData.data.title.isShopRecommend=='N'?'checked':'']]>固定推荐</label>  
2010 - <label style="cursor: pointer;"><input type="checkbox" name="isShopRecommend" value="Y" [[contentData.data.title.isShopRecommend=='Y'?'checked':'']]>>个性化推荐</label>  
2011 - <input type="hidden" id="isShopRecommend" for="checkbox" value="[[contentData.data.isShopRecommend]]" /> 2009 + <input type="radio" class="isShopRecommend" name="isShopRecommend" value="N" [[contentData.isShopRecommend=="N"?"checked":""]]> 固定推荐
  2010 + <input type="radio" class="isShopRecommend" name="isShopRecommend" value="Y" [[contentData.isShopRecommend=="Y"?"checked":""]]> 个性化推荐&emsp;
  2011 + <input type="hidden" id="isShopRecommend" for="radio" value="[[contentData.isShopRecommend]]" />
2012 </div> 2012 </div>
2013 <div class="col-sm-6"> 2013 <div class="col-sm-6">
2014 </div> 2014 </div>
2015 </div> 2015 </div>
2016 <div class="form-group"> 2016 <div class="form-group">
2017 - <div class="col-sm-6"> 2017 + <div class="col-sm-10" id="shopRecommendTip" style="display: none">
2018 <span style="color:red">提示:选择频道后无需手动配置,将根据大数据个性化算法,抓取内容展示给用户。</span> 2018 <span style="color:red">提示:选择频道后无需手动配置,将根据大数据个性化算法,抓取内容展示给用户。</span>
2019 - <span style="color:red" id="isRecommendInfo" style="display: none">提示:此处配置的内容,将按顺序固定展示。</span>  
2020 </div> 2019 </div>
2021 - <div class="col-sm-6"> 2020 + <div class="col-sm-10" id="shopBaseTip">
  2021 + <span style="color:red" style="display: none">提示:此处配置的内容,将按顺序固定展示。</span>
2022 </div> 2022 </div>
2023 </div> 2023 </div>
2024 - <div>  
2025 - <p><input type="button" name="select-pic" class="btn btn-info btn-xs addBtn" value="添加店铺" data-limit="12" style="margin:10px;" data-event="shopRecommend.list"></p>  
2026 - <ul class="draggable" data-array="data.list">  
2027 - [[each contentData.data.list as item index]]  
2028 - <li>  
2029 - <table class="table table-hover table-bordered responsive dataTable no-footer">  
2030 - <tbody>  
2031 - <tr>  
2032 - <td align="center">[[index+1]]<br/>店铺</td>  
2033 - <td align="center"><input type="file" name="file" value="[[item.src]]" class="observe" data-field="list.[[index]].src" required/></td>  
2034 - <td>  
2035 - <div class="form-group">  
2036 - <div class="col-sm-10">  
2037 - <select name="goTo" class="observe form-control" value="[[item.url.action]]" data-field="list.[[index]].url.action">  
2038 - [[layout action_template]]  
2039 - </select> 2024 + <div class="form-group" id="shopRecommendDiv" style="display: none">
  2025 + <div class="col-sm-12">
  2026 + <select name="shopChannelId" class="shopChannelId observe form-control input-form" value="[[contentData.shopChannelId]]" data-field="contentData.shopChannelId">
  2027 + <option value="0">选择频道</option>
  2028 + <option value="1">男生</option>
  2029 + <option value="2">女生</option>
  2030 + <option value="3">潮童</option>
  2031 + <option value="4">创意生活</option>
  2032 + </select>
  2033 + </div>
  2034 + </div>
  2035 +
  2036 + <div id="shopBaseDiv">
  2037 + <p><input type="button" name="select-pic" class="btn btn-info btn-xs addBtn" value="添加店铺" data-limit="12" style="margin:10px;" data-event="shopRecommend.list"></p>
  2038 + <ul class="draggable" data-array="data.list">
  2039 + [[each contentData.data.list as item index]]
  2040 + <li>
  2041 + <table class="table table-hover table-bordered responsive dataTable no-footer">
  2042 + <tbody>
  2043 + <tr>
  2044 + <td align="center">[[index+1]]<br/>店铺</td>
  2045 + <td align="center"><input type="file" name="file" value="[[item.src]]" class="shopRecommendRequired observe" data-field="list.[[index]].src" /></td>
  2046 + <td>
  2047 + <div class="form-group">
  2048 + <div class="col-sm-10">
  2049 + <select name="goTo" class="observe form-control" value="[[item.url.action]]" data-field="list.[[index]].url.action">
  2050 + [[layout action_template]]
  2051 + </select>
  2052 + </div>
2040 </div> 2053 </div>
2041 - </div>  
2042 - <div class="form-group">  
2043 - <div class="col-sm-10">  
2044 - <input type="text" placeholder="url" value="[[item.url.url]]" class="observe form-control" data-field="list.[[index]].url.url"/> 2054 + <div class="form-group">
  2055 + <div class="col-sm-10">
  2056 + <input type="text" placeholder="url" value="[[item.url.url]]" class="observe form-control" data-field="list.[[index]].url.url"/>
  2057 + </div>
2045 </div> 2058 </div>
2046 - </div>  
2047 - </td>  
2048 - <td align="center">  
2049 - <input type="text" placeholder="店铺id" value="[[item.shopId]]" class="observe number form-control input-form" data-field="list.[[index]].shopId" required/>  
2050 - </td>  
2051 - </tr>  
2052 - <tr>  
2053 - <td align="center">商品</td>  
2054 - <td align="center"><input type="file" name="file" value="[[item.goods0.src]]" class="observe" data-field="list.[[index]].goods0.src" required/></td>  
2055 - <td>  
2056 - <div class="form-group">  
2057 - <div class="col-sm-10">  
2058 - <select name="goTo" class="observe form-control" value="[[item.goods0.url.action]]" data-field="list.[[index]].goods0.url.action">  
2059 - [[layout action_template]]  
2060 - </select> 2059 + </td>
  2060 + <td align="center">
  2061 + <input type="text" placeholder="店铺id" value="[[item.shopId]]" class="shopRecommendRequired observe number form-control input-form" data-field="list.[[index]].shopId"/>
  2062 + </td>
  2063 + </tr>
  2064 + <tr>
  2065 + <td align="center">商品</td>
  2066 + <td align="center"><input type="file" name="file" value="[[item.goods0.src]]" class="shopRecommendRequired observe" data-field="list.[[index]].goods0.src" /></td>
  2067 + <td>
  2068 + <div class="form-group">
  2069 + <div class="col-sm-10">
  2070 + <select name="goTo" class="observe form-control" value="[[item.goods0.url.action]]" data-field="list.[[index]].goods0.url.action">
  2071 + [[layout action_template]]
  2072 + </select>
  2073 + </div>
2061 </div> 2074 </div>
2062 - </div>  
2063 - <div class="form-group">  
2064 - <div class="col-sm-10">  
2065 - <input type="text" placeholder="url" value="[[item.goods0.url.url]]" class="observe form-control" data-field="list.[[index]].goods0.url.url"/> 2075 + <div class="form-group">
  2076 + <div class="col-sm-10">
  2077 + <input type="text" placeholder="url" value="[[item.goods0.url.url]]" class="observe form-control" data-field="list.[[index]].goods0.url.url"/>
  2078 + </div>
2066 </div> 2079 </div>
2067 - </div>  
2068 - </td>  
2069 - </tr>  
2070 - <tr>  
2071 - <td align="center">商品</td>  
2072 - <td align="center"><input type="file" name="file" value="[[item.goods1.src]]" class="observe" data-field="list.[[index]].goods1.src" required/></td>  
2073 - <td>  
2074 - <div class="form-group">  
2075 - <div class="col-sm-10">  
2076 - <select name="goTo" class="observe form-control" value="[[item.goods1.url.action]]" data-field="list.[[index]].goods1.url.action">  
2077 - [[layout action_template]]  
2078 - </select> 2080 + </td>
  2081 + </tr>
  2082 + <tr>
  2083 + <td align="center">商品</td>
  2084 + <td align="center"><input type="file" name="file" value="[[item.goods1.src]]" class="shopRecommendRequired observe" data-field="list.[[index]].goods1.src" /></td>
  2085 + <td>
  2086 + <div class="form-group">
  2087 + <div class="col-sm-10">
  2088 + <select name="goTo" class="observe form-control" value="[[item.goods1.url.action]]" data-field="list.[[index]].goods1.url.action">
  2089 + [[layout action_template]]
  2090 + </select>
  2091 + </div>
2079 </div> 2092 </div>
2080 - </div>  
2081 - <div class="form-group">  
2082 - <div class="col-sm-10">  
2083 - <input type="text" placeholder="url" value="[[item.goods1.url.url]]" class="observe form-control" data-field="list.[[index]].goods1.url.url"/> 2093 + <div class="form-group">
  2094 + <div class="col-sm-10">
  2095 + <input type="text" placeholder="url" value="[[item.goods1.url.url]]" class="observe form-control" data-field="list.[[index]].goods1.url.url"/>
  2096 + </div>
2084 </div> 2097 </div>
2085 - </div>  
2086 - </td>  
2087 - <td align="center"><button class="btn btn-danger btn-sm delBtn" data-event="shopRecommend.list" type="button" data-index="[[index]]">删除</button></td>  
2088 - </tr>  
2089 - </tbody>  
2090 - </table>  
2091 - </li>  
2092 - [[/each]]  
2093 - </ul>  
2094 - </div>  
2095 - <div class="form-group" style="display: none">  
2096 - <div class="col-sm-12">  
2097 - <select name="channelId" class="observe form-control input-form" value="[[contentData.shopChannelId]]">  
2098 - <option value="0">选择频道</option>  
2099 - <option value="1">男生</option>  
2100 - <option value="2">女生</option>  
2101 - <option value="3">潮童</option>  
2102 - <option value="4">创意生活</option>  
2103 - </select>  
2104 - </div> 2098 + </td>
  2099 + <td align="center"><button class="btn btn-danger btn-sm delBtn" data-event="shopRecommend.list" type="button" data-index="[[index]]">删除</button></td>
  2100 + </tr>
  2101 + </tbody>
  2102 + </table>
  2103 + </li>
  2104 + [[/each]]
  2105 + </ul>
2105 </div> 2106 </div>
2106 </script> 2107 </script>
2107 2108
@@ -76,7 +76,7 @@ @@ -76,7 +76,7 @@
76 <div class="shopRecommend"> 76 <div class="shopRecommend">
77 <p class="title"><span>[[module.contentData.data.title.name]]</span> 77 <p class="title"><span>[[module.contentData.data.title.name]]</span>
78 </p> 78 </p>
79 - [[if module.contentData.data.isShopRecommend=='N']] 79 + [[if module.contentData.isShopRecommend=='N']]
80 [[each module.contentData.data.list as item i]] 80 [[each module.contentData.data.list as item i]]
81 [[if i == 0]] 81 [[if i == 0]]
82 <div class="recommend-info"> 82 <div class="recommend-info">
@@ -1236,6 +1236,8 @@ var Button = [ @@ -1236,6 +1236,8 @@ var Button = [
1236 template_intro: "好店推荐", 1236 template_intro: "好店推荐",
1237 __title:"好店推荐", 1237 __title:"好店推荐",
1238 dialog: "shopRecommend-template", 1238 dialog: "shopRecommend-template",
  1239 + isShopRecommend:"",
  1240 + shopChannelId:"",
1239 data: { 1241 data: {
1240 "title": { 1242 "title": {
1241 "name": "", 1243 "name": "",
@@ -1245,8 +1247,6 @@ var Button = [ @@ -1245,8 +1247,6 @@ var Button = [
1245 "url": "" 1247 "url": ""
1246 } 1248 }
1247 }, 1249 },
1248 - "isShopRecommend":"",  
1249 - "shopChannelId":"",  
1250 "list": [ 1250 "list": [
1251 { 1251 {
1252 "url": { 1252 "url": {
@@ -354,9 +354,7 @@ var addObj = { @@ -354,9 +354,7 @@ var addObj = {
354 "action": "", 354 "action": "",
355 "url": "" 355 "url": ""
356 } 356 }
357 - },  
358 - "isShopRecommend":"",  
359 - "shopChannelId":"" 357 + }
360 }, 358 },
361 vipUse_banner_image: {//新人专享->banner 359 vipUse_banner_image: {//新人专享->banner
362 "src": "", 360 "src": "",
@@ -84,6 +84,19 @@ var Bll = { @@ -84,6 +84,19 @@ var Bll = {
84 return false; 84 return false;
85 } 85 }
86 var couponFlag = true; 86 var couponFlag = true;
  87 + //好店推荐切换radio,增加/删除校验
  88 + var shopRecommendFlag = false;
  89 + if(module.contentData.template_name == 'shopRecommend') {
  90 + if(module.contentData.isShopRecommend=="N"||module.contentData.isShopRecommend==""){
  91 + $(".shopRecommendRequired").attr("required",true);
  92 + module.contentData.shopChannelId='';
  93 + module.contentData.isShopRecommend="N"
  94 +
  95 + }else{
  96 + $(".shopRecommendRequired").attr("required",false);
  97 + }
  98 +
  99 + }
87 if (Validate[module.contentData.template_name]) { 100 if (Validate[module.contentData.template_name]) {
88 Validate[module.contentData.template_name].forEach(function (item) { 101 Validate[module.contentData.template_name].forEach(function (item) {
89 couponFlag = item.fn(module.contentData); 102 couponFlag = item.fn(module.contentData);
@@ -487,9 +500,12 @@ $(document).on("click", ".del", function () {//删除 @@ -487,9 +500,12 @@ $(document).on("click", ".del", function () {//删除
487 $(document).on("click", ".edit", function () { 500 $(document).on("click", ".edit", function () {
488 var index = $(this).data("index"); 501 var index = $(this).data("index");
489 var item = Bll.contentDatas[currIndex][index]; 502 var item = Bll.contentDatas[currIndex][index];
490 -  
491 Bll.module = $.extend(true, {}, item); 503 Bll.module = $.extend(true, {}, item);
492 Bll.toast(index, Bll.module); 504 Bll.toast(index, Bll.module);
  505 + if(item.contentData.template_name=='shopRecommend'){
  506 + var _shopRecommendFlag = item.contentData.isShopRecommend==''?"N":item.contentData.isShopRecommend;
  507 + changeShopRecommendDivShow(_shopRecommendFlag);
  508 + }
493 }); 509 });
494 510
495 /*根据limit判断最多添加条数, 根据event判断添加的类型, data-event:template_name + "-template"*/ 511 /*根据limit判断最多添加条数, 根据event判断添加的类型, data-event:template_name + "-template"*/
@@ -661,6 +677,20 @@ $(document).on("click", '.is_show_name', function () { @@ -661,6 +677,20 @@ $(document).on("click", '.is_show_name', function () {
661 Bll.renderDialog("imageList-template"); 677 Bll.renderDialog("imageList-template");
662 }); 678 });
663 //*****************************************************************// 679 //*****************************************************************//
  680 +//*****************************************************************//
  681 +/*好店推荐*/
  682 +$(document).on("click", '.isShopRecommend', function () {
  683 + var _isShopRecommend = $(this).val();
  684 + Bll.module.contentData.isShopRecommend = _isShopRecommend;
  685 + //Bll.renderDialog("shopRecommend-template");
  686 + //切换到推荐
  687 + changeShopRecommendDivShow(_isShopRecommend)
  688 +});
  689 +$(document).on("change", '.shopChannelId', function () {
  690 + Bll.module.contentData.shopChannelId = $(this).val();
  691 + //Bll.renderDialog("shopRecommend-template");
  692 +});
  693 +//*****************************************************************//
664 /*推荐(标题 + 12张图)*/ 694 /*推荐(标题 + 12张图)*/
665 $(document).on("change", '#recommendContentFive-is_show', function () { 695 $(document).on("change", '#recommendContentFive-is_show', function () {
666 Bll.module.contentData.data.title.is_show = 1 - Bll.module.contentData.data.title.is_show; 696 Bll.module.contentData.data.title.is_show = 1 - Bll.module.contentData.data.title.is_show;
@@ -839,7 +869,6 @@ $(document).on("click", "#sub_btn", function () { @@ -839,7 +869,6 @@ $(document).on("click", "#sub_btn", function () {
839 contentData.data.begin_time = dateStrToSeconds(contentData.data.begin_time); 869 contentData.data.begin_time = dateStrToSeconds(contentData.data.begin_time);
840 contentData.data.end_time = dateStrToSeconds(contentData.data.end_time); 870 contentData.data.end_time = dateStrToSeconds(contentData.data.end_time);
841 } 871 }
842 -  
843 data.content[i] = JSON.stringify(common.util.__ArrayToObj(contentData)); 872 data.content[i] = JSON.stringify(common.util.__ArrayToObj(contentData));
844 data.content[i] = JSON.stringify(common.util.__ArrayToObj(Bll.contentDatas[currIndex][i].contentData)); 873 data.content[i] = JSON.stringify(common.util.__ArrayToObj(Bll.contentDatas[currIndex][i].contentData));
845 if (Bll.contentDatas[currIndex][i].id) { 874 if (Bll.contentDatas[currIndex][i].id) {
@@ -1616,3 +1645,18 @@ function validateRollingOverContent(data) { @@ -1616,3 +1645,18 @@ function validateRollingOverContent(data) {
1616 1645
1617 return errArr; 1646 return errArr;
1618 } 1647 }
  1648 +//切换好店推荐div是否展示
  1649 +function changeShopRecommendDivShow(shopRecommendFlag){
  1650 + if(shopRecommendFlag=='Y'){
  1651 + $("#shopBaseTip").css('display','none');
  1652 + $("#shopRecommendTip").css('display','block');
  1653 + $("#shopBaseDiv").css('display','none');
  1654 + $("#shopRecommendDiv").css('display','block');
  1655 + }else if(shopRecommendFlag=='N'){
  1656 + //切换到基础
  1657 + $("#shopBaseTip").css('display','block');
  1658 + $("#shopRecommendTip").css('display','none');
  1659 + $("#shopBaseDiv").css('display','block');
  1660 + $("#shopRecommendDiv").css('display','none');
  1661 + }
  1662 +}