From 079db900212bd1db52076e44e499ae37e31e4e7a Mon Sep 17 00:00:00 2001 From: wangyifeng <812766448@qq.com> Date: Tue, 3 Jun 2025 15:30:33 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=AF=AD=E9=9F=B3=E8=BE=93?= =?UTF-8?q?=E5=85=A5=E5=8A=9F=E8=83=BD=E6=9D=83=E9=99=90=E6=A0=A1=E9=AA=8C?= =?UTF-8?q?=E5=8F=8A=E6=9C=AA=E6=8E=88=E6=9D=83=E5=A4=84=E7=90=86=EF=BC=9B?= =?UTF-8?q?=E6=AD=A3=E5=BC=8F=E7=8E=AF=E5=A2=83=E5=BC=80=E6=94=BE2?= =?UTF-8?q?=E4=B8=AA=E8=B4=A6=E5=8F=B7=E7=94=A8=E4=BA=8E=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- env/.env.test | 11 +++- src/pages/dialog/index.vue | 23 ++++++-- .../components/all-speech/all-speech.vue | 56 +++++++++++++------ 3 files changed, 64 insertions(+), 26 deletions(-) diff --git a/env/.env.test b/env/.env.test index dfe98c6..d6e39a6 100644 --- a/env/.env.test +++ b/env/.env.test @@ -4,9 +4,16 @@ NODE_ENV = 'test' VITE_SHOW_CONSOLE = true # 是否开启sourcemap VITE_SHOW_SOURCEMAP = true -# baseUrl + +# # baseUrl VITE_BASEURL = 'http://172.16.100.93:8503' -#VITE_SOCKET_API +# #VITE_SOCKET_API VITE_SOCKET_API = 'ws://172.16.100.93:8504' + +# baseUrl +# VITE_BASEURL = 'http://192.168.88.21:9503' +#VITE_SOCKET_API +# VITE_SOCKET_API = 'ws://192.168.88.21:9504' + # EPRAPI baseUrl VITE_EPR_BASEURL = 'http://114.218.158.24:9020' diff --git a/src/pages/dialog/index.vue b/src/pages/dialog/index.vue index 93f3a6e..7282cf8 100644 --- a/src/pages/dialog/index.vue +++ b/src/pages/dialog/index.vue @@ -219,7 +219,14 @@ --> -
+
{{ item.voiceContent }}
@@ -290,13 +297,17 @@
- + v-if=" + userStore.mobile === '13580848136' || + userStore.mobile === '18100591363' + " + >
{ //切换键盘输入/语音输入 const changeEditorMode = () => { state.value.isUseSpeech = !state.value.isUseSpeech - if(state.value.isUseSpeech){ + if (state.value.isUseSpeech) { //如果切换为语音输入,则删除引用 state.value.quoteInfo = null } @@ -1449,7 +1460,7 @@ const multipleChoose = (item) => { const actionCite = (item) => { console.log('引用') - if(state.value.isUseSpeech){ + if (state.value.isUseSpeech) { state.value.isUseSpeech = false } state.value.quoteInfo = item diff --git a/src/uni_modules/all-speech/components/all-speech/all-speech.vue b/src/uni_modules/all-speech/components/all-speech/all-speech.vue index cbf2d8f..fe45f61 100644 --- a/src/uni_modules/all-speech/components/all-speech/all-speech.vue +++ b/src/uni_modules/all-speech/components/all-speech/all-speech.vue @@ -105,7 +105,11 @@ src="@/static/image/record/chat-voice-cancel-blue.png" > - + {{ $t('release_hand_to_cancel') }} @@ -271,13 +275,14 @@ export default { startTouchData: {}, popupHeight: '0px', // 这是初始的高度 recording: true, // 录音中 - recordPopupShow: false,//是否显示录音弹窗 + recordPopupShow: false, //是否显示录音弹窗 recordTimeout: null, // 录音定时器 recordAnimationAreaCancelBg: recordCancelBg, //录音动画区域取消时背景 permissionInfo: '', //当前请求的权限 nearTimeLimit: false, //是否录音将超时 autoStopRecordCountDown: 0, //自动停止录音倒计时 autoStopRecordInterval: null, //自动停止录音技术定时器 + permisionState: false, //权限授权状态 } }, mounted() { @@ -330,12 +335,32 @@ export default { upx2px(upx) { return uni.upx2px(upx) + 'px' }, - handleAppMicro() { + handleAppMicro(permissionStatus) { let that = this - setTimeout(function () { - that.$refs.requestPer.hideCustomPermission() - }, 1000) - that.continueAppMicro() + // setTimeout(function () { + // that.$refs.requestPer.hideCustomPermission() + // }, 1000) + if (Number(permissionStatus) === 1) { + that.continueAppMicro() + } else if (Number(permissionStatus) === -1) { + uni.showModal({ + title: '提示', + content: '检测到您还未授权麦克风哦', + showCancel: true, + confirmText: '去授权', + cancelText: '保持拒绝', + success: ({ confirm, cancel }) => { + if (confirm) { + let OAWebView = plus.webview.all() + OAWebView.forEach((webview, index) => { + if (webview.id === 'webviewId1') { + webview.evalJS(`handleRequestAndroidPermission('settings')`) + } + }) + } + }, + }) + } }, handleRequestPer(permissionInfo, permissionID) { console.log(permissionInfo) @@ -365,8 +390,6 @@ export default { if (isUserNotAllow) { //用户拒绝了录音权限 //这里你应当编写代码进行引导用户给录音权限,不同平台分别进行编写 - } else { - message.error('似乎没检测到您的麦克风哦') } console.error('请求录音权限失败:' + msg) }, @@ -410,14 +433,11 @@ export default { // #endif // #ifdef H5 if (typeof plus !== 'undefined') { - webUni.postMessage({ - data: { - action: 'handleRequestAndroidPermission', - params: { - type: 'micro', - key: that.field, - }, - }, + let OAWebView = plus.webview.all() + OAWebView.forEach((webview, index) => { + if (webview.id === 'webviewId1') { + webview.evalJS(`handleRequestAndroidPermission('micro')`) + } }) } else { that.continueAppMicro() @@ -622,7 +642,7 @@ export default { font-weight: 500; color: #1a1a1a; box-sizing: border-box; - text{ + text { font-size: 30rpx; font-weight: 600; line-height: 1;