fix: 修复火狐重定向时报错

This commit is contained in:
2025-09-23 15:27:16 +08:00
parent f4ead35b0b
commit 2693e2f3a6

View File

@@ -167,8 +167,8 @@
<div <div
v-if="data.unlockMode === 1" v-if="data.unlockMode === 1"
class="goclass" class="goclass"
@click=" @click.prevent="
toFinish(el, item.stageName, item.id, item.studyModel) toFinish(el, item.stageName, item.id, item.studyModel, $event)
" "
:style="{ :style="{
background: background:
@@ -188,7 +188,7 @@
<div <div
v-else v-else
class="goclass" class="goclass"
@click=" @click.prevent="
toFinish(el, item.stageName, item.id, item.studyModel) toFinish(el, item.stageName, item.id, item.studyModel)
" "
:style="{ :style="{
@@ -550,7 +550,7 @@ function judgeTaskIsEnd(type, endTimes, status) {
return isEnd; return isEnd;
} }
function toFinish(d, sName, chapterOrStageId, studyModel) { function toFinish(d, sName, chapterOrStageId, studyModel,e) {
if (studyModel != 0 && !d.statusName) { if (studyModel != 0 && !d.statusName) {
ElMessage.warning("当前未解锁"); ElMessage.warning("当前未解锁");
return; return;
@@ -753,14 +753,13 @@ function toFinish(d, sName, chapterOrStageId, studyModel) {
type: PROJECT, type: PROJECT,
pid: projectId, pid: projectId,
name: d.name, name: d.name,
}); }).then(()=>{
if (typeof TASK_TYPES.path[d.type] === "string") {
if (typeof TASK_TYPES.path[d.type] === "string") { console.log("TASK_TYPES.path[d.type]", TASK_TYPES.path[d.type]);
console.log("TASK_TYPES.path[d.type]", TASK_TYPES.path[d.type]); TASK_TYPES.path[d.type] &&
TASK_TYPES.path[d.type] &&
TASK_TYPES.path[d.type].startsWith("http") && TASK_TYPES.path[d.type].startsWith("http") &&
window.open(TASK_TYPES.path[d.type] + d.targetId, "_top"); window.open(TASK_TYPES.path[d.type] + d.targetId, "_top");
TASK_TYPES.path[d.type] && TASK_TYPES.path[d.type] &&
TASK_TYPES.path[d.type].startsWith("/") && TASK_TYPES.path[d.type].startsWith("/") &&
router.push({ router.push({
path: TASK_TYPES.path[d.type], path: TASK_TYPES.path[d.type],
@@ -780,21 +779,23 @@ function toFinish(d, sName, chapterOrStageId, studyModel) {
quizTaskId: d.quizTaskId, quizTaskId: d.quizTaskId,
}, },
}); });
} else if (typeof TASK_TYPES.path[d.type] === "function") { } else if (typeof TASK_TYPES.path[d.type] === "function") {
if (d.type == 5) { if (d.type == 5) {
// 模拟点击跳转
const url = TASK_TYPES.path[d.type](d) + d.targetId const url = TASK_TYPES.path[d.type](d) + d.targetId
const a = document.createElement("a"); if (isIOS()){
a.href = url; // 模拟点击跳转
// a.target = "_blank"; const a = document.createElement("a");
a.click(); a.href = url;
// a.target = "_blank";
a.click();
// 保底解决兼容问题 // 保底解决兼容问题
window.open(url, "_top"); window.open(url, "_top");
} else { } else {
TASK_TYPES.path[d.type](d); TASK_TYPES.path[d.type](d);
} }
} }}})
// if (typeof types.value.path[d.type] === "string") { // if (typeof types.value.path[d.type] === "string") {
// types.value.path[d.type] && // types.value.path[d.type] &&
// types.value.path[d.type].startsWith("http") && // types.value.path[d.type].startsWith("http") &&