mirror of
https://github.com/kuaifan/dootask.git
synced 2026-01-16 03:58:12 +00:00
1 line
5.5 KiB
JavaScript
Vendored
1 line
5.5 KiB
JavaScript
Vendored
"use strict";(self.webpackChunkDooTask=self.webpackChunkDooTask||[]).push([[399],{91345:(e,t,i)=>{i.d(t,{Z:()=>r});var o=i(1519),n=i.n(o)()((function(e){return e[1]}));n.push([e.id,".component-only-office[data-v-53ec86ff]{align-items:center;bottom:0;display:flex;justify-content:center;left:0;position:absolute;right:0;top:0}.component-only-office .placeholder[data-v-53ec86ff]{flex:1;height:100%;width:100%}.component-only-office .office-loading[data-v-53ec86ff]{align-items:center;bottom:0;display:flex;justify-content:center;left:0;position:absolute;right:0;top:0;z-index:2}",""]);const r=n},20550:(e,t,i)=>{i.d(t,{Z:()=>r});var o=i(1519),n=i.n(o)()((function(e){return e[1]}));n.push([e.id,".component-only-office .load-error{align-items:center;display:flex;left:50%;padding:8px;position:absolute;top:50%;transform:translate(-50%,-50%);z-index:1}.component-only-office .load-error .ivu-alert-icon{margin-left:4px;margin-right:8px;position:static}",""]);const r=n},52399:(e,t,i)=>{i.r(t),i.d(t,{default:()=>y});var o=i(20629),n=i(62065),r=i(33875);function a(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,o)}return i}function s(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?a(Object(i),!0).forEach((function(t){c(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):a(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}function c(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}const l={name:"OnlyOffice",components:{IFrame:n.Z},props:{id:{type:String,default:function(){return"office_"+Math.round(1e4*Math.random())}},code:{type:String,default:""},historyId:{type:Number,default:0},value:{type:[Object,Array],default:function(){return{}}},readOnly:{type:Boolean,default:!1},documentKey:Function},data:function(){return{loading:!1,loadError:!1,docEditor:null}},beforeDestroy:function(){null!==this.docEditor&&(this.docEditor.destroyEditor(),this.docEditor=null)},computed:s(s({},(0,o.rn)(["userInfo","themeIsDark"])),{},{fileType:function(){return this.getType(this.value.type)},fileName:function(){return this.value.name},fileUrl:function(){var e,t=this.code||this.value.id;return $A.leftExists(t,"msgFile_")?e="dialog/msg/download/?msg_id=".concat($A.leftDelete(t,"msgFile_"),"&token=").concat(this.userToken):$A.leftExists(t,"taskFile_")?e="project/task/filedown/?file_id=".concat($A.leftDelete(t,"taskFile_"),"&token=").concat(this.userToken):(e="file/content/?id=".concat(t,"&token=").concat(this.userToken),this.historyId>0&&(e+="&history_id=".concat(this.historyId))),e},previewUrl:function(){return $A.apiUrl(this.fileUrl)+"&down=preview"}}),watch:{"value.id":{handler:function(e){var t=this;e&&$A.isDesktop()&&(this.loading=!0,this.loadError=!1,$A.loadScript($A.apiUrl("../office/web-apps/apps/api/documents/api.js"),(function(e){if(t.loading=!1,null===e)if(t.documentKey){var i=t.documentKey();i&&i.then?i.then(t.loadFile):t.loadFile()}else t.handleClose();else t.loadError=!0})))},immediate:!0},previewUrl:{handler:function(){$A.isDesktop()||(this.loading=!0)},immediate:!0}},methods:{onFrameLoad:function(){this.loading=!1},getType:function(e){switch(e){case"word":return"docx";case"excel":return"xlsx";case"ppt":return"pptx"}return e},loadFile:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";null!==this.docEditor&&(this.docEditor.destroyEditor(),this.docEditor=null);var i="zh";switch(r.AX){case"CN":case"TC":i="zh";break;default:i="en"}var o=this.code||this.value.id,n=$A.strExists(this.fileName,".")?this.fileName:this.fileName+"."+this.fileType,a="".concat(this.fileType,"-").concat(t||o);this.historyId>0&&(a+="-".concat(this.historyId));var s={document:{fileType:this.fileType,title:n,key:a,url:"http://nginx/api/".concat(this.fileUrl)},editorConfig:{mode:"edit",lang:i,user:{id:String(this.userInfo.userid),name:this.userInfo.nickname},customization:{uiTheme:this.themeIsDark?"theme-dark":"theme-classic-light",forcesave:!0,help:!1},callbackUrl:"http://nginx/api/file/content/office?id=".concat(o,"&token=").concat(this.userToken)},events:{onDocumentReady:this.onDocumentReady}};if(/\/hideenOfficeTitle\//.test(window.navigator.userAgent)&&(s.document.title=" "),(this.readOnly||this.historyId>0)&&(s.editorConfig.mode="view",s.editorConfig.callbackUrl=null,!s.editorConfig.user.id)){var c=$A.getStorageInt("viewer");c||(c=$A.randNum(1e3,99999),$A.setStorage("viewer",c)),s.editorConfig.user.id="viewer_"+c,s.editorConfig.user.name="Viewer_"+c}this.$nextTick((function(){e.docEditor=new DocsAPI.DocEditor(e.id,s)}))},onDocumentReady:function(){this.$emit("on-document-ready",this.docEditor)}}};var d=i(93379),f=i.n(d),u=i(91345),h={insert:"head",singleton:!1};f()(u.Z,h);u.Z.locals;var p=i(20550),m={insert:"head",singleton:!1};f()(p.Z,m);p.Z.locals;const y=(0,i(51900).Z)(l,(function(){var e=this,t=e._self._c;return t("div",{staticClass:"component-only-office"},[e.$A.isDesktop()?[e.loadError?t("Alert",{staticClass:"load-error",attrs:{type:"error","show-icon":""}},[e._v(e._s(e.$L("组件加载失败!")))]):e._e(),e._v(" "),t("div",{staticClass:"placeholder",attrs:{id:e.id}})]:t("IFrame",{staticClass:"preview-iframe",attrs:{src:e.previewUrl},on:{"on-load":e.onFrameLoad}}),e._v(" "),e.loading?t("div",{staticClass:"office-loading"},[t("Loading")],1):e._e()],2)}),[],!1,null,"53ec86ff",null).exports}}]); |