提交 c3447af9 authored 作者: yujiejie's avatar yujiejie

学生提交页面优化好

上级 f7e2102f
......@@ -3110,6 +3110,8 @@ function handleDeployLogFile(input) {
function setDeployArtifact(field, value) {
if (!studentState.deployArtifact) studentState.deployArtifact = {};
studentState.deployArtifact[field] = value;
studentState.deployArtifactSubmitted = false;
studentState.deploySubmitted = false;
}
function selectDemoDeployLog(input) {
......@@ -3145,6 +3147,20 @@ function getDeploySubmissionStatus() {
return 'none';
}
function isDeploySubmissionLocked() {
return getDeploySubmissionStatus() === 'both';
}
function buildDeploySubmitNotice() {
var locked = isDeploySubmissionLocked();
if (!locked) return '';
return `
<div class="rounded-lg bg-emerald-50 border border-emerald-200 p-4 text-sm text-emerald-700 mb-6 flex items-start gap-2">
<svg class="w-4 h-4 mt-0.5 flex-shrink-0" data-lucide="check-circle"></svg>
<div>产物和报告都已提交,你现在可以查看提交内容,但不能再编辑。</div>
</div>`;
}
function getDeployArtifactButtonLabel() {
return studentState.deployArtifactSubmitted ? '已保存' : '保存';
}
......@@ -3162,6 +3178,7 @@ function getDeployReportSubmitLabel() {
}
function saveDeployArtifact() {
if (isDeploySubmissionLocked()) return false;
if (!studentState.deployArtifact) studentState.deployArtifact = {};
var a = studentState.deployArtifact;
if (!a.fileName || !a.fileName.trim()) {
......@@ -3190,6 +3207,7 @@ function saveDeployArtifact() {
}
function submitDeployArtifact() {
if (isDeploySubmissionLocked()) return false;
if (!studentState.deployArtifactSaved) {
showStudentFlowModal('请先保存部署产物', '提交产物前,请先点击左侧的“保存”按钮完成产物保存。');
return false;
......@@ -3207,6 +3225,7 @@ function submitDeployArtifact() {
}
function saveDeployReport() {
if (isDeploySubmissionLocked()) return false;
if (!studentState.deployReport) studentState.deployReport = {};
var r = studentState.deployReport;
if (!r.taskName || !r.taskName.trim()) {
......@@ -3225,6 +3244,7 @@ function saveDeployReport() {
}
function submitDeployReport() {
if (isDeploySubmissionLocked()) return false;
if (!studentState.deployReportSaved) {
showStudentFlowModal('请先保存实操报告', '提交报告前,请先点击左侧的“保存”按钮完成报告保存。');
return false;
......@@ -3245,6 +3265,7 @@ function buildDeployArtifactPanel() {
var a = studentState.deployArtifact || {};
var saved = !!studentState.deployArtifactSaved;
var submitted = !!studentState.deployArtifactSubmitted;
var locked = isDeploySubmissionLocked();
return `
<div class="bg-white rounded-lg border border-[#E5E6EB] shadow-sm p-6 space-y-5">
<div class="flex items-center justify-between gap-2">
......@@ -3258,7 +3279,7 @@ function buildDeployArtifactPanel() {
<div>
<label class="text-sm font-medium text-[#4E5969] block mb-2">上传部署日志包 <span class="text-rose-500">*</span></label>
<label class="block border-2 border-dashed border-[#C9CDD4] rounded-lg p-6 text-center cursor-pointer hover:border-[#165DFF]">
<input type="file" class="hidden" onchange="selectDemoDeployLog(this)">
<input type="file" class="hidden" onchange="selectDemoDeployLog(this)" ` + (locked ? 'disabled' : '') + `>
<svg class="w-7 h-7 mx-auto mb-2 text-[#165DFF]" data-lucide="upload-cloud"></svg>
<div class="text-sm font-medium">` + escapeAutodlHtml(a.fileName || '点击选择日志包或压缩包') + `</div>
<div class="text-xs text-[#86909C] mt-1">建议包含启动日志、探测日志和错误排查记录</div>
......@@ -3267,27 +3288,27 @@ function buildDeployArtifactPanel() {
<div class="grid grid-cols-2 gap-4">
<div>
<label class="text-sm font-medium text-[#4E5969] block mb-2">API 地址</label>
<input class="input-field font-mono" placeholder="https://xxx.autodl.com/v1/chat/completions" value="` + escapeAutodlHtml(a.apiUrl || '') + `" oninput="setDeployArtifact('apiUrl', this.value)">
<input class="input-field font-mono" placeholder="https://xxx.autodl.com/v1/chat/completions" value="` + escapeAutodlHtml(a.apiUrl || '') + `" oninput="setDeployArtifact('apiUrl', this.value)" ` + (locked ? 'disabled' : '') + `>
</div>
<div>
<label class="text-sm font-medium text-[#4E5969] block mb-2">API Key</label>
<input class="input-field font-mono" placeholder="sk-..." value="` + escapeAutodlHtml(a.apiKey || '') + `" oninput="setDeployArtifact('apiKey', this.value)">
<input class="input-field font-mono" placeholder="sk-..." value="` + escapeAutodlHtml(a.apiKey || '') + `" oninput="setDeployArtifact('apiKey', this.value)" ` + (locked ? 'disabled' : '') + `>
</div>
<div>
<label class="text-sm font-medium text-[#4E5969] block mb-2">模型名称 <span class="text-rose-500">*</span></label>
<input class="input-field font-mono" placeholder="qwen3.5-4b" value="` + escapeAutodlHtml(a.modelName || '') + `" oninput="setDeployArtifact('modelName', this.value)">
<input class="input-field font-mono" placeholder="qwen3.5-4b" value="` + escapeAutodlHtml(a.modelName || '') + `" oninput="setDeployArtifact('modelName', this.value)" ` + (locked ? 'disabled' : '') + `>
</div>
<div>
<label class="text-sm font-medium text-[#4E5969] block mb-2">请求路径</label>
<input class="input-field font-mono" placeholder="/v1/chat/completions" value="` + escapeAutodlHtml(a.apiPath || '') + `" oninput="setDeployArtifact('apiPath', this.value)">
<input class="input-field font-mono" placeholder="/v1/chat/completions" value="` + escapeAutodlHtml(a.apiPath || '') + `" oninput="setDeployArtifact('apiPath', this.value)" ` + (locked ? 'disabled' : '') + `>
</div>
<div>
<label class="text-sm font-medium text-[#4E5969] block mb-2">端口 <span class="text-rose-500">*</span></label>
<input class="input-field font-mono" placeholder="8000" value="` + escapeAutodlHtml(a.port || '') + `" oninput="setDeployArtifact('port', this.value)">
<input class="input-field font-mono" placeholder="8000" value="` + escapeAutodlHtml(a.port || '') + `" oninput="setDeployArtifact('port', this.value)" ` + (locked ? 'disabled' : '') + `>
</div>
</div>
<div class="flex gap-3">
<button class="btn-outline flex-1 py-3" onclick="saveDeployArtifact()">` + (saved ? '已保存' : '保存') + `</button>
<button class="btn-outline flex-1 py-3" onclick="saveDeployArtifact()" ` + (locked ? 'disabled' : '') + `>` + (submitted ? '已保存' : (saved ? '已保存' : '保存')) + `</button>
<button class="btn-primary flex-1 py-3" onclick="submitDeployArtifact()" ` + ((!saved || submitted) ? 'disabled' : '') + `>` + (submitted ? '已提交' : '提交') + `</button>
</div>
</div>`;
......@@ -3297,6 +3318,7 @@ function buildDeployReportPanel() {
var r = studentState.deployReport || {};
var saved = !!studentState.deployReportSaved;
var submitted = !!studentState.deployReportSubmitted;
var locked = isDeploySubmissionLocked();
return `
<div class="bg-white rounded-lg border border-[#E5E6EB] shadow-sm p-6 space-y-5">
<div class="flex items-center justify-between gap-2">
......@@ -3309,26 +3331,26 @@ function buildDeployReportPanel() {
<p class="text-sm text-[#86909C] leading-relaxed">部署产物提交时可以同步提交实操报告,也可以先保存报告、后保存产物。</p>
<div>
<label class="text-sm font-medium text-[#4E5969] block mb-2">本次任务目标 <span class="text-rose-500">*</span></label>
<input class="input-field" placeholder="例如:完成 Qwen3.5-4B OpenAI 兼容 API 部署验收" value="` + escapeAutodlHtml(r.taskName || '') + `" oninput="setDeployReportField('taskName', this.value)">
<input class="input-field" placeholder="例如:完成 Qwen3.5-4B OpenAI 兼容 API 部署验收" value="` + escapeAutodlHtml(r.taskName || '') + `" oninput="setDeployReportField('taskName', this.value)" ` + (locked ? 'disabled' : '') + `>
</div>
<div>
<label class="text-sm font-medium text-[#4E5969] block mb-2">部署过程 <span class="text-rose-500">*</span></label>
<textarea class="input-field min-h-[110px] resize-none" placeholder="描述环境检查、启动过程、遇到的问题和关键操作" oninput="setDeployReportField('process', this.value)">` + escapeAutodlHtml(r.process || '') + `</textarea>
<textarea class="input-field min-h-[110px] resize-none" placeholder="描述环境检查、启动过程、遇到的问题和关键操作" oninput="setDeployReportField('process', this.value)" ` + (locked ? 'disabled' : '') + `>` + escapeAutodlHtml(r.process || '') + `</textarea>
</div>
<div>
<label class="text-sm font-medium text-[#4E5969] block mb-2">问题与解决</label>
<textarea class="input-field min-h-[110px] resize-none" placeholder="记录报错和修复方式" oninput="setDeployReportField('issues', this.value)">` + escapeAutodlHtml(r.issues || '') + `</textarea>
<textarea class="input-field min-h-[110px] resize-none" placeholder="记录报错和修复方式" oninput="setDeployReportField('issues', this.value)" ` + (locked ? 'disabled' : '') + `>` + escapeAutodlHtml(r.issues || '') + `</textarea>
</div>
<div>
<label class="text-sm font-medium text-[#4E5969] block mb-2">自测结果</label>
<textarea class="input-field min-h-[110px] resize-none" placeholder="记录接口是否可用、返回内容是否正常" oninput="setDeployReportField('selfTest', this.value)">` + escapeAutodlHtml(r.selfTest || '') + `</textarea>
<textarea class="input-field min-h-[110px] resize-none" placeholder="记录接口是否可用、返回内容是否正常" oninput="setDeployReportField('selfTest', this.value)" ` + (locked ? 'disabled' : '') + `>` + escapeAutodlHtml(r.selfTest || '') + `</textarea>
</div>
<div>
<label class="text-sm font-medium text-[#4E5969] block mb-2">总结反思</label>
<textarea class="input-field min-h-[110px] resize-none" placeholder="总结本次部署经验与后续改进点" oninput="setDeployReportField('summary', this.value)">` + escapeAutodlHtml(r.summary || '') + `</textarea>
<textarea class="input-field min-h-[110px] resize-none" placeholder="总结本次部署经验与后续改进点" oninput="setDeployReportField('summary', this.value)" ` + (locked ? 'disabled' : '') + `>` + escapeAutodlHtml(r.summary || '') + `</textarea>
</div>
<div class="flex gap-3">
<button class="btn-outline flex-1 py-3" onclick="saveDeployReport()">` + (saved ? '已保存' : '保存') + `</button>
<button class="btn-outline flex-1 py-3" onclick="saveDeployReport()" ` + (locked ? 'disabled' : '') + `>` + (submitted ? '已保存' : (saved ? '已保存' : '保存')) + `</button>
<button class="btn-primary flex-1 py-3" onclick="submitDeployReport()" ` + ((!saved || submitted) ? 'disabled' : '') + `>` + (submitted ? '已提交' : '提交') + `</button>
</div>
</div>`;
......@@ -3337,19 +3359,24 @@ function buildDeployReportPanel() {
function setDeployReportField(field, value) {
if (!studentState.deployReport) studentState.deployReport = {};
studentState.deployReport[field] = value;
studentState.deployReportSubmitted = false;
studentState.deploySubmitted = false;
}
pageRenderers["student-deploy-submit"] = function() {
if (!studentState.deployQuizPassed) return pageRenderers["student-autodl"]();
var locked = isDeploySubmissionLocked();
var submitStatus = getDeploySubmissionStatus();
return `
<div class="max-w-6xl mx-auto">
<div class="flex items-center gap-3 mb-6">
<button class="btn-ghost p-2" onclick="switchPage('student-autodl')"><svg class="w-5 h-5" data-lucide="arrow-left"></svg></button>
<div>
<h1 class="text-xl font-bold text-[#1D2129]">提交部署产物与实操报告</h1>
<p class="text-sm text-[#86909C]">产物与报告分别填写后,在各自表单底部先保存,再提交。</p>
<p class="text-sm text-[#86909C]">` + (locked ? '两部分都已提交,你可以查看自己提交的内容,不能再编辑。' : '产物与报告分别填写后,在各自表单底部先保存,再提交。') + `</p>
</div>
</div>
` + (locked ? '<div class="rounded-lg bg-emerald-50 border border-emerald-200 p-4 text-sm text-emerald-700 mb-6 flex items-start gap-2"><svg class="w-4 h-4 mt-0.5 flex-shrink-0" data-lucide="check-circle"></svg><div>产物和报告都已提交,你现在可以查看自己提交的内容,不能再编辑。</div></div>' : '') + `
<div class="grid grid-cols-2 gap-6 items-start">
` + buildDeployArtifactPanel() + `
` + buildDeployReportPanel() + `
......@@ -3374,7 +3401,7 @@ pageRenderers["student-deploy-result"] = function() {
var r = studentState.deployReport || {};
var passed = isDeployReviewPassed();
var rejected = isDeployReviewRejected();
var hasAnySaved = !!(studentState.deployArtifactSubmitted || studentState.deployReportSubmitted || studentState.deploySubmitted || studentState.deployReviewed);
var hasAnySaved = !!(studentState.deployArtifactSubmitted || studentState.deployReportSubmitted || studentState.deploySubmitted || studentState.deployReviewed || studentState.deployArtifactSaved || studentState.deployReportSaved);
if (!hasAnySaved && !passed && !rejected) {
return pageRenderers["student-deploy-submit"]();
}
......@@ -3386,6 +3413,8 @@ pageRenderers["student-deploy-result"] = function() {
var logName = a.fileName || studentState.deployLogName || '—';
var submitSummary = getDeploySubmissionStatus();
var submitSummaryText = submitSummary === 'both' ? '产物与报告都已提交' : (submitSummary === 'artifact' ? '仅产物已提交' : (submitSummary === 'report' ? '仅报告已提交' : '尚未提交'));
var lockedNote = submitSummary === 'both' ? '两边都提交后,本页只读,不能再修改。' : '只要还有一边未提交,就可以返回提交页继续修改。';
var bothSubmitted = submitSummary === 'both';
var actionHtml = '';
if (passed) {
actionHtml =
......@@ -3395,6 +3424,9 @@ pageRenderers["student-deploy-result"] = function() {
actionHtml =
'<button class="btn-primary w-full py-3" onclick="reopenDeploySubmit()">修改并重新保存</button>' +
'<button class="btn-outline w-full py-3" onclick="switchPage(\'student-dashboard\')">返回首页</button>';
} else if (bothSubmitted) {
actionHtml =
'<button class="btn-outline w-full py-3" onclick="switchPage(\'student-dashboard\')">返回首页</button>';
} else {
actionHtml =
'<button class="btn-outline w-full py-3" onclick="switchPage(\'student-deploy-submit\')">返回提交页继续编辑</button>' +
......@@ -3420,6 +3452,7 @@ pageRenderers["student-deploy-result"] = function() {
<h3 class="font-semibold text-[#1D2129]">保存状态</h3>
<span class="text-xs px-2 py-1 rounded bg-[#F7F8FA] text-[#4E5969]">` + submitSummaryText + `</span>
</div>
<p class="text-xs text-[#86909C]">` + lockedNote + `</p>
<div class="grid grid-cols-3 gap-3">
<div class="p-4 rounded-lg ` + (studentState.deployArtifactSubmitted ? 'bg-emerald-50' : 'bg-[#F7F8FA]') + `">
<div class="text-xs text-[#86909C]">部署产物</div>
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论