(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["pages-users-yuyin-index"],{"1e3f":function(n,o,e){"use strict";e("6a54");var t=e("f5bd").default;Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var i=t(e("2634")),s=t(e("2fdc"));e("d4b5"),e("e966");var a=t(e("af29")),r=uni.getRecorderManager(),u=uni.createInnerAudioContext();u.autoplay=!0;var c=0,l={data:function(){return{baseUrl:"",count:0,show:!1,isPlay:!1,isPlays:!1,yuyinInfo:{},isRest:!1,counts:0,isPlay1:!1}},onReady:function(){var n=this;n.yuyinInfo=uni.getStorageSync("yuyinInfo"),console.log(n.yuyinInfo),n.baseUrl=n.$baseUrl,n.yuyinInfo.voiceTime=n.formatFun(n.yuyinInfo.voiceTime),r.onStop((function(o){n.yuyinInfo.voice=o.tempFilePath,n.isPlays=!1,n.count=0,n.counts=0,n.isPlay=!1,clearInterval(c),n.$forceUpdate(),console.log("that.yuyinInfo:"+JSON.stringify(n.yuyinInfo)),console.log(n.yuyinInfo.voice),console.log(n.yuyinInfo.voiceTime)})),u.onEnded((function(o){n.isPlay=!1})),u.onTimeUpdate((function(o){console.log(u.currentTime),n.counts=n.formatFun(Math.ceil(u.currentTime.toFixed(0)))})),uni.$on("onPopup",(function(o){1==o&&(n.show=!1)}))},methods:{recorderAuthModal:function(){var n=this;uni.showModal({title:"温馨提示",content:"为了麦克风的功能,我们需要申请麦克风权限,请您确认授权,否则无法使用该功能~",cancelText:"关闭",confirmText:"去授权",success:function(o){n.show=!1,o.confirm&&a.default.gotoAppPermissionSetting()}})},requestAndroidPermission:function(n){var o=this;return(0,s.default)((0,i.default)().mark((function e(){var t,s;return(0,i.default)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return t=o,e.next=3,a.default.requestAndroidPermission(n);case 3:s=e.sent,1!=s?t.recorderAuthModal():t.show=!1;case 5:case"end":return e.stop()}}),e)})))()},toDo:function(n){var o=this;if(1==n){if("android"==uni.getSystemInfoSync().platform)return plus.android.checkPermission("android.permission.RECORD_AUDIO",(function(n){-1==n.checkResult?o.show=!0:(o.show=!1,o.yuyinInfo.voice="",o.yuyinInfo.voiceTime=o.formatFun(0),o.yuyinInfo.voiceTimes=0,o.counts=0,o.count=0,o.isRest=!0,o.isPlay1&&(console.log(1111),u.pause(),o.isPlay1=!1))}),(function(n){console.error("Error checking permission:",n.message)})),void o.requestAndroidPermission("android.permission.RECORD_AUDIO");o.counts=0,o.count=0,o.yuyinInfo.voice="",o.yuyinInfo.voiceTime=o.formatFun(0),o.yuyinInfo.voiceTimes=0,o.isRest=!0}else if(2==n)r.stop();else if(3==n)console.log(111,u),u&&console.log(u.src),u.src=o.yuyinInfo.voice,u.play(),o.isPlay=!0,o.isPlay1=!0;else if(4==n)console.log(222,u),o.isPlay=!1,o.isPlay1=!1,u.pause();else if(5==n){if("android"==uni.getSystemInfoSync().platform)return plus.android.checkPermission("android.permission.RECORD_AUDIO",(function(n){-1==n.checkResult?o.show=!0:(o.show=!1,o.yuyinInfo.voice="",o.yuyinInfo.voiceTime=o.formatFun(0),o.isPlays=!0,clearInterval(c),c=setInterval((function(){o.count++,o.yuyinInfo.voiceTime=o.formatFun(o.count)}),1e3),r.start({format:"mp3"}))}),(function(n){console.error("Error checking permission:",n.message)})),void o.requestAndroidPermission("android.permission.RECORD_AUDIO");o.yuyinInfo.voice="",o.yuyinInfo.voiceTime=o.formatFun(0),o.isPlays=!0,clearInterval(c),c=setInterval((function(){o.count++,o.yuyinInfo.voiceTime=o.formatFun(o.count),o.yuyinInfo.voiceTimes=o.count}),1e3),r.start({format:"mp3"})}else 6==n?r.stop():51==n&&uni.uploadFile({url:o.$baseUrl+"/prod-api/api/user/voiceSign",filePath:o.yuyinInfo.voice,name:"file",formData:{userId:uni.getStorageSync("userInfo").id,voiceTime:o.formatFun2(o.yuyinInfo.voiceTime)+1},complete:function(n){if(console.log({userId:uni.getStorageSync("userInfo").id,voiceTime:o.formatFun2(o.yuyinInfo.voiceTime)}),console.log(n),200==n.statusCode){var e=JSON.parse(n.data),t=e.code;e.fileName,e.url,e.msg;200==t?(uni.showToast({title:"上传成功"}),o.isRest=!1,uni.$emit("changVioce",111),setTimeout((function(){uni.navigateBack({delta:1})}),2e3)):uni.showToast({icon:"error",title:"上传失败"})}else uni.showToast({icon:"error",title:"上传失败"})}})},formatFun:function(n){var o,e,t,i;return e=Math.floor(n/3600),t=Math.floor((n-3600*e)/60),i=n-3600*e-60*t,o=(e<=9?"0"+e:e)+":"+(t<=9?"0"+t:t)+":"+(i<=9?"0"+i:i),o},formatFun2:function(n){var o,e,t,i,s=n.split(":");return e=3600*parseInt(s[0]),t=60*parseInt(s[1]),i=parseInt(s[2]),o=e+t+i,o}},destroyed:function(){}};o.default=l},"4b30":function(n,o,e){n.exports=e.p+"static/yuying-02.png"},"80ea":function(n,o,e){var t=e("c86c");o=t(!1),o.push([n.i,'@charset "UTF-8";\n/**\n * 这里是uni-app内置的常用样式变量\n *\n * uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量\n * 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App\n *\n */\n/**\n * 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能\n *\n * 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件\n */\n/* 颜色变量 */\n/* 行为相关颜色 */\n/* 文字基本颜色 */\n/* 背景颜色 */\n/* 边框颜色 */\n/* 尺寸变量 */\n/* 文字尺寸 */\n/* 图片尺寸 */\n/* Border Radius */\n/* 水平间距 */\n/* 垂直间距 */\n/* 透明度 */\n/* 文章场景相关 */uni-page-body[data-v-3892fb4f]{background-color:#fff}body.?%PAGE?%[data-v-3892fb4f]{background-color:#fff}.yuyin .a[data-v-3892fb4f]{margin-top:%?360?%;display:flex;align-items:center;justify-content:center}.yuyin .a .item[data-v-3892fb4f]{flex:1;text-align:center}.yuyin .a .item uni-image[data-v-3892fb4f]{width:%?178?%;height:%?178?%;margin:0 auto}.yuyin .a .item .txt[data-v-3892fb4f]{text-align:center;font-weight:500;font-size:%?30?%;color:#222;margin-top:%?30?%}.yuyin .a .items[data-v-3892fb4f]{flex:1;text-align:center}.yuyin .a .items uni-image[data-v-3892fb4f]{width:%?125?%;height:%?125?%;margin:0 auto}.yuyin .a .items uni-image.img1[data-v-3892fb4f]{display:block}.yuyin .a .items uni-image.img2[data-v-3892fb4f]{display:none}.yuyin .a .items .txt[data-v-3892fb4f]{font-weight:500;font-size:%?24?%;color:#222}',""]),n.exports=o},"858b":function(n,o,e){"use strict";e.d(o,"b",(function(){return i})),e.d(o,"c",(function(){return s})),e.d(o,"a",(function(){return t}));var t={uPopup:e("9f5d").default},i=function(){var n=this,o=n.$createElement,t=n._self._c||o;return t("v-uni-view",{staticClass:"yuyin"},[n.yuyinInfo.voice?t("v-uni-view",{staticClass:"a"},[t("v-uni-view",{staticClass:"items",on:{click:function(o){arguments[0]=o=n.$handleEvent(o),n.toDo(1)}}},[t("v-uni-image",{attrs:{src:"/static/yuying-05.png"}}),t("v-uni-view",{staticClass:"txt"},[n._v("重新录制")])],1),t("v-uni-view",{staticClass:"item"},[0==n.isPlay?t("v-uni-image",{staticClass:"img1",attrs:{src:e("9d3f")},on:{click:function(o){arguments[0]=o=n.$handleEvent(o),n.toDo(3)}}}):t("v-uni-image",{staticClass:"img2",attrs:{src:e("4b30")},on:{click:function(o){arguments[0]=o=n.$handleEvent(o),n.toDo(4)}}}),0==n.isPlay?t("v-uni-view",{staticClass:"txt"},[n._v(n._s(n.counts?n.counts:n.yuyinInfo.voiceTime))]):t("v-uni-view",{staticClass:"txt"},[n._v(n._s(n.counts))])],1),n.isRest?t("v-uni-view",{staticClass:"items",on:{click:function(o){arguments[0]=o=n.$handleEvent(o),n.toDo(51)}}},[t("v-uni-image",{attrs:{src:"/static/yuying-03.png"}}),t("v-uni-view",{staticClass:"txt"},[n._v("保存提交")])],1):t("v-uni-view",{staticClass:"items"})],1):t("v-uni-view",{staticClass:"a"},[t("v-uni-view",{staticClass:"item"},[0==n.isPlays?t("v-uni-image",{staticClass:"img1",attrs:{src:e("9d3f")},on:{click:function(o){arguments[0]=o=n.$handleEvent(o),n.toDo(5)}}}):t("v-uni-image",{staticClass:"img2",attrs:{src:e("4b30")},on:{click:function(o){arguments[0]=o=n.$handleEvent(o),n.toDo(6)}}}),t("v-uni-view",{staticClass:"txt"},[n._v(n._s(n.isPlays?"停止录音":"点击录音"))]),n.isPlays?t("v-uni-view",{staticClass:"txt"},[n._v(n._s(n.yuyinInfo.voiceTime))]):n._e()],1)],1),t("u-popup",{attrs:{mode:"top","mask-close-able":!1,zIndex:5},model:{value:n.show,callback:function(o){n.show=o},expression:"show"}},[t("v-uni-view",{staticClass:"permissions_box"},[n._v("当您使用APP时,为了使用录音的功能,我们需要申请麦克风权限。")])],1)],1)},s=[]},"9d3f":function(n,o,e){n.exports=e.p+"static/yuying-04.png"},af29:function(n,o,e){e("bf0f"),n.exports={judgeIosPermission:function(n){return"location"==n?function(){var n,o=plus.ios.import("CLLocationManager"),e=o.authorizationStatus();return n=2!=e,console.log("定位权限开启:"+n),plus.ios.deleteObject(o),n}():"camera"==n?function(){var n=!1,o=plus.ios.import("AVCaptureDevice"),e=o.authorizationStatusForMediaType("vide");return console.log("authStatus:"+e),3==e?(n=!0,console.log("相机权限已经开启")):console.log("相机权限没有开启"),plus.ios.deleteObject(o),n}():"photoLibrary"==n?function(){var n=!1,o=plus.ios.import("PHPhotoLibrary"),e=o.authorizationStatus();return console.log("authStatus:"+e),3==e?(n=!0,console.log("相册权限已经开启")):console.log("相册权限没有开启"),plus.ios.deleteObject(o),n}():"record"==n?function(){var n=!1,o=plus.ios.import("AVAudioSession"),e=o.sharedInstance(),t=e.recordPermission();return console.log("permissionStatus:"+t),1684369017==t||1970168948==t?console.log("麦克风权限没有开启"):(n=!0,console.log("麦克风权限已经开启")),plus.ios.deleteObject(o),n}():"push"==n?function(){var n=!1,o=plus.ios.import("UIApplication"),e=o.sharedApplication(),t=0;if(e.currentUserNotificationSettings){var i=e.currentUserNotificationSettings();t=i.plusGetAttribute("types"),console.log("enabledTypes1:"+t),0==t?console.log("推送权限没有开启"):(n=!0,console.log("已经开启推送功能!")),plus.ios.deleteObject(i)}else t=e.enabledRemoteNotificationTypes(),0==t?console.log("推送权限没有开启!"):(n=!0,console.log("已经开启推送功能!")),console.log("enabledTypes2:"+t);return plus.ios.deleteObject(e),plus.ios.deleteObject(o),n}():"contact"==n?function(){var n=!1,o=plus.ios.import("CNContactStore"),e=o.authorizationStatusForEntityType(0);return 3==e?(n=!0,console.log("通讯录权限已经开启")):console.log("通讯录权限没有开启"),plus.ios.deleteObject(o),n}():"calendar"==n?function(){var n=!1,o=plus.ios.import("EKEventStore"),e=o.authorizationStatusForEntityType(0);return 3==e?(n=!0,console.log("日历权限已经开启")):console.log("日历权限没有开启"),plus.ios.deleteObject(o),n}():"memo"==n&&function(){var n=!1,o=plus.ios.import("EKEventStore"),e=o.authorizationStatusForEntityType(1);return 3==e?(n=!0,console.log("备忘录权限已经开启")):console.log("备忘录权限没有开启"),plus.ios.deleteObject(o),n}()},requestAndroidPermission:function(n){return new Promise((function(o,e){plus.android.requestPermissions([n],(function(n){console.log(1111,n);for(var e=0,t=0;t