Quellcode durchsuchen

fix(Student): 修复代码格式问题和字符串拼接逻辑

- 调整代码缩进和换行格式以提高可读性
- 修复字符串拼接中的空格问题
- 优化条件判断中的变量处理
SanHQin vor 9 Stunden
Ursprung
Commit
40bc399230
1 geänderte Dateien mit 58 neuen und 43 gelöschten Zeilen
  1. 58 43
      src/views/Student/components/choiceQuestionDetailDialog.vue

+ 58 - 43
src/views/Student/components/choiceQuestionDetailDialog.vue

@@ -17,7 +17,8 @@
           }}</div>
           }}</div>
           <div class="c_t45_msg">
           <div class="c_t45_msg">
             <div>{{ lang.ssAnswerCount }} {{ props.showData.workArray.length }}<span
             <div>{{ lang.ssAnswerCount }} {{ props.showData.workArray.length }}<span
-                v-if="props.showData.unsubmittedStudents.length > 0">/{{ props.showData.workArray.length + props.showData.unsubmittedStudents.length
+                v-if="props.showData.unsubmittedStudents.length > 0">/{{ props.showData.workArray.length +
+                  props.showData.unsubmittedStudents.length
                 }}</span></div>
                 }}</span></div>
             <span v-if="props.showData.unsubmittedStudents.length > 0" @click="viewUnsubmittedStudents()">{{
             <span v-if="props.showData.unsubmittedStudents.length > 0" @click="viewUnsubmittedStudents()">{{
               lang.ssViewSubmitStatus2 }}</span>
               lang.ssViewSubmitStatus2 }}</span>
@@ -75,7 +76,8 @@
           <div class="ai_echartsData" v-if="currentAnalysis && currentAnalysis.json.keyword">
           <div class="ai_echartsData" v-if="currentAnalysis && currentAnalysis.json.keyword">
             {{ currentAnalysis.json.keyword }}
             {{ currentAnalysis.json.keyword }}
           </div>
           </div>
-          <div class="generatingContent" v-if="currentAnalysis && currentAnalysis.loading">{{lang.ssGeneratingContent}}...</div>
+          <div class="generatingContent" v-if="currentAnalysis && currentAnalysis.loading">
+            {{ lang.ssGeneratingContent }}...</div>
           <div class="ai_updateTime" v-if="currentAnalysis">{{ lang.ssUpdateTime }}:{{ currentAnalysis.update_at }}
           <div class="ai_updateTime" v-if="currentAnalysis">{{ lang.ssUpdateTime }}:{{ currentAnalysis.update_at }}
           </div>
           </div>
         </div>
         </div>
@@ -144,10 +146,11 @@
           </div>
           </div>
           <div class="ai_echartsData" v-if="currentAnalysis && currentAnalysis.json.keyword">
           <div class="ai_echartsData" v-if="currentAnalysis && currentAnalysis.json.keyword">
             <div class="title">{{ lang.ssKeyword }}:</div>
             <div class="title">{{ lang.ssKeyword }}:</div>
-            <span v-for="(item,index) in currentAnalysis.json.keyword" :key="index">{{ item }}</span>
+            <span v-for="(item, index) in currentAnalysis.json.keyword" :key="index">{{ item }}</span>
             <div class="btn" @click="openEchatsDialog()">{{ lang.ssViewKeywordCloud }}</div>
             <div class="btn" @click="openEchatsDialog()">{{ lang.ssViewKeywordCloud }}</div>
           </div>
           </div>
-          <div class="generatingContent" v-if="currentAnalysis && currentAnalysis.generatingContent">{{ lang.ssGeneratingContent }}...</div>
+          <div class="generatingContent" v-if="currentAnalysis && currentAnalysis.generatingContent">{{
+            lang.ssGeneratingContent }}...</div>
           <div class="ai_updateTime" v-if="currentAnalysis">{{ lang.ssUpdateTime }}:{{ currentAnalysis.update_at }}
           <div class="ai_updateTime" v-if="currentAnalysis">{{ lang.ssUpdateTime }}:{{ currentAnalysis.update_at }}
           </div>
           </div>
         </div>
         </div>
