You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 lines
8.7 KiB
1 lines
8.7 KiB
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-5b8631e6"],{6953:function(t,e,a){"use strict";a("beff")},a9ec:function(t,e,a){"use strict";a.r(e);var i=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"main-box",attrs:{id:"advert"}},[a("TableSearch",{attrs:{model:t.params},scopedSlots:t._u([{key:"btn",fn:function(){return[a("el-button",{attrs:{type:"primary",icon:"el-icon-plus"},on:{click:t.goAdd}},[t._v(" "+t._s(t.$t("添加"))+" ")])]},proxy:!0}])},[[a("el-form-item",{attrs:{label:t.$t("广告名称")+":",prop:"title"}},[a("el-input",{model:{value:t.params.title,callback:function(e){t.$set(t.params,"title",e)},expression:"params.title"}})],1),a("el-form-item",[a("el-button",{attrs:{type:"primary"},on:{click:function(e){return t.search()}}},[t._v(" "+t._s(t.$t("搜索"))+" ")]),a("el-button",{on:{click:function(e){return t.reset()}}},[t._v(t._s(t.$t("重置")))])],1)]],2),a("BaseTable",{ref:"baseTable",attrs:{request:t.request,params:t.params,"is-request":!1},on:{"update:params":function(e){t.params=e}}},[a("el-table-column",{attrs:{label:"ID",prop:"id",width:"80"}}),a("el-table-column",{attrs:{label:t.$t("广告名称"),prop:"title","show-overflow-tooltip":""}}),a("el-table-column",{attrs:{label:t.$t("广告链接"),prop:"url","show-overflow-tooltip":""}}),a("el-table-column",{attrs:{label:t.$t("广告形式"),prop:"type",width:"120px"},scopedSlots:t._u([{key:"default",fn:function(e){return[1==e.row.type?a("span",[t._v(t._s(t.$t("文字")))]):t._e(),2==e.row.type?a("span",[t._v(t._s(t.$t("图片")))]):t._e(),3==e.row.type?a("span",[t._v(t._s(t.$t("视频")))]):t._e()]}}])}),a("el-table-column",{attrs:{label:t.$t("尺寸"),prop:"size",width:"180px"}}),a("el-table-column",{attrs:{label:t.$t("有效期"),prop:"expiration_date",width:"180px"}}),a("el-table-column",{attrs:{label:t.$t("操作"),width:"100px",fixed:"right",align:"right"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("EditBtn",{on:{click:function(a){return t.editor(e.row)}}}),a("DelBtn",{attrs:{"confirm-content":t.$t("删除该广告")},on:{success:function(a){return t.del(e.row)}}})]}}])})],1),a("BaseDialog",{attrs:{title:t.addForm.id?t.$t("编辑"):t.$t("添加"),"dialog-show":t.dialogShow,width:"50%",footer:""},on:{"update:dialogShow":function(e){t.dialogShow=e},"update:dialog-show":function(e){t.dialogShow=e},submit:t.submit}},[a("el-form",{ref:"addForm",attrs:{model:t.addForm,rules:t.rules,"label-position":"top"}},[a("el-form-item",{attrs:{label:t.$t("广告形式"),prop:"type"}},[a("el-radio-group",{on:{change:t.chooseType},model:{value:t.addForm.type,callback:function(e){t.$set(t.addForm,"type",e)},expression:"addForm.type"}},[a("el-radio",{attrs:{label:1}},[t._v(t._s(t.$t("文字")))]),a("el-radio",{attrs:{label:2}},[t._v(t._s(t.$t("图片")))]),a("el-radio",{attrs:{label:3}},[t._v(t._s(t.$t("视频")))])],1)],1),a("el-form-item",{attrs:{label:t.$t("广告名称"),prop:"title"}},[a("el-input",{model:{value:t.addForm.title,callback:function(e){t.$set(t.addForm,"title",e)},expression:"addForm.title"}})],1),a("el-form-item",{attrs:{label:t.$t("广告链接"),prop:"url"}},[a("el-input",{attrs:{placeholder:t.$t("广告链接提示")},model:{value:t.addForm.url,callback:function(e){t.$set(t.addForm,"url",e)},expression:"addForm.url"}})],1),1==t.addForm.type?a("el-form-item",{attrs:{label:t.$t("广告内容"),prop:"content"}},[a("el-input",{attrs:{type:"textarea"},model:{value:t.addForm.content,callback:function(e){t.$set(t.addForm,"content",e)},expression:"addForm.content"}})],1):t._e(),a("el-form-item",{attrs:{label:t.$t("有效期"),prop:"expiration_date"}},[a("el-date-picker",{attrs:{type:"date",placeholder:t.$t("请选择日期"),"value-format":"yyyy-MM-dd",format:"yyyy-MM-dd"},model:{value:t.addForm.expiration_date,callback:function(e){t.$set(t.addForm,"expiration_date",e)},expression:"addForm.expiration_date"}})],1),a("Attachment",{ref:"attachment",attrs:{"dialog-show":t.dialogShow2,"attachment-type":t.attachmentType},on:{"update:dialogShow":function(e){t.dialogShow2=e},"update:dialog-show":function(e){t.dialogShow2=e},func:t.getData}}),2==t.addForm.type||3==t.addForm.type?a("div",[a("el-form-item",{attrs:{label:t.$t("广告尺寸"),prop:"size"}},[a("el-input",{attrs:{placeholder:"例如:300X200"},model:{value:t.addForm.size,callback:function(e){t.$set(t.addForm,"size",e)},expression:"addForm.size"}})],1),2==t.addForm.type?a("el-form-item",{attrs:{size:"small",label:t.$t("广告图片"),prop:"attachment_id"}},[a("div",{staticClass:"attachment_imgBox",on:{click:function(e){return t.openList("image")}}},[t.addForm.attachment_id?a("img",{staticClass:"attachmentImg",attrs:{src:t.imageUrl}}):a("i",{staticClass:"el-icon-camera"})])]):t._e(),3==t.addForm.type?a("el-form-item",{attrs:{label:t.$t("广告视频"),prop:"attachment_id"}},[a("div",{staticClass:"attachment_imgBox",on:{click:function(e){return t.openList("video")}}},[t.addForm.attachment_id?a("div",[a("i",{staticClass:"el-icon-video-camera-solid"}),a("p",{staticClass:"videoName"},[t._v(t._s(t.videoName))])]):a("i",{staticClass:"el-icon-video-camera"})])]):t._e()],1):t._e()],1)],1)],1)},o=[],r=a("5530"),d=(a("b0c0"),a("365c"));function s(t){var e="/advertisement/index";return d["a"].get(e,t)}function n(t){var e="/advertisement/read";return d["a"].get(e,t)}function l(t){var e="/advertisement/save";return d["a"].post(e,t)}function c(t){var e="/advertisement/update";return d["a"].post(e,t)}function u(t){var e="/advertisement/delete";return d["a"].post(e,t)}var m={advertList:s,advertSave:l,advertUpdate:c,advertDelete:u,advertInfo:n},p=a("37cb"),h={data:function(){return{request:m.advertList,params:{title:""},dialogShow2:!1,imageUrl:"",videoUrl:"",videoName:"",orderData:[],dialogShow:!1,options:[],addForm:{type:1},rules:{title:[{required:"true",message:this.$t("请输入广告的名称"),trigger:"blur"}],url:[{required:"true",message:this.$t("请输入广告链接"),trigger:"blur"}],content:[{required:"true",message:this.$t("请输入广告内容"),trigger:"blur"}],size:[{required:"true",message:this.$t("请输入广告尺寸"),trigger:"blur"}],attachment_id:[{required:"true",message:this.$t("请上传广告"),trigger:"blur"}],expiration_date:[{required:"true",message:this.$t("请输入广告有效期"),trigger:"blur"}]},id:"",loading:!0,attachmentType:"",uploadType:""}},created:function(){this.getWebsiteList()},mounted:function(){this.getList()},methods:{getData:function(t){t.length>1?this.$message.error(this.$t("最多只能选择一张图片")):("image"==this.uploadType?(this.addForm.attachment_id=t[0].id,this.imageUrl=t[0].url):"video"==this.uploadType&&(this.addForm.attachment_id=t[0].id,this.videoUrl=t[0].url,this.videoName=t[0].name),this.dialogShow2=!1)},openList:function(t){var e=this;this.attachmentType=this.addForm.type,this.dialogShow2=!0,this.$nextTick((function(){e.$refs.attachment.getAttachmentList()})),this.uploadType=t},getWebsiteList:function(){var t=this;p["a"].websiteList().then((function(e){t.options=e.data}))},chooseWedsite:function(t){this.$forceUpdate()},chooseType:function(t){this.addForm.id||(1==this.addForm.type?this.addForm={type:t,title:"",url:"",content:"",expiration_date:""}:2!=this.addForm.type&&3!=this.addForm.type||(this.addForm={type:t,title:"",url:"",expiration_date:"",size:"",attachment_id:""}))},goAdd:function(){this.addForm={id:"",type:1,title:"",url:"",content:"",expiration_date:""},this.dialogShow=!0},editor:function(t){var e=this;m.advertInfo({id:t.id}).then((function(t){0==t.code&&(1==t.data.type?e.addForm={id:t.data.id,type:t.data.type,title:t.data.title,url:t.data.url,content:t.data.content,expiration_date:t.data.expiration_date}:2!=t.data.type&&3!=t.data.type||(2==t.data.type&&(e.imageUrl=t.data.attachment.url),e.addForm={id:t.data.id,type:t.data.type,title:t.data.title,url:t.data.url,attachment_id:t.data.attachment_id,expiration_date:t.data.expiration_date,size:t.data.size})),e.dialogShow=!0}))},submit:function(){var t=this;this.$refs.addForm.validate((function(e){e?t.addForm.id?m.advertUpdate(Object(r["a"])({},t.addForm)).then((function(e){0==e.code&&(t.$message.success(e.msg),t.dialogShow=!1,t.getList())})):m.advertSave(Object(r["a"])({},t.addForm)).then((function(e){0==e.code&&(t.$message.success(e.msg),t.dialogShow=!1,t.getList("search"))})):t.$message.error(t.$t("请填写必要信息"))}))},del:function(t){var e=this;m.advertDelete({id:t.id}).then((function(t){0==t.code&&(e.$message.success(t.msg),e.getList())}))},search:function(){this.getList("search")},reset:function(){this.params.title="",this.getList("search")},getList:function(t){this.$refs.baseTable.getList(t)}}},f=h,g=(a("6953"),a("b709"),a("2877")),b=Object(g["a"])(f,i,o,!1,null,"984ae9cc",null);e["default"]=b.exports},b709:function(t,e,a){"use strict";a("b91a")},b91a:function(t,e,a){},beff:function(t,e,a){}}]);
|