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({
},
// 对话灵感内容
inspirationContent
:
{
type
:
String
type
:
String
,
observer
:
function
(
n
)
{
this
.
setData
({
content
:
n
})
}
}
},
/**
* 组件的初始数据
*/
data
:
{
times
:
0
times
:
0
,
recorder1
:
wx
.
getRecorderManager
(),
recorder2
:
wx
.
getRecorderManager
(),
},
lifetimes
:{
attached
()
{
...
...
@@ -39,7 +44,7 @@ Component({
},
detached
:
function
()
{
this
.
data
.
srStart
=
false
wx
.
getRecorderManager
()
.
stop
()
this
.
data
.
recorder1
.
stop
()
if
(
this
.
data
.
sr
)
{
this
.
data
.
sr
.
shutdown
()
}
else
{
...
...
@@ -61,7 +66,8 @@ Component({
},
onSrStop
:
async
function
()
{
console
.
log
(
'onSrStop'
)
wx
.
getRecorderManager
().
stop
()
this
.
data
.
recorder1
.
stop
()
this
.
data
.
recorder2
.
stop
();
await
sleep
(
500
)
if
(
this
.
data
.
srStart
&&
this
.
data
.
sr
)
{
try
{
...
...
@@ -105,16 +111,23 @@ Component({
console
.
log
(
"start failed:"
+
e
)
return
}
wx
.
getRecorderManager
()
.
start
({
this
.
data
.
recorder1
.
start
({
duration
:
600000
,
numberOfChannels
:
1
,
sampleRate
:
16000
,
format
:
"PCM"
,
frameSize
:
4
})
this
.
data
.
recorder2
.
start
({
duration
:
600000
,
numberOfChannels
:
1
,
sampleRate
:
16000
,
format
:
"mp3"
,
frameSize
:
4
})
},
connectSr
:
async
function
(
options
)
{
wx
.
getRecorderManager
()
.
onFrameRecorded
((
res
)
=>
{
this
.
data
.
recorder1
.
onFrameRecorded
((
res
)
=>
{
if
(
res
.
isLastFrame
)
{
console
.
log
(
"record done"
)
}
...
...
@@ -123,10 +136,23 @@ Component({
this
.
data
.
sr
.
sendAudio
(
res
.
frameBuffer
)
}
})
wx
.
getRecorderManager
()
.
onStart
(()
=>
{
this
.
data
.
recorder1
.
onStart
(()
=>
{
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..."
)
if
(
res
.
tempFilePath
)
{
const
{
isClose
}
=
this
.
data
...
...
@@ -139,7 +165,7 @@ Component({
}
}
})
wx
.
getRecorderManager
()
.
onError
((
res
)
=>
{
this
.
data
.
recorder1
.
onError
((
res
)
=>
{
console
.
log
(
"recording failed:"
+
res
)
})
try
{
...
...
@@ -216,7 +242,7 @@ Component({
this
.
onSrStart
()
})
},
3
00
)
},
10
00
)
},
1500
),
onClose
()
{
this
.
setData
({
...
...
packageEquity/pages/aiCheck/components/SpeechPopup/SpeechPopup.wxml
View file @
ffee4d1
<!--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 wx:if="{{
inspirationC
ontent}}">对话灵感</view> -->
<view wx:if="{{
c
ontent}}">对话灵感</view> -->
<!-- <view class="inspiration-title-icon" bindtap="openInspiration">
<gl-image class="inspiration-icon" src="/aiCheck/inspiration-icon.png"></gl-image>
对话灵感
</view> -->
<!-- <view class="inspiration-title-description">用自己的话说出来效果更佳~</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">
<view class="content">{{
inspirationC
ontent}}</view>
<view class="content">{{
c
ontent}}</view>
</scroll-view>
<!-- <block wx:else>
<view class="first loadding"></view>
<view class="second loadding"></view>
<view class="third loadding"></view>
</block>
<view wx:if="{{!
inspirationC
ontent}}" class="loadding-text">对话灵感生成中...</view> -->
<view wx:if="{{!
c
ontent}}" class="loadding-text">对话灵感生成中...</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-item" wx:for="{{36}}">
</view>
...
...
packageEquity/pages/aiCheck/result/result.js
View file @
ffee4d1
...
...
@@ -71,6 +71,7 @@ Page({
wx
.
navigateBack
({
delta
:
1
,
});
prevPage
.
setData
({
tabIndex
:
1
})
}
else
{
wx
.
navigateBack
({
delta
:
2
,
...
...
packageEquity/pages/aiCheck/start/start.js
View file @
ffee4d1
...
...
@@ -67,7 +67,6 @@ console.log(wx.$util.getUserInfo(), '==============')
* 生命周期函数--监听页面显示
*/
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