bztang-admin/addons/yun_shop/static/app/js/chunk-2d0e889a.f6d91d8d.js

1 line
4.2 KiB
JavaScript

(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2d0e889a"],{"8a61":function(t,e,n){"use strict";n.r(e);var i=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"hello"},[n("div",{on:{click:t.toMin}},[t._v("调起小程序")])])},o=[],a=(n("d3b7"),n("3ca3"),n("ddb0"),n("2b3d"),n("9861"),n("88a7"),n("271a"),n("5494"),n("d9e2"),n("b680"),n("e9c4"),wx),r={name:"test",data:function(){return{localId:"",serverId:"",downLoadId:"",Soff:!0,time:0,timer:null,voice:""}},created:function(){},mounted:function(){},methods:{toMin:function(){YDB.MiniWX("gh_cdb1a2dfcd17","/packageD/buy/orderPay/orderPay.html?order_id=7669&status=2")},end:function(t){var e=this.$refs.audios;e.src=URL.createObjectURL(t),e.onended=function(){},e.play()},initWithUrl:function(t){if(this._isInit||this._isInitRecorder)throw new Error("AMR has been initialized. For a new AMR, please generate a new BenzAMRRecorder().");var e=new Promise((function(e,n){fetch(t,{method:"GET",responseType:"blob",headers:{"Content-Type":"application/octet-stream"},credentials:"include"}).then((function(t){t.ok&&t.blob().then((function(t){e(t)}))})).catch((function(t){n(t)}))}));return e.then((function(t){return t}))},loadDemoBtn:function(t){this.loadDemoBtn1.setAttribute("disabled",!0),this.loadAmrFile1.setAttribute("disabled",!0),this.playBtn.setAttribute("disabled",!0);var e=this;e.initWithUrl("http://localhost:8081/addons/yun_shop/static/app/mario.amr").then((function(t){Recorder.amr2wav(t,(function(t){e.end(t)}),(function(t){})),e.loadDemoBtn1.removeAttribute("disabled"),e.loadAmrFile1.removeAttribute("disabled"),e.playBtn.removeAttribute("disabled")}))},playAmr:function(){this.amr.isPlaying()?this.amr.stop():this.amr.play()},loadAmrFile:function(t){var e=this,n=this.$refs.inputer;this.amr=new BenzAMRRecorder,this.loadDemoBtn1.setAttribute("disabled",!0),this.loadAmrFile1.setAttribute("disabled",!0),this.playBtn.setAttribute("disabled",!0),this.amr.initWithBlob(n.files[0]).then((function(){e.loadDemoBtn1.removeAttribute("disabled"),e.loadAmrFile1.removeAttribute("disabled"),e.playBtn.removeAttribute("disabled"),e.duration.innerHTML=e.amr.getDuration().toFixed(2)+"'"})),this.amr.onPlay((function(){e.playBtn.innerHTML="停止"})),this.amr.onStop((function(){e.playBtn.innerHTML="播放"})),this.amr.onEnded((function(){e.playBtn.innerHTML="播放"})),this.amr.onAutoEnded((function(){})),this.amr.onStartRecord((function(){})),this.amr.onFinishRecord((function(){})),this.amr.onCancelRecord((function(){}))},start:function(t){var e=this;e.time=0,a.startRecord({success:function(){alert("成功调起录音"),e.timer=setInterval((function(){e.time++}),1e3),e.vicoeEnd()},cancel:function(){alert("用户拒绝授权录音")}})},stop:function(){var t=this;a.stopRecord({success:function(e){alert("暂停成功"),clearInterval(t.timer),t.localId=e.localId,t.upVoice()},fail:function(t){alert("死啦停不了")}})},cancel:function(){a.stopRecord({success:function(t){alert("取消录音")}})},vicoeEnd:function(){var t=this;a.onVoiceRecordEnd({complete:function(e){alert("60秒停止录音"),t.localId=e.localId,clearInterval(t.timer),t.upVoice()}})},merge:function(){var t=this,e=window.location.href;this.axios({method:"post",url:"http://apiwx.lostars.cn/index.php/index/File/merge",headers:{"Content-Type":"application/json"},data:{url:e}}).then((function(e){t.$refs.allRecord.src=e.data})).catch((function(t){}))},play:function(){var t=this;a.playVoice({localId:t.localId})},pausePlay:function(){var t=this;a.pauseVoice({localId:t.localId})},stopPlay:function(){var t=this;a.stopVoice({localId:t.localId})},upVoice:function(){var t=this;wx.uploadVoice({localId:t.localId,isShowProgressTips:1,success:function(e){alert(JSON.stringify(e)),t.serverId=e.serverId,axios.post(t.fun.getRealUrl("plugin.business-card.frontend.controllers.card.card.get-voice"),{media_id:e.serverId},{headers:{"Content-Type":"application/json"}}).then((function(e){var n=e.data;1===n.result?(t.voice=n.data,t.loadDemoBtn()):alert(n.msg)})).catch((function(t){alert(t)}))}})},downVoice:function(){var t=this;a.downloadVoice({serverId:t.serverId,isShowProgressTips:1,success:function(e){alert("下载成功"),t.downLoadId=e.localId,alert(e)}})}}},c=r,s=n("2877"),l=Object(s["a"])(c,i,o,!1,null,null,null);e["default"]=l.exports}}]);