resource-edit-new.7ad07d8327e48652a0be.js
13.1 KB
webpackJsonp([7],{10:function(t,e){t.exports=Vue},133:function(t,e,a){"use strict";var o=a(13),i=a.n(o),s=a(28),r=a.n(s),l=a(2),n=a(11),c=a(45),d=a(102),m=a(131),u=a(62),h=a.n(u);e.a={name:"resourceEditNew",components:{Divide:m.a,bannerEditor:c.a,SmartFloor:d.a,draggable:h.a},data:function(){return{title:"",list:[],floorList:[],modalInfo:{modalType:0,modalTitle:"",resContentId:0,floorIndex:-1,template_intro:"",template_name:"",hideAddButton:!0,isSelectAction:!1},singleData:{data:{0:{alt:"",bgColor:"",imgId:"0",src:"",title:"",hideDeleteButton:!0,url:{action:"go.h5",url:""}}},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:""}},1:{alt:"",bgColor:"",imgId:"0",src:"",title:"",hideDeleteButton:!0,url:{action:"go.h5",url:""}}},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:l.a.getQueryString("id"),items:[]}}},mounted:function(){this.resId=l.a.getQueryString("id"),this.platform=l.a.getQueryString("platform"),this.title=l.a.getQueryString("name"),this.resourceService=new n.a,this.getResourceDetailList()},methods:{getResourceDetailList:function(){var t=this;this.resourceService.info(this.resId).then(function(e){t.list=e,t.manageAllData(e),t.manageFloorList(e)})},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=e.data.list;l||(l=e.data);for(var n in l){var c=l[n];this.modalData.push(c)}switch(t){case"singleImage":o=3,i="一张图",s=!0,r=!1;break;case"twoPicture":o=4,i="两张图",s=!0,r=!1;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.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&&2e3===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 s in e)if(o++,""===e[s].url.url)return this.modalData=[],void this.$Message.error("请填写所有信息后再提交!");var l=e;"tabFloor"===this.modalInfo.template_name&&(l={list:e});var n=this.modalInfo.template_name,c=this.modalInfo.template_intro,d={id:this.modalInfo.resContentId,contentName:"楼层"+(this.floorList.length+1),templateKey:"123",contentData:r()({template_name:n,template_intro:c,data:l,size:a}),type:this.modalInfo.modalType};-1===this.modalInfo.floorIndex?this.uploadData.items.push(d):(d=i()(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}}}},341:function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=a(342),i=a(18);Object(i.a)(o.a)},342:function(t,e,a){"use strict";function o(t){r||a(343)}var i=a(133),s=a(344),r=!1,l=a(0),n=o,c=l(i.a,s.a,!1,n,null,null);c.options.__file="src/views/resource-edit-new/index.vue",e.a=c.exports},343:function(t,e){},344: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:"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(12)}}),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(12)}}),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(12)}}),t._v(" "),o("img",{staticStyle:{width:"50%",height:"120px"},attrs:{src:e.data[1].src.split("?")[0]||a(12)}}),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(12)}}),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(12)}}),t._v(" "),o("img",{staticClass:"floor-image-three-right-item",attrs:{src:e.data[2].src.split("?")[0]||a(12)}})])]),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,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},5:function(t,e){t.exports=iview}},[341]);