修复部分已知问题

This commit is contained in:
2025-11-22 16:38:36 +08:00
parent 2878783349
commit 7487be2bb5
8 changed files with 216 additions and 43 deletions

View File

@@ -1,4 +1,3 @@
import React, { useState, useEffect, useRef } from 'react';
import { geminiService, decodeAudioData } from '../services/geminiService';
import AudioRecorder from '../components/AudioRecorder';
@@ -190,13 +189,13 @@ const SpeakingPracticeView: React.FC<SpeakingPracticeViewProps> = ({ language })
<circle cx="56" cy="56" r="48" stroke="currentColor" strokeWidth="8" fill="transparent" className="text-slate-100" />
<circle cx="56" cy="56" r="48" stroke="currentColor" strokeWidth="8" fill="transparent"
strokeDasharray={301.6}
strokeDashoffset={301.6 - (301.6 * feedback.score) / 100}
strokeDashoffset={301.6 - (301.6 * (feedback.score || 0)) / 100}
strokeLinecap="round"
className={`${feedback.score > 80 ? 'text-green-500' : feedback.score > 60 ? 'text-amber-500' : 'text-red-500'} transition-all duration-1000 ease-out`}
className={`${(feedback.score || 0) > 80 ? 'text-green-500' : (feedback.score || 0) > 60 ? 'text-amber-500' : 'text-red-500'} transition-all duration-1000 ease-out`}
/>
</svg>
<div className="absolute flex flex-col items-center animate-scale-in">
<span className="text-3xl font-black text-slate-800">{feedback.score}</span>
<span className="text-3xl font-black text-slate-800">{feedback.score || 0}</span>
</div>
</div>
<span className="text-xs font-bold text-slate-400 uppercase tracking-widest">{t.score}</span>
@@ -207,7 +206,7 @@ const SpeakingPracticeView: React.FC<SpeakingPracticeViewProps> = ({ language })
<h4 className="text-xs font-bold text-slate-400 mb-4 uppercase tracking-wider flex items-center gap-2">
<AlertCircle size={14} className="text-red-500" /> {t.toImprove}
</h4>
{feedback.pronunciationIssues.length > 0 ? (
{feedback.pronunciationIssues && feedback.pronunciationIssues.length > 0 ? (
<ul className="space-y-2">
{feedback.pronunciationIssues.map((issue, i) => (
<li key={i} className="text-sm text-slate-700 bg-red-50/50 p-3 rounded-lg border border-red-100 flex items-start gap-2">
@@ -394,4 +393,4 @@ const SpeakingPracticeView: React.FC<SpeakingPracticeViewProps> = ({ language })
);
};
export default SpeakingPracticeView;
export default SpeakingPracticeView;