chunk-6f065644.110a679c.js 7.9 KB

12
  1. (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-6f065644"],{"15ea":function(e,t,a){},"451a":function(e,t,a){"use strict";var r=a("15ea"),i=a.n(r);i.a},"93f2":function(e,t,a){"use strict";a.r(t);var r=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("el-card",{scopedSlots:e._u([{key:"header",fn:function(){return[a("content-header")]},proxy:!0}])},[a("el-row",{attrs:{type:"flex"}},[a("lz-form",{ref:"form",attrs:{"get-data":e.getData,submit:e.onSubmit,form:e.form,errors:e.errors,"edit-mode":e.editMode},on:{"update:form":function(t){e.form=t},"update:errors":function(t){e.errors=t}}},[a("el-form-item",{attrs:{label:"广告位",required:"",prop:"advertisement_position_slug"}},[a("el-select",{attrs:{clearable:"",disabled:e.footerDisabled,placeholder:"选择广告位"},on:{change:e.advertisementPositionChange},model:{value:e.form.advertisement_position_slug,callback:function(t){e.$set(e.form,"advertisement_position_slug",t)},expression:"form.advertisement_position_slug"}},e._l(e.advertisement_positions,function(e){return a("el-option",{key:e.id,attrs:{label:e.name,value:e.slug}})}),1)],1),a("el-form-item",{attrs:{label:"广告类型",required:"",prop:"type"}},[a("el-select",{attrs:{clearable:"",disabled:e.adChangeDisabled,placeholder:"选择广告类型"},on:{change:e.adChange},model:{value:e.form.type,callback:function(t){e.$set(e.form,"type",t)},expression:"form.type"}},e._l(e.types,function(e,t){return a("el-option",{key:t,attrs:{label:e.name,value:e.slug}})}),1)],1),a("el-form-item",{attrs:{label:"广告名称",required:"",prop:"name"}},[a("el-input",{model:{value:e.form.name,callback:function(t){e.$set(e.form,"name",t)},expression:"form.name"}})],1),a("el-form-item",{attrs:{label:"广告层级",required:"",prop:"name"}},[a("el-input",{attrs:{placeholder:"请输入数字,数字越大越靠前",onkeyup:"this.value=this.value.replace(/[^\\d]/g,'');"},model:{value:e.form.sort,callback:function(t){e.$set(e.form,"sort",t)},expression:"form.sort"}})],1),a("el-form-item",{attrs:{label:"缩略内容",required:"",prop:"surface"}},[a("el-upload",{staticClass:"avatar-uploader",attrs:{action:"/admin-api/advertisements/uploadImg",name:"surface",headers:e.uploadHeaders,"show-file-list":!1,"on-success":e.handleAvatarSuccess,"before-upload":e.beforeAvatarUpload}},[e.form.surface?a("img",{staticClass:"avatara",attrs:{src:e.form.surface}}):a("i",{staticClass:"el-icon-plus avatar-uploader-icon"})])],1),a("el-form-item",{attrs:{label:"投放区域",required:"",prop:"area_id"}},[a("el-select",{attrs:{clearable:"",placeholder:"选择区域"},model:{value:e.form.area_id,callback:function(t){e.$set(e.form,"area_id",t)},expression:"form.area_id"}},e._l(e.areas,function(e){return a("el-option",{key:e.id,attrs:{label:e.name,value:e.id}})}),1)],1),a("el-form-item",{directives:[{name:"show",rawName:"v-show",value:e.adShowDetail,expression:"adShowDetail"}],attrs:{label:"广告详情",required:"",prop:"detail"}},[1==e.showDetail?a("el-input",{attrs:{placeholder:"请输入链接,必须带https或小程序内路径,或者手机号,或腾讯广告id"},model:{value:e.form.detail,callback:function(t){e.$set(e.form,"detail",t)},expression:"form.detail"}}):2==e.showDetail?a("Editor",{attrs:{value:e.form.detail},on:{input:e.handelIncrease}}):3==e.showDetail?a("span"):e._e()],1),a("el-form-item",{attrs:{label:"投放状态",required:"",prop:"is_display"}},[a("el-radio",{attrs:{label:"0"},model:{value:e.form.is_display,callback:function(t){e.$set(e.form,"is_display",t)},expression:"form.is_display"}},[e._v("未投放")]),a("el-radio",{attrs:{label:"1"},model:{value:e.form.is_display,callback:function(t){e.$set(e.form,"is_display",t)},expression:"form.is_display"}},[e._v("已投放")])],1),a("el-form-item",{attrs:{label:"投放开始时间",required:"",prop:"start_time"}},[a("el-date-picker",{attrs:{type:"datetime",placeholder:"选择日期时间"},model:{value:e.form.start_time,callback:function(t){e.$set(e.form,"start_time",t)},expression:"form.start_time"}})],1),a("el-form-item",{attrs:{label:"投放结束时间",required:"",prop:"end_time"}},[a("el-date-picker",{attrs:{type:"datetime",placeholder:"选择日期时间"},model:{value:e.form.end_time,callback:function(t){e.$set(e.form,"end_time",t)},expression:"form.end_time"}})],1)],1)],1)],1)},i=[],s=(a("7f7f"),a("ac6a"),a("5df3"),a("768b")),o=(a("96cf"),a("3b8d")),n=a("f6eb"),l=a("b64d"),d=a("ada3"),u=a("fe06"),c=a("94b0"),m=a("9d8d"),f={name:"Form",components:{LzForm:d["a"],Editor:m["a"]},mixins:[u["a"]],data:function(){return{form:{advertisement_position_slug:"",type:"clilk_null",name:"",surface:"",area_id:"",detail:"",is_display:"1",start_time:"",end_time:"",sort:""},errors:{},areas:[],advertisement_positions:[],types:[],uploadHeaders:{Authorization:""},showDetail:"",adChangeDisabled:!1,adShowDetail:!1,footerDisabled:!1}},created:function(){this.uploadHeaders.Authorization=Object(c["a"])()},methods:{getData:function(){var e=Object(o["a"])(regeneratorRuntime.mark(function e(){var t,a,r,i,o,d,u,c,m=this;return regeneratorRuntime.wrap(function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([Object(l["b"])({all:1})]);case 2:return t=e.sent,a=Object(s["a"])(t,1),r=a[0].data,e.next=7,Promise.all([Object(n["c"])()]);case 7:if(i=e.sent,o=Object(s["a"])(i,1),d=o[0].data,this.areas=[{id:0,name:"全部"}],r.map(function(e){m.areas.push({id:e.id,name:e.name})}),this.types=d.advertisementType,this.advertisement_positions=d.advertisementPosition,console.log(this.editMode),!this.editMode){e.next=25;break}return e.next=18,Object(n["a"])(this.resourceId);case 18:u=e.sent,c=u.data,c.is_display=c.is_display?"1":"0","url"==c.type||"wxUrl"==c.type||"phone"==c.type||"wxTencentAdvertisement"==c.type?(this.showDetail=1,this.adShowDetail=!0):"text"==c.type?(this.showDetail=2,this.adShowDetail=!0):(this.showDetail=3,this.adShowDetail=!1),console.log(this.footerDisabled),this.footerDisabled=!0,this.fillForm(c);case 25:case"end":return e.stop()}},e,this)}));function t(){return e.apply(this,arguments)}return t}(),onSubmit:function(){var e=Object(o["a"])(regeneratorRuntime.mark(function e(){return regeneratorRuntime.wrap(function(e){while(1)switch(e.prev=e.next){case 0:if(!this.editMode){e.next=5;break}return e.next=3,Object(n["e"])(this.resourceId,this.form);case 3:e.next=7;break;case 5:return e.next=7,Object(n["d"])(this.form);case 7:case"end":return e.stop()}},e,this)}));function t(){return e.apply(this,arguments)}return t}(),adChange:function(){"url"==this.form.type||"wxUrl"==this.form.type||"phone"==this.form.type||"wxTencentAdvertisement"==this.form.type?(this.showDetail=1,this.adShowDetail=!0):"text"==this.form.type?(this.showDetail=2,this.adShowDetail=!0):(this.showDetail=3,this.adShowDetail=!1)},advertisementPositionChange:function(){"footer"==this.form.advertisement_position_slug?(this.form.type="clilk_null",this.adChangeDisabled=!0):this.adChangeDisabled=!1},handleAvatarSuccess:function(e,t){this.form.surface=e.path},beforeAvatarUpload:function(e){var t="image/jpeg"===e.type,a="image/png"===e.type,r=e.size/1024/1024<2;return t||a||this.$message.error("上传头像图片只能是 JPG/PNG 格式!"),r||this.$message.error("上传头像图片大小不能超过 2MB!"),(t||a)&&r},handelIncrease:function(e){this.form.detail=e}}},p=f,h=(a("451a"),a("2877")),b=Object(h["a"])(p,r,i,!1,null,"07aae93a",null);t["default"]=b.exports},f6eb:function(e,t,a){"use strict";a.d(t,"b",function(){return i}),a.d(t,"c",function(){return s}),a.d(t,"a",function(){return o}),a.d(t,"d",function(){return n}),a.d(t,"e",function(){return l});var r=a("bf9a");function i(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return r["b"].get("advertisements",{params:e})}function s(){return r["b"].get("advertisements/advertisementSelectData")}function o(e){return r["b"].get("advertisements/".concat(e,"/edit"))}function n(e){return r["b"].post("advertisements",e)}function l(e,t){return r["b"].put("advertisements/".concat(e),t)}}}]);
  2. //# sourceMappingURL=chunk-6f065644.110a679c.js.map