resource-edit-new.91f57fc4c7c845cd964a.js
10.5 KB
webpackJsonp([7],{10:function(t,e){t.exports=Vue},132:function(t,e,a){"use strict";var o=a(12),i=a.n(o),s=a(28),r=a.n(s),l=a(4),n=a(11),d=a(45),c=a(101),m=a(130);e.a={name:"resourceEditNew",components:{Divide:m.a,bannerEditor:d.a,SmartFloor:c.a},data:function(){return{title:"",list:[],floorList:[],modalInfo:{modalType:0,modalTitle:"",resContentId:0,floorIndex:-1,template_intro:"",template_name:"",hideAddButton:!0},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.h5",url:""}}}},type:7,template_intro:"商品池Tab",template_name:"guessLike",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;console.log("this.resId:"+this.resId),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,this.floorList.push(a)}},showModal:function(t,e,a){var o=0,i="",s=!0;for(var r in e.data){var l=e.data[r];this.modalData.push(l)}switch(t){case"singleImage":o=3,i="一张图",s=!0;break;case"twoPicture":o=4,i="两张图",s=!0;break;case"threePicture":o=5,i="三张图(左一右二)",s=!0;break;case"imageList":o=6,i="热门系列",s=!1;break;case"guessLike":o=7,i="商品池",s=!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.floorIndex=a,this.modalInfo.hideAddButton=s,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.modalData=[],e.modalInfo={modalType:0,modalTitle:"",resContentId:0,floorIndex:-1,template_intro:"",template_name:""}):e.$Message.error(t.message||"修改失败!")})}})},onOk:function(){var t=this,e=this.$refs.addEditor.getValue();console.log("modalValue"),console.log(e);for(var a in e)if(""===e[a].url.url)return this.modalData=[],void this.$Message.error("请填写所有信息后再提交!");if("imageList"===this.modalInfo.template_name||"guessLike"===this.modalInfo.template_name);var o={id:this.modalInfo.resContentId,contentName:"楼层"+(this.floorList.length+1),templateKey:"123",contentData:r()({template_name:this.modalInfo.template_name,template_intro:this.modalInfo.template_intro,data:e}),type:this.modalInfo.modalType};-1===this.modalInfo.floorIndex?this.uploadData.items.push(o):(o=i()(o,{contentName:this.uploadData.items[this.modalInfo.floorIndex].contentName}),this.uploadData.items[this.modalInfo.floorIndex]=o),console.log("uploadData:",this.uploadData),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:""},t.show=!1):t.$Message.error(e.message||"修改失败!")})},onCancel:function(){this.modalData=[],this.modalInfo={modalType:0,modalTitle:"",resContentId:0,floorIndex:-1,template_intro:"",template_name:""},this.show=!1}}}},336:function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=a(337),i=a(15);Object(i.a)(o.a)},337:function(t,e,a){"use strict";function o(t){r||a(338)}var i=a(132),s=a(339),r=!1,l=a(0),n=o,d=l(i.a,s.a,!1,n,null,null);d.options.__file="src/views/resource-edit-new/index.vue",e.a=d.exports},338:function(t,e){},339: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(" "),t._l(t.floorList,function(e,i){return[o("div",{staticClass:"floor-item"},["singleImage"===e.template_name?o("div",{staticClass:"floor-image"},[o("img",{staticStyle:{width:"100%"},attrs:{src:e.data[0].src.split("?")[0]||a(16)}}),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(16)}}),t._v(" "),o("img",{staticStyle:{width:"50%",height:"120px"},attrs:{src:e.data[1].src.split("?")[0]||a(16)}}),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(16)}}),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(16)}}),t._v(" "),o("img",{staticClass:"floor-image-three-right-item",attrs:{src:e.data[2].src.split("?")[0]||a(16)}})])]),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(e,a){return o("div",{key:a,staticClass:"hot-image-list-item"},[o("img",{staticClass:"item-image",attrs:{src:e.src.split("?")[0],alt:"",srcset:""}}),t._v(" "),o("p",{staticClass:"item-title"},[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("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(" "),o("divide")]})],2)],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("商品池")])],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},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}},[336]);