This commit is contained in:
yuping
2023-02-22 04:00:32 +08:00
parent 0b5b3be7d2
commit 32d9130bf0
2 changed files with 26 additions and 82 deletions

View File

@@ -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);
}
}