1 |
- (global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pagesSub/chatting/chatting"],{"056a":function(e,t,n){"use strict";n.r(t);var o=n("d42c"),i=n("b318");for(var s in i)"default"!==s&&function(e){n.d(t,e,(function(){return i[e]}))}(s);n("ab12");var r,c=n("f0c5"),a=Object(c["a"])(i["default"],o["b"],o["c"],!1,null,"0ba42020",null,!1,o["a"],r);t["default"]=a.exports},"2a49":function(e,t,n){"use strict";(function(e){n("39a3");o(n("66fd"));var t=o(n("056a"));function o(e){return e&&e.__esModule?e:{default:e}}wx.__webpack_require_UNI_MP_PLUGIN__=n,e(t.default)}).call(this,n("543d")["createPage"])},"95b9":function(e,t,n){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=function(){Promise.all([n.e("common/vendor"),n.e("components/tui-chat/message-elements/emoji/index")]).then(function(){return resolve(n("60cc"))}.bind(null,n)).catch(n.oe)},i=function(){n.e("components/tui-chat/message-list/index").then(function(){return resolve(n("c49f"))}.bind(null,n)).catch(n.oe)},s={components:{TUIMessageList:i,TUIEmoji:o},data:function(){return{assetsUrl:this.$util.assetsUrl,scrollHeight:0,topNavHeight:0,userInfo:null,messageList:[],message:null,onlineState:"",scrollRefreshing:!1,scrollTriggered:!0,conversation:"",conversationID:"",inputText:"",showSendBtn:!1,showActionIndex:-1,recorderManager:null,voiceText:"按住说话,松手发送",recordTimeTotal:60,isRecording:!1,canSend:!1,startPoint:0,videoPlay:!1,videoMessage:{}}},computed:{statusBarHeight:function(){return this.$store.state.statusBarHeight},topbarOffsetHeight:function(){return this.$store.state.topbarOffsetHeight}},created:function(){var t=this;e.$on("videoPlayerHandler",(function(e){t.videoPlay=e.isPlay,t.videoMessage=e.message})),e.authorize({scope:"scope.record",success:function(){t.startRecordManage()},fail:function(n){e.showModal({content:"检测到您没打开录音功能权限,是否去设置打开?",confirmText:"确认",cancelText:"取消",success:function(n){n.confirm&&e.openSetting({success:function(e){e.authSetting&&t.startRecordManage()}})}})}})},onLoad:function(t){var n=this;this.conversationID=t.conversationid,e.$TUIKit.setMessageRead({conversationID:this.conversationID}),e.$TUIKit.getConversationProfile(this.conversationID).then((function(e){var t=e.data.conversation;n.conversation=t}));var o=getCurrentPages(),i=o[o.length-2];this.userInfo=i.$vm.userInfo},mounted:function(){var e=this;0===this.userInfo.lastActiveTime||this.userInfo.online?this.onlineState="在线":this.userInfo.lastActiveTime<30&&!this.userInfo.online?this.onlineState="刚刚":this.onlineState="离线",setTimeout((function(){e.computedScollviewHeight()}),500)},methods:{back:function(){e.navigateBack({delta:1})},prevent:function(){return!1},stopVideoHander:function(){this.videoPlay=!1},computedScollviewHeight:function(){var t=this,n=e.createSelectorQuery().in(this),o=0;n.selectAll("#topnav,#talk-box").boundingClientRect((function(e){e.forEach((function(e){o+=e.height}))})).exec((function(){var n=e.getSystemInfoSync();t.scrollHeight=n.windowHeight-o,t.$refs.messageList.scrollToButtom()}))},scrollRefresh:function(){var e=this;this.scrollRefreshing||(this.scrollRefreshing=!0,setTimeout((function(){e.scrollTriggered=!1,e.scrollRefreshing=!1}),1e3),this.isLoadPreData=!0)},scrollPulling:function(e){},scrollRestore:function(){this.scrollTriggered=!0},scrollAbort:function(){},scrollToBottom:function(){},showActionPanel:function(t){var n=this;if(this.showActionIndex===t)return this.showActionIndex=-1,void setTimeout((function(){n.computedScollviewHeight()}),50);switch(t){case 0:this.showActionIndex=t,setTimeout((function(){n.computedScollviewHeight()}),50);break;case 1:this.showActionIndex=-1,e.chooseImage({count:1,sizeType:["original","compressed"],sourceType:["album","camera"],success:function(t){console.log(t);var o=e.$TUIKit.createImageMessage({to:String(n.userInfo.id),conversationType:n.conversation.type,payload:{file:t},onProgress:function(e){}});n.$sendTIMMessage(o)}});break;case 2:e.chooseVideo({sourceType:["album","camera"],maxDuration:60,camera:"back",success:function(t){var o=e.$TUIKit.createVideoMessage({to:String(n.userInfo.id),conversationType:n.conversation.type,payload:{file:t},onProgress:function(e){}});n.$sendTIMMessage(o)}});break;case 3:this.showActionIndex=t,setTimeout((function(){n.computedScollviewHeight()}),50);break}},appendMessage:function(e){this.inputText+=e.detail.message},startRecordManage:function(){var t=this;this.recorderManager=e.getRecorderManager(),console.log(this.recorderManager),this.recorderManager.onStop((function(n){console.log(n),clearInterval(t.recordTimer);var o={duration:n.duration?n.duration:1e3*t.recordTime,tempFilePath:n.tempFilePath,fileSize:n.fileSize?n.fileSize:48*t.recordTime/8*1024};if(e.hideLoading(),t.canSend)if(o.duration<1e3)e.showToast({title:"录音时间太短",icon:"none"});else{var i=e.$TUIKit.createAudioMessage({to:String(t.userInfo.id),conversationType:t.conversation.type,payload:{file:o}});t.$sendTIMMessage(i)}t.startPoint=0,t.isRecording=!1,t.canSend=!0,t.voiceText="按住说话,松手发送"})),this.recorderManager.onError((function(e){console.log(e)}))},handleLongPress:function(t){var n=this;e.vibrateShort(),this.recorderManager.start({duration:6e4,sampleRate:44100,numberOfChannels:1,encodeBitRate:192e3,format:"aac"}),this.startPoint=t.touches[0],this.voiceText="正在录音,上划可取消",this.isRecording=!0,this.recordTime=0,this.recordTimer=setInterval((function(){n.recordTime++,n.recorTime>=n.recordTimeTotal&&(n.recorderManager.stop(),clearInterval(n.recordTimer),n.recordTimer=null)}),1e3)},handleTouchMove:function(e){this.isRecording&&(this.startPoint.clientY-e.touches[e.touches.length-1].clientY>100?(this.voiceText="松开手指,取消发送",this.canSend=!1):this.startPoint.clientY-e.touches[e.touches.length-1].clientY>20?(this.voiceText="上划可取消",this.canSend=!0):(this.voiceText="抬起停止",this.canSend=!0))},handleTouchEnd:function(){this.isRecording=!1,this.voiceText="按住说话,松手发送",e.hideLoading(),this.recorderManager.stop()},sendTextMessage:function(){var t=String(this.userInfo.id),n=this.inputText,o=e.$TUIKit.createTextMessage({to:t,conversationType:this.conversation.type,payload:{text:n}});this.inputText="",this.$sendTIMMessage(o)},$sendTIMMessage:function(t){var n=this;this.$EventBus.$emit("sendMessage",t),e.$TUIKit.sendMessage(t).then((function(e){n.$refs.messageList.scrollToButtom()})).catch((function(e){console.log(e)}))}}};t.default=s}).call(this,n("543d")["default"])},ab12:function(e,t,n){"use strict";var o=n("d62a"),i=n.n(o);i.a},b318:function(e,t,n){"use strict";n.r(t);var o=n("95b9"),i=n.n(o);for(var s in o)"default"!==s&&function(e){n.d(t,e,(function(){return o[e]}))}(s);t["default"]=i.a},d42c:function(e,t,n){"use strict";var o;n.d(t,"b",(function(){return i})),n.d(t,"c",(function(){return s})),n.d(t,"a",(function(){return o}));var i=function(){var e=this,t=e.$createElement;e._self._c},s=[]},d62a:function(e,t,n){}},[["2a49","common/runtime","common/vendor"]]]);
|