mini.50dacbd5.js 31 KB

1
  1. (function(t){function e(e){for(var s,r,o=e[0],c=e[1],u=e[2],h=0,p=[];h<o.length;h++)r=o[h],i[r]&&p.push(i[r][0]),i[r]=0;for(s in c)Object.prototype.hasOwnProperty.call(c,s)&&(t[s]=c[s]);l&&l(e);while(p.length)p.shift()();return a.push.apply(a,u||[]),n()}function n(){for(var t,e=0;e<a.length;e++){for(var n=a[e],s=!0,o=1;o<n.length;o++){var c=n[o];0!==i[c]&&(s=!1)}s&&(a.splice(e--,1),t=r(r.s=n[0]))}return t}var s={},i={mini:0},a=[];function r(e){if(s[e])return s[e].exports;var n=s[e]={i:e,l:!1,exports:{}};return t[e].call(n.exports,n,n.exports,r),n.l=!0,n.exports}r.m=t,r.c=s,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"===typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var s in t)r.d(n,s,function(e){return t[e]}.bind(null,s));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t["default"]}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="/dist/";var o=window["webpackJsonp"]=window["webpackJsonp"]||[],c=o.push.bind(o);o.push=e,o=o.slice();for(var u=0;u<o.length;u++)e(o[u]);var l=c;a.push([5,"chunk-vendors","chunk-common"]),n()})({"0a84":function(t,e,n){},"24dc":function(t,e,n){},"3abf":function(t,e,n){},5:function(t,e,n){t.exports=n("5b59")},"5b59":function(t,e,n){"use strict";n.r(e);n("cadf"),n("551c"),n("097d");var s=n("2b0e"),i=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{attrs:{id:"app"},on:{mousewheel:function(t){t.stopPropagation()},touchstart:function(t){t.stopPropagation()}}},[n("chat-mini",{attrs:{show:t.show,groupId:t.groupId,width:t.outWidth,height:t.outHeight}})],1)},a=[],r=n("be94"),o=n("2f62"),c=n("33f8"),u=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"mini-wrap"},[n("div",{directives:[{name:"show",rawName:"v-show",value:t.showChat,expression:"showChat"}],staticClass:"mini-body",class:{"moblie-wrap":t.isMobile}},[n("div",{staticClass:"box"},[n("div",{staticClass:"box-hd"},[n("div",{staticClass:"btn-menu",on:{click:function(e){e.stopPropagation(),t.showMenuExtra=!t.showMenuExtra}}}),n("div",{staticClass:"btn-close",on:{click:function(e){t.handleToggleChat(!1)}}}),n("div",{staticClass:"box-title"},[t._v(t._s(t.group.groupName))]),n("div",{staticClass:"user-tips"},[n("em",[t._v(t._s(t.group.userCounts))])]),n("ul",{directives:[{name:"show",rawName:"v-show",value:t.showMenuExtra,expression:"showMenuExtra"}],staticClass:"menu-extra"},[t.account?n("div",{staticClass:"info clearfix"},[n("span",{staticClass:"avatar avatar-bg"},[t._v(t._s(t.account.name.slice(0,2).toUpperCase()))]),n("span",{staticClass:"account-info"},[n("em",[t._v(t._s(t.account.name))]),n("i",{staticClass:"login-out",attrs:{href:"javascript:void(0);"},on:{click:t.handleLogout}},[t._v("注销")])])]):t._e(),t.group.groupId?n("li",[n("a",{attrs:{href:"/mini.html?groupId="+t.group.groupId+"&show=true",target:"_blank"}},[t._v("在新网页中打开聊天"),n("i",{staticClass:"icon-arrow"})])]):t._e(),t._m(0)])]),n("chat-pin",t._b({on:{pinMsgClose:t.pinMsgClose,scrollToView:t.scrollToView}},"chat-pin",t.pinMsg,!1)),n("div",{ref:"msgBox",staticClass:"box-bd"},[n("div",{ref:"scrollWrap",staticClass:"scroller",on:{scroll:function(e){return e.preventDefault(),t.handleScroll(e)}}},[n("div",{ref:"msgWrap",staticClass:"msg-wrap"},[t.lockEnd?n("div",{staticClass:"msg-top-more"},[n("em",[t._v("没有更多了")])]):t._e(),t.lockMore&&!t.lockEnd?n("div",{staticClass:"msg-top-load"},[n("i",{staticClass:"msg-loading-icon"})]):t._e(),t.group.chatList.length?t._l(t.group.pinList,function(e,s){return n("msg-item",t._b({key:"pin"+s,on:{quoteMsg:t.quoteMsg,deleteMsg:t.deleteMsg}},"msg-item",e,!1))}):t._e(),t._l(t.group.chatList,function(e){return n("msg-item",t._b({key:e.hash,attrs:{msgItem:e},on:{quoteMsg:t.quoteMsg,deleteMsg:t.deleteMsg}},"msg-item",e,!1))})],2)]),n("at-me",{staticClass:"mini",attrs:{atList:t.atList},on:{scrollToMsg:t.scrollToMsg}}),t.unreadNums>0&&t.enableScroll?n("div",{staticClass:"msg-unread",on:{click:t.doSetRead}},[n("em",[n("i",{staticClass:"el-icon-d-arrow-right"}),t._v(t._s(t.unreadNums)+"条未读消息")])]):t._e()],1),n("div",{staticClass:"box-ft"},[t.atShow?n("chat-at",{ref:"chatAt",attrs:{curInd:t.atInd,filterList:t.filterMembers},on:{atperson:t.atPerson}}):t._e(),t.showLoginBtn?n("div",{staticClass:"input-ctrl"},["loading"===t.showLoginBtn?n("span",[t._v("登录中...")]):n("span",{staticClass:"enable",on:{click:t.handleLogin}},[t._v("登录")])]):n("div",{staticClass:"input-con"},[n("div",{staticClass:"more-icon",on:{click:function(e){return e.stopPropagation(),t.handleMoreClick(e)}}}),n("form",{staticClass:"input-wrap",on:{submit:t.handleSend}},[n("textarea",{directives:[{name:"model",rawName:"v-model",value:t.inputMsg,expression:"inputMsg"}],ref:"chatInput",style:{height:t.inputHeight},attrs:{cols:"1",rows:"1",placeholder:"Write a message"},domProps:{value:t.inputMsg},on:{keydown:[function(e){return"button"in e||!t._k(e.keyCode,"up",38,e.key,["Up","ArrowUp"])?(e.preventDefault(),t.handleUp(e)):null},function(e){return"button"in e||!t._k(e.keyCode,"down",40,e.key,["Down","ArrowDown"])?(e.preventDefault(),t.handleDown(e)):null},function(e){return"button"in e||!t._k(e.keyCode,"enter",13,e.key,"Enter")?t.handleKeyDown(e):null}],blur:t.handleBlur,input:function(e){e.target.composing||(t.inputMsg=e.target.value)}}})]),n("div",{staticClass:"emoji-icon",on:{click:function(e){return e.stopPropagation(),t.handleEmojiClick(e)}}}),n("div",{staticClass:"btn-send",on:{click:t.handleSend}},[t._v("发送")])]),n("div",{directives:[{name:"show",rawName:"v-show",value:t.toolShow,expression:"toolShow"}],staticClass:"tool-wrap",on:{click:function(t){t.stopPropagation()}}},[n("div",{staticClass:"tool-item"},[n("div",{staticClass:"icon-box",on:{click:t.$packetSend}},[n("i",{staticClass:"packet-icon"})]),n("span",{staticClass:"type"},[t._v("红包")])]),n("div",{staticClass:"tool-item"},[n("div",{staticClass:"icon-box"},[n("i",{staticClass:"picture-icon"}),n("input",{ref:"inputFile1",attrs:{type:"file",name:"res",accept:"image/*"},on:{change:t.handleFile}})]),n("span",{staticClass:"type"},[t._v("图片")])]),n("div",{staticClass:"tool-item"},[n("div",{staticClass:"icon-box"},[n("i",{staticClass:"audio-icon"}),n("input",{ref:"inputFile2",attrs:{type:"file",name:"res",accept:"audio/*"},on:{change:t.handleFile}})]),n("span",{staticClass:"type"},[t._v("音频")])]),n("div",{staticClass:"tool-item"},[n("div",{staticClass:"icon-box"},[n("i",{staticClass:"video-icon"}),n("input",{ref:"inputFile3",attrs:{type:"file",name:"res",accept:"video/*"},on:{change:t.handleFile}})]),n("span",{staticClass:"type"},[t._v("视频")])])]),t.showEmoji?n("div",{staticClass:"emoji-wrap"},[n("emoji-list",{on:{addEmoji:t.addEmoji}})],1):t._e()],1)],1)]),n("div",{directives:[{name:"show",rawName:"v-show",value:!t.showChat,expression:"!showChat"}],staticClass:"mini-control",on:{click:function(e){t.handleToggleChat(!0)}}},[n("i",{directives:[{name:"show",rawName:"v-show",value:t.atList.length,expression:"atList.length"}],staticClass:"at-tip"},[t._v("@")]),t.unreadCounts>0?n("ul",[n("li",{staticClass:"msg-tips"},[n("em",[t._v("+"+t._s(t.unreadCounts))])]),n("li",{staticClass:"user-tips"},[n("em",[t._v(t._s(t.group.userCounts))])])]):n("div",{staticClass:"meechat-icon"},[n("i",{staticClass:"user-tips"},[n("em",[t._v(t._s(t.group.userCounts))])])])])])},l=[function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("li",[n("a",{attrs:{href:"https://www.mee.chat/",target:"_blank"}},[t._v("官网:www.mee.chat")])])}],h=(n("20d6"),n("ac6a"),n("5df3"),n("1c4c"),n("0fb7"),n("450d"),n("f529")),p=n.n(h),d=(n("7514"),n("96cf"),n("1da1")),m=(n("4917"),n("a481"),n("c5f6"),n("2f35")),f=n("4e81"),g=n("a1aa"),v=n("9360"),w=n("34d0"),b=n("e332"),k=n("76a4"),y=n("53ca");function C(t){if(t)return _(t)}function _(t){for(var e in C.prototype)t[e]=C.prototype[e];return t}function x(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"*",n=arguments.length>1?arguments[1]:void 0;if(!(this instanceof x))return new x(e,n);e&&"object"===Object(y["a"])(e)&&(n=e,e=void 0),C(this),n=n||{},n.path=n.path||"/",this.opts=n,this.target=e,this.requestQueue={},window.addEventListener("message",function(e){t.msgHandler(e)},!1)}C.prototype.on=C.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},C.prototype.once=function(t,e){function n(){this.off(t,n),e.apply(this,arguments)}return n.fn=e,this.on(t,n),this},C.prototype.off=C.prototype.removeListener=C.prototype.removeAllListeners=C.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0===arguments.length)return this._callbacks={},this;var n,s=this._callbacks["$"+t];if(!s)return this;if(1===arguments.length)return delete this._callbacks["$"+t],this;for(var i=0;i<s.length;i++)if(n=s[i],n===e||n.fn===e){s.splice(i,1);break}return this},C.prototype.emit=function(t){this._callbacks=this._callbacks||{};var e=[].slice.call(arguments,1),n=this._callbacks["$"+t];if(n){n=n.slice(0);for(var s=0,i=n.length;s<i;++s)n[s].apply(this,e)}return this},C.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]},C.prototype.hasListeners=function(t){return!!this.listeners(t).length},x.prototype.send=function(t,e){var n=this;return t.reqId=(new Date).getTime(),window.parent.postMessage(t,this.target),new Promise(function(s,i){n.on("res_".concat(t.reqId),function(t){t&&t.data&&t.data.response?s(t.data.response):i(t.data.error),e&&e(t)})})},x.prototype.msgHandler=function(t){var e=t.data.resId;e?this.emit("res_".concat(e),t):this.opts["callback"]&&this.opts["callback"](t.data)};var S=x,M=n("8476"),L=n("b16d"),I=n("8869"),O={name:"chatMini",mixins:[I["a"]],components:{msgItem:m["a"],emojiList:f["a"],chatAt:g["a"],chatPin:w["a"],atMe:v["a"]},props:{width:{type:Number,default:274},height:{type:Number,default:390},show:{type:Boolean,default:!1},groupId:[Number,String]},computed:Object(r["a"])({},Object(o["d"])(["account","group","userId","userInfo"]),Object(o["d"])({chatInputFocus:function(t){return t.group.chatInputFocus},blockList:function(t){return t.group.blockList},pinMsg:function(t){return t.group.pinMsg},pinList:function(t){return t.group.pinList},atList:function(t){return t.group.atList},unreadNums:function(t){return t.group.unreadNums}}),{filterMembers:function(){var t=this.inputMsg.replace("@",""),e=this.group.members,n=[];for(var s in e)s!=this.userId&&-1===t.indexOf(e[s].nick_name)&&n.push(e[s]);return n},atShow:function(){return this.inputMsg.match(/@$/)&&this.filterMembers.length}}),data:function(){return{isMobile:Object(c["n"])(),showChat:!!this.show,showEmoji:!1,showMenuExtra:!1,showLoginBtn:!0,lockMore:!1,isScrollToView:!1,lockEnd:!1,loading:!1,unreadCounts:0,inputMsg:"",atInd:0,inputHeight:18,enableScroll:!1,isBottom:!0,toolShow:!1}},watch:{inputMsg:function(t,e){var n=this,s=this.$refs.chatInput;this.inputHeight="auto",this.$refs.scrollWrap.style.overflowY="hidden",this.$nextTick(function(){n.inputHeight=Math.max(18,Math.min(s.scrollHeight,75))+"px"})},unreadNums:function(t,e){t>0&&this.isBottom&&this.resizeToBottom()},chatInputFocus:function(t,e){if(!this.showLoginBtn){var n=this.$refs.chatInput;t?document.activeElement!==n&&(this.placeEnd(n),n.focus()):document.activeElement===n&&n.blur()}}},mounted:function(){var t=Object(d["a"])(regeneratorRuntime.mark(function t(){var e,n,s,i,a=this;return regeneratorRuntime.wrap(function(t){while(1)switch(t.prev=t.next){case 0:if(e=function(t){"meechat:setShow"===t.action?a.handleToggleChat(t.show):"meechat:logout"===t.action&&a.handleLogout2()},this.postMessager=new S("*",{callback:e}),window.postMessager=this.postMessager,this.initGroup({userId:this.userId,groupId:this.groupId,useCache:!1}),n=localStorage.getItem("user_id"),s=localStorage.getItem("token"),i=localStorage.getItem("account"),!(n&&s&&i)){t.next=14;break}return this.setUserId(n),this.setToken(s),this.setAccount(JSON.parse(i)),this.showLoginBtn=!1,t.next=14,this.getUserInfo();case 14:this.$nextTick(this.initChat),this.$nextTick(this.initSocket),document.addEventListener("contextmenu",function(t){return t.preventDefault()}),document.addEventListener("paste",this.initPaste),document.addEventListener("drop",this.initDrop),document.addEventListener("dragover",this.initDragOver),document.body.addEventListener("click",function(){a.showEmoji=!1,a.showMenuExtra=!1,a.toolShow=!1});case 21:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}(),beforeDestroy:function(){document.removeEventListener("paste",this.initPaste),document.removeEventListener("drop",this.initDrop),document.removeEventListener("dragover",this.initDragOver)},methods:Object(r["a"])({},Object(o["c"])(["initGroup","setUserId","setToken","addChatItem","deleteChatItem","updateChatInputFocus","updateGroupBlockList","updateMembers","updateGroupPinMsg","repealChatItem","clearAtList","initState","addPacketItem","addPacketTip","addUnreadNums","resetUnreadNums"]),Object(o["b"])(["getUserInfo","setScatter","setAccount","doGameLogin","doScatterLogin","doScatterLogout","getGroupInfo","getNewMsg","getHistoryMsg","doSendMsg","doSendFile","doContractLogin"]),{handleMoreClick:function(){this.showEmoji=!1,this.toolShow=!this.toolShow},handleEmojiClick:function(){this.toolShow=!1,this.showEmoji=!this.showEmoji},initSocket:function(){var t=this;if(window.WebSocket){var e=Object(b["a"])()+"?group_id=".concat(this.groupId);this.socket&&(this.socket.destroy(),this.socket=null),this.socket=new k["a"](e,{autoConnect:!0,reconnection:!0,reconnectionDelay:2e3}),this.socket.on("open",function(t){}),this.socket.on("message",function(e){e=JSON.parse(e),e.channel.match("chat:group")&&("msg"===e.data.type&&e.data.from!=t.userId&&(t.getNewMsg(),t.showChat?t.addUnreadNums():(0===t.unreadCounts&&t.postResize(130,50),t.unreadCounts++)),"repeal"===e.data.type&&t.repealChatItem(e.data),"block"===e.data.type&&t.updateGroupBlockList({type:"add",id:e.data.to}),"unblock"===e.data.type&&t.updateGroupBlockList({type:"delete",id:e.data.to}),"join"===e.data.type&&t.updateMembers(e.data.user_info),"pin_msg"===e.data.type&&t.updateGroupPinMsg(e.data.pinMsg),"unpin_msg"===e.data.type&&t.updateGroupPinMsg(null),"new_redpack"===e.data.type&&(t.addPacketItem(e.data),e.data.from==t.userId&&t.$nextTick(t.resizeToBottom)),"grab_redpack"===e.data.type&&(e.data.from!=t.userId&&e.data.to!=t.userId||t.addPacketTip(e.data)))})}else console.log("Error: WebSocket is not supported .")},initChat:function(){var t=Object(d["a"])(regeneratorRuntime.mark(function t(){return regeneratorRuntime.wrap(function(t){while(1)switch(t.prev=t.next){case 0:return this.handleToggleChat(this.show),t.next=3,this.getGroupInfo();case 3:return t.next=5,this.getNewMsg();case 5:this.show&&this.$nextTick(this.resizeToBottom);case 6:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}(),handleLogout:function(){var t=Object(d["a"])(regeneratorRuntime.mark(function t(){return regeneratorRuntime.wrap(function(t){while(1)switch(t.prev=t.next){case 0:this.doScatterLogout(),this.showLoginBtn=!0,self!==top&&(localStorage.removeItem("account"),this.postMessager.send({action:"meechat:logout"})),location.replace(location.href.replace("show=false","show=true"));case 4:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}(),handleLogout2:function(){var t=Object(d["a"])(regeneratorRuntime.mark(function t(){return regeneratorRuntime.wrap(function(t){while(1)switch(t.prev=t.next){case 0:this.doScatterLogout(),this.showLoginBtn=!0;case 2:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}(),handleLogin:function(){var t=Object(d["a"])(regeneratorRuntime.mark(function t(){var e=this;return regeneratorRuntime.wrap(function(t){while(1)switch(t.prev=t.next){case 0:this.showLoginBtn="loading",self!==top?this.handleParentLogin():M["a"].scatter.connect("MEE_CHAT").then(function(){var t=Object(d["a"])(regeneratorRuntime.mark(function t(n){return regeneratorRuntime.wrap(function(t){while(1)switch(t.prev=t.next){case 0:if(!n){t.next=18;break}return t.prev=1,e.setScatter(M["a"].scatter),window.ScatterJS=null,t.next=6,e.doScatterLogin();case 6:return localStorage.setItem("account",JSON.stringify(e.account)),t.next=9,e.doGameLogin();case 9:return e.showLoginBtn=!1,e.initGroup({userId:e.userId,groupId:e.groupId,useCache:!1}),t.next=13,e.getUserInfo();case 13:t.next=18;break;case 15:t.prev=15,t.t0=t["catch"](1),e.showLoginBtn=!0;case 18:case"end":return t.stop()}},t,this,[[1,15]])}));return function(e){return t.apply(this,arguments)}}());case 2:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}(),getParentIdentity:function(){var t=Object(d["a"])(regeneratorRuntime.mark(function t(){var e,n;return regeneratorRuntime.wrap(function(t){while(1)switch(t.prev=t.next){case 0:if(self===top){t.next=13;break}return t.prev=1,t.next=4,this.postMessager.send({action:"meechat:getIdentity"});case 4:e=t.sent,n=e.accounts.find(function(t){return"eos"===t.blockchain}),localStorage.setItem("account",JSON.stringify(n)),this.setAccount(n),t.next=13;break;case 10:t.prev=10,t.t0=t["catch"](1),this.showLoginBtn=!0;case 13:case"end":return t.stop()}},t,this,[[1,10]])}));return function(){return t.apply(this,arguments)}}(),handleParentLogin:function(){var t=Object(d["a"])(regeneratorRuntime.mark(function t(){var e,n;return regeneratorRuntime.wrap(function(t){while(1)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.getParentIdentity();case 3:if(this.account){t.next=5;break}return t.abrupt("return");case 5:return t.next=7,this.doContractLogin();case 7:location.replace(location.href.replace("show=false","show=true")),t.next=14;break;case 10:t.prev=10,t.t0=t["catch"](0),t.t0.type||(e=JSON.parse(t.t0),n=e.error.details,p()({message:n[0].message,type:"error"})),this.showLoginBtn=!0;case 14:case"end":return t.stop()}},t,this,[[0,10]])}));return function(){return t.apply(this,arguments)}}(),resizeToBottom:function(){this.$refs.scrollWrap.scrollTop=this.$refs.msgWrap.offsetHeight,this.resetUnreadNums(),this.isBottom=!0},doSetRead:function(){this.resizeToBottom()},addEmoji:function(t){this.inputMsg+=t},handleScroll:function(t){var e=this;if(this.enableScroll=!0,t.target.focus(),this.group.chatList.length&&!this.isScrollToView){var n=this.$refs.msgWrap,s=n.offsetHeight,i=t.target.scrollTop;0!==i||this.lockMore||null!==this.group.endHash&&(this.lockMore=!0,this.getHistoryMsg().then(function(a){if("end"===a)e.lockEnd=!0;else{var r=s-i;e.$nextTick(function(){t.target.scrollTop=n.offsetHeight-r,e.ps&&e.ps.update(),setTimeout(function(){e.lockMore=!1},800)})}})),i+t.target.offsetHeight>s?(this.isBottom=!0,this.unreadNums&&this.resetUnreadNums()):this.isBottom=!1}},handleSend:function(){var t=Object(d["a"])(regeneratorRuntime.mark(function t(e){var n,s,i,a=this;return regeneratorRuntime.wrap(function(t){while(1)switch(t.prev=t.next){case 0:if(!this.blockList.some(function(t){return t==a.userId})){t.next=3;break}return p()({message:"您已被禁言",type:"error"}),t.abrupt("return");case 3:if(n=this.inputMsg.trim(),0!==n.length){t.next=7;break}return p()({message:"聊天内容不能为空",type:"warning"}),t.abrupt("return");case 7:if(s={type:0,msg:n},this.inputMsg="",!this.group.members[this.userId]){t.next=16;break}i=Date.now(),this.addChatItem({from:this.userId,content:n,hash:"".concat(i),timestamp:i,createTime:i,msg_type:"0",loading:!0}),s.createTime=i,this.doSendMsg(s),t.next=18;break;case 16:return t.next=18,this.doSendMsg(s);case 18:return this.$nextTick(function(){this.resizeToBottom()}),e.preventDefault(),t.abrupt("return",!1);case 21:case"end":return t.stop()}},t,this)}));return function(e){return t.apply(this,arguments)}}(),handleBlur:function(){this.$refs.scrollWrap.style.overflowY="scroll",this.updateChatInputFocus(!1)},placeEnd:function(t){var e=document.createRange();e.selectNodeContents(t),e.collapse(!1);var n=window.getSelection();n.removeAllRanges(),n.addRange(e)},initDrop:function(t){var e=this;t.preventDefault();var n=Array.from(t.dataTransfer.files);n.forEach(function(t){return e.handleFile(t)})},initDragOver:function(t){t.preventDefault()},initPaste:function(t){var e=this,n=(t.clipboardData||window.clipboardData).items;n&&n.length&&Array.from(n).forEach(function(t){var n=t.getAsFile();n&&e.handleFile(n)})},preHandleFile:function(){var t=Object(d["a"])(regeneratorRuntime.mark(function t(e){var n,s,i;return regeneratorRuntime.wrap(function(t){while(1)switch(t.prev=t.next){case 0:if(n=e.type,s=e.size,!n.match("video")){t.next=6;break}return t.abrupt("return",s>3145728?Promise.reject(new Error(e)):Promise.resolve({type:2,res:e}));case 6:if(!n.match("audio")){t.next=10;break}return t.abrupt("return",s>2097152?Promise.reject(new Error(e)):Promise.resolve({type:3,res:e}));case 10:if(!n.match("image")){t.next=15;break}return t.next=13,new L["a"]({file:e,maxSize:1048576});case 13:return i=t.sent,t.abrupt("return",{type:1,preview:i.base64,res:i.res});case 15:case"end":return t.stop()}},t,this)}));return function(e){return t.apply(this,arguments)}}(),handleFile:function(){var t=Object(d["a"])(regeneratorRuntime.mark(function t(e){var n,s,i,a,r=this;return regeneratorRuntime.wrap(function(t){while(1)switch(t.prev=t.next){case 0:return n=e.constructor===File?e:e.target.files[0],t.prev=1,t.next=4,this.preHandleFile(n);case 4:s=t.sent,i={res:s.res},this.group.members[this.userId]&&(a=Date.now(),this.addChatItem({content:s.preview||"",from:this.userId,hash:"".concat(a),msg_type:s.type,timestamp:a,res:s.res,loading:!0,createTime:a}),i.createTime=a),this.doSendFile(i),this.toolShow=!1,this.toolShow=!1,setTimeout(function(){r.$refs.inputFile1.value=null,r.$refs.inputFile2.value=null,r.$refs.inputFile3.value=null,r.resizeToBottom()},100),t.next=16;break;case 13:t.prev=13,t.t0=t["catch"](1),p()({message:"上传文件大小限制:音频2M以内,视频3M以内",type:"warning"});case 16:case"end":return t.stop()}},t,this,[[1,13]])}));return function(e){return t.apply(this,arguments)}}(),handleToggleChat:function(t){var e=this;t?(this.showChat=!0,this.unreadCounts=0,this.$nextTick(function(){e.postResize(e.width,e.height+16),e.resizeToBottom()})):(this.showChat=!1,this.$nextTick(function(){e.postResize(56,50)}))},postResize:function(t,e){var n={action:"meechat:resize",data:{ch:e,cw:t}};return window.parent.postMessage(n,"*")},handleKeyDown:function(t){if(!this.atShow)return t.altKey||t.ctrlKey?this.inputMsg=this.inputMsg+"\n":(t.returnValue=!1,this.handleSend(t)),!1;t.preventDefault();var e=this.filterMembers[this.atInd];this.atPerson(e.user_name)},quoteMsg:function(t){this.inputMsg=t},deleteMsg:function(t){this.deleteChatItem(t)},pinMsgClose:function(){this.pinMsg.visible=!1},scrollToView:function(){var t=this;if(this.pinList.length){var e=this.$refs.msgWrap.querySelector(".msg-item");Object(c["p"])(this.$refs.scrollWrap,e.offsetTop-(this.pinMsg?40:10),e)}else{var n=this.pinMsg.hash,s=this.group.chatList.findIndex(function(t){return t.hash===n});if(s>=0){var i=this.$refs.msgWrap.querySelectorAll(".msg-item").item(s);Object(c["p"])(this.$refs.scrollWrap,i.offsetTop-(this.pinMsg?40:10),i)}}this.isScrollToView=!0,setTimeout(function(){t.isScrollToView=!1},2e3)},scrollToMsg:function(t){var e=this.atList[t].hash,n=this.group.chatList.findIndex(function(t){return t.hash===e});if(n>=0){var s=this.group.pinList.length,i=this.$refs.msgWrap.querySelectorAll(".msg-item").item(n+s);Object(c["p"])(this.$refs.scrollWrap,i.offsetTop-(this.pinMsg?40:10),i)}this.clearAtList()}})},j=O,T=(n("ff70"),n("2877")),E=Object(T["a"])(j,u,l,!1,null,"c7e4d298",null);E.options.__file="chatMini.vue";var N=E.exports,$={name:"App",components:{chatMini:N},data:function(){var t=Object(c["m"])("width")||window.innerWidth,e=Object(c["m"])("height")||window.innerHeight-16;return{show:"true"===Object(c["m"])("show"),groupId:Object(c["m"])("groupId")||1e4,outWidth:parseInt(t),outHeight:parseInt(e)}},methods:Object(r["a"])({},Object(o["c"])(["setPublicKey"]),Object(o["b"])(["setScatter","setAccount","doScatterLogin"])),created:function(){}},P=$,B=(n("70ed"),Object(T["a"])(P,i,a,!1,null,null,null));B.options.__file="App.vue";var R=B.exports,F=n("1c04"),D=n("4eb5"),A=n.n(D),H=n("21f7"),W=n("8f20"),z=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("transition",{attrs:{name:"msgbox-fade"}},[t.visible?n("div",{staticClass:"pub-modal-mask pub-scroll-box"},[n("div",{staticClass:"send-wrap"},[n("i",{staticClass:"el-icon-close",on:{click:function(e){t.visible=!1}}}),n("i",{staticClass:"el-icon-question",on:{click:function(e){t.helpShow=!0}}}),n("h3",{staticClass:"title"},[t._v("发红包")]),n("p",{staticClass:"redpacket-tips",class:{hidden:!t.tips}},[t._v(t._s(t.tips))]),n("div",{staticClass:"main-box"},[n("div",{staticClass:"input-item"},[1==t.packetType?n("span",{staticClass:"text"},[t._v("单个金额")]):n("span",{staticClass:"text"},[n("em",[t._v("拼")]),t._v("总金额\n ")]),n("div",{staticClass:"box"},[n("input",{directives:[{name:"model",rawName:"v-model.number",value:t.money,expression:"money",modifiers:{number:!0}}],attrs:{type:"number",placeholder:"0.00"},domProps:{value:t.money},on:{input:function(e){e.target.composing||(t.money=t._n(e.target.value))},blur:function(e){t.$forceUpdate()}}}),n("span",{staticClass:"unit"},[t._v("EOS")])])]),2==t.packetType?n("p",{staticClass:"input-tips"},[t._v("\n 当前为拼手气红包\n ")]):t._e(),n("div",{staticClass:"input-item"},[n("span",{staticClass:"text"},[t._v("红包个数")]),n("div",{staticClass:"box"},[n("input",{directives:[{name:"model",rawName:"v-model.number",value:t.packetNum,expression:"packetNum",modifiers:{number:!0}}],attrs:{type:"number",placeholder:"请填写个数"},domProps:{value:t.packetNum},on:{input:function(e){e.target.composing||(t.packetNum=t._n(e.target.value))},blur:function(e){t.$forceUpdate()}}}),n("span",{staticClass:"unit"},[t._v("个")])])]),n("p",{staticClass:"group-user-num"},[t._v("\n 本群共"+t._s(t.group.userCounts)+"人\n ")]),n("textarea",{directives:[{name:"model",rawName:"v-model",value:t.word,expression:"word"}],staticClass:"words",attrs:{placeholder:"恭喜发财,大吉大利"},domProps:{value:t.word},on:{input:function(e){e.target.composing||(t.word=e.target.value)}}}),n("div",{staticClass:"sum"},[t._v("\n "+t._s(t.amountSum)+" "),n("span",[t._v("EOS")])]),n("button",{staticClass:"send-btn",class:{"is-disable":!t.amountSum||!t.packetNum,loading:t.isLoading},on:{click:t.sendPacket}},[t.isLoading?n("i",{staticClass:"el-icon-loading"}):t._e(),t._v(" 塞钱进红包\n ")])]),n("p",{staticClass:"bot"},[t._v("未领取的红包,将于24小时后发起退款")])]),n("div",{directives:[{name:"show",rawName:"v-show",value:t.helpShow,expression:"helpShow"}],staticClass:"help-wrap"},[n("i",{staticClass:"el-icon-close",on:{click:function(e){t.helpShow=!1}}}),n("h3",{staticClass:"title"},[t._v("帮助")]),n("div",{staticClass:"content"},[n("div",{staticClass:"item"},[t._v("\n 1. 发出的红包均为拼手气红包,抢得的\n 红包金额随机;一次最多发100个红包;\n ")]),n("div",{staticClass:"item"},[t._v("\n 2. 发红包时可选择币种;抢到的红包金额\n 直接转账到对应币种的绑定账户;若未绑\n 定账户,则所得币种余额在绑定账户后即\n 刻转账;\n ")]),n("div",{staticClass:"item"},[t._v("\n 3. MeeChat会从每次发出红包的金额中收\n 取2%的手续费,用于支付上链成本\n ")])])])]):t._e()])},U=[],q=(n("7f7f"),n("3835")),G=n("5fe9"),J=n.n(G),V={transfer:function(t,e,n,s,i){var a="transfer",r={authorization:["".concat(t,"@").concat(i)]};return self!==top?K(a,[t,e,n,s,r]):window.EOS[a](t,e,n,s,r)},getCurrencyBalance:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"EOS",s="getCurrencyBalance";return self!==top?K(s,[t,e,n]):window.EOS.getCurrencyBalance(t,e,n)}};function K(t,e,n){return window.postMessager.send({action:"meechat:eosAction",data:{code:n,action:t,param:e}})}var Y=V,Q={name:"packetSend",data:function(){return{helpShow:!1,money:1,packetNum:1,word:"恭喜发财,大吉大利",tips:"",isLoading:!1,packetType:2}},computed:Object(r["a"])({},Object(o["d"])(["account","group"]),{amountSum:function(){return this.money}}),watch:{money:function(t){t>200&&(this.money=200,this.showTip("总金额 不能多于 200 EOS")),t&&t/this.packetNum<.01&&(this.money=J.a.times(this.packetNum,.01),this.showTip("单个红包最小为 0.01 EOS"))},packetNum:function(t,e){this.money&&J.a.divide(this.money,t)<.01&&(this.packetNum=e,this.showTip("单个红包最小为 0.01 EOS")),t>100&&(this.packetNum=100,this.showTip("红包个数最大为 100 个"))}},methods:{showTip:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3e3;this.tips=t,setTimeout(function(){e.tips=""},n)},sendPacket:function(){var t=Object(d["a"])(regeneratorRuntime.mark(function t(){var e,n,s,i,a,r,o,c,u=this;return regeneratorRuntime.wrap(function(t){while(1)switch(t.prev=t.next){case 0:if(!(this.money<.1)){t.next=3;break}return this.showTip("总金额 不能少于 0.1 EOS"),t.abrupt("return",!1);case 3:return e=this.amountSum.toFixed(4)+" EOS",n="meechatadmin",s={type:"redpack",num:this.packetNum,memo:this.word,sid:this.group.groupId},this.isLoading=!0,t.next=9,Y.getCurrencyBalance("eosio.token",this.account.name,"EOS");case 9:if(i=t.sent,a=Object(q["a"])(i,1),r=a[0],!r){t.next=22;break}if(o=Number(r.replace(/\sEOS/,"")).toFixed(4),!(this.amountSum>o)){t.next=18;break}return p()({message:"账户EOS不足",type:"error"}),this.isLoading=!1,t.abrupt("return");case 18:c=Y.transfer(this.account.name,n,e,JSON.stringify(s),this.account.authority),c.then(function(t){u.visible=!1}).catch(function(t){if("signature_rejected"===t.type);else{"string"===typeof t&&(t=JSON.parse(t));var e=t.error.details;p()({message:e[0].message,type:"error"})}}).finally(function(){u.isLoading=!1}),t.next=24;break;case 22:p()({message:"网络太差~ 请重试",type:"error"}),this.isLoading=!1;case 24:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}()},mounted:function(){}},X=Q,Z=(n("923d"),Object(T["a"])(X,z,U,!1,null,"49c0fd5a",null));Z.options.__file="index.vue";var tt=Z.exports;tt.install=function(t,e){var n,s=t.extend(tt);t.prototype.$packetSend=function(){n&&(document.body.removeChild(n.$el),n=null),n=new s({el:document.createElement("div"),computed:{$store:function(){return e}},data:function(){return{visible:!0}}}),document.body.appendChild(n.$el)}};var et=tt,nt=n("5a09"),st=n("682a"),it=n.n(st);function at(t){requestAnimationFrame(at),it.a.update(t)}s["default"].use(A.a),s["default"].use(H["a"]),s["default"].use(nt["a"],F["a"]),s["default"].use(W["a"],F["a"]),s["default"].use(et,F["a"]),s["default"].config.productionTip=!1,new s["default"]({render:function(t){return t(R)},store:F["a"]}).$mount("#app"),requestAnimationFrame(at)},"70ed":function(t,e,n){"use strict";var s=n("3abf"),i=n.n(s);i.a},"923d":function(t,e,n){"use strict";var s=n("24dc"),i=n.n(s);i.a},ff70:function(t,e,n){"use strict";var s=n("0a84"),i=n.n(s);i.a}});