fix: 修复跳转异常

This commit is contained in:
2025-09-23 19:48:18 +08:00
parent 0f4959d80b
commit 9b9dd8499d

View File

@@ -1,12 +1,12 @@
<template>
<div class="projectdetails">
<!-- <ReturnHead-->
<!-- text="项目详情"-->
<!-- :showfile="true"-->
<!-- :courseId="projectId || courseId"-->
<!-- :type="1"-->
<!-- :gohome="type == 1 ? true : false"-->
<!-- ></ReturnHead>-->
<!-- <ReturnHead-->
<!-- text="项目详情"-->
<!-- :showfile="true"-->
<!-- :courseId="projectId || courseId"-->
<!-- :type="1"-->
<!-- :gohome="type == 1 ? true : false"-->
<!-- ></ReturnHead>-->
<div class="main">
<div class="up">
<!-- <div class="notice">
@@ -167,7 +167,7 @@
<div
v-if="data.unlockMode === 1"
class="goclass"
@click.prevent="
@click="
toFinish(el, item.stageName, item.id, item.studyModel, $event)
"
:style="{
@@ -188,7 +188,7 @@
<div
v-else
class="goclass"
@click.prevent="
@click="
toFinish(el, item.stageName, item.id, item.studyModel)
"
:style="{
@@ -313,59 +313,55 @@
</template>
<script setup>
import { computed, reactive, ref, watch, onMounted } from "vue";
import { ElLoading } from "element-plus";
import { useRequest, request } from "@/api/request";
import {computed, onMounted, ref, watch} from "vue";
import {ElMessage} from "element-plus";
import {request, useRequest} from "@/api/request";
import {
PROJECT_PROCESS,
STUDY_RECORD,
PROJECT_DETAIL,
SubmitExternalExam,
UPDATE_CURRENT_TASK,
checkStudentExist,
EvaluationToLearn,
QueryEvaluationTaskStatusOne,
SubmitExternalExam,
UPDATE_CURRENT_TASK,
} from "@/api/api";
import { useRoute, useRouter } from "vue-router";
import {useRoute, useRouter} from "vue-router";
import store from "@/store";
import { ElMessage } from "element-plus";
import ReturnHead from "@/components/ReturnHead.vue";
import { PROJECT, TASK_TYPES } from "@/api/CONST";
import {PROJECT, TASK_TYPES} from "@/api/CONST";
import dayjs from "dayjs";
import { useStore } from "vuex";
import { changeTime } from "@/api/method";
import {useStore} from "vuex";
import {changeTime} from "@/api/method";
const {
query: { courseId, projectId, type, infoId, chapterOrStageId, id },
query: {courseId, projectId, type, infoId, chapterOrStageId, id},
} = useRoute();
const router = useRouter();
const { commit, dispatch, state } = useStore();
const {commit, dispatch, state} = useStore();
const data = computed(() => state.projectInfo);
useRequest(
checkStudentExist,
{
targetId: type == 1 ? projectId : infoId,
type: type,
chapterId: chapterOrStageId,
courseId: id,
},
(res) => {
console.log("判断任务是否删除", res);
if (res.code === 7) {
useRequest(
checkStudentExist,
{
targetId: type == 1 ? projectId : infoId,
type: type,
chapterId: chapterOrStageId,
courseId: id,
},
(res) => {
console.log("判断任务是否删除", res);
if (res.code === 7) {
router.push({
path: "/loseEfficacyProject",
query: {
msg: res.message,
},
});
} else {
if (res.code === 6) {
router.push({
path: "/loseEfficacyProject",
query: {
msg: res.message,
},
path: "/notpath",
});
} else {
if (res.code === 6) {
router.push({
path: "/notpath",
});
}
}
}
);
}
);
watch(data, () => {
if (data.value.code === 6) {
router.push({
@@ -375,7 +371,7 @@ watch(data, () => {
});
onMounted(() => {
sessionStorage.setItem("projectid", projectId)
dispatch("getProjectInfo", { projectId, type });
dispatch("getProjectInfo", {projectId, type});
});
watch(
() => data.value.stageProcessList,
@@ -387,7 +383,7 @@ watch(
console.log("改变data", data);
}
},
{ deep: true }
{deep: true}
);
// watch(data, () => {
// console.log("data.value.projectId", data.value);
@@ -422,6 +418,7 @@ function getTaskStatus(d) {
}
return "进行中";
}
console.log("datadata", data);
const openCourseVisible = ref(false);
const openCourseList = ref([]);
@@ -432,7 +429,7 @@ const activeName = ref("first");
const handleClick = (tab, event) => {
console.log(tab, event);
};
const path = { 1: "path" };
const path = {1: "path"};
const types = ref({
typeName: {
1: "在线",
@@ -466,7 +463,7 @@ const types = ref({
},
path: {
1: window.location.protocol + import.meta.env.VITE_BOE_ONLINE_CLASS_URL, //在线
2: ({ targetId }) =>
2: ({targetId}) =>
window.open(
`${location.protocol}//${location.host}${
import.meta.env.VITE_BASE_API
@@ -513,42 +510,42 @@ function judgeTaskIsEnd(type, endTimes, status) {
status == -1
? (isEnd = true)
: nowTime > endTime
? (isEnd = true)
: (isEnd = false);
? (isEnd = true)
: (isEnd = false);
break;
case 3:
status == -1
? (isEnd = true)
: nowTime > endTime
? (isEnd = true)
: (isEnd = false);
? (isEnd = true)
: (isEnd = false);
break;
case 5:
status == -1
? (isEnd = true)
: nowTime > endTime
? (isEnd = true)
: (isEnd = false);
? (isEnd = true)
: (isEnd = false);
break;
case 7:
status == -1
? (isEnd = true)
: nowTime > endTime
? (isEnd = true)
: (isEnd = false);
? (isEnd = true)
: (isEnd = false);
break;
case 10:
status == -1
? (isEnd = true)
: nowTime > endTime
? (isEnd = true)
: (isEnd = false);
? (isEnd = true)
: (isEnd = false);
break;
}
return isEnd;
}
function toFinish(d, sName, chapterOrStageId, studyModel,e) {
function toFinish(d, sName, chapterOrStageId, studyModel, e) {
if (studyModel != 0 && !d.statusName) {
ElMessage.warning("当前未解锁");
return;
@@ -751,7 +748,7 @@ function toFinish(d, sName, chapterOrStageId, studyModel,e) {
type: PROJECT,
pid: projectId,
name: d.name,
}).then(()=>{
}).then(() => {
if (typeof TASK_TYPES.path[d.type] === "string") {
console.log("TASK_TYPES.path[d.type]", TASK_TYPES.path[d.type]);
TASK_TYPES.path[d.type] &&
@@ -779,21 +776,20 @@ function toFinish(d, sName, chapterOrStageId, studyModel,e) {
});
} else if (typeof TASK_TYPES.path[d.type] === "function") {
if (d.type == 5) {
// 模拟点击跳转
const url = TASK_TYPES.path[d.type](d) + d.targetId
if (isIOS()){
// 模拟点击跳转
const a = document.createElement("a");
a.href = url;
// a.target = "_blank";
a.click();
const a = document.createElement("a");
a.href = url;
// a.target = "_blank";
a.click();
// 保底解决兼容问题
window.open(url, "_top");
} else {
TASK_TYPES.path[d.type](d);
// 保底解决兼容问题
window.open(url, "_top");
} else {
TASK_TYPES.path[d.type](d);
}
}
}}})
})
// if (typeof types.value.path[d.type] === "string") {
// types.value.path[d.type] &&
// types.value.path[d.type].startsWith("http") &&
@@ -822,13 +818,14 @@ function toFinish(d, sName, chapterOrStageId, studyModel,e) {
// }
}
function toOffcoursePlanPage(id){
function toOffcoursePlanPage(id) {
window.open(`${location.protocol}//${location.host}${import.meta.env.VITE_BASE_API}/stu/project/redirectDetail?courseId=${id}`, '_top')
}
function whiteTypes(type) {
return import.meta.env.VITE_TASK_WHITE_TYPE.includes("-" + type + "-");
}
// 查询当前阶段所有任务是否都完成
const queryAllStatus = (data) => {
// status === 1 已完成
@@ -847,19 +844,23 @@ const queryAllStatus = (data) => {
.el-dialog__body {
width: 80%;
}
.el-dialog__header {
display: none;
}
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
.main {
width: 100%;
display: flex;
flex-direction: column;
//justify-content: center;
margin-top: 10px;
.up {
width: 100%;
height: 162px;
@@ -868,6 +869,7 @@ const queryAllStatus = (data) => {
align-items: center;
//justify-content: center;
background-color: rgba(255, 255, 255, 1);
.notice {
background-color: rgba(255, 251, 238, 1);
width: 100%;
@@ -875,6 +877,7 @@ const queryAllStatus = (data) => {
display: flex;
justify-content: center;
position: relative;
.text {
//display: flex;
height: 25px;
@@ -887,6 +890,7 @@ const queryAllStatus = (data) => {
text-overflow: ellipsis;
overflow: hidden;
}
.close {
display: flex;
position: absolute;
@@ -900,10 +904,12 @@ const queryAllStatus = (data) => {
margin-bottom: 8px;
}
}
.content {
width: 90%;
display: flex;
flex-direction: column;
.title {
margin-top: 15.5px;
font-size: 14px;
@@ -911,6 +917,7 @@ const queryAllStatus = (data) => {
line-height: 21.6px;
color: rgba(4, 36, 60, 1);
}
.text2 {
display: flex;
margin-top: 10px;
@@ -923,6 +930,7 @@ const queryAllStatus = (data) => {
}
}
}
.down {
width: 100%;
margin-top: 11.5px;
@@ -932,6 +940,7 @@ const queryAllStatus = (data) => {
align-items: center;
//justify-content: center;
background-color: rgba(255, 255, 255, 1);
.project_title {
width: calc(100% - 36.5px);
display: flex;
@@ -942,12 +951,14 @@ const queryAllStatus = (data) => {
padding: 17px 0 17px 36.5px;
border-bottom: 0.5px solid rgba(241, 242, 243, 1);
}
.project_first {
width: 90%;
display: flex;
flex-direction: column;
align-items: center;
margin-top: 18px;
.course1_first {
width: 100%;
height: 35px;
@@ -955,6 +966,7 @@ const queryAllStatus = (data) => {
justify-content: content;
border-radius: 10px;
background-color: #f9f9f9;
.text8 {
display: flex;
flex: 1;
@@ -966,6 +978,7 @@ const queryAllStatus = (data) => {
font-weight: 600;
color: #333330;
}
.course1_right {
display: flex;
position: relative;
@@ -982,6 +995,7 @@ const queryAllStatus = (data) => {
border-radius: 7px;
border: 1px solid #0060ff;
}
.text9 {
display: flex;
justify-content: content;
@@ -996,6 +1010,7 @@ const queryAllStatus = (data) => {
font-size: 13px;
font-weight: 600;
}
.btn1 {
width: 7px;
height: 6px;
@@ -1006,28 +1021,33 @@ const queryAllStatus = (data) => {
}
}
}
.course_content {
width: 90%;
display: flex;
flex-direction: column;
justify-content: center;
margin-top: 26.5px;
.study1 {
display: flex;
//justify-content: center;
width: 100%;
margin-bottom: 15px;
.firstclass {
display: flex;
width: 74px;
height: 43px;
background-image: url(../../assets/image/pathmap/firstclass.png);
}
.firstprogress {
display: flex;
flex: 1;
position: relative;
margin-left: 9.5px;
.firsttext {
position: absolute;
//top: 6px;
@@ -1039,6 +1059,7 @@ const queryAllStatus = (data) => {
text-overflow: ellipsis;
overflow: hidden;
}
.secondtext {
position: absolute;
//top: 6px;
@@ -1047,6 +1068,7 @@ const queryAllStatus = (data) => {
line-height: 30.29px;
color: rgba(39, 122, 255, 1);
}
.progressbox {
width: 100%;
position: absolute;
@@ -1055,33 +1077,38 @@ const queryAllStatus = (data) => {
bottom: 4px;
background-color: rgba(232, 241, 254, 1);
border-radius: 2px;
.progressboxpart {
width: 70%;
height: 6.4px;
border-radius: 2px;
background: linear-gradient(
-180deg,
rgba(36, 120, 255, 1),
rgba(80, 147, 255, 1)
-180deg,
rgba(36, 120, 255, 1),
rgba(80, 147, 255, 1)
);
}
}
}
}
.study2 {
display: flex;
width: 100%;
margin-bottom: 15px;
.secondclass {
width: 74px;
height: 43px;
background-image: url(../../assets/image/pathmap/secondclass.png);
}
.secondprogress {
display: flex;
flex: 1;
position: relative;
margin-left: 9.5px;
.firsttext {
position: absolute;
//top: 6px;
@@ -1093,6 +1120,7 @@ const queryAllStatus = (data) => {
text-overflow: ellipsis;
overflow: hidden;
}
.secondtext {
position: absolute;
//top: 6px;
@@ -1101,6 +1129,7 @@ const queryAllStatus = (data) => {
line-height: 30.29px;
color: rgba(39, 122, 255, 1);
}
.progressbox {
width: 100%;
position: absolute;
@@ -1109,14 +1138,15 @@ const queryAllStatus = (data) => {
bottom: 4px;
background-color: rgba(232, 241, 254, 1);
border-radius: 2px;
.progressboxpart {
width: 52%;
height: 6.4px;
border-radius: 2px;
background: linear-gradient(
-180deg,
rgba(36, 120, 255, 1),
rgba(80, 147, 255, 1)
-180deg,
rgba(36, 120, 255, 1),
rgba(80, 147, 255, 1)
);
}
}
@@ -1124,12 +1154,14 @@ const queryAllStatus = (data) => {
}
}
}
.project_second {
width: 90%;
display: flex;
flex-direction: column;
align-items: center;
margin-top: 10.5px;
.course1_first {
width: 100%;
height: 35px;
@@ -1137,6 +1169,7 @@ const queryAllStatus = (data) => {
justify-content: content;
border-radius: 10px;
background-color: #f9f9f9;
.text8 {
display: flex;
flex: 1;
@@ -1148,6 +1181,7 @@ const queryAllStatus = (data) => {
font-weight: 600;
color: #333330;
}
.course1_right {
display: flex;
position: relative;
@@ -1164,6 +1198,7 @@ const queryAllStatus = (data) => {
border-radius: 7px;
border: 1px solid #0060ff;
}
.text9 {
display: flex;
justify-content: content;
@@ -1178,6 +1213,7 @@ const queryAllStatus = (data) => {
font-size: 13px;
font-weight: 600;
}
.btn1 {
width: 7px;
height: 6px;
@@ -1188,12 +1224,14 @@ const queryAllStatus = (data) => {
}
}
}
.secondcontent {
width: 90%;
display: flex;
flex-direction: column;
justify-content: center;
margin-top: 10px;
.question {
width: 100%;
display: flex;
@@ -1215,10 +1253,12 @@ const queryAllStatus = (data) => {
text-overflow: ellipsis;
white-space: nowrap;
}
.coursetag {
display: flex;
flex-wrap: wrap;
}
.goclass {
width: 63px;
height: 23px;
@@ -1234,6 +1274,7 @@ const queryAllStatus = (data) => {
// margin-right: 37px;
cursor: pointer;
}
// .tag1 {
// position: absolute;
// left: 0;
@@ -1277,6 +1318,7 @@ const queryAllStatus = (data) => {
}
}
}
.last {
width: 100%;
margin-top: 11.5px;
@@ -1284,6 +1326,7 @@ const queryAllStatus = (data) => {
flex-direction: column;
align-items: center;
background-color: rgba(255, 255, 255, 1);
.project_title {
width: calc(100% - 36.5px);
display: flex;
@@ -1294,6 +1337,7 @@ const queryAllStatus = (data) => {
padding: 17px 0 17px 36.5px;
border-bottom: 0.5px solid rgba(241, 242, 243, 1);
}
.ranking {
width: 90%;
display: flex;
@@ -1302,11 +1346,13 @@ const queryAllStatus = (data) => {
border-radius: 10px;
background-color: rgba(242, 245, 247, 1);
margin-bottom: 13.5px;
.rankingbox {
width: 90%;
display: flex;
flex-direction: column;
align-items: center;
.ranknumber {
width: 100%;
height: 50px;
@@ -1314,6 +1360,7 @@ const queryAllStatus = (data) => {
position: relative;
align-items: center;
border-bottom: 0.5px solid rgba(223, 223, 223, 1);
.describe {
display: flex;
position: absolute;
@@ -1322,6 +1369,7 @@ const queryAllStatus = (data) => {
line-height: 24px;
color: rgba(51, 51, 48, 1);
}
.number {
display: flex;
position: absolute;
@@ -1331,6 +1379,7 @@ const queryAllStatus = (data) => {
line-height: 24px;
color: rgba(0, 96, 255, 1);
}
.describe_part {
display: flex;
position: absolute;