You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
3 lines
43 KiB
3 lines
43 KiB
1 year ago
|
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["pages-index-index"],{"0000":function(t,e,n){"use strict";n("7a82");var i=n("4a46").default,a=n("ee27").default;Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0,n("d9e2"),n("d401"),n("d3b7"),n("159b"),n("3ca3"),n("ddb0"),n("2b3d"),n("9861"),n("4d63"),n("c607"),n("ac1f"),n("2c3e"),n("25f0"),n("5319"),n("e25e");var o=a(n("f07e")),r=a(n("c964")),s=a(n("3740")),d=i(n("3675")),c=(n("6ea9"),uni.getRecorderManager(),{data:function(){return{isRecording:!1,hasRecording:!1,recordingUrl:"",recordingChunks:[],mediaRecorder:null,recordingDuration:0,recordingSize:0,overDuration:6e4,duration:0,url:"",timer:null,hasStop:!1,hasStart:!1,isStart:!1,recordingTime:"00:00",recordingLength:0,setInter:null,userInfo:null}},mixins:[],methods:{startRecording:function(){var t=this;return(0,r.default)((0,o.default)().mark((function e(){var n,i;return(0,o.default)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(e.prev=0,navigator.mediaDevices.getUserMedia){e.next=3;break}throw new Error("getUserMedia not supported");case 3:return n=t,e.next=6,navigator.mediaDevices.getUserMedia({audio:!0});case 6:i=e.sent,n.setData({mediaRecorder:new MediaRecorder(i,{mimeType:"audio/webm"}),recordingChunks:[]}),n.mediaRecorder.addEventListener("dataavailable",(function(t){n.setData({recordingChunks:[t.data]})})),n.mediaRecorder.onstop=function(){i.getTracks().forEach((function(t){return t.stop()}))},n.mediaRecorder.addEventListener("stop",(0,r.default)((0,o.default)().mark((function t(){var e,i;return(0,o.default)().wrap((function(t){while(1)switch(t.prev=t.next){case 0:e=function(t,e){var n=new File([t],e,{type:t.type});return n},i=new Blob(n.recordingChunks,{type:"audio/webm"}),n.setData({recordingUrl:URL.createObjectURL(i),recordingSize:Math.round(i.size/1024),hasRecording:!0,file:e(i,"luyin.webm")}),n.uploadRecord(e(i,"luyin.webm"),n.recordingLength);case 4:case"end":return t.stop()}}),t)})))),n.mediaRecorder.start(),e.next=18;break;case 14:e.prev=14,e.t0=e["catch"](0),console.error("Failed to start recording:",e.t0),t.isRecording=!1;case 18:case"end":return e.stop()}}),e,null,[[0,14]])})))()},stopRecording:function(){this.mediaRecorder&&this.mediaRecorder.stop()},playRecording:function(){this.$refs.audioPlayer.play()},recordingTimer:function(){var t=this,e=this;clearInterval(this.timer),this.setData({timer:null},(function(){t.setData({timer:setInterval((function(){var t=e,n=t.overDuration,i=t.recordingLength;if(1e3*i>=n)return uni.showToast({title:"录音已超时,已停止录音",icon:"none",duration:1500}),t.recorderManager.stop(),clearInterval(t.timer),void t.setData({timer:null,hasStart:!1,duration:i});var a=t.recordingLength+1;t.setData({recordingLength:a,recordingTime:t.formatTime(a)})}),1e3)})}))},handleRecord:function(){},handleOpenRecord:function(){var t=d.getStoreUserInfo();this.setData({isStart:!0,userInfo:t}),this.setData({hasStart:!0}),this.recordingTimer(),this.startRecording()},handleRecordDel:function(){clearInterval(this.timer),this.setData({recordingTime:"00:00",recordingLength:0,hasStart:!1,isStart:!1,hasStop:!1,url:"",timer:null,duration:0,hasRecording:!1,mediaRecorder:null,recordingUrl:"",recordingDuration:0,recordingSize:0})},hancleCancle:function(){this.handleRecordDel(),this.$emit("onTapCancle")},recordStart:function(){this.setData({hasStart:!0}),this.recordingTimer()},recordStop:function(){var t=this,e=this.url,n=this.hasStop;if(this.setData({hasStart:!1}),uni.showLoading({title:"录音上传中..."}),n)this.uploadRecord(e,this.duration);else{clearInterval(this.timer),this.setData({timer:null},(function(){t.stopRecording()}))}},uploadRecord:function(t,e){var n=s.default.SERVER_URL+"/oss/file/uploadvoice";this.uploadFile(n,t,e)},uploadFile:function(t,e,n){var i=this;console.log("url, file, duration::",t,e,n,this.userInfo.authorization),uni.uploadFile({url:t,fileType:"audio",files:[e],header:{authorization:this.userInfo.authorization},formData:{file:e,customerId:this.userInfo.customerId},success:function(t){var e=t.data,a=new RegExp("http://172.20.46
|
||
|
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
||
|
e.default=function(){return t};var t={},n=Object.prototype,a=n.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},r="function"==typeof Symbol?Symbol:{},s=r.iterator||"@@iterator",d=r.asyncIterator||"@@asyncIterator",c=r.toStringTag||"@@toStringTag";function u(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(C){u=function(t,e,n){return t[e]=n}}function l(t,e,n,i){var a=e&&e.prototype instanceof h?e:h,r=Object.create(a.prototype),s=new E(i||[]);return o(r,"_invoke",{value:A(t,n,s)}),r}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(C){return{type:"throw",arg:C}}}t.wrap=l;var m={};function h(){}function p(){}function v(){}var g={};u(g,s,(function(){return this}));var b=Object.getPrototypeOf,w=b&&b(b(R([])));w&&w!==n&&a.call(w,s)&&(g=w);var y=v.prototype=h.prototype=Object.create(g);function Z(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function x(t,e){var n;o(this,"_invoke",{value:function(o,r){function s(){return new e((function(n,s){(function n(o,r,s,d){var c=f(t[o],t,r);if("throw"!==c.type){var u=c.arg,l=u.value;return l&&"object"==(0,i.default)(l)&&a.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,s,d)}),(function(t){n("throw",t,s,d)})):e.resolve(l).then((function(t){u.value=t,s(u)}),(function(t){return n("throw",t,s,d)}))}d(c.arg)})(o,r,n,s)}))}return n=n?n.then(s,s):s()}})}function A(t,e,n){var i="suspendedStart";return function(a,o){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===a)throw o;return I()}for(n.method=a,n.arg=o;;){var r=n.delegate;if(r){var s=k(r,n);if(s){if(s===m)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===i)throw i="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i="executing";var d=f(t,e,n);if("normal"===d.type){if(i=n.done?"completed":"suspendedYield",d.arg===m)continue;return{value:d.arg,done:n.done}}"throw"===d.type&&(i="completed",n.method="throw",n.arg=d.arg)}}}function k(t,e){var n=e.method,i=t.iterator[n];if(void 0===i)return e.delegate=null,"throw"===n&&t.iterator["return"]&&(e.method="return",e.arg=void 0,k(t,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),m;var a=f(i,t.iterator,e.arg);if("throw"===a.type)return e.method="throw",e.arg=a.arg,e.delegate=null,m;var o=a.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,m):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,m)}function L(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function S(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function E(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(L,this),this.reset(!0)}function R(t){if(t){var e=t[s];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(a.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:I}}function I(){return{value:void 0,done:!0}}return p.prototype=v,o(y,"constructor",{value:v,configurable:!0}),o(v,"constructor",{value:p,configurable:!0}),p.displayName=u(v,c,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===p||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,v):(t.__proto__=v,u(t,c,"GeneratorFunction")),t.prototype=Object.create(y),t},t.awrap=function(t){return{__await:t}},Z(x.prototype),u(x.prototype,d,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,i,a,o){void 0===o&&(o=Promise);var r=new x(l(e,n,i,a),o);return t.isGeneratorFunction(n)?r:r.next().then((function(t){return t.do
|