diff --git a/src/api/CONST.js b/src/api/CONST.js index e07e4bb..bc6936d 100644 --- a/src/api/CONST.js +++ b/src/api/CONST.js @@ -2,7 +2,7 @@ export const PROJECT = 1; export const ROUTER = 2; export const COURSE = 3; -export const TASK_TYPES ={ +export const TASK_TYPES = { typeName: { 1: "在线", 2: "面授", @@ -38,9 +38,9 @@ export const TASK_TYPES ={ 2: ({courseId}) => window.open(`${location.protocol}//${location.host}${import.meta.env.VITE_BASE_API}/stu/project/redirectDetail?courseId=${courseId}`, '_top'), 3: window.location.protocol + import.meta.env.VITE_BOE_CASS_DETAIL_URL, //案例 4: "/homeworkpage", - 5: window.location.protocol + import.meta.env.VITE_BOE_EXAM_DETAIL_URL, //考试 + 5: ({examType}) => examType === 2 ? '/externalexamination' : (window.location.protocol + import.meta.env.VITE_BOE_EXAM_DETAIL_URL), //考试 6: "/livebroadcast", - 7: ({targetId}) => window.open(targetId, '_top'), //外联 + 7: '/outerchain', //外联 8: "/discusspage", 9: "/moreactive", 10: ({evaType, targetId}) => diff --git a/src/views/roadmap/PathDetails.vue b/src/views/roadmap/PathDetails.vue index e60e0fb..7487335 100644 --- a/src/views/roadmap/PathDetails.vue +++ b/src/views/roadmap/PathDetails.vue @@ -280,12 +280,11 @@ import {computed, onMounted, ref} from "vue"; import circle from '@/assets/image/pathdetails/circle.png'; import circle2 from '@/assets/image/pathdetails/circle2.png'; import {request} from "@/api/request"; -import {EvaluationToLearn, STUDY_RECORD, SubmitExternalExam} from "@/api/api"; +import {STUDY_RECORD, UPDATE_CURRENT_TASK} from "@/api/api"; import {useRoute, useRouter} from "vue-router"; import {ElMessage} from "element-plus"; import {ROUTER, TASK_TYPES} from "@/api/CONST"; import FileTypeImg from "@/components/FileTypeImg.vue"; -import {UPDATE_CURRENT_TASK} from "@/api/api"; import {useStore} from "vuex"; const { @@ -323,19 +322,19 @@ function judgeTaskIsEnd(type, endTimes, status) { let endTime = new Date().getTime(endTimes); switch (type) { case 1: - status == -1 ? isEnd = true : nowTime > endTime ? isEnd = true : isEnd = false; + status == -1 ? isEnd = true : nowTime > endTime ? isEnd = true : isEnd = false; break; // case 3: // status == 3 ? isEnd = true : nowTime > endTime ? isEnd = true : isEnd = false; // break; case 5: - status == -1 ? isEnd = true : nowTime > endTime ? isEnd = true : isEnd = false; + status == -1 ? isEnd = true : nowTime > endTime ? isEnd = true : isEnd = false; break; case 7: - status == -1 ? isEnd = true : nowTime > endTime ? isEnd = true : isEnd = false; + status == -1 ? isEnd = true : nowTime > endTime ? isEnd = true : isEnd = false; break; case 10: - status == -1 ? isEnd = true : nowTime > endTime ? isEnd = true : isEnd = false; + status == -1 ? isEnd = true : nowTime > endTime ? isEnd = true : isEnd = false; break; } return isEnd; @@ -346,7 +345,7 @@ async function toFinish(d) { ElMessage.warning("当前未解锁") return } - if (judgeTaskIsEnd(d.type, data.value.endTime, data.value.status)) { + if (data.value.endTime && judgeTaskIsEnd(d.type, data.value.endTime, data.value.status)) { ElMessage.error("当前任务已结束") return } @@ -393,37 +392,6 @@ async function toFinish(d) { dialogVisible.value = true; return } - // 此处判断外部考试跳转 - if (d.examType == 2) { - - // 点击即更新状态 进行中 - request(SubmitExternalExam, { - "chapterId": data.value.currentStageId, - "externalId": d.courseId, - "externalName": d.name, - "targetId": routerId, - "studentNo": userInfo.value.userNo - }).then(res => { - console.log(res) - }).catch(err => { - console.log(err) - }) - - router.push({ - path: '/externalexamination', - query: { - id: d.id, - type: ROUTER, - infoId: routerId, - courseId: d.courseId, - pName: data.value.name, - sName: data.value.currentStageName, - chapterOrStageId: data.value.currentStageId, - exname: d.name, // 考试名称 - }, - }); - return - } } // 评估 停用 if (d.type == 11) { @@ -464,38 +432,19 @@ async function toFinish(d) { } //更新学员当前任务 await request(UPDATE_CURRENT_TASK, {id: d.id, type: ROUTER, pid: routerId, name: d.name}) - if (d.type === 3 || d.type === 7) { + if (d.type === 3 || d.type === 7 || (d.type === 5 && d.examType === 2)) { d.status !== 1 && await request(STUDY_RECORD, { studentId: userInfo.value.id, targetId: data.value.id, logo: ROUTER, + type: ROUTER, stageOrChapterId: data.value.currentStageId, taskId: d.id, }); - - // 此处判断外链跳转详情界面 - if (d.type == 7) { - router.push({ - path: '/outerchain', - query: { - id: d.id, - type: ROUTER, - infoId: routerId, - courseId: d.courseId, - pName: data.value.name, - sName: data.value.currentStageName, - chapterOrStageId: data.value.currentStageId, - exname: d.name, // 外链名称 - }, - }); - return - } } // 测评模块 请求接口跳转新的页面 - 新增 暂时未调试 目前无测评数据 2023-02-04 if (d.type == 10) { - - // 此处判断测评跳转详情界面 router.push({ path: '/evaluation', @@ -525,27 +474,22 @@ async function toFinish(d) { }); return } + const path = typeof TASK_TYPES.path[d.type] === "string" ? TASK_TYPES.path[d.type] : TASK_TYPES.path[d.type](d); + path && path.startsWith("http") ? window.open(path + d.targetId, '_top') : path.startsWith("/") ? + router.push({ + path, + query: { + id: d.id, + type: ROUTER, + infoId: routerId, + courseId: d.courseId, + pName: data.value.name, + sName: data.value.currentStageName, + chapterOrStageId: data.value.currentStageId, + btype: 2 + }, + }) : '' - if (typeof TASK_TYPES.path[d.type] === "string") { - TASK_TYPES.path[d.type] && TASK_TYPES.path[d.type].startsWith("http") && window.open(TASK_TYPES.path[d.type] + d.targetId, '_top'); - //任务列表 加载 - TASK_TYPES.path[d.type] && TASK_TYPES.path[d.type].startsWith("/") && - router.push({ - path: TASK_TYPES.path[d.type], - query: { - id: d.id, - type: ROUTER, - infoId: routerId, - courseId: d.courseId, - pName: data.value.name, - sName: data.value.currentStageName, - chapterOrStageId: data.value.currentStageId, - btype: 2 - }, - }); - } else if (typeof TASK_TYPES.path[d.type] === "function") { - TASK_TYPES.path[d.type](d); - } }