فهرست منبع

新回答结果(已隐藏)

SanHQin 2 روز پیش
والد
کامیت
814f8afa39
4فایلهای تغییر یافته به همراه259 افزوده شده و 0 حذف شده
  1. BIN
      src/assets/img/arrow_up.png
  2. 13 0
      src/services/course.ts
  3. 208 0
      src/views/Student/components/answerTheResult.vue
  4. 38 0
      src/views/Student/index.vue

BIN
src/assets/img/arrow_up.png


+ 13 - 0
src/services/course.ts

@@ -170,6 +170,18 @@ export const clearDialogue = (params: any): Promise<any> => {
   return axios.delete(`https://appapi.cocorobo.cn/api/agentchats/clear_thread_context`, { data: params })
 }
 
+/**
+ * 
+ * 获取作业·详细
+ * @param any 作业id
+ * @returns Promise<any>
+ */
+
+export const getWorkDetail = (params: any): Promise<any> => {
+  return axios.get(`${API_URL}select_workPageById`, { params: params })
+}
+
+
 
 
 
@@ -191,5 +203,6 @@ export default {
   getChatList,
   getAgentData,
   clearDialogue,
+  getWorkDetail
 }
 

+ 208 - 0
src/views/Student/components/answerTheResult.vue

@@ -0,0 +1,208 @@
+<template>
+  <div class="answerTheResult">
+    <div class="atr_detail">
+      <div class="atr_d_btn">查看详细</div>
+      <div class="atr_d_msg">
+        <div>参与人数</div>
+        <span>{{workArrayLength}}/{{ workArrayLength + unsubmittedStudentsLength }}</span>
+      </div>
+
+      <div class="atr_d_msg" v-if="workDetail && workDetail.type === '45'">
+        <div>正确率</div>
+        <span>30%(15/30)</span>
+      </div>
+
+      <div class="atr_d_msg" v-if="workDetail && workDetail.type === '45'">
+        <div>正确答案</div>
+        <span>B</span>
+      </div>
+
+      <span class="atr_d_line"></span>
+
+      <div  class="no_submit">
+        <div>未提交人员</div>
+        <img @click="showNoSubmitDetail = !showNoSubmitDetail" :class="{'no_submit_active':!showNoSubmitDetail}" src="../../../assets/img/arrow_up.png" />
+      </div>
+
+      <div class="no_submitList" :class="{'no_submitList_active':showNoSubmitDetail}">
+        <div v-for="(student, idx) in props.unsubmittedStudents" :key="student.id ?? idx">{{ student.name ?? '' }}</div>
+      </div>
+    </div>
+
+    <div class="atr_type45Area" v-if="workDetail && workDetail.type === '45'">
+      {{ workDetail.json }}
+    </div>
+  </div>
+</template>
+
+<script lang="ts" setup>
+import { ref, computed, watch} from 'vue'
+import api from '../../../services/course'
+
+interface Props {
+  workArray?: object[] | null
+  unsubmittedStudents?: object[] | null
+  workId?:string | null
+}
+
+const props = withDefaults(defineProps<Props>(), {
+  workArray: () => [],
+  unsubmittedStudents: () => [],
+  workId: ''
+})
+
+const workArrayLength = computed(() => {
+  let _result = 0
+  if (props.workArray) {
+    _result = props.workArray.length
+  }
+  return _result
+})
+
+const unsubmittedStudentsLength = computed(() => {
+  let _result = 0
+  if (props.unsubmittedStudents) {
+    _result = props.unsubmittedStudents.length
+  }
+  return _result
+})
+
+
+console.log('workArray', props.workArray)
+console.log('unsubmittedStudents', props.unsubmittedStudents)
+
+
+const workIndex = ref<number>(0)
+
+const showNoSubmitDetail = ref<boolean>(false)
+
+const workDetail = ref<any>({})
+
+// 获取作业详细
+const getWorkDetail = async () => {
+  if (props.workId) {
+    const _res = await api.getWorkDetail({id: props.workId})
+    const _data = _res[0][0]
+    if (_data) {
+      _data.json = JSON.parse(_data.json)
+      workDetail.value = _data
+    }
+   
+  }
+}
+
+
+// 监听作业Id
+watch(
+  () => props.workId,
+  (newVal, oldVal) => {
+    console.log('props.workId变化', { newVal, oldVal })
+    if (newVal && newVal !== oldVal) {
+      getWorkDetail()
+    }
+  },
+  { immediate: true }
+)
+
+
+
+
+</script>
+
+<style lang="scss" scoped>
+.answerTheResult {
+  width: 100%;
+  height: auto;
+  max-height: 100%;
+  overflow: auto;
+  box-sizing: border-box;
+  padding: 12px;
+  .atr_detail {
+    width: 100%;
+    height: auto;
+    border-radius: 4px;
+    padding: 10px 15px 10px 15px;
+    box-sizing: border-box;
+    border: solid 1px rgba(0, 0, 0, 0.1);
+    .atr_d_btn{
+      width: 100%;
+      height: 40px;
+      display: flex;
+      align-items: center;
+      justify-content: center;
+      background: rgba(0, 0, 0, 0.9);
+      color: #fff;
+      font-weight: 500;
+      font-size: 14px;
+      border-radius: 4px;
+      cursor: pointer;
+
+    }
+
+    .atr_d_msg{
+      width: 100%;
+      display: flex;
+      align-items: center;
+      margin-top: 15px;
+      font-size: 14px;
+      color: rgba(0, 0, 0, 0.9);
+      &>div{
+        width: 4em;
+        margin-right: 35px;
+        font-weight: 500;
+      }
+    }
+
+    .atr_d_line{
+      width: 100%;
+      height: 2px;
+      display: block;
+      background: rgba(242, 243, 245, 1);
+      margin: 20px 0;
+      border-radius: 2px;
+    }
+
+    .no_submit{
+      width: 100%;
+      display: flex;
+      align-items: center;
+      justify-content: space-between;
+      font-size: 14px;
+      font-weight: 500;
+      margin-bottom: 20px;
+      .no_submit_active{
+        transform: rotate(180deg);
+      }
+      &>img{
+        cursor: pointer;
+      }
+    }
+
+    .no_submitList{
+      width: 100%;
+      display: flex;
+      align-items: center;
+      flex-wrap: nowrap;
+      overflow: hidden;
+      gap: 10px;
+      &>div{
+        padding: 5px 10px;
+        background: rgba(255, 236, 232, 1);
+        color: rgba(245, 63, 63, 1);
+        font-size: 14px;
+        font-weight: 500;
+        border-radius: 10px;
+      }
+
+    }
+    .no_submitList_active{
+      flex-wrap: wrap;
+    }
+  }
+
+  .atr_type45Area{
+    width: 100%;
+    height: auto;
+  }
+}
+</style>

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

