fix: open student demo through hash route

bugfix/ai-assessment-evidence-rescore
陈沅 1 month ago
parent c569a98c3b
commit a87707e85f

@ -19,7 +19,7 @@ function receiveTicket(event) {
saveStudentDemoSession(res.data);
window.clearInterval(readyTimer);
window.removeEventListener("message", receiveTicket);
window.location.replace("/index");
window.location.replace("/#/index");
}).catch(() => { message.value = "演示链接已失效,请返回教师端重新打开。"; });
}

@ -578,7 +578,7 @@ async function restoreAllTasksDefaults() {
async function openStudentDemo() {
if (!selectedTeachingClass.value) return;
const child = window.open("/student-demo", "_blank");
const child = window.open("/#/student-demo", "_blank");
if (!child) { proxy?.$modal?.msgError?.("浏览器拦截了演示窗口,请允许弹窗后重试"); return; }
let ticket = "";
let childReady = false;

@ -0,0 +1,12 @@
import assert from "node:assert/strict";
import { readFileSync } from "node:fs";
import { resolve } from "node:path";
const root = resolve(import.meta.dirname, "..");
const teacherTaskPage = readFileSync(resolve(root, "src/views/teacherEnd/trainingTask/index.vue"), "utf8");
const studentDemoPage = readFileSync(resolve(root, "src/views/studentDemo/index.vue"), "utf8");
assert.match(teacherTaskPage, /window\.open\("\/#\/student-demo", "_blank"\)/, "学生端讲解必须通过 Hash 路由打开演示入口");
assert.match(studentDemoPage, /window\.location\.replace\("\/#\/index"\)/, "兑换演示学生会话后必须通过 Hash 路由进入学生首页");
console.log("student demo uses hash routes instead of falling back to the teacher homepage");
Loading…
Cancel
Save