Преглед изворни кода

1、智能问答页面优化

liyanbo пре 7 месеци
родитељ
комит
fb3476e0aa
1 измењених фајлова са 7 додато и 11 уклоњено
  1. 7 11
      src/components/ai/text/TextToText.vue

+ 7 - 11
src/components/ai/text/TextToText.vue

@@ -162,12 +162,6 @@ const personIntroduce = ref(props.personIntroduce);
 
 // 渲染实验室携带的人物形象图片
 const selectedImage = ref("");
-onMounted(() => {
-  const image = route.query.image;
-  if (image) {
-    selectedImage.value = image;
-  }
-});
 
 // 聊天对话
 const activeConversationModelPath = ref(null); // 选中的对话编号
@@ -361,10 +355,6 @@ const onCompositionend = () => {
 const gradeId = ref("");
 // 添加消息计数器变量
 const messageCount = ref(0);
-onMounted(() => {
-  // 从全局状态初始化年级ID
-  gradeId.value = globalState.initGradeId();
-});
 
 /** 真正执行【发送】消息操作 */
 const doSendMessage = async (content) => {
@@ -625,9 +615,13 @@ watch(
 /** 初始化 **/
 onMounted(async () => {
 
+  // 从全局状态初始化年级ID
+  gradeId.value = globalState.initGradeId();
+
   //默认加载没传递数字人表示的话---默认加载小智
   if (!personId.value) {
-    const grade = route.query.grade || localStorage.getItem('selectedGrade')
+    let grade = route.query.grade || localStorage.getItem('selectedGrade')
+    grade = "小学低年级"
     // 获取小学低年级AI数据
     const juniorAIRes = await teacherList({category: grade + 'AI'})
     const aiPerson = juniorAIRes.data.list.find(
@@ -638,6 +632,8 @@ onMounted(async () => {
       personName.value = aiPerson.name;
       personImage.value = aiPerson.model2dPath;
       personIntroduce.value = aiPerson.systemMessage;
+
+      selectedImage.value = personImage.value;
     }
   }