@@ -233,6 +233,8 @@
         
         <!-- 回答结果内容 -->
         <div v-show="!workPanelCollapsed && rightPanelMode === 'homework'" class="panel-content">
+          <!--<div v-if="workLoading" class="homework-loading">正在加载作业...</div>
+          // <answerTheResult :workId="workId" :workArray="workArray" :unsubmittedStudents="unsubmittedStudents" v-else ref="answerTheResultRef"/>-->
           <div class="homework-title">已提交</div>
           <div v-if="workLoading" class="homework-loading">正在加载作业...</div>
           <div v-else>
@@ -315,6 +317,7 @@ import ChoiceStatistics from './components/ChoiceStatistics.vue'
 import * as Y from 'yjs'
 import { WebsocketProvider } from 'y-websocket'
 import { Refresh } from '@icon-park/vue-next'
+// import answerTheResult from './components/answerTheResult.vue'
 
 
 // 导入图片资源
@@ -396,6 +399,9 @@ const visibleQA = ref(false)
 const visibleChoice = ref(false)
 const visibleAI = ref(false)
 
+// 当前作业选择/问答题的ID
+const workId = ref<string>('')
+
 // 回答结果收缩状态
 const workPanelCollapsed = ref(true)
 // 幻灯片导航收缩状态
@@ -716,6 +722,8 @@ watch(() => slideIndex.value, (newIndex, oldIndex) => {
       isSubmitting.value = false
     }
   }
+
+  getWorkId()
 }, { immediate: false, deep: false })
 
 // 监听iframe状态变化,自动切换面板
@@ -763,6 +771,35 @@ const handleFullscreenChange = () => {
   }
 }
 
+const getWorkId = () => {
+  // 修复类型报错:elementList 可能没有 toolType 和 url 字段,需先判断类型
+  const element = elementList.value[0]
+  if (
+    element &&
+    typeof element === 'object' &&
+    ('toolType' in element) &&
+    (element as any).toolType !== undefined &&
+    ((element as any).toolType === 45 || (element as any).toolType === 15)
+  ) {
+    // 提取链接中的id参数
+    const url = (element as any).url
+    let id = ''
+    if (typeof url === 'string') {
+      const match = url.match(/[?&]id=([^&]+)/)
+      if (match) {
+        id = match[1]
+      }
+      workId.value = id
+    }
+    else {
+      workId.value = ''
+    }
+  }
+  else {
+    workId.value = ''
+  }
+}
+
 // 切换激光笔模式
 const toggleLaserPen = () => {
   laserPen.value = !laserPen.value
@@ -1697,6 +1734,7 @@ const getCourseDetail = async () => {
         }
       }
     }
+    getWorkId()
   }
   catch (error) {
     console.error('获取课程详情失败:', error)