fix code
This commit is contained in:
@@ -130,7 +130,6 @@ interface IPageData {
|
||||
isWordEmptyResult: boolean,
|
||||
recordPermissionGranted: boolean
|
||||
loadingMaskVisible: boolean,
|
||||
bottomLocked: boolean,
|
||||
standardAudioLocalMap: { [key: string]: string }, // 标准语音文件ID映射
|
||||
assessmentAudioLocalMap: { [key: string]: string } // 评估语音文件ID映射
|
||||
}
|
||||
@@ -274,7 +273,6 @@ Page<IPageData, IPageInstance>({
|
||||
isMoreMenuClosing: false,
|
||||
recordPermissionGranted: false,
|
||||
loadingMaskVisible: false,
|
||||
bottomLocked: false,
|
||||
},
|
||||
|
||||
onMicHighlight() {
|
||||
@@ -544,12 +542,12 @@ Page<IPageData, IPageInstance>({
|
||||
}
|
||||
|
||||
recorderManager.stop()
|
||||
this.setData({ isRecording: false })
|
||||
// this.setData({ isRecording: false })
|
||||
},
|
||||
|
||||
// 长按开始录音
|
||||
handleRecordStart() {
|
||||
if (this.data.bottomLocked) return
|
||||
if (this.data.isRecording) return
|
||||
this.startRecording()
|
||||
try { this.onMicHighlight() } catch (e) {}
|
||||
},
|
||||
@@ -612,7 +610,7 @@ Page<IPageData, IPageInstance>({
|
||||
|
||||
// 播放标准语音
|
||||
playStandardVoice() {
|
||||
if (this.data.bottomLocked || this.data.isRecording) return
|
||||
if (this.data.isRecording) return
|
||||
const { currentSentence, standardAudioMap, isPlaying } = this.data
|
||||
const audioUrl = standardAudioMap[currentSentence.id]
|
||||
|
||||
@@ -778,7 +776,7 @@ Page<IPageData, IPageInstance>({
|
||||
|
||||
// 新增:播放评分结果音频(使用当前句子的 file_id)
|
||||
playAssessmentVoice() {
|
||||
if (this.data.bottomLocked || this.data.isRecording) return
|
||||
if (this.data.isRecording) return
|
||||
const { currentSentence, isPlaying } = this.data
|
||||
const fileId = currentSentence?.file_id
|
||||
|
||||
@@ -1266,6 +1264,7 @@ Page<IPageData, IPageInstance>({
|
||||
completenessScore: pronCompletion >= 0 ? Number(pronCompletion.toFixed(2)) : 0,
|
||||
fluencyScore: pronFluency >= 0 ? Number(pronFluency.toFixed(2)) : 0,
|
||||
wordScores,
|
||||
isRecording: false,
|
||||
overlayVisible: false,
|
||||
highlightShow: false,
|
||||
highlightZoom: false,
|
||||
@@ -1280,6 +1279,7 @@ Page<IPageData, IPageInstance>({
|
||||
}).catch(err => {
|
||||
console.error('获取评估结果失败:', err)
|
||||
this.setData({
|
||||
isRecording: false,
|
||||
overlayVisible: false,
|
||||
highlightShow: false,
|
||||
highlightZoom: false,
|
||||
@@ -1293,6 +1293,7 @@ Page<IPageData, IPageInstance>({
|
||||
}).catch(err => {
|
||||
console.error('上传录音失败:', err)
|
||||
this.setData({
|
||||
isRecording: false,
|
||||
overlayVisible: false,
|
||||
highlightShow: false,
|
||||
highlightZoom: false,
|
||||
@@ -1307,6 +1308,7 @@ Page<IPageData, IPageInstance>({
|
||||
},
|
||||
fail: () => {
|
||||
this.setData({
|
||||
isRecording: false,
|
||||
overlayVisible: false,
|
||||
highlightShow: false,
|
||||
highlightZoom: false,
|
||||
@@ -1318,6 +1320,7 @@ Page<IPageData, IPageInstance>({
|
||||
})
|
||||
} else {
|
||||
this.setData({
|
||||
isRecording: false,
|
||||
overlayVisible: false,
|
||||
highlightShow: false,
|
||||
highlightZoom: false,
|
||||
@@ -1335,7 +1338,7 @@ Page<IPageData, IPageInstance>({
|
||||
recorderManager.onError((res) => {
|
||||
wx.showToast({ title: '录音失败', icon: 'none' })
|
||||
// 录音出错时淡出高亮层
|
||||
this.setData({ overlayVisible: false })
|
||||
this.setData({ overlayVisible: false, isRecording: false })
|
||||
const timer = setTimeout(() => {
|
||||
this.setData({ highlightShow: false, highlightZoom: false, focusTransform: '', highlightWords: [] })
|
||||
clearTimeout(timer)
|
||||
@@ -1534,7 +1537,7 @@ Page<IPageData, IPageInstance>({
|
||||
},
|
||||
|
||||
onScoreTap() {
|
||||
if (this.data.bottomLocked || this.data.isRecording) return
|
||||
if (this.data.isRecording) return
|
||||
console.log('Score button tapped')
|
||||
// 当当前选中例句无评分信息时,不响应点击
|
||||
if (!this.data.hasScoreInfo) {
|
||||
@@ -1573,7 +1576,7 @@ Page<IPageData, IPageInstance>({
|
||||
})
|
||||
},
|
||||
onTransTap() {
|
||||
if (this.data.bottomLocked || this.data.isRecording) return
|
||||
if (this.data.isRecording) return
|
||||
console.log('User button tapped')
|
||||
// Cycle through translation display modes
|
||||
const currentMode = this.data.transDisplayMode
|
||||
@@ -1708,7 +1711,7 @@ Page<IPageData, IPageInstance>({
|
||||
},
|
||||
|
||||
onMoreTap() {
|
||||
if (this.data.bottomLocked || this.data.isRecording) return
|
||||
if (this.data.isRecording) return
|
||||
const { isMoreMenuOpen } = this.data
|
||||
if (!isMoreMenuOpen) {
|
||||
this.setData({ isMoreMenuOpen: true, isMoreMenuClosing: false })
|
||||
|
||||
@@ -43,20 +43,20 @@
|
||||
<view wx:if="{{isMoreMenuOpen}}" class="more-menu-modal"></view>
|
||||
<view class="button-row">
|
||||
<t-icon name="{{isPlaying ? 'pause' : 'play'}}" class="bottom-button {{isRecording ? 'disabled' : ''}}" size="48rpx" bind:tap="playStandardVoice" />
|
||||
<view class="bottom-button-img-wrap bottom-button {{isRecording ? 'disabled' : ''}} {{bottomLocked ? 'disabled' : ''}}" bind:tap="onTransTap">
|
||||
<view class="bottom-button-img-wrap bottom-button {{isRecording ? 'disabled' : ''}}" bind:tap="onTransTap">
|
||||
<t-icon name="translate" class="trans-button left-half {{transDisplayMode === 'en_ipa' ? 'trans-active' : 'trans-deactive'}}" size="48rpx" />
|
||||
<t-icon name="translate" class="trans-button right-half {{transDisplayMode === 'en_zh' ? 'trans-active' : 'trans-deactive'}}" size="48rpx" />
|
||||
</view>
|
||||
<view class="bottom-button mic-wrap {{bottomLocked ? 'disabled' : ''}}" bind:longpress="handleRecordStart" bind:touchend="handleRecordEnd" bind:touchcancel="handleRecordEnd" >
|
||||
<view class="bottom-button mic-wrap" bind:longpress="handleRecordStart" bind:touchend="handleRecordEnd" bind:touchcancel="handleRecordEnd" >
|
||||
<t-icon name="microphone-1" color="{{isRecording ? '#FFFFFF' : '#333333'}}"
|
||||
class="microphone {{isRecording ? 'recording' : 'bottom-button'}} {{recordPermissionGranted ? '' : 'disabled'}}" size="48rpx" />
|
||||
<view wx:if="{{isRecording}}" class="mic">
|
||||
<view class="mic-shadow"></view>
|
||||
</view>
|
||||
</view>
|
||||
<t-icon name="fact-check" class="bottom-button {{(hasScoreInfo && !isRecording && !bottomLocked) ? '' : 'disabled'}}" size="48rpx" bind:tap="onScoreTap" />
|
||||
<t-icon name="fact-check" class="bottom-button {{(hasScoreInfo && !isRecording) ? '' : 'disabled'}}" size="48rpx" bind:tap="onScoreTap" />
|
||||
<!-- <t-icon name="ellipsis" class="bottom-button {{isMoreMenuOpen ? 'more-open' : ''}}" size="48rpx" bind:tap="onMoreTap" /> -->
|
||||
<view class="bottom-button {{isRecording ? 'disabled' : ''}} {{bottomLocked ? 'disabled' : ''}}" bindtap="onMoreTap">
|
||||
<view class="bottom-button {{isRecording ? 'disabled' : ''}} " bindtap="onMoreTap">
|
||||
<view class="ul {{isMoreMenuOpen ? 'active' : ''}}">
|
||||
<view class="dot1"></view>
|
||||
<view class="dot2"></view>
|
||||
|
||||
Reference in New Issue
Block a user