(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["components/cu-editor/cu-editor"],{475:function(t,e,o){"use strict";o.r(e);var n=o(476),i=o(478);for(var r in i)["default"].indexOf(r)<0&&function(t){o.d(e,t,(function(){return i[t]}))}(r);o(481);var a,s=o(46),c=Object(s["default"])(i["default"],n["render"],n["staticRenderFns"],!1,null,"7b039d96",null,!1,n["components"],a);c.options.__file="components/cu-editor/cu-editor.vue",e["default"]=c.exports},476:function(t,e,o){"use strict";o.r(e);var n=o(477);o.d(e,"render",(function(){return n["render"]})),o.d(e,"staticRenderFns",(function(){return n["staticRenderFns"]})),o.d(e,"recyclableRender",(function(){return n["recyclableRender"]})),o.d(e,"components",(function(){return n["components"]}))},477:function(t,e,o){"use strict";var n;o.r(e),o.d(e,"render",(function(){return i})),o.d(e,"staticRenderFns",(function(){return a})),o.d(e,"recyclableRender",(function(){return r})),o.d(e,"components",(function(){return n}));var i=function(){var t=this,e=t.$createElement,o=(t._self._c,t.__map(t.formatArray,(function(e,o){var n=t.__get_orig(e),i=0===t.swiperCurrent||1!==t.swiperCurrent&&2!==t.swiperCurrent?null:t.__map(e.array,(function(e,o){var n=t.__get_orig(e),i=t.__map(e.items,(function(o,n){var i=t.__get_orig(o),r=t.isActive(o,e),a="color"!=e.name&&"icon"!=e.label?t.__get_style([{fontSize:"fontSize"==e.name?o.value:""},o.style]):null;return{$orig:i,m0:r,s0:a}}));return{$orig:n,l0:i}}));return{$orig:n,l1:i}})));t._isMounted||(t.e0=function(e,o){var n=arguments[arguments.length-1].currentTarget.dataset,i=n.eventParams||n["event-params"];o=i.index;return e.stopPropagation(),t.changeSwiper(o)}),t.$mp.data=Object.assign({},{$root:{l2:o}})},r=!1,a=[];i._withStripped=!0},478:function(t,e,o){"use strict";o.r(e);var n=o(479),i=o.n(n);for(var r in n)["default"].indexOf(r)<0&&function(t){o.d(e,t,(function(){return n[t]}))}(r);e["default"]=i.a},479:function(t,e,o){"use strict";(function(t,n){var i=o(4);Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var r=i(o(11)),a=o(480);function s(t,e){var o=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),o.push.apply(o,n)}return o}function c(t){for(var e=1;e0?t+this.iphoneXBottomH:t},fixedBottom:function(){return this.isIos||this.iphoneXBottomH>0?this.keyboardHeight>0?this.keyboardHeight:this.iphoneXBottomH:0}},watch:{keyboardHeight:function(t,e){t>0&&(this.toolBarContentShow=!1)},toolbarShow:function(t){t||(this.toolBarContentShow=t)}},created:function(){var t=this;this.index=0,this.createdAt=Date.now(),this.getUid=function(){return"wux-upload--".concat(t.createdAt,"-").concat(++t.index)},this.uploadTask={},this.tempFilePaths=[]},mounted:function(){var e=this,o=n.createSelectorQuery().in(this);o.select("#fixed-top").boundingClientRect((function(t){e.fixedTopHeight=t.height})).exec();t.getSystemInfo({success:function(t){e.isIos="ios"==t.platform;var o=("devtools"==t.platform||e.isIos)&&44==t.safeArea.top;e.iphoneXBottomH=o?34:0,e.scrollHeightDefault=t.windowHeight-34}});t.onKeyboardHeightChange((function(o){var n=e.keyboardHeight;if(o.height!==n){e.keyboardHeight=o.height;var i=o.height>0?1e3*o.duration:0;n=o.height,setTimeout((function(){t.pageScrollTo({scrollTop:0,success:function(){e.updatePosition(n),e.editorCtx.scrollIntoView()}})}),i)}}))},beforeDestroy:function(){console.log("editor beforeDestroy")},methods:{isActive:function(t,e){var o=t.name,n=t.value,i=t.format;if(!o&&(o=e.name),i){for(var r in i)if(this.formats[r]!==i[r])return!1;return!0}return n?this.formats[o]===n:this.formats[o]},hideKeyboard:function(){this.editorCtx.blur()},changeSwiper:function(t){console.log(t),this.toolBarContentShow=!0,this.swiperCurrent=t,this.hideKeyboard()},updatePosition:function(t){this.keyboardHeight=t},onEditorReady:function(){var e=this;t.createSelectorQuery().in(this).select("#editor").context((function(t){e.editorCtx=t.context,e.setValue(e.content),e.readOnly=!1})).exec()},onEditorInput:function(t){var e=t.detail,o=(e.html,e.text);this.curLength=o.length-1},onEditorFocus:function(t){this.toolbarShow=!0},onEditorBlur:function(){},changeKeyBoard:function(){this.toolBarContentShow=!1,this.hideKeyboard()},hideToolbar:function(){this.hideKeyboard(),this.toolbarShow=!1},formatDefault:function(t){for(var e in t)this.editorCtx.format(e,t[e]);t.bold?this.editorCtx.format("bold",!0):this.formats.bold&&this.editorCtx.format("bold",""),this.editorCtx.format("lineHeight","")},formatformat:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};e.name=e.name||o.name||"";var n=e.name,i=e.value;switch(t){case"format":if(!n)return;"defaultFormat"==n?this.formatDefault(e.format):this.editorCtx.format(n,i);break;case"removeFormat":this.editorCtx.removeFormat();break;case"insertDate":var r=new Date,a="".concat(r.getFullYear()," 年").concat(r.getMonth()+1," 月").concat(r.getDate()," 日");this.editorCtx.insertText({text:a});break;case"check":this.editorCtx.format("list","check");break;case"undo":this.editorCtx.undo();break;case"redo":this.editorCtx.redo();break;case"insertDivider":this.editorCtx.insertDivider();break;case"clear":this.editorCtx.clear();break;case"chooseImage":this.chooseImage();break;case"chooseImagebyCamera":this.chooseImage(!0);break;case"chooseMusic":this.chooseMusic();break;case"choosArticleTemplate":this.choosArticleTemplate();break}},choosArticleTemplate:function(){this.changeSwiper(3)},chooseMusic:function(){this.changeSwiper(4)},onStatusChange:function(t){this.formats=t.detail,console.log(this.formats)},chooseImage:function(e){var o=this,n=function(t){o.tempFilePaths=t.tempFiles.map((function(t){return{url:t.path,size:t.size,type:t.path.substring(t.path.lastIndexOf(".")+1,t.path.length),uid:o.getUid()}})),o.tempFilePaths.forEach((function(t){o.insertImage(t.url,t)}))},i=this.count,r=this.sizeType;setTimeout((function(){t.chooseImage({count:i,sizeType:r,sourceType:e?["camera"]:o.sourceType,success:n})}),100)},insertImage:function(t,e){var o=this;o.editorCtx.insertImage({src:t,data:{id:e.uid},extClass:"editor--editor-img",success:function(t){}})},uploadFile:function(e,o){var n=this;if(this.tempFilePaths.length){var i=this.url,r=this.name,a=this.header,s=this.formData,c=this.progress,l=this.tempFilePaths.shift();l.index=o?o+1:1;var u=l.uid,h=l.url;i&&h&&(this.uploadTask[u]=t.uploadFile({url:i,filePath:h,name:r,header:a,formData:s,success:function(t){return n.onSuccess(l,t)},fail:function(t){return n.onFail(l,t)},complete:function(t){delete n.uploadTask[u],n.$emit("complete",t),n.tempFilePaths.length&&(n.verifyFile(),n.uploadFile(e,l.index))}}),c&&this.uploadTask[u].onProgressUpdate((function(t){return n.onProgress(l,t,e)})))}},verifyFile:function(){var e=this,o=this.tempFilePaths[0],n=o.size,i=o.type;this.noAllowType.map((function(o){i==o&&(t.showToast({title:"不支持上传".concat(o,"图片"),icon:"none"}),e.tempFilePaths.shift())})),n/1024>1024*this.maxSize&&(t.showToast({title:"上传图片不能大于"+this.bytesToSize(1024*this.maxSize*1024)+"!",icon:"none"}),this.tempFilePaths.shift())},onSuccess:function(e,o){var n=JSON.parse(o.data);0==n.code?this.insertImage(n.data.path,e):t.showToast({title:"图片上传失败",icon:"none"})},onFail:function(e,o){t.showToast({title:"图片上传失败!",icon:"none"})},onProgress:function(e,o,n){100!=o.progress&&t.showToast({title:"正在上传图片".concat(e.index,"/").concat(n),icon:"none"});var i=c(c({},e),{},{progress:o.progress,res:o}),r={file:i};this.$emit("progress",r)},bytesToSize:function(t){if(0===t)return"0 B";var e=1024,o=["B","KB","MB","GB","TB","PB","EB","ZB","YB"],n=Math.floor(Math.log(t)/Math.log(e));return(t/Math.pow(e,n)).toPrecision(3)+" "+o[n]},setValue:function(t){var e=this;this.editorCtx&&this.editorCtx.setContents({html:t,success:function(){e.getContents((function(t){e.onEditorInput({detail:{html:t.html,text:t.text}}),e.$emit("update",t)}))}})},getContents:function(t){this.editorCtx.getContents({success:function(e){t(e)}})},chooseAudio:function(){var e=this;console.log(0),t.chooseMessageFile({count:1,type:"file",extension:[".mp3",".m4a",".wav"],success:function(t){console.log(t),e.musicConfig.src=t.tempFiles[0].path,e.musicConfig.name=t.tempFiles[0].name,e.musicConfig.show=!0}})},playAudioFile:function(e){var o=t.createInnerAudioContext();o.src=e,o.autoplay=!0,o.play()},templateChange:function(t){this.currentTemplate=t;for(var e=0;e