voice.js 4.9 KB

12
  1. (global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pages_index/voice"],{234:function(e,n,t){"use strict";(function(e,n){var o=t(4);t(26);o(t(25));var r=o(t(235));e.__webpack_require_UNI_MP_PLUGIN__=t,n(r.default)}).call(this,t(1)["default"],t(2)["createPage"])},235:function(e,n,t){"use strict";t.r(n);var o=t(236),r=t(238);for(var i in r)["default"].indexOf(i)<0&&function(e){t.d(n,e,(function(){return r[e]}))}(i);t(240);var a,c=t(34),s=Object(c["default"])(r["default"],o["render"],o["staticRenderFns"],!1,null,"132a211c",null,!1,o["components"],a);s.options.__file="pages_index/voice.vue",n["default"]=s.exports},236:function(e,n,t){"use strict";t.r(n);var o=t(237);t.d(n,"render",(function(){return o["render"]})),t.d(n,"staticRenderFns",(function(){return o["staticRenderFns"]})),t.d(n,"recyclableRender",(function(){return o["recyclableRender"]})),t.d(n,"components",(function(){return o["components"]}))},237:function(e,n,t){"use strict";var o;t.r(n),t.d(n,"render",(function(){return r})),t.d(n,"staticRenderFns",(function(){return a})),t.d(n,"recyclableRender",(function(){return i})),t.d(n,"components",(function(){return o}));try{o={uIcon:function(){return Promise.all([t.e("common/vendor"),t.e("uni_modules/uview-ui/components/u-icon/u-icon")]).then(t.bind(null,679))}}}catch(c){if(-1===c.message.indexOf("Cannot find module")||-1===c.message.indexOf(".vue"))throw c;console.error(c.message),console.error("1. 排查组件名称拼写是否正确"),console.error("2. 排查组件是否符合 easycom 规范,文档:https://uniapp.dcloud.net.cn/collocation/pages?id=easycom"),console.error("3. 若组件不符合 easycom 规范,需手动引入,并在 components 中注册该组件")}var r=function(){var e=this,n=e.$createElement;e._self._c},i=!1,a=[];r._withStripped=!0},238:function(e,n,t){"use strict";t.r(n);var o=t(239),r=t.n(o);for(var i in o)["default"].indexOf(i)<0&&function(e){t.d(n,e,(function(){return o[e]}))}(i);n["default"]=r.a},239:function(e,n,t){"use strict";(function(e){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var o=t(223),r=null,i={data:function(){return{recorderManager:null,textHeight:"",statusBarHeight:e.getSystemInfoSync().statusBarHeight+"px",screenHeight:e.getSystemInfoSync().windowHeight+"px",voicePath:"",status:"stop",isVoicePlay:!1,btnLoading:!1}},onLoad:function(){var n=this;console.log("==onLoad==",this.recorderManager),this.recorderManager=e.getRecorderManager(),r=e.createInnerAudioContext();var t=this;console.log("==recorderManager22222222==",this.recorderManager),this.recorderManager&&(console.log("==recorderManager=="),this.recorderManager.onStart((function(){console.log("==start=="),n.status="start"})),this.recorderManager.onStop((function(e){console.log("recorder stop"+JSON.stringify(e)),n.status="end",t.voicePath=e.tempFilePath})),this.recorderManager.onError((function(e){console.log("onError =="+JSON.stringify(e))}))),r&&(r.onPlay((function(){n.isVoicePlay=!0})),r.onStop((function(){n.isVoicePlay=!1})),r.onEnded((function(){n.isVoicePlay=!1})),r.onError((function(e){n.isVoicePlay=!1})),r.onPause((function(){n.isVoicePlay=!1})))},onReady:function(){var n=this,t=e.createSelectorQuery().in(this);t.select(".voice-footer").boundingClientRect((function(t){n.textHeight="calc(".concat(n.screenHeight," - ").concat(t.height,"px - ").concat(n.statusBarHeight," - 45px - ").concat(e.upx2px(120),"px)")})).exec()},onHide:function(){r&&r.pause()},onUnload:function(){this.recorderManager=null,r&&(r.destroy(),r=null)},methods:{handleRecord:function(){console.log("handleRecord",this.status),r&&r.pause(),"stop"==this.status?this.startRecord():"start"==this.status?this.endRecord():"end"==this.status&&this.startRecord()},startRecord:function(){console.log("this.recorderManager",this.recorderManager),this.recorderManager.start({format:"mp3",duration:1e4})},endRecord:function(){this.recorderManager.stop()},playVoice:function(){console.log(r),"start"!=this.status&&this.voicePath&&(0==this.isVoicePlay?(r.src=this.voicePath,r.play()):r.stop())},onSubmit:function(){var n=this;console.log("==onSubmit=",this.status),"start"!=this.status&&(this.btnLoading=!0,e.showLoading({title:"提交中..."}),e.uploadFile({url:e.getStorageSync("requestPath")+"/app/common/uploadOSS",filePath:this.voicePath,name:"file",success:function(t){console.log(JSON.parse(t.data).url);var r=JSON.parse(t.data).url;(0,o.addVoicePrintUrl)({voicePrintUrl:r}).then((function(t){e.hideLoading(),n.btnLoading=!1,200==t.code?e.showToast({icon:"none",title:"提交成功"}):e.showToast({icon:"none",title:t.msg})})).catch((function(){e.hideLoading(),n.btnLoading=!1}))},fail:function(){e.hideLoading(),n.btnLoading=!1}}))}}};n.default=i}).call(this,t(2)["default"])},240:function(e,n,t){"use strict";t.r(n);var o=t(241),r=t.n(o);for(var i in o)["default"].indexOf(i)<0&&function(e){t.d(n,e,(function(){return o[e]}))}(i);n["default"]=r.a},241:function(e,n,t){}},[[234,"common/runtime","common/vendor"]]]);
  2. //# sourceMappingURL=../../.sourcemap/mp-weixin/pages_index/voice.js.map