@@ -732,7 +735,7 @@ const getAnalysis = () => {
   }
   }
   console.log('props.workId', props.workId)
   console.log('props.workId', props.workId)
   const params = {
   const params = {
-    pid: props.workId+(props.cid?','+props.cid:''),
+    pid: props.workId + (props.cid ? ',' + props.cid : ''),
   }
   }
   axios.get('https://pbl.cocorobo.cn/api/pbl/select_pptAnalysisByPid?pid=' + params.pid).then(res => {
   axios.get('https://pbl.cocorobo.cn/api/pbl/select_pptAnalysisByPid?pid=' + params.pid).then(res => {
     const data = res[0]
     const data = res[0]
@@ -869,7 +872,7 @@ watch(
 
 
 // 查看未提交学生
 // 查看未提交学生
 const viewUnsubmittedStudents = () => {
 const viewUnsubmittedStudents = () => {
-  selectUserDialogRef.value.open(lang.ssSubmitStatus, { user: props.showData.unsubmittedStudents.map((item: any) => item.name),notFiledUser:props.showData.unsubmittedStudents.map((item: any) => item.name),isSubmitUser: props.workArray.map((item: any) => item.name)})
+  selectUserDialogRef.value.open(lang.ssSubmitStatus, { user: props.showData.unsubmittedStudents.map((item: any) => item.name), notFiledUser: props.showData.unsubmittedStudents.map((item: any) => item.name), isSubmitUser: props.workArray.map((item: any) => item.name) })
   // if (props.unsubmittedStudents.length > 0) {
   // if (props.unsubmittedStudents.length > 0) {
   // unsubmittedStudentsDialogRef.value.open(props.unsubmittedStudents)
   // unsubmittedStudentsDialogRef.value.open(props.unsubmittedStudents)
   // }
   // }
@@ -910,7 +913,7 @@ const aiAnalysisRefresh45 = () => {
 
 
   if (!currentAnalysis.value) {
   if (!currentAnalysis.value) {
     aiAnalysisData.value.push({
     aiAnalysisData.value.push({
-      pid: props.workId+(props.cid?','+props.cid:''),
+      pid: props.workId + (props.cid ? ',' + props.cid : ''),
       index: props.showData.workIndex,
       index: props.showData.workIndex,
       loading: true,
       loading: true,
       generatingContent: true,
       generatingContent: true,
@@ -922,32 +925,32 @@ const aiAnalysisRefresh45 = () => {
   }
   }
   else {
   else {
     aiAnalysisData.value.find((item: any) => {
     aiAnalysisData.value.find((item: any) => {
-      return item.pid === props.workId+(props.cid?','+props.cid:'') && item.index === props.showData.workIndex
+      return item.pid === props.workId + (props.cid ? ',' + props.cid : '') && item.index === props.showData.workIndex
     }).loading = true
     }).loading = true
     aiAnalysisData.value.find((item: any) => {
     aiAnalysisData.value.find((item: any) => {
-      return item.pid === props.workId+(props.cid?','+props.cid:'') && item.index === props.showData.workIndex
+      return item.pid === props.workId + (props.cid ? ',' + props.cid : '') && item.index === props.showData.workIndex
     }).json = { text: '', echartsData: '' }
     }).json = { text: '', echartsData: '' }
   }
   }
 
 
   chat_stream(msg, 'a7741704-ba56-40b7-a6b8-62a423ef9376', props.userId, lang.lang, (event) => {
   chat_stream(msg, 'a7741704-ba56-40b7-a6b8-62a423ef9376', props.userId, lang.lang, (event) => {
     if (event.type === 'message') {
     if (event.type === 'message') {
       aiAnalysisData.value.find((item: any) => {
       aiAnalysisData.value.find((item: any) => {
-        return item.pid === props.workId+(props.cid?','+props.cid:'') && item.index === props.showData.workIndex
+        return item.pid === props.workId + (props.cid ? ',' + props.cid : '') && item.index === props.showData.workIndex
       }).json.text = event.data
       }).json.text = event.data
 
 
       aiAnalysisData.value.find((item: any) => {
       aiAnalysisData.value.find((item: any) => {
-        return item.pid === props.workId+(props.cid?','+props.cid:'') && item.index === props.showData.workIndex
+        return item.pid === props.workId + (props.cid ? ',' + props.cid : '') && item.index === props.showData.workIndex
       }).loading = false
       }).loading = false
     }
     }
     else if (event.type === 'messageEnd') {
     else if (event.type === 'messageEnd') {
       aiAnalysisData.value.find((item: any) => {
       aiAnalysisData.value.find((item: any) => {
-        return item.pid === props.workId+(props.cid?','+props.cid:'') && item.index === props.showData.workIndex
+        return item.pid === props.workId + (props.cid ? ',' + props.cid : '') && item.index === props.showData.workIndex
       }).json.text = event.data
       }).json.text = event.data
       aiAnalysisData.value.find((item: any) => {
       aiAnalysisData.value.find((item: any) => {
-        return item.pid === props.workId+(props.cid?','+props.cid:'') && item.index === props.showData.workIndex
+        return item.pid === props.workId + (props.cid ? ',' + props.cid : '') && item.index === props.showData.workIndex
       }).noEnd = false
       }).noEnd = false
       aiAnalysisData.value.find((item: any) => {
       aiAnalysisData.value.find((item: any) => {
-        return item.pid === props.workId+(props.cid?','+props.cid:'') && item.index === props.showData.workIndex
+        return item.pid === props.workId + (props.cid ? ',' + props.cid : '') && item.index === props.showData.workIndex
       }).update_at = new Date().toLocaleString('zh-CN', { year: 'numeric', month: '2-digit', day: '2-digit', hour: '2-digit', minute: '2-digit', second: '2-digit', hour12: false }).replace(/\//g, '-')
       }).update_at = new Date().toLocaleString('zh-CN', { year: 'numeric', month: '2-digit', day: '2-digit', hour: '2-digit', minute: '2-digit', second: '2-digit', hour12: false }).replace(/\//g, '-')
       saveAnalysis()
       saveAnalysis()
     }
     }
@@ -989,7 +992,7 @@ const aiAnalysisRefresh15 = () => {
 30人中15人提交问答题(参与率50%),核心概念“同理心地图”掌握薄弱。发现学生13在智能体对话中6次答“不知道”,需单独辅导设计思维基础概念。建议课程增加POV框架实例演练,强化痛点识别能力训练。`
 30人中15人提交问答题(参与率50%),核心概念“同理心地图”掌握薄弱。发现学生13在智能体对话中6次答“不知道”,需单独辅导设计思维基础概念。建议课程增加POV框架实例演练,强化痛点识别能力训练。`
   if (!currentAnalysis.value) {
   if (!currentAnalysis.value) {
     aiAnalysisData.value.push({
     aiAnalysisData.value.push({
-      pid: props.workId+(props.cid?','+props.cid:''),
+      pid: props.workId + (props.cid ? ',' + props.cid : ''),
       index: props.showData.workIndex,
       index: props.showData.workIndex,
       loading: true,
       loading: true,
       generatingContent: true,
       generatingContent: true,
@@ -1001,19 +1004,19 @@ const aiAnalysisRefresh15 = () => {
   }
   }
   else {
   else {
     aiAnalysisData.value.find((item: any) => {
     aiAnalysisData.value.find((item: any) => {
-      return item.pid === props.workId+(props.cid?','+props.cid:'') && item.index === props.showData.workIndex
+      return item.pid === props.workId + (props.cid ? ',' + props.cid : '') && item.index === props.showData.workIndex
     }).loading = true
     }).loading = true
     aiAnalysisData.value.find((item: any) => {
     aiAnalysisData.value.find((item: any) => {
-      return item.pid === props.workId+(props.cid?','+props.cid:'') && item.index === props.showData.workIndex
+      return item.pid === props.workId + (props.cid ? ',' + props.cid : '') && item.index === props.showData.workIndex
     }).json = { text: '', echartsData: '' }
     }).json = { text: '', echartsData: '' }
     aiAnalysisData.value.find((item: any) => {
     aiAnalysisData.value.find((item: any) => {
-      return item.pid === props.workId+(props.cid?','+props.cid:'') && item.index === props.showData.workIndex
+      return item.pid === props.workId + (props.cid ? ',' + props.cid : '') && item.index === props.showData.workIndex
     }).generatingContent = true
     }).generatingContent = true
   }
   }
   getWordCloud15().then((res) => {
   getWordCloud15().then((res) => {
     flag += 1
     flag += 1
     aiAnalysisData.value.find((item: any) => {
     aiAnalysisData.value.find((item: any) => {
-      return item.pid === props.workId+(props.cid?','+props.cid:'') && item.index === props.showData.workIndex
+      return item.pid === props.workId + (props.cid ? ',' + props.cid : '') && item.index === props.showData.workIndex
     }).generatingContent = false
     }).generatingContent = false
     if (flag == 2) {
     if (flag == 2) {
       saveAnalysis()
       saveAnalysis()
@@ -1023,22 +1026,22 @@ const aiAnalysisRefresh15 = () => {
     console.log(event)
     console.log(event)
     if (event.type === 'message') {
     if (event.type === 'message') {
       aiAnalysisData.value.find((item: any) => {
       aiAnalysisData.value.find((item: any) => {
-        return item.pid === props.workId+(props.cid?','+props.cid:'') && item.index === props.showData.workIndex
+        return item.pid === props.workId + (props.cid ? ',' + props.cid : '') && item.index === props.showData.workIndex
       }).json.text = event.data
       }).json.text = event.data
 
 
       aiAnalysisData.value.find((item: any) => {
       aiAnalysisData.value.find((item: any) => {
-        return item.pid === props.workId+(props.cid?','+props.cid:'') && item.index === props.showData.workIndex
+        return item.pid === props.workId + (props.cid ? ',' + props.cid : '') && item.index === props.showData.workIndex
       }).loading = false
       }).loading = false
     }
     }
     else if (event.type === 'messageEnd') {
     else if (event.type === 'messageEnd') {
       aiAnalysisData.value.find((item: any) => {
       aiAnalysisData.value.find((item: any) => {
-        return item.pid === props.workId+(props.cid?','+props.cid:'') && item.index === props.showData.workIndex
+        return item.pid === props.workId + (props.cid ? ',' + props.cid : '') && item.index === props.showData.workIndex
       }).json.text = event.data
       }).json.text = event.data
       aiAnalysisData.value.find((item: any) => {
       aiAnalysisData.value.find((item: any) => {
-        return item.pid === props.workId+(props.cid?','+props.cid:'') && item.index === props.showData.workIndex
+        return item.pid === props.workId + (props.cid ? ',' + props.cid : '') && item.index === props.showData.workIndex
       }).noEnd = false
       }).noEnd = false
       aiAnalysisData.value.find((item: any) => {
       aiAnalysisData.value.find((item: any) => {
-        return item.pid === props.workId+(props.cid?','+props.cid:'') && item.index === props.showData.workIndex
+        return item.pid === props.workId + (props.cid ? ',' + props.cid : '') && item.index === props.showData.workIndex
       }).update_at = new Date().toLocaleString('zh-CN', { year: 'numeric', month: '2-digit', day: '2-digit', hour: '2-digit', minute: '2-digit', second: '2-digit', hour12: false }).replace(/\//g, '-')
       }).update_at = new Date().toLocaleString('zh-CN', { year: 'numeric', month: '2-digit', day: '2-digit', hour: '2-digit', minute: '2-digit', second: '2-digit', hour12: false }).replace(/\//g, '-')
       flag += 1
       flag += 1
       if (flag == 2) {
       if (flag == 2) {
@@ -1054,7 +1057,7 @@ const aiAnalysisRefresh15 = () => {
 // 打开词云图弹窗
 // 打开词云图弹窗
 const openEchatsDialog = () => {
 const openEchatsDialog = () => {
   if (echartsDialogRef.value && currentAnalysis.value.json.echartsData) {
   if (echartsDialogRef.value && currentAnalysis.value.json.echartsData) {
-    echartsDialogRef.value.open(lang.ssKeywordCloud,currentAnalysis.value.json.echartsData)
+    echartsDialogRef.value.open(lang.ssKeywordCloud, currentAnalysis.value.json.echartsData)
   }
   }
 }
 }
 
 
@@ -1090,7 +1093,7 @@ const getWordCloud15 = () => {
 
 
     chat_no_stream(msg, 'a7741704-ba56-40b7-a6b8-62a423ef9376', props.userId, lang.lang).promise.then((res) => {
     chat_no_stream(msg, 'a7741704-ba56-40b7-a6b8-62a423ef9376', props.userId, lang.lang).promise.then((res) => {
       aiAnalysisData.value.find((item: any) => {
       aiAnalysisData.value.find((item: any) => {
-        return item.pid === props.workId+(props.cid?','+props.cid:'') && item.index === props.showData.workIndex
+        return item.pid === props.workId + (props.cid ? ',' + props.cid : '') && item.index === props.showData.workIndex
       }).json.echartsData = JSON.parse(res)
       }).json.echartsData = JSON.parse(res)
       resolve(1)
       resolve(1)
     }).catch(err => {
     }).catch(err => {
@@ -1109,10 +1112,18 @@ const aiAnalysisRefresh72 = async () => {
 
 
   processedWorkArray.value.forEach((i) => {
   processedWorkArray.value.forEach((i) => {
     i.content.forEach(j => {
     i.content.forEach(j => {
-      j.messages.forEach((a) => {
-        chatMsg += `\n${a.sender}:
+      if (j.messages) {
+        j.messages.forEach((a) => {
+          chatMsg += `\n${a.sender}:
 ${a.content}\n`
 ${a.content}\n`
-      })
+        })
+      }
+      if(j.imageUrls){
+        j.imageUrls.forEach((a) => {
+          chatMsg += `\n${a}\n`
+        })
+      }
+
     })
     })
 
 
   })
   })
@@ -1151,7 +1162,7 @@ ${a.content}\n`
   console.log("cs", msg)
   console.log("cs", msg)
   if (!currentAnalysis.value) {
   if (!currentAnalysis.value) {
     aiAnalysisData.value.push({
     aiAnalysisData.value.push({
-      pid: props.workId+(props.cid?','+props.cid:''),
+      pid: props.workId + (props.cid ? ',' + props.cid : ''),
       index: props.showData.workIndex,
       index: props.showData.workIndex,
       loading: true,
       loading: true,
       json: { text: '', echartsData: '' },
       json: { text: '', echartsData: '' },
@@ -1162,32 +1173,32 @@ ${a.content}\n`
   }
   }
   else {
   else {
     aiAnalysisData.value.find((item: any) => {
     aiAnalysisData.value.find((item: any) => {
-      return item.pid === props.workId+(props.cid?','+props.cid:'') && item.index === props.showData.workIndex
+      return item.pid === props.workId + (props.cid ? ',' + props.cid : '') && item.index === props.showData.workIndex
     }).loading = true
     }).loading = true
     aiAnalysisData.value.find((item: any) => {
     aiAnalysisData.value.find((item: any) => {
-      return item.pid === props.workId+(props.cid?','+props.cid:'') && item.index === props.showData.workIndex
+      return item.pid === props.workId + (props.cid ? ',' + props.cid : '') && item.index === props.showData.workIndex
     }).json = { text: '', echartsData: '' }
     }).json = { text: '', echartsData: '' }
   }
   }
 
 
   chat_stream(msg, 'a7741704-ba56-40b7-a6b8-62a423ef9376', props.userId, lang.lang, (event) => {
   chat_stream(msg, 'a7741704-ba56-40b7-a6b8-62a423ef9376', props.userId, lang.lang, (event) => {
     if (event.type === 'message') {
     if (event.type === 'message') {
       aiAnalysisData.value.find((item: any) => {
       aiAnalysisData.value.find((item: any) => {
-        return item.pid === props.workId+(props.cid?','+props.cid:'') && item.index === props.showData.workIndex
+        return item.pid === props.workId + (props.cid ? ',' + props.cid : '') && item.index === props.showData.workIndex
       }).json.text = event.data
       }).json.text = event.data
 
 
       aiAnalysisData.value.find((item: any) => {
       aiAnalysisData.value.find((item: any) => {
-        return item.pid === props.workId+(props.cid?','+props.cid:'') && item.index === props.showData.workIndex
+        return item.pid === props.workId + (props.cid ? ',' + props.cid : '') && item.index === props.showData.workIndex
       }).loading = false
       }).loading = false
     }
     }
     else if (event.type === 'messageEnd') {
     else if (event.type === 'messageEnd') {
       aiAnalysisData.value.find((item: any) => {
       aiAnalysisData.value.find((item: any) => {
-        return item.pid === props.workId+(props.cid?','+props.cid:'') && item.index === props.showData.workIndex
+        return item.pid === props.workId + (props.cid ? ',' + props.cid : '') && item.index === props.showData.workIndex
       }).json.text = event.data
       }).json.text = event.data
       aiAnalysisData.value.find((item: any) => {
       aiAnalysisData.value.find((item: any) => {
-        return item.pid === props.workId+(props.cid?','+props.cid:'') && item.index === props.showData.workIndex
+        return item.pid === props.workId + (props.cid ? ',' + props.cid : '') && item.index === props.showData.workIndex
       }).noEnd = false
       }).noEnd = false
       aiAnalysisData.value.find((item: any) => {
       aiAnalysisData.value.find((item: any) => {
-        return item.pid === props.workId+(props.cid?','+props.cid:'') && item.index === props.showData.workIndex
+        return item.pid === props.workId + (props.cid ? ',' + props.cid : '') && item.index === props.showData.workIndex
       }).update_at = new Date().toLocaleString('zh-CN', { year: 'numeric', month: '2-digit', day: '2-digit', hour: '2-digit', minute: '2-digit', second: '2-digit', hour12: false }).replace(/\//g, '-')
       }).update_at = new Date().toLocaleString('zh-CN', { year: 'numeric', month: '2-digit', day: '2-digit', hour: '2-digit', minute: '2-digit', second: '2-digit', hour12: false }).replace(/\//g, '-')
       saveAnalysis()
       saveAnalysis()
     }
     }
@@ -1200,7 +1211,7 @@ ${a.content}\n`
 // 当前分析
 // 当前分析
 const currentAnalysis = computed(() => {
 const currentAnalysis = computed(() => {
   let _result = aiAnalysisData.value.find((item: any) => {
   let _result = aiAnalysisData.value.find((item: any) => {
-    return item.pid === props.workId+(props.cid?','+props.cid:'') && item.index === props.showData.workIndex
+    return item.pid === props.workId + (props.cid ? ',' + props.cid : '') && item.index === props.showData.workIndex
   })
   })
 
 
   if (_result?.json?.echartsData) {
   if (_result?.json?.echartsData) {
@@ -1222,7 +1233,7 @@ const saveAnalysis = () => {
     return
     return
   }
   }
   const params = [{
   const params = [{
-    pid: props.workId+(props.cid?','+props.cid:''),
+    pid: props.workId + (props.cid ? ',' + props.cid : ''),
     idx: props.showData.workIndex,
     idx: props.showData.workIndex,
     json: JSON.stringify(currentAnalysis.value.json),
     json: JSON.stringify(currentAnalysis.value.json),
   }]
   }]
@@ -2027,11 +2038,13 @@ onUnmounted(() => {
     font-size: 1rem;
     font-size: 1rem;
     font-weight: 500;
     font-weight: 500;
   }
   }
-  &>.ai_echartsData{
+
+  &>.ai_echartsData {
     display: flex;
     display: flex;
     flex-wrap: wrap;
     flex-wrap: wrap;
     gap: .5rem;
     gap: .5rem;
-    &>span{
+
+    &>span {
       padding: .2rem .5rem;
       padding: .2rem .5rem;
       border-radius: .25rem;
       border-radius: .25rem;
       background: #E6F4FF;
       background: #E6F4FF;
@@ -2041,10 +2054,12 @@ onUnmounted(() => {
       color: #141517;
       color: #141517;
       font-size: .75rem;
       font-size: .75rem;
     }
     }
-    &>.title{
+
+    &>.title {
       font-weight: 600;
       font-weight: 600;
     }
     }
-    &>.btn{
+
+    &>.btn {
       font-size: .9rem;
       font-size: .9rem;
       text-decoration: underline;
       text-decoration: underline;
       color: #F6C82B;
       color: #F6C82B;