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

管理员端下发任务已完善,后续修改学生端导师端页面细节

上级 e8ccb60c
......@@ -426,7 +426,7 @@ function initRadarChart() {
<script src="pages-enterprise.js"></script>
<script src="pages-school.js"></script>
<script>
const ROLES = {student:{name:'学生端',pages:[{id:'student-dashboard',label:'学习首页'},{id:'student-resume',label:'上传简历'},{id:'student-bridge-preview',label:'衔接预习'},{id:'student-bridge-quiz',label:'衔接测验'},{id:'student-deploy-preview',label:'部署知识点'},{id:'student-deploy-quiz',label:'部署小测'},{id:'student-autodl',label:'AutoDL'},{id:'student-deploy-submit',label:'提交部署产物'},{id:'student-deploy-result',label:'部署作业详情'},{id:'student-projects',label:'AI推荐项目'},{id:'student-preview',label:'知识点预习'},{id:'student-quiz',label:'预习小测'},{id:'student-practice',label:'实操工作台'},{id:'student-report',label:'实操报告'},{id:'student-defense',label:'答辩申请'},{id:'student-entry',label:'入项申请'},{id:'student-archive',label:'成长档案'}]},mentor:{name:'导师端',pages:[{id:'mentor-dashboard',label:'导师首页'},{id:'mentor-students',label:'学员管理'},{id:'mentor-practice-review',label:'实操评审'},{id:'mentor-deploy-review',label:'部署验收'},{id:'mentor-autodl',label:'AutoDL 配置'},{id:'mentor-defense-review',label:'答辩评审'},{id:'mentor-entry-review',label:'入项审核'}]},admin:{name:'管理员端',pages:[{id:'admin-dashboard',label:'管理首页'},{id:'admin-projects',label:'项目库管理'},{id:'admin-difficulty',label:'难度校准'},{id:'admin-system-generator',label:'体系生成器'},{id:'admin-users',label:'用户列表'},{id:'admin-roles',label:'角色管理'},{id:'admin-permissions',label:'权限配置'},{id:'admin-departments',label:'部门管理'},{id:'admin-logs',label:'登录日志'},{id:'admin-monitoring',label:'系统监控'}]},enterprise:{name:'企业端',pages:[{id:'enterprise-dashboard',label:'总览首页'},{id:'enterprise-review',label:'学员审核台'},{id:'enterprise-records',label:'入项记录'},{id:'enterprise-stats',label:'统计报表'}]},school:{name:'院校教务端',pages:[{id:'school-dashboard',label:'工作台'},{id:'school-systems',label:'培训体系'},{id:'school-teaching',label:'教学管理'},{id:'school-students',label:'学生档案'},{id:'school-accounts',label:'账号管理'},{id:'school-business',label:'商业服务'}]}};
const ROLES = {student:{name:'学生端',pages:[{id:'student-dashboard',label:'学习首页'},{id:'student-resume',label:'上传简历'},{id:'student-bridge-preview',label:'衔接预习'},{id:'student-bridge-quiz',label:'衔接测验'},{id:'student-deploy-preview',label:'部署知识点'},{id:'student-deploy-quiz',label:'部署小测'},{id:'student-autodl',label:'AutoDL'},{id:'student-deploy-submit',label:'提交部署产物'},{id:'student-deploy-result',label:'部署作业详情'},{id:'student-projects',label:'AI推荐项目'},{id:'student-preview',label:'知识点预习'},{id:'student-quiz',label:'预习小测'},{id:'student-practice',label:'实操工作台'},{id:'student-report',label:'实操报告'},{id:'student-defense',label:'答辩申请'},{id:'student-entry',label:'入项申请'},{id:'student-archive',label:'成长档案'}]},mentor:{name:'导师端',pages:[{id:'mentor-dashboard',label:'导师首页'},{id:'mentor-students',label:'学员管理'},{id:'mentor-practice-review',label:'实操评审'},{id:'mentor-deploy-review',label:'部署验收'},{id:'mentor-autodl',label:'AutoDL 配置'},{id:'mentor-defense-review',label:'答辩评审'},{id:'mentor-entry-review',label:'入项审核'}]},admin:{name:'管理员端',pages:[{id:'admin-dashboard',label:'管理首页'},{id:'admin-projects',label:'项目库管理'},{id:'admin-difficulty',label:'难度校准'},{id:'admin-system-generator',label:'体系生成器'},{id:'admin-deploy-task',label:'阶段二任务下发'},{id:'admin-users',label:'用户列表'},{id:'admin-roles',label:'角色管理'},{id:'admin-permissions',label:'权限配置'},{id:'admin-departments',label:'部门管理'},{id:'admin-logs',label:'登录日志'},{id:'admin-monitoring',label:'系统监控'}]},enterprise:{name:'企业端',pages:[{id:'enterprise-dashboard',label:'总览首页'},{id:'enterprise-review',label:'学员审核台'},{id:'enterprise-records',label:'入项记录'},{id:'enterprise-stats',label:'统计报表'}]},school:{name:'院校教务端',pages:[{id:'school-dashboard',label:'工作台'},{id:'school-systems',label:'培训体系'},{id:'school-teaching',label:'教学管理'},{id:'school-students',label:'学生档案'},{id:'school-accounts',label:'账号管理'},{id:'school-business',label:'商业服务'}]}};
// Student state management
var studentState = {
selectedProject: null,
......
......@@ -2,6 +2,15 @@
// UI/UX 升级:Arco Design Pro 风格 + 丰容优化
// 包含:管理首页、项目库管理、难度校准、AI配置、体系生成器
// ===== 阶段二模型任务下发(管理员端配置,统一下发给全部学生)=====
var adminDeployTask = {
status: 'draft', // draft(未下发/草稿) | downloaded(已下发)
updatedAt: '', // 最近一次下发时间
tasks: {} // { 'text-model': {...}, 'image-gen': {...} },结构与学生端 DEPLOY_TASK_INFO 一致
};
var adminDeployTaskDraftType = 'text-model'; // 当前编辑的任务类型
var adminDeployTaskForms = {}; // { 'text-model': {...}, 'image-gen': {...} } 编辑缓存
// ===== ADMIN DASHBOARD =====
pageRenderers["admin-dashboard"] = function() { return `
<div class="max-w-7xl mx-auto">
......@@ -1066,6 +1075,187 @@ pageRenderers["admin-monitoring"] = function() { return `
</div>
</div>`; };
function cloneAdminDeployTaskTemplate(type) {
var base = (typeof DEPLOY_TASK_INFO !== 'undefined' && DEPLOY_TASK_INFO[type]) ? DEPLOY_TASK_INFO[type] : null;
return base ? JSON.parse(JSON.stringify(base)) : { taskNo: '', title: '', model: '', goal: '', instance: { gpu: '', cpu: '', mem: '', sysDisk: '', dataDisk: '' }, env: [], apiChecks: [], passConditions: [] };
}
function ensureAdminDeployTaskForm(type) {
var key = type === 'image-gen' ? 'image-gen' : 'text-model';
if (!adminDeployTaskForms[key]) {
adminDeployTaskForms[key] = cloneAdminDeployTaskTemplate(key);
}
return adminDeployTaskForms[key];
}
function getAdminDeployTaskForm(type) {
return ensureAdminDeployTaskForm(type);
}
function parseDeployTaskLines(text) {
return String(text || '')
.split(/\r?\n/)
.map(function(line) { return line.trim(); })
.filter(function(line) { return !!line; });
}
function formatDeployTaskLines(list) {
return (list || []).join('\n');
}
function setAdminDeployTaskDraftType(type) {
adminDeployTaskDraftType = type === 'image-gen' ? 'image-gen' : 'text-model';
ensureAdminDeployTaskForm(adminDeployTaskDraftType);
renderContent();
}
function setAdminDeployTaskField(type, field, value) {
var form = ensureAdminDeployTaskForm(type);
if (field.indexOf('instance.') === 0) {
var instKey = field.split('.')[1];
if (instKey) form.instance[instKey] = value;
} else {
form[field] = value;
}
}
function syncAdminDeployTaskFormFromInputs(type) {
var form = ensureAdminDeployTaskForm(type);
var ids = ['taskNo','title','model','goal','instance.gpu','instance.cpu','instance.mem','instance.sysDisk','instance.dataDisk','envText','apiChecksText','passConditionsText'];
ids.forEach(function(id) {
var el = document.getElementById('adminDeploy_' + type + '_' + id.replace(/\./g, '_'));
if (!el) return;
if (id.indexOf('instance.') === 0) {
var key = id.split('.')[1];
form.instance[key] = el.value;
} else if (id === 'envText') {
form.env = parseDeployTaskLines(el.value);
} else if (id === 'apiChecksText') {
form.apiChecks = parseDeployTaskLines(el.value).map(function(line) {
var parts = line.split('|').map(function(s) { return s.trim(); });
return { method: parts[0] || 'GET', path: parts[1] || '', desc: parts.slice(2).join(' | ') || '' };
});
} else if (id === 'passConditionsText') {
form.passConditions = parseDeployTaskLines(el.value);
} else {
form[id] = el.value;
}
});
}
function buildAdminDeployTaskFormHtml(type) {
var form = getAdminDeployTaskForm(type);
var isActive = adminDeployTaskDraftType === type;
return '<div class="rounded-xl border ' + (isActive ? 'border-[#165DFF] bg-[#F7FAFF]' : 'border-[#E5E6EB] bg-white') + ' p-5 shadow-sm">' +
'<div class="flex items-center justify-between mb-4"><div><h3 class="font-semibold text-[#1D2129]">' + (type === 'image-gen' ? '图像生成任务' : '文本模型任务') + '</h3><p class="text-xs text-[#86909C] mt-1">编辑后可保存草稿,确认无误再统一下发</p></div>' +
'<button class="px-3 py-1.5 text-xs rounded-lg ' + (isActive ? 'bg-[#165DFF] text-white' : 'bg-[#E8F3FF] text-[#165DFF]') + '" onclick="setAdminDeployTaskDraftType(\'' + type + '\')">' + (isActive ? '当前编辑' : '切换编辑') + '</button></div>' +
'<div class="grid grid-cols-2 gap-4 text-sm">' +
'<div><label class="block text-xs text-[#86909C] mb-1">任务编号</label><input id="adminDeploy_' + type + '_taskNo" class="input-field" value="' + escapeAutodlHtml(form.taskNo || '') + '" oninput="setAdminDeployTaskField(\'' + type + '\', \'taskNo\', this.value)"></div>' +
'<div><label class="block text-xs text-[#86909C] mb-1">标题</label><input id="adminDeploy_' + type + '_title" class="input-field" value="' + escapeAutodlHtml(form.title || '') + '" oninput="setAdminDeployTaskField(\'' + type + '\', \'title\', this.value)"></div>' +
'<div class="col-span-2"><label class="block text-xs text-[#86909C] mb-1">目标模型</label><input id="adminDeploy_' + type + '_model" class="input-field font-mono" value="' + escapeAutodlHtml(form.model || '') + '" oninput="setAdminDeployTaskField(\'' + type + '\', \'model\', this.value)"></div>' +
'<div class="col-span-2"><label class="block text-xs text-[#86909C] mb-1">任务目标</label><textarea id="adminDeploy_' + type + '_goal" class="input-field min-h-[88px] resize-none" oninput="setAdminDeployTaskField(\'' + type + '\', \'goal\', this.value)">' + escapeAutodlHtml(form.goal || '') + '</textarea></div>' +
'<div><label class="block text-xs text-[#86909C] mb-1">GPU</label><input id="adminDeploy_' + type + '_instance_gpu" class="input-field" value="' + escapeAutodlHtml(form.instance.gpu || '') + '" oninput="setAdminDeployTaskField(\'' + type + '\', \'instance.gpu\', this.value)"></div>' +
'<div><label class="block text-xs text-[#86909C] mb-1">CPU / 内存</label><input id="adminDeploy_' + type + '_instance_cpu" class="input-field" value="' + escapeAutodlHtml(form.instance.cpu || '') + '" oninput="setAdminDeployTaskField(\'' + type + '\', \'instance.cpu\', this.value)"></div>' +
'<div><label class="block text-xs text-[#86909C] mb-1">内存</label><input id="adminDeploy_' + type + '_instance_mem" class="input-field" value="' + escapeAutodlHtml(form.instance.mem || '') + '" oninput="setAdminDeployTaskField(\'' + type + '\', \'instance.mem\', this.value)"></div>' +
'<div><label class="block text-xs text-[#86909C] mb-1">系统盘</label><input id="adminDeploy_' + type + '_instance_sysDisk" class="input-field" value="' + escapeAutodlHtml(form.instance.sysDisk || '') + '" oninput="setAdminDeployTaskField(\'' + type + '\', \'instance.sysDisk\', this.value)"></div>' +
'<div class="col-span-2"><label class="block text-xs text-[#86909C] mb-1">数据盘</label><input id="adminDeploy_' + type + '_instance_dataDisk" class="input-field" value="' + escapeAutodlHtml(form.instance.dataDisk || '') + '" oninput="setAdminDeployTaskField(\'' + type + '\', \'instance.dataDisk\', this.value)"></div>' +
'<div class="col-span-2"><label class="block text-xs text-[#86909C] mb-1">环境(每行一项)</label><textarea id="adminDeploy_' + type + '_envText" class="input-field min-h-[88px] resize-none font-mono text-sm" oninput="setAdminDeployTaskField(\'' + type + '\', \'env\', this.value)">' + escapeAutodlHtml(formatDeployTaskLines(form.env)) + '</textarea></div>' +
'<div class="col-span-2"><label class="block text-xs text-[#86909C] mb-1">API 验收要求(格式:METHOD | PATH | 说明,每行一条)</label><textarea id="adminDeploy_' + type + '_apiChecksText" class="input-field min-h-[110px] resize-none font-mono text-sm" oninput="setAdminDeployTaskField(\'' + type + '\', \'apiChecks\', this.value)">' + escapeAutodlHtml((form.apiChecks || []).map(function(c) { return (c.method || 'GET') + ' | ' + (c.path || '') + ' | ' + (c.desc || ''); }).join('\n')) + '</textarea></div>' +
'<div class="col-span-2"><label class="block text-xs text-[#86909C] mb-1">通过条件(每行一条)</label><textarea id="adminDeploy_' + type + '_passConditionsText" class="input-field min-h-[110px] resize-none" oninput="setAdminDeployTaskField(\'' + type + '\', \'passConditions\', this.value)">' + escapeAutodlHtml(formatDeployTaskLines(form.passConditions)) + '</textarea></div>' +
'</div>' +
'</div>';
}
function buildAdminDeployTaskPreviewHtml(type) {
var form = getAdminDeployTaskForm(type);
return '<div class="sticky top-6">' +
'<div class="flex items-center justify-between mb-3"><h3 class="font-semibold text-[#1D2129]">发布预览</h3><span class="text-xs px-2 py-1 rounded-lg ' + (adminDeployTask.status === 'downloaded' ? 'bg-emerald-100 text-emerald-700' : 'bg-amber-100 text-amber-700') + '">' + (adminDeployTask.status === 'downloaded' ? '已下发' : '草稿') + '</span></div>' +
(buildDeployTaskSection ? buildDeployTaskSection(form) : '<div class="bg-white rounded-lg border border-[#E5E6EB] p-6">预览组件不可用</div>') +
'</div>';
}
function saveAdminDeployTaskDraft() {
syncAdminDeployTaskFormFromInputs(adminDeployTaskDraftType);
adminDeployTask.forms = adminDeployTaskForms;
adminDeployTask.status = adminDeployTask.status === 'downloaded' ? 'downloaded' : 'draft';
adminDeployTask.updatedAt = adminDeployTask.updatedAt || '';
renderContent();
}
function publishAdminDeployTasks() {
syncAdminDeployTaskFormFromInputs(adminDeployTaskDraftType);
adminDeployTask.tasks = {
'text-model': JSON.parse(JSON.stringify(ensureAdminDeployTaskForm('text-model'))),
'image-gen': JSON.parse(JSON.stringify(ensureAdminDeployTaskForm('image-gen')))
};
adminDeployTask.status = 'downloaded';
adminDeployTask.updatedAt = '2026-08-21 10:00';
renderContent();
}
pageRenderers["admin-deploy-task"] = function() {
ensureAdminDeployTaskForm('text-model');
ensureAdminDeployTaskForm('image-gen');
var activeType = adminDeployTaskDraftType === 'image-gen' ? 'image-gen' : 'text-model';
var statusText = adminDeployTask.status === 'downloaded' ? '已下发' : '草稿';
var statusClass = adminDeployTask.status === 'downloaded' ? 'bg-emerald-100 text-emerald-700' : 'bg-amber-100 text-amber-700';
var previewTask = adminDeployTask.status === 'downloaded' ? (adminDeployTask.tasks[activeType] || ensureAdminDeployTaskForm(activeType)) : ensureAdminDeployTaskForm(activeType);
return `
<div class="max-w-7xl mx-auto">
<div class="flex items-center justify-between mb-6">
<div class="flex items-center gap-4">
<button class="btn-ghost p-2 rounded-lg hover:bg-[#F2F3F5]" onclick="switchPage('admin-dashboard')">
<svg class="w-5 h-5" data-lucide="arrow-left"></svg>
</button>
<div class="w-12 h-12 rounded-xl bg-gradient-to-br from-[#165DFF] to-[#4080FF] flex items-center justify-center shadow-lg shadow-[#165DFF]/20">
<svg class="w-6 h-6 text-white" data-lucide="clipboard-list"></svg>
</div>
<div>
<h2 class="text-xl font-bold text-[#1D2129]">阶段二任务下发</h2>
<p class="text-sm text-[#86909C]">统一配置 AutoDL 阶段二任务内容,并下发给全部学生</p>
</div>
</div>
<div class="flex items-center gap-3">
<span class="px-3 py-1.5 rounded-lg text-sm font-medium ${statusClass}">${statusText}</span>
<span class="text-xs text-[#86909C]">${escapeAutodlHtml(adminDeployTask.updatedAt || '尚未下发')}</span>
</div>
</div>
<div class="grid grid-cols-12 gap-6">
<div class="col-span-7 space-y-5">
<div class="feature-card p-5">
<div class="flex items-center justify-between mb-4">
<div>
<h3 class="font-semibold text-[#1D2129]">任务配置</h3>
<p class="text-xs text-[#86909C] mt-1">支持分别配置文本模型与图像生成两个任务模板</p>
</div>
<div class="flex gap-2">
<button class="px-3 py-1.5 rounded-lg text-xs font-medium ${activeType === 'text-model' ? 'bg-[#165DFF] text-white' : 'bg-[#F7F8FA] text-[#4E5969]'}" onclick="setAdminDeployTaskDraftType('text-model')">文本模型</button>
<button class="px-3 py-1.5 rounded-lg text-xs font-medium ${activeType === 'image-gen' ? 'bg-[#165DFF] text-white' : 'bg-[#F7F8FA] text-[#4E5969]'}" onclick="setAdminDeployTaskDraftType('image-gen')">图像生成</button>
</div>
</div>
${buildAdminDeployTaskFormHtml(activeType)}
</div>
<div class="bg-white rounded-lg border border-[#E5E6EB] p-5 shadow-sm">
<h3 class="font-semibold text-[#1D2129] mb-3">操作说明</h3>
<ul class="space-y-2 text-sm text-[#4E5969] leading-relaxed">
<li>1. 先在左侧修改任务内容并点击 <b>保存草稿</b>,保留当前编辑结果。</li>
<li>2. 确认内容无误后点击 <b>下发任务</b>,系统将把当前配置发布给全部学生。</li>
<li>3. 学生端 AutoDL 页面会直接读取已下发的任务内容,展示与管理员一致的配置。</li>
</ul>
<div class="flex gap-3 mt-4">
<button class="btn-outline py-3 px-5" onclick="saveAdminDeployTaskDraft()">保存草稿</button>
<button class="btn-primary py-3 px-5" onclick="publishAdminDeployTasks()">下发任务</button>
</div>
</div>
</div>
<div class="col-span-5">
${buildAdminDeployTaskPreviewHtml(activeType)}
</div>
</div>
</div>`;
};
// ===== ADMIN: USER MANAGEMENT =====
pageRenderers["admin-users"] = function() { return `
<div class="max-w-7xl mx-auto">
......
......@@ -2405,6 +2405,9 @@ var autodlLeaseDraft = null;
var autodlLeaseEditId = null;
function getDeployTaskInfo() {
if (typeof adminDeployTask !== 'undefined' && adminDeployTask && adminDeployTask.status === 'downloaded' && adminDeployTask.tasks) {
return adminDeployTask.tasks[studentState.deployTaskType] || adminDeployTask.tasks['text-model'] || DEPLOY_TASK_INFO[studentState.deployTaskType] || DEPLOY_TASK_INFO['text-model'];
}
return DEPLOY_TASK_INFO[studentState.deployTaskType] || DEPLOY_TASK_INFO['text-model'];
}
......@@ -2661,8 +2664,8 @@ function clearAutodlLeaseData() {
renderContent();
}
function buildDeployTaskSection() {
var t = getDeployTaskInfo();
function buildDeployTaskSection(taskOverride) {
var t = taskOverride || getDeployTaskInfo();
var inst = t.instance;
var apiRows = (t.apiChecks || []).map(function(c) {
var methodCls = c.method === 'GET'
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论