Jelajahi Sumber

Merge branch 'beta' of https://git.cocorobo.cn/jack/PPT into beta

lsc 1 hari lalu
induk
melakukan
634fdb5cab

+ 66 - 51
src/views/Student/components/choiceQuestionDetailDialog.vue

@@ -17,7 +17,8 @@
           }}</div>
           <div class="c_t45_msg">
             <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 v-if="props.showData.unsubmittedStudents.length > 0" @click="viewUnsubmittedStudents()">{{
               lang.ssViewSubmitStatus2 }}</span>
@@ -75,7 +76,8 @@
           <div class="ai_echartsData" v-if="currentAnalysis && currentAnalysis.json.keyword">
             {{ currentAnalysis.json.keyword }}
           </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>
         </div>
@@ -144,10 +146,11 @@
           </div>
           <div class="ai_echartsData" v-if="currentAnalysis && currentAnalysis.json.keyword">
             <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>
-          <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>
         </div>
@@ -248,7 +251,7 @@
                           {{ item.type }}
                         </div>
                         <div class="na_m_i_content">
-                          <img style="height: 100px;width: auto;" :src="item3" />
+                          <img @click="lookImage(item3)" style="height: 100px;width: auto;cursor: pointer;" :src="item3" />
                         </div>
                       </div>
                     </template>
