(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-cd69b68a","chunk-2d0d6f6b"],{7590:function(e,t,r){"use strict";var i=r("d4ec"),a=r("bee2"),l=r("45eb"),s=r("7e84a"),o=r("262e"),n=r("2caf8"),u=r("953d"),c=u["Quill"].import("blots/block/embed"),d=u["Quill"].import("formats/link"),p=["height","width","src","poster"],m=function(e){Object(o["a"])(r,e);var t=Object(n["a"])(r);function r(){return Object(i["a"])(this,r),t.apply(this,arguments)}return Object(a["a"])(r,[{key:"format",value:function(e,t){p.indexOf(e)>-1?t?this.domNode.setAttribute(e,t):this.domNode.removeAttribute(e):Object(l["a"])(Object(s["a"])(r.prototype),"format",this).call(this,e,t)}},{key:"html",value:function(){var e=this.value(),t=e.video;return'').concat(t,"")}}],[{key:"create",value:function(e){var t=Object(l["a"])(Object(s["a"])(r),"create",this).call(this,e.url);return t.setAttribute("controls","controls"),t.setAttribute("type","video/mp4"),t.setAttribute("preload","auto"),t.setAttribute("autopaly","false"),t.setAttribute("src",this.sanitize(e.url)),t.setAttribute("poster",this.sanitize(e.poster)),t}},{key:"formats",value:function(e){return p.reduce((function(t,r){return e.hasAttribute(r)&&(t[r]=e.getAttribute(r)),t}),{})}},{key:"sanitize",value:function(e){return d.sanitize(e)}},{key:"value",value:function(e){return e.getAttribute("src")}}]),r}(c);m.blotName="video",m.className="ql-video",m.tagName="video",t["a"]=m},c8dd:function(e,t,r){"use strict";r("c92b")},c92b:function(e,t,r){},fb7d:function(e,t,r){"use strict";r.r(t);var i=function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("div",{staticClass:"m-container"},[r("h2",[r("el-page-header",{attrs:{content:"create"==e.pageType?"添加时间充值活动":"查看时间充值活动"},on:{back:e.onCancel}})],1),e._v(" "),r("div",{staticClass:"m-core"},[r("el-form",{ref:"form",staticStyle:{width:"100%"},attrs:{model:e.form,rules:e.rules,"label-width":"120px"}},[r("el-form-item",{attrs:{label:"活动名称",prop:"name"}},[r("el-input",{attrs:{placeholder:"请输入活动名称",disabled:"create"!=e.pageType},model:{value:e.form.name,callback:function(t){e.$set(e.form,"name","string"===typeof t?t.trim():t)},expression:"form.name"}})],1),e._v(" "),r("el-form-item",{attrs:{label:"适用范围",prop:"suitableUser"}},[r("el-select",{attrs:{disabled:"create"!=e.pageType,placeholder:"请选择适用范围"},model:{value:e.form.suitableUser,callback:function(t){e.$set(e.form,"suitableUser",t)},expression:"form.suitableUser"}},[r("el-option",{attrs:{label:"全部",value:"ALL"}}),e._v(" "),r("el-option",{attrs:{label:"新用户",value:"NEW"}})],1)],1),e._v(" "),r("el-form-item",{attrs:{label:"有效期",prop:"date"}},[r("el-date-picker",{attrs:{disabled:"create"!=e.pageType,type:"datetimerange","picker-options":{firstDayOfWeek:1},"default-time":["00:00:00","23:59:59"],align:"right","unlink-panels":"","value-format":"yyyy-MM-dd HH:mm:ss","range-separator":"至","start-placeholder":"开始日期","end-placeholder":"结束日期"},model:{value:e.form.date,callback:function(t){e.$set(e.form,"date",t)},expression:"form.date"}})],1),e._v(" "),r("el-form-item",{attrs:{label:"价格",prop:"totalPrice"}},[r("el-input",{attrs:{type:"number",placeholder:"请输入价格",disabled:"create"!=e.pageType},nativeOn:{mousewheel:function(e){e.preventDefault()}},model:{value:e.form.totalPrice,callback:function(t){e.$set(e.form,"totalPrice","string"===typeof t?t.trim():t)},expression:"form.totalPrice"}})],1),e._v(" "),r("el-form-item",{attrs:{label:"折扣价",prop:"discountPrice"}},[r("el-input",{attrs:{type:"number",placeholder:"请输入折价格",disabled:"create"!=e.pageType},nativeOn:{mousewheel:function(e){e.preventDefault()}},model:{value:e.form.discountPrice,callback:function(t){e.$set(e.form,"discountPrice","string"===typeof t?t.trim():t)},expression:"form.discountPrice"}})],1),e._v(" "),r("el-form-item",{attrs:{label:"购买分钟数",prop:"purchaseMinutes"}},[r("el-input",{attrs:{type:"number",placeholder:"请输入购买分钟",disabled:"create"!=e.pageType},nativeOn:{mousewheel:function(e){e.preventDefault()}},model:{value:e.form.purchaseMinutes,callback:function(t){e.$set(e.form,"purchaseMinutes","string"===typeof t?t.trim():t)},expression:"form.purchaseMinutes"}})],1),e._v(" "),r("el-form-item",{attrs:{label:"赠送分钟数",prop:"giveMinutes"}},[r("el-input",{attrs:{type:"number",placeholder:"请输入赠送分钟",disabled:"create"!=e.pageType},nativeOn:{mousewheel:function(e){e.preventDefault()}},model:{value:e.form.giveMinutes,callback:function(t){e.$set(e.form,"giveMinutes","string"===typeof t?t.trim():t)},expression:"form.giveMinutes"}})],1),e._v(" "),r("el-form-item",{attrs:{label:"活动图",prop:"coverImg"}},[r("el-upload",{staticClass:"avatar-uploader",attrs:{action:"/api-web/uploadFile",disabled:"create"!=e.pageType,headers:e.headers,"show-file-list":!1,accept:".jpg, .jpeg, .png, .gif","on-success":e.handleAvatarSuccess,"before-upload":e.beforeAvatarUpload}},[e.form.coverImg?r("img",{staticClass:"avatar",attrs:{src:e.form.coverImg}}):r("i",{staticClass:"el-icon-plus avatar-uploader-icon"})]),e._v(" "),e.imageSize?r("p",{staticClass:"imageSize"},[e._v("上传图片尺寸为:"+e._s(e.imageSize))]):e._e()],1),e._v(" "),r("el-form-item",{attrs:{label:"活动详情",prop:"detail"}},[r("quill-editor",{ref:"myQuillEditor",staticClass:"ql-editor",attrs:{disabled:"create"!=e.pageType,options:e.editorOption},on:{change:function(t){return e.onEditorChange(t)}},model:{value:e.form.detail,callback:function(t){e.$set(e.form,"detail",t)},expression:"form.detail"}}),e._v(" "),r("el-upload",{staticClass:"ivu-upload",attrs:{"show-upload-list":!1,headers:e.headers,"on-success":e.handleSuccess,accept:".jpg, .jpeg, .png, .gif","max-size":2048,multiple:"",action:"/api-web/uploadFile"}},[r("Button",{attrs:{icon:"ios-cloud-upload-outline"}})],1)],1),e._v(" "),"create"==e.pageType?r("el-form-item",[r("el-button",{attrs:{type:"primary"},on:{click:function(t){return e.onSubmit("form")}}},[e._v("立即"+e._s("create"==e.pageType?"创建":"修改"))]),e._v(" "),r("el-button",{on:{click:function(t){return e.onReSet("form")}}},[e._v("重置")])],1):e._e()],1)],1)])},a=[],l=(r("7f7f"),r("ac6a"),r("3607")),s=(r("4360"),r("5f87")),o=(r("61f7"),r("3908")),n=(r("a753"),r("8096"),r("14e1"),r("9339")),u=r.n(n),c=r("953d"),d=r("7590"),p=[["bold","italic","underline","strike"],["blockquote","code-block"],[{header:1},{header:2}],[{list:"ordered"},{list:"bullet"}],[{script:"sub"},{script:"super"}],[{indent:"-1"},{indent:"+1"}],[{size:["small",!1,"large","huge"]}],[{header:[1,2,3,4,5,6,!1]}],[{color:[]},{background:[]}],[{font:[]}],[{align:[]}],["clean"]],m={"ql-bold":"加粗","ql-color":"颜色","ql-font":"字体","ql-code":"插入代码","ql-italic":"斜体","ql-background":"背景颜色","ql-size":"字体大小","ql-strike":"删除线","ql-script":"上标/下标","ql-underline":"下划线","ql-blockquote":"引用","ql-header":"标题","ql-indent":"缩进","ql-list":"列表","ql-align":"文本对齐","ql-direction":"文本方向","ql-code-block":"代码块","ql-formula":"公式","ql-image":"图片","ql-video":"视频","ql-clean":"清除字体样式","ql-upload":"文件"},f=function(e,t,r){""==t&&"string"==typeof t||null==t?r(new Error("请输入金额")):t<0?r(new Error("输入金额必须大于或等于0")):t>=1e5?r(new Error("输入金额必须小于100000")):r()},g=function(e,t,r){""==t&&"string"==typeof t||null==t?r(new Error("请输入分钟数")):t<0?r(new Error("输入分钟数必须大于或等于0")):t>=1e5?r(new Error("输入分钟数必须小于100000")):r()};u.a.register(d["a"],!0);var b={name:"contentOperation",components:{quillEditor:c["quillEditor"]},data:function(){return{categoryList:[],pageType:this.$route.query.type,headers:{Authorization:Object(s["b"])()},content:null,editorIndex:0,editorOption:{placeholder:"请输入内容",modules:{toolbar:{container:p,handlers:{image:function(e){e?document.querySelector(".ivu-upload .el-upload").click():this.quill.format("image",!1)}}}}},form:{name:null,suitableUser:null,date:null,startDate:null,endDate:null,totalPrice:null,discountPrice:null,purchaseMinutes:null,giveMinutes:null,coverImg:null,detail:null},rules:{name:[{required:!0,message:"请输入活动名称",trigger:"blur"},{min:2,max:30,message:"长度在 2 到 30 个字符",trigger:"blur"}],suitableUser:[{required:!0,message:"请选择适用范围",trigger:"change"}],date:[{required:!0,message:"请选择有效期",trigger:"change"}],totalPrice:[{required:!0,validator:f,trigger:"blur"}],discountPrice:[{required:!0,validator:f,trigger:"blur"}],purchaseMinutes:[{required:!0,validator:g,trigger:"blur"}],giveMinutes:[{required:!0,validator:g,trigger:"blur"}],coverImg:[{required:!0,message:"请选择活动图",trigger:"blur"}],detail:[{required:!0,message:"请编辑活动内容",trigger:"blur"}]},imageSize:null}},created:function(){},mounted:function(){this.init()},methods:{init:function(){this.getList(),this.addQuillTitle();var e={1:"468px * 552px",2:"456px * 288px",3:"686px * 140px",4:null};this.imageSize=e[this.form.type]},addQuillTitle:function(){var e=document.querySelector(".ql-toolbar"),t=e.querySelectorAll("button"),r=e.querySelectorAll("select");t.forEach((function(e){"ql-script"===e.className?"sub"===e.value?e.title="下标":e.title="上标":"ql-indent"===e.className?"+1"===e.value?e.title="向右缩进":e.title="向左缩进":e.title=m[e.classList[0]]})),r.forEach((function(e){e.parentNode.title=m[e.classList[0]]}))},onSubmit:function(e){var t=this;this.$refs[e].validate((function(e){if(!e)return t.$nextTick((function(){var e=document.getElementsByClassName("is-error");e[0].scrollIntoView({block:"center",behavior:"smooth"})})),!1;if("create"==t.pageType){var r=t.form,i={name:r.name,suitableUser:r.suitableUser,startDate:r.date[0],endDate:r.date[1],totalPrice:r.totalPrice,discountPrice:r.discountPrice,purchaseMinutes:r.purchaseMinutes,giveMinutes:r.giveMinutes,coverImg:r.coverImg,detail:r.detail,delFlag:!1};Object(l["e"])(i).then((function(e){t.messageTips("添加",e)}))}}))},messageTips:function(e,t){200==t.code?(this.$message.success(e+"成功"),this.$store.dispatch("delVisitedViews",this.$route),this.$router.push({path:"/sysBasics/entryActivities"})):this.$message.error(t.msg)},onCancel:function(){this.$store.dispatch("delVisitedViews",this.$route),this.$router.push({path:"/sysBasics/entryActivities"})},handleSuccess:function(e){var t=this.editor;if(e.code){var r=t.getSelection().index;t.insertEmbed(r,"image",e.data.url),t.setSelection(r+1)}else this.$message.error("图片插入失败")},onReSet:function(e){this.$refs[e].resetFields()},getList:function(){var e=this;"create"!=this.pageType&&Object(l["f"])({id:this.$route.query.id}).then((function(t){if(200==t.code){var r=t.data;e.form;e.form={name:r.name,suitableUser:r.suitableUser,date:[r.startDate,r.endDate],startDate:r.startDate,endDate:r.endDate,totalPrice:r.totalPrice,discountPrice:r.discountPrice,purchaseMinutes:r.purchaseMinutes,giveMinutes:r.giveMinutes,coverImg:r.coverImg,detail:r.detail}}}))},handleAvatarSuccess:function(e,t){o["a"].endLoading(),this.form.coverImg=e.data.url},beforeAvatarUpload:function(e){var t={"image/png":!0,"image/jpeg":!0,"image/gif":!0},r=t[e.type],i=e.size/1024/1024<2;return r||this.$message.error("只能上传图片格式!"),i||this.$message.error("上传头像图片大小不能超过 2MB!"),r&&i&&o["a"].startLoading(),r&&i},onEditorChange:function(e){e.quill;var t=e.html;e.text;this.form.detail=t}},computed:{editor:function(){return this.$refs.myQuillEditor.quill}}},h=b,v=(r("c8dd"),r("2877")),y=Object(v["a"])(h,i,a,!1,null,"eda4483c",null);t["default"]=y.exports}}]);