Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas_plus
/
dj-car-boutique-work-wechat
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
1
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit ffee4d1a
authored
May 22, 2024
by
前端
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fixed
1 parent
d9e1b533
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
43 additions
and
17 deletions
packageEquity/pages/aiCheck/components/SpeechPopup/SpeechPopup.js
packageEquity/pages/aiCheck/components/SpeechPopup/SpeechPopup.wxml
packageEquity/pages/aiCheck/result/result.js
packageEquity/pages/aiCheck/start/start.js
packageEquity/pages/aiCheck/components/SpeechPopup/SpeechPopup.js
View file @
ffee4d1
...
@@ -23,14 +23,19 @@ Component({
...
@@ -23,14 +23,19 @@ Component({
},
},
// 对话灵感内容
// 对话灵感内容
inspirationContent
:
{
inspirationContent
:
{
type
:
String
type
:
String
,
observer
:
function
(
n
)
{
this
.
setData
({
content
:
n
})
}
}
}
},
},
/**
/**
* 组件的初始数据
* 组件的初始数据
*/
*/
data
:
{
data
:
{
times
:
0
times
:
0
,
recorder1
:
wx
.
getRecorderManager
(),
recorder2
:
wx
.
getRecorderManager
(),
},
},
lifetimes
:{
lifetimes
:{
attached
()
{
attached
()
{
...
@@ -39,7 +44,7 @@ Component({
...
@@ -39,7 +44,7 @@ Component({
},
},
detached
:
function
()
{
detached
:
function
()
{
this
.
data
.
srStart
=
false
this
.
data
.
srStart
=
false
wx
.
getRecorderManager
()
.
stop
()
this
.
data
.
recorder1
.
stop
()
if
(
this
.
data
.
sr
)
{
if
(
this
.
data
.
sr
)
{
this
.
data
.
sr
.
shutdown
()
this
.
data
.
sr
.
shutdown
()
}
else
{
}
else
{
...
@@ -61,7 +66,8 @@ Component({
...
@@ -61,7 +66,8 @@ Component({
},
},
onSrStop
:
async
function
()
{
onSrStop
:
async
function
()
{
console
.
log
(
'onSrStop'
)
console
.
log
(
'onSrStop'
)
wx
.
getRecorderManager
().
stop
()
this
.
data
.
recorder1
.
stop
()
this
.
data
.
recorder2
.
stop
();
await
sleep
(
500
)
await
sleep
(
500
)
if
(
this
.
data
.
srStart
&&
this
.
data
.
sr
)
{
if
(
this
.
data
.
srStart
&&
this
.
data
.
sr
)
{
try
{
try
{
...
@@ -105,16 +111,23 @@ Component({
...
@@ -105,16 +111,23 @@ Component({
console
.
log
(
"start failed:"
+
e
)
console
.
log
(
"start failed:"
+
e
)
return
return
}
}
wx
.
getRecorderManager
()
.
start
({
this
.
data
.
recorder1
.
start
({
duration
:
600000
,
duration
:
600000
,
numberOfChannels
:
1
,
numberOfChannels
:
1
,
sampleRate
:
16000
,
sampleRate
:
16000
,
format
:
"PCM"
,
format
:
"PCM"
,
frameSize
:
4
frameSize
:
4
})
})
this
.
data
.
recorder2
.
start
({
duration
:
600000
,
numberOfChannels
:
1
,
sampleRate
:
16000
,
format
:
"mp3"
,
frameSize
:
4
})
},
},
connectSr
:
async
function
(
options
)
{
connectSr
:
async
function
(
options
)
{
wx
.
getRecorderManager
()
.
onFrameRecorded
((
res
)
=>
{
this
.
data
.
recorder1
.
onFrameRecorded
((
res
)
=>
{
if
(
res
.
isLastFrame
)
{
if
(
res
.
isLastFrame
)
{
console
.
log
(
"record done"
)
console
.
log
(
"record done"
)
}
}
...
@@ -123,10 +136,23 @@ Component({
...
@@ -123,10 +136,23 @@ Component({
this
.
data
.
sr
.
sendAudio
(
res
.
frameBuffer
)
this
.
data
.
sr
.
sendAudio
(
res
.
frameBuffer
)
}
}
})
})
wx
.
getRecorderManager
()
.
onStart
(()
=>
{
this
.
data
.
recorder1
.
onStart
(()
=>
{
console
.
log
(
"start recording..."
)
console
.
log
(
"start recording..."
)
})
})
wx
.
getRecorderManager
().
onStop
((
res
)
=>
{
this
.
data
.
recorder2
.
onStop
((
res
)
=>
{
console
.
log
(
res
.
tempFilePath
)
// if (res.tempFilePath) {
// const {isClose} = this.data
// if(isClose) {
// wx.removeSavedFile({
// filePath: res.tempFilePath
// })
// }else {
// this.setData({filePath:res.tempFilePath})
// }
// }
})
this
.
data
.
recorder1
.
onStop
((
res
)
=>
{
console
.
log
(
"stop recording..."
)
console
.
log
(
"stop recording..."
)
if
(
res
.
tempFilePath
)
{
if
(
res
.
tempFilePath
)
{
const
{
isClose
}
=
this
.
data
const
{
isClose
}
=
this
.
data
...
@@ -139,7 +165,7 @@ Component({
...
@@ -139,7 +165,7 @@ Component({
}
}
}
}
})
})
wx
.
getRecorderManager
()
.
onError
((
res
)
=>
{
this
.
data
.
recorder1
.
onError
((
res
)
=>
{
console
.
log
(
"recording failed:"
+
res
)
console
.
log
(
"recording failed:"
+
res
)
})
})
try
{
try
{
...
@@ -216,7 +242,7 @@ Component({
...
@@ -216,7 +242,7 @@ Component({
this
.
onSrStart
()
this
.
onSrStart
()
})
})
},
3
00
)
},
10
00
)
},
1500
),
},
1500
),
onClose
()
{
onClose
()
{
this
.
setData
({
this
.
setData
({
...
...
packageEquity/pages/aiCheck/components/SpeechPopup/SpeechPopup.wxml
View file @
ffee4d1
<!--packageEquity/pages/aiCheck/components/SpeechPopup/SpeechPopup.wxml-->
<!--packageEquity/pages/aiCheck/components/SpeechPopup/SpeechPopup.wxml-->
<pop-up class="speech-popup" title="{{
inspirationContent?'对话灵感':'正在录音'}}" show="{{show}}" height="{{inspirationC
ontent ? '850rpx':'530rpx'}}" bindcancel="onClose">
<pop-up class="speech-popup" title="{{
content?'对话灵感':'正在录音'}}" show="{{show}}" height="{{c
ontent ? '850rpx':'530rpx'}}" bindcancel="onClose">
<!-- <view class="inspiration-title">
<!-- <view class="inspiration-title">
<view wx:if="{{
inspirationC
ontent}}">对话灵感</view> -->
<view wx:if="{{
c
ontent}}">对话灵感</view> -->
<!-- <view class="inspiration-title-icon" bindtap="openInspiration">
<!-- <view class="inspiration-title-icon" bindtap="openInspiration">
<gl-image class="inspiration-icon" src="/aiCheck/inspiration-icon.png"></gl-image>
<gl-image class="inspiration-icon" src="/aiCheck/inspiration-icon.png"></gl-image>
对话灵感
对话灵感
</view> -->
</view> -->
<!-- <view class="inspiration-title-description">用自己的话说出来效果更佳~</view> -->
<!-- <view class="inspiration-title-description">用自己的话说出来效果更佳~</view> -->
<!-- </view> -->
<!-- </view> -->
<view class="inspiration-content" wx:if="{{
inspirationC
ontent}}">
<view class="inspiration-content" wx:if="{{
c
ontent}}">
<scroll-view scroll-y class="inspiration-scroll">
<scroll-view scroll-y class="inspiration-scroll">
<view class="content">{{
inspirationC
ontent}}</view>
<view class="content">{{
c
ontent}}</view>
</scroll-view>
</scroll-view>
<!-- <block wx:else>
<!-- <block wx:else>
<view class="first loadding"></view>
<view class="first loadding"></view>
<view class="second loadding"></view>
<view class="second loadding"></view>
<view class="third loadding"></view>
<view class="third loadding"></view>
</block>
</block>
<view wx:if="{{!
inspirationC
ontent}}" class="loadding-text">对话灵感生成中...</view> -->
<view wx:if="{{!
c
ontent}}" class="loadding-text">对话灵感生成中...</view> -->
</view>
</view>
<view class="inspiration-line" wx:if="{{
inspirationC
ontent}}">用自己的话说出来效果更佳</view>
<view class="inspiration-line" wx:if="{{
c
ontent}}">用自己的话说出来效果更佳</view>
<view class="loading-box">
<view class="loading-box">
<view class="loading-item" wx:for="{{36}}">
<view class="loading-item" wx:for="{{36}}">
</view>
</view>
...
...
packageEquity/pages/aiCheck/result/result.js
View file @
ffee4d1
...
@@ -71,6 +71,7 @@ Page({
...
@@ -71,6 +71,7 @@ Page({
wx
.
navigateBack
({
wx
.
navigateBack
({
delta
:
1
,
delta
:
1
,
});
});
prevPage
.
setData
({
tabIndex
:
1
})
}
else
{
}
else
{
wx
.
navigateBack
({
wx
.
navigateBack
({
delta
:
2
,
delta
:
2
,
...
...
packageEquity/pages/aiCheck/start/start.js
View file @
ffee4d1
...
@@ -67,7 +67,6 @@ console.log(wx.$util.getUserInfo(), '==============')
...
@@ -67,7 +67,6 @@ console.log(wx.$util.getUserInfo(), '==============')
* 生命周期函数--监听页面显示
* 生命周期函数--监听页面显示
*/
*/
onShow
()
{
onShow
()
{
this
.
setData
({
tabIndex
:
1
})
},
},
/**
/**
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment