chunk-c38f08da.300ad599.js
9.31 KB
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-c38f08da"],{3853:function(e,t,i){"use strict";i.r(t);var n=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{staticClass:"videoTool"},[i("h3",{staticClass:"toolTit"},[e._v("视频")]),i("div",{staticClass:"toolBox"},[i("div",{staticClass:"itemBox"},[i("label",[e._v("视频地址")]),i("Upload",{attrs:{"default-file-list":e.defaultVideoList,"limit-size":20,multiple:!1,types:["mp4"],limit:1},on:{change:function(t){return e.handleUploadChange(t,"videoUrl")}}})],1),i("div",{staticClass:"itemBox"},[i("label",[e._v("覆盖页地址(APP)")]),i("Upload",{attrs:{"default-file-list":e.defaultImgList,"limit-size":20,multiple:!1,types:["jpg","jpeg","png","gif"],limit:1},on:{change:function(t){return e.handleUploadChange(t,"coverImg")}}})],1),i("div",{staticClass:"itemBox"},[i("label",[e._v("标题")]),i("el-input",{attrs:{placeholder:"请输入内容"},model:{value:e.activeComponent.componentContent.title,callback:function(t){e.$set(e.activeComponent.componentContent,"title",t)},expression:"activeComponent.componentContent.title"}})],1),i("div",{staticClass:"itemBox"},[i("label",[e._v("正文")]),i("quill-editor",{ref:"myQuillEditor",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.activeComponent.componentContent.mainBody,callback:function(t){e.$set(e.activeComponent.componentContent,"mainBody",t)},expression:"activeComponent.componentContent.mainBody"}})],1)])])},o=[],l=i("953d"),a=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{staticClass:"content"},[i("el-upload",{directives:[{name:"loading",rawName:"v-loading",value:e.isUploading,expression:"isUploading"}],staticClass:"upload-demo",attrs:{disabled:e.componentError,drag:"",headers:e.headers,"file-list":e.viewFileList,name:e.name,"show-file-list":e.showFileList,"list-type":e.showFileListType,multiple:e.multiple,action:e.uploadUrl,limit:e.limit,"on-success":e.handleUploadSuccess,"before-upload":e.handleBeforeUpload,"on-error":e.handleUploadError,"on-exceed":e.handleExceed,"before-remove":e.handleBeforeRemove,"on-remove":e.handleRemove,"on-preview":e.handlePreviewOpen}},[i("i",{staticClass:"el-icon-upload"}),e.componentError?i("div",{staticClass:"error-text"},[e._v(" 组件配置错误,请查看控制台 ")]):i("div",{staticClass:"el-upload__text"},[e._v("将文件拖到此处,或"),i("em",[e._v("点击上传")])]),i("div",{staticClass:"el-upload__tip",attrs:{slot:"tip"},slot:"tip"},[e._v(" 文件大小不超过"+e._s(e.limitSize)+"m,文件类型为"+e._s(e.types.toString())+" ")])]),i("el-dialog",{attrs:{title:"预览",visible:e.previewObj.show,width:"60%","before-close":e.handlePreviewClose},on:{"update:visible":function(t){return e.$set(e.previewObj,"show",t)}}},[i("div",{staticClass:"preview-content"},[e.previewObj.file&&e.previewObj.file.type.includes("image")?[i("el-image",{staticClass:"preview-item",attrs:{src:e.previewObj.file.url}})]:e._e(),e.previewObj.file&&e.previewObj.file.type.includes("video")?[i("video",{staticClass:"preview-item",attrs:{controls:"",src:e.previewObj.file.url}})]:e._e()],2)])],1)},r=[],s=i("c7eb"),c=i("1da1"),d=(i("c740"),i("caad"),i("d81d"),i("fb6a"),i("a434"),i("b0c0"),i("a9e3"),i("d3b7"),i("25f0"),i("2532"),i("159b"),i("3b02")),u=i.n(d),p=null,f=Object({NODE_ENV:"production",VUE_APP_BASE_API:"/prod-api",VUE_APP_DOMAIN_PREFIX_1:"https://h5.028wlkj.com/cdwlMall/admin-server",VUE_APP_DOMAIN_PREFIX_2:"https://h5.028wlkj.com/cdwlMall/api",BASE_URL:"/cdwlMall/"}).VUE_APP_DOMAIN_PREFIX,m={name:"Upload",props:{headers:{type:Object,default:function(){return{}}},name:{type:String,default:function(){return"file"}},limit:{type:Number,default:function(){return 5}},limitSize:{type:Number,default:function(){return 5}},multiple:{type:Boolean,default:function(){return!0}},showFileList:{type:Boolean,default:function(){return!0}},showFileListType:{type:String,default:function(){return"text"}},types:{type:Array,default:function(){return["jpg","png","gif"]}},defaultFileList:{type:Array,default:function(){return[]}},responseFileName:{type:String,default:function(){return"url"}},needFullScreenLoading:{type:Boolean,default:function(){return!0}}},data:function(){return{uploadUrl:"".concat(f,"/file/upload"),fileList:[],viewFileList:[],componentError:!1,isUploading:!1,previewObj:{show:!1,file:null}}},watch:{defaultFileList:{handler:function(){var e=this,t="[object Array]"===Object.prototype.toString.call(this.defaultFileList)&&this.defaultFileList.length>0&&"[object String]"!==Object.prototype.toString.call(this.defaultFileList[0]);if(t)throw this.componentError=!0,new Error("defaultFileList格式错误,应为string[]格式");this.componentError=!1,this.viewFileList=this.defaultFileList.map((function(e){return{name:e,url:e}})),this.viewFileList.forEach((function(t){e.fileList.push(t)}))},deep:!0,immediate:!0},fileList:{handler:function(){this.handleNotifyFather()},deep:!0,immediate:!1}},methods:{handleCheckFileMime:function(e,t){var i=t.map((function(e){return u.a.getType(e)}));return i.includes(e)},handleCheckFileSize:function(e,t){var i=1024*t*1024;return i>e},handleBeforeUpload:function(e){var t=e.type||u.a.getType(e.name.slice(e.name.lastIndexOf(".")+1)),i=this.handleCheckFileMime(t,this.types),n=this.handleCheckFileSize(e.size,this.limitSize);return n||(e.isJumpRemove=!0),n||this.$notify.warning("文件大小不得超出".concat(this.limitSize,"m")),i||(e.isJumpRemove=!0),i||this.$notify.warning("文件类型不在合法列表 ".concat(this.types)),n&&i&&(this.isUploading=!0,this.needFullScreenLoading&&(p=this.$loading({background:"rgba(255,255,255,0.5)",text:"上传中",fullscreen:!0}))),n&&i},handleUploadSuccess:function(e,t,i){var n;(this.isUploading=!1,this.needFullScreenLoading)&&(null===(n=p)||void 0===n||n.close());var o={url:e.data[this.responseFileName],name:t.name};t.url=e.data[this.responseFileName],this.fileList.push(o)},handleUploadError:function(e,t,i){},handleExceed:function(e,t){this.$notify.warning("文件总数大于可上传数量 ".concat(this.limit))},handleBeforeRemove:function(e,t){var i=this;return Object(c["a"])(Object(s["a"])().mark((function t(){var n;return Object(s["a"])().wrap((function(t){while(1)switch(t.prev=t.next){case 0:if(null===e||void 0===e||null===(n=e.raw)||void 0===n||!n.isJumpRemove){t.next=2;break}return t.abrupt("return",!0);case 2:return t.next=4,i.$confirm("此操作将会删除已上传的文件, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"});case 4:return t.abrupt("return",t.sent);case 5:case"end":return t.stop()}}),t)})))()},handleRemove:function(e,t){var i,n=this;null!==e&&void 0!==e&&null!==(i=e.raw)&&void 0!==i&&i.isJumpRemove||this.fileList.splice(this.fileList.findIndex((function(t){var i;return(null===e||void 0===e||null===(i=e.response)||void 0===i?void 0:i.data[n.responseFileName])===t.url||e.url===t.url})),1)},handleNotifyFather:function(){this.$emit("change",this.fileList)},handlePreviewOpen:function(e){var t,i,n;e.type||(e.type=u.a.getType(null===e||void 0===e||null===(t=e.url)||void 0===t?void 0:t.slice((null===e||void 0===e||null===(i=e.url)||void 0===i?void 0:i.lastIndexOf("."))+1))||u.a.getType(null===e||void 0===e||null===(n=e.name)||void 0===n?void 0:n.slice((null===e||void 0===e?void 0:e.name.lastIndexOf("."))+1))||void 0);e.type.includes("image")||e.type.includes("video")?(this.previewObj.file=e,this.previewObj.show=!0):this.$confirm("需要下载才能预览此文件, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){var t=document.createElement("a");t.download=null===e||void 0===e?void 0:e.url.slice((null===e||void 0===e?void 0:e.url.lastIndexOf("/"))+1),t.target="_bank",t.href=null===e||void 0===e?void 0:e.url,t.click(),t=null})).catch((function(){}))},handlePreviewClose:function(){this.previewObj.file=null,this.previewObj.show=!1}}},h=m,v=(i("dbbd"),i("2877")),b=Object(v["a"])(h,a,r,!1,null,"3cf3b738",null),w=b.exports,g=i("629e"),C={mixins:[g["a"]],name:"videoTool",components:{quillEditor:l["quillEditor"],Upload:w},mounted:function(){this.activeComponent.componentContent.videoUrl&&this.defaultVideoList.push(this.activeComponent.componentContent.videoUrl),this.activeComponent.componentContent.coverImg&&this.defaultImgList.push(this.activeComponent.componentContent.coverImg)},data:function(){return{defaultVideoList:[],defaultImgList:[],editorOption:{placeholder:"请输入",modules:{toolbar:[["bold","italic","link"]]}}}},methods:{onEditorBlur:function(){},onEditorFocus:function(){},onEditorChange:function(){console.log(this.mainBody)},handleUploadChange:function(e,t){this.activeComponent.componentContent[t]=e.length>0?e[0].url:""}}},y=C,O=(i("f65f"),Object(v["a"])(y,n,o,!1,null,"e1d4bfd8",null));t["default"]=O.exports},"629e":function(e,t,i){"use strict";i.d(t,"a",(function(){return a}));var n=i("5530"),o=i("2f62"),l={computed:Object(n["a"])({},Object(o["b"])(["activeComponent","componentsData"])),methods:Object(n["a"])({},Object(o["c"])({setComponentsData:"SET_COMPONENTSDATA"})),beforeDestroy:function(){},watch:{"activeComponent.componentContent":{handler:function(e,t){console.log(e)},deep:!0}}},a=Object(n["a"])({},l)},7201:function(e,t,i){},"7cd0":function(e,t,i){},dbbd:function(e,t,i){"use strict";i("7cd0")},f65f:function(e,t,i){"use strict";i("7201")}}]);