kj-chat.js 6.8 KB

12345678910
  1. (global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["components/kj-chat/kj-chat"],{2452:function(t,e,o){"use strict";o.r(e);var n=o("5145"),s=o("91d0");for(var i in s)["default"].indexOf(i)<0&&function(t){o.d(e,t,(function(){return s[t]}))}(i);o("a8c5");var a,c=o("f0c5"),r=Object(c["a"])(s["default"],n["b"],n["c"],!1,null,null,null,!1,n["a"],a);e["default"]=r.exports},5145:function(t,e,o){"use strict";o.d(e,"b",(function(){return s})),o.d(e,"c",(function(){return i})),o.d(e,"a",(function(){return n}));var n={uPopup:function(){return Promise.all([o.e("common/vendor"),o.e("uview-ui/components/u-popup/u-popup")]).then(o.bind(null,"2f21"))}},s=function(){var t=this,e=t.$createElement;t._self._c;t._isMounted||(t.e0=function(e){t.isjianpan=!0},t.e1=function(e){t.isjianpan=!1,t.showtype=0},t.e2=function(e){t.show=!0})},i=[]},"91d0":function(t,e,o){"use strict";o.r(e);var n=o("b692"),s=o.n(n);for(var i in n)["default"].indexOf(i)<0&&function(t){o.d(e,t,(function(){return n[t]}))}(i);e["default"]=s.a},a8c5:function(t,e,o){"use strict";var n=o("f291"),s=o.n(n);s.a},b692:function(t,e,o){"use strict";(function(t){var n=o("4ea4");Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var s,i=o("970c"),a=n(o("01d0")),c=n(o("63af")),r=t.getRecorderManager(),u={props:{to:{typeof:String,default:""},list:{typeof:Array,default:[]},user_other:{type:Object,default:{}},user:{type:Object,default:{}}},data:function(){return{height:"100rpx",showtype:0,emoji:c.default,text:"",changlist:[],isjianpan:!0,longPress:"1",time:0,duration:6e4,tempFilePath:"",playStatus:0,show:!1,page:1,follow:"",orderList:[],keywords:"",last_page:"",user_no:""}},created:function(){this.getOrderList(),this.user_no=t.getStorageSync("user_no")},methods:{lower:function(){this.page<this.last_page?(this.page++,this.getOrderList()):this.$u.toast(this.i18n.Nofurtherdata)},getOrderList:function(e){var o=this;t.$u.http.get("/api/order/order_list?status=".concat(this.follow,"&page=").concat(this.page,"&limit=10&keywords=").concat(this.keywords)).then((function(t){e||0==o.orderList.length?o.orderList=t.data:o.orderList=o.orderList.concat(t.data),o.last_page=t.last_page}))},close:function(){this.show=!1},longpressBtn:function(){console.log(r),console.log("长按说话"),this.longPress="2",r.onStop((function(t){console.log("onstop",t)}));var t={duration:this.duration,sampleRate:16e3,numberOfChannels:1,encodeBitRate:96e3,format:"mp3",frameSize:10};this.recordingTimer(),r.start(t),r.onStart((function(t){})),r.onError((function(t){console.log(t)}))},touchendBtn:function(){console.log("长按松开录音事件");var e=this;this.longPress="1",r.onStop((function(o){console.log(o),e.tempFilePath=o.tempFilePath,console.log(e.tempFilePath),t.uploadFile({url:"https://cbec.hdlkeji.com/api/upload/images",filePath:e.tempFilePath,name:"file",success:function(o){console.log("发送语音",o),t.hideLoading(),1e4==JSON.parse(o.data).code?e.sendluyin(JSON.parse(o.data).data.filePath):e.$u.toast(JSON.parse(o.data).msg)},fail:function(t){console.log(t)}})})),this.recordingTimer(this.time),r.stop()},recordingTimer:function(t){var e=this;void 0==t?s=setInterval((function(){e.time++}),1e3):clearInterval(s)},sendluyin:function(t){var e=this,o={type:"audio",chatType:"singleChat",filename:t,to:this.to,body:{url:t,type:"audio",filename:t,length:this.time},ext:{user_other:this.user_other,user:this.user}},n=new a.default.message.create(o);i.conn.send(n).then((function(t){console.log("Success"),setTimeout((function(){e.$emit("success",!0)}),800)})).catch((function(t){console.log("Fail",t)}))},sendorder:function(e){var o=this,n=t.getStorageSync("user_info"),s=i.conn.getUniqueId(),c=new a.default.message("txt",s);c.set({type:"txt",msg:"订单消息",to:"13523652365",chatType:"singleChat",ext:{type:"orderinfo",order:{info:e},user:n},success:function(t,e){setTimeout((function(){o.$emit("success",!0)}),800)},fail:function(t){console.log("发送消息失败")}}),this.show=!1,i.conn.send(c.body)},send:function(){var t=this;if(""!=this.text&&null!=this.text){var e=i.conn.getUniqueId(),o=new a.default.message("txt",e);o.set({type:"txt",msg:this.text,to:this.to,chatType:"singleChat",ext:{user_other:this.user_other,user:this.user},success:function(e,o){console.log("成功发送消息"),setTimeout((function(){t.$emit("success",!0)}),800)},fail:function(t){console.log("发送消息失败",t)}}),console.log("msg",o),i.conn.send(o.body),this.text=""}else this.$u.toast("发送消息不能为空")},toalbum:function(){var e=this;t.chooseImage({count:1,sizeType:["original","compressed"],sourceType:["album"],success:function(o){t.showLoading({mask:!0,title:"请稍后"}),console.log("img",o),t.uploadFile({url:"https://cbec.hdlkeji.com/api/upload/images",filePath:o.tempFilePaths[0],name:"file",success:function(o){t.hideLoading(),console.log(JSON.parse(o.data)),1e4==JSON.parse(o.data).code?(console.log("data",JSON.parse(o.data).data.filePath),e.sendPrivateImg(JSON.parse(o.data).data.filePath)):e.$u.toast(JSON.parse(o.data).msg)},fail:function(t){console.log(t)}})}})},tocapture:function(){var e=this;t.chooseImage({count:1,sizeType:["original","compressed"],sourceType:["camera"],success:function(o){t.showLoading({mask:!0,title:"请稍后"}),console.log("img",o),t.uploadFile({url:"https://cbec.hdlkeji.com/api/upload/images",filePath:o.tempFilePaths[0],name:"file",success:function(o){t.hideLoading(),console.log(JSON.parse(o.data)),1e4==JSON.parse(o.data).code?e.sendPrivateImg(JSON.parse(o.data).data.filePath):e.$u.toast(JSON.parse(o.data).msg)},fail:function(t){console.log(t)}})}})},sendPrivateImg:function(t){var e=this;console.log("sendPrivateImg",t);var o={chatType:"singleChat",type:"img",url:t,to:this.to,ext:{user_other:this.user_other,user:this.user}},n=new a.default.message.create(o);i.conn.send(n).then((function(t){console.log("发送图片成功"),setTimeout((function(){e.$emit("success",!0)}),800)}))},select:function(t){this.text=t.content},tolist:function(){t.navigateTo({url:"/pagesC/changyong-list"})},toadd:function(){t.navigateTo({url:"/pagesC/changyong-add"})},changeemoji:function(t){this.text=this.text+t},openemoji:function(){this.showtype=3==this.showtype?0:3,this.height=3==this.showtype?"400rpx":"100rpx"},openmore:function(){this.showtype=1==this.showtype?0:1,this.height=1==this.showtype?"300rpx":"100rpx"},openchangyong:function(){this.showtype=2==this.showtype?0:2,this.height=2==this.showtype?"600rpx":"100rpx",this.isjianpan=!0}}};e.default=u}).call(this,o("543d")["default"])},f291:function(t,e,o){}}]);
  2. ;(global["webpackJsonp"] = global["webpackJsonp"] || []).push([
  3. 'components/kj-chat/kj-chat-create-component',
  4. {
  5. 'components/kj-chat/kj-chat-create-component':(function(module, exports, __webpack_require__){
  6. __webpack_require__('543d')['createComponent'](__webpack_require__("2452"))
  7. })
  8. },
  9. [['components/kj-chat/kj-chat-create-component']]
  10. ]);