This commit is contained in:
Pengxiansen
2025-02-14 15:44:59 +08:00
parent 535a1ad419
commit 8daf1d5374
2 changed files with 399 additions and 57 deletions

View File

@@ -90,7 +90,7 @@
{{ TASK_TYPES.typeName[value.courseType] || "" }}
</div>
</div>
<div class="progressBox">
<div class="progressBox">
<div>当前进度</div>
<div class="progress">
<div style="width: 291px">
@@ -130,7 +130,7 @@
@click="toFinish(value)"
style="background: #2478ff"
>
{{TASK_TYPES.toName[value.courseType]}}
{{ TASK_TYPES.toName[value.courseType] }}
</div>
</template>
<template v-if="value.completionStatus === '1'">
@@ -201,7 +201,7 @@
</div>
</div>
</div>
<div class="info" style="padding-top: 20px">
<div class="info" style="padding: 20px 0">
<div class="title">
<img
style="width: 18px; height: 17px"
@@ -211,12 +211,12 @@
<div class="box"></div>
</div>
<div class="rate" v-if="data?.lastLearned">
<div class="ratetext">上次学到{{ data?.lastLearned }}</div>
<div class="rate" v-if="lastLearned">
<div class="ratetext">上次学到{{ lastLearned.taskName }}</div>
<div
v-if="data?.lastLearned"
v-if="lastLearned"
class="ratebtn"
@click="continueLearn(data?.lastLearnedId)"
@click="toFinish(lastLearned)"
>
继续学习
</div>
@@ -459,14 +459,12 @@ import { ElMessage } from "element-plus";
import { request } from "@/api/request";
import { growthRequest } from "@/api/growthRequest";
import {
CompletionList,
EvaluationToLearn,
PointList,
QueryEvaluationTaskStatusOne,
STUDY_RECORD,
SubmitExternalExam,
UPDATE_CURRENT_TASK,
PROFESSIONAL_STUDENT_TASKLIST,
PROFESSIONAL_STUDENT_LEARN,
} from "@/api/api";
import { useRoute, useRouter } from "vue-router";
import { GROWTH, TASK_TYPES } from "@/api/CONST";
@@ -481,7 +479,9 @@ const { commit, dispatch, state } = useStore();
const userInfo = computed(() => state.userInfo);
const data = computed(() => state.growthInfo);
const errorData = computed(() => state.projectError);
const lastLearned = computed(() =>
stageProcessList.value.find((item) => item.lastStudy)
);
// 查询条件
const queryParams = reactive({
type: 1,
@@ -597,11 +597,16 @@ const openCourseIdList = ref([]);
const dialogVisible = ref(false);
const dialogVisibleTip = ref("该任务无法学习,请联系管理员进行替换!");
async function toFinish(d, sName, chapterOrStageId, studyModel) {
async function toFinish(d) {
if (d.completionStatus == 10) {
ElMessage.warning("当前未解锁");
return;
}
//更新学员当前任务
await growthRequest(PROFESSIONAL_STUDENT_LEARN, {
growthId: routerId,
taskId: d.taskId,
});
if (d.courseType === "2") {
if (!d.targetId) {
@@ -614,6 +619,7 @@ async function toFinish(d, sName, chapterOrStageId, studyModel) {
return;
}
}
// 作业过期判断
if (d.courseType == 4) {
let date1 = new Date(d.info.submitEndTime).getTime();
@@ -626,7 +632,7 @@ async function toFinish(d, sName, chapterOrStageId, studyModel) {
}
// 直播结束时间
if (d.courseType == 6) {
let date1 = new Date(d.endTime).getTime();
let date1 = new Date(d.info.liveEndTime).getTime();
let date2 = new Date().getTime();
if (date1 < date2) {
dialogVisibleTip.value = "当前直播已结束";
@@ -670,10 +676,10 @@ async function toFinish(d, sName, chapterOrStageId, studyModel) {
return;
}
}
// 其他活动 结束时间
if (d.courseType == 9) {
let date1 = new Date(d.endTime).getTime();
let date1 = new Date(d.info.activityEndTime).getTime();
let date2 = new Date().getTime();
if (date1 < date2) {
dialogVisibleTip.value = "当前活动已结束";
@@ -681,26 +687,17 @@ async function toFinish(d, sName, chapterOrStageId, studyModel) {
//return
}
}
// 测评模块 请求接口跳转新的页面 - 新增 暂时未调试 目前无测评数据 2023-02-04
if (d.courseType == 10) {
if (d.quizTaskId == null) {
if (d.completionStatus != 1) {
// 肯定没有完成测评
// 调用接口 跳转页面
console.log("我是查询测评跳转链接所传递得参数", {
businessType: "project",
chapterId: 0,
courseId: d.courseId,
quizKid: d.targetId,
routerOrProjectId: routerId,
studentId: userInfo.value.id,
studentName: userInfo.value.realName,
});
request(EvaluationToLearn, {
businessType: "project",
chapterId: 0,
courseId: d.courseId,
quizKid: d.targetId,
quizKid: d.info.evaluationTypeId,
routerOrProjectId: routerId,
studentId: userInfo.value.id,
studentName: userInfo.value.realName,
@@ -739,7 +736,7 @@ async function toFinish(d, sName, chapterOrStageId, studyModel) {
businessType: "project",
chapterId: 0,
courseId: d.courseId,
quizKid: d.targetId,
quizKid: d.info.evaluationTypeId,
routerOrProjectId: routerId,
studentId: userInfo.value.id,
studentName: userInfo.value.realName,
@@ -748,7 +745,7 @@ async function toFinish(d, sName, chapterOrStageId, studyModel) {
businessType: "project",
chapterId: 0,
courseId: d.courseId ? d.courseId : d.info.id,
quizKid: d.targetId,
quizKid: d.info.evaluationTypeId,
routerOrProjectId: routerId,
studentId: userInfo.value.id,
studentName: userInfo.value.realName,
@@ -779,13 +776,7 @@ async function toFinish(d, sName, chapterOrStageId, studyModel) {
ElMessage.error("暂时未开放");
return;
}
//更新学员当前任务
await request(UPDATE_CURRENT_TASK, {
id: d.id,
type: GROWTH,
pid: routerId,
name: d.taskName,
});
if (
d.courseType == 3 ||
d.courseType == 7 ||
@@ -802,6 +793,7 @@ async function toFinish(d, sName, chapterOrStageId, studyModel) {
taskType: d.courseType,
});
}
if (typeof TASK_TYPES.path[d.courseType] === "string") {
TASK_TYPES.path[d.courseType] &&
TASK_TYPES.path[d.courseType].startsWith("http") &&
@@ -813,6 +805,7 @@ async function toFinish(d, sName, chapterOrStageId, studyModel) {
query: {
id: d.id,
type: GROWTH,
projectId: d.courseId,
infoId: data.value.id,
courseId: d.courseId ? d.courseId : d.info.id,
pName: data.value.growthName,
@@ -847,17 +840,6 @@ function toOffcoursePlanPage(id) {
"_top"
);
}
// 继续学习
function continueLearn(lastLearnedId) {
data.value.stageProcessList.forEach((stage) => {
stage?.taskProcessList?.forEach((d) => {
if (d.id == lastLearnedId) {
toFinish(d, stage.stageName, stage.stageId);
}
});
});
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style lang="scss">
@@ -1110,6 +1092,7 @@ function continueLearn(lastLearnedId) {
align-items: center;
flex-direction: column;
font-size: 18px;
cursor: pointer;
font-weight: 700;
}
.tabs-line {

View File

@@ -84,11 +84,19 @@
:style="{
width:
item.completionStatus === '2' ? '360px' : '224px',
color: item.completionStatus === '0' ? '#333' : '#fff',
color:
item.completionStatus === '0' ||
item.completionStatus === '10'
? '#333'
: '#fff',
}"
class="progress-text"
>
{{ item.taskName }}
{{
`${item.taskName}${
item.completionStatus === "10" ? "(未解锁)" : ""
}`
}}
</div>
</div>
<div class="horizontal-line"></div>
@@ -114,7 +122,12 @@
src="@/assets/image/growth/growth-icon2.png"
/>
</template>
<template v-else-if="item.completionStatus === '0'">
<template
v-else-if="
item.completionStatus === '0' ||
item.completionStatus === '10'
"
>
<img
style="width: 100%; height: 100%"
src="@/assets/image/growth/growth-icon3.png"
@@ -153,11 +166,19 @@
:style="{
width:
item.completionStatus === '2' ? '360px' : '224px',
color: item.completionStatus === '0' ? '#333' : '#fff',
color:
item.completionStatus === '0' ||
item.completionStatus === '10'
? '#333'
: '#fff',
}"
class="progress-text"
>
{{ item.taskName }}
{{
`${item.taskName}${
item.completionStatus === "10" ? "(未解锁)" : ""
}`
}}
</div>
</div>
</template>
@@ -176,18 +197,111 @@
</template>
</div>
</div>
<!-- 开课列表弹框 -->
<el-dialog
title=""
top="347px"
v-model="openCourseVisible"
:show-close="false"
style="
display: flex;
justify-content: center;
align-items: center;
min-height: 320px;
padding: 0;
border-radius: 4px;
"
width="502px"
>
<div
style="
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 22px;
"
>
<div
style="
width: 288px;
color: #333333;
font-size: 16px;
font-weight: 600;
"
>
开课列表
</div>
<div
@click="openCourseVisible = false"
style="font-size: 12px; cursor: pointer"
>
X
</div>
</div>
<div style="width: 100%; min-height: 210px; margin-top: 12px">
<div
v-for="(item, key) in openCourseList"
style="
width: 100%;
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 12px;
background: rgb(247, 251, 253);
height: 40px;
padding: 5px;
border-radius: 5px;
"
>
<div
style="
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
width: 320px;
"
>
{{ item }}
</div>
<div
@click="toOffcoursePlanPage(openCourseIdList[key])"
style="
width: 60px;
height: 30px;
text-align: center;
line-height: 30px;
background: #0078fc;
border-radius: 5px;
color: #fff;
cursor: pointer;
"
>
去上课
</div>
</div>
</div>
</el-dialog>
</div>
</template>
<script setup>
import { computed, reactive, onMounted, onUnmounted, ref } from "vue";
import { useRoute } from "vue-router";
import { useRoute, useRouter } from "vue-router";
import { request } from "@/api/request";
import { useRequest, growthRequest } from "@/api/growthRequest";
import { useStore } from "vuex";
import { ElMessage } from "element-plus";
import { GROWTH, TASK_TYPES } from "@/api/CONST";
import {
EvaluationToLearn,
QueryEvaluationTaskStatusOne,
STUDY_RECORD,
SubmitExternalExam,
PROFESSIONAL_STUDENT_TASKLIST,
PROFESSIONAL_STUDENT_LEARN,
} from "@/api/api";
const router = useRouter();
const { commit, dispatch, state } = useStore();
const userInfo = computed(() => state.userInfo);
const data = computed(() => state.growthInfo);
@@ -230,11 +344,256 @@ onMounted(() => {
dispatch("getGrowthInfo", { routerId });
});
function toFinish(item) {
growthRequest(PROFESSIONAL_STUDENT_LEARN, {
const openCourseVisible = ref(false);
const openCourseList = ref([]);
const openCourseIdList = ref([]);
const dialogVisible = ref(false);
const dialogVisibleTip = ref("该任务无法学习,请联系管理员进行替换!");
async function toFinish(d) {
if (d.completionStatus == 10) {
ElMessage.warning("当前未解锁");
return;
}
//更新学员当前任务
await growthRequest(PROFESSIONAL_STUDENT_LEARN, {
growthId: routerId,
taskId: item.taskId,
taskId: d.taskId,
});
if (d.courseType === "2") {
if (!d.targetId) {
return ElMessage.error("还未添加开课,请联系管理员!");
}
if (d.targetId.split(",").length > 1) {
openCourseList.value = d.targetName?.split(",");
openCourseIdList.value = d.targetId?.split(",");
openCourseVisible.value = true;
return;
}
}
// 作业过期判断
if (d.courseType == 4) {
let date1 = new Date(d.info.submitEndTime).getTime();
let date2 = new Date().getTime();
if (date1 < date2) {
dialogVisibleTip.value = "当前作业已结束";
dialogVisible.value = true;
//return
}
}
// 直播结束时间
if (d.courseType == 6) {
let date1 = new Date(d.info.liveEndTime).getTime();
let date2 = new Date().getTime();
if (date1 < date2) {
dialogVisibleTip.value = "当前直播已结束";
dialogVisible.value = true;
//return
}
}
// 考试 停用
if (d.courseType == 5) {
// 此处判断外部考试跳转
if (d.info.examType == 2) {
// 点击即更新状态 进行中
request(SubmitExternalExam, {
type: 1,
taskId: d.id,
chapterId: 0,
externalId: d.courseId,
externalName: d.taskName,
targetId: data.value.id,
studentNo: userInfo.value.userNo,
})
.then((res) => {
console.log(res);
})
.catch((err) => {
console.log(err);
});
router.push({
path: "/externalexamination",
query: {
id: d.id,
type: GROWTH,
infoId: data.value.id,
courseId: d.courseId ? d.courseId : d.info.id,
pName: data.value.growthName,
sName: d.taskName,
chapterOrStageId: 0,
exname: d.info.examinationTestName, // 考试名称
},
});
return;
}
}
// 其他活动 结束时间
if (d.courseType == 9) {
let date1 = new Date(d.info.activityEndTime).getTime();
let date2 = new Date().getTime();
if (date1 < date2) {
dialogVisibleTip.value = "当前活动已结束";
dialogVisible.value = true;
//return
}
}
// 测评模块 请求接口跳转新的页面 - 新增 暂时未调试 目前无测评数据 2023-02-04
if (d.courseType == 10) {
if (d.completionStatus != 1) {
// 肯定没有完成测评
// 调用接口 跳转页面
request(EvaluationToLearn, {
businessType: "project",
chapterId: 0,
courseId: d.courseId,
quizKid: d.info.evaluationTypeId,
routerOrProjectId: routerId,
studentId: userInfo.value.id,
studentName: userInfo.value.realName,
})
.then((res) => {
console.log(res);
if (res.code == 200) {
let jumpUrl = res.data.quizUrl;
// 此处写跳转url
window.open(jumpUrl, "_top");
}
})
.catch((err) => {
console.log(err);
});
return;
} else {
// 进行中 或者 已完成
// 调用接口 判断当前测评状态 跳转页面
console.log("我是查询测评跳转链接所传递得参数", {
quizTaskId: d.quizTaskId,
});
request(QueryEvaluationTaskStatusOne, {
quizTaskId: d.quizTaskId,
})
.then((res) => {
console.log(res);
if (res.code == 200) {
if (res.data.complete_status == 2) {
ElMessage.error("您已完成测评");
return;
} else {
// 重新查询跳转
// 调用接口 跳转页面
console.log("我是查询测评跳转链接所传递得参数", {
businessType: "project",
chapterId: 0,
courseId: d.courseId,
quizKid: d.info.evaluationTypeId,
routerOrProjectId: routerId,
studentId: userInfo.value.id,
studentName: userInfo.value.realName,
});
request(EvaluationToLearn, {
businessType: "project",
chapterId: 0,
courseId: d.courseId ? d.courseId : d.info.id,
quizKid: d.info.evaluationTypeId,
routerOrProjectId: routerId,
studentId: userInfo.value.id,
studentName: userInfo.value.realName,
})
.then((res) => {
console.log(res);
if (res.code == 200) {
let jumpUrl = res.data.quizUrl;
// 此处写跳转url
window.open(jumpUrl, "_top");
}
})
.catch((err) => {
console.log(err);
});
return;
}
}
})
.catch((err) => {
console.log(err);
});
return;
}
}
if (!TASK_TYPES.path[d.courseType]) {
ElMessage.error("暂时未开放");
return;
}
if (
d.courseType == 3 ||
d.courseType == 7 ||
(d.courseType == 5 && d.examType == 2)
) {
console.log(d, data.value);
await request(STUDY_RECORD, {
studentId: userInfo.value.id,
targetId: data.value.id,
logo: GROWTH,
type: GROWTH,
stageOrChapterId: 0,
taskId: d.id,
taskType: d.courseType,
});
}
if (typeof TASK_TYPES.path[d.courseType] === "string") {
TASK_TYPES.path[d.courseType] &&
TASK_TYPES.path[d.courseType].startsWith("http") &&
window.open(TASK_TYPES.path[d.type] + d.targetId, "_top");
TASK_TYPES.path[d.courseType] &&
TASK_TYPES.path[d.courseType].startsWith("/") &&
router.push({
path: TASK_TYPES.path[d.courseType],
query: {
id: d.id,
type: GROWTH,
projectId: d.courseId,
infoId: data.value.id,
courseId: d.courseId ? d.courseId : d.info.id,
pName: data.value.growthName,
sName: d.taskName,
chapterOrStageId: 0,
},
});
} else if (typeof TASK_TYPES.path[d.courseType] === "function") {
if (d.courseType == 5) {
let params = {
examType: d.info.examType,
};
window.open(
TASK_TYPES.path[d.courseType](params) + d.info.examinationPaperId,
"_top"
);
} else {
let params = {
courseId: d.courseId ? d.courseId : d.info.id,
targetId: d.targetId ? d.targetId : "",
};
TASK_TYPES.path[d.courseType](params);
}
}
}
function toOffcoursePlanPage(id) {
window.open(
`${location.protocol}//${location.host}${
import.meta.env.VITE_BASE_API
}/stu/project/redirectDetail?courseId=${id}`,
"_top"
);
}
</script>
@@ -358,7 +717,7 @@ function toFinish(item) {
padding-bottom: 30px;
}
.path-container {
padding: 64px 0;
padding: 48px 0;
}
.tabs {
padding-top: 24px;