chunk-1604e400.fd1548bc.js 9.3 KB

1
  1. (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-1604e400"],{"095c":function(e,t,o){"use strict";o.r(t);var i=function(){var e=this,t=e.$createElement,o=e._self._c||t;return o("div",{staticClass:"editor"},[o("quill-editor",{ref:"myAlias",staticClass:"ql-editor",attrs:{options:e.editorOption},on:{blur:function(t){return e.onEditorBlur(t)},focus:function(t){return e.onEditorFocus(t)},change:function(t){return e.onEditorChange(t)}},model:{value:e.form,callback:function(t){e.form=t},expression:"form"}}),e._v(" "),o("el-upload",{ref:"ivuUpload",staticClass:"ivu-upload",attrs:{"show-file-list":!1,headers:e.headers,"on-success":e.handleSuccess,accept:".jpg, .jpeg, .png","max-size":2048,multiple:"",action:"/api-web/uploadFile"}},[o("Button",{attrs:{icon:"ios-cloud-upload-outline"}})],1),e._v(" "),o("el-dialog",{attrs:{title:"插入视频",width:"500px",visible:e.dialogFormVisible,"append-to-body":""},on:{"update:visible":function(t){e.dialogFormVisible=t}}},[o("el-form",{ref:"diologForm",attrs:{model:e.dialogForm,rules:e.dialogFormRules}},[o("el-form-item",{attrs:{label:"封面图地址","label-width":"90px"}},[o("el-upload",{directives:[{name:"loading",rawName:"v-loading",value:e.uploadImgLoading,expression:"uploadImgLoading"}],staticClass:"avatar-uploader",staticStyle:{"line-height":"0",display:"inline-block"},attrs:{action:"/api-web/uploadFile",headers:e.headers,"show-file-list":!1,accept:".jpg, .jpeg, .png","on-success":e.handleImgSuccess,"on-error":e.handleUploadImgError,"before-upload":e.beforeImgUpload}},[e.dialogForm.poster?o("img",{staticClass:"avatar",attrs:{width:"300px",src:e.dialogForm.poster}}):o("i",{staticClass:"el-icon-plus avatar-uploader-icon"})])],1),e._v(" "),o("el-form-item",{attrs:{label:"视频类型","label-width":"90px"}},[o("el-radio-group",{model:{value:e.formRadio,callback:function(t){e.formRadio=t},expression:"formRadio"}},[o("el-radio",{attrs:{label:1}},[e._v("外部链接")]),e._v(" "),o("el-radio",{attrs:{label:2}},[e._v("上传")])],1)],1),e._v(" "),1==e.formRadio?o("el-form-item",{attrs:{label:"视频地址","label-width":"90px",prop:"url"}},[o("el-input",{staticStyle:{width:"100%"},attrs:{autocomplete:"off"},model:{value:e.dialogForm.url,callback:function(t){e.$set(e.dialogForm,"url",t)},expression:"dialogForm.url"}})],1):e._e(),e._v(" "),2==e.formRadio?o("el-form-item",{attrs:{label:"上传视频","label-width":"90px",prop:"videoUrl"}},[o("el-upload",{directives:[{name:"loading",rawName:"v-loading",value:e.uploadLoading,expression:"uploadLoading"}],staticClass:"upload-demo",staticStyle:{display:"inline-block"},attrs:{action:"/api-web/uploadFile","before-upload":e.beforeUpload,"on-success":e.handleUploadSuccess,"on-error":e.handleUploadError,"show-file-list":!1,accept:".mp4","file-list":e.fileList,"on-exceed":e.handleExceed}},[e.dialogForm.videoUrl?o("video",{staticStyle:{width:"120px",height:"120px"},attrs:{type:"video/mp4",preload:"auto",src:e.dialogForm.videoUrl}}):o("i",{staticClass:"el-icon-plus avatar-uploader-icon"})]),e._v(" "),o("p",{staticClass:"imageSize"},[e._v("只能上传mp4文件, 且不超过100M")])],1):e._e()],1),e._v(" "),o("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[o("el-button",{on:{click:function(t){e.dialogFormVisible=!1}}},[e._v("取 消")]),e._v(" "),o("el-button",{attrs:{type:"primary"},on:{click:function(t){return e.onVideoComfirm("diologForm")}}},[e._v("确 定")])],1)],1)],1)},l=[],r=(o("ac6a"),o("5f87")),a=(o("a753"),o("8096"),o("14e1"),o("9339")),s=o.n(a),n=o("953d"),d=o("7590"),u=(o("5a0c"),[["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","middle","large","huge"]}],[{header:[1,2,3,4,5,6,!1]}],[{color:[]},{background:[]}],[{font:[]}],[{align:[]}],["clean"],["link","image","video"]]),c={"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":"文件"};s.a.register(d["a"],!0);var p={props:{id:"",keyWord:{type:String,default:"content"},form:{type:String},alias:{type:String,default:"myQuillEditor"}},name:"editor",components:{quillEditor:n["quillEditor"]},data:function(){var e=this;return{content:null,headers:{Authorization:Object(r["b"])()},dialogFormVisible:!1,dialogForm:{poster:null,url:null,videoUrl:null},uploadLoading:!1,uploadImgLoading:!1,fileList:[],dialogFormRules:{url:[{required:!0,message:"请输入视频地址",trigger:"blur"}],videoUrl:[{required:!0,message:"请上传视频",trigger:"blur"}]},formRadio:1,editorOption:{placeholder:"请输入内容",modules:{toolbar:{container:u,handlers:{image:function(t){if(t){var o,i=e.editor;e.editorIndex=(null===(o=i.getSelection())||void 0===o?void 0:o.index)||0,e.$refs.ivuUpload.$children[0].$refs.input.click()}else e.quill.format("image",!1)},video:function(t){if(t){var o;e.dialogFormVisible=!0;var i=e.editor;e.editorIndex=(null===(o=i.getSelection())||void 0===o?void 0:o.index)||0}else e.quill.format("image",!1)}}}}},ActiveEditor:null}},created:function(){},mounted:function(){this},methods:{onEditorBlur:function(e){e.quill,e.html,e.text},onEditorFocus:function(e){console.log(e,this.id),this.ActiveEditor=e},onEditorChange:function(e){e.quill;var t=e.html;e.text;this.$emit("onEditorChange",t)},onVideoComfirm:function(e){var t=this;this.$refs[e].validate((function(e){if(!e)return!1;var o=t.dialogForm,i=t.editor;console.log(i,t.keyWord);var l={poster:o.poster,url:1==t.formRadio?o.url:o.videoUrl};i.insertEmbed(t.editorIndex,"video",l),i.setSelection(t.editorIndex+1,{preload:!1}),t.dialogFormVisible=!1,t.dialogForm={poster:null,url:null,videoUrl:null}}))},handleSuccess:function(e){var t=this.ActiveEditor;if(console.log(t,this.id),e.code){var o=t.getSelection().index||0;t.insertEmbed(o,"image",e.data.url),t.setSelection(o+1)}else this.$message.error("图片插入失败")},addQuillTitle:function(){var e=document.querySelector(".ql-toolbar"),t=e.querySelectorAll("button"),o=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=c[e.classList[0]]})),o.forEach((function(e){e.parentNode.title=c[e.classList[0]]}))},handleUploadImgError:function(e){this.uploadImgLoading=!1,this.$message.error("上传失败")},handleImgSuccess:function(e,t){this.uploadImgLoading=!1,this.dialogForm.poster=e.data.url},beforeImgUpload:function(e){var t={"image/png":!0,"image/jpeg":!0},o=t[e.type],i=e.size/1024/1024<2;return o||this.$message.error("只能上传图片格式!"),i||this.$message.error("上传图片大小不能超过 2MB!"),o&&i&&(this.uploadImgLoading=!0),o&&i},beforeAvatarUpload:function(e){var t={"image/png":!0,"image/jpeg":!0},o=t[e.type],i=e.size/1024/1024<2;return o||this.$message.error("只能上传图片格式!"),i||this.$message.error("上传图片大小不能超过 2M!"),o&&i},beforeUpload:function(e){var t=e.size/1024/1024<100;return t||this.$message.error("上传视频大小不能超过 100MB!"),this.uploadLoading=!0,t},handleUploadError:function(e){this.uploadLoading=!1,this.$message.error("上传视频失败")},handleUploadSuccess:function(e,t){this.uploadLoading=!1,this.$message.success("上传视频成功"),this.dialogForm.videoUrl=e.data.url},handleExceed:function(e,t){this.$message.error("您已上传过视频")}},computed:{editor:function(){return this.$refs.myAlias.quill},ActiveEditors:function(){return console.log(this.id),this.ActiveEditor}}},m=p,g=(o("96b0"),o("2877")),f=Object(g["a"])(m,i,l,!1,null,"b57e41da",null);t["default"]=f.exports},"2f54":function(e,t,o){},7590:function(e,t,o){"use strict";var i=o("d4ec"),l=o("bee2"),r=o("45eb"),a=o("7e84"),s=o("262e"),n=o("2caf8"),d=o("953d"),u=d["Quill"].import("blots/block/embed"),c=d["Quill"].import("formats/link"),p=["height","width","src","poster"],m=function(e){Object(s["a"])(o,e);var t=Object(n["a"])(o);function o(){return Object(i["a"])(this,o),t.apply(this,arguments)}return Object(l["a"])(o,[{key:"format",value:function(e,t){p.indexOf(e)>-1?t?this.domNode.setAttribute(e,t):this.domNode.removeAttribute(e):Object(r["a"])(Object(a["a"])(o.prototype),"format",this).call(this,e,t)}},{key:"html",value:function(){var e=this.value(),t=e.video;return'<a href="'.concat(t,'">').concat(t,"</a>")}}],[{key:"create",value:function(e){var t=Object(r["a"])(Object(a["a"])(o),"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,o){return e.hasAttribute(o)&&(t[o]=e.getAttribute(o)),t}),{})}},{key:"sanitize",value:function(e){return c.sanitize(e)}},{key:"value",value:function(e){return e.getAttribute("src")}}]),o}(u);m.blotName="video",m.className="ql-video",m.tagName="video",t["a"]=m},"96b0":function(e,t,o){"use strict";o("2f54")}}]);