|
|
<template>
|
|
|
<!--
|
|
|
教师端任务评阅右侧预览(脱离 Layout 的独立路由,不渲染顶栏/侧栏)。
|
|
|
|
|
|
必须补齐 .studentLayout 与 section.app-main 两级祖先:
|
|
|
学生端实训页的「新版皮肤」全部以
|
|
|
#app .studentLayout section.app-main:has(.xxx-page) …
|
|
|
作为样式门控前缀。本路由没有走 Layout,天然缺少这两级祖先,
|
|
|
会导致这些新样式集体失配,页面静默退化到全局旧版样式
|
|
|
(步骤导航变 100% 宽竖排、步骤说明文字重新出现、动作按钮配色不一致)。
|
|
|
这里只补空壳容器,不引入顶栏、侧栏或 TagsView。
|
|
|
-->
|
|
|
<div class="studentLayout student-task-preview-root">
|
|
|
<section class="app-main">
|
|
|
<main ref="previewRoot" class="student-task-readonly-preview" @click.capture="guardPreviewInteraction" @keydown.capture="guardPreviewInteraction">
|
|
|
<!-- :key 用 previewKey:同任务换学生时强制重挂载,保证学生页重新按新上下文拉取作答 -->
|
|
|
<component v-if="previewComponent" :is="previewComponent" :key="activePreviewKey" v-bind="previewProps" />
|
|
|
<el-empty v-else :description="emptyDescription" :image-size="112" />
|
|
|
</main>
|
|
|
</section>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
import { ElMessage } from "element-plus";
|
|
|
import { isPreviewAnswerSubmitted, readTrainingReviewPreview } from "@/utils/trainingReviewPreview";
|
|
|
import { getPendingRequestCount } from "@/utils/request";
|
|
|
import { studentTaskPreviewComponentByKey, studentTaskPreviewPropsByKey } from "./studentTaskPreviewMap";
|
|
|
|
|
|
const route = useRoute();
|
|
|
const previewComponent = shallowRef(null);
|
|
|
const previewProps = ref({});
|
|
|
const emptyDescription = ref("正在加载学生任务页面");
|
|
|
const previewRoot = ref();
|
|
|
const activeTaskKey = ref("");
|
|
|
const activePreviewKey = ref("");
|
|
|
const previewBooting = ref(true);
|
|
|
/* 当前预览的学生是否已完成作答:未完成的学生没有内容可看,步骤导航一律不放行 */
|
|
|
const previewStudentSubmitted = ref(false);
|
|
|
const PREVIEW_HEIGHT_MESSAGE = "teacher-task-review-preview-height";
|
|
|
/* 与父页 TaskReviewPanel.vue 约定的热切换协议 */
|
|
|
const PARENT_LOAD_MESSAGE = "teacher-task-review-preview-load";
|
|
|
const PARENT_READY_MESSAGE = "teacher-task-review-preview-ready";
|
|
|
/* 闸门放行后通知父页揭幕(加载遮罩画在教师端预览容器上,不在学生页内) */
|
|
|
const PARENT_LOADED_MESSAGE = "teacher-task-review-preview-loaded";
|
|
|
/* 放行闸门参数:DOM 静默判定窗口 / 最短遮罩时长 / 最长强制放行兜底 */
|
|
|
const SETTLE_DELAY = 350;
|
|
|
const MIN_HOLD = 250;
|
|
|
const FORCE_REVEAL_DELAY = 8000;
|
|
|
let resizeObserver;
|
|
|
let mutationObserver;
|
|
|
let animationFrame;
|
|
|
let loadVersion = 0;
|
|
|
let settleTimer = 0;
|
|
|
let forceRevealTimer = 0;
|
|
|
let bootStartAt = 0;
|
|
|
|
|
|
/*
|
|
|
* 预览 iframe 内禁用 localStorage(中心化隔离,覆盖所有学生页)。
|
|
|
*
|
|
|
* 根因:多个学生实训页有「本地草稿」机制,草稿 key 取当前登录用户——
|
|
|
* 教师预览时所有学生共用教师这一个草稿键。预览学生 A 回显作答会触发
|
|
|
* persistDraft 把 A 的作答写进教师草稿;切换到未作答学生 B 时 loadDraft
|
|
|
* 先行恢复,B 的页面就出现了 A 的答题记录(跨学生数据污染)。
|
|
|
*
|
|
|
* 预览是只读的:用内存假 localStorage 顶替,旧草稿读不到、新写入不留存;
|
|
|
* sessionStorage 不受影响(评阅预览上下文由父页写在 sessionStorage)。
|
|
|
*/
|
|
|
function isolatePreviewStorage() {
|
|
|
if (typeof window === "undefined") return;
|
|
|
try {
|
|
|
const memoryStore = new Map();
|
|
|
const keys = () => Array.from(memoryStore.keys());
|
|
|
const shim = {
|
|
|
getItem: (key) => (memoryStore.has(String(key)) ? memoryStore.get(String(key)) : null),
|
|
|
setItem: (key, value) => { memoryStore.set(String(key), String(value)); },
|
|
|
removeItem: (key) => { memoryStore.delete(String(key)); },
|
|
|
clear: () => memoryStore.clear(),
|
|
|
key: (index) => keys()[index] ?? null,
|
|
|
get length() { return memoryStore.size; },
|
|
|
};
|
|
|
Object.defineProperty(window, "localStorage", { configurable: true, get: () => shim });
|
|
|
} catch (_) {
|
|
|
/* 个别隐私模式下 localStorage 本就不可用,忽略 */
|
|
|
}
|
|
|
}
|
|
|
isolatePreviewStorage();
|
|
|
|
|
|
/*
|
|
|
* 预览内被跳过的写请求会让页面走到「保存成功」分支(见 request.js 的跳过语义),
|
|
|
* 但实际上什么都没有保存——成功类 toast 一律不弹,避免误导教师以为改动已落库。
|
|
|
* 只抑制 success;error / warning / info(含本壳的只读操作提示)保持原样。
|
|
|
*/
|
|
|
function suppressPreviewSuccessToasts() {
|
|
|
if (typeof ElMessage !== "function") return;
|
|
|
try {
|
|
|
ElMessage.success = () => undefined;
|
|
|
} catch (_) {
|
|
|
/* 属性只读等极端情况下忽略,仅多一条无害提示 */
|
|
|
}
|
|
|
}
|
|
|
suppressPreviewSuccessToasts();
|
|
|
|
|
|
/*
|
|
|
* 性能关键点:iframe 只冷启动一次(首次靠路由 query 加载),
|
|
|
* 之后父页切换学生/任务时通过 postMessage 热切换动态组件,
|
|
|
* 不再整页重载 SPA。loadVersion 防止两次切换的异步加载交错覆盖。
|
|
|
*
|
|
|
* 数据隔离关键点:切换学生必须让学生页组件「重新加载」(全新实例),
|
|
|
* 因此这里刻意分两阶段交换——
|
|
|
* 1) 先置空并 await nextTick():确保旧实例真正卸载、其 DOM 与副作用清空;
|
|
|
* 2) 再挂载新实例。
|
|
|
* 若把置空与赋值放在同一 tick,Vue 会把两次渲染合并成一次 keyed patch,
|
|
|
* 新旧实例短暂并存,旧实例里未完成的异步回填可能把上一个学生的数据带进来。
|
|
|
*/
|
|
|
async function loadPreview(taskKey, previewKey) {
|
|
|
const version = ++loadVersion;
|
|
|
clearBootTimers();
|
|
|
previewComponent.value = null;
|
|
|
previewProps.value = {};
|
|
|
emptyDescription.value = "正在加载学生任务页面";
|
|
|
activeTaskKey.value = taskKey;
|
|
|
activePreviewKey.value = previewKey;
|
|
|
previewBooting.value = true;
|
|
|
bootStartAt = Date.now();
|
|
|
syncPreviewLocation(taskKey, previewKey);
|
|
|
const preview = readTrainingReviewPreview(previewKey);
|
|
|
previewStudentSubmitted.value = isPreviewAnswerSubmitted(preview?.answer);
|
|
|
const loader = studentTaskPreviewComponentByKey[taskKey];
|
|
|
if (!preview || preview.taskKey !== taskKey) {
|
|
|
emptyDescription.value = "学生作答预览已失效,请返回任务评阅重新选择学生";
|
|
|
revealPreview(version);
|
|
|
return;
|
|
|
}
|
|
|
if (!loader) {
|
|
|
emptyDescription.value = "该实训任务暂不支持页面预览";
|
|
|
revealPreview(version);
|
|
|
return;
|
|
|
}
|
|
|
try {
|
|
|
const component = (await loader()).default;
|
|
|
if (version !== loadVersion) return;
|
|
|
/* 阶段一:等旧实例卸载完成,避免新旧实例并存导致数据串味 */
|
|
|
await nextTick();
|
|
|
if (version !== loadVersion) return;
|
|
|
/* 阶段二:以全新实例挂载(:key 变化 = 完整重建) */
|
|
|
previewProps.value = studentTaskPreviewPropsByKey[taskKey]?.(taskKey) || {};
|
|
|
previewComponent.value = component;
|
|
|
await nextTick();
|
|
|
if (version !== loadVersion) return;
|
|
|
armReadyGate(version);
|
|
|
} catch (_) {
|
|
|
if (version !== loadVersion) return;
|
|
|
emptyDescription.value = "学生任务页面加载失败,请刷新后重试";
|
|
|
revealPreview(version);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/*
|
|
|
* 把 iframe 地址栏 query 同步为当前预览上下文。
|
|
|
* 关键:getStudentTrainingAnswer / isTrainingReviewPreviewRequest 等都是从
|
|
|
* window.location 解析 reviewPreviewKey 再查 sessionStorage。热切换只改内部状态
|
|
|
* 不动 URL 的话,iframe 地址栏还停留在首次冷启动的旧 key,旧上下文已被父页删除,
|
|
|
* 页面会误判「不在预览模式」→ 拿教师 token 真发 /api/student-training-answers/:taskKey,
|
|
|
* 既发错请求也踩只读守卫。replaceState 不触发路由 watch,不会造成重复加载。
|
|
|
*/
|
|
|
function syncPreviewLocation(taskKey, previewKey) {
|
|
|
if (typeof window === "undefined" || !window.history?.replaceState) return;
|
|
|
const query = `taskKey=${encodeURIComponent(taskKey)}&reviewPreviewKey=${encodeURIComponent(previewKey)}`;
|
|
|
const hash = `#${route.path}?${query}`;
|
|
|
window.history.replaceState(null, "", `${window.location.pathname}${window.location.search}${hash}`);
|
|
|
}
|
|
|
|
|
|
/*
|
|
|
* 放行闸门:组件挂载后,等待「无进行中请求 + DOM 连续 SETTLE_DELAY 无变化
|
|
|
* + 最短遮罩时长」才放行;FORCE_REVEAL_DELAY 兜底防止个别页面长轮询导致永不放行。
|
|
|
*/
|
|
|
function armReadyGate(version) {
|
|
|
scheduleSettleCheck(version);
|
|
|
/* 冷启动时 watch 与 onMounted 会各调一次,强制放行定时器先清再设,避免提前触发 */
|
|
|
if (forceRevealTimer) clearTimeout(forceRevealTimer);
|
|
|
forceRevealTimer = setTimeout(() => revealPreview(version), FORCE_REVEAL_DELAY);
|
|
|
}
|
|
|
|
|
|
function scheduleSettleCheck(version) {
|
|
|
if (settleTimer) clearTimeout(settleTimer);
|
|
|
settleTimer = setTimeout(() => checkSettled(version), SETTLE_DELAY);
|
|
|
}
|
|
|
|
|
|
function checkSettled(version) {
|
|
|
settleTimer = 0;
|
|
|
if (version !== loadVersion) return;
|
|
|
if (getPendingRequestCount() > 0 || Date.now() - bootStartAt < MIN_HOLD) {
|
|
|
scheduleSettleCheck(version);
|
|
|
return;
|
|
|
}
|
|
|
revealPreview(version);
|
|
|
}
|
|
|
|
|
|
function revealPreview(version) {
|
|
|
if (version !== loadVersion) return;
|
|
|
clearBootTimers();
|
|
|
previewBooting.value = false;
|
|
|
/* 通知父页:页面已就绪,可以揭掉教师端预览容器上的加载遮罩 */
|
|
|
window.parent?.postMessage({
|
|
|
type: PARENT_LOADED_MESSAGE,
|
|
|
previewKey: activePreviewKey.value,
|
|
|
}, window.location.origin);
|
|
|
}
|
|
|
|
|
|
function clearBootTimers() {
|
|
|
if (settleTimer) clearTimeout(settleTimer);
|
|
|
if (forceRevealTimer) clearTimeout(forceRevealTimer);
|
|
|
settleTimer = 0;
|
|
|
forceRevealTimer = 0;
|
|
|
}
|
|
|
|
|
|
function loadPreviewFromRoute() {
|
|
|
loadPreview(String(route.query.taskKey || ""), String(route.query.reviewPreviewKey || ""));
|
|
|
}
|
|
|
|
|
|
watch(() => [route.query.taskKey, route.query.reviewPreviewKey], loadPreviewFromRoute, { immediate: true });
|
|
|
|
|
|
function onParentMessage(event) {
|
|
|
if (event.origin !== window.location.origin) return;
|
|
|
const data = event.data || {};
|
|
|
if (data.type !== PARENT_LOAD_MESSAGE) return;
|
|
|
loadPreview(String(data.taskKey || ""), String(data.previewKey || ""));
|
|
|
}
|
|
|
|
|
|
onMounted(() => {
|
|
|
window.addEventListener("message", onParentMessage);
|
|
|
resizeObserver = new ResizeObserver(schedulePreviewHeight);
|
|
|
if (previewRoot.value) resizeObserver.observe(previewRoot.value);
|
|
|
mutationObserver = new MutationObserver(onPreviewDomChanged);
|
|
|
if (previewRoot.value) mutationObserver.observe(previewRoot.value, { childList: true, subtree: true });
|
|
|
schedulePreviewHeight();
|
|
|
/* 首次冷启动也要走放行闸门(组件还没挂载,先保持遮罩) */
|
|
|
armReadyGate(loadVersion);
|
|
|
/* 通知父页:iframe 已就绪,可以开始接收热切换消息 */
|
|
|
window.parent?.postMessage({ type: PARENT_READY_MESSAGE }, window.location.origin);
|
|
|
});
|
|
|
|
|
|
onBeforeUnmount(() => {
|
|
|
window.removeEventListener("message", onParentMessage);
|
|
|
resizeObserver?.disconnect();
|
|
|
mutationObserver?.disconnect();
|
|
|
clearBootTimers();
|
|
|
if (animationFrame) cancelAnimationFrame(animationFrame);
|
|
|
});
|
|
|
|
|
|
function onPreviewDomChanged() {
|
|
|
schedulePreviewHeight();
|
|
|
/* 放行闸门期间 DOM 仍在变(接口回填、图片渲染),推迟放行 */
|
|
|
if (previewBooting.value) scheduleSettleCheck(loadVersion);
|
|
|
}
|
|
|
|
|
|
function schedulePreviewHeight() {
|
|
|
if (animationFrame) cancelAnimationFrame(animationFrame);
|
|
|
animationFrame = requestAnimationFrame(reportPreviewHeight);
|
|
|
}
|
|
|
|
|
|
function reportPreviewHeight() {
|
|
|
animationFrame = 0;
|
|
|
const height = Math.ceil(Math.max(
|
|
|
previewRoot.value?.scrollHeight || 0,
|
|
|
document.body?.scrollHeight || 0,
|
|
|
document.documentElement?.scrollHeight || 0,
|
|
|
window.innerHeight || 0,
|
|
|
));
|
|
|
window.parent?.postMessage({
|
|
|
type: PREVIEW_HEIGHT_MESSAGE,
|
|
|
previewKey: activePreviewKey.value,
|
|
|
height,
|
|
|
}, window.location.origin);
|
|
|
}
|
|
|
|
|
|
function guardPreviewInteraction(event) {
|
|
|
const target = event.target instanceof Element ? event.target : null;
|
|
|
if (!target) return;
|
|
|
if (target.closest("input, textarea, select, [contenteditable='true'], .el-input, .el-textarea, .el-select, .el-checkbox, .el-radio, .el-switch")) {
|
|
|
event.preventDefault();
|
|
|
event.stopImmediatePropagation();
|
|
|
notifyReadonly();
|
|
|
return;
|
|
|
}
|
|
|
/*
|
|
|
* 未完成作答的学生没有任何作答内容可看,步骤导航一律拦住并说明原因;
|
|
|
* 已完成(有分数)的学生才允许在步骤间切换查看。
|
|
|
*/
|
|
|
if (!previewStudentSubmitted.value && (target.closest(PREVIEW_STEP_NAV_CONTAINER) || target.closest("[role='tab'], .el-step"))) {
|
|
|
event.preventDefault();
|
|
|
event.stopImmediatePropagation();
|
|
|
notifyNotSubmitted();
|
|
|
return;
|
|
|
}
|
|
|
const action = target.closest("button, a, [role='button'], [role='tab'], .el-step");
|
|
|
if (action && !isStepNavigation(action)) {
|
|
|
event.preventDefault();
|
|
|
event.stopImmediatePropagation();
|
|
|
notifyReadonly();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/*
|
|
|
* 步骤导航容器白名单:
|
|
|
* 只靠文案(第N步/上一步/下一步)判断太窄——行业需求分析、竞争环境分析等页面的步骤胶囊
|
|
|
* 文案是「01 PEST宏观环境分析 切换 →」,不匹配任何关键词,会被当成普通按钮拦掉,
|
|
|
* 表现为「点了没反应、也不报错」。凡落在已知步骤导航容器里的控件一律放行。
|
|
|
*/
|
|
|
const PREVIEW_STEP_NAV_CONTAINER = [
|
|
|
".step-indicator",
|
|
|
".step-tabs",
|
|
|
".step-nav",
|
|
|
".training-step-nav",
|
|
|
".comprehensive-step-nav",
|
|
|
".comprehensive-step-strip",
|
|
|
".flow-steps",
|
|
|
".flow-rail",
|
|
|
".training-intro__steps",
|
|
|
".top_item",
|
|
|
].join(",");
|
|
|
|
|
|
function isStepNavigation(element) {
|
|
|
if (element.matches("[role='tab'], .el-step")) return true;
|
|
|
if (element.closest(PREVIEW_STEP_NAV_CONTAINER)) return true;
|
|
|
const label = String(element.getAttribute("aria-label") || "");
|
|
|
const text = `${label} ${String(element.textContent || "")}`.replace(/\s+/g, " ").trim();
|
|
|
return /(上一步|下一步|第\s*\d+\s*步|步骤\s*\d+|切换.*步骤|步骤.*切换)/.test(text);
|
|
|
}
|
|
|
|
|
|
/* 只读态被拦截的操作要给提示,避免教师以为页面坏了 */
|
|
|
let lastReadonlyHintAt = 0;
|
|
|
function notifyReadonly() {
|
|
|
const now = Date.now();
|
|
|
if (now - lastReadonlyHintAt < 2500) return;
|
|
|
lastReadonlyHintAt = now;
|
|
|
ElMessage({
|
|
|
message: "任务评阅预览为只读模式,不能修改学生作答",
|
|
|
type: "info",
|
|
|
duration: 2000,
|
|
|
showClose: true,
|
|
|
});
|
|
|
}
|
|
|
|
|
|
/* 未完成作答的学生:步骤切换被拦住,明确告知原因 */
|
|
|
let lastNotSubmittedHintAt = 0;
|
|
|
function notifyNotSubmitted() {
|
|
|
const now = Date.now();
|
|
|
if (now - lastNotSubmittedHintAt < 2500) return;
|
|
|
lastNotSubmittedHintAt = now;
|
|
|
ElMessage({
|
|
|
message: "该学生尚未完成作答,暂不能切换步骤",
|
|
|
type: "info",
|
|
|
duration: 2200,
|
|
|
showClose: true,
|
|
|
});
|
|
|
}
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
/*
|
|
|
* 教师端任务评阅右侧预览:
|
|
|
* 学生页面已通过 dynamic component 嵌入,保留学生端样式;
|
|
|
* 仅保留步骤导航与步骤内容,隐藏标题区、任务简介、AI 助手与所有顶部/底部操作按钮(仅查看)。
|
|
|
*/
|
|
|
.student-task-readonly-preview {
|
|
|
background: #ffffff;
|
|
|
font-family: var(--student-font-base, "PingFang SC", "Source Han Sans SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif);
|
|
|
}
|
|
|
|
|
|
/* ===== 1. 隐藏 AI 助手、AI 评测、独立的 TrainingTaskBrief 组件(保持原行为) ===== */
|
|
|
.student-task-readonly-preview :deep(.training-ai-sidebar),
|
|
|
.student-task-readonly-preview :deep(.training-ai-evaluation),
|
|
|
.student-task-readonly-preview :deep(.training-task-brief) { display: none !important; }
|
|
|
|
|
|
/* ===== 2. 隐藏学生页顶部 chrome(标题、任务简介、展开/收起按钮、顶部工具栏等) ===== */
|
|
|
.student-task-readonly-preview :deep(.task-header),
|
|
|
.student-task-readonly-preview :deep(.task-head-main),
|
|
|
.student-task-readonly-preview :deep(.task-brief),
|
|
|
.student-task-readonly-preview :deep(.task-brief-toggle),
|
|
|
.student-task-readonly-preview :deep(.task-brief-more),
|
|
|
.student-task-readonly-preview :deep(.workbench-head),
|
|
|
.student-task-readonly-preview :deep(.workbench-head--actions-only),
|
|
|
.student-task-readonly-preview :deep(.workbench-actions),
|
|
|
.student-task-readonly-preview :deep(.task-action-strip),
|
|
|
.student-task-readonly-preview :deep(.training-task-toolbar),
|
|
|
.student-task-readonly-preview :deep(.training-legacy-actions),
|
|
|
.student-task-readonly-preview :deep(.new-product-survey-toolbar),
|
|
|
.student-task-readonly-preview :deep(.comprehensive-training-toolbar),
|
|
|
.student-task-readonly-preview :deep(.release-channel-toolbar),
|
|
|
.student-task-readonly-preview :deep(.purchase-workbench) > .workbench-head,
|
|
|
.student-task-readonly-preview :deep(.process-workbench) > .workbench-head,
|
|
|
.student-task-readonly-preview :deep(.factors-workbench) > .workbench-head,
|
|
|
.student-task-readonly-preview :deep(.channel-toolbar),
|
|
|
.student-task-readonly-preview :deep(.supplier-toolbar),
|
|
|
.student-task-readonly-preview :deep(.promotion-toolbar),
|
|
|
.student-task-readonly-preview :deep(.hardware-workbench-head),
|
|
|
.student-task-readonly-preview :deep(.legacy-toolbar),
|
|
|
.student-task-readonly-preview :deep(.material-actions) { display: none !important; }
|
|
|
|
|
|
/* ===== 2.1 旧版实训页:隐藏 TrainingIntro 组件的标题/简介,仅保留其步骤导航 ===== */
|
|
|
.student-task-readonly-preview :deep(.training-intro__head),
|
|
|
.student-task-readonly-preview :deep(.training-intro__body) { display: none !important; }
|
|
|
.student-task-readonly-preview :deep(.training-intro) {
|
|
|
margin-bottom: 12px !important;
|
|
|
padding: 0 !important;
|
|
|
border: 0 !important;
|
|
|
border-radius: 0 !important;
|
|
|
background: transparent !important;
|
|
|
box-shadow: none !important;
|
|
|
overflow: visible !important;
|
|
|
}
|
|
|
.student-task-readonly-preview :deep(.training-intro__steps.step-indicator) { margin: 4px 0 18px !important; }
|
|
|
|
|
|
/* ===== 2.2 旧版实训页:top_item 是 section 切换 tab,保留作为步骤导航 ===== */
|
|
|
.student-task-readonly-preview :deep(.top_item) {
|
|
|
margin: 0 0 14px !important;
|
|
|
padding: 0 !important;
|
|
|
border: 0 !important;
|
|
|
background: transparent !important;
|
|
|
}
|
|
|
|
|
|
/* ===== 3. 让学生页面把 AI 侧栏所在的网格列收回,让预览通栏展示 ===== */
|
|
|
.student-task-readonly-preview :deep(.student-training-shell) { grid-template-columns: minmax(0, 1fr) !important; }
|
|
|
|
|
|
/* ===== 4. 紧贴 app-main 内边距,复用学生端整体留白 ===== */
|
|
|
.student-task-readonly-preview :deep(.student-training-shell) > main { padding: 14px 16px 24px !important; }
|
|
|
|
|
|
/* ===== 5. 步骤导航横排、并与学生端胶囊样式一致 ===== */
|
|
|
.student-task-readonly-preview :deep(.step-indicator),
|
|
|
.student-task-readonly-preview :deep(.comprehensive-step-nav),
|
|
|
.student-task-readonly-preview :deep(.comprehensive-step-strip),
|
|
|
.student-task-readonly-preview :deep(.step-tabs),
|
|
|
.student-task-readonly-preview :deep(.flow-steps),
|
|
|
.student-task-readonly-preview :deep(.flow-rail),
|
|
|
.student-task-readonly-preview :deep(.training-intro__steps) {
|
|
|
display: flex !important;
|
|
|
flex-direction: row !important;
|
|
|
flex-wrap: nowrap !important;
|
|
|
align-items: stretch !important;
|
|
|
justify-content: flex-start !important;
|
|
|
gap: 0 !important;
|
|
|
width: 100% !important;
|
|
|
max-width: 100% !important;
|
|
|
margin: 4px 0 18px !important;
|
|
|
padding: 0 !important;
|
|
|
border: none !important;
|
|
|
border-radius: 0 !important;
|
|
|
background: transparent !important;
|
|
|
box-shadow: none !important;
|
|
|
overflow-x: auto !important;
|
|
|
overflow-y: hidden !important;
|
|
|
scrollbar-width: thin !important;
|
|
|
-webkit-overflow-scrolling: touch !important;
|
|
|
}
|
|
|
|
|
|
/* 步骤胶囊:固定宽度并排,不让任何一条占满整行 */
|
|
|
.student-task-readonly-preview :deep(.step-indicator) .step-tab,
|
|
|
.student-task-readonly-preview :deep(.comprehensive-step-strip) .step-tab,
|
|
|
.student-task-readonly-preview :deep(.step-tabs) .step-tab,
|
|
|
.student-task-readonly-preview :deep(.step-tabs) .step-pill,
|
|
|
.student-task-readonly-preview :deep(.step-indicator) .flow-pill,
|
|
|
.student-task-readonly-preview :deep(.flow-steps) .step-pill,
|
|
|
.student-task-readonly-preview :deep(.flow-rail) .flow-step,
|
|
|
.student-task-readonly-preview :deep(.training-intro__steps) .step-tab {
|
|
|
flex: 0 0 auto !important;
|
|
|
flex-grow: 0 !important;
|
|
|
flex-shrink: 0 !important;
|
|
|
flex-basis: auto !important;
|
|
|
width: auto !important;
|
|
|
min-width: 132px !important;
|
|
|
max-width: 220px !important;
|
|
|
margin: 0 !important;
|
|
|
}
|
|
|
|
|
|
.student-task-readonly-preview :deep(.comprehensive-step-strip) {
|
|
|
width: max-content !important;
|
|
|
min-width: 100% !important;
|
|
|
}
|
|
|
|
|
|
.student-task-readonly-preview :deep(.step-connector),
|
|
|
.student-task-readonly-preview :deep(.step-arrow),
|
|
|
.student-task-readonly-preview :deep(.flow-arrow) {
|
|
|
flex: 0 0 22px !important;
|
|
|
width: 22px !important;
|
|
|
min-width: 22px !important;
|
|
|
display: inline-block !important;
|
|
|
}
|
|
|
|
|
|
/* ===== 6. 步骤内容卡片:保留学生端白卡 + 灰边样式 ===== */
|
|
|
.student-task-readonly-preview :deep(.step-card),
|
|
|
.student-task-readonly-preview :deep(.industry-step-card),
|
|
|
.student-task-readonly-preview :deep(.process-step-card),
|
|
|
.student-task-readonly-preview :deep(.factor-step-card),
|
|
|
.student-task-readonly-preview :deep(.step-content > .step-card),
|
|
|
.student-task-readonly-preview :deep(.training-step-area) {
|
|
|
border: 1px solid #e5e7eb !important;
|
|
|
border-radius: 12px !important;
|
|
|
background: #ffffff !important;
|
|
|
box-shadow: none !important;
|
|
|
}
|
|
|
|
|
|
/* ===== 7. 关闭底部"提交/导出/清空"等动作按钮区(仅查看,不需要学生端的提交动作) ===== */
|
|
|
.student-task-readonly-preview :deep(.task-actions),
|
|
|
.student-task-readonly-preview :deep(.task-actions-row),
|
|
|
.student-task-readonly-preview :deep(.taskfooter),
|
|
|
.student-task-readonly-preview :deep(.step-footer),
|
|
|
.student-task-readonly-preview :deep(.step-actions),
|
|
|
.student-task-readonly-preview :deep(.footer-actions) {
|
|
|
pointer-events: none !important;
|
|
|
opacity: 0.55 !important;
|
|
|
filter: grayscale(0.4) !important;
|
|
|
}
|
|
|
|
|
|
/* ===== 8. 禁用所有表单交互,确保仅查看 ===== */
|
|
|
.student-task-readonly-preview :deep(input),
|
|
|
.student-task-readonly-preview :deep(textarea),
|
|
|
.student-task-readonly-preview :deep(select),
|
|
|
.student-task-readonly-preview :deep(.el-input__inner),
|
|
|
.student-task-readonly-preview :deep(.el-textarea__inner),
|
|
|
.student-task-readonly-preview :deep(.el-select) { pointer-events: none !important; }
|
|
|
|
|
|
/* ===== 9. 隐藏通用浮层与弹窗,避免误触 ===== */
|
|
|
.student-task-readonly-preview :deep(.gdialog),
|
|
|
.student-task-readonly-preview :deep(.popModal),
|
|
|
.student-task-readonly-preview :deep(.el-popper),
|
|
|
.student-task-readonly-preview :deep(.el-overlay) { display: none !important; }
|
|
|
</style>
|
|
|
|
|
|
<!--
|
|
|
非 scoped:补齐 .studentLayout / section.app-main 空壳祖先之后,
|
|
|
需要压掉布局级背景与内边距;同时复位窄屏媒体查询。
|
|
|
|
|
|
选择器统一带 #app + .student-task-preview-root,确保 ID 级特异性高于
|
|
|
student-training.scss / sidebar.scss 里的
|
|
|
#app .studentLayout .app-main:has(.student-training-shell) …
|
|
|
这类规则,避免预览壳被学生端布局背景与内边距污染。
|
|
|
-->
|
|
|
<style lang="scss">
|
|
|
#app .studentLayout.student-task-preview-root {
|
|
|
min-height: 0 !important;
|
|
|
background: #ffffff !important;
|
|
|
}
|
|
|
|
|
|
#app .studentLayout.student-task-preview-root .app-main,
|
|
|
#app .studentLayout.student-task-preview-root .app-main:has(.student-training-shell) {
|
|
|
height: auto !important;
|
|
|
min-height: 0 !important;
|
|
|
padding: 0 !important;
|
|
|
overflow: visible !important;
|
|
|
background: #ffffff !important;
|
|
|
}
|
|
|
|
|
|
/*
|
|
|
评阅预览的 iframe 宽度约 1000px(左栏 440~520px + 右栏自适应),
|
|
|
会命中 student-training.scss 的 @media (max-width: 1100px):
|
|
|
.student-training-shell .step-indicator { flex-direction: column }
|
|
|
#app .student-training-shell .step-tab { width: 100% }
|
|
|
后者带 #app(ID 级特异性),会压过本组件 :deep() 里的宽度覆盖,
|
|
|
于是预览里的步骤胶囊被撑成整行、只剩第一个可见(横向滚动条)。
|
|
|
预览需要呈现学生端「桌面端」外观,这里用更高特异性把宽度复位。
|
|
|
*/
|
|
|
#app .student-task-preview-root .step-indicator .step-tab,
|
|
|
#app .student-task-preview-root .step-tabs .step-tab,
|
|
|
#app .student-task-preview-root .comprehensive-step-strip .step-tab,
|
|
|
#app .student-task-preview-root .training-intro__steps .step-tab,
|
|
|
#app .student-task-preview-root .step-indicator .flow-pill,
|
|
|
#app .student-task-preview-root .flow-steps .flow-pill,
|
|
|
#app .student-task-preview-root .flow-rail .flow-step,
|
|
|
#app .student-task-preview-root .training-actions .el-button.training-action,
|
|
|
#app .student-task-preview-root .training-actions button.training-action {
|
|
|
width: auto !important;
|
|
|
}
|
|
|
</style>
|