Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
水玉婷
ai-wechat
Commits
00898816
Commit
00898816
authored
Mar 09, 2026
by
水玉婷
Browse files
feat:移除麦克风检查,并添加调试工具
parent
20c5890a
Changes
2
Hide whitespace changes
Inline
Side-by-side
index.html
View file @
00898816
...
@@ -11,5 +11,18 @@
...
@@ -11,5 +11,18 @@
<body>
<body>
<div id="app"></div>
<div id="app"></div>
<script type="module" src="/src/main.js"></script>
<script type="module" src="/src/main.js"></script>
<!-- 根据环境加载eruda.js -->
<script>
var env = window.location.href;
if (env.indexOf('//xc.cmic.com.cn') === -1) {
var script = document.createElement('script');
script.type = 'module';
script.src = 'https://lib.baomitu.com/eruda/2.4.1/eruda.min.js';
document.getElementsByTagName('head')[0].appendChild(script);
script.onload = function () {
window.eruda.init();
}
}
</script>
</body>
</body>
</html>
</html>
\ No newline at end of file
src/views/components/VoiceRecognitionText.vue
View file @
00898816
...
@@ -259,6 +259,7 @@ const isMediaRecorderSupported = () => {
...
@@ -259,6 +259,7 @@ const isMediaRecorderSupported = () => {
const
checkMicrophonePermission
=
async
()
=>
{
const
checkMicrophonePermission
=
async
()
=>
{
try
{
try
{
const
permissionStatus
=
await
navigator
.
permissions
.
query
({
name
:
'
microphone
'
as
PermissionName
}
);
const
permissionStatus
=
await
navigator
.
permissions
.
query
({
name
:
'
microphone
'
as
PermissionName
}
);
console
.
log
(
'
麦克风权限查询结果:
'
,
permissionStatus
);
if
(
props
.
debug
)
{
if
(
props
.
debug
)
{
console
.
log
(
'
麦克风权限状态:
'
,
permissionStatus
.
state
);
console
.
log
(
'
麦克风权限状态:
'
,
permissionStatus
.
state
);
...
@@ -282,12 +283,12 @@ const startRecording = async () => {
...
@@ -282,12 +283,12 @@ const startRecording = async () => {
if
(
props
.
disabled
||
isRecording
.
value
||
!
isFullScreen
.
value
)
return
if
(
props
.
disabled
||
isRecording
.
value
||
!
isFullScreen
.
value
)
return
// 检查权限
// 检查权限
const
hasPermission
=
await
checkMicrophonePermission
();
//
const hasPermission = await checkMicrophonePermission();
if
(
!
hasPermission
)
{
//
if (!hasPermission)
{
emit
(
'
error
'
,
'
麦克风权限被拒绝
'
);
//
emit('error', '麦克风权限被拒绝');
exitFullScreen
();
//
exitFullScreen();
return
;
//
return;
}
//
}
// 检查浏览器支持
// 检查浏览器支持
if
(
!
isMediaRecorderSupported
())
{
if
(
!
isMediaRecorderSupported
())
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment