mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-10 18:02:55 +00:00
1 line
48 KiB
JavaScript
Vendored
1 line
48 KiB
JavaScript
Vendored
"use strict";(self.webpackChunkDooTask=self.webpackChunkDooTask||[]).push([[425],{30264:(t,e,a)=>{a.d(e,{Z:()=>g});const i=a(70538).default.prototype.$isServer;function s(t,e){for(let a=0;a<e.length;a++)if(t===e[a])return!0;return!1}!i&&(window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver);function o(t,e,a){a="string"==typeof e?[e]:e;let i=t.$parent,s=i.$options.name;for(;i&&(!s||a.indexOf(s)<0);)i=i.$parent,i&&(s=i.$options.name);return i}const n=["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","text-rendering","text-transform","width","text-indent","padding-left","padding-right","border-width","box-sizing"];let r,l={};function c(t,e=null,a=null,i=!1){r||(r=document.createElement("textarea"),document.body.appendChild(r)),t.getAttribute("wrap")?r.setAttribute("wrap",t.getAttribute("wrap")):r.removeAttribute("wrap");let{paddingSize:s,borderSize:o,boxSizing:c,sizingStyle:u}=function(t,e=!1){const a=t.getAttribute("id")||t.getAttribute("data-reactid")||t.getAttribute("name");if(e&&l[a])return l[a];const i=window.getComputedStyle(t),s=i.getPropertyValue("box-sizing")||i.getPropertyValue("-moz-box-sizing")||i.getPropertyValue("-webkit-box-sizing"),o=parseFloat(i.getPropertyValue("padding-bottom"))+parseFloat(i.getPropertyValue("padding-top")),r=parseFloat(i.getPropertyValue("border-bottom-width"))+parseFloat(i.getPropertyValue("border-top-width")),c={sizingStyle:n.map((t=>`${t}:${i.getPropertyValue(t)}`)).join(";"),paddingSize:o,borderSize:r,boxSizing:s};return e&&a&&(l[a]=c),c}(t,i);r.setAttribute("style",`${u};\n min-height:0 !important;\n max-height:none !important;\n height:0 !important;\n visibility:hidden !important;\n overflow:hidden !important;\n position:absolute !important;\n z-index:-1000 !important;\n top:0 !important;\n right:0 !important\n`),r.value=t.value||t.placeholder||"";let d,p=Number.MIN_SAFE_INTEGER,h=Number.MAX_SAFE_INTEGER,g=r.scrollHeight;if("border-box"===c?g+=o:"content-box"===c&&(g-=s),null!==e||null!==a){r.value=" ";let t=r.scrollHeight-s;null!==e&&(p=t*e,"border-box"===c&&(p=p+s+o),g=Math.max(p,g)),null!==a&&(h=t*a,"border-box"===c&&(h=h+s+o),d=g>h?"":"hidden",g=Math.min(h,g))}return a||(d="hidden"),{height:`${g}px`,minHeight:`${p}px`,maxHeight:`${h}px`,overflowY:d}}function u(t,e,a){this.$children.forEach((i=>{i.$options.name===t?i.$emit.apply(i,[e].concat(a)):u.apply(i,[t,e].concat([a]))}))}function d(t,e,a){return e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}var p="ivu-input";const h={name:"DragInput",mixins:[{methods:{dispatch(t,e,a){let i=this.$parent||this.$root,s=i.$options.name;for(;i&&(!s||s!==t);)i=i.$parent,i&&(s=i.$options.name);i&&i.$emit.apply(i,[e].concat(a))},broadcast(t,e,a){u.call(this,t,e,a)}}},{inject:{FormInstance:{default:""}},computed:{itemDisabled(){let t=this.disabled;return!t&&this.FormInstance&&(t=this.FormInstance.disabled),t}}}],props:{type:{validator:function(t){return s(t,["text","textarea","password","url","email","date","number","tel"])},default:"text"},value:{type:[String,Number],default:""},size:{validator:function(t){return s(t,["small","large","default"])},default:function(){return this.$IVIEW&&""!==this.$IVIEW.size?this.$IVIEW.size:"default"}},placeholder:{type:String,default:""},maxlength:{type:[String,Number]},disabled:{type:Boolean,default:!1},icon:String,autosize:{type:[Boolean,Object],default:!1},rows:{type:Number,default:2},readonly:{type:Boolean,default:!1},name:{type:String},number:{type:Boolean,default:!1},autofocus:{type:Boolean,default:!1},spellcheck:{type:Boolean,default:!1},autocomplete:{type:String,default:"off"},clearable:{type:Boolean,default:!1},elementId:{type:String},wrap:{validator:function(t){return s(t,["hard","soft"])},default:"soft"},prefix:{type:String,default:""},suffix:{type:String,default:""},search:{type:Boolean,default:!1},enterButton:{type:[Boolean,String],default:!1},showWordLimit:{type:Boolean,default:!1},password:{type:Boolean,default:!1}},data:function(){return{currentValue:this.value,prefixCls:p,slotReady:!1,textareaStyles:{},isOnComposition:!1,showPassword:!1}},computed:{currentType:function(){var t=this.type;return"password"===t&&this.password&&this.showPassword&&(t="text"),t},prepend:function(){var t=!1;return"textarea"!==this.type&&(t=void 0!==this.$slots.prepend),t},append:function(){var t=!1;return"textarea"!==this.type&&(t=void 0!==this.$slots.append),t},showPrefix:function(){var t=!1;return"textarea"!==this.type&&(t=""!==this.prefix||void 0!==this.$slots.prefix),t},showSuffix:function(){var t=!1;return"textarea"!==this.type&&(t=""!==this.suffix||void 0!==this.$slots.suffix),t},wrapClasses:function(){var t;return["".concat(p,"-wrapper"),(t={},d(t,"".concat(p,"-wrapper-").concat(this.size),!!this.size),d(t,"".concat(p,"-type-").concat(this.type),this.type),d(t,"".concat(p,"-group"),this.prepend||this.append||this.search&&this.enterButton),d(t,"".concat(p,"-group-").concat(this.size),(this.prepend||this.append||this.search&&this.enterButton)&&!!this.size),d(t,"".concat(p,"-group-with-prepend"),this.prepend),d(t,"".concat(p,"-group-with-append"),this.append||this.search&&this.enterButton),d(t,"".concat(p,"-hide-icon"),this.append),d(t,"".concat(p,"-with-search"),this.search&&this.enterButton),t)]},inputClasses:function(){var t;return["".concat(p),(t={},d(t,"".concat(p,"-").concat(this.size),!!this.size),d(t,"".concat(p,"-disabled"),this.itemDisabled),d(t,"".concat(p,"-with-prefix"),this.showPrefix),d(t,"".concat(p,"-with-suffix"),this.showSuffix||this.search&&!1===this.enterButton),t)]},textareaClasses:function(){return["".concat(p),d({},"".concat(p,"-disabled"),this.itemDisabled)]},upperLimit:function(){return this.maxlength},textLength:function(){return"number"==typeof this.value?String(this.value).length:(this.value||"").length}},methods:{handleEnter:function(t){this.$emit("on-enter",t),this.search&&this.$emit("on-search",this.currentValue)},handleKeydown:function(t){this.$emit("on-keydown",t)},handleKeypress:function(t){this.$emit("on-keypress",t)},handleKeyup:function(t){this.$emit("on-keyup",t)},handleIconClick:function(t){this.$emit("on-click",t)},handleFocus:function(t){this.$emit("on-focus",t)},handleBlur:function(t){this.$emit("on-blur",t),o(this,["DatePicker","TimePicker","Cascader","Search"])||this.dispatch("FormItem","on-form-blur",this.currentValue)},handleComposition:function(t){"compositionstart"===t.type&&(this.isOnComposition=!0),"compositionend"===t.type&&(this.isOnComposition=!1,this.handleInput(t))},handleInput:function(t){if(!this.isOnComposition){var e=t.target.value;this.number&&""!==e&&(e=Number.isNaN(Number(e))?e:Number(e)),this.$emit("input",e),this.setCurrentValue(e),this.$emit("on-change",t)}},handleChange:function(t){this.$emit("on-input-change",t)},handlePaste:function(t){this.$emit("on-input-paste",t)},setCurrentValue:function(t){var e=this;t!==this.currentValue&&(this.$nextTick((function(){e.resizeTextarea()})),this.currentValue=t,o(this,["DatePicker","TimePicker","Cascader","Search"])||this.dispatch("FormItem","on-form-change",t))},resizeTextarea:function(){var t=this.autosize;if(!t||"textarea"!==this.type)return!1;var e=t.minRows,a=t.maxRows;this.textareaStyles=c(this.$refs.textarea,e,a)},focus:function(){"textarea"===this.type?this.$refs.textarea.focus():this.$refs.input.focus()},blur:function(){"textarea"===this.type?this.$refs.textarea.blur():this.$refs.input.blur()},handleClear:function(){this.$emit("input",""),this.setCurrentValue(""),this.$emit("on-change",{target:{value:""}}),this.$emit("on-clear")},handleSearch:function(){if(this.itemDisabled)return!1;this.$refs.input.focus(),this.$emit("on-search",this.currentValue)},handleToggleShowPassword:function(){var t=this;if(this.itemDisabled)return!1;this.showPassword=!this.showPassword,this.focus();var e=this.currentValue.length;setTimeout((function(){t.$refs.input.setSelectionRange(e,e)}),0)}},watch:{value:function(t){this.setCurrentValue(t)}},mounted:function(){this.slotReady=!0,this.resizeTextarea()}};const g=(0,a(51900).Z)(h,(function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{class:t.wrapClasses},["textarea"!==t.type?[t.prepend?a("div",{directives:[{name:"show",rawName:"v-show",value:t.slotReady,expression:"slotReady"}],class:[t.prefixCls+"-group-prepend"]},[t._t("prepend")],2):t._e(),t._v(" "),t.clearable&&t.currentValue&&!t.itemDisabled?a("i",{staticClass:"ivu-icon",class:["ivu-icon-ios-close-circle",t.prefixCls+"-icon",t.prefixCls+"-icon-clear",t.prefixCls+"-icon-normal"],on:{click:t.handleClear}}):t.icon?a("i",{staticClass:"ivu-icon",class:["ivu-icon-"+t.icon,t.prefixCls+"-icon",t.prefixCls+"-icon-normal"],on:{click:t.handleIconClick}}):t.search&&!1===t.enterButton?a("i",{staticClass:"ivu-icon ivu-icon-ios-search",class:[t.prefixCls+"-icon",t.prefixCls+"-icon-normal",t.prefixCls+"-search-icon"],on:{click:t.handleSearch}}):t.showSuffix?a("span",{staticClass:"ivu-input-suffix"},[t._t("suffix",(function(){return[t.suffix?a("i",{staticClass:"ivu-icon",class:["ivu-icon-"+t.suffix]}):t._e()]}))],2):t.showWordLimit?a("span",{staticClass:"ivu-input-word-count"},[t._v(t._s(t.textLength)+"/"+t._s(t.upperLimit))]):t.password?a("span",{staticClass:"ivu-input-suffix",on:{click:t.handleToggleShowPassword}},[t.showPassword?a("i",{staticClass:"ivu-icon ivu-icon-ios-eye-off-outline"}):a("i",{staticClass:"ivu-icon ivu-icon-ios-eye-outline"})]):t._e(),t._v(" "),a("transition",{attrs:{name:"fade"}},[t.icon?t._e():a("i",{staticClass:"ivu-icon ivu-icon-ios-loading ivu-load-loop",class:[t.prefixCls+"-icon",t.prefixCls+"-icon-validate"]})]),t._v(" "),a("input",{ref:"input",class:t.inputClasses,attrs:{id:t.elementId,autocomplete:t.autocomplete,spellcheck:t.spellcheck,type:t.currentType,placeholder:t.placeholder,disabled:t.itemDisabled,maxlength:t.maxlength,readonly:t.readonly,name:t.name,number:t.number,autofocus:t.autofocus},domProps:{value:t.currentValue},on:{keyup:[function(e){return!e.type.indexOf("key")&&t._k(e.keyCode,"enter",13,e.key,"Enter")?null:t.handleEnter.apply(null,arguments)},t.handleKeyup],keypress:t.handleKeypress,keydown:t.handleKeydown,focus:t.handleFocus,blur:t.handleBlur,compositionstart:t.handleComposition,compositionupdate:t.handleComposition,compositionend:t.handleComposition,input:t.handleInput,change:t.handleChange,paste:t.handlePaste}}),t._v(" "),t.append?a("div",{directives:[{name:"show",rawName:"v-show",value:t.slotReady,expression:"slotReady"}],class:[t.prefixCls+"-group-append"]},[t._t("append")],2):t.search&&t.enterButton?a("div",{class:[t.prefixCls+"-group-append",t.prefixCls+"-search"],on:{click:t.handleSearch}},[!0===t.enterButton?a("i",{staticClass:"ivu-icon ivu-icon-ios-search"}):[t._v(t._s(t.enterButton))]],2):t.showPrefix?a("span",{staticClass:"ivu-input-prefix"},[t._t("prefix",(function(){return[t.prefix?a("i",{staticClass:"ivu-icon",class:["ivu-icon-"+t.prefix]}):t._e()]}))],2):t._e()]:[a("textarea",{ref:"textarea",class:t.textareaClasses,style:t.textareaStyles,attrs:{id:t.elementId,wrap:t.wrap,autocomplete:t.autocomplete,spellcheck:t.spellcheck,placeholder:t.placeholder,disabled:t.itemDisabled,rows:t.rows,maxlength:t.maxlength,readonly:t.readonly,name:t.name,autofocus:t.autofocus},domProps:{value:t.currentValue},on:{keyup:[function(e){return!e.type.indexOf("key")&&t._k(e.keyCode,"enter",13,e.key,"Enter")?null:t.handleEnter.apply(null,arguments)},t.handleKeyup],keypress:t.handleKeypress,keydown:t.handleKeydown,focus:t.handleFocus,blur:t.handleBlur,compositionstart:t.handleComposition,compositionupdate:t.handleComposition,compositionend:t.handleComposition,input:t.handleInput,paste:t.handlePaste}}),t._v(" "),t.showWordLimit?a("span",{staticClass:"ivu-input-word-count"},[t._v(t._s(t.textLength)+"/"+t._s(t.upperLimit))]):t._e()]],2)}),[],!1,null,null,null).exports},86877:(t,e,a)=>{a.d(e,{Z:()=>s});const i={name:"ScrollerY",props:{static:{type:Boolean,default:!1},autoBottom:{type:Boolean,default:!1},autoRecovery:{type:Boolean,default:!0},autoRecoveryAnimate:{type:Boolean,default:!1}},data:function(){return{scrollY:0,scrollDiff:0,autoInterval:null}},mounted:function(){this.openInterval(),this.$nextTick(this.initScroll)},activated:function(){this.openInterval(),this.recoveryScroll()},destroyed:function(){this.closeInterval()},deactivated:function(){this.closeInterval()},methods:{initScroll:function(){var t=this;this.autoToBottom();var e="function"==typeof this.$listeners["on-scroll"],a=$A(this.$refs.scrollerView);a.scroll((function(){var i=Math.round(a.innerHeight()),s=a.scrollTop(),o=t.$refs.scrollerView.scrollHeight;if(t.scrollY=s,e){var n="static",r="static";t.scrollDiff-s>50?(t.scrollDiff=s,n="down"):t.scrollDiff-s<-100&&(t.scrollDiff=s,n="up"),t.scrollDiff-s>1?(t.scrollDiff=s,r="down"):t.scrollDiff-s<-1&&(t.scrollDiff=s,r="up"),t.$emit("on-scroll",{scale:s/(o-i),scrollY:s,scrollE:o-i-s,direction:n,directionreal:r})}}))},recoveryScroll:function(){var t=this;this.autoRecovery&&(this.scrollY>0||this.autoBottom)&&this.$nextTick((function(){t.autoBottom?t.autoToBottom():t.scrollTo(t.scrollY,t.autoRecoveryAnimate)}))},openInterval:function(){this.autoToBottom(),this.autoInterval&&clearInterval(this.autoInterval),this.autoInterval=setInterval(this.autoToBottom,300)},closeInterval:function(){clearInterval(this.autoInterval),this.autoInterval=null},scrollTo:function(t,e){!1===e?$A(this.$refs.scrollerView).stop().scrollTop(t):$A(this.$refs.scrollerView).stop().animate({scrollTop:t})},autoToBottom:function(){this.autoBottom&&$A.scrollToView(this.$refs.bottom,{behavior:"instant",inline:"end"})},scrollInfo:function(){var t=$A(this.$refs.scrollerView),e=Math.round(t.innerHeight()),a=t.scrollTop(),i=this.$refs.scrollerView.scrollHeight;return this.scrollY=a,{scale:a/(i-e),scrollY:a,scrollE:i-e-a}},querySelector:function(t){return this.$refs.scrollerView&&this.$refs.scrollerView.querySelector(t)}}};const s=(0,a(51900).Z)(i,(function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{ref:"scrollerView",staticClass:"app-scroller-y",class:[t.static?"static":""]},[t._t("default"),t._v(" "),a("div",{ref:"bottom",staticClass:"app-scroller-bottom"})],2)}),[],!1,null,null,null).exports},51708:(t,e,a)=>{a.d(e,{Z:()=>x});var i=a(30264),s=a(86877),o=a(20629);const n={name:"WCircle",props:{percent:{type:Number,default:0},size:{type:Number,default:120}},computed:{style:function(){var t=this.size;return this.isNumeric(t)&&(t+="px"),{width:t,height:t}},args:function(){var t=this.percent,e=Math.min(360,3.6*t);return 360==e?e=0:0==e&&(e=360),{x:14,y:14,r:14,start:360,end:e}}},methods:{isNumeric:function(t){return""!==t&&!isNaN(parseFloat(t))&&isFinite(t)},point:function(t,e,a,i){return[(t+Math.sin(i)*a).toFixed(2),(e-Math.cos(i)*a).toFixed(2)]},full:function(t,e,a,i){return i<=0?"M ".concat(t-a," ").concat(e," A ").concat(a," ").concat(a," 0 1 1 ").concat(t+a," ").concat(e," A ").concat(a," ").concat(a," 1 1 1 ").concat(t-a," ").concat(e," Z"):"M ".concat(t-a," ").concat(e," A ").concat(a," ").concat(a," 0 1 1 ").concat(t+a," ").concat(e," A ").concat(a," ").concat(a," 1 1 1 ").concat(t-a," ").concat(e," M ").concat(t-i," ").concat(e," A ").concat(i," ").concat(i," 0 1 1 ").concat(t+i," ").concat(e," A ").concat(i," ").concat(i," 1 1 1 ").concat(t-i," ").concat(e," Z")},part:function(t,e,a,i,s,o){var n=s/360*2*Math.PI,r=o/360*2*Math.PI,l=[this.point(t,e,i,n),this.point(t,e,a,n),this.point(t,e,a,r),this.point(t,e,i,r)],c=r-n>Math.PI?"1":"0";return"M ".concat(l[0][0]," ").concat(l[0][1]," L ").concat(l[1][0]," ").concat(l[1][1]," A ").concat(a," ").concat(a," 0 ").concat(c," 1 ").concat(l[2][0]," ").concat(l[2][1]," L ").concat(l[3][0]," ").concat(l[3][1]," A ").concat(i," ").concat(i," 0 ").concat(c," 0 ").concat(l[0][0]," ").concat(l[0][1]," Z")},arc:function(t){var e=t.x,a=void 0===e?0:e,i=t.y,s=void 0===i?0:i,o=t.R,n=void 0===o?0:o,r=t.r,l=void 0===r?0:r,c=t.start,u=t.end,d=[Math.max(n,l),Math.min(n,l)];if(l=d[1],(n=d[0])<=0)return"";if(c!==+c||u!==+u)return this.full(a,s,n,l);if(Math.abs(c-u)<1e-6)return"";if(Math.abs(c-u)%360<1e-6)return this.full(a,s,n,l);var p=[c%360,u%360];return(c=p[0])>(u=p[1])&&(u+=360),this.part(a,s,n,l,c,u)}}};var r=a(51900);function l(t,e){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),a.push.apply(a,i)}return a}function c(t){for(var e=1;e<arguments.length;e++){var a=null!=arguments[e]?arguments[e]:{};e%2?l(Object(a),!0).forEach((function(e){u(t,e,a[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):l(Object(a)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(a,e))}))}return t}function u(t,e,a){return e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}const d={name:"DialogView",components:{WCircle:(0,r.Z)(n,(function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"common-circle",style:t.style,attrs:{"data-id":t.percent}},[a("svg",{attrs:{viewBox:"0 0 28 28"}},[a("g",{attrs:{fill:"none","fill-rule":"evenodd"}},[a("path",{staticClass:"common-circle-path",attrs:{d:"M-500-100h997V48h-997z"}}),t._v(" "),a("g",{attrs:{"fill-rule":"nonzero"}},[a("path",{staticClass:"common-circle-g-path-ring",attrs:{"stroke-width":"3",d:"M14 25.5c6.351 0 11.5-5.149 11.5-11.5S20.351 2.5 14 2.5 2.5 7.649 2.5 14 7.649 25.5 14 25.5z"}}),t._v(" "),a("path",{staticClass:"common-circle-g-path-core",attrs:{d:t.arc(t.args)}})])])])])}),[],!1,null,null,null).exports},props:{msgData:{type:Object,default:function(){return{}}},dialogType:{type:String,default:""}},data:function(){return{popperShow:!1,allList:[]}},activated:function(){this.msgRead()},computed:c(c({},(0,o.rn)(["userToken","userId"])),{},{readList:function(){return this.allList.filter((function(t){return t.read_at}))},unreadList:function(){return this.allList.filter((function(t){return!t.read_at}))},showMenu:function(){return this.msgData.userid==this.userId||"file"===this.msgData.type}}),watch:{msgData:{handler:function(){this.msgRead()},immediate:!0},popperShow:function(t){var e=this;t&&this.$store.dispatch("call",{url:"dialog/msg/readlist",data:{msg_id:this.msgData.id}}).then((function(t){var a=t.data;e.allList=a,setTimeout(e.$refs.percent.updatePopper,10)})).catch((function(){e.allList=[],setTimeout(e.$refs.percent.updatePopper,10)}))}},methods:{msgRead:function(){var t=this;!0!==this.msgData._r&&(this.msgData._r=!0,setTimeout((function(){t.$el.offsetParent?t.$store.dispatch("dialogMsgRead",t.msgData):t.msgData._r=!1}),50))},textMsg:function(t){return t?t=t.trim().replace(/(\n\x20*){3,}/g,"\n\n"):""},imageStyle:function(t){var e=t.width,a=t.height;if(e&&a){var i=e,s=a;return(e>180||a>180)&&(e>a?(i=180,s=a*(180/e)):(i=e*(180/a),s=180)),{width:i+"px",height:s+"px"}}return{}},withdraw:function(){var t=this;$A.modalConfirm({content:"确定撤回此信息吗?",okText:"撤回",loading:!0,onOk:function(){t.$store.dispatch("call",{url:"dialog/msg/withdraw",data:{msg_id:t.msgData.id}}).then((function(){$A.messageSuccess("消息已撤回"),t.$store.dispatch("forgetDialogMsg",t.msgData.id),t.$Modal.remove()})).catch((function(e){var a=e.msg;$A.messageError(a,301),t.$Modal.remove()}))}})},viewFile:function(){this.$Electron?this.$Electron.sendMessage("windowRouter",{name:"file-msg-"+this.msgData.id,path:"/single/file/msg/"+this.msgData.id,userAgent:"/hideenOfficeTitle/",force:!1,config:{title:"".concat(this.msgData.msg.name," (").concat($A.bytesToSize(this.msgData.msg.size),")"),titleFixed:!0,parent:null,width:Math.min(window.screen.availWidth,1440),height:Math.min(window.screen.availHeight,900)}}):window.open($A.apiUrl("../single/file/msg/".concat(this.msgData.id)))},downFile:function(){var t=this;$A.modalConfirm({title:"下载文件",content:"".concat(this.msgData.msg.name," (").concat($A.bytesToSize(this.msgData.msg.size),")"),okText:"立即下载",onOk:function(){$A.downFile($A.apiUrl("dialog/msg/download?msg_id=".concat(t.msgData.id,"&token=").concat(t.userToken)))}})}}};const p=(0,r.Z)(d,(function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{class:"dialog-view "+t.msgData.type,attrs:{"data-id":t.msgData.id}},[a("div",{staticClass:"dialog-head"},[a("div",{staticClass:"dialog-content"},["text"===t.msgData.type?a("div",{staticClass:"content-text"},[a("pre",{staticClass:"no-dark-mode"},[t._v(t._s(t.textMsg(t.msgData.msg.text)))])]):"file"===t.msgData.type?a("div",{class:"content-file "+t.msgData.msg.type},[a("div",{staticClass:"dialog-file"},["img"===t.msgData.msg.type?a("img",{staticClass:"file-img",style:t.imageStyle(t.msgData.msg),attrs:{src:t.msgData.msg.thumb},on:{click:t.viewFile}}):a("div",{staticClass:"file-box"},[a("img",{staticClass:"file-thumb",attrs:{src:t.msgData.msg.thumb}}),t._v(" "),a("div",{staticClass:"file-info"},[a("div",{staticClass:"file-name"},[t._v(t._s(t.msgData.msg.name))]),t._v(" "),a("div",{staticClass:"file-size"},[t._v(t._s(t.$A.bytesToSize(t.msgData.msg.size)))])])])])]):"loading"===t.msgData.type?a("div",{staticClass:"content-loading"},[a("Loading")],1):a("div",{staticClass:"content-unknown"},[t._v(t._s(t.$L("未知的消息类型")))])]),t._v(" "),t.showMenu?a("div",{staticClass:"dialog-menu"},[a("div",{staticClass:"menu-icon"},[t.msgData.userid==t.userId?a("Icon",{attrs:{type:"md-undo",title:t.$L("撤回")},on:{click:t.withdraw}}):t._e(),t._v(" "),"file"===t.msgData.type?[a("Icon",{attrs:{type:"md-eye",title:t.$L("查看")},on:{click:t.viewFile}}),t._v(" "),a("Icon",{attrs:{type:"md-arrow-round-down",title:t.$L("下载")},on:{click:t.downFile}})]:t._e()],2)]):t._e()]),t._v(" "),t.msgData.created_at?a("div",{staticClass:"dialog-foot"},[a("div",{staticClass:"time",attrs:{title:t.msgData.created_at}},[t._v(t._s(t.$A.formatTime(t.msgData.created_at)))]),t._v(" "),t.msgData.send>1||"group"==t.dialogType?a("EPopover",{ref:"percent",staticClass:"percent",attrs:{placement:"left-end",width:360,offset:-8},model:{value:t.popperShow,callback:function(e){t.popperShow=e},expression:"popperShow"}},[a("div",{staticClass:"dialog-wrapper-read-poptip-content"},[a("ul",{staticClass:"read overlay-y"},[a("li",{staticClass:"read-title"},[a("em",[t._v(t._s(t.readList.length))]),t._v(t._s(t.$L("已读")))]),t._v(" "),t._l(t.readList,(function(t){return a("li",[a("UserAvatar",{attrs:{userid:t.userid,size:26,showName:""}})],1)}))],2),t._v(" "),a("ul",{staticClass:"unread overlay-y"},[a("li",{staticClass:"read-title"},[a("em",[t._v(t._s(t.unreadList.length))]),t._v(t._s(t.$L("未读")))]),t._v(" "),t._l(t.unreadList,(function(t){return a("li",[a("UserAvatar",{attrs:{userid:t.userid,size:26,showName:""}})],1)}))],2)]),t._v(" "),a("WCircle",{attrs:{slot:"reference",percent:t.msgData.percentage,size:14},slot:"reference"})],1):100===t.msgData.percentage?a("Icon",{staticClass:"done",attrs:{type:"md-done-all"}}):a("Icon",{staticClass:"done",attrs:{type:"md-checkmark"}})],1):a("div",{staticClass:"dialog-foot"},[a("Loading")],1)])}),[],!1,null,null,null).exports;function h(t,e){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),a.push.apply(a,i)}return a}function g(t){for(var e=1;e<arguments.length;e++){var a=null!=arguments[e]?arguments[e]:{};e%2?h(Object(a),!0).forEach((function(e){f(t,e,a[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):h(Object(a)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(a,e))}))}return t}function f(t,e,a){return e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}const m={name:"DialogUpload",props:{dialogId:{type:Number,default:0},maxSize:{type:Number,default:204800}},data:function(){return{uploadFormat:["text","md","markdown","drawio","mind","docx","wps","doc","xls","xlsx","ppt","pptx","jpg","jpeg","png","gif","bmp","ico","raw","rar","zip","jar","7-zip","tar","gzip","7z","tif","tiff","dwg","dxf","ofd","pdf","txt","htaccess","htgroups","htpasswd","conf","bat","cmd","cpp","c","cc","cxx","h","hh","hpp","ino","cs","css","dockerfile","go","html","htm","xhtml","vue","we","wpy","java","js","jsm","jsx","json","jsp","less","lua","makefile","gnumakefile","ocamlmakefile","make","mysql","nginx","ini","cfg","prefs","m","mm","pl","pm","p6","pl6","pm6","pgsql","php","inc","phtml","shtml","php3","php4","php5","phps","phpt","aw","ctp","module","ps1","py","r","rb","ru","gemspec","rake","guardfile","rakefile","gemfile","rs","sass","scss","sh","bash","bashrc","sql","sqlserver","swift","ts","typescript","str","vbs","vb","v","vh","sv","svh","xml","rdf","rss","wsdl","xslt","atom","mathml","mml","xul","xbl","xaml","yaml","yml","asp","properties","gitignore","log","bas","prg","python","ftl","aspx","mp3","wav","mp4","flv","avi","mov","wmv","mkv","3gp","rm","xmind","rp"],actionUrl:$A.apiUrl("dialog/msg/sendfile")}},computed:g(g({},(0,o.rn)(["userToken"])),{},{headers:function(){return{fd:$A.getStorageString("userWsFd"),token:this.userToken}},params:function(){return{dialog_id:this.dialogId}}}),methods:{handleProgress:function(t,e){void 0===e.tempId&&(e.tempId=$A.randomString(8),this.$emit("on-progress",e))},handleSuccess:function(t,e){1===t.ret?(e.data=t.data,this.$emit("on-success",e),t.data.task_id&&this.$store.dispatch("getTaskFiles",t.data.task_id)):($A.modalWarning({title:"发送失败",content:"文件 "+e.name+" 发送失败,"+t.msg}),this.$emit("on-error",e),this.$refs.upload.fileList.pop())},handleFormatError:function(t){$A.modalWarning({title:"文件格式不正确",content:"文件 "+t.name+" 格式不正确,仅支持发送:"+this.uploadFormat.join(",")})},handleMaxSize:function(t){$A.modalWarning({title:"超出文件大小限制",content:"文件 "+t.name+" 太大,不能发送超过"+$A.bytesToSize(1024*this.maxSize)+"。"})},handleClick:function(){this.$refs.upload.handleClick()},upload:function(t){this.$refs.upload.upload(t)}}};const v=(0,r.Z)(m,(function(){var t=this,e=t.$createElement;return(t._self._c||e)("Upload",{ref:"upload",attrs:{name:"files",action:t.actionUrl,headers:t.headers,data:t.params,multiple:"",format:t.uploadFormat,"show-upload-list":!1,"max-size":t.maxSize,"on-progress":t.handleProgress,"on-success":t.handleSuccess,"on-format-error":t.handleFormatError,"on-exceeded-size":t.handleMaxSize}})}),[],!1,null,null,null).exports;var y=a(80641);function _(t,e){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),a.push.apply(a,i)}return a}function b(t){for(var e=1;e<arguments.length;e++){var a=null!=arguments[e]?arguments[e]:{};e%2?_(Object(a),!0).forEach((function(e){w(t,e,a[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):_(Object(a)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(a,e))}))}return t}function w(t,e,a){return e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}const $={name:"DialogWrapper",components:{DialogUpload:v,DialogView:p,ScrollerY:s.Z,DragInput:i.Z},props:{dialogId:{type:Number,default:0}},data:function(){return{autoBottom:!0,autoInterval:null,dialogDrag:!1,inputFocus:!1,msgText:"",msgNew:0,topId:0,tempMsgs:[],dialogMsgSubscribe:null,pasteShow:!1,pasteFile:[],pasteItem:[]}},mounted:function(){this.dialogMsgSubscribe=y.Store.subscribe("dialogMsgPush",this.addDialogMsg)},beforeDestroy:function(){this.dialogMsgSubscribe&&(this.dialogMsgSubscribe.unsubscribe(),this.dialogMsgSubscribe=null)},computed:b(b({},(0,o.rn)(["isDesktop","userId","cacheDialogs","dialogMsgs"])),{},{dialogData:function(){var t=this;return this.cacheDialogs.find((function(e){return e.id==t.dialogId}))||{}},dialogMsgList:function(){var t=this;return this.dialogId?$A.cloneJSON(this.dialogMsgs.filter((function(e){return e.dialog_id==t.dialogId}))).sort((function(t,e){return t.id-e.id})):[]},isAutoBottom:function(){return!(this.inputFocus&&!this.isDesktop)&&this.autoBottom},tempMsgList:function(){var t=this;return this.dialogId?$A.cloneJSON(this.tempMsgs.filter((function(e){return e.dialog_id==t.dialogId}))):[]},peopleNum:function(){return"group"===this.dialogData.type?$A.runNum(this.dialogData.people):0},pasteTitle:function(){var t=this.pasteItem,e=t.find((function(t){return"image"==t.type})),a=t.find((function(t){return"image"!=t.type}));return e&&a?"发送文件/图片":e?"发送图片":"发送文件"}}),watch:{$route:{handler:function(t){var e=this;if($A.isJson(window.__sendDialogMsg)&&window.__sendDialogMsg.time>$A.Time()){var a=window.__sendDialogMsg,i=a.msgFile,s=a.msgText;window.__sendDialogMsg=null,this.$nextTick((function(){$A.isArray(i)&&i.length>0?e.sendFileMsg(i):s&&e.sendMsg(s)}))}if(t.query&&t.query._){var o=$A.cloneJSON(t.query);delete o._,this.goForward({query:o},!0)}},immediate:!0},dialogId:{handler:function(t){t&&(this.autoBottom=!0,this.msgNew=0,this.topId=-1,this.$store.dispatch("getDialogMsgs",t))},immediate:!0}},methods:{sendMsg:function(t){var e=this;if("string"==typeof t&&t&&(this.msgText=t,this.$refs.input.focus()),""!=this.msgText){var a=$A.randomString(16);this.tempMsgs.push({id:a,dialog_id:this.dialogData.id,type:"text",userid:this.userId,msg:{text:this.msgText}}),this.isDesktop||this.$refs.input.blur(),this.onToBottom(),this.onActive(),this.$store.dispatch("call",{url:"dialog/msg/sendtext",data:{dialog_id:this.dialogId,text:this.msgText},method:"post"}).then((function(t){var i=t.data;e.tempMsgs=e.tempMsgs.filter((function(t){return t.id!=a})),e.sendSuccess(i)})).catch((function(t){var i=t.msg;$A.modalError(i),e.tempMsgs=e.tempMsgs.filter((function(t){return t.id!=a}))})),this.msgText=""}},sendFileMsg:function(t){var e=this;t.length>0&&(this.pasteFile=[],this.pasteItem=[],t.some((function(t){var a=new FileReader;a.readAsDataURL(t),a.onload=function(a){var i=a.target;e.pasteFile.push(t),e.pasteItem.push({type:$A.getMiddle(t.type,null,"/"),name:t.name,size:t.size,result:i.result}),e.pasteShow=!0}})))},chatKeydown:function(t){if(13===t.keyCode){if(t.shiftKey)return;t.preventDefault(),this.sendMsg()}},pasteDrag:function(t,e){var a="drag"===e?t.dataTransfer.files:t.clipboardData.files,i=Array.prototype.slice.call(a);i.length>0&&(t.preventDefault(),this.sendFileMsg(i))},chatPasteDrag:function(t,e){this.dialogDrag=!1,this.pasteDrag(t,e)},chatDragOver:function(t,e){var a=this,i=this.__dialogDrag=$A.randomString(8);if(t){if("move"===e.dataTransfer.effectAllowed)return;this.dialogDrag=!0}else setTimeout((function(){i===a.__dialogDrag&&(a.dialogDrag=t)}),150)},pasteSend:function(){var t=this;this.pasteFile.some((function(e){t.$refs.chatUpload.upload(e)}))},chatFile:function(t,e){switch(t){case"progress":this.tempMsgs.push({id:e.tempId,dialog_id:this.dialogData.id,type:"loading",userid:this.userId,msg:{}}),this.isDesktop||this.$refs.input.blur(),this.onToBottom(),this.onActive();break;case"error":this.tempMsgs=this.tempMsgs.filter((function(t){return t.id!=e.tempId}));break;case"success":this.tempMsgs=this.tempMsgs.filter((function(t){return t.id!=e.tempId})),this.sendSuccess(e.data)}},sendSuccess:function(t){var e=this;$A.isArray(t)?t.some((function(t){e.sendSuccess(t)})):(this.$store.dispatch("saveDialogMsg",t),this.$store.dispatch("increaseTaskMsgNum",this.dialogId),this.$store.dispatch("updateDialogLastMsg",t),this.onActive())},chatScroll:function(t){switch(t.directionreal){case"up":t.scrollE<10&&(this.msgNew=0,this.autoBottom=!0);break;case"down":this.autoBottom=!1}t.scale>=1&&(this.msgNew=0,this.autoBottom=!0)},onEventFocus:function(t){this.inputFocus=!0,this.$emit("on-focus",t)},onEventblur:function(t){this.inputFocus=!1,this.$emit("on-blur",t)},onActive:function(){this.$emit("on-active")},onToBottom:function(){this.autoBottom=!0,this.$refs.scroller&&this.$refs.scroller.autoToBottom()},openProject:function(){this.dialogData.group_info&&this.goForward({path:"/manage/project/"+this.dialogData.group_info.id})},openTask:function(){this.dialogData.group_info&&this.$store.dispatch("openTask",this.dialogData.group_info.id)},loadNextPage:function(){var t=this,e=this.dialogMsgList[0].id;this.$store.dispatch("getDialogMoreMsgs",this.dialogId).then((function(){t.$nextTick((function(){t.topId=e,$A.scrollToView(document.getElementById("view_"+e),{behavior:"instant",inline:"start"})}))})).catch((function(){}))},addDialogMsg:function(){var t=this;this.isAutoBottom?this.$nextTick(this.onToBottom):this.$nextTick((function(){t.$refs.scroller&&t.$refs.scroller.scrollInfo().scrollE>10&&t.msgNew++}))}}};const x=(0,r.Z)($,(function(){var t=this,e=t.$createElement,a=t._self._c||e;return t.dialogData&&t.dialogData.id?a("div",{staticClass:"dialog-wrapper",on:{drop:function(e){return e.preventDefault(),t.chatPasteDrag(e,"drag")},dragover:function(e){return e.preventDefault(),t.chatDragOver(!0,e)},dragleave:function(e){return e.preventDefault(),t.chatDragOver(!1,e)}}},[t._t("head",(function(){return[a("div",{staticClass:"dialog-title",class:{completed:t.$A.dialogCompleted(t.dialogData)}},[a("div",{staticClass:"main-title"},[t._l(t.$A.dialogTags(t.dialogData),(function(e){return"success"!=e.color?[a("Tag",{attrs:{color:e.color,fade:!1}},[t._v(t._s(t.$L(e.text)))])]:t._e()})),t._v(" "),a("h2",[t._v(t._s(t.dialogData.name))]),t._v(" "),t.peopleNum>0?a("em",[t._v("("+t._s(t.peopleNum)+")")]):t._e(),t._v(" "),t.dialogData.top_at?a("label",{staticClass:"top-text"},[t._v(t._s(t.$L("置顶")))]):t._e()],2),t._v(" "),"group"===t.dialogData.type?["project"===t.dialogData.group_type?a("div",{staticClass:"sub-title pointer",on:{click:t.openProject}},[t._v("\n "+t._s(t.$L("项目聊天室"))+" "+t._s(t.$L("打开项目管理"))+"\n ")]):"task"===t.dialogData.group_type?a("div",{staticClass:"sub-title pointer",on:{click:t.openTask}},[t._v("\n "+t._s(t.$L("任务聊天室"))+" "+t._s(t.$L("查看任务详情"))+"\n ")]):t._e()]:t._e()],2)]})),t._v(" "),a("ScrollerY",{ref:"scroller",staticClass:"dialog-scroller overlay-y",attrs:{"auto-bottom":t.isAutoBottom,static:""},on:{"on-scroll":t.chatScroll}},[a("div",{ref:"manageList",staticClass:"dialog-list"},[a("ul",[t.dialogData.hasMorePages?a("li",{staticClass:"history",on:{click:t.loadNextPage}},[t._v(t._s(t.$L("加载历史消息")))]):t.dialogData.loading>0&&0===t.dialogMsgList.length?a("li",{staticClass:"loading"},[a("Loading")],1):0===t.dialogMsgList.length?a("li",{staticClass:"nothing"},[t._v(t._s(t.$L("暂无消息")))]):t._e(),t._v(" "),t._l(t.dialogMsgList,(function(e){return a("li",{key:e.id,class:{self:e.userid==t.userId,"history-tip":t.topId==e.id},attrs:{id:"view_"+e.id}},[t.topId==e.id?a("em",{staticClass:"history-text"},[t._v(t._s(t.$L("历史消息")))]):t._e(),t._v(" "),a("div",{staticClass:"dialog-avatar"},[a("UserAvatar",{attrs:{userid:e.userid,tooltipDisabled:e.userid==t.userId,size:30}})],1),t._v(" "),a("DialogView",{attrs:{"msg-data":e,"dialog-type":t.dialogData.type}})],1)})),t._v(" "),t._l(t.tempMsgList,(function(e){return a("li",{key:"tmp_"+e.id,class:{self:e.userid==t.userId},attrs:{id:"tmp_"+e.id}},[a("div",{staticClass:"dialog-avatar"},[a("UserAvatar",{attrs:{userid:e.userid,tooltipDisabled:e.userid==t.userId,size:30}})],1),t._v(" "),a("DialogView",{attrs:{"msg-data":e,"dialog-type":t.dialogData.type}})],1)}))],2)])]),t._v(" "),a("div",{class:["dialog-footer",t.msgNew>0&&t.dialogMsgList.length>0?"newmsg":""],on:{click:t.onActive}},[a("div",{staticClass:"dialog-newmsg",on:{click:t.onToBottom}},[t._v(t._s(t.$L("有"+t.msgNew+"条新消息")))]),t._v(" "),t._t("inputBefore"),t._v(" "),a("DragInput",{ref:"input",staticClass:"dialog-input",attrs:{type:"textarea",rows:1,autosize:{minRows:1,maxRows:3},maxlength:2e4,placeholder:t.$L("输入消息...")},on:{"on-focus":t.onEventFocus,"on-blur":t.onEventblur,"on-keydown":t.chatKeydown,"on-input-paste":t.pasteDrag},model:{value:t.msgText,callback:function(e){t.msgText=e},expression:"msgText"}}),t._v(" "),""!=t.msgText?a("div",{staticClass:"dialog-send",on:{click:t.sendMsg}},[a("Icon",{attrs:{type:"md-send"}})],1):t._e(),t._v(" "),a("DialogUpload",{ref:"chatUpload",staticClass:"chat-upload",attrs:{"dialog-id":t.dialogId},on:{"on-progress":function(e){return t.chatFile("progress",e)},"on-success":function(e){return t.chatFile("success",e)},"on-error":function(e){return t.chatFile("error",e)}}})],2),t._v(" "),t.dialogDrag?a("div",{staticClass:"drag-over",on:{click:function(e){t.dialogDrag=!1}}},[a("div",{staticClass:"drag-text"},[t._v(t._s(t.$L("拖动到这里发送")))])]):t._e(),t._v(" "),a("Modal",{attrs:{title:t.$L(t.pasteTitle),"cancel-text":t.$L("取消"),"ok-text":t.$L("发送"),"enter-ok":!0},on:{"on-ok":t.pasteSend},model:{value:t.pasteShow,callback:function(e){t.pasteShow=e},expression:"pasteShow"}},[a("div",{staticClass:"dialog-wrapper-paste"},[t._l(t.pasteItem,(function(e){return["image"==e.type?a("img",{attrs:{src:e.result}}):a("div",[t._v(t._s(t.$L("文件"))+": "+t._s(e.name)+" ("+t._s(t.$A.bytesToSize(e.size))+")")])]}))],2)])],2):t._e()}),[],!1,null,null,null).exports},40425:(t,e,a)=>{a.r(e),a.d(e,{default:()=>c});var i=a(20629),s=a(51708);function o(t,e){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),a.push.apply(a,i)}return a}function n(t){for(var e=1;e<arguments.length;e++){var a=null!=arguments[e]?arguments[e]:{};e%2?o(Object(a),!0).forEach((function(e){r(t,e,a[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):o(Object(a)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(a,e))}))}return t}function r(t,e,a){return e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}const l={components:{ScrollerY:a(86877).Z,DialogWrapper:s.Z},data:function(){return{tabActive:"dialog",dialogType:[{type:"",name:"全部"},{type:"project",name:"项目"},{type:"task",name:"任务"},{type:"user",name:"个人"}],dialogActive:"",dialogKey:"",dialogId:0,contactsKey:"",contactsLoad:0,contactsList:[],contactsData:null,contactsCurrentPage:1,contactsHasMorePages:!1,topOperateStyles:{},topOperateVisible:!1,topOperateItem:{}}},activated:function(){this.openDialogStorage()},computed:n(n({},(0,i.rn)(["userId","cacheDialogs","dialogOpenId"])),{},{dialogList:function(){var t=this,e=this.dialogActive,a=this.dialogKey;return""==e&&""==a?this.cacheDialogs.filter((function(e){return t.filterDialog(e)})).sort((function(t,e){return t.top_at||e.top_at?$A.Date(e.top_at)-$A.Date(t.top_at):$A.Date(e.last_at)-$A.Date(t.last_at)})):this.cacheDialogs.filter((function(i){if(!t.filterDialog(i))return!1;if(e)switch(e){case"project":case"task":if(i.group_type!=e)return!1;break;case"user":if("user"!=i.type)return!1;break;default:return!1}if(a){var s=$A.strExists(i.name,a),o=i.last_msg&&"text"===i.last_msg.type&&$A.strExists(i.last_msg.msg.text,a);if(!s&&!o)return!1}return!0})).sort((function(t,e){return t.top_at||e.top_at?$A.Date(e.top_at)-$A.Date(t.top_at):$A.Date(e.last_at)-$A.Date(t.last_at)}))},msgUnread:function(){return function(t){var e=0;return this.cacheDialogs.some((function(a){var i=$A.getDialogUnread(a);if(i)switch(t){case"project":case"task":t==a.group_type&&(e+=i);break;case"user":t==a.type&&(e+=i);break;default:e+=i}})),e}},overlayClass:function(){return{"overlay-y":!0,"overlay-none":!0===this.topOperateVisible}}}),watch:{tabActive:function(t){t&&null===this.contactsData&&this.getContactsList(1)},dialogId:function(t){$A.setStorage("messenger::dialogId",t),this.$store.state.dialogOpenId=t},dialogOpenId:function(t){t>0&&(this.dialogId=t)},contactsKey:function(t){var e=this;setTimeout((function(){e.contactsKey==t&&(e.contactsData=null,e.getContactsList(1))}),600)}},methods:{listScroll:function(t){if("up"===t.directionreal)t.scrollE<10&&"contacts"===this.tabActive&&0==this.contactsLoad&&this.contactsHasMorePages&&this.getContactsList(this.contactsCurrentPage+1);this.topOperateVisible=!1},onActive:function(t){if(this.dialogActive==t){var e=this.dialogList.find((function(t){return $A.getDialogUnread(t)>0}));e&&$A.scrollToView(this.$refs["dialog_".concat(e.id)][0],{behavior:"smooth",scrollMode:"if-needed"})}this.dialogActive=t},closeDialog:function(){this.dialogId=0},openDialog:function(t,e){this.dialogId=t.id,this.scrollIntoActive(e)},openDialogStorage:function(){var t=this;if(this.dialogId=$A.getStorageInt("messenger::dialogId"),this.dialogId>0){var e=this.cacheDialogs.find((function(e){return e.id===t.dialogId}));e&&this.openDialog(e,!1)}},openContacts:function(t){var e=this;this.tabActive="dialog",this.$store.dispatch("openDialogUserid",t.userid).then((function(){e.scrollIntoActive()}))},filterDialog:function(t){if($A.getDialogUnread(t)>0||t.id==this.dialogId||t.top_at)return!0;if(void 0===t.name)return!1;if(!t.last_at)return!1;if("group"==t.type&&["project","task"].includes(t.group_type)&&$A.isJson(t.group_info)){if("task"==t.group_type&&t.group_info.complete_at)if(432e3+Math.max($A.Date(t.last_at,!0),$A.Date(t.group_info.complete_at,!0))<$A.Time())return!1;if(t.group_info.deleted_at)if(172800+Math.max($A.Date(t.last_at,!0),$A.Date(t.group_info.deleted_at,!0))<$A.Time())return!1;if(t.group_info.archived_at)if(259200+Math.max($A.Date(t.last_at,!0),$A.Date(t.group_info.archived_at,!0))<$A.Time())return!1}return!0},getContactsList:function(t){var e=this;null===this.contactsData&&(this.contactsData={}),this.contactsLoad++,this.$store.dispatch("call",{url:"users/search",data:{keys:{key:this.contactsKey},sorts:{az:"asc"},page:t,pagesize:50}}).then((function(t){var a=t.data;e.contactsLoad--,a.data.some((function(t){if(t.userid===e.userId)return!1;var a=t.az?t.az.toUpperCase():"#";void 0===e.contactsData[a]&&(e.contactsData[a]=[]);var i=e.contactsData[a].findIndex((function(e){return e.userid===t.userid}));i>-1?e.contactsData[a].splice(i,1,t):(e.contactsData[a].push(t),e.contactsList.push(t))})),e.contactsCurrentPage=a.current_page,e.contactsHasMorePages=a.current_page<a.last_page})).catch((function(){e.contactsLoad--,e.contactsHasMorePages=!1}))},formatLastMsg:function(t){if($A.isJson(t))switch(t.type){case"text":return t.msg.text;case"file":return"img"==t.msg.type?"["+this.$L("图片")+"]":"["+this.$L("文件")+"] "+t.msg.name;default:return"["+this.$L("未知的消息")+"]"}return""},lastMsgReadDone:function(t){if($A.isJson(t)){var e=t.userid,a=t.percentage;if(e===this.userId)return 100===a?"md-done-all":"md-checkmark"}return null},scrollIntoActive:function(t){var e=this;this.$nextTick((function(){if(e.$refs.list){var a=e.$refs.list.querySelector(".active");if(a)$A.scrollToView(a,{behavior:!0===t?"smooth":"instant",scrollMode:"if-needed"});else e.cacheDialogs.find((function(t){return t.id==e.dialogId}))&&e.dialogActive&&(e.dialogActive="",e.$nextTick((function(){var a=e.$refs.list.querySelector(".active");a&&$A.scrollToView(a,{behavior:!0===t?"smooth":"instant",scrollMode:"if-needed"})})))}}))},handleRightClick:function(t,e){var a=this;this.handleClickTopOperateOutside(),this.topOperateItem=$A.isJson(e)?e:{},this.$nextTick((function(){var e=a.$refs.dialogWrapper.getBoundingClientRect();a.topOperateStyles={left:"".concat(t.clientX-e.left,"px"),top:"".concat(t.clientY-e.top+100-a.$refs.list.scrollInfo().scrollY,"px")},a.topOperateVisible=!0}))},handleClickTopOperateOutside:function(){this.topOperateVisible=!1},handleTopClick:function(){var t=this;this.$store.dispatch("call",{url:"dialog/top",data:{dialog_id:this.topOperateItem.id}}).then((function(e){var a=e.data;t.$store.dispatch("saveDialog",a),t.$nextTick((function(){t.scrollIntoActive(!1)}))})).catch((function(t){var e=t.msg;$A.modalError(e)}))},updateRead:function(t){var e=this;this.$store.dispatch("call",{url:"dialog/msg/mark",data:{dialog_id:this.topOperateItem.id,type:t}}).then((function(t){var a=t.data;e.$store.dispatch("saveDialog",a)})).catch((function(t){var e=t.msg;$A.modalError(e)}))}}};const c=(0,a(51900).Z)(l,(function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"page-messenger"},[a("PageTitle",{attrs:{title:t.$L("消息")}}),t._v(" "),a("div",{staticClass:"messenger-wrapper"},[a("div",{staticClass:"messenger-select",class:{"show768-menu":0==t.dialogId}},[a("div",{staticClass:"messenger-search"},[a("div",{staticClass:"search-wrapper"},["dialog"===t.tabActive?a("Input",{attrs:{prefix:"ios-search",placeholder:t.$L("搜索..."),clearable:""},model:{value:t.dialogKey,callback:function(e){t.dialogKey=e},expression:"dialogKey"}}):a("Input",{attrs:{prefix:"ios-search",placeholder:t.$L("搜索..."),clearable:""},model:{value:t.contactsKey,callback:function(e){t.contactsKey=e},expression:"contactsKey"}})],1)]),t._v(" "),"dialog"===t.tabActive?a("div",{staticClass:"messenger-nav"},t._l(t.dialogType,(function(e,i){return a("p",{key:i,class:{active:t.dialogActive==e.type},on:{click:function(a){return t.onActive(e.type)}}},[a("Badge",{staticClass:"nav-num",attrs:{count:t.msgUnread(e.type)}}),t._v("\n "+t._s(t.$L(e.name))+"\n ")],1)})),0):t._e(),t._v(" "),a("ScrollerY",{ref:"list",staticClass:"messenger-list",class:t.overlayClass,attrs:{static:""},on:{"on-scroll":t.listScroll}},["dialog"===t.tabActive?a("ul",{ref:"dialogWrapper",staticClass:"dialog"},t._l(t.dialogList,(function(e,i){return a("li",{key:i,ref:"dialog_"+e.id,refInFor:!0,class:{top:e.top_at,active:e.id==t.dialogId,operate:e.id==t.topOperateItem.id&&t.topOperateVisible},on:{click:function(a){return t.openDialog(e,!0)},contextmenu:function(a){return a.preventDefault(),a.stopPropagation(),t.handleRightClick(a,e)}}},["group"==e.type?["project"==e.group_type?a("i",{staticClass:"taskfont icon-avatar project"},[t._v("")]):"task"==e.group_type?a("i",{staticClass:"taskfont icon-avatar task",class:{completed:t.$A.dialogCompleted(e)}},[t._v("")]):a("Icon",{staticClass:"icon-avatar",attrs:{type:"ios-people"}})]:e.dialog_user?a("div",{staticClass:"user-avatar"},[a("UserAvatar",{attrs:{userid:e.dialog_user.userid,size:42}})],1):a("Icon",{staticClass:"icon-avatar",attrs:{type:"md-person"}}),t._v(" "),a("div",{staticClass:"dialog-box"},[a("div",{staticClass:"dialog-title"},[t._l(t.$A.dialogTags(e),(function(e){return"success"!=e.color?[a("Tag",{attrs:{color:e.color,fade:!1}},[t._v(t._s(t.$L(e.text)))])]:t._e()})),t._v(" "),a("span",[t._v(t._s(e.name))]),t._v(" "),"user"==e.type&&t.lastMsgReadDone(e.last_msg)?a("Icon",{attrs:{type:t.lastMsgReadDone(e.last_msg)}}):t._e(),t._v(" "),e.last_at?a("em",[t._v(t._s(t.$A.formatTime(e.last_at)))]):t._e()],2),t._v(" "),a("div",{staticClass:"dialog-text no-dark-mode"},[t._v(t._s(t.formatLastMsg(e.last_msg)))])]),t._v(" "),a("Badge",{staticClass:"dialog-num",attrs:{count:t.$A.getDialogUnread(e)}})],2)})),0):a("ul",{staticClass:"contacts"},[t._l(t.contactsData,(function(e,i){return a("li",[a("div",{staticClass:"label"},[t._v(t._s(i))]),t._v(" "),a("ul",t._l(e,(function(e,i){return a("li",{key:i,on:{click:function(a){return t.openContacts(e)}}},[a("div",{staticClass:"avatar"},[a("UserAvatar",{attrs:{userid:e.userid,size:30}})],1),t._v(" "),a("div",{staticClass:"nickname"},[t._v(t._s(e.nickname))])])})),0)])})),t._v(" "),t.contactsLoad>0?a("li",{staticClass:"loading"},[a("Loading")],1):t.contactsHasMorePages?t._e():a("li",{staticClass:"loaded"},[t._v(t._s(t.$L("共"+t.contactsList.length+"位联系人")))])],2),t._v(" "),a("div",{staticClass:"top-operate",style:t.topOperateStyles},[a("Dropdown",{attrs:{trigger:"custom",visible:t.topOperateVisible,"transfer-class-name":"page-file-dropdown-menu",transfer:""},on:{"on-clickoutside":t.handleClickTopOperateOutside}},[a("DropdownMenu",{attrs:{slot:"list"},slot:"list"},[a("DropdownItem",{nativeOn:{click:function(e){return t.handleTopClick.apply(null,arguments)}}},[t._v("\n "+t._s(t.$L(t.topOperateItem.top_at?"取消置顶":"置顶该聊天"))+"\n ")]),t._v(" "),t.$A.getDialogUnread(t.topOperateItem)>0?a("DropdownItem",{nativeOn:{click:function(e){return t.updateRead("read")}}},[t._v("\n "+t._s(t.$L("标记已读"))+"\n ")]):a("DropdownItem",{nativeOn:{click:function(e){return t.updateRead("unread")}}},[t._v("\n "+t._s(t.$L("标记未读"))+"\n ")])],1)],1)],1)]),t._v(" "),a("div",{staticClass:"messenger-menu"},[a("div",{staticClass:"menu-icon"},[a("Icon",{class:{active:"dialog"===t.tabActive},attrs:{type:"ios-chatbubbles"},on:{click:function(e){t.tabActive="dialog"}}}),t._v(" "),a("Badge",{staticClass:"menu-num",attrs:{count:t.msgUnread("all")}})],1),t._v(" "),a("div",{staticClass:"menu-icon"},[a("Icon",{class:{active:"contacts"===t.tabActive},attrs:{type:"md-person"},on:{click:function(e){t.tabActive="contacts"}}})],1)])],1),t._v(" "),a("div",{staticClass:"messenger-msg"},[a("div",{staticClass:"msg-dialog-bg"},[a("div",{staticClass:"msg-dialog-bg-icon"},[a("Icon",{attrs:{type:"ios-chatbubbles"}})],1),t._v(" "),a("div",{staticClass:"msg-dialog-bg-text"},[t._v(t._s(t.$L("选择一个会话开始聊天")))])]),t._v(" "),t.dialogId>0?a("DialogWrapper",{attrs:{dialogId:t.dialogId},on:{"on-active":t.scrollIntoActive}},[a("div",{staticClass:"dialog-back",attrs:{slot:"inputBefore"},on:{click:t.closeDialog},slot:"inputBefore"},[a("Icon",{attrs:{type:"md-arrow-back"}})],1)]):t._e()],1)])],1)}),[],!1,null,null,null).exports}}]); |