@@ -578,7 +581,7 @@ const setEchartsArea1 = () => {
           fontSize: 17,
           lineHeight: 20,
           interval: 0,
-          formatter: function (value: any, idx: number) {
+          formatter: function(value: any, idx: number) {
             // 如果是字符串且格式为JSON(图片),则解析处理
             if (typeof value === 'string') {
               try {
@@ -732,7 +735,7 @@ const getAnalysis = () => {
   }
   console.log('props.workId', props.workId)
   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 => {
     const data = res[0]
@@ -869,7 +872,7 @@ watch(
 
 // 查看未提交学生
 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) {
   // unsubmittedStudentsDialogRef.value.open(props.unsubmittedStudents)
   // }
@@ -910,7 +913,7 @@ const aiAnalysisRefresh45 = () => {
 
   if (!currentAnalysis.value) {
     aiAnalysisData.value.push({
-      pid: props.workId+(props.cid?','+props.cid:''),
+      pid: props.workId + (props.cid ? ',' + props.cid : ''),
       index: props.showData.workIndex,
       loading: true,
       generatingContent: true,
@@ -922,32 +925,32 @@ const aiAnalysisRefresh45 = () => {
   }
   else {
     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
     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: '' }
   }
 
   chat_stream(msg, 'a7741704-ba56-40b7-a6b8-62a423ef9376', props.userId, lang.lang, (event) => {
     if (event.type === 'message') {
       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
 
       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
     }
     else if (event.type === 'messageEnd') {
       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
       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
       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, '-')
       saveAnalysis()
     }
@@ -989,7 +992,7 @@ const aiAnalysisRefresh15 = () => {
 30人中15人提交问答题(参与率50%),核心概念“同理心地图”掌握薄弱。发现学生13在智能体对话中6次答“不知道”,需单独辅导设计思维基础概念。建议课程增加POV框架实例演练,强化痛点识别能力训练。`
   if (!currentAnalysis.value) {
     aiAnalysisData.value.push({
-      pid: props.workId+(props.cid?','+props.cid:''),
+      pid: props.workId + (props.cid ? ',' + props.cid : ''),
       index: props.showData.workIndex,
       loading: true,
       generatingContent: true,
@@ -1001,19 +1004,19 @@ const aiAnalysisRefresh15 = () => {
   }
   else {
     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
     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: '' }
     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
   }
   getWordCloud15().then((res) => {
     flag += 1
     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
     if (flag == 2) {
       saveAnalysis()
@@ -1023,22 +1026,22 @@ const aiAnalysisRefresh15 = () => {
     console.log(event)
     if (event.type === 'message') {
       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
 
       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
     }
     else if (event.type === 'messageEnd') {
       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
       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
       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, '-')
       flag += 1
       if (flag == 2) {
@@ -1054,13 +1057,13 @@ const aiAnalysisRefresh15 = () => {
 // 打开词云图弹窗
 const openEchatsDialog = () => {
   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)
   }
 }
 
 
 
-//问答题获取词云图与关键词
+// 问答题获取词云图与关键词
 const getWordCloud15 = () => {
 
   return new Promise((resolve,) => {
@@ -1090,7 +1093,7 @@ const getWordCloud15 = () => {
 
     chat_no_stream(msg, 'a7741704-ba56-40b7-a6b8-62a423ef9376', props.userId, lang.lang).promise.then((res) => {
       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)
       resolve(1)
     }).catch(err => {
@@ -1109,10 +1112,18 @@ const aiAnalysisRefresh72 = async () => {
 
   processedWorkArray.value.forEach((i) => {
     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`
-      })
+        })
+      }
+      if (j.imageUrls) {
+        j.imageUrls.forEach((a) => {
+          chatMsg += `\n${a}\n`
+        })
+      }
+
     })
 
   })
@@ -1148,10 +1159,10 @@ ${a.content}\n`
 # EXAMPLES #
 样例:
 智能体对话显示学生对“模型训练”概念模糊,多次询问“为什么不能直接告诉机器答案”。针对概念混淆学生,补充“人类学习类比”相关解释,巩固“从数据中学习规律”核心认知。`
-  console.log("cs", msg)
+  console.log('cs', msg)
   if (!currentAnalysis.value) {
     aiAnalysisData.value.push({
-      pid: props.workId+(props.cid?','+props.cid:''),
+      pid: props.workId + (props.cid ? ',' + props.cid : ''),
       index: props.showData.workIndex,
       loading: true,
       json: { text: '', echartsData: '' },
@@ -1162,32 +1173,32 @@ ${a.content}\n`
   }
   else {
     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
     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: '' }
   }
 
   chat_stream(msg, 'a7741704-ba56-40b7-a6b8-62a423ef9376', props.userId, lang.lang, (event) => {
     if (event.type === 'message') {
       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
 
       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
     }
     else if (event.type === 'messageEnd') {
       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
       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
       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, '-')
       saveAnalysis()
     }
@@ -1199,8 +1210,8 @@ ${a.content}\n`
 
 // 当前分析
 const currentAnalysis = computed(() => {
-  let _result = aiAnalysisData.value.find((item: any) => {
-    return item.pid === props.workId+(props.cid?','+props.cid:'') && item.index === props.showData.workIndex
+  const _result = aiAnalysisData.value.find((item: any) => {
+    return item.pid === props.workId + (props.cid ? ',' + props.cid : '') && item.index === props.showData.workIndex
   })
 
   if (_result?.json?.echartsData) {
@@ -1211,9 +1222,9 @@ const currentAnalysis = computed(() => {
   if (_result) {
     return _result
   }
-  else {
-    return null
-  }
+  
+  return null
+  
 })
 
 // 保存分析
@@ -1222,7 +1233,7 @@ const saveAnalysis = () => {
     return
   }
   const params = [{
-    pid: props.workId+(props.cid?','+props.cid:''),
+    pid: props.workId + (props.cid ? ',' + props.cid : ''),
     idx: props.showData.workIndex,
     json: JSON.stringify(currentAnalysis.value.json),
   }]
@@ -2027,11 +2038,13 @@ onUnmounted(() => {
     font-size: 1rem;
     font-weight: 500;
   }
-  &>.ai_echartsData{
+
+  &>.ai_echartsData {
     display: flex;
     flex-wrap: wrap;
     gap: .5rem;
-    &>span{
+
+    &>span {
       padding: .2rem .5rem;
       border-radius: .25rem;
       background: #E6F4FF;
@@ -2041,10 +2054,12 @@ onUnmounted(() => {
       color: #141517;
       font-size: .75rem;
     }
-    &>.title{
+
+    &>.title {
       font-weight: 600;
     }
-    &>.btn{
+
+    &>.btn {
       font-size: .9rem;
       text-decoration: underline;
       color: #F6C82B;

+ 0 - 1
src/views/Student/index.vue

@@ -3326,7 +3326,6 @@ const getMessages = (msgObj: any) => {
       }
     }, 1000)
   }
-  
   // 计时器消息 - 学生与老师端实时显示
   if (msgObj.type === 'timer_start' && msgObj.courseid === props.courseid) {
     applyTimerStart(msgObj.payload)