diff --git a/app.js b/app.js index ae201e6..c0e22cb 100644 --- a/app.js +++ b/app.js @@ -1,5 +1,6 @@ // app.js -import GoEasyIM from './utils/goeasy-im-1.5.1.js'; +import GoEasyIM from './static/lib/goeasy-im-1.5.1.js'; + App({ onLaunch: function () { wx.im = GoEasyIM.getInstance({ diff --git a/app.json b/app.json index 1b0f381..7fa7384 100644 --- a/app.json +++ b/app.json @@ -2,7 +2,14 @@ "pages":[ "pages/index/index", "pages/ltjm/ltjm", - "pages/liaotian/liaotian" + "pages/liaotian/liaotian", + "pages/conversations/conversations", + "pages/login/login", + "pages/contacts/contacts", + "pages/mine/mine", + "pages/chat/groupChat/groupChat", + "pages/chat/privateChat/privateChat", + "pages/chat/groupMember/groupMember" ], "tabBar":{ "color": "#f00", @@ -12,8 +19,12 @@ "pagePath": "pages/index/index", "text": "首页" },{ - "pagePath": "pages/liaotian/liaotian", - "text": "聊天" + "pagePath" : "pages/conversations/conversations", + "text":"信息" + }, + { + "pagePath" : "pages/contacts/contacts", + "text" : "通讯录" }] }, "window":{ diff --git a/components/GoEasyAudioPlayer/goEasyAudioPlayer.js b/components/GoEasyAudioPlayer/goEasyAudioPlayer.js new file mode 100644 index 0000000..6ba0d5e --- /dev/null +++ b/components/GoEasyAudioPlayer/goEasyAudioPlayer.js @@ -0,0 +1,63 @@ +Component({ + options: { + addGlobalClass: true, + }, + properties: { + src: { + type: String, + value: "" + }, + duration: { + type: Number, + value: 0 + } + }, + data: { + width: "", + play: false, + finalDuration: "", + audioContext: null + }, + methods: { + playAudio() { + // 播放时才创建audioContext,播放完毕销毁 + var self = this; + this.setData({ + audioContext: wx.createInnerAudioContext() + }); + this.data.audioContext.src = this.data.src; + this.switchAudioState(); + setTimeout(() => { + self.switchAudioState(); + self.data.audioContext.destroy(); + }, self.data.finalDuration*1000); + + this.data.audioContext.play(); + this.data.audioContext.onPlay(()=>{ + console.log("正在播放......"); + }); + this.data.audioContext.onError((res) => { + console.log("audio error:",res) + }); + }, + switchAudioState(){ + this.setData({ + play: !this.data.play + }); + }, + }, + attached: function() { + // 在组件实例进入页面节点树时执行 + this.setData({ + width: Math.ceil(this.data.duration)*7+80, + finalDuration: Math.ceil(this.data.duration), + }); + }, + detached: function() { + // 在组件实例被从页面节点树移除时执行 + // 语音还在播放时退出该界面时audioContext还没有被销毁,因此调用该方法清空audioContext + if(this.data.audioContext != null){ + this.data.audioContext.destroy(); + } + }, +}) diff --git a/components/GoEasyAudioPlayer/goEasyAudioPlayer.json b/components/GoEasyAudioPlayer/goEasyAudioPlayer.json new file mode 100644 index 0000000..a89ef4d --- /dev/null +++ b/components/GoEasyAudioPlayer/goEasyAudioPlayer.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} diff --git a/components/GoEasyAudioPlayer/goEasyAudioPlayer.wxml b/components/GoEasyAudioPlayer/goEasyAudioPlayer.wxml new file mode 100644 index 0000000..faa691e --- /dev/null +++ b/components/GoEasyAudioPlayer/goEasyAudioPlayer.wxml @@ -0,0 +1,7 @@ + + + + + {{finalDuration}} + + diff --git a/components/GoEasyAudioPlayer/goEasyAudioPlayer.wxss b/components/GoEasyAudioPlayer/goEasyAudioPlayer.wxss new file mode 100644 index 0000000..64d470d --- /dev/null +++ b/components/GoEasyAudioPlayer/goEasyAudioPlayer.wxss @@ -0,0 +1,34 @@ + +.goeasy-audio-player { + -webkit-tap-highlight-color: rgba(0, 0, 0, 0); +} + +.audio-facade { + display: flex; + align-items: center; + min-width: 80rpx; + max-width: 300rpx; + height: 60rpx; + padding: 6rpx 10rpx; + border-radius: 14rpx; + line-height: 30rpx; + background: #D02129; + font-size: 24rpx; + color: #ffffff; +} + +.audio-facade .audio-play-icon { + -moz-transform: rotate(180deg); + -webkit-transform: rotate(180deg); + -o-transform: rotate(180deg); + transform: rotate(180deg); +} + +.audio-facade-bg { + width: 40rpx; + height: 35rpx; +} + +.record-second { + padding-left: 14rpx; +} \ No newline at end of file diff --git a/components/GoEasyCustomMessage/customMessage.js b/components/GoEasyCustomMessage/customMessage.js new file mode 100644 index 0000000..6f7e50c --- /dev/null +++ b/components/GoEasyCustomMessage/customMessage.js @@ -0,0 +1,49 @@ +/* customMessage.js */ +Component({ + data: { + to: null,//接收方 + type: "", //私聊还是群聊 + show: false,//是否展示自定义消息组件 + + goods : '', + price : '', + number : '' + }, + methods:{ + setNumber(e){ + this.setData({ + number: e.detail.value + }); + }, + setGoods(e){ + this.setData({goods: e.detail.value}); + }, + setPrice(e){ + this.setData({ + price: e.detail.value + }); + }, + createCustomMessage () { + let customMessage = wx.im.createCustomMessage({ + type : 'order', + payload : { + number : this.data.number, + goods : this.data.goods, + price : this.data.price + }, + to: { + id : this.data.to.uuid, + type : this.data.type, + data : {name : this.data.to.name, avatar: this.data.to.avatar} + } + }); + this.triggerEvent("sendCustomMessage",customMessage); + this.close(); + }, + close () { + this.setData({ + show: false + }); + } + } +}) diff --git a/components/GoEasyCustomMessage/customMessage.json b/components/GoEasyCustomMessage/customMessage.json new file mode 100644 index 0000000..d507499 --- /dev/null +++ b/components/GoEasyCustomMessage/customMessage.json @@ -0,0 +1,5 @@ +{ + "component": true, + "usingComponents":{}, + "navigationBarTitleText": "自定义消息" +} \ No newline at end of file diff --git a/components/GoEasyCustomMessage/customMessage.wxml b/components/GoEasyCustomMessage/customMessage.wxml new file mode 100644 index 0000000..3ba2596 --- /dev/null +++ b/components/GoEasyCustomMessage/customMessage.wxml @@ -0,0 +1,29 @@ + + + + 发送订单 + + + 编号: + 商品: + 金额: + + + + + + + + + + + + + 取消 + 发送 + + + + + + diff --git a/components/GoEasyCustomMessage/customMessage.wxss b/components/GoEasyCustomMessage/customMessage.wxss new file mode 100644 index 0000000..1c77a71 --- /dev/null +++ b/components/GoEasyCustomMessage/customMessage.wxss @@ -0,0 +1,78 @@ +/* customMessage.wxss */ +.goeasy-custom-message { + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; + z-index: 10000; + background: #fff; +} + +.custom-message-box { + padding: 0 40rpx; +} + +.goeasy-custom-message-title { + text-align: center; + font-weight: 600; + font-size: 40rpx; + line-height: 200rpx; + color: #000000; +} + +.content { + display: flex; + justify-content: center; +} + +.order-item { + display: flex; + align-items: center; + height: 80rpx; + margin-top: 40rpx; +} + +.order-input { + height: 80rpx; + margin-top: 40rpx; +} + +.input { + width: 500rpx; + height: 80rpx; + padding: 10rpx; + border-radius: 10rpx; + box-sizing: border-box; + font-size: 28rpx; + background: #EFEFEF; +} + +.action-btn { + display: flex; + justify-content: space-around; + margin-top: 80rpx; +} + +.send-btn { + width: 240rpx; + height: 80rpx; + background: #618DFF; + line-height: 80rpx; + text-align: center; + border-radius: 10rpx; + color: #FFFFFF; + font-size: 32rpx; +} + +.cancel-btn { + width: 240rpx; + height: 80rpx; + background: #FFFFFF; + line-height: 80rpx; + text-align: center; + border-radius: 10rpx; + color: #666666; + font-size: 32rpx; + border: 1px solid rgba(0, 0, 0, 0.1) +} diff --git a/components/GoEasyRecorder/goEasyRecorder.js b/components/GoEasyRecorder/goEasyRecorder.js new file mode 100644 index 0000000..4c2ebf6 --- /dev/null +++ b/components/GoEasyRecorder/goEasyRecorder.js @@ -0,0 +1,67 @@ +const recorderManager = wx.getRecorderManager(); +Component({ + options: { + addGlobalClass: true, // 加载组件css文件,需在app.wxss中引入组件css文件 + }, + data: { + recording: false, + stopSignaled: false, + clickLongPress: false, + }, + methods: { + startRecord: function() { + console.log('start'); + this.setData({ + clickLongPress: true + }); + recorderManager.start(); + }, + stopRecord: function() { + console.log('end'); + + if (!this.data.recording && this.data.clickLongPress) { + console.log('in1', this.data.clickLongPress); + + this.setData({ + stopSignaled: true, + clickLongPress: false + }); + } else { + this.setData({ + recording: false, + }); + recorderManager.stop(); + } + } + }, + attached() { + var self = this; + recorderManager.onStart(function() { + self.setData({ + recording: true, + clickLongPress: false + }); + if (self.data.stopSignaled) { + self.setData({ + stopSignaled: false + }); + recorderManager.stop(); + } + }); + recorderManager.onStop(function(res) { + + self.setData({ + recording: false + }); + if(res.duration < 100) { + return; + } + self.triggerEvent('onStop', res); + }); + recorderManager.onError(function() { + self.setData({ + recording: false + }); + }); + } +}) diff --git a/components/GoEasyRecorder/goEasyRecorder.json b/components/GoEasyRecorder/goEasyRecorder.json new file mode 100644 index 0000000..a89ef4d --- /dev/null +++ b/components/GoEasyRecorder/goEasyRecorder.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} diff --git a/components/GoEasyRecorder/goEasyRecorder.wxml b/components/GoEasyRecorder/goEasyRecorder.wxml new file mode 100644 index 0000000..3cf3a08 --- /dev/null +++ b/components/GoEasyRecorder/goEasyRecorder.wxml @@ -0,0 +1,6 @@ + + + {{recording ? '松开发送' : '按下录音'}} + + + \ No newline at end of file diff --git a/components/GoEasyRecorder/goEasyRecorder.wxss b/components/GoEasyRecorder/goEasyRecorder.wxss new file mode 100644 index 0000000..5c5d196 --- /dev/null +++ b/components/GoEasyRecorder/goEasyRecorder.wxss @@ -0,0 +1,32 @@ +.goeasy-recorder { + height: 80rpx; + background-color: #ffffff; + flex: 1; + display: flex; +} + + +.record-msg-box { + flex: 1; + height: 80rpx; + padding-left: 20rpx; + padding: 0; + border-radius: 12rpx; + box-sizing: border-box; + line-height: 80rpx; + font-size: 28rpx; + text-align: center; + color: #FFFFFF; + background: #cccccc; +} + +.record-icon { + position: fixed; + top: 0; + left: 0; + right: 0; + bottom: 158rpx; + margin: auto; + width: 316rpx; + height: 308rpx; +} diff --git a/components/GoEasyVideoPlayer/goEasyVideoPlayer.js b/components/GoEasyVideoPlayer/goEasyVideoPlayer.js new file mode 100644 index 0000000..d3ec08a --- /dev/null +++ b/components/GoEasyVideoPlayer/goEasyVideoPlayer.js @@ -0,0 +1,48 @@ + +Component({ + options: { + multipleSlots: true, // 在组件定义时的选项中启用多slot支持 + }, + data: { + videoContext: null, + show : false, + src : '', + duration : 0 + }, + methods: { + play({url='', duration=0}) { + this.setData({ + show : true, + src : url, + duration : duration, + videoContext: wx.createVideoContext('videoPlayer', this) + }) + }, + onPlay () { + console.log('onplay'); + + this.data.videoContext.requestFullScreen({ + direction : 0 + }) + }, + onFullScreenChange(e) { + // 视频的全屏与退出全屏都会执行 + //当退出全屏播放时,隐藏播放器 + if(this.data.show && !e.detail.fullScreen){ + this.setData({ + show : false + }) + this.data.videoContext.stop(); + } + } + }, + attached: function() { + // 在组件实例进入页面节点树时执行 + }, + detached: function() { + // 在组件实例被从页面节点树移除时执行 + if(this.data.videoContext != null){ + this.data.videoContext.stop(); + } + } +}) diff --git a/components/GoEasyVideoPlayer/goEasyVideoPlayer.json b/components/GoEasyVideoPlayer/goEasyVideoPlayer.json new file mode 100644 index 0000000..a89ef4d --- /dev/null +++ b/components/GoEasyVideoPlayer/goEasyVideoPlayer.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} diff --git a/components/GoEasyVideoPlayer/goEasyVideoPlayer.wxml b/components/GoEasyVideoPlayer/goEasyVideoPlayer.wxml new file mode 100644 index 0000000..0f4e42c --- /dev/null +++ b/components/GoEasyVideoPlayer/goEasyVideoPlayer.wxml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/components/GoEasyVideoPlayer/goEasyVideoPlayer.wxss b/components/GoEasyVideoPlayer/goEasyVideoPlayer.wxss new file mode 100644 index 0000000..c0e3ced --- /dev/null +++ b/components/GoEasyVideoPlayer/goEasyVideoPlayer.wxss @@ -0,0 +1,11 @@ +.goeasy-video-player { + width: 100%; + height: 100%; +} +.mask { + position: absolute; + top: 0; + z-index: 1; + opacity: 0.6; + background: #333; +} diff --git a/pages/chat/groupChat/groupChat.js b/pages/chat/groupChat/groupChat.js new file mode 100644 index 0000000..7f4b9e5 --- /dev/null +++ b/pages/chat/groupChat/groupChat.js @@ -0,0 +1,332 @@ +/* groupChat.js */ +// 定义表情 +import EmojiDecoder from "../../../static/lib/EmojiDecoder"; +let emojiUrl = 'https://imgcache.qq.com/open/qcloud/tim/assets/emoji/'; +let emojiMap = { + '[么么哒]': 'emoji_3@2x.png', + '[乒乓]': 'emoji_4@2x.png', + '[便便]': 'emoji_5@2x.png', + '[信封]': 'emoji_6@2x.png', + '[偷笑]': 'emoji_7@2x.png', + '[傲慢]': 'emoji_8@2x.png' +}; +const app = getApp(); +Page({ + data: { + content: '', + group: null, + messages: [], + + //默认为false展示输入框, 为true时显示录音按钮 + recordVisible: false, + + currentUser: null, + groupMemberNum: 0, + groupMembers: {}, + allHistoryLoaded: false, + // 表情 + emoji : { + url : emojiUrl, + map : emojiMap, + show : false, + decoder : new EmojiDecoder(emojiUrl,emojiMap) + }, + more : {//更多按钮 + show : false + }, + imService: null, + // 群名称 + groupTitle: "" + }, + onPullDownRefresh () { + this.loadMoreHistoryMessage(); + }, + onLoad(options) { + // 初始化群数据 + let groupId = options.to; + let imService = app.globalData.imService; + let currentUser = imService.currentUser; + let group = imService.findGroupById(groupId); + let groupMembers = imService.getGroupMembers(groupId); + let groupTitle = group.name + "(" + Object.keys(groupMembers).length + ")"; + + this.setData({ + group: group, + imService: imService, + groupTitle: groupTitle, + currentUser: currentUser, + groupMembers: groupMembers, + }); + // 获取群消息 + let messages = this.data.imService.getGroupMessages(groupId); + // 渲染表情与消息间隔5分钟显示时间 + this.renderMessages(messages); + this.scrollToBottom(); + // 收到的消息设置为已读 + if(this.data.messages.length !==0){ + this.markGroupMessageAsRead(groupId); + } + + // 监听群消息 + this.data.imService.onNewGroupMessageReceive = (groupId, message)=> { + if (groupId === this.data.group.uuid) { + // 渲染messages + this.renderMessages(this.data.messages); + this.scrollToBottom(); + // 如果收到当前群消息则清除当前群的未读消息 + this.markGroupMessageAsRead(groupId); + } + }; + }, + onUnload() { + // 退出聊天页面之前,清空页面传入的监听器 + if(this.data.imService){ + this.data.imService.onNewGroupMessageReceive = function () {}; + } + }, + onRecordStop(res) { + // 发送语音 + let audioMessage = wx.im.createAudioMessage({ + to: { + id : this.data.group.uuid, + type : wx.GoEasyIM.SCENE.GROUP, + data : {name:this.data.group.name, avatar:this.data.group.avatar} + }, + file: res.detail, + onProgress :function (progress) { + console.log(progress) + } + }); + this.sendMessage(audioMessage); + }, + sendTextMessage() { + // 发送文本与表情 + if (this.data.content.trim() !== '') { + let textMessage = wx.im.createTextMessage({ + text: this.data.content, + to : { + id : this.data.group.uuid, + type : wx.GoEasyIM.SCENE.GROUP, + data : {name:this.data.group.name, avatar:this.data.group.avatar} + } + }); + this.sendMessage(textMessage); + } + this.setData({ + content: "" + }); + }, + sendImage(){ + // 发送图片 + let self = this; + wx.chooseImage({ + count: 1, + sizeType: ['original', 'compressed'], + sourceType: ['album', 'camera'], + success (res) { + let imageMessage = wx.im.createImageMessage({ + to : { + id : self.data.group.uuid, + type : wx.GoEasyIM.SCENE.GROUP, + data : {name:self.data.group.name, avatar:self.data.group.avatar} + }, + file: res, + onProgress :function (progress) { + console.log(progress) + } + }); + self.sendMessage(imageMessage); + } + }); + }, + sendVideo(){ + // 发送视频 + let self = this; + wx.chooseVideo({ + sourceType: ['album','camera'], + maxDuration: 60, + camera: 'back', + success(res) { + let videoMessage = wx.im.createVideoMessage({ + to : { + id : self.data.group.uuid, + type : wx.GoEasyIM.SCENE.GROUP, + data : {name:self.data.group.name, avatar:self.data.group.avatar} + }, + file: res, + onProgress :function (progress) { + console.log(progress) + } + }); + self.sendMessage(videoMessage); + } + }) + }, + sendMessage(message){ + let self = this; + this.data.messages.push(message); + this.renderMessages(this.data.messages); + self.scrollToBottom(); + let promise = wx.im.sendMessage(message); + promise.then((res) => { + console.log('发送消息成功'); + self.renderMessages(self.data.messages); + }) + .catch(e => { + console.log('发送失败',e) + }); + }, + showCustomMessageForm(){ + // 展示自定义消息页面 + let self = this; + let customMessage = this.selectComponent("#customMessage"); + customMessage.setData({ + show: true, + to: self.data.group, + type: wx.GoEasyIM.SCENE.GROUP + }); + }, + sendCustomMessage(event){ + let customMessage = event.detail; + this.sendMessage(customMessage); + // 发送自定义消息关闭更多菜单栏 + this.setData({ + ["more.show"]: false, + ["emoji.show"]: false, + }); + }, + loadMoreHistoryMessage() { //历史消息 + //历史消息 + let lastMessageTimeStamp = Date.now(); + let lastMessage = this.data.messages[0]; + if (lastMessage) { + lastMessageTimeStamp = lastMessage.timestamp; + } + let currentLength = this.data.messages.length; + let promise = this.data.imService.loadGroupHistoryMessage(this.data.group.uuid, lastMessageTimeStamp); + promise.then(messages => { + if (messages.length === currentLength) { + this.setData({ + allHistoryLoaded: true + }) + } + this.renderMessages(this.data.messages); + wx.stopPullDownRefresh(); + }).catch(e => { + console.log(e); + wx.stopPullDownRefresh(); + }) + }, + renderMessages(messages){ + messages.forEach((message,index)=>{ + if(index === 0){ + // 当页面只有一条消息时,显示发送时间 + message.showTime = app.formatDate(message.timestamp); + }else { + // 当前消息与上条消息的发送时间进行比对,超过5分钟则显示当前消息的发送时间 + if (message.timestamp - messages[index - 1].timestamp > 5 * 60 * 1000) { + message.showTime = app.formatDate(message.timestamp); + } + } + if(message.type === 'text'){ + // 渲染表情与文本消息 + let text = this.data.emoji.decoder.decode(message.payload.text); + message.node= text; + } + }); + this.setData({ + messages: messages + }); + }, + showMembers() { //显示群成员 + wx.navigateTo({ + url: '../groupMember/groupMember?group=' + JSON.stringify(this.data.group) + }); + }, + markGroupMessageAsRead (groupId) { + wx.im.markGroupMessageAsRead(groupId) + .then(() => { + console.log('标记为已读成功') + }) + .catch(e => { + console.log('标记为已读失败', e) + }) + }, + setContent(e) { + // 监听输入的消息 + let content = e.detail.value; + this.setData({ + content: content + }); + }, + switchAudioKeyboard() { + // 语音录制按钮和键盘输入的切换 + this.setData({ + recordVisible: !this.data.recordVisible + }); + if(this.data.more.show || this.data.emoji.show){ + this.setData({ + ["more.show"]: false, + ["emoji.show"]: false + }); + } + if(this.data.recordVisible){ + // 录音授权 + wx.authorize({ + scope: 'scope.record', + success() {} + }); + } + }, + playVideo (e) { + //播放视频 + this.selectComponent("#videoPlayer").play({ + url : e.currentTarget.dataset.url, + duration : e.currentTarget.dataset.duration + }) + }, + previewImage(event) { + // 预览图片 + let imagesUrl = [event.currentTarget.dataset.src]; + wx.previewImage({ + urls: imagesUrl // 需要预览的图片http链接列表 + }) + }, + selectEmoji(e){ + // 选择表情 + let emojiKey = e.currentTarget.dataset.emojikey; + emojiKey = this.data.content + emojiKey; + this.setData({ + content: emojiKey + }); + }, + messageInputFocusin(){ + this.setData({ + ["more.show"]: false, + ["emoji.show"]: false + }); + }, + showEmoji(){ + this.setData({ + ["emoji.show"]: true, + ["more.show"]: false, + recordVisible: false + }); + // 关闭手机键盘 + wx.hideKeyboard(); + }, + showMore(){ + this.setData({ + ["more.show"]: true, + ["emoji.show"]: false + }); + // 关闭手机键盘 + wx.hideKeyboard(); + }, + scrollToBottom() { // 滑动到最底部 + wx.pageScrollTo({ + scrollTop : 200000, + duration :10 + }) + } +}) diff --git a/pages/chat/groupChat/groupChat.json b/pages/chat/groupChat/groupChat.json new file mode 100644 index 0000000..a13c6f6 --- /dev/null +++ b/pages/chat/groupChat/groupChat.json @@ -0,0 +1,11 @@ +{ + "navigationBarTitleText": "", + "enablePullDownRefresh" : true, + "backgroundTextStyle" : "dark", + "usingComponents": { + "GoEasyRecorder": "/components/GoEasyRecorder/goEasyRecorder", + "GoEasyAudioPlayer": "/components/GoEasyAudioPlayer/goEasyAudioPlayer", + "GoEasyVideoPlayer": "/components/GoEasyVideoPlayer/goEasyVideoPlayer", + "GoEasyCustomMessage": "/components/GoEasyCustomMessage/customMessage" + } +} \ No newline at end of file diff --git a/pages/chat/groupChat/groupChat.wxml b/pages/chat/groupChat/groupChat.wxml new file mode 100644 index 0000000..b598ba7 --- /dev/null +++ b/pages/chat/groupChat/groupChat.wxml @@ -0,0 +1,91 @@ + + + + + + + + + {{allHistoryLoaded ? '已经没有更多的历史消息' : '下拉获取历史消息'}} + + + + + + {{message.showTime}} + + + + + + + + + + + + + + + + + + + + + + 自定义消息 + + 编号: {{message.payload.number}} + 商品: {{message.payload.goods}} + 金额: {{message.payload.price}} + + + + + + + + + + + + + + + + + + + + + + + 发送 + + + + + + + + + + 图片 + + + + 视频 + + + + 自定义消息 + + + + + + + diff --git a/pages/chat/groupChat/groupChat.wxss b/pages/chat/groupChat/groupChat.wxss new file mode 100644 index 0000000..63a9751 --- /dev/null +++ b/pages/chat/groupChat/groupChat.wxss @@ -0,0 +1,276 @@ +/* groupChat.wxss */ +page { + height: 100%; +} +.groupChat { + height: 100%; +} + + +.group-member-icon { + width: 60rpx; + height: 60rpx; + position: fixed; + top: 60rpx; + right: 20rpx; + background-color: #C4C4C4; + z-index: 2; + border-radius: 60rpx; +} + +.scroll-view { + overflow-x: hidden; + -webkit-overflow-scrolling: touch; + padding-bottom: 130rpx; +} + +.header { + display: flex; + align-items: center; + flex-direction: column; + justify-content: center; + height: 90rpx; + font-size: 24rpx; + color: gray !important; + text-decoration: none !important; +} + +.time-lag{ + font-size: 20rpx; + text-align: center; +} + +.message-item { + max-height: 400rpx; + padding: 20rpx 0; + overflow: hidden; + display: flex; +} + +.self{ + overflow: hidden; + display: flex; + justify-content: flex-start; + flex-direction: row-reverse; +} + +.avatar{ + width: 80rpx; + height: 80rpx; + flex-shrink: 0; + flex-grow: 0; +} + +.other-icon { + margin: 0 20rpx; +} + +.self-icon { + margin: 0 20rpx; +} + +.content{ + font-size: 34rpx; + line-height: 44rpx; + max-height: 400rpx; + display: flex; + align-items: center; + justify-content: right; + text-align: right; +} + +.pending { + width: 30rpx; + height: 30rpx; + padding: 10rpx; +} + +.send-fail{ + width: 30rpx; + height: 30rpx; + margin-right: 10rpx; + flex-grow: 0; + flex-shrink: 0; +} + +.text-content{ + padding: 16rpx; + border-radius: 12rpx; + color: #ffffff; + background:#D02129; + word-break: break-all; + text-align: left; + vertical-align: center; + display: block; +} + +.image-content{ + padding: 16rpx; + border-radius: 12rpx; + width: 300rpx; + height: 300rpx; +} + +.video-snapshot { + position: relative; + max-height: 240rpx; + max-width: 300rpx; + overflow: hidden; +} + +.thumbnail-image{ + max-height: 240rpx; + max-width: 300rpx; +} + +.play-icon { + position: absolute; + width: 80rpx; + height: 80rpx; + border-radius: 20rpx; + top: 50%; + left: 50%; + margin-left: -40rpx; + margin-top: -40rpx; + z-index: 1000; + opacity: 1; +} + +.custom-message{ + width: 400rpx; + height: 260rpx; + display: flex; + flex-direction: column; + justify-content: space-around; + align-items: flex-start; + box-sizing: border-box; + padding: 10rpx 30rpx; + border: 1px solid rgba(0, 0, 0, 0.05); + box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1); + border-radius: 20rpx; +} + +.title{ + width: 100%; + display: flex; + align-items: center; + font-size: 30rpx; +} + +.title text { + padding: 10rpx; +} + +.custom-message-item{ + text-align: left; + font-size: 28rpx; + overflow: hidden; + width: 100%; + text-overflow:ellipsis; + white-space: nowrap; +} + +.action-box { + width: 100%; + position: fixed; + bottom: 0; + left: 0; + z-index: 1000; + background-color: #FAFAFA; +} + +.action-top { + display: flex; + width: 100%; + align-items: center; + height: 130rpx; + padding: 20rpx 10rpx 20rpx 10rpx; + box-sizing: border-box; + background-color: #FAFAFA; +} + +.action-icon { + display: flex; + align-items: center; + justify-content: center; + height: 100%; +} + +.microphone-icon { + width: 45rpx; + height: 50rpx; + padding: 0 10rpx; +} + + +.keyboard-icon { + width: 50rpx; + height: 50rpx; + padding: 0 10rpx; +} + +.msg-input-box { + flex: 1; + height: 80rpx; + padding-left: 20rpx; + border-radius: 12rpx; + box-sizing: border-box; + line-height: 80rpx; + font-size: 28rpx; + background-color: #efefef; +} + +.emoji-icon { + width: 50rpx; + height: 50rpx; + padding-left: 15rpx; +} + +.more-icon { + width: 58rpx; + height: 58rpx; + padding-left: 15rpx; +} + +.send-btn-box { + width: 80rpx; + box-sizing: border-box; + text-align: center; + line-height: 80rpx; + font-size: 28rpx; + color: #95949A; +} + +.action-bottom { + display: flex; + padding: 20rpx 10rpx 20rpx 10rpx; + height: 320rpx; + box-sizing: border-box; + background: #fff; +} + +.image { + width: 100rpx; + height: 100rpx; +} + +.more-item{ + display: flex; + flex-direction: column; + width: 150rpx; + height: 150rpx; + margin-right: 20rpx; + align-items: center; +} + +.text { + font-size: 20rpx; + text-align: center; + line-height: 50rpx; + color: #666666; +} + +.title image { + width: 40rpx; + height: 40rpx; +} \ No newline at end of file diff --git a/pages/chat/groupMember/groupMember.js b/pages/chat/groupMember/groupMember.js new file mode 100644 index 0000000..c6165a6 --- /dev/null +++ b/pages/chat/groupMember/groupMember.js @@ -0,0 +1,20 @@ +/* groupMember.js */ + +const app = getApp() + +Page({ + data: { + currentUser : null, + groupMembersMap : {}, + groupMemberNum: 0 + }, + onLoad(options){ + let group = JSON.parse(options.group); + let groupMemberMap = app.globalData.imService.getGroupMembers(group.uuid); + let groupMemberNum = Object.keys(groupMemberMap).length; + this.setData({ + groupMemberNum: groupMemberNum, + groupMembersMap: groupMemberMap, + }); + }, +}) diff --git a/pages/chat/groupMember/groupMember.json b/pages/chat/groupMember/groupMember.json new file mode 100644 index 0000000..e6364ab --- /dev/null +++ b/pages/chat/groupMember/groupMember.json @@ -0,0 +1,3 @@ +{ + "navigationBarTitleText": "" +} \ No newline at end of file diff --git a/pages/chat/groupMember/groupMember.wxml b/pages/chat/groupMember/groupMember.wxml new file mode 100644 index 0000000..a968cc7 --- /dev/null +++ b/pages/chat/groupMember/groupMember.wxml @@ -0,0 +1,15 @@ + + + + + + + + + + + diff --git a/pages/chat/groupMember/groupMember.wxss b/pages/chat/groupMember/groupMember.wxss new file mode 100644 index 0000000..4997714 --- /dev/null +++ b/pages/chat/groupMember/groupMember.wxss @@ -0,0 +1,51 @@ +/* groupMember.wxss */ + +page { + width: 100%; + height: 100%; + font-family: Source Han Sans CN; +} + +.member-layer { + display: flex; + flex-direction: column; + position: fixed; + left: 0; + right: 0; + z-index: 1000; + height: 100%; + background: #FFFFFF; +} + +.exit-icon { + padding-left: 20rpx; + line-height: 120rpx; + font-size: 36rpx; + color: #FFFFFF; +} + +.header-group-name { + flex: 1; + display: flex; + align-items: center; + justify-content: center; + height: 100%; + color: #FFFFFF; +} + +.member { + padding: 10rpx; + margin-top: 10rpx; +} + +.avatar { + width: 96rpx; + height: 96rpx; + min-width: 96rpx; + min-height: 96rpx; +} + +.group-member-avatar { + margin-right: 10rpx; + margin-bottom: 10rpx; +} \ No newline at end of file diff --git a/pages/chat/privateChat/privateChat.js b/pages/chat/privateChat/privateChat.js new file mode 100644 index 0000000..d2aa719 --- /dev/null +++ b/pages/chat/privateChat/privateChat.js @@ -0,0 +1,323 @@ +/* privateChat.js */ +import EmojiDecoder from "../../../static/lib/EmojiDecoder"; +let emojiUrl = 'https://imgcache.qq.com/open/qcloud/tim/assets/emoji/'; +let emojiMap = { + '[么么哒]': 'emoji_3@2x.png', + '[乒乓]': 'emoji_4@2x.png', + '[便便]': 'emoji_5@2x.png', + '[信封]': 'emoji_6@2x.png', + '[偷笑]': 'emoji_7@2x.png', + '[傲慢]': 'emoji_8@2x.png' +}; +const app = getApp(); +Page({ + data: { + content: '', + friend: null, + currentUser: null, + messages: [], + + //默认为false展示输入框, 为true时显示录音按钮 + recordVisible: false, + + //所有历史消息加载完成标识 + allHistoryLoaded: false, + //定义表情列表 + emoji : { + url : emojiUrl, + map : emojiMap, + show: false, + decoder: new EmojiDecoder(emojiUrl, emojiMap), + }, + more : {//更多按钮 + show : false + }, + imService : null, + }, + onPullDownRefresh () { + this.loadMoreHistoryMessage(); + }, + onLoad: function(options) { + // 获取初始数据并加载 + let friendId = options.to; + let imService = app.globalData.imService; + let currentUser = imService.currentUser; + let friend = imService.findFriendById(friendId); + + this.setData({ + friend: friend, + imService: imService, + currentUser: currentUser, + }); + + // 获取消息 + let messages = this.data.imService.getPrivateMessages(friendId); + // 渲染表情与消息间隔5分钟显示时间 + this.renderMessages(messages); + this.scrollToBottom(); + // 收到的消息设置为已读 + if(this.data.messages.length !==0){ + this.markPrivateMessageAsRead(friendId); + } + + //传入监听器,收到一条私聊消息总是滚到到页面底部 + this.data.imService.onNewPrivateMessageReceive = (friendId, message)=> { + if (friendId === this.data.friend.uuid) { + this.renderMessages(this.data.messages); + this.scrollToBottom(); + // 如果是好友发送则清除未读消息 + this.markPrivateMessageAsRead(friendId); + } + }; + }, + onUnload () { + //退出聊天页面之前,清空页面传入的监听器 + if(this.data.imService) { + this.data.imService.onNewPrivateMessageReceive = (friendId, message)=> {}; + } + }, + onRecordStop(res) { + // 发送语音 + let audioMessage = wx.im.createAudioMessage({ + to: { + id : this.data.friend.uuid, + type : wx.GoEasyIM.SCENE.PRIVATE, + data : {name:this.data.friend.name, avatar:this.data.friend.avatar} + }, + file: res.detail, + onProgress :function (progress) { + console.log(progress) + } + }); + this.sendMessage(audioMessage); + }, + sendTextMessage() { + // 发送文本与表情 + if (this.data.content.trim() !== '') { + let textMessage = wx.im.createTextMessage({ + text: this.data.content, + to : { + id : this.data.friend.uuid, + type : wx.GoEasyIM.SCENE.PRIVATE, + data : {name:this.data.friend.name, avatar:this.data.friend.avatar} + } + }); + this.sendMessage(textMessage); + } + this.setData({ + content: "" + }); + }, + sendImage(){ + // 发送图片 + let self = this; + wx.chooseImage({ + count: 1, + sizeType: ['original', 'compressed'], + sourceType: ['album', 'camera'], + success (res) { + let imageMessage = wx.im.createImageMessage({ + to : { + id : self.data.friend.uuid, + type : wx.GoEasyIM.SCENE.PRIVATE, + data : {name:self.data.friend.name, avatar:self.data.friend.avatar} + }, + file: res, + onProgress :function (progress) { + console.log(progress) + } + }); + self.sendMessage(imageMessage); + } + }); + }, + sendVideo(){ + // 发送视频 + let self = this; + wx.chooseVideo({ + sourceType: ['album','camera'], + maxDuration: 60, + camera: 'back', + success(res) { + let videoMessage = wx.im.createVideoMessage({ + to : { + id : self.data.friend.uuid, + type : wx.GoEasyIM.SCENE.PRIVATE, + data : {name:self.data.friend.name, avatar:self.data.friend.avatar} + }, + file: res, + onProgress :function (progress) { + console.log(progress) + } + }); + self.sendMessage(videoMessage); + } + }) + }, + sendMessage(message){ + let self = this; + this.data.messages.push(message); + this.renderMessages(this.data.messages); + this.scrollToBottom(); + let promise = wx.im.sendMessage(message); + promise.then((res) => { + console.log('发送消息成功'); + self.renderMessages(self.data.messages); + }) + .catch(e => { + console.log('发送失败',e) + }); + }, + + showCustomMessageForm(){ + let self = this; + let customMessage = this.selectComponent("#customMessage"); + customMessage.setData({ + show: true, + to: self.data.friend, + type: wx.GoEasyIM.SCENE.PRIVATE + }); + }, + + sendCustomMessage(event){ + let customerMessage = event.detail; + this.sendMessage(customerMessage); + // 发送自定义消息关闭更多菜单栏 + this.setData({ + ["more.show"]: false, + ["emoji.show"]: false, + }); + }, + loadMoreHistoryMessage() { + //历史消息 + let friendId = this.data.friend.uuid; + let lastMessageTimeStamp = Date.now(); + let lastMessage = this.data.messages[0]; + if (lastMessage) { + lastMessageTimeStamp = lastMessage.timestamp; + } + let currentLength = this.data.messages.length; + let promise = app.globalData.imService.loadPrivateHistoryMessage(friendId, lastMessageTimeStamp); + promise.then(messages => { + if (messages.length === currentLength) { + this.setData({ + allHistoryLoaded: true + }) + } + this.renderMessages(this.data.messages); + wx.stopPullDownRefresh(); + }).catch(e => { + console.log(e) + wx.stopPullDownRefresh(); + }) + }, + renderMessages(messages){ + console.log(this.data.emoji.decoder) + messages.forEach((message,index)=>{ + if(index === 0){ + // 当页面只有一条消息时,显示发送时间 + message.showTime = app.formatDate(message.timestamp); + }else { + // 当前消息与上条消息的发送时间进行比对,超过5分钟则显示当前消息的发送时间 + if (message.timestamp - messages[index - 1].timestamp > 5 * 60 * 1000) { + message.showTime = app.formatDate(message.timestamp); + } + } + if(message.type === 'text'){ + // 渲染表情与文本消息 + let text = this.data.emoji.decoder.decode(message.payload.text); + message.node= text; + } + }); + this.setData({ + messages: messages + }); + }, + + markPrivateMessageAsRead (friendId) { + wx.im.markPrivateMessageAsRead(friendId) + .then(() => { + console.log('标记为已读成功') + }) + .catch(e => { + console.log('标记为已读失败', e) + }) + }, + setContent(e) { + // 监听输入的消息 + let content = e.detail.value; + this.setData({ + content: content + }); + }, + switchAudioKeyboard() { + // 语音录制按钮和键盘输入的切换 + this.setData({ + recordVisible: !this.data.recordVisible + }); + if(this.data.more.show || this.data.emoji.show){ + this.setData({ + ["more.show"]: false, + ["emoji.show"]: false + }); + } + if(this.data.recordVisible){ + // 录音授权 + wx.authorize({ + scope: 'scope.record', + success() {} + }); + } + }, + playVideo (e) { + //播放视频 + this.selectComponent("#videoPlayer").play({ + url : e.currentTarget.dataset.url, + duration : e.currentTarget.dataset.duration + }) + }, + previewImage(event) { + // 预览图片 + let imagesUrl = [event.currentTarget.dataset.src]; + wx.previewImage({ + urls: imagesUrl // 需要预览的图片http链接列表 + }) + }, + selectEmoji(e){ + // 选择表情 + let emojiKey = e.currentTarget.dataset.emojikey; + emojiKey = this.data.content + emojiKey; + this.setData({ + content: emojiKey + }); + }, + messageInputFocusin(){ + this.setData({ + ["more.show"]: false, + ["emoji.show"]: false + }); + }, + showEmoji(){ + this.setData({ + ["emoji.show"]: true, + ["more.show"]: false, + recordVisible: false + }); + // 关闭手机键盘 + wx.hideKeyboard(); + }, + showMore(){ + this.setData({ + ["more.show"]: true, + ["emoji.show"]: false + }); + // 关闭手机键盘 + wx.hideKeyboard(); + }, + scrollToBottom() { // 滑动到最底部 + wx.pageScrollTo({ + scrollTop : 200000, + duration :10 + }) + } +}) diff --git a/pages/chat/privateChat/privateChat.json b/pages/chat/privateChat/privateChat.json new file mode 100644 index 0000000..345369c --- /dev/null +++ b/pages/chat/privateChat/privateChat.json @@ -0,0 +1,11 @@ +{ + "navigationBarTitleText": "私聊", + "enablePullDownRefresh" : true, + "backgroundTextStyle" : "dark", + "usingComponents": { + "GoEasyRecorder": "/components/GoEasyRecorder/goEasyRecorder", + "GoEasyAudioPlayer": "/components/GoEasyAudioPlayer/goEasyAudioPlayer", + "GoEasyVideoPlayer": "/components/GoEasyVideoPlayer/goEasyVideoPlayer", + "GoEasyCustomMessage": "/components/GoEasyCustomMessage/customMessage" + } +} diff --git a/pages/chat/privateChat/privateChat.wxml b/pages/chat/privateChat/privateChat.wxml new file mode 100644 index 0000000..a9c4331 --- /dev/null +++ b/pages/chat/privateChat/privateChat.wxml @@ -0,0 +1,92 @@ + + + + + + + + + {{allHistoryLoaded ? '已经没有更多的历史消息' : '下拉获取历史消息'}} + + + + + + {{message.showTime}} + + + + + + + + + + + + + + + + + + + + + + + 自定义消息 + + 编号: {{message.payload.number}} + 商品: {{message.payload.goods}} + 金额: {{message.payload.price}} + + + + + + + + + + + + + + + + + + + + + + + 发送 + + + + + + + + + + 图片 + + + + 视频 + + + + 自定义消息 + + + + + + + diff --git a/pages/chat/privateChat/privateChat.wxss b/pages/chat/privateChat/privateChat.wxss new file mode 100644 index 0000000..9e0f4f4 --- /dev/null +++ b/pages/chat/privateChat/privateChat.wxss @@ -0,0 +1,264 @@ +/* privateChat.wxss */ +page { + height: 100%; +} +.chat { + height: 100%; +} + +.scroll-view { + overflow-x: hidden; + -webkit-overflow-scrolling: touch; + padding-bottom: 130rpx; +} + +.header { + display: flex; + align-items: center; + flex-direction: column; + justify-content: center; + height: 90rpx; + font-size: 24rpx; + color: gray !important; + text-decoration: none !important; +} + +.time-lag{ + font-size: 20rpx; + text-align: center; +} + +.message-item { + max-height: 400rpx; + padding: 20rpx 0; + overflow: hidden; + display: flex; +} + +.self{ + overflow: hidden; + display: flex; + justify-content: flex-start; + flex-direction: row-reverse; +} + +.avatar{ + width: 80rpx; + height: 80rpx; + flex-shrink: 0; + flex-grow: 0; +} + +.other-icon { + margin: 0 20rpx; +} + +.self-icon { + margin: 0 20rpx; +} + +.content{ + font-size: 34rpx; + line-height: 44rpx; + max-height: 400rpx; + display: flex; + align-items: center; + justify-content: right; + text-align: right; +} + +.pending { + width: 30rpx; + height: 30rpx; + padding: 10rpx; +} + +.send-fail{ + width: 30rpx; + height: 30rpx; + margin-right: 10rpx; + flex-grow: 0; + flex-shrink: 0; +} + +.text-content{ + padding: 16rpx; + border-radius: 12rpx; + color: #ffffff; + background:#D02129; + word-break: break-all; + text-align: left; + vertical-align: center; + display: block; +} + +.image-content{ + padding: 16rpx; + border-radius: 12rpx; + width: 300rpx; + height: 300rpx; +} + +.video-snapshot { + position: relative; + max-height: 240rpx; + max-width: 300rpx; + overflow: hidden; +} + +.thumbnail-image{ + max-height: 240rpx; + max-width: 300rpx; +} + +.play-icon { + position: absolute; + width: 80rpx; + height: 80rpx; + border-radius: 20rpx; + top: 50%; + left: 50%; + margin-left: -40rpx; + margin-top: -40rpx; + z-index: 1000; + opacity: 1; +} + +.custom-message{ + width: 400rpx; + height: 260rpx; + display: flex; + flex-direction: column; + justify-content: space-around; + align-items: flex-start; + box-sizing: border-box; + padding: 10rpx 30rpx; + border: 1px solid rgba(0, 0, 0, 0.05); + box-shadow: 0px 2px 12px rgba(0, 0, 0, 0.1); + border-radius: 20rpx; +} + +.title{ + width: 100%; + display: flex; + align-items: center; + font-size: 30rpx; +} + +.title text { + padding: 10rpx; +} + +.custom-message-item{ + text-align: left; + font-size: 28rpx; + overflow: hidden; + width: 100%; + text-overflow:ellipsis; + white-space: nowrap; +} + +.action-box { + width: 100%; + position: fixed; + bottom: 0; + left: 0; + z-index: 1000; + background-color: #FAFAFA; +} + +.action-top { + display: flex; + align-items: center; + width: 100%; + height: 130rpx; + padding: 20rpx 10rpx 20rpx 10rpx; + box-sizing: border-box; + background-color: #FAFAFA; +} + +.action-icon { + display: flex; + align-items: center; + justify-content: center; + height: 100%; +} + +.microphone-icon { + width: 45rpx; + height: 50rpx; + padding: 0 10rpx; +} + +.keyboard-icon { + width: 50rpx; + height: 50rpx; + padding: 0 10rpx; +} + +.msg-input-box { + flex: 1; + height: 80rpx; + padding-left: 20rpx; + border-radius: 12rpx; + box-sizing: border-box; + line-height: 80rpx; + font-size: 28rpx; + background-color: #efefef; +} + +.emoji-icon { + width: 50rpx; + height: 50rpx; + padding-left: 15rpx; +} + +.more-icon { + width: 58rpx; + height: 58rpx; + padding-left: 15rpx; +} + + +.send-btn-box { + width: 80rpx; + box-sizing: border-box; + text-align: center; + line-height: 80rpx; + font-size: 28rpx; + color: #95949A; +} + +.action-bottom { + display: flex; + padding: 20rpx 10rpx 20rpx 10rpx; + height: 320rpx; + box-sizing: border-box; + background: #fff; +} + +.image { + height: 100rpx; + width: 100rpx; +} + +.more-item{ + display: flex; + flex-direction: column; + width: 150rpx; + height: 150rpx; + margin-right: 20rpx; + align-items: center; +} + +.text { + font-size: 20rpx; + text-align: center; + line-height: 50rpx; + color: #666666; +} + +.title image { + width: 40rpx; + height: 40rpx; +} \ No newline at end of file diff --git a/pages/contacts/contacts.js b/pages/contacts/contacts.js new file mode 100644 index 0000000..f2f244f --- /dev/null +++ b/pages/contacts/contacts.js @@ -0,0 +1,34 @@ +/* contacts.js */ + +import restapi from "../../static/lib/restapi"; + +const app = getApp() + +Page({ + data: { + groups:[], + friends:[], + }, + onShow () { + let currentUser = app.globalData.imService.currentUser; + let groups = restapi.findGroups(currentUser); + let friends = restapi.findFriends(currentUser); + this.setData({ + groups: groups, + friends: friends, + }); + }, + onUnload(){ + app.globalData.imService.disconnect(); + }, + enterChat (e) {//进入私聊 + let type = e.currentTarget.dataset.type; + let conversation = e.currentTarget.dataset.conversation; + let path = type === wx.GoEasyIM.SCENE.PRIVATE? + '../chat/privateChat/privateChat?to='+conversation.uuid + :'../chat/groupChat/groupChat?to='+ conversation.uuid; + wx.navigateTo({ + url : path + }); + } +}) \ No newline at end of file diff --git a/pages/contacts/contacts.json b/pages/contacts/contacts.json new file mode 100644 index 0000000..e53ee87 --- /dev/null +++ b/pages/contacts/contacts.json @@ -0,0 +1,3 @@ +{ + "navigationBarTitleText": "联系人" +} \ No newline at end of file diff --git a/pages/contacts/contacts.wxml b/pages/contacts/contacts.wxml new file mode 100644 index 0000000..3fbb15a --- /dev/null +++ b/pages/contacts/contacts.wxml @@ -0,0 +1,26 @@ + + + + + + + + + + {{group.name}} + + + + 联系人 + + +
+ +
+
+ {{friend.name}} +
+
+
+
+
diff --git a/pages/contacts/contacts.wxss b/pages/contacts/contacts.wxss new file mode 100644 index 0000000..7501743 --- /dev/null +++ b/pages/contacts/contacts.wxss @@ -0,0 +1,87 @@ +/* contacts.wxss */ + +page { + width: 100%; + height: 100%; + font-family: Source Han Sans CN; +} + +.contacts{ + width: 100%; + height: 100%; + display: flex; + flex-direction: column; +} +.contacts .contacts-container{ + width: 100%; + overflow: auto; +} + +.contacts .user-list-item{ + height: 132rpx; + padding-left: 32rpx; + display: flex; + align-items: center; +} +.contacts .contacts-title{ + height: 80rpx; + line-height: 100rpx; + font-size: 30rpx; + color: #666666; + background: #F3F4F7; + text-indent: 44rpx; +} + +.contacts .user-list{ + flex-grow: 1; + background: #ffffff; + display: flex; + flex-direction: column; +} +.contacts .user-item-avatar{ + width: 96rpx; + height: 96rpx; + margin-right: 32rpx; + overflow: hidden; + position: relative; +} +.contacts .user-item-avatar image{ + width: 100%; + height: 100%; + display: block; +} +.contacts .user-item-info{ + height: 130rpx; + padding-right: 32rpx; + line-height: 88rpx; + flex-grow: 1; + border-bottom: 1px solid #EFEFEF; + display: flex; + justify-content: space-between; + align-items: center; +} +.contacts .user-item-info__name{ + font-size: 30rpx; + font-family: Source Han Sans CN; + font-style: normal; + font-weight: bold; + color: #262628; +} +.contacts .user-item-info__tips{ + height: 44rpx; + width: 64rpx; + border-radius: 24rpx; + font-size: 26rpx; + line-height: 44rpx; + background: #D02129; + color: #ffffff; + font-family: Cabin; + text-align: center; +} +.contacts .online-dot{ + position: absolute; + width: 32rpx!important; + height: 32rpx!important; + right: 0; + bottom: 0; +} \ No newline at end of file diff --git a/pages/conversations/conversations.js b/pages/conversations/conversations.js new file mode 100644 index 0000000..c06bd81 --- /dev/null +++ b/pages/conversations/conversations.js @@ -0,0 +1,142 @@ +const app = getApp() +import IMService from '../../static/lib/imservice.js'; +Page({ + data : { + conversations : [], + action : { + conversation : null, + show : false, + toastMessage : '', + showToast : false + } + }, + onShow () { + let currentUser = wx.getStorageSync("currentUser"); + if(!currentUser){ + wx.redirectTo({ + url : '../login/login' + }); + return; + } + + if(wx.im.getStatus() === 'disconnected') { + app.globalData.imService= new IMService(wx.im); + app.globalData.imService.connectIM(currentUser); + } + wx.showLoading({ + title: '加载中' + }); + //监听会话列表变化 + let self = this; + wx.im.on(wx.GoEasyIM.EVENT.CONVERSATIONS_UPDATED, (conversations) => { + // 设置tabBar未读消息总数以及conversation + self.setConversations(conversations); + }); + + //加载会话列表 + wx.im.latestConversations() + .then(res => { + let content = res.content; + self.setConversations(content); + wx.hideLoading(); + }) + .catch(e => { + console.log(e); + wx.hideLoading(); + }); + }, + onHide(){ + // 销毁conversation监听器 + wx.im.on(wx.GoEasyIM.EVENT.CONVERSATIONS_UPDATED, (conversations) => {}); + }, + setConversations (conversations) { + conversations.conversations && conversations.conversations.map((item) => { + // 格式化时间格式 + item.lastMessage.date = app.formatDate(item.lastMessage.timestamp) + }); + this.setData({ + conversations : conversations.conversations + }); + this.setUnreadAmount(conversations.unreadTotal); + }, + navigateToChat (e) { + let conversation = e.currentTarget.dataset.conversation; + let path = conversation.type === wx.GoEasyIM.SCENE.PRIVATE? + '../chat/privateChat/privateChat?to='+conversation.userId + :'../chat/groupChat/groupChat?to='+ conversation.groupId; + wx.navigateTo({ + url : path + }); + }, + setUnreadAmount(unreadTotal) { + if(unreadTotal >0){ + wx.setTabBarBadge({ + index: 0, + text: unreadTotal.toString() + }); + }else{ + wx.hideTabBarRedDot({ + index :0 + }); + } + }, + showAction(e){ + let conversation = e.currentTarget.dataset.conversation; + this.setData({ + ["action.conversation"]: conversation, + ["action.show"]: true + }); + }, + topConversation(){ + let conversation = this.data.action.conversation; + let title = conversation.top ? '取消置顶失败' : '置顶失败'; + let promise; + wx.showLoading({ + title: "" + }); + if(conversation.type === wx.GoEasyIM.SCENE.PRIVATE){ + promise = wx.im.topPrivateConversation(conversation.userId, !conversation.top) + }else{ + promise = wx.im.topGroupConversation(conversation.groupId, !conversation.top) + } + this.afterDoAction(promise, title) + }, + removeConversation(){ + wx.showLoading({title: "删除中"}); + let conversation = this.data.action.conversation; + let promise; + if(conversation.type === wx.GoEasyIM.SCENE.PRIVATE){ + promise = wx.im.removePrivateConversation(conversation.userId); + }else{ + promise = wx.im.removeGroupConversation(conversation.groupId); + } + this.afterDoAction(promise, '删除失败') + }, + afterDoAction (promise, failedDescription) { + promise.then(() => { + wx.hideLoading() + }).catch(() => { + let self = this; + wx.hideLoading(); + this.setData({ + ["action.showToast"]: true, + ["action.toastMessage"]: failedDescription, + }); + setTimeout(() => { + self.setData({ + ["action.showToast"]: false + }); + },2000); + }); + this.setData({ + ["action.show"]: false + }) + }, + + // 关闭弹窗 + closeMask(){ + this.setData({ + ["action.show"]: false + }) + }, +}) \ No newline at end of file diff --git a/pages/conversations/conversations.json b/pages/conversations/conversations.json new file mode 100644 index 0000000..923f2a0 --- /dev/null +++ b/pages/conversations/conversations.json @@ -0,0 +1,3 @@ +{ + "navigationBarTitleText": "会话列表" +} diff --git a/pages/conversations/conversations.wxml b/pages/conversations/conversations.wxml new file mode 100644 index 0000000..8327abf --- /dev/null +++ b/pages/conversations/conversations.wxml @@ -0,0 +1,43 @@ + + + + + + + {{conversation.unread}} + + + + {{conversation.data.name}} + {{conversation.lastMessage.date}} + + + + {{conversation.lastMessage.payload.text}} + [视频消息] + [语音消息] + [图片消息] + [文件消息] + [自定义消息:订单] + [[未识别内容]] + + + + + + + + 当前没有会话为空 + + + + + {{action.conversation.top ? '取消置顶' : '置顶聊天'}} + 删除聊天 + + + + {{action.toastMessage}} + + + \ No newline at end of file diff --git a/pages/conversations/conversations.wxss b/pages/conversations/conversations.wxss new file mode 100644 index 0000000..754d2c5 --- /dev/null +++ b/pages/conversations/conversations.wxss @@ -0,0 +1,164 @@ +page{ height: 100%; } + +.conversations-container{ + width: 100%; + overflow: hidden; + height: 100%; +} +.conversations{ + width: 750rpx; + height: 100%; + overflow-x: hidden; + display: flex; + flex-direction: column; + overflow-x: hidden; +} +.conversations .scroll-item{ + height: 152rpx; + padding-left: 32rpx; + display: flex; + align-items: center; +} +.conversations .scroll-item .head-icon{ + width:100rpx; + height: 100rpx; + margin-right: 28rpx; +} +.conversations .scroll-item_info{ + height: 151rpx; + width: 590rpx; + padding-right: 32rpx; + box-sizing: border-box; + border-bottom: 1px solid #EFEFEF; +} +.conversations .scroll-item_info .item-info-top{ + padding-top: 20rpx; + height: 60rpx; + line-height: 60rpx; + display: flex; + align-items: center; + justify-content: space-between; + +} +.conversations .item-info-top_name{ + font-size: 34rpx; + color: #262628; +} +.conversations .item-info-top_time{ + font-size: 26rpx; + color: rgba(179, 179, 179, 0.8); + font-family: Source Han Sans CN; +} +.conversations .item-info-bottom{ + height: 40rpx; + line-height: 40rpx; + overflow: hidden; +} +.conversations .item-info-bottom-item{ + display: flex; + align-items: center; + justify-content: space-between; +} +.item-info-bottom .item-info-top_content{ + font-size: 30rpx; + color: #b3b3b3; + overflow: hidden; + text-overflow:ellipsis; + white-space: nowrap; + +} +.item-info-bottom .item-info-bottom_unread{ + padding: 6rpx; + background-color: #EE593C; + color: #FFFFFF; + font-size: 24rpx; + line-height: 28rpx; + border-radius: 24rpx; + min-width: 24rpx; + min-height: 24rpx; + text-align: center; +} +.no-conversation{ + width: 100%; + text-align: center; + height: 80rpx; + line-height: 80rpx; + font-size: 28rpx; + color: #9D9D9D; +} + +.item-info-bottom .item-info-bottom_action{ + width:30rpx; + height: 30rpx; + font-size: 20rpx; + background-size: 28rpx 30rpx; +} + +.item-head{ + position: relative; +} + +.item-head .item-head_unread{ + padding: 6rpx; + background-color: #EE593C; + color: #FFFFFF; + font-size: 24rpx; + line-height: 28rpx; + border-radius: 24rpx; + min-width: 24rpx; + min-height: 24rpx; + text-align: center; + position: absolute; + top:0; + right: 15rpx; +} +.action-container{ + width: 100%; + height: 100%; + position: absolute; + top: 0; + left: 0; + display: flex; + justify-content: center; + align-items: center; +} +.action-container .layer{ + position: absolute; + top: 0; + left: 0; + background: rgba(51, 51, 51, 0.5); + width: 100%; + height: 100%; + z-index: 99; +} +.action-box{ + width: 400rpx; + height: 240rpx; + background: #ffffff; + position: relative; + z-index: 100; + border-radius: 20rpx; + overflow: hidden; +} +.action-item{ + text-align: center; + line-height: 120rpx; + font-size: 34rpx; + color: #262628; + border-bottom: 1px solid #EFEFEF; + +} +.action-toast{ + position: absolute; + width: 400rpx; + height: 100rpx; + font-size: 30rpx; + line-height: 100rpx; + background: #9D9D9D; + border-radius: 20rpx; + top:50%; + left: 50%; + margin: -50rpx -200rpx; + text-align: center; + color: #262628; +} \ No newline at end of file diff --git a/pages/login/login.js b/pages/login/login.js new file mode 100644 index 0000000..290c471 --- /dev/null +++ b/pages/login/login.js @@ -0,0 +1,27 @@ +/* login.js */ +import restapi from "../../static/lib/restapi"; +Page({ + data: { + username:"", + password:"", + showError:false, + }, + login: function(e) { + let username = e.detail.value.username; + let password = e.detail.value.password; + if (username.trim() !== "" && password.trim() !== "") { + let user = restapi.findUser(username,password); + if (user) { + wx.setStorageSync('currentUser',user); + // 页面跳转 + wx.switchTab({ + url:'../conversations/conversations' + }); + return; + } + } + this.setData({ + showError:true + }); + } +}) \ No newline at end of file diff --git a/pages/login/login.json b/pages/login/login.json new file mode 100644 index 0000000..6101173 --- /dev/null +++ b/pages/login/login.json @@ -0,0 +1,3 @@ +{ + "navigationBarTitleText": "" +} diff --git a/pages/login/login.wxml b/pages/login/login.wxml new file mode 100644 index 0000000..34be976 --- /dev/null +++ b/pages/login/login.wxml @@ -0,0 +1,13 @@ + + + +
+ GoEasy IM + + + 请输入正确的用户名和密码 + + +
+
+
diff --git a/pages/login/login.wxss b/pages/login/login.wxss new file mode 100644 index 0000000..84c9b51 --- /dev/null +++ b/pages/login/login.wxss @@ -0,0 +1,67 @@ +/* login.wxss */ + +page { + width: 100%; + height: 100%; + font-family: Source Han Sans CN; +} + +.login { + display: flex; + align-items: center; + flex-direction: column; + padding: 72rpx; +} + +form{ + width: 100%; + height: 100%; + overflow: hidden; +} + +.title { + width: 100%; + font-size: 84rpx; + font-style: normal; + font-weight: bold; + color: #D02129; + text-align: center; + margin-bottom: 40rpx; +} + +.login-tips { + text-align: center; + margin-top: 40rpx; + color: #999999; +} + +.input-box { + width: 100%; + height: 100rpx; + padding: 20rpx; + border: 2rpx solid #D02129; + box-sizing: border-box; + margin-bottom: 40rpx; +} + +.error { + display: flex; + align-items: center; + width: 100%; + height: 120rpx; + padding-left: 20rpx; + box-sizing: border-box; + margin-bottom: 40rpx; + color: #D02129; + background: rgba(208, 33, 41, 0.1); +} + +.login-btn { + display: flex; + align-items: center; + justify-content: center; + width: 100%; + height: 100rpx; + color: #FFFFFF; + background: #D02129; +} diff --git a/pages/mine/mine.js b/pages/mine/mine.js new file mode 100644 index 0000000..2084455 --- /dev/null +++ b/pages/mine/mine.js @@ -0,0 +1,29 @@ +/* login.js */ +const app = getApp() +Page({ + data : { + currentUser : null + }, + onShow () { + let service = app.globalData.imService; + this.setData({ + currentUser : service.currentUser + }); + + if(!this.data.currentUser) { + wx.redirectTo({ + url : '../login/login' + }) + } + }, + logout () { + wx.im.disconnect().then(() => { + console.log("断连成功"); + wx.removeStorageSync("currentUser"); + app.globalData.imService= null; + wx.redirectTo({ + url: '../login/login' + }) + }) + } +}) \ No newline at end of file diff --git a/pages/mine/mine.json b/pages/mine/mine.json new file mode 100644 index 0000000..1da2e19 --- /dev/null +++ b/pages/mine/mine.json @@ -0,0 +1,3 @@ +{ + "navigationBarTitleText": "我的" +} diff --git a/pages/mine/mine.wxml b/pages/mine/mine.wxml new file mode 100644 index 0000000..a8938ed --- /dev/null +++ b/pages/mine/mine.wxml @@ -0,0 +1,11 @@ + +
+
+ + {{currentUser.name}} +
+
+ 欢迎体验GoEasyIM + 注销 +
+
diff --git a/pages/mine/mine.wxss b/pages/mine/mine.wxss new file mode 100644 index 0000000..e76b48c --- /dev/null +++ b/pages/mine/mine.wxss @@ -0,0 +1,36 @@ +.mine{ + width: 100%; + height: 100%; + display: flex; + flex-direction: column; +} +.top{ + height: 400rpx; + background: #F3F4F7; + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; +} +.top image{ + width:156rpx; + height: 156rpx; + border-radius: 156rpx; +} +.top .name{ + line-height: 80rpx; +} +.bottom{ + text-align: center; + line-height: 200rpx; +} +.bottom .logout{ + width:266rpx; + height: 76rpx; + border-radius: 10rpx; + background: #D02129; + color: #ffffff; + font-size: 32rpx; + margin:0 auto; + line-height: 76rpx; +} \ No newline at end of file diff --git a/static/images/Arrow-Left.png b/static/images/Arrow-Left.png new file mode 100644 index 0000000..66a11c5 Binary files /dev/null and b/static/images/Arrow-Left.png differ diff --git a/static/images/Avatar-1.png b/static/images/Avatar-1.png new file mode 100644 index 0000000..fa57b53 Binary files /dev/null and b/static/images/Avatar-1.png differ diff --git a/static/images/Avatar-2.png b/static/images/Avatar-2.png new file mode 100644 index 0000000..7ab92a8 Binary files /dev/null and b/static/images/Avatar-2.png differ diff --git a/static/images/Avatar-3.png b/static/images/Avatar-3.png new file mode 100644 index 0000000..eeaed52 Binary files /dev/null and b/static/images/Avatar-3.png differ diff --git a/static/images/Avatar-4.png b/static/images/Avatar-4.png new file mode 100644 index 0000000..df26452 Binary files /dev/null and b/static/images/Avatar-4.png differ diff --git a/static/images/Vector.png b/static/images/Vector.png new file mode 100644 index 0000000..5b6c3d7 Binary files /dev/null and b/static/images/Vector.png differ diff --git a/static/images/action.png b/static/images/action.png new file mode 100644 index 0000000..9398ca1 Binary files /dev/null and b/static/images/action.png differ diff --git a/static/images/audioImage/play.gif b/static/images/audioImage/play.gif new file mode 100644 index 0000000..e367c87 Binary files /dev/null and b/static/images/audioImage/play.gif differ diff --git a/static/images/audioImage/voice.png b/static/images/audioImage/voice.png new file mode 100644 index 0000000..93d6090 Binary files /dev/null and b/static/images/audioImage/voice.png differ diff --git a/static/images/chat-active.png b/static/images/chat-active.png new file mode 100644 index 0000000..06c019b Binary files /dev/null and b/static/images/chat-active.png differ diff --git a/static/images/chat.png b/static/images/chat.png new file mode 100644 index 0000000..75884e0 Binary files /dev/null and b/static/images/chat.png differ diff --git a/static/images/contacts-active.png b/static/images/contacts-active.png new file mode 100644 index 0000000..81e3d98 Binary files /dev/null and b/static/images/contacts-active.png differ diff --git a/static/images/contacts.png b/static/images/contacts.png new file mode 100644 index 0000000..c16c89b Binary files /dev/null and b/static/images/contacts.png differ diff --git a/static/images/dingdan.png b/static/images/dingdan.png new file mode 100644 index 0000000..c56da6e Binary files /dev/null and b/static/images/dingdan.png differ diff --git a/static/images/emoji.png b/static/images/emoji.png new file mode 100644 index 0000000..4fd0201 Binary files /dev/null and b/static/images/emoji.png differ diff --git a/static/images/failed.png b/static/images/failed.png new file mode 100644 index 0000000..09fc972 Binary files /dev/null and b/static/images/failed.png differ diff --git a/static/images/file-content.png b/static/images/file-content.png new file mode 100644 index 0000000..306f4fd Binary files /dev/null and b/static/images/file-content.png differ diff --git a/static/images/file-icon.png b/static/images/file-icon.png new file mode 100644 index 0000000..c0d6651 Binary files /dev/null and b/static/images/file-icon.png differ diff --git a/static/images/file.png b/static/images/file.png new file mode 100644 index 0000000..0afabe5 Binary files /dev/null and b/static/images/file.png differ diff --git a/static/images/goeasy.jpeg b/static/images/goeasy.jpeg new file mode 100644 index 0000000..7a9f055 Binary files /dev/null and b/static/images/goeasy.jpeg differ diff --git a/static/images/green-dot.png b/static/images/green-dot.png new file mode 100644 index 0000000..3b84707 Binary files /dev/null and b/static/images/green-dot.png differ diff --git a/static/images/group-icon.png b/static/images/group-icon.png new file mode 100644 index 0000000..5d1bb15 Binary files /dev/null and b/static/images/group-icon.png differ diff --git a/static/images/group.png b/static/images/group.png new file mode 100644 index 0000000..90181ab Binary files /dev/null and b/static/images/group.png differ diff --git a/static/images/im.gif b/static/images/im.gif new file mode 100644 index 0000000..db65d9a Binary files /dev/null and b/static/images/im.gif differ diff --git a/static/images/jianpan.png b/static/images/jianpan.png new file mode 100644 index 0000000..260e6f3 Binary files /dev/null and b/static/images/jianpan.png differ diff --git a/static/images/loading.gif b/static/images/loading.gif new file mode 100644 index 0000000..53edda2 Binary files /dev/null and b/static/images/loading.gif differ diff --git a/static/images/mine-active.png b/static/images/mine-active.png new file mode 100644 index 0000000..9da9a75 Binary files /dev/null and b/static/images/mine-active.png differ diff --git a/static/images/mine.png b/static/images/mine.png new file mode 100644 index 0000000..689f32e Binary files /dev/null and b/static/images/mine.png differ diff --git a/static/images/more.png b/static/images/more.png new file mode 100644 index 0000000..e2184e6 Binary files /dev/null and b/static/images/more.png differ diff --git a/static/images/pending.gif b/static/images/pending.gif new file mode 100644 index 0000000..e846e1d Binary files /dev/null and b/static/images/pending.gif differ diff --git a/static/images/record-appearance-icon.png b/static/images/record-appearance-icon.png new file mode 100644 index 0000000..e77eed5 Binary files /dev/null and b/static/images/record-appearance-icon.png differ diff --git a/static/images/recordImage/loading.gif b/static/images/recordImage/loading.gif new file mode 100644 index 0000000..3c8c141 Binary files /dev/null and b/static/images/recordImage/loading.gif differ diff --git a/static/images/shipin.png b/static/images/shipin.png new file mode 100644 index 0000000..26f4c24 Binary files /dev/null and b/static/images/shipin.png differ diff --git a/static/images/tupian.png b/static/images/tupian.png new file mode 100644 index 0000000..a143e80 Binary files /dev/null and b/static/images/tupian.png differ diff --git a/static/images/uniapp.png b/static/images/uniapp.png new file mode 100644 index 0000000..3455b37 Binary files /dev/null and b/static/images/uniapp.png differ diff --git a/static/images/videoImage/play.png b/static/images/videoImage/play.png new file mode 100644 index 0000000..0e6338e Binary files /dev/null and b/static/images/videoImage/play.png differ diff --git a/static/images/wx.png b/static/images/wx.png new file mode 100644 index 0000000..e6009c0 Binary files /dev/null and b/static/images/wx.png differ diff --git a/static/images/zidingyi.png b/static/images/zidingyi.png new file mode 100644 index 0000000..a8fbb48 Binary files /dev/null and b/static/images/zidingyi.png differ diff --git a/static/lib/EmojiDecoder.js b/static/lib/EmojiDecoder.js new file mode 100644 index 0000000..8657a3e --- /dev/null +++ b/static/lib/EmojiDecoder.js @@ -0,0 +1,33 @@ +/* +* @Author: jack.lu +* @Date: 2020/9/11 +* @Last Modified by: jack.lu +* @Last Modified time: 2020/9/11 4:35 下午 +*/ + +class EmojiDecoder { + emojiMap = null; + url = ""; + patterns = []; + metaChars = /[[\]{}()*+?.\\|^$\-,&#\s]/g; + decode = this.decode; + + constructor(url,emojiMap) { + this.url = url || ''; + this.emojiMap = emojiMap || {}; + for (let i in this.emojiMap) { + if (this.emojiMap.hasOwnProperty(i)){ + this.patterns.push('('+i.replace(this.metaChars, "\\$&")+')'); + } + } + console.log(this) + } + + decode (text) { + return text.replace(new RegExp(this.patterns.join('|'),'g'), (match) => { + return typeof this.emojiMap[match] != 'undefined' ? '' : match; + }); + } +} + +export default EmojiDecoder \ No newline at end of file diff --git a/static/lib/goeasy-im-1.5.1.js b/static/lib/goeasy-im-1.5.1.js new file mode 100644 index 0000000..e4131bb --- /dev/null +++ b/static/lib/goeasy-im-1.5.1.js @@ -0,0 +1,2 @@ +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.GoEasyIM=t():e.GoEasyIM=t()}("undefined"!=typeof self?self:this,function(){return function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:o})},n.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=120)}([function(e,t,n){"use strict";t.__esModule=!0,t["default"]=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},function(e,t,n){"use strict";t.__esModule=!0;var o,r=n(127),i=(o=r)&&o.__esModule?o:{"default":o};t["default"]=function(){function e(e,t){for(var n=0;n1?{type:u[o],data:e.substring(1)}:{type:u[o]}:c}o=new Uint8Array(e)[0];var r=sliceBuffer(e,1);return l&&"blob"===t&&(r=new l([r])),{type:u[o],data:r}},t.encodePayload=function(e,n,o){"function"==typeof n&&(o=n,n=null);var s=r(e);if(!e.length)return o("0:");!function(e,t,n){for(var o=new Array(e.length),r=i(e.length,n),s=function(e,n,r){t(n,function(t,n){o[e]=n,r(t,o)})},a=0;a300)return o["default"].reject({code:400,content:"user.data-length limit 300 byte."});this.initialBeforeConnect(e);var t=this._connection.connect(e);return this.initialAfterConnect(),t}},{key:"disconnect",value:function(){return this._connection.disconnect()}},{key:"getStatus",value:function(){return this._goEasySocket?this._goEasySocket.getStatus():S["default"].DISCONNECTED}},{key:"createTextMessage",value:function(e){return l.messageCreator.create(f["default"].text,e)}},{key:"createImageMessage",value:function(e){return l.messageCreator.create(f["default"].image,e)}},{key:"createFileMessage",value:function(e){return l.messageCreator.create(f["default"].file,e)}},{key:"createAudioMessage",value:function(e){return l.messageCreator.create(f["default"].audio,e)}},{key:"createVideoMessage",value:function(e){return l.messageCreator.create(f["default"].video,e)}},{key:"createCustomMessage",value:function(e){return l.messageCreator.create(e.type,e)}},{key:"latestConversations",value:function(){return this._conversations?this._conversations.latestConversations():o["default"].reject({code:500,content:"Please connect GoEasyIM first."})}},{key:"groupMarkAsRead",value:function(e,t){return this._conversations.groupMarkAsRead(e,t)}},{key:"privateMarkAsRead",value:function(e,t){return this._conversations.privateMarkAsRead(e,t)}},{key:"removePrivateConversation",value:function(e){return this._conversations.removeConversation(e,a.ConversationType.PRIVATE)}},{key:"removeGroupConversation",value:function(e){return this._conversations.removeConversation(e,a.ConversationType.GROUP)}},{key:"topPrivateConversation",value:function(e,t){return this._conversations.topConversation(e,t,a.ConversationType.PRIVATE)}},{key:"topGroupConversation",value:function(e,t){return this._conversations.topConversation(e,t,a.ConversationType.GROUP)}},{key:"history",value:function(e){return this._history.history(e)}},{key:"upload",value:function(e,t,n){return this._goEasyUploader.upload(e,t,n)}},{key:"sendSystemMessage",value:function(e,t){return this._messageSender.send(e,t,a.ConversationType.SYSTEM)}},{key:"sendMessage",value:function(e){return this._messageSender.sendMessage(e)}},{key:"sendPrivateMessage",value:function(e,t){return this._messageSender.send(e,t,a.ConversationType.PRIVATE)}},{key:"subscribeUserPresence",value:function(e){return this._userPresenceSubscriber.presence(e)}},{key:"unsubscribeUserPresence",value:function(e){return this._userPresenceSubscriber.unPresence(e)}},{key:"hereNow",value:function(e){return this._userHereNow.hereNow(e,a.ConversationType.PRIVATE)}},{key:"sendGroupMessage",value:function(e,t){return this._messageSender.send(e,t,a.ConversationType.GROUP)}},{key:"subscribeGroup",value:function(e){return this._groupMessageReceive.subscribe(e)}},{key:"unsubscribeGroup",value:function(e){return this._groupMessageReceive.unsubscribe(e)}},{key:"subscribeGroupPresence",value:function(e){return this._groupPresenceSubscriber.presence(e)}},{key:"unsubscribeGroupPresence",value:function(e){return this._groupPresenceSubscriber.unPresence(e)}},{key:"groupHereNow",value:function(e){return this._groupHereNow.hereNow(e)}},{key:"groupOnlineCount",value:function(e){return this._groupOnlineCount.get(e)}},{key:"setUriAndOpts",value:function(){var e=void 0,t=void 0,n="://"+u.GoEasyDomainNumber.refreshNumber()+this._host;if(u.env.isBrowserClient()){e=!1===this._forceTLS?"http"+n+":80":"https"+n+":443";t={transports:!0===this._supportOldBrowser?["polling","websocket"]:["websocket"],timeout:d.SocketTimeout.connect}}else e="https://wx-"+this._host+":443",t={transports:["websocket"],reconnectionDelayMax:d.SocketTimeout.reconnectionDelayMax};return{uri:e,opts:t}}}]),e}();P.version=null,P.userId=undefined,P.userData=null,t["default"]=P},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=l(n(16)),r=l(n(0)),i=l(n(1)),s=l(n(39)),a=n(6),u=(l(n(9)),l(n(49))),c=n(26);function l(e){return e&&e.__esModule?e:{"default":e}}var f=function(){function e(t){(0,r["default"])(this,e),this.type="",this.to={type:null,id:null,data:null},this.timestamp=Date.now(),this.senderId=null,this.payload=null,this.messageId=a.UUID.get(),this.status=u["default"]["new"],this.validate(t),this.setSenderId(),this.setType(t),this.setNotification(t),this.setPayload(t),this.setTo(t),this.setData()}return(0,i["default"])(e,[{key:"validate",value:function(e){if(!a.calibrator.isObject(e))throw Error("it is an empty message.")}},{key:"setType",value:function(e){throw Error("Abstract method")}},{key:"setNotification",value:function(e){if(e.notification){if(!a.calibrator.isObject(e.notification))throw Error("notification require an object.");if(a.calibrator.isEmpty(e.notification.title))throw Error("notification's title is empty.");if(a.calibrator.isEmpty(e.notification.body))throw Error("notification's body is empty.");if(e.notification.title.length>32)throw Error("notification's title over max length 32");if(e.notification.body.length>50)throw Error("notification's body over max length 50");this.notification=e.notification}}},{key:"setPayload",value:function(e){this.payload=(0,o["default"])(null)}},{key:"setSenderId",value:function(){if(!s["default"].userId)throw Error("please call connect() first.");this.senderId=s["default"].userId}},{key:"setTo",value:function(e){this.to=e.to}},{key:"setData",value:function(){this.to&&this.to.type==c.ConversationType.GROUP&&(this.senderData=s["default"].userData)}}]),e}();t["default"]=f},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t["default"]={DISCONNECTED:"disconnected",DISCONNECTING:"disconnecting",CONNECTING:"connecting",CONNECTED:"connected",RECONNECTING:"reconnecting",RECONNECTED:"reconnected",EXPIRED_RECONNECTED:"reconnected",CONNECT_FAILED:"connect_failed"}},function(e,t,n){function o(e){if(e)return function(e){for(var t in o.prototype)e[t]=o.prototype[t];return e}(e)}e.exports=o,o.prototype.on=o.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},o.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},o.prototype.off=o.prototype.removeListener=o.prototype.removeAllListeners=o.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n,o=this._callbacks["$"+e];if(!o)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var r=0;r31457280)throw Error("message-length limit 30mib")}},{key:"setPayload",value:function(e){(0,a["default"])(t.prototype.__proto__||(0,o["default"])(t.prototype),"setPayload",this).call(this,e),this.payload.contentType=e.file.type,this.payload.name=e.file.name,this.payload.size=e.file.size;var n=(window.URL||window.webkitURL).createObjectURL(e.file);this.payload.url=n}}]),t}(c(n(70))["default"]);t["default"]=l},function(e,t,n){(function(o){function r(){var e;try{e=t.storage.debug}catch(n){}return!e&&void 0!==o&&"env"in o&&(e=o.env.DEBUG),e}(t=e.exports=n(200)).log=function(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)},t.formatArgs=function(e){var n=this.useColors;if(e[0]=(n?"%c":"")+this.namespace+(n?" %c":" ")+e[0]+(n?"%c ":" ")+"+"+t.humanize(this.diff),!n)return;var o="color: "+this.color;e.splice(1,0,o,"color: inherit");var r=0,i=0;e[0].replace(/%[a-zA-Z%]/g,function(e){"%%"!==e&&"%c"===e&&(i=++r)}),e.splice(i,0,o)},t.save=function(e){try{null==e?t.storage.removeItem("debug"):t.storage.debug=e}catch(n){}},t.load=r,t.useColors=function(){if("undefined"!=typeof window&&window.process&&"renderer"===window.process.type)return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage="undefined"!=typeof chrome&&"undefined"!=typeof chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(e){}}(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.formatters.j=function(e){try{return JSON.stringify(e)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}},t.enable(r())}).call(t,n(71))},function(e,t){t.encode=function(e){var t="";for(var n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t},t.decode=function(e){for(var t={},n=e.split("&"),o=0,r=n.length;odocument.F=Object<\/script>"),e.close(),u=e.F;o--;)delete u.prototype[i[o]];return u()};e.exports=Object.create||function(e,t){var n;return null!==e?(a.prototype=o(e),n=new a,a.prototype=null,n[s]=e):n=u(),t===undefined?n:r(n,t)}},function(e,t){e.exports=function(e){if(e==undefined)throw TypeError("Can't call method on "+e);return e}},function(e,t){var n=Math.ceil,o=Math.floor;e.exports=function(e){return isNaN(e=+e)?0:(e>0?o:n)(e)}},function(e,t,n){var o=n(61)("keys"),r=n(45);e.exports=function(e){return o[e]||(o[e]=r(e))}},function(e,t,n){var o=n(7),r=n(11),i=r["__core-js_shared__"]||(r["__core-js_shared__"]={});(e.exports=function(e,t){return i[e]||(i[e]=t!==undefined?t:{})})("versions",[]).push({version:o.version,mode:n(36)?"pure":"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})},function(e,t){e.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(e,t,n){t.f=n(12)},function(e,t,n){var o=n(11),r=n(7),i=n(36),s=n(63),a=n(22).f;e.exports=function(e){var t=r.Symbol||(r.Symbol=i?{}:o.Symbol||{});"_"==e.charAt(0)||e in t||a(t,e,{value:s.f(e)})}},function(e,t){t.f=Object.getOwnPropertySymbols},function(e,t,n){var o=n(47),r=n(44),i=n(29),s=n(56),a=n(28),u=n(79),c=Object.getOwnPropertyDescriptor;t.f=n(19)?c:function(e,t){if(e=i(e),t=s(t,!0),u)try{return c(e,t)}catch(n){}if(a(e,t))return r(!o.f.call(e,t),e[t])}},function(e,t,n){var o=n(17),r=n(7),i=n(30);e.exports=function(e,t){var n=(r.Object||{})[e]||Object[e],s={};s[e]=t(n),o(o.S+o.F*i(function(){n(1)}),"Object",s)}},function(e,t,n){"use strict";var o=n(43);e.exports.f=function(e){return new function(e){var t,n;this.promise=new e(function(e,o){if(t!==undefined||n!==undefined)throw TypeError("Bad Promise constructor");t=e,n=o}),this.resolve=o(t),this.reject=o(n)}(e)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.ConversationType={GROUP:"group",PRIVATE:"private"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=f(n(2)),r=f(n(0)),i=f(n(1)),s=f(n(3)),a=f(n(8)),u=f(n(4)),c=f(n(40)),l=f(n(9));function f(e){return e&&e.__esModule?e:{"default":e}}var d=function(e){function t(e){(0,r["default"])(this,t);var n=(0,s["default"])(this,(t.__proto__||(0,o["default"])(t)).call(this,e));return n.file=null,n.onProgress=null,n.setFile(e.file),n.setOnProgress(e.onProgress),n}return(0,u["default"])(t,e),(0,i["default"])(t,[{key:"validate",value:function(e){(0,a["default"])(t.prototype.__proto__||(0,o["default"])(t.prototype),"validate",this).call(this,e)}},{key:"setPayload",value:function(e){(0,a["default"])(t.prototype.__proto__||(0,o["default"])(t.prototype),"setPayload",this).call(this,e),this.payload.size="",this.payload.contentType="",this.payload.name="",this.payload.url=""}},{key:"setType",value:function(e){this.type=l["default"].file}},{key:"setFile",value:function(e){this.file=e}},{key:"setOnProgress",value:function(e){this.onProgress=e}}]),t}(c["default"]);t["default"]=d},function(e,t){var n,o,r=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(e){if(n===setTimeout)return setTimeout(e,0);if((n===i||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:i}catch(e){n=i}try{o="function"==typeof clearTimeout?clearTimeout:s}catch(e){o=s}}();var u,c=[],l=!1,f=-1;function d(){l&&u&&(l=!1,u.length?c=u.concat(c):f=-1,c.length&&p())}function p(){if(!l){var e=a(d);l=!0;for(var t=c.length;t;){for(u=c,c=[];++f1)for(var n=1;n=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage="undefined"!=typeof chrome&&"undefined"!=typeof chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(e){}}(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.formatters.j=function(e){try{return JSON.stringify(e)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}},t.enable(r())}).call(t,n(71))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=i(n(0)),r=i(n(1));function i(e){return e&&e.__esModule?e:{"default":e}}var s=function(){function e(){(0,o["default"])(this,e)}return(0,r["default"])(e,[{key:"upload",value:function(e){throw Error("Not implementation yet.")}}]),e}();t["default"]=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t["default"]={message:"message",imMessage:"imMessage",userPresence:"userPresence",groupPresence:"groupPresence"}},function(e,t,n){e.exports=!n(19)&&!n(30)(function(){return 7!=Object.defineProperty(n(55)("div"),"a",{get:function(){return 7}}).a})},function(e,t,n){var o=n(28),r=n(29),i=n(125)(!1),s=n(60)("IE_PROTO");e.exports=function(e,t){var n,a=r(e),u=0,c=[];for(n in a)n!=s&&o(a,n)&&c.push(n);for(;t.length>u;)o(a,n=t[u++])&&(~i(c,n)||c.push(n));return c}},function(e,t,n){var o=n(35);e.exports=Object("z").propertyIsEnumerable(0)?Object:function(e){return"String"==o(e)?e.split(""):Object(e)}},function(e,t,n){var o=n(59),r=Math.min;e.exports=function(e){return e>0?r(o(e),9007199254740991):0}},function(e,t,n){var o=n(11).document;e.exports=o&&o.documentElement},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ImEventType=undefined;var o,r=n(16);var i=(0,((o=r)&&o.__esModule?o:{"default":o})["default"])(null);i.PRIVATE_MESSAGE_RECEIVED="PRIVATE_MESSAGE_RECEIVED",i.GROUP_MESSAGE_RECEIVED="GROUP_MESSAGE_RECEIVED",i.SYSTEM_MESSAGE_RECEIVED="SYSTEM_MESSAGE_RECEIVED",i.CONVERSATIONS_UPDATED="CONVERSATIONS_UPDATED",i.CONNECTED="CONNECTED",i.CONNECTING="CONNECTING",i.DISCONNECTED="DISCONNECTED",i.USER_PRESENCE="USER_PRESENCE",i.GROUP_PRESENCE="GROUP_PRESENCE",t.ImEventType=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.calibrator=undefined;var o=s(n(20)),r=s(n(0)),i=s(n(1));function s(e){return e&&e.__esModule?e:{"default":e}}var a=new(function(){function e(){(0,r["default"])(this,e)}return(0,i["default"])(e,[{key:"isUndef",value:function(e){return e===undefined||null===e}},{key:"isTrue",value:function(e){return!0===e}},{key:"isFalse",value:function(e){return!1===e}},{key:"isPrimitive",value:function(e){return"string"==typeof e||"number"==typeof e||"symbol"===(void 0===e?"undefined":(0,o["default"])(e))||"boolean"==typeof e}},{key:"isDef",value:function(e){return e!==undefined&&null!==e}},{key:"isObject",value:function(e){return null!==e&&"object"===(void 0===e?"undefined":(0,o["default"])(e))}},{key:"isPlainObject",value:function(e){return"[object Object]"===Object.prototype.toString.call(e)}},{key:"isRegExp",value:function(e){return"[object RegExp]"===Object.prototype.toString.call(e)}},{key:"isValidArrayIndex",value:function(e){var t=parseFloat(String(e));return t>=0&&Math.floor(t)===t&&isFinite(e)}},{key:"isStringOrNumber",value:function(e){return"string"==typeof e||"number"==typeof e}},{key:"isString",value:function(e){return"string"==typeof e}},{key:"isNumber",value:function(e){return"number"==typeof e}},{key:"isArray",value:function(e){return"[object Array]"==Object.prototype.toString.call(e)}},{key:"isEmpty",value:function(e){return this.isArray(e)?0==e.length:this.isObject(e)?!this.isDef(e):!this.isNumber(e)&&(this.isString(e)?""==e.trim():!this.isDef(e))}},{key:"isNative",value:function(e){return"function"==typeof e&&/native code/.test(e.toString())}},{key:"isFunction",value:function(e){return"function"==typeof e}}]),e}());t.calibrator=a},function(e,t,n){"use strict";var o=n(133)(!0);n(87)(String,"String",function(e){this._t=String(e),this._i=0},function(){var e,t=this._t,n=this._i;return n>=t.length?{value:undefined,done:!0}:(e=o(t,n),this._i+=e.length,{value:e,done:!1})})},function(e,t,n){"use strict";var o=n(36),r=n(17),i=n(88),s=n(27),a=n(37),u=n(134),c=n(46),l=n(89),f=n(12)("iterator"),d=!([].keys&&"next"in[].keys()),p=function(){return this};e.exports=function(e,t,n,h,y,v,m){u(n,t,h);var g,b,_,C=function(e){if(!d&&e in T)return T[e];switch(e){case"keys":case"values":return function(){return new n(this,e)}}return function(){return new n(this,e)}},k=t+" Iterator",w="values"==y,E=!1,T=e.prototype,O=T[f]||T["@@iterator"]||y&&T[y],S=O||C(y),M=y?w?C("entries"):S:undefined,P="Array"==t&&T.entries||O;if(P&&(_=l(P.call(new e)))!==Object.prototype&&_.next&&(c(_,k,!0),o||"function"==typeof _[f]||s(_,f,p)),w&&O&&"values"!==O.name&&(E=!0,S=function(){return O.call(this)}),o&&!m||!d&&!E&&T[f]||s(T,f,S),a[t]=S,a[k]=p,y)if(g={values:w?S:C("values"),keys:v?S:C("keys"),entries:M},m)for(b in g)b in T||i(T,b,g[b]);else r(r.P+r.F*(d||E),t,g);return g}},function(e,t,n){e.exports=n(27)},function(e,t,n){var o=n(28),r=n(38),i=n(60)("IE_PROTO"),s=Object.prototype;e.exports=Object.getPrototypeOf||function(e){return e=r(e),o(e,i)?e[i]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?s:null}},function(e,t,n){n(135);for(var o=n(11),r=n(27),i=n(37),s=n(12)("toStringTag"),a="CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,TextTrackList,TouchList".split(","),u=0;u-1)}},{key:"isTT",value:function(){return!("object"!==("undefined"==typeof tt?"undefined":(0,o["default"])(tt))||!tt.getSystemInfo)}},{key:"isBrowserClient",value:function(){return this.isUni()?"function"==typeof WebSocket&&"function"==typeof XMLHttpRequest&&"object"==("undefined"==typeof localStorage?"undefined":(0,o["default"])(localStorage)):!(this.isReactNative()||this.isWx()||this.isTT())}},{key:"isReactNative",value:function(){return"undefined"!=typeof navigator&&"ReactNative"==navigator.product}}]),e}());t.env=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GoEasyDomainNumber=undefined;var o=u(n(0)),r=u(n(1)),i=n(93),s=n(158),a=u(n(159));function u(e){return e&&e.__esModule?e:{"default":e}}var c=function(){function e(){(0,o["default"])(this,e)}return(0,r["default"])(e,null,[{key:"refreshNumber",value:function(){var e=Math.floor(Math.random()*(a["default"].maxNumber-1)+1);return i.env.isBrowserClient()&&(e=parseInt(s.storage.getData("goEasyNode"))||e),e>0&&en;)t.push(arguments[n++]);return m[++v]=function(){a("function"==typeof e?e:Function(e),t)},o(v),v},p=function(e){delete m[e]},"process"==n(35)(f)?o=function(e){f.nextTick(s(g,e,1))}:y&&y.now?o=function(e){y.now(s(g,e,1))}:h?(i=(r=new h).port2,r.port1.onmessage=b,o=s(i.postMessage,i,1)):l.addEventListener&&"function"==typeof postMessage&&!l.importScripts?(o=function(e){l.postMessage(e+"","*")},l.addEventListener("message",b,!1)):o="onreadystatechange"in c("script")?function(e){u.appendChild(c("script")).onreadystatechange=function(){u.removeChild(this),g.call(e)}}:function(e){setTimeout(s(g,e,1),0)}),e.exports={set:d,clear:p}},function(e,t){e.exports=function(e){try{return{e:!1,v:e()}}catch(t){return{e:!0,v:t}}}},function(e,t,n){var o=n(18),r=n(23),i=n(68);e.exports=function(e,t){if(o(e),r(t)&&t.constructor===e)return t;var n=i.f(e);return(0,n.resolve)(t),n.promise}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Conversion=undefined;var o=u(n(0)),r=u(n(1)),i=n(69),s=u(n(39)),a=u(n(48));function u(e){return e&&e.__esModule?e:{"default":e}}t.Conversion=function(){function e(){(0,o["default"])(this,e),this.type="",this.lastMessage=null,this.unread=0,this.top=!1,this.data=null,this.lc=0,this.lm=0}return(0,r["default"])(e,null,[{key:"buildByInMessage",value:function(t){var n=new e;return n.type=t.t,n.lastMessage=a["default"].assemble(t),n.lc=n.lastMessage.timestamp-1,n.lm=n.lastMessage.timestamp,n.unread=0,t.t==i.ConversationType.GROUP?n.groupId=t.r:s["default"].userId==t.r?n.userId=t.s:n.userId=t.r,n}},{key:"buildByOutMessage",value:function(t,n,o,r){var s=new e;return s.type=n,s.lastMessage=t,s.lm=s.lastMessage.timestamp,s.lc=s.lm,s.unread=0,n==i.ConversationType.GROUP?(s.groupId=o,s.lastMessage.groupId=o):(s.userId=o,s.lastMessage.receiverId=o),s}},{key:"buildByConversation",value:function(t,n){var o=new e;o.type=n.t,n.lmsg.t=n.t,o.lastMessage=a["default"].assemble(n.lmsg),o.unread=0,o.lc=n.lcts,o.lm=o.lastMessage.timestamp,o.top=n.top||!1;var r=n.d?JSON.parse(n.d):{};return o.data=r,n.t==i.ConversationType.GROUP?(o.groupId=n.g,t.putGroupData(o.groupId,r)):(o.userId=n.uid,t.putUserData(o.userId,r),s["default"].userId==n.lmsg.s?o.lastMessage.senderData=s["default"].userData:o.lastMessage.senderData=r),o}}]),e}()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=s(n(0)),r=s(n(1)),i=n(6);function s(e){return e&&e.__esModule?e:{"default":e}}var a=function(){function e(){(0,o["default"])(this,e)}return(0,r["default"])(e,null,[{key:"resolve",value:function(){return i.env.isUni()?"uniApp":i.env.isWx()?"wx":"html"}}]),e}();t["default"]=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=d(n(2)),r=d(n(0)),i=d(n(1)),s=d(n(3)),a=d(n(8)),u=d(n(4)),c=d(n(40)),l=d(n(9)),f=n(6);function d(e){return e&&e.__esModule?e:{"default":e}}var p=function(e){function t(e){return(0,r["default"])(this,t),(0,s["default"])(this,(t.__proto__||(0,o["default"])(t)).call(this,e))}return(0,u["default"])(t,e),(0,i["default"])(t,[{key:"validate",value:function(e){if(f.calibrator.isEmpty(e.text)||""==e.text.trim())throw Error("text is empty")}},{key:"setType",value:function(e){this.type=l["default"].text}},{key:"setPayload",value:function(e){(0,a["default"])(t.prototype.__proto__||(0,o["default"])(t.prototype),"setPayload",this).call(this,e),this.payload.text=e.text}}]),t}(c["default"]);t["default"]=p},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=l(n(0)),r=l(n(1)),i=l(n(41)),s=l(n(10)),a=l(n(197)),u=l(n(198)),c=n(6);function l(e){return e&&e.__esModule?e:{"default":e}}var f=function(){function e(){(0,o["default"])(this,e),this.io=u["default"],this.status=i["default"].DISCONNECTED,this.permissions=[s["default"].NONE],this.emitter=null,this.connectedObservers=[],this.disconnectedObservers=[],this.emitter=new a["default"](this)}return(0,r["default"])(e,[{key:"connect",value:function(){this.status=i["default"].CONNECTING}},{key:"emit",value:function(e){this.emitter.emit(e)}},{key:"doEmit",value:function(e,t,n){}},{key:"on",value:function(e,t){this.io.on(e,t)}},{key:"disconnect",value:function(){this.io.disconnect()}},{key:"getStatus",value:function(){return this.status}},{key:"addConnectedObserver",value:function(e){c.calibrator.isFunction(e)&&this.connectedObservers.push(e)}},{key:"addDisconnectedObserver",value:function(e){c.calibrator.isFunction(e)&&this.disconnectedObservers.push(e)}},{key:"notify",value:function(e,t){for(var n=0;n0&&!this.encoding){var e=this.packetBuffer.shift();this.packet(e)}},v.prototype.cleanup=function(){for(var e=this.subs.length,t=0;t=this._reconnectionAttempts)this.backoff.reset(),this.emitAll("reconnect_failed"),this.reconnecting=!1;else{var t=this.backoff.duration();this.reconnecting=!0;var n=setTimeout(function(){e.skipReconnect||(e.emitAll("reconnect_attempt",e.backoff.attempts),e.emitAll("reconnecting",e.backoff.attempts),e.skipReconnect||(m()?(e.reconnecting=!1,e.reconnect(),e.emitAll("reconnect_error","Uniapp running backend, skipped reconnect...")):e.open(function(t){t?(e.reconnecting=!1,e.reconnect(),e.emitAll("reconnect_error",t.data)):e.onreconnect()})))},t);this.subs.push({destroy:function(){clearTimeout(n)}})}},v.prototype.onreconnect=function(){var e=this.backoff.attempts;this.reconnecting=!1,this.backoff.reset(),this.updateSocketIds(),this.emitAll("reconnect",e)}},function(e,t,n){"use strict";var o=n(209),r=n(222);t.polling=function(e){var t=!1,n=!1;e.jsonp;if("undefined"!=typeof location){var r="https:"===location.protocol,i=location.port;i||(i=r?443:80),t=e.hostname!==location.hostname||i!==e.port,n=e.secure!==r}return e.xdomain=t,e.xscheme=n,new o(e)},t.websocket=r},function(e,t,n){"use strict";var o,r="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),i=64,s={},a=0,u=0;function c(e){var t="";do{t=r[e%i]+t,e=Math.floor(e/i)}while(e>0);return t}function l(){var e=c(+new Date);return e!==o?(a=0,o=e):e+"."+c(a++)}for(;uu;)o.f(e,n=s[u++],t[n]);return e}},function(e,t,n){var o=n(29),r=n(82),i=n(126);e.exports=function(e){return function(t,n,s){var a,u=o(t),c=r(u.length),l=i(s,c);if(e&&n!=n){for(;c>l;)if((a=u[l++])!=a)return!0}else for(;c>l;l++)if((e||l in u)&&u[l]===n)return e||l||0;return!e&&-1}}},function(e,t,n){var o=n(59),r=Math.max,i=Math.min;e.exports=function(e,t){return(e=o(e))<0?r(e+t,0):i(e,t)}},function(e,t,n){e.exports={"default":n(128),__esModule:!0}},function(e,t,n){n(129);var o=n(7).Object;e.exports=function(e,t,n){return o.defineProperty(e,t,n)}},function(e,t,n){var o=n(17);o(o.S+o.F*!n(19),"Object",{defineProperty:n(22).f})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.eventCenter=undefined;var o=u(n(16)),r=u(n(0)),i=u(n(1)),s=n(84),a=n(6);function u(e){return e&&e.__esModule?e:{"default":e}}var c=new(function(){function e(){(0,r["default"])(this,e),this.subs=null,this.subs=(0,o["default"])(null)}return(0,i["default"])(e,[{key:"on",value:function(e,t){if(!a.calibrator.isString(e))throw Error("eventType require a string.");if(!a.calibrator.isDef(s.ImEventType[e]))throw Error("event not found.");if(!a.calibrator.isFunction(t))throw Error("event require a callback.");this.subs[e]=t}},{key:"notify",value:function(e,t){var n=this.subs[e];n&&n(t)}}]),e}());t.eventCenter=c},function(e,t,n){e.exports={"default":n(132),__esModule:!0}},function(e,t,n){n(86),n(90),e.exports=n(63).f("iterator")},function(e,t,n){var o=n(59),r=n(58);e.exports=function(e){return function(t,n){var i,s,a=String(r(t)),u=o(n),c=a.length;return u<0||u>=c?e?"":undefined:(i=a.charCodeAt(u))<55296||i>56319||u+1===c||(s=a.charCodeAt(u+1))<56320||s>57343?e?a.charAt(u):i:e?a.slice(u,u+2):s-56320+(i-55296<<10)+65536}}},function(e,t,n){"use strict";var o=n(57),r=n(44),i=n(46),s={};n(27)(s,n(12)("iterator"),function(){return this}),e.exports=function(e,t,n){e.prototype=o(s,{next:r(1,n)}),i(e,t+" Iterator")}},function(e,t,n){"use strict";var o=n(136),r=n(137),i=n(37),s=n(29);e.exports=n(87)(Array,"Array",function(e,t){this._t=s(e),this._i=0,this._k=t},function(){var e=this._t,t=this._k,n=this._i++;return!e||n>=e.length?(this._t=undefined,r(1)):r(0,"keys"==t?n:"values"==t?e[n]:[n,e[n]])},"values"),i.Arguments=i.Array,o("keys"),o("values"),o("entries")},function(e,t){e.exports=function(){}},function(e,t){e.exports=function(e,t){return{value:t,done:!!e}}},function(e,t,n){e.exports={"default":n(139),__esModule:!0}},function(e,t,n){n(140),n(92),n(145),n(146),e.exports=n(7).Symbol},function(e,t,n){"use strict";var o=n(11),r=n(28),i=n(19),s=n(17),a=n(88),u=n(141).KEY,c=n(30),l=n(61),f=n(46),d=n(45),p=n(12),h=n(63),y=n(64),v=n(142),m=n(143),g=n(18),b=n(23),_=n(38),C=n(29),k=n(56),w=n(44),E=n(57),T=n(144),O=n(66),S=n(65),M=n(22),P=n(34),N=O.f,I=M.f,F=T.f,x=o.Symbol,R=o.JSON,A=R&&R.stringify,j=p("_hidden"),D=p("toPrimitive"),U={}.propertyIsEnumerable,B=l("symbol-registry"),L=l("symbols"),G=l("op-symbols"),q=Object.prototype,z="function"==typeof x&&!!S.f,V=o.QObject,H=!V||!V.prototype||!V.prototype.findChild,W=i&&c(function(){return 7!=E(I({},"a",{get:function(){return I(this,"a",{value:7}).a}})).a})?function(e,t,n){var o=N(q,t);o&&delete q[t],I(e,t,n),o&&e!==q&&I(q,t,o)}:I,J=function(e){var t=L[e]=E(x.prototype);return t._k=e,t},K=z&&"symbol"==typeof x.iterator?function(e){return"symbol"==typeof e}:function(e){return e instanceof x},Y=function(e,t,n){return e===q&&Y(G,t,n),g(e),t=k(t,!0),g(n),r(L,t)?(n.enumerable?(r(e,j)&&e[j][t]&&(e[j][t]=!1),n=E(n,{enumerable:w(0,!1)})):(r(e,j)||I(e,j,w(1,{})),e[j][t]=!0),W(e,t,n)):I(e,t,n)},X=function(e,t){g(e);for(var n,o=v(t=C(t)),r=0,i=o.length;i>r;)Y(e,n=o[r++],t[n]);return e},$=function(e){var t=U.call(this,e=k(e,!0));return!(this===q&&r(L,e)&&!r(G,e))&&(!(t||!r(this,e)||!r(L,e)||r(this,j)&&this[j][e])||t)},Q=function(e,t){if(e=C(e),t=k(t,!0),e!==q||!r(L,t)||r(G,t)){var n=N(e,t);return!n||!r(L,t)||r(e,j)&&e[j][t]||(n.enumerable=!0),n}},Z=function(e){for(var t,n=F(C(e)),o=[],i=0;n.length>i;)r(L,t=n[i++])||t==j||t==u||o.push(t);return o},ee=function(e){for(var t,n=e===q,o=F(n?G:C(e)),i=[],s=0;o.length>s;)!r(L,t=o[s++])||n&&!r(q,t)||i.push(L[t]);return i};z||(a((x=function(){if(this instanceof x)throw TypeError("Symbol is not a constructor!");var e=d(arguments.length>0?arguments[0]:undefined),t=function(n){this===q&&t.call(G,n),r(this,j)&&r(this[j],e)&&(this[j][e]=!1),W(this,e,w(1,n))};return i&&H&&W(q,e,{configurable:!0,set:t}),J(e)}).prototype,"toString",function(){return this._k}),O.f=Q,M.f=Y,n(91).f=T.f=Z,n(47).f=$,S.f=ee,i&&!n(36)&&a(q,"propertyIsEnumerable",$,!0),h.f=function(e){return J(p(e))}),s(s.G+s.W+s.F*!z,{Symbol:x});for(var te="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),ne=0;te.length>ne;)p(te[ne++]);for(var oe=P(p.store),re=0;oe.length>re;)y(oe[re++]);s(s.S+s.F*!z,"Symbol",{"for":function(e){return r(B,e+="")?B[e]:B[e]=x(e)},keyFor:function(e){if(!K(e))throw TypeError(e+" is not a symbol!");for(var t in B)if(B[t]===e)return t},useSetter:function(){H=!0},useSimple:function(){H=!1}}),s(s.S+s.F*!z,"Object",{create:function(e,t){return t===undefined?E(e):X(E(e),t)},defineProperty:Y,defineProperties:X,getOwnPropertyDescriptor:Q,getOwnPropertyNames:Z,getOwnPropertySymbols:ee});var ie=c(function(){S.f(1)});s(s.S+s.F*ie,"Object",{getOwnPropertySymbols:function(e){return S.f(_(e))}}),R&&s(s.S+s.F*(!z||c(function(){var e=x();return"[null]"!=A([e])||"{}"!=A({a:e})||"{}"!=A(Object(e))})),"JSON",{stringify:function(e){for(var t,n,o=[e],r=1;arguments.length>r;)o.push(arguments[r++]);if(n=t=o[1],(b(t)||e!==undefined)&&!K(e))return m(t)||(t=function(e,t){if("function"==typeof n&&(t=n.call(this,e,t)),!K(t))return t}),o[1]=t,A.apply(R,o)}}),x.prototype[D]||n(27)(x.prototype,D,x.prototype.valueOf),f(x,"Symbol"),f(Math,"Math",!0),f(o.JSON,"JSON",!0)},function(e,t,n){var o=n(45)("meta"),r=n(23),i=n(28),s=n(22).f,a=0,u=Object.isExtensible||function(){return!0},c=!n(30)(function(){return u(Object.preventExtensions({}))}),l=function(e){s(e,o,{value:{i:"O"+ ++a,w:{}}})},f=e.exports={KEY:o,NEED:!1,fastKey:function(e,t){if(!r(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!i(e,o)){if(!u(e))return"F";if(!t)return"E";l(e)}return e[o].i},getWeak:function(e,t){if(!i(e,o)){if(!u(e))return!0;if(!t)return!1;l(e)}return e[o].w},onFreeze:function(e){return c&&f.NEED&&u(e)&&!i(e,o)&&l(e),e}}},function(e,t,n){var o=n(34),r=n(65),i=n(47);e.exports=function(e){var t=o(e),n=r.f;if(n)for(var s,a=n(e),u=i.f,c=0;a.length>c;)u.call(e,s=a[c++])&&t.push(s);return t}},function(e,t,n){var o=n(35);e.exports=Array.isArray||function(e){return"Array"==o(e)}},function(e,t,n){var o=n(29),r=n(91).f,i={}.toString,s="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];e.exports.f=function(e){return s&&"[object Window]"==i.call(e)?function(e){try{return r(e)}catch(t){return s.slice()}}(e):r(o(e))}},function(e,t,n){n(64)("asyncIterator")},function(e,t,n){n(64)("observable")},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UUID=undefined;var o=s(n(0)),r=s(n(1)),i=s(n(148));function s(e){return e&&e.__esModule?e:{"default":e}}var a=function(){function e(){(0,o["default"])(this,e)}return(0,r["default"])(e,null,[{key:"get",value:function(){return(0,i["default"])().replace(/-/g,"")}}]),e}();t.UUID=a},function(e,t,n){var o,r,i=n(149),s=n(150),a=0,u=0;e.exports=function(e,t,n){var c=t&&n||0,l=t||[],f=(e=e||{}).node||o,d=e.clockseq!==undefined?e.clockseq:r;if(null==f||null==d){var p=i();null==f&&(f=o=[1|p[0],p[1],p[2],p[3],p[4],p[5]]),null==d&&(d=r=16383&(p[6]<<8|p[7]))}var h=e.msecs!==undefined?e.msecs:(new Date).getTime(),y=e.nsecs!==undefined?e.nsecs:u+1,v=h-a+(y-u)/1e4;if(v<0&&e.clockseq===undefined&&(d=d+1&16383),(v<0||h>a)&&e.nsecs===undefined&&(y=0),y>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");a=h,u=y,r=d;var m=(1e4*(268435455&(h+=122192928e5))+y)%4294967296;l[c++]=m>>>24&255,l[c++]=m>>>16&255,l[c++]=m>>>8&255,l[c++]=255&m;var g=h/4294967296*1e4&268435455;l[c++]=g>>>8&255,l[c++]=255&g,l[c++]=g>>>24&15|16,l[c++]=g>>>16&255,l[c++]=d>>>8|128,l[c++]=255&d;for(var b=0;b<6;++b)l[c+b]=f[b];return t||s(l)}},function(e,t){var n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(n){var o=new Uint8Array(16);e.exports=function(){return n(o),o}}else{var r=new Array(16);e.exports=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),r[t]=e>>>((3&t)<<3)&255;return r}}},function(e,t){for(var n=[],o=0;o<256;++o)n[o]=(o+256).toString(16).substr(1);e.exports=function(e,t){var o=t||0,r=n;return[r[e[o++]],r[e[o++]],r[e[o++]],r[e[o++]],"-",r[e[o++]],r[e[o++]],"-",r[e[o++]],r[e[o++]],"-",r[e[o++]],r[e[o++]],"-",r[e[o++]],r[e[o++]],r[e[o++]],r[e[o++]],r[e[o++]],r[e[o++]]].join("")}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.goEasyArray=undefined;var o=u(n(2)),r=u(n(0)),i=u(n(1)),s=u(n(3)),a=u(n(4));function u(e){return e&&e.__esModule?e:{"default":e}}var c=new(function(e){function t(){return(0,r["default"])(this,t),(0,s["default"])(this,(t.__proto__||(0,o["default"])(t)).apply(this,arguments))}return(0,a["default"])(t,e),(0,i["default"])(t,[{key:"deleteByKey",value:function(e,t,n){var o=e.findIndex(function(e){return e[t]==n});o>-1&&e.splice(o,1)}},{key:"unshiftGuid",value:function(e){var t=!1,n=this.findIndex(function(t){return t==e});for(n>-1&&(t=!0,this.splice(n,1)),this.unshift(e);this.length>300;)this.pop();return t}}]),t}(Array));t.goEasyArray=c},function(e,t,n){n(153),e.exports=n(7).Object.getPrototypeOf},function(e,t,n){var o=n(38),r=n(89);n(67)("getPrototypeOf",function(){return function(e){return r(o(e))}})},function(e,t,n){e.exports={"default":n(155),__esModule:!0}},function(e,t,n){n(156),e.exports=n(7).Object.setPrototypeOf},function(e,t,n){var o=n(17);o(o.S,"Object",{setPrototypeOf:n(157).set})},function(e,t,n){var o=n(23),r=n(18),i=function(e,t){if(r(e),!o(t)&&null!==t)throw TypeError(t+": can't set as prototype!")};e.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(e,t,o){try{(o=n(33)(Function.call,n(66).f(Object.prototype,"__proto__").set,2))(e,[]),t=!(e instanceof Array)}catch(r){t=!0}return function(e,n){return i(e,n),t?e.__proto__=n:o(e,n),e}}({},!1):undefined),check:i}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.storage=undefined;var o=i(n(0)),r=i(n(1));function i(e){return e&&e.__esModule?e:{"default":e}}var s=new(function(){function e(){(0,o["default"])(this,e)}return(0,r["default"])(e,[{key:"getCookie",value:function(){var e,t=new RegExp("(^| )"+name+"=([^;]*)(;|$)");return(e=document.cookie.match(t))?unescape(e[2]):null}},{key:"getData",value:function(e){return window.localStorage?window.localStorage.getItem(e):this.getCookie(e)}},{key:"setCookie",value:function(e,t){var n=new Date;n.setTime(n.getTime()+2592e6),document.cookie=e+"="+escape(t)+";expires="+n.toGMTString()}},{key:"setData",value:function(e,t){window.localStorage?window.localStorage.setItem(e,t):this.setCookie(e,t)}}]),e}());t.storage=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]={connectTimeout:3e3,authorizeTimeout:5e3,historyTimeout:3e3,hereNowTimeout:3e3,publishTimeout:3e3,subscribeTimeout:3e3,manualDisconnectTimeout:1500,emitRetryFrequency:500,maxRetries:3,maxNumber:10}},function(e,t,n){n(92),n(86),n(90),n(161),n(173),n(174),e.exports=n(7).Promise},function(e,t,n){"use strict";var o,r,i,s,a=n(36),u=n(11),c=n(33),l=n(95),f=n(17),d=n(23),p=n(43),h=n(162),y=n(163),v=n(96),m=n(97).set,g=n(168)(),b=n(68),_=n(98),C=n(169),k=n(99),w=u.TypeError,E=u.process,T=E&&E.versions,O=T&&T.v8||"",S=u.Promise,M="process"==l(E),P=function(){},N=r=b.f,I=!!function(){try{var e=S.resolve(1),t=(e.constructor={})[n(12)("species")]=function(e){e(P,P)};return(M||"function"==typeof PromiseRejectionEvent)&&e.then(P)instanceof t&&0!==O.indexOf("6.6")&&-1===C.indexOf("Chrome/66")}catch(o){}}(),F=function(e){var t;return!(!d(e)||"function"!=typeof(t=e.then))&&t},x=function(e,t){if(!e._n){e._n=!0;var n=e._c;g(function(){for(var o=e._v,r=1==e._s,i=0,s=function(t){var n,i,s,a=r?t.ok:t.fail,u=t.resolve,c=t.reject,l=t.domain;try{a?(r||(2==e._h&&j(e),e._h=1),!0===a?n=o:(l&&l.enter(),n=a(o),l&&(l.exit(),s=!0)),n===t.promise?c(w("Promise-chain cycle")):(i=F(n))?i.call(n,u,c):u(n)):c(o)}catch(f){l&&!s&&l.exit(),c(f)}};n.length>i;)s(n[i++]);e._c=[],e._n=!1,t&&!e._h&&R(e)})}},R=function(e){m.call(u,function(){var t,n,o,r=e._v,i=A(e);if(i&&(t=_(function(){M?E.emit("unhandledRejection",r,e):(n=u.onunhandledrejection)?n({promise:e,reason:r}):(o=u.console)&&o.error&&o.error("Unhandled promise rejection",r)}),e._h=M||A(e)?2:1),e._a=undefined,i&&t.e)throw t.v})},A=function(e){return 1!==e._h&&0===(e._a||e._c).length},j=function(e){m.call(u,function(){var t;M?E.emit("rejectionHandled",e):(t=u.onrejectionhandled)&&t({promise:e,reason:e._v})})},D=function(e){var t=this;t._d||(t._d=!0,(t=t._w||t)._v=e,t._s=2,t._a||(t._a=t._c.slice()),x(t,!0))},U=function(e){var t,n=this;if(!n._d){n._d=!0,n=n._w||n;try{if(n===e)throw w("Promise can't be resolved itself");(t=F(e))?g(function(){var o={_w:n,_d:!1};try{t.call(e,c(U,o,1),c(D,o,1))}catch(r){D.call(o,r)}}):(n._v=e,n._s=1,x(n,!1))}catch(o){D.call({_w:n,_d:!1},o)}}};I||(S=function(e){h(this,S,"Promise","_h"),p(e),o.call(this);try{e(c(U,this,1),c(D,this,1))}catch(t){D.call(this,t)}},(o=function(e){this._c=[],this._a=undefined,this._s=0,this._d=!1,this._v=undefined,this._h=0,this._n=!1}).prototype=n(170)(S.prototype,{then:function(e,t){var n=N(v(this,S));return n.ok="function"!=typeof e||e,n.fail="function"==typeof t&&t,n.domain=M?E.domain:undefined,this._c.push(n),this._a&&this._a.push(n),this._s&&x(this,!1),n.promise},"catch":function(e){return this.then(undefined,e)}}),i=function(){var e=new o;this.promise=e,this.resolve=c(U,e,1),this.reject=c(D,e,1)},b.f=N=function(e){return e===S||e===s?new i(e):r(e)}),f(f.G+f.W+f.F*!I,{Promise:S}),n(46)(S,"Promise"),n(171)("Promise"),s=n(7).Promise,f(f.S+f.F*!I,"Promise",{reject:function(e){var t=N(this);return(0,t.reject)(e),t.promise}}),f(f.S+f.F*(a||!I),"Promise",{resolve:function(e){return k(a&&this===s?S:this,e)}}),f(f.S+f.F*!(I&&n(172)(function(e){S.all(e)["catch"](P)})),"Promise",{all:function(e){var t=this,n=N(t),o=n.resolve,r=n.reject,i=_(function(){var n=[],i=0,s=1;y(e,!1,function(e){var a=i++,u=!1;n.push(undefined),s++,t.resolve(e).then(function(e){u||(u=!0,n[a]=e,--s||o(n))},r)}),--s||o(n)});return i.e&&r(i.v),n.promise},race:function(e){var t=this,n=N(t),o=n.reject,r=_(function(){y(e,!1,function(e){t.resolve(e).then(n.resolve,o)})});return r.e&&o(r.v),n.promise}})},function(e,t){e.exports=function(e,t,n,o){if(!(e instanceof t)||o!==undefined&&o in e)throw TypeError(n+": incorrect invocation!");return e}},function(e,t,n){var o=n(33),r=n(164),i=n(165),s=n(18),a=n(82),u=n(166),c={},l={};(t=e.exports=function(e,t,n,f,d){var p,h,y,v,m=d?function(){return e}:u(e),g=o(n,f,t?2:1),b=0;if("function"!=typeof m)throw TypeError(e+" is not iterable!");if(i(m)){for(p=a(e.length);p>b;b++)if((v=t?g(s(h=e[b])[0],h[1]):g(e[b]))===c||v===l)return v}else for(y=m.call(e);!(h=y.next()).done;)if((v=r(y,g,h.value,t))===c||v===l)return v}).BREAK=c,t.RETURN=l},function(e,t,n){var o=n(18);e.exports=function(e,t,n,r){try{return r?t(o(n)[0],n[1]):t(n)}catch(s){var i=e["return"];throw i!==undefined&&o(i.call(e)),s}}},function(e,t,n){var o=n(37),r=n(12)("iterator"),i=Array.prototype;e.exports=function(e){return e!==undefined&&(o.Array===e||i[r]===e)}},function(e,t,n){var o=n(95),r=n(12)("iterator"),i=n(37);e.exports=n(7).getIteratorMethod=function(e){if(e!=undefined)return e[r]||e["@@iterator"]||i[o(e)]}},function(e,t){e.exports=function(e,t,n){var o=n===undefined;switch(t.length){case 0:return o?e():e.call(n);case 1:return o?e(t[0]):e.call(n,t[0]);case 2:return o?e(t[0],t[1]):e.call(n,t[0],t[1]);case 3:return o?e(t[0],t[1],t[2]):e.call(n,t[0],t[1],t[2]);case 4:return o?e(t[0],t[1],t[2],t[3]):e.call(n,t[0],t[1],t[2],t[3])}return e.apply(n,t)}},function(e,t,n){var o=n(11),r=n(97).set,i=o.MutationObserver||o.WebKitMutationObserver,s=o.process,a=o.Promise,u="process"==n(35)(s);e.exports=function(){var e,t,n,c=function(){var o,r;for(u&&(o=s.domain)&&o.exit();e;){r=e.fn,e=e.next;try{r()}catch(i){throw e?n():t=undefined,i}}t=undefined,o&&o.enter()};if(u)n=function(){s.nextTick(c)};else if(!i||o.navigator&&o.navigator.standalone)if(a&&a.resolve){var l=a.resolve(undefined);n=function(){l.then(c)}}else n=function(){r.call(o,c)};else{var f=!0,d=document.createTextNode("");new i(c).observe(d,{characterData:!0}),n=function(){d.data=f=!f}}return function(o){var r={fn:o,next:undefined};t&&(t.next=r),e||(e=r,n()),t=r}}},function(e,t,n){var o=n(11).navigator;e.exports=o&&o.userAgent||""},function(e,t,n){var o=n(27);e.exports=function(e,t,n){for(var r in t)n&&e[r]?e[r]=t[r]:o(e,r,t[r]);return e}},function(e,t,n){"use strict";var o=n(11),r=n(7),i=n(22),s=n(19),a=n(12)("species");e.exports=function(e){var t="function"==typeof r[e]?r[e]:o[e];s&&t&&!t[a]&&i.f(t,a,{configurable:!0,get:function(){return this}})}},function(e,t,n){var o=n(12)("iterator"),r=!1;try{var i=[7][o]();i["return"]=function(){r=!0},Array.from(i,function(){throw 2})}catch(s){}e.exports=function(e,t){if(!t&&!r)return!1;var n=!1;try{var i=[7],a=i[o]();a.next=function(){return{done:n=!0}},i[o]=function(){return a},e(i)}catch(s){}return n}},function(e,t,n){"use strict";var o=n(17),r=n(7),i=n(11),s=n(96),a=n(99);o(o.P+o.R,"Promise",{"finally":function(e){var t=s(this,r.Promise||i.Promise),n="function"==typeof e;return this.then(n?function(n){return a(t,e()).then(function(){return n})}:e,n?function(n){return a(t,e()).then(function(){throw n})}:e)}})},function(e,t,n){"use strict";var o=n(17),r=n(68),i=n(98);o(o.S,"Promise",{"try":function(e){var t=r.f(this),n=i(e);return(n.e?t.reject:t.resolve)(n.v),t.promise}})},function(e,t,n){var o=n(7),r=o.JSON||(o.JSON={stringify:JSON.stringify});e.exports=function(e){return r.stringify.apply(r,arguments)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Conversations=undefined;var o=g(n(5)),r=g(n(177)),i=g(n(0)),s=g(n(1)),a=n(100),u=g(n(39)),c=n(24),l=n(69),f=g(n(13)),d=g(n(10)),p=n(31),h=n(14),y=n(6),v=g(n(48)),m=g(n(49));function g(e){return e&&e.__esModule?e:{"default":e}}t.Conversations=function(){function e(t){(0,i["default"])(this,e),this.im=null,this.list=[],this.synchronized=!1,this.im=t,t._iMReceiver.addIMMessageObserver(this.updateByInMessage.bind(this))}return(0,s["default"])(e,[{key:"onUpdated",value:function(){var e=this;this.latestConversations().then(function(){e.im._event.notify(c.ImEventType.CONVERSATIONS_UPDATED,{unreadTotal:e.getUnreadTotal(e.list),conversations:e.list.slice(0)})})}},{key:"latestConversations",value:function(){return this.synchronized?this.loadLocalConversations():this.loadServerConversations()}},{key:"updateByInMessage",value:function(e){var t=this,n=null;n=e.t==l.ConversationType.GROUP?e.r:u["default"].userId==e.r?e.s:e.r;var o=this.list.findIndex(function(t){return e.t==l.ConversationType.GROUP&&n==t.groupId||e.t==l.ConversationType.PRIVATE&&n==t.userId}),r=void 0;function i(e){e.type===l.ConversationType.PRIVATE&&(u["default"].userId===e.lastMessage.senderId?e.lastMessage.senderData=u["default"].userData:e.lastMessage.senderData=e.data)}o>-1?(r=this.list[o],this.list.splice(o,1),r.lc-1?(c=this.list[s],this.list.splice(s,1),c.unread=0,c.lc=c.lm,c.lastMessage=i,e.status===m["default"].success&&(c.lc=e.timestamp,c.lm=e.timestamp)):c=a.Conversion.buildByOutMessage(i,t,n,o),c.data=o;var f=this.im._dataCache;t===l.ConversationType.GROUP?f.putGroupData(c.groupId,o):(f.putUserData(c.userId,o),c.lastMessage.senderData=u["default"].userData),this.insertOne(c),this.onUpdated()}},{key:"imLastConversations",value:function(e,t){var n=new f["default"]({name:h.EmitType.imLastConversations,params:{},permission:d["default"].READ,singleTimeout:p.SocketTimeout.commonQuerySingle,totalTimeout:p.SocketTimeout.commonQueryTotal,fail:t,success:e});this.im._goEasySocket.emit(n)}},{key:"loadServerConversations",value:function(){var e=this,t=this.im;return new o["default"](function(n,o){e.imLastConversations(function(r){if(200==r.code){for(var i=r.content,s=function(n,o){var r=i[n],s=e.list.find(function(e){return r.t==l.ConversationType.GROUP&&r.g==e.groupId||r.t==l.ConversationType.PRIVATE&&r.uid==e.userId});y.calibrator.isDef(s)?s.top=r.top:(s=a.Conversion.buildByConversation(t._dataCache,r),e.insertOne(s))},u=0,c=i.length;u1;){t=Math.floor((o+r)/2),n=this.list[t];var i=this.compares(e,n);if(0==i)return t;i>0?o=t:r=t}return 0==o&&this.compares(this.list[0],e)>0?-1:o}},{key:"compares",value:function(e,t){var n=void 0;return(n=e.top==t.top?t.lastMessage.timestamp-e.lastMessage.timestamp:e.top?-1:1)>0?1:0===n?0:-1}},{key:"removeConversation",value:function(e,t){var n=this,r=t==l.ConversationType.PRIVATE?"userId":"groupId";return y.calibrator.isStringOrNumber(e)?(y.calibrator.isNumber(e)&&(e=e.toString()),-1==this.findConversationIndex(t,e)?o["default"].reject({code:400,content:"Failed to remove conversation, "+r+" does not exists."}):new o["default"](function(o,r){var i={targetId:e,type:t};n.requestEmit(h.EmitType.removeConversation,i,function(i){var s=n.findConversationIndex(t,e);s>-1&&n.list.splice(s,1),n.onUpdated(),200==i.code?o({}):r({code:i.code||408,content:i.content||"Failed to remove conversation"})},function(e){r({code:e.code||408,content:e.content||"Failed to remove conversation"})})})):o["default"].reject({code:400,content:"Failed to remove conversation, "+r+" must be a string or integer."})}},{key:"topConversation",value:function(e,t,n){var r=this,i=n==l.ConversationType.PRIVATE?"userId":"groupId";if(!y.calibrator.isStringOrNumber(e))return o["default"].reject({code:400,content:"Failed to top conversation, "+i+" must be a string or integer."});y.calibrator.isNumber(e)&&(e=e.toString());var s=this.findConversationIndex(n,e);return-1==s||this.list[s].top==t?o["default"].reject({code:400,content:"Failed to top conversation, "+i+" does not exists."}):new o["default"](function(o,i){var s={targetId:e,top:t,type:n};r.requestEmit(h.EmitType.topConversation,s,function(){var i=r.findConversationIndex(n,e),s=r.list[i];s.top=t,r.list.splice(i,1),r.insertOne(s),r.onUpdated(),o({})},function(e){i({code:e.code||408,content:e.content||"Failed to top Conversation"})})})}},{key:"requestEmit",value:function(e,t,n,o){var r=new f["default"]({name:e,params:t,permission:d["default"].WRITE,singleTimeout:p.SocketTimeout.commonRequestSingle,totalTimeout:p.SocketTimeout.commonRequestTotal,success:n,fail:o});this.im._goEasySocket.emit(r)}},{key:"findConversationIndex",value:function(e,t){return this.list.findIndex(function(n){return e==l.ConversationType.PRIVATE?n.type==e&&n.userId==t:n.type==e&&n.groupId==t})}}]),e}()},function(e,t,n){e.exports={"default":n(178),__esModule:!0}},function(e,t,n){n(179),e.exports=n(7).Object.assign},function(e,t,n){var o=n(17);o(o.S+o.F,"Object",{assign:n(180)})},function(e,t,n){"use strict";var o=n(19),r=n(34),i=n(65),s=n(47),a=n(38),u=n(81),c=Object.assign;e.exports=!c||n(30)(function(){var e={},t={},n=Symbol(),o="abcdefghijklmnopqrst";return e[n]=7,o.split("").forEach(function(e){t[e]=e}),7!=c({},e)[n]||Object.keys(c({},t)).join("")!=o})?function(e,t){for(var n=a(e),c=arguments.length,l=1,f=i.f,d=s.f;c>l;)for(var p,h=u(arguments[l++]),y=f?r(h).concat(f(h)):r(h),v=y.length,m=0;v>m;)p=y[m++],o&&!d.call(h,p)||(n[p]=h[p]);return n}:c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.str=undefined;var o=s(n(0)),r=s(n(1)),i=n(85);function s(e){return e&&e.__esModule?e:{"default":e}}var a=new(function(){function e(){(0,o["default"])(this,e)}return(0,r["default"])(e,[{key:"fileExtension",value:function(e,t){if(i.calibrator.isString(e))try{var n=e.split(t);return n[n.length-1]}catch(o){throw Error(o)}}}]),e}());t.str=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.messageCreator=undefined;var o=_(n(0)),r=_(n(1)),i=_(n(50)),s=_(n(186)),a=_(n(187)),u=_(n(188)),c=_(n(51)),l=_(n(189)),f=_(n(190)),d=_(n(191)),p=_(n(192)),h=_(n(193)),y=_(n(194)),v=_(n(101)),m=_(n(102)),g=_(n(52)),b=_(n(195));function _(e){return e&&e.__esModule?e:{"default":e}}var C=new(function(){function e(){(0,o["default"])(this,e),this.messageTypes={wx:{image:s["default"],file:i["default"],audio:a["default"],video:u["default"],text:m["default"]},uniApp:{image:d["default"],file:c["default"],audio:l["default"],video:f["default"],text:m["default"]},html:{image:p["default"],file:g["default"],audio:h["default"],video:y["default"],text:m["default"]}}}return(0,r["default"])(e,[{key:"create",value:function(e,t){var n=v["default"].resolve(),o=this.messageTypes[n][e];return o?new o(t):new b["default"](t)}}]),e}());t.messageCreator=C},function(e,t,n){e.exports={"default":n(184),__esModule:!0}},function(e,t,n){n(185);var o=n(7).Object;e.exports=function(e,t){return o.getOwnPropertyDescriptor(e,t)}},function(e,t,n){var o=n(29),r=n(66).f;n(67)("getOwnPropertyDescriptor",function(){return function(e,t){return r(o(e),t)}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=d(n(2)),r=d(n(0)),i=d(n(1)),s=d(n(3)),a=d(n(8)),u=d(n(4)),c=d(n(50)),l=d(n(9)),f=n(15);function d(e){return e&&e.__esModule?e:{"default":e}}var p=function(e){function t(e){return(0,r["default"])(this,t),(0,s["default"])(this,(t.__proto__||(0,o["default"])(t)).call(this,e))}return(0,u["default"])(t,e),(0,i["default"])(t,[{key:"validate",value:function(e){if((0,a["default"])(t.prototype.__proto__||(0,o["default"])(t.prototype),"validate",this).call(this,e),!f.calibrator.isDef(e.file.tempFiles)||0==e.file.tempFiles[0].length)throw Error("tempFiles is empty.")}},{key:"setType",value:function(e){this.type=l["default"].image}},{key:"setFile",value:function(e){var t="chooseMedia:ok"==e.errMsg?e.tempFiles[0].tempFilePath:e.tempFiles[0].path;e.tempFiles[0].path=t,this.file=e}},{key:"setPayload",value:function(e){(0,a["default"])(t.prototype.__proto__||(0,o["default"])(t.prototype),"setPayload",this).call(this,e);var n=this,r=e.file.tempFiles[0],i="chooseMedia:ok"==e.file.errMsg?r.tempFilePath:r.path;this.payload.url=i,this.payload.size=r.size,this.payload.width="",this.payload.height="",this.payload.contentType="";var s=f.calibrator.isEmpty(r.name)||r.name==undefined?i:r.name;this.payload.name="wx-image."+f.str.fileExtension(s,"."),this.payload.contentType="image/"+f.str.fileExtension(s,"."),wx.getImageInfo({src:i,success:function(e){n.payload.width=e.width,n.payload.height=e.height}})}}]),t}(c["default"]);t["default"]=p},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=d(n(2)),r=d(n(0)),i=d(n(1)),s=d(n(3)),a=d(n(8)),u=d(n(4)),c=d(n(50)),l=d(n(9)),f=n(15);function d(e){return e&&e.__esModule?e:{"default":e}}var p=function(e){function t(e){return(0,r["default"])(this,t),(0,s["default"])(this,(t.__proto__||(0,o["default"])(t)).call(this,e))}return(0,u["default"])(t,e),(0,i["default"])(t,[{key:"validate",value:function(e){(0,a["default"])(t.prototype.__proto__||(0,o["default"])(t.prototype),"validate",this).call(this,e)}},{key:"setType",value:function(e){this.type=l["default"].audio}},{key:"setPayload",value:function(e){(0,a["default"])(t.prototype.__proto__||(0,o["default"])(t.prototype),"setPayload",this).call(this,e);var n=e.file.tempFilePath;this.payload.url=n,this.payload.duration=e.file.duration/1e3,this.payload.size=e.file.fileSize;var r=f.calibrator.isEmpty(e.file.name)||e.file.name==undefined?n:e.file.name;this.payload.contentType="audio/"+f.str.fileExtension(r,"."),this.payload.name="wx-audio."+f.str.fileExtension(r,".")}}]),t}(c["default"]);t["default"]=p},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=h(n(16)),r=h(n(2)),i=h(n(0)),s=h(n(1)),a=h(n(3)),u=h(n(8)),c=h(n(4)),l=h(n(50)),f=h(n(9)),d=n(6),p=n(15);function h(e){return e&&e.__esModule?e:{"default":e}}var y=function(e){function t(e){return(0,i["default"])(this,t),(0,a["default"])(this,(t.__proto__||(0,r["default"])(t)).call(this,e))}return(0,c["default"])(t,e),(0,s["default"])(t,[{key:"validate",value:function(e){(0,u["default"])(t.prototype.__proto__||(0,r["default"])(t.prototype),"validate",this).call(this,e)}},{key:"setType",value:function(e){this.type=f["default"].video}},{key:"setFile",value:function(e){this.file="chooseMedia:ok"==e.errMsg?e.tempFiles[0]:e}},{key:"setPayload",value:function(e){this.payload=(0,o["default"])(null);var t=(0,o["default"])(null),n=(0,o["default"])(null),r="chooseMedia:ok"==e.file.errMsg?e.file.tempFiles[0]:e.file,i=r.duration,s=r.height,a=r.size,u=r.tempFilePath,c=r.thumbTempFilePath,l=r.width,f=r.name,h=f===undefined?"":f,y=d.calibrator.isEmpty(h)?u:h;t.contentType="video/"+p.str.fileExtension(y,"."),t.name="wx-video."+p.str.fileExtension(y,"."),t.url=u,t.width=n.width=l,t.height=n.height=s,t.size=a,t.duration=i,n.url=c,n.contentType="image/jpg",n.name="wx-thumbnail.jpg",this.payload.video=t,this.payload.thumbnail=n}}]),t}(l["default"]);t["default"]=y},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=d(n(2)),r=d(n(0)),i=d(n(1)),s=d(n(3)),a=d(n(8)),u=d(n(4)),c=d(n(51)),l=d(n(9)),f=n(15);function d(e){return e&&e.__esModule?e:{"default":e}}var p=function(e){function t(e){return(0,r["default"])(this,t),(0,s["default"])(this,(t.__proto__||(0,o["default"])(t)).call(this,e))}return(0,u["default"])(t,e),(0,i["default"])(t,[{key:"validate",value:function(e){(0,a["default"])(t.prototype.__proto__||(0,o["default"])(t.prototype),"validate",this).call(this,e)}},{key:"setType",value:function(e){this.type=l["default"].audio}},{key:"setPayload",value:function(e){var n=this;(0,a["default"])(t.prototype.__proto__||(0,o["default"])(t.prototype),"setPayload",this).call(this,e);var r=this,i=e.file.tempFilePath;this.payload.url=i;var s=f.calibrator.isEmpty(e.file.name)||e.file.name==undefined?i:e.file.name;if(this.payload.contentType="audio/"+f.str.fileExtension(s,"."),this.payload.name="uni-audio."+f.str.fileExtension(s,"."),f.calibrator.isDef(e.file.duration))this.payload.duration=e.file.duration/1e3;else{this.payload.duration=0;var u=uni.createInnerAudioContext();u.src=i,u.onCanplay(function(e){r.payload.duration=u.duration,u.destroy()})}uni.getFileInfo({filePath:i,success:function(e){n.payload.size=e.size}})}}]),t}(c["default"]);t["default"]=p},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=p(n(16)),r=p(n(2)),i=p(n(0)),s=p(n(1)),a=p(n(3)),u=p(n(8)),c=p(n(4)),l=p(n(51)),f=p(n(9)),d=n(15);function p(e){return e&&e.__esModule?e:{"default":e}}var h=function(e){function t(e){return(0,i["default"])(this,t),(0,a["default"])(this,(t.__proto__||(0,r["default"])(t)).call(this,e))}return(0,c["default"])(t,e),(0,s["default"])(t,[{key:"validate",value:function(e){(0,u["default"])(t.prototype.__proto__||(0,r["default"])(t.prototype),"validate",this).call(this,e)}},{key:"setType",value:function(e){this.type=f["default"].video}},{key:"setPayload",value:function(e){var t=(0,o["default"])(null),n=(0,o["default"])(null);this.payload=(0,o["default"])(null);var r=e.file,i=r.duration,s=r.height,a=r.size,u=r.tempFilePath,c=r.width,l=r.name,f=l===undefined?"":l,p=d.calibrator.isEmpty(f)?u:f;t.contentType="video/"+d.str.fileExtension(p,"."),t.name="uni-video."+d.str.fileExtension(p,"."),t.size=a,t.duration=i,t.url=n.url=u,t.width=n.width=c,t.height=n.height=s,n.contentType="image/jpg",n.name="wx-thumbnail.jpg",this.payload.video=t,this.payload.thumbnail=n}}]),t}(l["default"]);t["default"]=h},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=d(n(2)),r=d(n(0)),i=d(n(1)),s=d(n(3)),a=d(n(8)),u=d(n(4)),c=d(n(51)),l=n(15),f=d(n(9));function d(e){return e&&e.__esModule?e:{"default":e}}var p=function(e){function t(e){return(0,r["default"])(this,t),(0,s["default"])(this,(t.__proto__||(0,o["default"])(t)).call(this,e))}return(0,u["default"])(t,e),(0,i["default"])(t,[{key:"validate",value:function(e){if((0,a["default"])(t.prototype.__proto__||(0,o["default"])(t.prototype),"validate",this).call(this,e),!l.calibrator.isDef(e.file.tempFiles)||0==e.file.tempFiles[0].length)throw Error("tempFiles is empty.")}},{key:"setType",value:function(e){this.type=f["default"].image}},{key:"setPayload",value:function(e){(0,a["default"])(t.prototype.__proto__||(0,o["default"])(t.prototype),"setPayload",this).call(this,e);var n=this,r=e.file.tempFiles[0];this.payload.url=r.path,this.payload.size=r.size,this.payload.width="",this.payload.height="";var i=l.calibrator.isEmpty(r.name)||r.name==undefined?r.path:r.name;this.payload.contentType="image/"+l.str.fileExtension(i,"."),this.payload.name="uni-image."+l.str.fileExtension(i,"."),uni.getImageInfo({src:r.path,success:function(e){n.payload.width=e.width,n.payload.height=e.height}})}}]),t}(c["default"]);t["default"]=p},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=f(n(2)),r=f(n(0)),i=f(n(1)),s=f(n(3)),a=f(n(8)),u=f(n(4)),c=f(n(52)),l=f(n(9));function f(e){return e&&e.__esModule?e:{"default":e}}var d=function(e){function t(e){return(0,r["default"])(this,t),(0,s["default"])(this,(t.__proto__||(0,o["default"])(t)).call(this,e))}return(0,u["default"])(t,e),(0,i["default"])(t,[{key:"validate",value:function(e){(0,a["default"])(t.prototype.__proto__||(0,o["default"])(t.prototype),"validate",this).call(this,e);var n=["gif","jpg","png","jpeg"];if(!n.find(function(t){return t==e.file.type.split("/")[1].toLowerCase()}))throw Error("Only "+n.join(",")+" is supported image.")}},{key:"setType",value:function(e){this.type=l["default"].image}},{key:"setPayload",value:function(e){var n=this;(0,a["default"])(t.prototype.__proto__||(0,o["default"])(t.prototype),"setPayload",this).call(this,e);var r=window.URL||window.webkitURL,i=new Image;i.src=r.createObjectURL(e.file),i.onload=function(){n.payload.width=i.width,n.payload.height=i.height,r.revokeObjectURL(i.src)}}}]),t}(c["default"]);t["default"]=d},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=f(n(2)),r=f(n(0)),i=f(n(1)),s=f(n(3)),a=f(n(8)),u=f(n(4)),c=f(n(52)),l=f(n(9));function f(e){return e&&e.__esModule?e:{"default":e}}var d=function(e){function t(e){return(0,r["default"])(this,t),(0,s["default"])(this,(t.__proto__||(0,o["default"])(t)).call(this,e))}return(0,u["default"])(t,e),(0,i["default"])(t,[{key:"validate",value:function(e){(0,a["default"])(t.prototype.__proto__||(0,o["default"])(t.prototype),"validate",this).call(this,e);var n=["mp3","ogg","wav","wma","ape","acc","mpeg"];if(!n.find(function(t){return t==e.file.type.split("/")[1].toLowerCase()}))throw Error("Only "+n.join(",")+" is supported audio.")}},{key:"setType",value:function(e){this.type=l["default"].audio}},{key:"setPayload",value:function(e){(0,a["default"])(t.prototype.__proto__||(0,o["default"])(t.prototype),"setPayload",this).call(this,e);var n=this,r=window.URL||window.webkitURL,i=document.createElement("audio");i.src=r.createObjectURL(e.file),i.onloadedmetadata=function(){n.payload.duration=i.duration,r.revokeObjectURL(i.src)}}}]),t}(c["default"]);t["default"]=d},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=d(n(16)),r=d(n(2)),i=d(n(0)),s=d(n(1)),a=d(n(3)),u=d(n(8)),c=d(n(4)),l=d(n(52)),f=d(n(9));function d(e){return e&&e.__esModule?e:{"default":e}}var p=function(e){function t(e){return(0,i["default"])(this,t),(0,a["default"])(this,(t.__proto__||(0,r["default"])(t)).call(this,e))}return(0,c["default"])(t,e),(0,s["default"])(t,[{key:"validate",value:function(e){(0,u["default"])(t.prototype.__proto__||(0,r["default"])(t.prototype),"validate",this).call(this,e);var n=["avi","mov","rmvb","rm","flv","mp4","3gp","quicktime"];if(!n.find(function(t){return t==e.file.type.split("/")[1].toLowerCase()}))throw Error("Only "+n.join(",")+" is supported video.")}},{key:"setType",value:function(e){this.type=f["default"].video}},{key:"setPayload",value:function(e){this.payload=(0,o["default"])(null);var t=(0,o["default"])(null),n=(0,o["default"])(null);t.contentType=e.file.type,t.size=e.file.size,t.duration=0,t.url=n.url="",t.name=e.file.name,t.width=n.width=0,t.height=n.height=0,n.contentType="image/jpg",this.payload.video=t,this.payload.thumbnail=n;var r=this,i=window.URL||window.webkitURL,s=document.createElement("video"),a=i.createObjectURL(e.file);s.src=a,s.onloadedmetadata=function(){r.payload.video.duration=s.duration,r.payload.video.width=r.payload.thumbnail.width=s.videoWidth,r.payload.video.height=r.payload.thumbnail.height=s.videoHeight,r.payload.video.url=a,r.payload.thumbnail.url=function(e){var t=document.createElement("canvas");return t.width=e.videoWidth,t.height=e.videoHeight,t.getContext("2d").drawImage(e,0,0,t.width,t.height),t.toDataURL("image/png")}(s),i.revokeObjectURL(s.src)}}}]),t}(l["default"]);t["default"]=p},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=l(n(2)),r=l(n(0)),i=l(n(1)),s=l(n(3)),a=l(n(4)),u=l(n(40)),c=n(6);function l(e){return e&&e.__esModule?e:{"default":e}}var f=function(e){function t(e){return(0,r["default"])(this,t),(0,s["default"])(this,(t.__proto__||(0,o["default"])(t)).call(this,e))}return(0,a["default"])(t,e),(0,i["default"])(t,[{key:"setType",value:function(e){if(!c.calibrator.isStringOrNumber(e.type))throw Error("type require a string or number.");if(c.calibrator.isEmpty(e.type))throw Error("type is empty.");this.type=e.type}},{key:"setPayload",value:function(e){if(c.calibrator.isEmpty(e.payload))throw Error("payload is empty.");if(!c.calibrator.isPlainObject(e.payload)&&!c.calibrator.isStringOrNumber(e.payload))throw Error("payload require object | string | number.");this.payload=e.payload}}]),t}(u["default"]);t["default"]=f},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=k(n(5)),r=k(n(25)),i=k(n(2)),s=k(n(0)),a=k(n(1)),u=k(n(3)),c=k(n(8)),l=k(n(4)),f=k(n(103)),d=n(14),p=k(n(227)),h=k(n(13)),y=k(n(10)),v=k(n(41)),m=k(n(228)),g=n(6),b=n(113),_=n(21),C=k(n(229));function k(e){return e&&e.__esModule?e:{"default":e}}var w=function(e){function t(e){(0,s["default"])(this,t);var n=(0,u["default"])(this,(t.__proto__||(0,i["default"])(t)).call(this));return n.ioSocket=null,n.sid=null,n.appKey=null,n.userId=null,n.userData=null,n.otp=null,n.artifactVersion="0.0.0",n.imVersion="0.0.0",n.uri=null,n.ioOpts=null,n.type="",n.allowNotification=!1,n.reconnectingTimes=0,n.messageObservers={},n.connectFailedObservers=[],n.connectingObservers=[],n.expiredReconnectedObservers=[],n.ioSocket=new p["default"]({onDisconnected:n.onIoDisconnected.bind(n),onReconnecting:n.onIoReconnecting.bind(n)}),n.ioSocket.addConnectedObserver(n.onIoReconnected.bind(n)),n.appKey=e.appkey,n.userId=e.userId,n.userData=e.userData||"",n.otp=e.otp||null,n.ioOpts=e.opts,n.uri=e.uri,n.allowNotification=e.allowNotification,n.imVersion=e.imVersion,n.artifactVersion=e.artifactVersion,n.type=e.type||"",n.addConnectedObserver(e.onSuccess),n.addConnectingObserver(e.onProgress),n.addConnectFailedObserver(e.onFailed),n}return(0,l["default"])(t,e),(0,a["default"])(t,[{key:"onIoReconnected",value:function(){this.status===v["default"].RECONNECTING&&this.authorize()}},{key:"emit",value:function(e){(0,c["default"])(t.prototype.__proto__||(0,i["default"])(t.prototype),"emit",this).call(this,e)}},{key:"doEmit",value:function(e,t,n){b.uniApp.overrideUniShowHideMethods(),t.sid=this.sid,this.ioSocket.doEmit(e,t,n)}},{key:"sendAck",value:function(e,t){this.ioSocket.io.emit(e,t)}},{key:"connect",value:function(e){var n=this;((0,c["default"])(t.prototype.__proto__||(0,i["default"])(t.prototype),"connect",this).call(this),this.onConnecting(this.reconnectingTimes),this.ioSocket.connect({uri:this.uri,opts:this.ioOpts}),this.notifier=new C["default"](this),this.notifier.support())?this.notifier.getRegId().then(function(e){n.regId=e,n.authorize()})["catch"](function(e){console.error("注册厂商通道失败:"+(0,r["default"])(e)),n.authorize()}):this.authorize()}},{key:"disconnect",value:function(){var e=this;return new o["default"](function(t,n){var o=function(){e.status=v["default"].DISCONNECTED,e.ioSocket.disconnect(),t()};if(e.allowNotification){var r=new h["default"]({name:d.EmitType.manualDisconnect,params:{},permission:y["default"].READ,singleTimeout:_.SocketTimeout.commonInfiniteSingle,totalTimeout:_.SocketTimeout.commonInfiniteTotal,fail:function(e){n(e)},success:o});e.emit(r)}else o()})}},{key:"authorize",value:function(){var e={appkey:this.appKey,userId:this.userId,userData:this.userData,otp:this.otp,artifactVersion:this.artifactVersion,type:this.type,sid:this.sid,imVersion:this.imVersion,allowNT:this.allowNotification,regId:this.regId},t=new h["default"]({name:d.EmitType.authorize,params:e,permission:y["default"].NONE,singleTimeout:_.SocketTimeout.commonInfiniteSingle,totalTimeout:_.SocketTimeout.commonInfiniteTotal,success:this.onAuthorizeSuccess.bind(this),fail:this.onAuthorizeFailed.bind(this)});this.ioSocket.emit(t)}},{key:"onConnecting",value:function(){this.notify(this.connectingObservers,this.reconnectingTimes)}},{key:"onIoReconnecting",value:function(){b.uniApp.overrideUniShowHideMethods(),this.reconnectingTimes++,this.status==v["default"].CONNECTED||this.status==v["default"].EXPIRED_RECONNECTED||this.status==v["default"].RECONNECTING?this.status=v["default"].RECONNECTING:this.status=v["default"].CONNECTING,this.onConnecting()}},{key:"onIoDisconnected",value:function(){this.status==v["default"].DISCONNECTING&&(this.status=v["default"].DISCONNECTED,this.notify(this.disconnectedObservers))}},{key:"onAuthorizeSuccess",value:function(e){this.status===v["default"].RECONNECTING?this.sid!==e.sid?(this.status=v["default"].EXPIRED_RECONNECTED,this.notify(this.expiredReconnectedObservers)):this.status=v["default"].RECONNECTED:(this.status=v["default"].CONNECTED,this.sid=e.sid);e.enablePublish&&(this.permissions.find(function(e){return e==y["default"].WRITE})||this.permissions.push(y["default"].WRITE)),e.enableSubscribe&&(this.permissions.find(function(e){return e==y["default"].READ})||this.permissions.push(y["default"].READ)),this.reconnectingTimes=0,this.notify(this.connectedObservers)}},{key:"onAuthorizeFailed",value:function(e){this.ioSocket.disconnect(),this.status=v["default"].CONNECT_FAILED;var t={code:e.resultCode||408,content:e.content||"Host unreachable or timeout"};this.notify(this.connectFailedObservers,t)}},{key:"addConnectingObserver",value:function(e){g.calibrator.isFunction(e)&&this.connectingObservers.push(e)}},{key:"addConnectFailedObserver",value:function(e){g.calibrator.isFunction(e)&&this.connectFailedObservers.push(e)}},{key:"addExpiredReconnectedObserver",value:function(e){g.calibrator.isFunction(e)&&this.expiredReconnectedObservers.push(e)}},{key:"addMessageObserver",value:function(e,t){var n=this;this.ioSocket.io.on(e,function(t){n.notifyMessageObservers(e,t)}),this.messageObservers[e]||(this.messageObservers[e]=[]),this.messageObservers[e].push(new m["default"](t))}},{key:"notifyMessageObservers",value:function(e,t){for(var n=this.messageObservers[e],o=0;o0)return function(e){if((e=String(e)).length>100)return;var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(!t)return;var a=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return a*s;case"days":case"day":case"d":return a*i;case"hours":case"hour":case"hrs":case"hr":case"h":return a*r;case"minutes":case"minute":case"mins":case"min":case"m":return a*o;case"seconds":case"second":case"secs":case"sec":case"s":return a*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return a;default:return undefined}}(e);if("number"===c&&!1===isNaN(e))return t.long?a(u=e,i,"day")||a(u,r,"hour")||a(u,o,"minute")||a(u,n,"second")||u+" ms":function(e){if(e>=i)return Math.round(e/i)+"d";if(e>=r)return Math.round(e/r)+"h";if(e>=o)return Math.round(e/o)+"m";if(e>=n)return Math.round(e/n)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},function(e,t,n){(function(o){function r(){var e;try{e=t.storage.debug}catch(n){}return!e&&void 0!==o&&"env"in o&&(e=o.env.DEBUG),e}(t=e.exports=n(203)).log=function(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)},t.formatArgs=function(e){var n=this.useColors;if(e[0]=(n?"%c":"")+this.namespace+(n?" %c":" ")+e[0]+(n?"%c ":" ")+"+"+t.humanize(this.diff),!n)return;var o="color: "+this.color;e.splice(1,0,o,"color: inherit");var r=0,i=0;e[0].replace(/%[a-zA-Z%]/g,function(e){"%%"!==e&&"%c"===e&&(i=++r)}),e.splice(i,0,o)},t.save=function(e){try{null==e?t.storage.removeItem("debug"):t.storage.debug=e}catch(n){}},t.load=r,t.useColors=function(){if("undefined"!=typeof window&&window.process&&"renderer"===window.process.type)return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage="undefined"!=typeof chrome&&"undefined"!=typeof chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(e){}}(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.formatters.j=function(e){try{return JSON.stringify(e)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}},t.enable(r())}).call(t,n(71))},function(e,t,n){function o(e){var n;function o(){if(o.enabled){var e=o,r=+new Date,i=r-(n||r);e.diff=i,e.prev=n,e.curr=r,n=r;for(var s=new Array(arguments.length),a=0;a0)return function(e){if((e=String(e)).length>100)return;var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(!t)return;var a=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return a*s;case"days":case"day":case"d":return a*i;case"hours":case"hour":case"hrs":case"hr":case"h":return a*r;case"minutes":case"minute":case"mins":case"min":case"m":return a*o;case"seconds":case"second":case"secs":case"sec":case"s":return a*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return a;default:return undefined}}(e);if("number"===c&&!1===isNaN(e))return t.long?a(u=e,i,"day")||a(u,r,"hour")||a(u,o,"minute")||a(u,n,"second")||u+" ms":function(e){if(e>=i)return Math.round(e/i)+"d";if(e>=r)return Math.round(e/r)+"h";if(e>=o)return Math.round(e/o)+"m";if(e>=n)return Math.round(e/n)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},function(e,t,n){"use strict";e.exports=n(206),e.exports.parser=n(32)},function(e,t,n){"use strict";var o=i(n(73)),r=i(n(20));function i(e){return e&&e.__esModule?e:{"default":e}}var s=n(107),a=n(42),u=(n(76)("engine.io-client:socket"),n(109)),c=n(32),l=n(104),f=n(54);function d(e,t){if(!(this instanceof d))return new d(e,t);t=t||{},e&&"object"===(void 0===e?"undefined":(0,r["default"])(e))&&(t=e,e=null),e?(e=l(e),t.hostname=e.host,t.secure="https"===e.protocol||"wss"===e.protocol,t.port=e.port,e.query&&(t.query=e.query)):t.host&&(t.hostname=l(t.host).host),this.secure=null!=t.secure?t.secure:"undefined"!=typeof location&&"https:"===location.protocol,t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.agent=t.agent||!1,this.hostname=t.hostname||("undefined"!=typeof location?location.hostname:"localhost"),this.port=t.port||("undefined"!=typeof location&&location.port?location.port:this.secure?443:80),this.query=t.query||{},"string"==typeof this.query&&(this.query=f.decode(this.query)),this.upgrade=!1!==t.upgrade,this.path=(t.path||"/engine.io").replace(/\/$/,"")+"/",this.forceJSONP=!!t.forceJSONP,this.jsonp=!1!==t.jsonp,this.forceBase64=!!t.forceBase64,this.enablesXDR=!!t.enablesXDR,this.timestampParam=t.timestampParam||"t",this.timestampRequests=t.timestampRequests,this.transports=t.transports||["polling","websocket"],this.transportOptions=t.transportOptions||{},this.readyState="",this.writeBuffer=[],this.prevBufferLen=0,this.policyPort=t.policyPort||843,this.rememberUpgrade=t.rememberUpgrade||!1,this.binaryType=null,this.onlyBinaryUpgrades=t.onlyBinaryUpgrades,this.perMessageDeflate=!1!==t.perMessageDeflate&&(t.perMessageDeflate||{}),!0===this.perMessageDeflate&&(this.perMessageDeflate={}),this.perMessageDeflate&&null==this.perMessageDeflate.threshold&&(this.perMessageDeflate.threshold=1024),this.pfx=t.pfx||null,this.key=t.key||null,this.passphrase=t.passphrase||null,this.cert=t.cert||null,this.ca=t.ca||null,this.ciphers=t.ciphers||null,this.rejectUnauthorized=t.rejectUnauthorized===undefined||t.rejectUnauthorized,this.forceNode=!!t.forceNode,this.isReactNative="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase(),("undefined"==typeof self||this.isReactNative)&&(t.extraHeaders&&(0,o["default"])(t.extraHeaders).length>0&&(this.extraHeaders=t.extraHeaders),t.localAddress&&(this.localAddress=t.localAddress)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingIntervalTimer=null,this.pingTimeoutTimer=null,this.open()}e.exports=d,d.priorWebsocketSuccess=!1,a(d.prototype),d.protocol=c.protocol,d.Socket=d,d.Transport=n(74),d.transports=n(107),d.parser=n(32),d.prototype.createTransport=function(e){var t=function(e){var t={};for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}(this.query);t.EIO=c.protocol,t.transport=e;var n=this.transportOptions[e]||{};return this.id&&(t.sid=this.id),new s[e]({query:t,socket:this,agent:n.agent||this.agent,hostname:n.hostname||this.hostname,port:n.port||this.port,secure:n.secure||this.secure,path:n.path||this.path,forceJSONP:n.forceJSONP||this.forceJSONP,jsonp:n.jsonp||this.jsonp,forceBase64:n.forceBase64||this.forceBase64,enablesXDR:n.enablesXDR||this.enablesXDR,timestampRequests:n.timestampRequests||this.timestampRequests,timestampParam:n.timestampParam||this.timestampParam,policyPort:n.policyPort||this.policyPort,pfx:n.pfx||this.pfx,key:n.key||this.key,passphrase:n.passphrase||this.passphrase,cert:n.cert||this.cert,ca:n.ca||this.ca,ciphers:n.ciphers||this.ciphers,rejectUnauthorized:n.rejectUnauthorized||this.rejectUnauthorized,perMessageDeflate:n.perMessageDeflate||this.perMessageDeflate,extraHeaders:n.extraHeaders||this.extraHeaders,forceNode:n.forceNode||this.forceNode,localAddress:n.localAddress||this.localAddress,requestTimeout:n.requestTimeout||this.requestTimeout,protocols:n.protocols||void 0,isReactNative:this.isReactNative})},d.prototype.open=function(){var e;if(this.rememberUpgrade&&d.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket"))e="websocket";else{if(0===this.transports.length){var t=this;return void setTimeout(function(){t.emit("error","No transports available")},0)}e=this.transports[0]}this.readyState="opening";try{e=this.createTransport(e)}catch(n){return this.transports.shift(),void this.open()}e.open(),this.setTransport(e)},d.prototype.setTransport=function(e){e.name;var t=this;this.transport&&(this.transport.name,this.transport.removeAllListeners()),this.transport=e,e.on("drain",function(){t.onDrain()}).on("packet",function(e){t.onPacket(e)}).on("error",function(e){t.onError(e)}).on("close",function(){t.onClose("transport close")})},d.prototype.probe=function(e){var t=this.createTransport(e,{probe:1}),n=!1,o=this;function r(){if(o.onlyBinaryUpgrades){var e=!this.supportsBinary&&o.transport.supportsBinary;n=n||e}n||(t.send([{type:"ping",data:"probe"}]),t.once("packet",function(e){if(!n)if("pong"===e.type&&"probe"===e.data){if(o.upgrading=!0,o.emit("upgrading",t),!t)return;d.priorWebsocketSuccess="websocket"===t.name,o.transport.name,o.transport.pause(function(){n||"closed"!==o.readyState&&(l(),o.setTransport(t),t.send([{type:"upgrade"}]),o.emit("upgrade",t),t=null,o.upgrading=!1,o.flush())})}else{var r=new Error("probe error");r.transport=t.name,o.emit("upgradeError",r)}}))}function i(){n||(n=!0,l(),t.close(),t=null)}function s(e){var n=new Error("probe error: "+e);n.transport=t.name,i(),o.emit("upgradeError",n)}function a(){s("transport closed")}function u(){s("socket closed")}function c(e){t&&e.name!==t.name&&(e.name,t.name,i())}function l(){t.removeListener("open",r),t.removeListener("error",s),t.removeListener("close",a),o.removeListener("close",u),o.removeListener("upgrading",c)}d.priorWebsocketSuccess=!1,t.once("open",r),t.once("error",s),t.once("close",a),this.once("close",u),this.once("upgrading",c),t.open()},d.prototype.onOpen=function(){if(this.readyState="open",d.priorWebsocketSuccess="websocket"===this.transport.name,this.emit("open"),this.flush(),"open"===this.readyState&&this.upgrade&&this.transport.pause)for(var e=0,t=this.upgrades.length;e';o=document.createElement(e)}catch(t){(o=document.createElement("iframe")).name=n.iframeId,o.src="javascript:0"}o.id=n.iframeId,n.form.appendChild(o),n.iframe=o}this.form.action=this.uri(),l(),e=e.replace(a,"\\\n"),this.area.value=e.replace(s,"\\n");try{this.form.submit()}catch(f){}this.iframe.attachEvent?this.iframe.onreadystatechange=function(){"complete"===n.iframe.readyState&&c()}:this.iframe.onload=c}}).call(t,n(210))},function(e,t){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(o){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";var o=n(74),r=n(54),i=n(32),s=n(75),a=n(108);n(76)("engine.io-client:polling");e.exports=c;var u=null!=new(n(220))({xdomain:!1}).responseType;function c(e){var t=e&&e.forceBase64;u&&!t||(this.supportsBinary=!1),o.call(this,e)}s(c,o),c.prototype.name="polling",c.prototype.doOpen=function(){this.poll()},c.prototype.pause=function(e){var t=this;function n(){t.readyState="paused",e()}if(this.readyState="pausing",this.polling||!this.writable){var o=0;this.polling&&(o++,this.once("pollComplete",function(){--o||n()})),this.writable||(o++,this.once("drain",function(){--o||n()}))}else n()},c.prototype.poll=function(){this.polling=!0,this.doPoll(),this.emit("poll")},c.prototype.onData=function(e){var t=this;i.decodePayload(e,this.socket.binaryType,function(e,n,o){if("opening"===t.readyState&&t.onOpen(),"close"===e.type)return t.onClose(),!1;t.onPacket(e)}),"closed"!==this.readyState&&(this.polling=!1,this.emit("pollComplete"),"open"===this.readyState?this.poll():this.readyState)},c.prototype.doClose=function(){var e=this;function t(){e.write([{type:"close"}])}"open"===this.readyState?t():this.once("open",t)},c.prototype.write=function(e){var t=this;this.writable=!1;var n=function(){t.writable=!0,t.emit("drain")};i.encodePayload(e,this.supportsBinary,function(e){t.doWrite(e,n)})},c.prototype.uri=function(){var e=this.query||{},t=this.secure?"https":"http",n="";return!1!==this.timestampRequests&&(e[this.timestampParam]=a()),this.supportsBinary||e.sid||(e.b64=1),e=r.encode(e),this.port&&("https"===t&&443!==Number(this.port)||"http"===t&&80!==Number(this.port))&&(n=":"+this.port),e.length&&(e="?"+e),t+"://"+(-1!==this.hostname.indexOf(":")?"["+this.hostname+"]":this.hostname)+n+this.path+e}},function(e,t,n){"use strict";var o,r=n(73),i=(o=r)&&o.__esModule?o:{"default":o};e.exports=i["default"]||function(e){var t=[],n=Object.prototype.hasOwnProperty;for(var o in e)n.call(e,o)&&t.push(o);return t}},function(e,t,n){var o=n(214),r=Object.prototype.toString,i="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===r.call(Blob),s="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===r.call(File);e.exports=function a(e){if(!e||"object"!=typeof e)return!1;if(o(e)){for(var t=0,n=e.length;t=55296&&t<=56319&&r=55296&&e<=57343){if(t)throw Error("Lone surrogate U+"+e.toString(16).toUpperCase()+" is not a scalar value");return!1}return!0}function c(e,t){return s(e>>t&63|128)}function l(e,t){if(0==(4294967168&e))return s(e);var n="";return 0==(4294965248&e)?n=s(e>>6&31|192):0==(4294901760&e)?(u(e,t)||(e=65533),n=s(e>>12&15|224),n+=c(e,6)):0==(4292870144&e)&&(n=s(e>>18&7|240),n+=c(e,12),n+=c(e,6)),n+=s(63&e|128)}function f(){if(i>=r)throw Error("Invalid byte index");var e=255&o[i];if(i++,128==(192&e))return 63&e;throw Error("Invalid continuation byte")}function d(e){var t,n;if(i>r)throw Error("Invalid byte index");if(i==r)return!1;if(t=255&o[i],i++,0==(128&t))return t;if(192==(224&t)){if((n=(31&t)<<6|f())>=128)return n;throw Error("Invalid continuation byte")}if(224==(240&t)){if((n=(15&t)<<12|f()<<6|f())>=2048)return u(n,e)?n:65533;throw Error("Invalid continuation byte")}if(240==(248&t)&&(n=(7&t)<<18|f()<<12|f()<<6|f())>=65536&&n<=1114111)return n;throw Error("Invalid UTF-8 detected")}e.exports={version:"2.1.2",encode:function(e,t){for(var n=!1!==(t=t||{}).strict,o=a(e),r=o.length,i=-1,s="";++i65535&&(r+=s((t-=65536)>>>10&1023|55296),t=56320|1023&t),r+=s(t);return r}(c)}}},function(e,t){var n=void 0!==n?n:"undefined"!=typeof WebKitBlobBuilder?WebKitBlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder&&MozBlobBuilder,o=function(){try{return 2===new Blob(["hi"]).size}catch(e){return!1}}(),r=o&&function(){try{return 2===new Blob([new Uint8Array([1,2])]).size}catch(e){return!1}}(),i=n&&n.prototype.append&&n.prototype.getBlob;function s(e){return e.map(function(e){if(e.buffer instanceof ArrayBuffer){var t=e.buffer;if(e.byteLength!==t.byteLength){var n=new Uint8Array(e.byteLength);n.set(new Uint8Array(t,e.byteOffset,e.byteLength)),t=n.buffer}return t}return e})}function a(e,t){t=t||{};var o=new n;return s(e).forEach(function(e){o.append(e)}),t.type?o.getBlob(t.type):o.getBlob()}function u(e,t){return new Blob(s(e),t||{})}"undefined"!=typeof Blob&&(a.prototype=Blob.prototype,u.prototype=Blob.prototype),e.exports=o?r?Blob:u:i?a:undefined},function(e,t,n){function o(e){var n;function o(){if(o.enabled){var e=o,r=+new Date,i=r-(n||r);e.diff=i,e.prev=n,e.curr=r,n=r;for(var s=new Array(arguments.length),a=0;a0)return function(e){if((e=String(e)).length>100)return;var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(!t)return;var a=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return a*s;case"days":case"day":case"d":return a*i;case"hours":case"hour":case"hrs":case"hr":case"h":return a*r;case"minutes":case"minute":case"mins":case"min":case"m":return a*o;case"seconds":case"second":case"secs":case"sec":case"s":return a*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return a;default:return undefined}}(e);if("number"===c&&!1===isNaN(e))return t.long?a(u=e,i,"day")||a(u,r,"hour")||a(u,o,"minute")||a(u,n,"second")||u+" ms":function(e){if(e>=i)return Math.round(e/i)+"d";if(e>=r)return Math.round(e/r)+"h";if(e>=o)return Math.round(e/o)+"m";if(e>=n)return Math.round(e/n)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},function(e,t,n){"use strict";var o=n(221);e.exports=function(e){var t=e.xdomain,n=e.xscheme,r=e.enablesXDR;try{if("undefined"!=typeof XMLHttpRequest&&(!t||o))return new XMLHttpRequest}catch(i){}try{if("undefined"!=typeof XDomainRequest&&!n&&r)return new XDomainRequest}catch(i){}if(!t)try{return new(self[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(i){}}},function(e,t){try{e.exports="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(n){e.exports=!1}},function(e,t,n){"use strict";var o,r=n(20),i=(o=r)&&o.__esModule?o:{"default":o};var s,a,u=n(74),c=n(32),l=n(54),f=n(75),d=n(108);n(76)("engine.io-client:websocket");if("undefined"==typeof uni&&"undefined"==typeof wx||"undefined"!=typeof WebSocket)if("undefined"!=typeof WebSocket)s=WebSocket;else if("undefined"!=typeof self)s=self.WebSocket||self.MozWebSocket;else try{a=n(223)}catch(y){}var p=s||a;function h(e){e&&e.forceBase64&&(this.supportsBinary=!1),("undefined"==typeof uni&&"undefined"==typeof wx||"undefined"!=typeof WebSocket)&&(this.perMessageDeflate=e.perMessageDeflate,this.usingBrowserWebSocket=s&&!e.forceNode,this.protocols=e.protocols,this.usingBrowserWebSocket||(p=a)),u.call(this,e)}"undefined"==typeof uni&&"undefined"==typeof wx||"undefined"!=typeof WebSocket||(p=function(e){var t=this;if(t.onopen=function(){},t.onclose=function(){},t.onmessage=function(e){},t.onerror=function(e){},"object"===("undefined"==typeof tt?"undefined":(0,i["default"])(tt))&&tt.getSystemInfo){var n=tt.connectSocket({url:e});t.send=function(e){n.send({data:e})},t.close=function(){n.close()},n.onOpen(function(){t.onopen()}),n.onError(function(e){t.onerror(e)}),n.onMessage(function(e){t.onmessage(e)}),n.onClose(function(){t.onclose()})}else"undefined"!=typeof uni?(t.send=function(e){uni.sendSocketMessage({data:e})},t.close=function(){uni.closeSocket()},uni.onSocketOpen(function(e){t.onopen()}),uni.onSocketError(function(e){t.onerror(e)}),uni.onSocketMessage(function(e){t.onmessage(e)}),uni.onSocketClose(function(e){t.onclose()}),uni.connectSocket({url:e})):(t.send=function(e){wx.sendSocketMessage({data:e})},t.close=function(){wx.closeSocket()},wx.onSocketOpen(function(e){t.onopen()}),wx.onSocketError(function(e){t.onerror(e)}),wx.onSocketMessage(function(e){t.onmessage(e)}),wx.onSocketClose(function(e){t.onclose()}),wx.connectSocket({url:e}))}),e.exports=h,f(h,u),h.prototype.name="websocket",h.prototype.supportsBinary=!1,h.prototype.doOpen=function(){if(this.check()){var e,t,n=this.uri();("undefined"==typeof uni&&"undefined"==typeof wx||"undefined"!=typeof WebSocket)&&(e=this.protocols),(t="undefined"==typeof uni&&"undefined"==typeof wx||"undefined"!=typeof WebSocket?{agent:this.agent,perMessageDeflate:this.perMessageDeflate}:{agent:this.agent}).pfx=this.pfx,t.key=this.key,t.passphrase=this.passphrase,t.cert=this.cert,t.ca=this.ca,t.ciphers=this.ciphers,t.rejectUnauthorized=this.rejectUnauthorized,this.extraHeaders&&(t.headers=this.extraHeaders),this.localAddress&&(t.localAddress=this.localAddress);try{"undefined"==typeof uni&&"undefined"==typeof wx||"undefined"!=typeof WebSocket?this.ws=this.usingBrowserWebSocket&&!this.isReactNative?e?new p(n,e):new p(n):new p(n,e,t):this.ws=new p(n)}catch(o){return this.emit("error",o)}this.ws.binaryType===undefined&&(this.supportsBinary=!1),this.ws.supports&&this.ws.supports.binary?(this.supportsBinary=!0,this.ws.binaryType="nodebuffer"):this.ws.binaryType="arraybuffer",this.addEventListeners()}},h.prototype.addEventListeners=function(){var e=this;this.ws.onopen=function(){e.onOpen()},this.ws.onclose=function(){e.onClose()},this.ws.onmessage=function(t){e.onData(t.data)},this.ws.onerror=function(t){e.onError("websocket error",t)}},h.prototype.write=function(e){var t=this;this.writable=!1;for(var n=e.length,o=0,r=n;o0&&e.jitter<=1?e.jitter:0,this.attempts=0}e.exports=n,n.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=0==(1&Math.floor(10*t))?e-n:e+n}return 0|Math.min(e,this.max)},n.prototype.reset=function(){this.attempts=0},n.prototype.setMin=function(e){this.ms=e},n.prototype.setMax=function(e){this.max=e},n.prototype.setJitter=function(e){this.jitter=e}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=f(n(2)),r=f(n(0)),i=f(n(1)),s=f(n(3)),a=f(n(8)),u=f(n(4)),c=f(n(103)),l=f(n(41));function f(e){return e&&e.__esModule?e:{"default":e}}var d=function(e){function t(e){(0,r["default"])(this,t);var n=(0,s["default"])(this,(t.__proto__||(0,o["default"])(t)).call(this));return n.reconnectingObservers=[],n.addReconnectingObserver(e.onReconnecting),n.addDisconnectedObserver(e.onDisconnected),n}return(0,u["default"])(t,e),(0,i["default"])(t,[{key:"connect",value:function(e){(0,a["default"])(t.prototype.__proto__||(0,o["default"])(t.prototype),"connect",this).call(this),this.io=this.io.connect(e.uri,e.opts),this.initListener()}},{key:"doEmit",value:function(e,t,n){this.io.emit(e,t,n)}},{key:"initListener",value:function(){var e=this;this.io.on("reconnecting",function(t){e.status=l["default"].CONNECTING,e.notify(e.reconnectingObservers,t)}),this.io.on("connect",function(){e.status=l["default"].CONNECTED,e.notify(e.connectedObservers)}),this.io.on("disconnect",function(){e.status=l["default"].DISCONNECTED,e.notify(e.disconnectedObservers)}),this.io.on("connect_error",function(e){})}},{key:"addReconnectingObserver",value:function(e){this.reconnectingObservers.push(e)}}]),t}(c["default"]);t["default"]=d},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=s(n(0)),r=s(n(1)),i=n(6);function s(e){return e&&e.__esModule?e:{"default":e}}var a=function(){function e(t){(0,o["default"])(this,e),this.callback=i.noop,this.guidList=[],this.callback=t}return(0,r["default"])(e,[{key:"onMessage",value:function(e,t){"string"==typeof t&&(t=JSON.parse(t)),this.guidList.findIndex(function(e){return e===t.i})>-1||(this.guidList.unshift(t.i),this.guidList.length>300&&this.guidList.pop(),this.callback(t))}}]),e}();t["default"]=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=c(n(25)),r=c(n(5)),i=c(n(0)),s=c(n(1)),a=n(6),u=n(113);function c(e){return e&&e.__esModule?e:{"default":e}}var l=function(){function e(t){(0,i["default"])(this,e),this.goEasySocket=null,this.goEasySocket=t,this.support()&&(this.GoEasyUniapp=uni.requireNativePlugin("GoEasy-Uniapp"),t.addMessageObserver("imMessage",this.onNewMessageReceived.bind(this)),t.addMessageObserver("message",this.onNewMessageReceived.bind(this)))}return(0,s["default"])(e,[{key:"onNewMessageReceived",value:function(e){this.createLocalNotification(e)}},{key:"createLocalNotification",value:function(e){if(a.calibrator.isObject(e.nt)&&!0===u.uniApp.runningBackend()){var t=e.nt.t,n=e.nt.c;this.GoEasyUniapp?this.GoEasyUniapp.createLocalNotification(t,n):plus.push.createMessage(n,null,{title:t})}}},{key:"getRegId",value:function(){var e=this;return new r["default"](function(t,n){try{e.GoEasyUniapp?e.GoEasyUniapp.regId(function(e){t(e)},function(n){if(1e6==n.data.code)var r=setInterval(function(){e.GoEasyUniapp.regId(function(e){clearInterval(r),t(e)},function(e){1e6!=e.data.code&&(clearInterval(r),console.error("注册厂商通道失败:"+(0,o["default"])(e)),t())})},5e3);else console.error("注册厂商通道失败:"+(0,o["default"])(n)),t()}):(console.error("注册厂商通道失败:GoEasy-Uniapp is not installed correctly"),t())}catch(r){console.error("注册厂商通道失败:"+(0,o["default"])(r)),t()}})}},{key:"support",value:function(){return a.env.isUni()&&!0===this.goEasySocket.allowNotification&&a.env.isSupportHtmlPlus()&&!a.env.isBrowserClient()}}]),e}();t["default"]=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.connection=undefined;var o=a(n(5)),r=a(n(0)),i=a(n(1)),s=n(24);n(21),a(n(10)),n(14),a(n(13));function a(e){return e&&e.__esModule?e:{"default":e}}var u=function(){function e(t){(0,r["default"])(this,e),this.im=null,this.im=t}return(0,i["default"])(e,[{key:"connect",value:function(){var e=this;return new o["default"](function(t,n){e.im._goEasySocket.addConnectedObserver(function(){e.im._event.notify(s.ImEventType.CONNECTED),t()}),e.im._goEasySocket.addConnectFailedObserver(function(e){n({code:e.resultCode||408,content:e.content||"Failed to connect GoEasy"})}),e.im._goEasySocket.addConnectingObserver(function(t){e.im._event.notify(s.ImEventType.CONNECTING,t)}),e.im._goEasySocket.addDisconnectedObserver(function(){e.im._event.notify(s.ImEventType.DISCONNECT),n({code:400,content:"GoEasy disconnected."})}),e.im._goEasySocket.connect()})}},{key:"disconnect",value:function(){var e=this;return new o["default"](function(t,n){e.im._goEasySocket.disconnect().then(function(){t()})["catch"](function(e){n(e)})})}}]),e}();t["default"]=u;var c=new u;t.connection=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=v(n(25)),r=v(n(5)),i=v(n(0)),s=v(n(1)),a=v(n(232)),u=v(n(13)),c=n(31),l=v(n(10)),f=n(14),d=v(n(49)),p=n(26),h=v(n(40)),y=n(6);function v(e){return e&&e.__esModule?e:{"default":e}}var m=function(){function e(t){(0,i["default"])(this,e),this.im=null,this.bulletMessageBuilder=null,this.im=t,this.bulletMessageBuilder=new a["default"](t)}return(0,s["default"])(e,[{key:"send",value:function(e,t,n){var o=this;return new r["default"](function(r,i){t.status===d["default"]["new"]?(t.status=d["default"].sending,o.bulletMessageBuilder.build(e,t,n).then(function(e){var n=new u["default"]({name:f.EmitType.publishIM,params:e,permission:l["default"].WRITE,singleTimeout:c.SocketTimeout.commonRequestSingle,totalTimeout:c.SocketTimeout.commonRequestTotal,fail:function(e){t.status=d["default"].fail,i({code:e.resultCode||408,content:e.content||"Failed to send private message."})},success:function(e){t.status=d["default"].success,200==e.resultCode?r({code:200,content:e.content}):i(e)}});o.im._goEasySocket.emit(n)})["catch"](function(e){i({code:e.code||400,content:e.content||e})})):i({code:400,content:"Please create a new message, a message can only be sent once"})})}},{key:"sendMessage",value:function(e){var t=this,n=this.im;return new r["default"](function(r,i){if(e instanceof h["default"])if(e.status===d["default"]["new"]){e.status=d["default"].sending;var s=e.to;if(delete e.to,s)if(!s.type||s.type!=p.ConversationType.GROUP&&s.type!=p.ConversationType.PRIVATE)i({code:400,content:"message require property to.type"});else if(s.id)if(s.data&&y.calibrator.isFunction(s.data))i({code:400,content:"to.data can not be function"});else{var a=e.notification;if(a)if(y.calibrator.isObject(a)){if(y.calibrator.isEmpty(a.title))return void i({code:400,content:"notification title is required"});if(!y.calibrator.isString(a.title))return void i({code:400,content:"notification title must be string"});if(y.calibrator.isEmpty(e.notification.body))return void i({code:400,content:"notification body is required"});if(!y.calibrator.isString(e.notification.body))return void i({code:400,content:"notification body must be string"})}else if(y.calibrator.isPrimitive(e.notification))return void i({code:400,content:"notification must be an json object"});s.data||(s.data={}),n._conversations.updateByOutMessage(e,s.type,s.id,s.data),t.bulletMessageBuilder.build(s.id,e,s.type).then(function(t){t.d=(0,o["default"])(s.data);var a=new u["default"]({name:f.EmitType.publishIM,params:t,permission:l["default"].WRITE,singleTimeout:c.SocketTimeout.commonRequestSingle,totalTimeout:c.SocketTimeout.commonRequestTotal,fail:function(t){e.status=d["default"].fail,i({code:t.resultCode||408,content:t.content||"Failed to send private message."})},success:function(t){e.status=d["default"].success,e.timestamp=t.content.timestamp,r(e),n._conversations.updateByOutMessage(e,s.type,s.id,s.data)}});n._goEasySocket.emit(a)})["catch"](function(e){i({code:e.code||400,content:e.content||e})})}else i({code:400,content:"message require property to.id"});else i({code:400,content:"message require property to."})}else i({code:400,content:"Please create a new message, a message can only be sent once"});else i({code:400,content:"it is invalid message"})})}}]),e}();t["default"]=m},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=c(n(25)),r=c(n(5)),i=c(n(0)),s=c(n(1)),a=c(n(233)),u=c(n(234));function c(e){return e&&e.__esModule?e:{"default":e}}var l=function(){function e(t){(0,i["default"])(this,e),this.im=null,this.im=t}return(0,s["default"])(e,[{key:"build",value:function(e,t,n){var i=this;return new r["default"](function(r,s){var c=new a["default"]({to:e,message:t,conversationType:n}),l=t.type;new u["default"](l,i.im).build(t).then(function(e){c.p=(0,o["default"])(e),r(c)})["catch"](function(e){s(e)})})}}]),e}();t["default"]=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=f(n(25)),r=f(n(0)),i=f(n(1)),s=n(15),a=f(n(40)),u=f(n(102)),c=f(n(9)),l=f(n(39));function f(e){return e&&e.__esModule?e:{"default":e}}var d=function(){function e(t){(0,r["default"])(this,e),this.mt=null,this.to=null,this.p=null,this.t=null,this.guid=null,this.nt=null,this.validate(t.to,t.message),this.mt=t.message.type,this.to=t.to,this.t=t.conversationType,this.guid=t.message.messageId,this.p=t.message.payload,this.nt=t.message.notification}return(0,i["default"])(e,[{key:"validate",value:function(e,t){if(!(t instanceof a["default"]))throw Error("createMessage first.");if(s.calibrator.isEmpty(e))throw Error("userId is empty.");if(!s.calibrator.isStringOrNumber(e))throw Error("userId should be a string or number.");if(l["default"].userId==e)throw Error("userId can not be the same as your id.");if(t.type==c["default"].text){if(!(t instanceof u["default"]))throw Error("it is not textMessage");if((s.calibrator.isObject(t.payload)?(0,o["default"])(t.payload).length:t.payload.length)>3072)throw Error("message-length limit 3kb")}}}]),e}();t["default"]=d},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=u(n(0)),r=n(235),i=u(n(236)),s=u(n(115)),a=u(n(9));function u(e){return e&&e.__esModule?e:{"default":e}}t["default"]=function c(e,t){return(0,o["default"])(this,c),e==a["default"].video?new i["default"](t):e==a["default"].audio||e==a["default"].image||e==a["default"].file?new s["default"](t):r.simplePayloadBuilder}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.simplePayloadBuilder=undefined;var o=c(n(5)),r=c(n(2)),i=c(n(0)),s=c(n(1)),a=c(n(3)),u=c(n(4));function c(e){return e&&e.__esModule?e:{"default":e}}var l=new(function(e){function t(){return(0,i["default"])(this,t),(0,a["default"])(this,(t.__proto__||(0,r["default"])(t)).call(this))}return(0,u["default"])(t,e),(0,s["default"])(t,[{key:"build",value:function(e){return new o["default"](function(t,n){try{t(e.payload)}catch(o){n(o)}})}}]),t}(c(n(114))["default"]));t.simplePayloadBuilder=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=f(n(5)),r=f(n(2)),i=f(n(0)),s=f(n(1)),a=f(n(3)),u=f(n(4)),c=f(n(115)),l=f(n(116));function f(e){return e&&e.__esModule?e:{"default":e}}var d=function(e){function t(e){return(0,i["default"])(this,t),(0,a["default"])(this,(t.__proto__||(0,r["default"])(t)).call(this,e))}return(0,u["default"])(t,e),(0,s["default"])(t,[{key:"build",value:function(e){var t=this;return new o["default"](function(n,o){var r=new l["default"];t.upload(e).then(function(t){var o=t.content;undefined;r=e.payload;var i="?x-oss-process=video/snapshot,t_0000,f_jpg,w_"+e.payload.video.width+",m_fast,ar_auto";r.video.url=t.content.url,r.thumbnail.url=t.content.url+i,r.video.name=t.content.newFileName,n(r)})["catch"](function(e){o(e)})})}}]),t}(c["default"]);t["default"]=d},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.fileUploader=undefined;var o=c(n(0)),r=c(n(1)),i=c(n(101)),s=n(238),a=n(239),u=n(240);function c(e){return e&&e.__esModule?e:{"default":e}}var l=function(){function e(){(0,o["default"])(this,e),this.uploader={uniApp:s.uniAppFileUploader,wx:a.wxFileUploader,html:u.htmlFileUploader}}return(0,r["default"])(e,[{key:"upload",value:function(e,t){var n=i["default"].resolve();return this.uploader[n].upload(e,t)}}]),e}();t["default"]=l;var f=new l;t.fileUploader=f},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.uniAppFileUploader=undefined;var o=c(n(5)),r=c(n(2)),i=c(n(0)),s=c(n(1)),a=c(n(3)),u=c(n(4));function c(e){return e&&e.__esModule?e:{"default":e}}var l=new(function(e){function t(){return(0,i["default"])(this,t),(0,a["default"])(this,(t.__proto__||(0,r["default"])(t)).call(this))}return(0,u["default"])(t,e),(0,s["default"])(t,[{key:"upload",value:function(e,t){var n=this;try{return new o["default"](function(o,r){uni.uploadFile({url:e.host,filePath:n.getTempFilePath(e),name:"file",formData:e.parameters,success:function(t){if(200===t.statusCode){var n=e.payload;n.message=t.errMsg,o({code:200,content:n})}else r({code:t.statusCode,content:t.errMsg})},fail:function(e){r({code:500,content:e.errMsg})}}).onProgressUpdate(function(e){t&&t(e)})})}catch(r){return new o["default"](function(e,t){t({code:500,content:r})})}}},{key:"getTempFilePath",value:function(e){var t=e.file||e.fileRes;return Array.isArray(t.tempFiles)?t.tempFiles[0].path:t.tempFilePath}}]),t}(c(n(77))["default"]));t.uniAppFileUploader=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.wxFileUploader=undefined;var o=c(n(5)),r=c(n(2)),i=c(n(0)),s=c(n(1)),a=c(n(3)),u=c(n(4));function c(e){return e&&e.__esModule?e:{"default":e}}var l=new(function(e){function t(){return(0,i["default"])(this,t),(0,a["default"])(this,(t.__proto__||(0,r["default"])(t)).apply(this,arguments))}return(0,u["default"])(t,e),(0,s["default"])(t,[{key:"upload",value:function(e,t){var n=this;try{return new o["default"](function(o,r){wx.uploadFile({url:e.host,filePath:n.getTempFilePath(e),name:"file",formData:e.parameters,success:function(t){if(200===t.statusCode){var n=e.payload;n.message=t.errMsg,o({code:200,content:n})}else r({code:t.statusCode,content:t.errMsg})},fail:function(e){r({code:500,content:e.errMsg})}}).onProgressUpdate(function(e){t&&t(e)})})}catch(r){return new o["default"](function(e,t){t({code:500,content:r})})}}},{key:"getTempFilePath",value:function(e){var t=e.file||e.fileRes;return Array.isArray(t.tempFiles)?t.tempFiles[0].path:t.tempFilePath}}]),t}(c(n(77))["default"]));t.wxFileUploader=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.htmlFileUploader=undefined;var o=c(n(5)),r=c(n(2)),i=c(n(0)),s=c(n(1)),a=c(n(3)),u=c(n(4));function c(e){return e&&e.__esModule?e:{"default":e}}var l=new(function(e){function t(){return(0,i["default"])(this,t),(0,a["default"])(this,(t.__proto__||(0,r["default"])(t)).call(this))}return(0,u["default"])(t,e),(0,s["default"])(t,[{key:"upload",value:function(e,t){try{return new o["default"](function(n,o){var r=new XMLHttpRequest;for(var i in r.open("post",e.host,!0),e.headers)r.setRequestHeader(i,e.headers[i]);r.upload.onprogress=function(e){t&&t(e)},r.upload.onloadstart=function(e){t&&t(e)},r.upload.onloadend=function(e){t&&t(e)};var s=new FormData;for(var a in e.parameters)"fileRes"==a?s.append("file",e.parameters[a]):s.append(a,e.parameters[a]);r.send(s),r.onreadystatechange=function(){if(4==r.readyState)if(r.status>=200&&r.status<300||304==r.status){var t=e.payload;t.message=r.responseText,n({code:200,content:t})}else o({code:r.status,content:r.responseText})}})}catch(n){return new o["default"](function(e,t){t({code:500,content:n})})}}}]),t}(c(n(77))["default"]));t.htmlFileUploader=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=u(n(5)),r=u(n(0)),i=u(n(1)),s=u(n(242)),a=u(n(246));function u(e){return e&&e.__esModule?e:{"default":e}}var c=function(){function e(t){(0,r["default"])(this,e),this.uploadTokenResolver=null,this.uploadTokenResolver=new a["default"](t)}return(0,i["default"])(e,[{key:"build",value:function(e,t){var n=this;return new o["default"](function(o,r){n.uploadTokenResolver.resolve(t).then(function(t){var n=t.content;o(new s["default"](n.vendor).build(n,e))})["catch"](function(e){r(e)})})}}]),e}();t["default"]=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o,r=n(0),i=(o=r)&&o.__esModule?o:{"default":o},s=n(243),a=n(244),u=n(245);t["default"]=function c(e){return(0,i["default"])(this,c),e==s.OssType.aliYun?a.aliYunOSSRequestBuilder:u.qiNiuYunOSSRequestBuilder}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.OssType={aliYun:"ALI",qiNiu:"QN"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.aliYunOSSRequestBuilder=undefined;var o=c(n(2)),r=c(n(0)),i=c(n(1)),s=c(n(3)),a=c(n(4)),u=c(n(118));function c(e){return e&&e.__esModule?e:{"default":e}}var l=function(e){function t(){return(0,r["default"])(this,t),(0,s["default"])(this,(t.__proto__||(0,o["default"])(t)).call(this))}return(0,a["default"])(t,e),(0,i["default"])(t,[{key:"url",value:function(e){return e.host+"/"+e.dir+"/"+this.newFileName(e)}},{key:"build",value:function(e,t){var n={key:e.dir+"/"+this.newFileName(e),OSSAccessKeyId:e.accessKeyId,policy:e.policy,signature:e.signature,success_action_status:"200",fileRes:t},o={newFileName:this.newFileName(e),url:this.url(e)};return new u["default"](e.host,null,n,t,o)}}]),t}(c(n(119))["default"]);t["default"]=l;var f=new l;t.aliYunOSSRequestBuilder=f},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.qiNiuYunOSSRequestBuilder=undefined;var o=l(n(2)),r=l(n(0)),i=l(n(1)),s=l(n(3)),a=l(n(4)),u=l(n(119)),c=l(n(118));function l(e){return e&&e.__esModule?e:{"default":e}}var f=new(function(e){function t(){return(0,r["default"])(this,t),(0,s["default"])(this,(t.__proto__||(0,o["default"])(t)).call(this))}return(0,a["default"])(t,e),(0,i["default"])(t,[{key:"url",value:function(e){return e.downloadUrl}},{key:"build",value:function(e,t){var n={key:this.newFileName(e),token:e.token,file:t},o={newFileName:this.newFileName(e),url:this.url(e)};return new c["default"](e.host,null,n,t,o)}}]),t}(u["default"]));t.qiNiuYunOSSRequestBuilder=f},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=c(n(5)),r=c(n(0)),i=c(n(1)),s=c(n(13)),a=c(n(10)),u=n(31);function c(e){return e&&e.__esModule?e:{"default":e}}var l=function(){function e(t){(0,r["default"])(this,e),this.im=null,this.im=t}return(0,i["default"])(e,[{key:"resolve",value:function(e){var t=this;return new o["default"](function(n,o){var r=new s["default"]({name:"uploadToken",params:{filename:e},permission:a["default"].WRITE,singleTimeout:u.SocketTimeout.commonRequestSingle,totalTimeout:u.SocketTimeout.commonRequestTotal,fail:function(e){o(e)},success:function(e){200==e.code?n(e):o(e)}});t.im._goEasySocket.emit(r)})}}]),e}();t["default"]=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=d(n(16)),r=d(n(5)),i=d(n(0)),s=d(n(1)),a=n(15),u=d(n(13)),c=d(n(10)),l=n(31),f=n(14);function d(e){return e&&e.__esModule?e:{"default":e}}var p=function(){function e(t){(0,i["default"])(this,e),this.im=null,this.im=t}return(0,s["default"])(e,[{key:"history",value:function(e){var t=this;return new r["default"](function(n,o){t.transformOptions(e);var r=new u["default"]({name:f.EmitType.imHistory,params:e,permission:c["default"].READ,singleTimeout:l.SocketTimeout.commonQuerySingle,totalTimeout:l.SocketTimeout.commonQueryTotal,fail:function(e){o({code:e.code||408,content:e.content||"Failed to query message"})},success:function(r){if(200==r.code){var i=t.transformHistories(r,e);n({code:200,content:i})}else o(r)}});t.im._goEasySocket.emit(r)})}},{key:"transformOptions",value:function(e){if(!a.calibrator.isObject(e)||!a.calibrator.isDef(e.friendId)&&!a.calibrator.isDef(e.groupId))throw Error("friendId or groupId is not define.");if(a.calibrator.isDef(e.friendId)&&a.calibrator.isDef(e.groupId))throw Error("only contain friendId or groupId.");if(a.calibrator.isDef(e.limit)||(e.limit=10),e.limit>30&&(e.limit=30),a.calibrator.isDef(e.friendId)){if(!a.calibrator.isStringOrNumber(e.friendId))throw Error("TypeError: friendId require string or number.");a.calibrator.isNumber(e.friendId)&&(e.friendId=e.friendId.toString())}else{if(!a.calibrator.isStringOrNumber(e.groupId))throw Error("TypeError: groupId require string or number.");a.calibrator.isNumber(e.groupId)&&(e.groupId=e.groupId.toString())}return e}},{key:"transformHistories",value:function(e,t){var n=[];return e&&e.content&&e.content.map(function(e){var r=(0,o["default"])(null);r.timestamp=e.ts,r.senderId=e.s,r.type=e.mt,r.payload="string"==typeof e.p?JSON.parse(e.p):e.p,t.groupId&&e.d&&(r.senderData=JSON.parse(e.d)),n.push(r)}),n}}]),e}();t["default"]=p},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=h(n(5)),r=h(n(0)),i=h(n(1)),s=h(n(13)),a=n(14),u=h(n(10)),c=n(21),l=n(26),f=h(n(48)),d=n(6),p=n(24);function h(e){return e&&e.__esModule?e:{"default":e}}var y=function(){function e(t){(0,r["default"])(this,e),this.im=null,this.im=t,t._iMReceiver.addIMMessageObserver(this.newNewMessageReceived.bind(this))}return(0,i["default"])(e,[{key:"newNewMessageReceived",value:function(e){if(e.t===l.ConversationType.GROUP){var t=f["default"].assemble(e);this.im._event.notify(p.ImEventType.GROUP_MESSAGE_RECEIVED,t)}}},{key:"subscribe",value:function(e){var t=this;return new o["default"](function(n,o){if(Array.isArray(e)&&0!=e.length){for(var r=0;r { + membersMap[item.uuid] = item + }); + return membersMap; +}; + +IMService.prototype.findGroupById = function (groupId) { + let group = restApi.findGroupById(groupId); + return new Group(group.uuid, group.name, group.avatar); +}; + +IMService.prototype.getGroupMessages = function (groupId) { + if (!this.groupMessages[groupId]) { + this.groupMessages[groupId] = []; + } + return this.groupMessages[groupId] +}; + +IMService.prototype.findFriendById = function (userId) { + let user = restApi.findUserById(userId); + return new Friend(user.uuid, user.name, user.avatar); +}; + +IMService.prototype.getPrivateMessages = function (friendId) { + if (!this.privateMessages[friendId]) { + this.privateMessages[friendId] = []; + } + return this.privateMessages[friendId] +}; + +//连接GoEasy +IMService.prototype.connectIM = function (currentUser) { + this.currentUser = currentUser; + //初始化IM相关的监听器 + this.initialIMListeners(); + this.im.connect({ + id: this.currentUser.uuid, + data: { + avatar: this.currentUser.avatar, + name: this.currentUser.name + } + }).then(() => { + console.log('connect成功') + }).catch(error => { + console.log('connect失败,请确保网络正常,appkey和host正确,code:' + error.code + " content:" + error.content); + }); + this.subscribeGroupMessage(); +}; + +IMService.prototype.subscribeGroupMessage = function () { + let groups = restApi.findGroups(this.currentUser); + let groupIds = groups.map(item => item.uuid); + this.im.subscribeGroup(groupIds) + .then(() => { + console.log('订阅群消息成功') + }) + .catch(error => { + console.log('订阅群消息失败') + console.log(error) + }) +} + +//IM监听 +IMService.prototype.initialIMListeners = function () { + this.im.on(GoEasyIM.EVENT.CONNECTED, () => { + console.log('连接成功.') + }); + + this.im.on(GoEasyIM.EVENT.DISCONNECTED, () => { + console.log('连接断开.') + }); + + this.im.on(GoEasyIM.EVENT.CONNECTING, (times) => { + console.log('连接中', times); + }); + + //监听私聊消息 + this.im.on(GoEasyIM.EVENT.PRIVATE_MESSAGE_RECEIVED, (message) => { + //更新私聊消息记录 + let friendId; + if (this.currentUser.uuid == message.senderId) { + friendId = message.receiverId; + } else { + friendId = message.senderId; + } + let friendMessages = this.getPrivateMessages(friendId); + friendMessages.push(message); + //如果页面传入了相应的listener,执行listener + this.onNewPrivateMessageReceive(friendId, message); + }); + + //监听群聊消息 + this.im.on(GoEasyIM.EVENT.GROUP_MESSAGE_RECEIVED, (message) => { + let groupId = message.groupId; + + //更新群聊消息记录 + let groupMessages = this.getGroupMessages(groupId); + groupMessages.push(message); + + //如果页面传入了相应的listener,执行listener + this.onNewGroupMessageReceive(groupId, message); + }) +}; + +//加载单聊历史消息 +IMService.prototype.loadPrivateHistoryMessage = function (friendId, timeStamp) { + return new Promise((resolve, reject) => { + this.im.history({ + friendId: friendId, + lastTimestamp: timeStamp + }).then(result => { + let history = result.content; + let friendMessages = this.getPrivateMessages(friendId); + for (let i = history.length - 1; i >=0; i--) { + friendMessages.unshift(history[i]) + } + resolve(friendMessages) + }).catch(error => { + if (error.code == 401) { + console.log("您尚未开通历史消息,请登录GoEasy,查看应用详情里自助启用."); + } + reject(error) + }); + }) +}; + +//群聊历史消息 +IMService.prototype.loadGroupHistoryMessage = function (groupId, timeStamp) { + return new Promise((resolve, reject) => { + this.im.history({ + groupId: groupId, + lastTimestamp: timeStamp + }).then(result => { + let history = result.content; + let chatMessage = this.getGroupMessages(groupId); + for (let i = history.length - 1; i >= 0; i--) { + chatMessage.unshift(history[i]); + } + resolve(chatMessage) + }).catch(error => { + if (error.code == 401) { + console.log("您尚未开通历史消息,请登录GoEasy,查看应用详情里自助启用."); + } + reject(error) + }); + }) +}; + +export default IMService; \ No newline at end of file diff --git a/static/lib/restapi.js b/static/lib/restapi.js new file mode 100644 index 0000000..2e4385f --- /dev/null +++ b/static/lib/restapi.js @@ -0,0 +1,94 @@ +//用户数据示例 +let users = [ + { + "uuid": "08c0a6ec-a42b-47b2-bb1e-15e0f5f9a19a", + "name": "Mattie", + "password": "123", + "avatar": '/static/images/Avatar-1.png' + }, + { + "uuid": "3bb179af-bcc5-4fe0-9dac-c05688484649", + "name": "Wallace", + "password": "123", + "avatar": '/static/images/Avatar-2.png' + }, + { + "uuid": "fdee46b0-4b01-4590-bdba-6586d7617f95", + "name": "Tracy", + "password": "123", + "avatar": '/static/images/Avatar-3.png' + }, + { + "uuid": "33c3693b-dbb0-4bc9-99c6-fa77b9eb763f", + "name": "Juanita", + "password": "123", + "avatar": '/static/images/Avatar-4.png' + } +]; + +//群数据示例 +let groups = [ + { + "uuid": "group-a42b-47b2-bb1e-15e0f5f9a19a", + "name": "小程序交流群", + "avatar" : '/static/images/wx.png', + "userList": ['08c0a6ec-a42b-47b2-bb1e-15e0f5f9a19a', '3bb179af-bcc5-4fe0-9dac-c05688484649', 'fdee46b0-4b01-4590-bdba-6586d7617f95', '33c3693b-dbb0-4bc9-99c6-fa77b9eb763f'] + }, + { + "uuid": "group-4b01-4590-bdba-6586d7617f95", + "name": "UniApp交流群", + "avatar" : '/static/images/uniapp.png', + "userList": ['08c0a6ec-a42b-47b2-bb1e-15e0f5f9a19a', 'fdee46b0-4b01-4590-bdba-6586d7617f95', '33c3693b-dbb0-4bc9-99c6-fa77b9eb763f'] + }, + { + "uuid": "group-dbb0-4bc9-99c6-fa77b9eb763f", + "name": "GoEasy交流群", + "avatar" : '/static/images/goeasy.jpeg', + "userList": ['08c0a6ec-a42b-47b2-bb1e-15e0f5f9a19a', '3bb179af-bcc5-4fe0-9dac-c05688484649'] + } +]; + + +function RestApi() { + +} + +RestApi.prototype.findFriends = function (user) { + var friendList = users.filter(v => v.uuid != user.uuid); + return friendList; +}; + +RestApi.prototype.findGroups = function (user) { + var groupList = groups.filter(v => v.userList.find(id => id == user.uuid)); + return groupList; +}; + +RestApi.prototype.findUser = function (username, password) { + var user = users.find(user => (user.name == username && user.password == password)) + return user; +}; + +RestApi.prototype.findGroupById = function (groupId) { + var group = groups.find(group => (group.uuid == groupId)); + return group; +}; + + +RestApi.prototype.findUserById = function (userId) { + var user = users.find(user => (user.uuid == userId)) + return user; +}; + + +RestApi.prototype.findGroupMembers = function (groupId) { + let members = []; + let group = groups.find(v => v.uuid == groupId); + users.map(user => { + if (group.userList.find(v => v == user.uuid)) { + members.push(user) + } + }); + return members; +}; + +export default new RestApi(); \ No newline at end of file