|
|
@@ -70,7 +70,7 @@
|
|
|
:value="voice.code"
|
|
|
>
|
|
|
<div style="display: flex; align-items: center;">
|
|
|
- <el-avatar :src="voice.avatar" size="small" style="margin-right: 10px;"></el-avatar>
|
|
|
+ <el-avatar :src="voice.avatar || voiceOptions[0]?.avatar" size="small" style="margin-right: 10px;"></el-avatar>
|
|
|
<span>{{ voice.name }}</span>
|
|
|
<el-button
|
|
|
@click.stop="toggleAudio(voice)"
|
|
|
@@ -112,7 +112,7 @@
|
|
|
}"
|
|
|
>
|
|
|
<el-avatar
|
|
|
- :src="message.sender === 'user' ? userAvatar : (message.voiceCode !== null ? voiceOptions[message.voiceCode].avatar : voiceOptions[voiceCode].avatar)"
|
|
|
+ :src="message.sender === 'user' ? userAvatar : getAvatar(message.voiceCode)"
|
|
|
size="small"
|
|
|
style="flex-shrink:0"
|
|
|
shape="circle"
|
|
|
@@ -766,6 +766,22 @@ const saveHomework = async () => {
|
|
|
}
|
|
|
};
|
|
|
|
|
|
+// 安全的头像获取方法
|
|
|
+const getAvatar = (voiceCode) => {
|
|
|
+ if (voiceCode === null || voiceCode === undefined) {
|
|
|
+ return voiceOptions.value[0]?.avatar || userAvatar;
|
|
|
+ }
|
|
|
+ return voiceOptions.value[voiceCode]?.avatar || voiceOptions.value[0]?.avatar || gavinAvatar;
|
|
|
+};
|
|
|
+
|
|
|
+// 安全的语音选项获取方法
|
|
|
+const getVoiceOption = (voiceCode) => {
|
|
|
+ if (voiceCode === null || voiceCode === undefined) {
|
|
|
+ return voiceOptions.value[0];
|
|
|
+ }
|
|
|
+ return voiceOptions.value[voiceCode] || voiceOptions.value[0];
|
|
|
+};
|
|
|
+
|
|
|
// 文档预览相关
|
|
|
const open = ref(false)
|
|
|
const alertProps = reactive({
|