(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pages/common_tools/my_consulting/conversation"],{"393c":function(e,t,i){"use strict";var n=i("d0ac"),o=i.n(n);o.a},"39f1":function(e,t,i){"use strict";i.d(t,"b",(function(){return o})),i.d(t,"c",(function(){return s})),i.d(t,"a",(function(){return n}));var n={GoEasyAudioPlayer:function(){return i.e("components/GoEasyAudioPlayer/GoEasyAudioPlayer").then(i.bind(null,"cf0e"))}},o=function(){var e=this,t=e.$createElement,i=(e._self._c,e.__map(e.messages,(function(t,i){var n=e.__get_orig(t),o=t.senderId==e.currentUser.uuid?e.renderMessageDate(t,i):null;return{$orig:n,m0:o}})));e.$mp.data=Object.assign({},{$root:{l0:i}})},s=[]},5123:function(e,t,i){"use strict";i.r(t);var n=i("39f1"),o=i("ac57");for(var s in o)"default"!==s&&function(e){i.d(t,e,(function(){return o[e]}))}(s);i("393c");var r,a=i("f0c5"),c=Object(a["a"])(o["default"],n["b"],n["c"],!1,null,null,null,!1,n["a"],r);t["default"]=c.exports},6683:function(e,t,i){"use strict";(function(e){i("02cf");n(i("66fd"));var t=n(i("5123"));function n(e){return e&&e.__esModule?e:{default:e}}e(t.default)}).call(this,i("543d")["createPage"])},ac57:function(e,t,i){"use strict";i.r(t);var n=i("ff08"),o=i.n(n);for(var s in n)"default"!==s&&function(e){i.d(t,e,(function(){return n[e]}))}(s);t["default"]=o.a},d0ac:function(e,t,i){},ff08:function(e,t,i){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;i("a602");var n=function(){i.e("components/GoEasyAudioPlayer/GoEasyAudioPlayer").then(function(){return resolve(i("cf0e"))}.bind(null,i)).catch(i.oe)},o=e.getRecorderManager(),s={components:{GoEasyAudioPlayer:n},onLoad:function(t){if(this.doctorstatus=t.doctorstatus,console.log(this.doctorstatus),this.imService=getApp().globalData.imService,this.imService&&this.imService.currentUser){this.doctorInfo=JSON.parse(t.doctor),this.friend={uuid:"doctor_"+this.doctorInfo.id,name:this.doctorInfo.name,avatar:this.doctorInfo.avatar},this.currentUser=this.imService.currentUser;var i=this.imService.getPrivateMessages(this.friend.uuid);this.messages=i.sentMessages,this.pendingMessages=i.pendingMessages,e.setNavigationBarTitle({title:this.friend.name}),this.initialListeners(),this.scrollToBottom(),0!=this.messages.length&&this.imService.markPrivateMessageAsRead(this.friend.uuid)}else e.navigateTo({url:"../../login/login"})},onShow:function(){this.imService=getApp().globalData.imService,this.imService&&this.imService.currentUser||e.navigateTo({url:"../../login/login"})},mounted:function(){},data:function(){return{keyword:"",InputBottom:0,isvoice:!1,textinput:"请输入",isinput:!1,messages:[],self_messages:[],friend:null,currentUser:null,imService:null,audio:{recording:!1},doctorInfo:{},doctorstatus:""}},onPullDownRefresh:function(e){this.loadMoreHistoryMessage()},onUnload:function(){this.imService&&(this.imService.onNewPrivateMessageReceive=function(e,t){})},methods:{renderMessageDate:function(e,t){return 0===t||e.timestamp-this.messages[t-1].timestamp>3e5?this.formatDate(e.timestamp):""},InputFocus:function(e){this.InputBottom=e.detail.height},InputBlur:function(e){this.InputBottom=0},sendvoice:function(){this.isvoice=!this.isvoice},subscribeMessage:function(){},yulan:function(t){e.previewImage({urls:[t],current:t})},initialListeners:function(){var e=this;this.imService.onNewPrivateMessageReceive=function(t,i){t==e.friend.uuid&&(e.imService.markPrivateMessageAsRead(t),e.scrollToBottom())},this.initRecorderListeners()},initRecorderListeners:function(){var e=this;o.onStart((function(){e.audio.recording=!0})),o.onStop((function(t){console.log(t),e.audio.recording=!1,e.imService.sendPrivateAudioMessage(e.friend.uuid,t)})),o.onError((function(e){console.log("录音报错：",e)}))},onRecordStart:function(t){try{o.start()}catch(i){e.showModal({title:"发送语音错误",content:"请联系客服"})}t.preventDefault()},onRecordEnd:function(){try{o.stop()}catch(t){e.showModal({title:"发送语音错误",content:"请联系客服"})}},sendMessage:function(){""!=this.keyword.trim()&&(console.log(this.friend.uuid),this.imService.sendPrivateTextMessage(this.friend.uuid,this.keyword)),this.keyword=""},scrollToBottom:function(){this.$nextTick((function(){e.pageScrollTo({scrollTop:2e6,duration:10})}))},sendImage:function(){var t=this;e.chooseImage({count:1,success:function(e){t.imService.sendPrivateImageMessage(t.friend.uuid,e)}})},loadMoreHistoryMessage:function(){var t=this,i=Date.now(),n=this.messages[0];n&&(i=n.timestamp);var o=this.messages.length,s=this.imService.loadPrivateHistoryMessage(this.friend.uuid,i);s.then((function(i){i.length==o&&(t.allHistoryLoaded=!0),t.messages=i,e.stopPullDownRefresh()})).catch((function(t){console.log(t),e.stopPullDownRefresh()}))}}};t.default=s}).call(this,i("543d")["default"])}},[["6683","common/runtime","common/vendor"]]]);