| 12 |
- (global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pages_index/voiceItem"],{242:function(t,e,n){"use strict";(function(t,e){var o=n(4);n(26);o(n(25));var i=o(n(243));t.__webpack_require_UNI_MP_PLUGIN__=n,e(i.default)}).call(this,n(1)["default"],n(2)["createPage"])},243:function(t,e,n){"use strict";n.r(e);var o=n(244),i=n(246);for(var r in i)["default"].indexOf(r)<0&&function(t){n.d(e,t,(function(){return i[t]}))}(r);n(248);var s,a=n(34),c=Object(a["default"])(i["default"],o["render"],o["staticRenderFns"],!1,null,"9e2d4662",null,!1,o["components"],s);c.options.__file="pages_index/voiceItem.vue",e["default"]=c.exports},244:function(t,e,n){"use strict";n.r(e);var o=n(245);n.d(e,"render",(function(){return o["render"]})),n.d(e,"staticRenderFns",(function(){return o["staticRenderFns"]})),n.d(e,"recyclableRender",(function(){return o["recyclableRender"]})),n.d(e,"components",(function(){return o["components"]}))},245:function(t,e,n){"use strict";var o;n.r(e),n.d(e,"render",(function(){return i})),n.d(e,"staticRenderFns",(function(){return s})),n.d(e,"recyclableRender",(function(){return r})),n.d(e,"components",(function(){return o}));try{o={uTabs:function(){return Promise.all([n.e("common/vendor"),n.e("uni_modules/uview-ui/components/u-tabs/u-tabs")]).then(n.bind(null,688))},uIcon:function(){return Promise.all([n.e("common/vendor"),n.e("uni_modules/uview-ui/components/u-icon/u-icon")]).then(n.bind(null,679))},uLoadingIcon:function(){return Promise.all([n.e("common/vendor"),n.e("uni_modules/uview-ui/components/u-loading-icon/u-loading-icon")]).then(n.bind(null,696))}}}catch(a){if(-1===a.message.indexOf("Cannot find module")||-1===a.message.indexOf(".vue"))throw a;console.error(a.message),console.error("1. 排查组件名称拼写是否正确"),console.error("2. 排查组件是否符合 easycom 规范,文档:https://uniapp.dcloud.net.cn/collocation/pages?id=easycom"),console.error("3. 若组件不符合 easycom 规范,需手动引入,并在 components 中注册该组件")}var i=function(){var t=this,e=t.$createElement;t._self._c},r=!1,s=[];i._withStripped=!0},246:function(t,e,n){"use strict";n.r(e);var o=n(247),i=n.n(o);for(var r in o)["default"].indexOf(r)<0&&function(t){n.d(e,t,(function(){return o[t]}))}(r);e["default"]=i.a},247:function(t,e,n){"use strict";(function(t){var o=n(4);Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var i=o(n(11)),r=n(223);function s(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,o)}return n}function a(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?s(Object(n),!0).forEach((function(e){(0,i.default)(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):s(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var c=null,u={data:function(){return{recorderManager:null,textHeight:"",statusBarHeight:t.getSystemInfoSync().statusBarHeight+"px",screenHeight:t.getSystemInfoSync().windowHeight+"px",voicePath:"",status:"stop",isVoicePlay:!1,btnLoading:!1,tabs:[{id:1,name:"自己录制"},{id:2,name:"AI生成"}],current:0,id:null,voiceText:"",recordType:0,type:0}},onLoad:function(t){this.type=t.type||0,this.recordType=t.recordType||0,this.id=t.id||null,this.getDetail(),this.initDate()},onHide:function(){c&&c.pause()},onUnload:function(){this.recorderManager=null,c&&(c.destroy(),c=null)},methods:{tabclick:function(e){if(e!=this.current)if(this.btnLoading||"start"==this.status)t.showToast({title:"生成中,请勿进行其他操作!",icon:"none"});else if("end"==this.status){var n=this;t.showModal({title:"提示",content:"当亲录制已完成,切换类型需要重新录制,确认切换吗?",success:function(t){if(t.confirm){var o=a({index:e},n.tabs[e]);n.tabChange(o)}else t.cancel&&console.log("用户点击取消")}})}},tabChange:function(e){console.log("tabChange"),this.current!=e.index&&((this.btnLoading||"start"==this.status)&&t.showToast({title:"生成中,请勿进行其他操作!",icon:"none"}),this.current=e.index,this.recorderManager=null,c&&(c.stop(),c.destroy(),c=null),this.voicePath=1==this.recordType?this.voicePath:"",this.status=1==this.recordType?this.status:"stop",this.isVoicePlay=!1,this.btnLoading=!1,this.initDate())},initDate:function(){var e=this;this.recorderManager=t.getRecorderManager(),c=t.createInnerAudioContext();var n=this;this.recorderManager&&(this.recorderManager.onStart((function(){e.status="start",e.voicePath=""})),this.recorderManager.onStop((function(t){e.status="end",n.voicePath=t.tempFilePath}))),c&&(c.onPlay((function(){e.isVoicePlay=!0})),c.onStop((function(){e.isVoicePlay=!1})),c.onEnded((function(){e.isVoicePlay=!1})),c.onError((function(t){e.isVoicePlay=!1})),c.onPause((function(){e.isVoicePlay=!1})))},handleRecord:function(){c&&c.pause(),1==this.current?"stop"==this.status?this.creatVoice():"start"==this.status?t.showToast({title:"生成中,请勿进行其他操作!",icon:"none"}):"end"!=this.status&&"ok"!=this.status||this.creatVoice():"stop"==this.status?this.startRecord():"start"==this.status?this.endRecord():"end"!=this.status&&"ok"!=this.status||this.startRecord()},startRecord:function(){this.recorderManager.start({format:"mp3"})},endRecord:function(){this.recorderManager.stop()},playVoice:function(){"start"!=this.status&&this.voicePath&&(0==this.isVoicePlay?(c.src=this.voicePath,c.play()):c.stop())},onSubmit:function(){var e=this;"start"!=this.status&&(this.btnLoading=!0,t.showLoading({title:"提交中..."}),1!=this.current?t.uploadFile({url:t.getStorageSync("requestPath")+"/app/common/uploadOSS",filePath:this.voicePath,name:"file",success:function(n){console.log("companyUserVoiceNew==",JSON.parse(n.data).url);var o=JSON.parse(n.data).url;(0,r.companyUserVoiceNew)({userVoiceUrl:o,id:e.id}).then((function(n){t.hideLoading(),e.btnLoading=!1,200==n.code?(t.showToast({icon:"none",title:"提交成功"}),t.$emit("refreshVoiceList"),setTimeout((function(){t.navigateBack()}),2e3)):t.showToast({icon:"none",title:n.msg,duration:2e3})})).catch((function(){t.hideLoading(),e.btnLoading=!1}))},fail:function(){t.hideLoading(),e.btnLoading=!1}}):this.creatVoice())},getDetail:function(){var e=this;(0,r.queryDetail)(this.id).then((function(n){200==n.code?(e.voiceText=n.data.voiceTxt,e.recordType=n.data.recordType,1==e.recordType&&(e.voicePath=n.data.wavUrl||"",e.status="ok",e.voicePath&&e.voicePath.match(/\.mp3$/)?e.current=0:e.current=1),e.$nextTick((function(){var n=t.createSelectorQuery().in(e);n.select(".voice-footer").boundingClientRect((function(n){e.textHeight="calc(".concat(e.screenHeight," - ").concat(n.height,"px - ").concat(e.statusBarHeight," - 45px - ").concat(t.upx2px(120),"px)")})).exec()}))):t.showToast({icon:"none",title:n.msg})}))},creatVoice:function(){var e=this;"start"!=this.status&&(this.btnLoading=!0,this.status="start",this.voicePath="",t.showLoading({title:"生成中..."}),(0,r.companyUserVoice)({id:this.id}).then((function(n){t.hideLoading(),e.btnLoading=!1,200==n.code?(e.status="end",e.voicePath=n.data.wavUrl,t.showToast({icon:"none",title:"生成成功"}),t.$emit("refreshVoiceList"),setTimeout((function(){t.navigateBack()}),2e3)):(e.status="stop",t.showToast({icon:"none",title:n.msg,duration:2e3}))})).catch((function(){t.hideLoading(),e.btnLoading=!1,e.status="stop"})))}}};e.default=u}).call(this,n(2)["default"])},248:function(t,e,n){"use strict";n.r(e);var o=n(249),i=n.n(o);for(var r in o)["default"].indexOf(r)<0&&function(t){n.d(e,t,(function(){return o[t]}))}(r);e["default"]=i.a},249:function(t,e,n){}},[[242,"common/runtime","common/vendor"]]]);
- //# sourceMappingURL=../../.sourcemap/mp-weixin/pages_index/voiceItem.js.map
|