resource-edit-new.58a3fbc2d362239e466c.js 15.2 KB
webpackJsonp([10],{1:function(t,e){t.exports=iview},145:function(t,e,a){"use strict";var o=a(27),i=a.n(o),s=a(13),r=a.n(s),l=a(26),n=a.n(l),c=a(3),d=a(17),u=a(47),m=a(116),h=a(143),f=a(67),v=a.n(f),p=a(6),g=a.n(p);e.a={name:"resourceEditNew",components:{Divide:h.a,bannerEditor:u.a,SmartFloor:m.a,draggable:v.a},data:function(){return{title:"",list:[],floorList:[],modalInfo:{modalType:0,modalTitle:"",resContentId:0,floorIndex:-1,template_intro:"",template_name:"",hideAddButton:!0,isSelectAction:!1,isCustomImgSize:!1},singleData:{data:{0:{alt:"",bgColor:"",imgId:"0",src:"",title:"",hideDeleteButton:!0,url:{action:"go.h5",url:""},height:"",width:""}},type:3,template_intro:"一张图",template_name:"singleImage",resContentId:0},twoData:{data:{0:{alt:"",bgColor:"",imgId:"0",src:"",title:"",hideDeleteButton:!0,url:{action:"go.h5",url:""},height:"",width:""},1:{alt:"",bgColor:"",imgId:"0",src:"",title:"",hideDeleteButton:!0,url:{action:"go.h5",url:""},height:"",width:""}},type:4,template_intro:"两张图",template_name:"twoPicture",resContentId:0},threeData:{data:{0:{alt:"",bgColor:"",imgId:"0",src:"",title:"",hideDeleteButton:!0,url:{action:"go.h5",url:""}},1:{alt:"",bgColor:"",imgId:"0",src:"",title:"",hideDeleteButton:!0,url:{action:"go.h5",url:""}},2:{alt:"",bgColor:"",imgId:"0",src:"",title:"",hideDeleteButton:!0,url:{action:"go.h5",url:""}}},type:5,template_intro:"三张图(左一右二)",template_name:"threePicture",resContentId:0},imageListData:{data:{list:{0:{alt:"",bgColor:"",imgId:"0",src:"",title:"",hideDeleteButton:!0,url:{action:"go.h5",url:""}}}},type:6,template_intro:"热门系列",template_name:"imageList",resContentId:0},guessLikeData:{data:{list:{0:{alt:"",bgColor:"",imgId:"0",src:"",title:"",hideDeleteButton:!0,url:{action:"go.pool",url:"https://m.yohobuy.com/?pagename=productList"}}}},type:7,template_intro:"商品池Tab",template_name:"guessLike",resContentId:0},tabFloorData:{data:{list:{0:{tabName:"",code:"",hideDeleteButton:!0,url:{action:"go.channel",url:""}}}},type:8,template_intro:"首页频道Tab",template_name:"tabFloor",resContentId:0},foucsData:{data:{list:{0:{alt:"",bgColor:"",imgId:"0",src:"",title:"",hideDeleteButton:!0,url:{action:"go.h5",url:""}}}},type:9,template_intro:"焦点图",template_name:"focus",resContentId:0},resId:null,bg:"",show:!1,modalData:[],uploadData:{id:c.a.getQueryString("id"),items:[]},resourceCodeList:[],selectResource:{id:-1}}},watch:{selectResource:function(t){this.resId=t.id,this.uploadData.id=t.id,this.getResourceDetailList()}},mounted:function(){this.resId=c.a.getQueryString("id"),this.platform=c.a.getQueryString("platform"),this.title=c.a.getQueryString("name"),this.code=c.a.getQueryString("code"),this.resourceService=new d.a,this.getResourceListByCode()},methods:{getResourceDetailList:function(){var t=this;this.resourceService.info(this.resId).then(function(e){t.list=e,t.manageAllData(e),t.manageFloorList(e)})},getResourceListByCode:function(){var t=this;this.resourceService.listByCode(this.code).then(function(e){t.resourceCodeList=e.data,t.selectResource=e.data[0]})},manageAllData:function(t){this.uploadData.items=[];for(var e=0;e<t.length;e++){var a={id:t[e].resContentId,contentName:t[e].name,templateKey:"123",contentData:t[e].data,type:t[e].type};this.uploadData.items.push(a)}},manageFloorList:function(t){this.floorList=[];for(var e=0;e<t.length;e++){var a=JSON.parse(t[e].data);a.resContentId=t[e].resContentId,a.type=t[e].type,"imageList"===a.template_name&&5==a.size?(a.itemClass="hot-image-list-item-5",a.titleClass="item-title-5",a.imageClass="item-image-5"):(a.itemClass="",a.titleClass="",a.imageClass=""),this.floorList.push(a)}},showModal:function(t,e,a){var o=0,i="",s=!0,r=!1,l=!1,n=e.data.list;n||(n=e.data);for(var c in n){var d=n[c];this.modalData.push(d)}switch(t){case"singleImage":o=3,i="一张图",s=!0,r=!1,l=!0;break;case"twoPicture":o=4,i="两张图",s=!0,r=!1,l=!0;break;case"threePicture":o=5,i="三张图(左一右二)",s=!0,r=!1;break;case"imageList":o=6,i="热门系列",s=!1,r=!1;break;case"guessLike":o=7,i="商品池",s=!1,r=!0;break;case"tabFloor":o=8,i="首页频道Tab",s=!1,r=!0;break;case"focus":o=9,i="焦点图",s=!1,r=!1}o&&(this.modalInfo.modalType=o,this.modalInfo.modalTitle=i,this.modalInfo.resContentId=e.resContentId,this.modalInfo.template_intro=e.template_intro,this.modalInfo.template_name=e.template_name,this.modalInfo.size=e.size||"0",this.modalInfo.floorIndex=a,this.modalInfo.hideAddButton=s,this.modalInfo.isSelectAction=r,this.modalInfo.isCustomImgSize=l,this.show=!0)},showDeleteModal:function(t){var e=this;this.$Modal.confirm({title:"删除确认!",content:'<p style="color: red">是否确认删除该楼层?</p>',width:300,onOk:function(){e.uploadData.items.splice(t,1),e.resourceService.addOrUpdateResourceDetail(e.uploadData).then(function(t){t&&200===t.code?(e.$Message.success(t.message||"修改成功!"),e.getResourceDetailList()):e.$Message.error(t.message||"修改失败!"),e.modalData=[],e.modalInfo={modalType:0,modalTitle:"",resContentId:0,floorIndex:-1,template_intro:"",template_name:"",size:"0"}})}})},onOk:function(){var t=this,e=this.$refs.addEditor.getValue(),a=this.$refs.addEditor.getType(),o=0;for(var i in e)if(o++,""===e[i].url.url)return this.modalData=[],void this.$Message.error("请填写所有信息后再提交!");var s=e;"tabFloor"===this.modalInfo.template_name&&(s={list:e});var l=this.modalInfo.template_name,c=this.modalInfo.template_intro,d={id:this.modalInfo.resContentId,contentName:"楼层"+(this.floorList.length+1),templateKey:"123",contentData:n()({template_name:l,template_intro:c,data:s,size:a}),type:this.modalInfo.modalType};-1===this.modalInfo.floorIndex?this.uploadData.items.push(d):(d=r()(d,{contentName:this.uploadData.items[this.modalInfo.floorIndex].contentName}),this.uploadData.items[this.modalInfo.floorIndex]=d),this.resourceService.addOrUpdateResourceDetail(this.uploadData).then(function(e){e&&200===e.code?(t.$Message.success(e.message||"修改成功!"),t.getResourceDetailList(),t.modalData=[],t.modalInfo={modalType:0,modalTitle:"",resContentId:0,floorIndex:-1,template_intro:"",template_name:"",size:"0"},t.show=!1):t.$Message.error(e.message||"修改失败!")}),this.$refs.addEditor.reSetType()},onCancel:function(){this.modalData=[],this.modalInfo={modalType:0,modalTitle:"",resContentId:0,floorIndex:-1,template_intro:"",template_name:"",size:"0"},this.show=!1},onResourceSelect:function(t){this.selectResource=t},onCopyResourceSelect:function(){var t=this;this.resourceService.createResourceTime(i()({},this.selectResource)).then(function(t){}).finally(function(){t.getResourceListByCode()})},onRemoveResourceTime:function(){var t=this;this.resourceService.deleteResourceTime(this.selectResource).then(function(t){}).finally(function(){t.getResourceListByCode()})},onUpdateResourceTime:function(){var t=this;this.resourceService.updateResourceTimeStr(i()({},this.selectResource,{publishTimeStr:g()(this.selectResource.publishTimeStr).format("YYYY-MM-DD HH:mm:ss")})).then(function(t){}).finally(function(){t.resourceService.listByCode(t.code).then(function(e){t.resourceCodeList=e.data})})}}}},371:function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=a(372),i=a(12);Object(i.a)(o.a)},372:function(t,e,a){"use strict";function o(t){r||a(373)}var i=a(145),s=a(374),r=!1,l=a(0),n=o,c=l(i.a,s.a,!1,n,"data-v-63d5f295",null);c.options.__file="src/views/resource-edit-new/index.vue",e.a=c.exports},373:function(t,e){},374:function(t,e,a){"use strict";var o=function(){var t=this,e=t.$createElement,o=t._self._c||e;return o("LayoutContent",{attrs:{breads:[{url:"resource-list.html",title:"资源位列表"},{title:"资源位编辑"}]}},[o("div",{staticClass:"resource-wrapper"},[o("div",{staticClass:"select-resource"},t._l(t.resourceCodeList,function(e){return o("div",{staticClass:"resource-item",class:{active:t.selectResource.id===e.id},on:{click:function(a){return t.onResourceSelect(e)}}},[e.publishTimeStr?o("DatePicker",{staticStyle:{width:"180px"},attrs:{clearable:!1,type:"datetime",readonly:t.selectResource.id!==e.id},model:{value:e.publishTimeStr,callback:function(a){t.$set(e,"publishTimeStr",a)},expression:"i.publishTimeStr"}}):t._e(),t._v(" "),o("div",[t._v(t._s(e.publishStatusStr))])],1)}),0),t._v(" "),o("div",[o("Button",{attrs:{type:"primary"},on:{click:t.onCopyResourceSelect}},[t._v("复制")]),t._v(" "),o("Button",{attrs:{type:"error"},on:{click:t.onRemoveResourceTime}},[t._v("删除")]),t._v(" "),o("Button",{attrs:{type:"warning"},on:{click:t.onUpdateResourceTime}},[t._v("保存时间")])],1)]),t._v(" "),o("div",{staticClass:"main"},[o("div",{staticClass:"editor-container"},[o("Card",[o("p",{attrs:{slot:"title"},slot:"title"},[t._v(t._s(t.title))]),t._v(" "),o("draggable",{on:{start:function(e){t.drag=!0},end:function(e){t.drag=!1}},model:{value:t.floorList,callback:function(e){t.floorList=e},expression:"floorList"}},[t._l(t.floorList,function(e,i){return[o("div",{staticClass:"floor-item"},["focus"===e.template_name?o("div",{staticClass:"floor-image"},[o("img",{staticStyle:{width:"100%"},attrs:{src:e.data[0].src.split("?")[0]||a(18)}}),t._v(" "),o("div",{staticClass:"floor-mask"},[o("div",{staticClass:"floor-edit-buttons"},[o("a",{attrs:{href:"javascript:void(0)"},on:{click:function(a){return t.showModal("focus",e,i)}}},[t._v("编 辑")]),t._v(" "),o("a",{staticStyle:{"background-color":"red"},attrs:{href:"javascript:void(0)"},on:{click:function(e){return t.showDeleteModal(i)}}},[t._v("删 除")])])])]):t._e(),t._v(" "),"singleImage"===e.template_name?o("div",{staticClass:"floor-image"},[o("img",{staticStyle:{width:"100%"},attrs:{src:e.data[0].src.split("?")[0]||a(18)}}),t._v(" "),o("div",{staticClass:"floor-mask"},[o("div",{staticClass:"floor-edit-buttons"},[o("a",{attrs:{href:"javascript:void(0)"},on:{click:function(a){return t.showModal("singleImage",e,i)}}},[t._v("编 辑")]),t._v(" "),o("a",{staticStyle:{"background-color":"red"},attrs:{href:"javascript:void(0)"},on:{click:function(e){return t.showDeleteModal(i)}}},[t._v("删 除")])])])]):t._e(),t._v(" "),"twoPicture"===e.template_name?o("div",{staticClass:"floor-image"},[o("img",{staticStyle:{width:"50%",height:"120px"},attrs:{src:e.data[0].src.split("?")[0]||a(18)}}),t._v(" "),o("img",{staticStyle:{width:"50%",height:"120px"},attrs:{src:e.data[1].src.split("?")[0]||a(18)}}),t._v(" "),o("div",{staticClass:"floor-mask"},[o("div",{staticClass:"floor-edit-buttons"},[o("a",{attrs:{href:"javascript:void(0)"},on:{click:function(a){return t.showModal("twoPicture",e,i)}}},[t._v("编 辑")]),t._v(" "),o("a",{staticStyle:{"background-color":"red"},attrs:{href:"javascript:void(0)"},on:{click:function(e){return t.showDeleteModal(i)}}},[t._v("删 除")])])])]):t._e(),t._v(" "),"threePicture"===e.template_name?o("div",{staticClass:"floor-image-three-root"},[o("div",{staticClass:"floor-image-three"},[o("img",{staticClass:"floor-image-three-left",attrs:{src:e.data[0].src.split("?")[0]||a(18)}}),t._v(" "),o("div",{staticClass:"floor-image-three-right-root"},[o("img",{staticClass:"floor-image-three-right-item",attrs:{src:e.data[1].src.split("?")[0]||a(18)}}),t._v(" "),o("img",{staticClass:"floor-image-three-right-item",attrs:{src:e.data[2].src.split("?")[0]||a(18)}})])]),t._v(" "),o("div",{staticClass:"floor-mask"},[o("div",{staticClass:"floor-edit-buttons"},[o("a",{attrs:{href:"javascript:void(0)"},on:{click:function(a){return t.showModal("threePicture",e,i)}}},[t._v("编 辑")]),t._v(" "),o("a",{staticStyle:{"background-color":"red"},attrs:{href:"javascript:void(0)"},on:{click:function(e){return t.showDeleteModal(i)}}},[t._v("删 除")])])])]):t._e(),t._v(" "),"imageList"===e.template_name?o("div",{staticClass:"floor-image-hot"},[o("div",{staticClass:"hot-image-list"},[o("div",{staticClass:"hot-image-list-title"},[t._v(t._s(t.name)+"热门系列")]),t._v(" "),o("div",{staticClass:"hot-image-list-body"},t._l(e.data,function(a,i){return o("div",{key:i,staticClass:"hot-image-list-item",class:e.itemClass},[o("img",{staticClass:"item-image",class:e.imageClass,attrs:{src:a.src?a.src.split("?")[0]:"",alt:"",srcset:""}}),t._v(" "),o("p",{staticClass:"item-title",class:e.titleClass},[t._v(t._s(a.title))])])}),0)]),t._v(" "),o("div",{staticClass:"floor-mask"},[o("div",{staticClass:"floor-edit-buttons"},[o("a",{attrs:{href:"javascript:void(0)"},on:{click:function(a){return t.showModal("imageList",e,i)}}},[t._v("编 辑")]),t._v(" "),o("a",{staticStyle:{"background-color":"red"},attrs:{href:"javascript:void(0)"},on:{click:function(e){return t.showDeleteModal(i)}}},[t._v("删 除")])])])]):t._e(),t._v(" "),"guessLike"===e.template_name?o("div",{staticClass:"floor-image-sort-tab"},[o("div",{staticClass:"sort-tab-body"},t._l(e.data,function(e,a){return o("p",{key:a,staticClass:"sort-tab"},[t._v(t._s(e.title))])}),0),t._v(" "),o("div",{staticClass:"floor-mask"},[o("div",{staticClass:"floor-edit-buttons"},[o("a",{attrs:{href:"javascript:void(0)"},on:{click:function(a){return t.showModal("guessLike",e,i)}}},[t._v("编 辑")]),t._v(" "),o("a",{staticStyle:{"background-color":"red"},attrs:{href:"javascript:void(0)"},on:{click:function(e){return t.showDeleteModal(i)}}},[t._v("删 除")])])])]):t._e(),t._v(" "),"tabFloor"===e.template_name?o("div",{staticClass:"floor-image-sort-tab"},[o("div",{staticClass:"sort-tab-body"},t._l(e.data.list,function(e,a){return o("p",{key:a,staticClass:"sort-tab"},[t._v(t._s(e.tabName))])}),0),t._v(" "),o("div",{staticClass:"floor-mask"},[o("div",{staticClass:"floor-edit-buttons"},[o("a",{attrs:{href:"javascript:void(0)"},on:{click:function(a){return t.showModal("tabFloor",e,i)}}},[t._v("编 辑")]),t._v(" "),o("a",{staticStyle:{"background-color":"red"},attrs:{href:"javascript:void(0)"},on:{click:function(e){return t.showDeleteModal(i)}}},[t._v("删 除")])])])]):t._e()]),t._v(" "),o("divide")]})],2)],1)],1),t._v(" "),o("div",{staticClass:"button-container"},[o("Button",{attrs:{type:"primary"},on:{click:function(e){return t.showModal("singleImage",t.singleData,-1)}}},[t._v("一张图")]),t._v(" "),o("Button",{attrs:{type:"primary"},on:{click:function(e){return t.showModal("twoPicture",t.twoData,-1)}}},[t._v("两张图")]),t._v(" "),o("Button",{attrs:{type:"primary"},on:{click:function(e){return t.showModal("threePicture",t.threeData,-1)}}},[t._v("三张图(左一右二)")]),t._v(" "),o("Button",{attrs:{type:"primary"},on:{click:function(e){return t.showModal("imageList",t.imageListData,-1)}}},[t._v("热门系列")]),t._v(" "),o("Button",{attrs:{type:"primary"},on:{click:function(e){return t.showModal("guessLike",t.guessLikeData,-1)}}},[t._v("商品池")]),t._v(" "),o("Button",{attrs:{type:"primary"},on:{click:function(e){return t.showModal("tabFloor",t.tabFloorData,-1)}}},[t._v("首页频道Tab")]),t._v(" "),o("Button",{attrs:{type:"primary"},on:{click:function(e){return t.showModal("focus",t.foucsData,-1)}}},[t._v("焦点图")])],1),t._v(" "),o("Modal",{attrs:{title:t.modalInfo.modalTitle,width:"650"},on:{"on-ok":t.onOk,"on-cancel":t.onCancel},model:{value:t.show,callback:function(e){t.show=e},expression:"show"}},[o("banner-editor",{ref:"addEditor",attrs:{hideAddButton:t.modalInfo.hideAddButton,hideDeleteButton:!0,type:t.platform,isCustomImgSize:t.modalInfo.isCustomImgSize,isSelectAction:t.modalInfo.isSelectAction,templateName:t.modalInfo.template_name,size:t.modalInfo.size},model:{value:t.modalData,callback:function(e){t.modalData=e},expression:"modalData"}})],1)],1)])},i=[];o._withStripped=!0;var s={render:o,staticRenderFns:i};e.a=s},8:function(t,e){t.exports=Vue}},[371]);