Browse Source

fix(upload): 修复文件扩展名获取错误问题

refactor(dashboard): 添加用户类型检查并自动跳转
添加学员登录后自动跳转到课程列表页面的逻辑

feat(course_process): 增加认知节点类型支持
扩展课程处理逻辑以支持认知节点类型

fix(evaluation): 修正评分滑块事件处理
调整评分滑块的事件触发方式并优化表格列顺序
zhanghaijun 9 months ago
parent
commit
0bc601a969

+ 1 - 1
src/components/form/components/upload.vue

@@ -236,7 +236,7 @@
 
     if (props.accept) {
       const acceptedTypes = props.accept.split(',').map((type) => type.trim())
-      const fileExtension = `.${info.file.name.split('.').pop()?.toLowerCase()}`
+      const fileExtension = `.${info.name.split('.').pop()?.toLowerCase()}`
       if (!acceptedTypes.includes(fileExtension)) {
         // 清除fileList中的无效文件
         fileList.value = fileList.value.filter((item) => item.uid !== info.file.uid)

+ 9 - 0
src/views/dashboard/console/index.vue

@@ -60,6 +60,7 @@
 </template>
 
 <script setup lang="ts">
+  import { useUserStore } from '@/store/modules/user'
   import Image01 from '@imgs/common/01.webp'
   import Image02 from '@imgs/common/02.webp'
   import Image03 from '@imgs/common/03.webp'
@@ -68,11 +69,19 @@
   defineOptions({ name: 'TrainConsole' })
 
   const router = useRouter()
+  const { getUserType } = toRefs(useUserStore())
 
   const openPage = (url: string) => {
     const routeUrl = router.resolve(url)
     window.open(window.location.origin + window.location.pathname + routeUrl.href, '_blank')
   }
+
+  onMounted(() => {
+    if (getUserType.value === 1) {
+      // 学员登录,跳转到课程列表
+      router.push('/trainer/course/list')
+    }
+  })
 </script>
 
 <style lang="scss" scoped>

+ 16 - 3
src/views/train/course/trainer_run/course_process.vue

@@ -21,7 +21,9 @@
   const courseFormModel = ref<Record<string, unknown>>({})
   const fileUrl = ref('')
 
-  const isCourse = computed(() => processData.value?.nodeType === 'operation' || processData.value?.nodeType === 'fault' || processData.value?.nodeType === 'voice')
+  const isCourse = computed(
+    () => processData.value?.nodeType === 'operation' || processData.value?.nodeType === 'fault' || processData.value?.nodeType === 'voice' || processData.value?.nodeType === 'cognize'
+  )
   const isFault = computed(() => processData.value?.nodeType === 'fault')
 
   const [CommonForm] = useDetailForm({ labelWidth: '150px', schema: nodeDataCommon })
@@ -94,12 +96,23 @@
           })
         })
         break
-      default:
-        courseFormModel.value = {}
+      case 'cognize':
+        courseFormModel.value = {
+          templateID: Number(nodeData?.cognizeNode?.templateID || 0),
+          categoryName: String(nodeData?.cognizeNode?.categoryName || ''),
+          subCategoryName: String(nodeData?.cognizeNode?.subCategoryName || ''),
+          bindRole: String(nodeData?.cognizeNode?.bindRole || ''),
+          cognizeContent: String(nodeData?.cognizeNode?.cognizeContent || ''),
+          evalContent: String(nodeData?.cognizeNode?.evalContent || ''),
+          guideDesc: String(nodeData?.cognizeNode?.guideDesc || ''),
+          guideFilePath: String(nodeData?.cognizeNode?.guideFilePath || '')
+        }
         nextTick(() => {
           formApi.setState({ schema: [] })
         })
         break
+      default:
+        courseFormModel.value = {}
     }
   }
 

+ 5 - 4
src/views/train/evaluation/list-referee.vue

@@ -2,7 +2,7 @@
   <ArtTable ref="refereeTableRef" :loading="refereeLoading" :data="refereeData" :columns="refereeColumns" empty-height="360px">
     <!-- 操作得分 -->
     <template #operScore="{ row }">
-      <el-slider v-model="row.operScore" range show-stops :max="row.evaScore" :min="Math.max(0, row.evaDeduction)" :input="saveRefereeRow(row, 'operScore', '操作得分已修改')" />
+      <el-slider v-model="row.operScore" :max="row.evaScore" :min="Math.max(0, row.evaDeduction)" @change="saveRefereeRow(row, 'operScore', '操作得分已修改')" />
     </template>
     <!-- 是否失格项 -->
     <template #disqualificationItem="{ row }">
@@ -46,10 +46,10 @@
         { prop: 'evaSource', label: '评价来源', formatter: (row: RefereeData) => (row.evaSource === 0 ? '流程图' : row.evaSource === 1 ? '教员自定义' : '未知') },
         { prop: 'evaType', label: '评价类型', formatter: (row: RefereeData) => (row.evaType === 0 ? '主观评价' : row.evaType === 1 ? '客观评价' : '未知') },
         { prop: 'evaName', label: '节点名称', width: '250px' },
-        { prop: 'operScore', label: '操作得分', useSlot: true },
         { prop: 'operTime', label: '操作时间', formatter: (row: RefereeData) => formatSecondsToHHMMSS(Number(row.operTime ?? 0)) },
-        { prop: 'evaDeduction', label: '评价失分', width: 180 },
-        { prop: 'evaScore', label: '评价赋分', width: 180 },
+        { prop: 'evaDeduction', label: '评价失分' },
+        { prop: 'evaScore', label: '评价赋分' },
+        { prop: 'operScore', label: '操作得分', width: 180, useSlot: true },
         { prop: 'disqualificationItem', label: '是否失格项', useSlot: true },
         { prop: 'isOperated', label: '是否操作', useSlot: true }
       ]
@@ -66,6 +66,7 @@
   })
 
   const saveRefereeRow = async (row: RefereeData, prop: string, tip: string = '修改成功') => {
+    console.log(row)
     if (!row.runLogID || !row.runOperID || !prop) return
     if (prop === 'operScore') {
       await RefereeServer.setScore(row.runLogID, row.seqNo, Number(row.operScore))