Compare commits

...

2 Commits

Author SHA1 Message Date
qinzhenpen d77b307457 refactor(task-review): enhance scoring interface and improve user interactions
- Introduced a new button for batch AI scoring alongside the existing batch scoring functionality.
- Replaced the inline input for teacher scores with a button that opens a dedicated score dialog for better user experience.
- Improved the layout of the task review panel, including the addition of action buttons for viewing reference answers and AI assistance.
- Updated dialog components for single and batch scoring to enhance usability and visual consistency.
2 months ago
qinzhenpen fcb060fde0 refactor(training-task): streamline SVG and input elements for improved readability
- Cleaned up SVG and input element formatting for consistency and readability.
- Ensured proper spacing and alignment in the template structure.
- Enhanced the overall maintainability of the code by reducing unnecessary line breaks and improving element organization.
2 months ago

@ -6,23 +6,23 @@
<svg class="decoration-lines" viewBox="0 0 400 60" preserveAspectRatio="xMidYMid slice"> <svg class="decoration-lines" viewBox="0 0 400 60" preserveAspectRatio="xMidYMid slice">
<defs> <defs>
<linearGradient id="headerGrad" x1="0%" y1="0%" x2="100%" y2="0%"> <linearGradient id="headerGrad" x1="0%" y1="0%" x2="100%" y2="0%">
<stop offset="0%" style="stop-color:#2563eb;stop-opacity:0" /> <stop offset="0%" style="stop-color: #2563eb; stop-opacity: 0" />
<stop offset="50%" style="stop-color:#2563eb;stop-opacity:0.3" /> <stop offset="50%" style="stop-color: #2563eb; stop-opacity: 0.3" />
<stop offset="100%" style="stop-color:#2ba471;stop-opacity:0" /> <stop offset="100%" style="stop-color: #2ba471; stop-opacity: 0" />
</linearGradient> </linearGradient>
</defs> </defs>
<line x1="0" y1="58" x2="400" y2="58" stroke="url(#headerGrad)" stroke-width="1"/> <line x1="0" y1="58" x2="400" y2="58" stroke="url(#headerGrad)" stroke-width="1" />
<circle cx="50" cy="30" r="3" fill="#2563eb" opacity="0.2"/> <circle cx="50" cy="30" r="3" fill="#2563eb" opacity="0.2" />
<circle cx="150" cy="20" r="2" fill="#2ba471" opacity="0.2"/> <circle cx="150" cy="20" r="2" fill="#2ba471" opacity="0.2" />
<circle cx="250" cy="40" r="2.5" fill="#2563eb" opacity="0.15"/> <circle cx="250" cy="40" r="2.5" fill="#2563eb" opacity="0.15" />
<circle cx="350" cy="25" r="2" fill="#2ba471" opacity="0.2"/> <circle cx="350" cy="25" r="2" fill="#2ba471" opacity="0.2" />
</svg> </svg>
</div> </div>
<div class="header-content"> <div class="header-content">
<div class="header-icon"> <div class="header-icon">
<svg width="32" height="32" viewBox="0 0 24 24" fill="none"> <svg width="32" height="32" viewBox="0 0 24 24" fill="none">
<path d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2" stroke="#2563eb" stroke-width="1.5" stroke-linecap="round"/> <path d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2" stroke="#2563eb" stroke-width="1.5" stroke-linecap="round" />
<path d="M9 12h6M9 16h6" stroke="#2563eb" stroke-width="1.5" stroke-linecap="round"/> <path d="M9 12h6M9 16h6" stroke="#2563eb" stroke-width="1.5" stroke-linecap="round" />
</svg> </svg>
</div> </div>
<div class="header-text"> <div class="header-text">
@ -48,22 +48,16 @@
<div class="search-area"> <div class="search-area">
<div class="search-box"> <div class="search-box">
<svg class="search-icon" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"> <svg class="search-icon" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<circle cx="11" cy="11" r="8"/> <circle cx="11" cy="11" r="8" />
<path d="M21 21l-4.35-4.35"/> <path d="M21 21l-4.35-4.35" />
</svg> </svg>
<input <input v-model.trim="keyword" type="text" placeholder="输入实训任务名称搜索..." class="search-input" @keyup.enter="queryTasks" />
v-model.trim="keyword"
type="text"
placeholder="输入实训任务名称搜索..."
class="search-input"
@keyup.enter="queryTasks"
/>
<button v-if="keyword" class="clear-btn" @click="keyword = ''">×</button> <button v-if="keyword" class="clear-btn" @click="keyword = ''">×</button>
</div> </div>
<el-button type="primary" class="search-btn" @click="queryTasks"> <el-button type="primary" class="search-btn" @click="queryTasks">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"> <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<circle cx="11" cy="11" r="8"/> <circle cx="11" cy="11" r="8" />
<path d="M21 21l-4.35-4.35"/> <path d="M21 21l-4.35-4.35" />
</svg> </svg>
<span>查询</span> <span>查询</span>
</el-button> </el-button>
@ -71,18 +65,18 @@
<div class="toolbar-actions"> <div class="toolbar-actions">
<button class="tool-btn" @click="downloadTemplate"> <button class="tool-btn" @click="downloadTemplate">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"> <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M21 15v4a2 2 0 01-2 2H5a2 2 0 01-2-2v-4"/> <path d="M21 15v4a2 2 0 01-2 2H5a2 2 0 01-2-2v-4" />
<polyline points="7 10 12 15 17 10"/> <polyline points="7 10 12 15 17 10" />
<line x1="12" y1="15" x2="12" y2="3"/> <line x1="12" y1="15" x2="12" y2="3" />
</svg> </svg>
<span>下载模板</span> <span>下载模板</span>
</button> </button>
<el-upload action="#" :auto-upload="false" :show-file-list="false" :on-change="handleImportChange"> <el-upload action="#" :auto-upload="false" :show-file-list="false" :on-change="handleImportChange">
<button class="tool-btn"> <button class="tool-btn">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"> <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M21 15v4a2 2 0 01-2 2H5a2 2 0 01-2-2v-4"/> <path d="M21 15v4a2 2 0 01-2 2H5a2 2 0 01-2-2v-4" />
<polyline points="17 8 12 3 7 8"/> <polyline points="17 8 12 3 7 8" />
<line x1="12" y1="3" x2="12" y2="15"/> <line x1="12" y1="3" x2="12" y2="15" />
</svg> </svg>
<span>导入配置</span> <span>导入配置</span>
</button> </button>
@ -93,33 +87,23 @@
<div class="project-filter"> <div class="project-filter">
<span class="filter-label"> <span class="filter-label">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"> <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M22 19a2 2 0 01-2 2H4a2 2 0 01-2-2V5a2 2 0 012-2h5l2 3h9a2 2 0 012 2z"/> <path d="M22 19a2 2 0 01-2 2H4a2 2 0 01-2-2V5a2 2 0 012-2h5l2 3h9a2 2 0 012 2z" />
</svg> </svg>
所属项目: 所属项目:
</span> </span>
<div class="project-tabs"> <div class="project-tabs">
<button <button type="button" :class="['project-tab', { active: !activeProject }]" @click="activeProject = ''">
type="button"
:class="['project-tab', { active: !activeProject }]"
@click="activeProject = ''"
>
<span class="tab-name">全部</span> <span class="tab-name">全部</span>
<span class="tab-count">{{ tasks.length }}</span> <span class="tab-count">{{ tasks.length }}</span>
</button> </button>
<button <button v-for="project in projectOptions" :key="project.name" type="button" :class="['project-tab', { active: activeProject === project.name }]" @click="toggleProject(project.name)">
v-for="project in projectOptions"
:key="project.name"
type="button"
:class="['project-tab', { active: activeProject === project.name }]"
@click="toggleProject(project.name)"
>
<span class="tab-name">{{ project.name }}</span> <span class="tab-name">{{ project.name }}</span>
<span class="tab-count">{{ project.count }}</span> <span class="tab-count">{{ project.count }}</span>
</button> </button>
</div> </div>
<div class="filter-result"> <div class="filter-result">
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"> <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<polyline points="20 6 9 17 4 12"/> <polyline points="20 6 9 17 4 12" />
</svg> </svg>
<span>显示 {{ filteredTasks.length }} / {{ tasks.length }} 条</span> <span>显示 {{ filteredTasks.length }} / {{ tasks.length }} 条</span>
</div> </div>
@ -128,27 +112,19 @@
<!-- 任务网格 --> <!-- 任务网格 -->
<section v-loading="loading" class="task-grid"> <section v-loading="loading" class="task-grid">
<article <article v-for="(task, index) in filteredTasks" :key="task.id || task.taskKey" class="task-card" role="button" tabindex="0" @click="viewTask(task)" @keydown.enter.prevent="viewTask(task)">
v-for="(task, index) in filteredTasks"
:key="task.id || task.taskKey"
class="task-card"
role="button"
tabindex="0"
@click="viewTask(task)"
@keydown.enter.prevent="viewTask(task)"
>
<div class="card-decoration"> <div class="card-decoration">
<svg class="corner-decoration top-left" width="24" height="24" viewBox="0 0 24 24"> <svg class="corner-decoration top-left" width="24" height="24" viewBox="0 0 24 24">
<path d="M2 8V2h6" stroke="#2563eb" stroke-width="2" fill="none" opacity="0.6"/> <path d="M2 8V2h6" stroke="#2563eb" stroke-width="2" fill="none" opacity="0.6" />
</svg> </svg>
<svg class="corner-decoration top-right" width="24" height="24" viewBox="0 0 24 24"> <svg class="corner-decoration top-right" width="24" height="24" viewBox="0 0 24 24">
<path d="M22 8V2h-6" stroke="#2563eb" stroke-width="2" fill="none" opacity="0.6"/> <path d="M22 8V2h-6" stroke="#2563eb" stroke-width="2" fill="none" opacity="0.6" />
</svg> </svg>
<svg class="corner-decoration bottom-left" width="24" height="24" viewBox="0 0 24 24"> <svg class="corner-decoration bottom-left" width="24" height="24" viewBox="0 0 24 24">
<path d="M2 16v6h6" stroke="#2ba471" stroke-width="2" fill="none" opacity="0.4"/> <path d="M2 16v6h6" stroke="#2ba471" stroke-width="2" fill="none" opacity="0.4" />
</svg> </svg>
<svg class="corner-decoration bottom-right" width="24" height="24" viewBox="0 0 24 24"> <svg class="corner-decoration bottom-right" width="24" height="24" viewBox="0 0 24 24">
<path d="M22 16v6h-6" stroke="#2ba471" stroke-width="2" fill="none" opacity="0.4"/> <path d="M22 16v6h-6" stroke="#2ba471" stroke-width="2" fill="none" opacity="0.4" />
</svg> </svg>
</div> </div>
@ -158,12 +134,12 @@
<div class="card-header"> <div class="card-header">
<span class="task-project"> <span class="task-project">
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"> <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M22 19a2 2 0 01-2 2H4a2 2 0 01-2-2V5a2 2 0 012-2h5l2 3h9a2 2 0 012 2z"/> <path d="M22 19a2 2 0 01-2 2H4a2 2 0 01-2-2V5a2 2 0 012-2h5l2 3h9a2 2 0 012 2z" />
</svg> </svg>
{{ task.project || "默认实训任务" }} {{ task.project || "默认实训任务" }}
</span> </span>
<span :class="['task-status', { enabled: task.enabled }]"> <span :class="['task-status', { enabled: task.enabled }]">
{{ task.enabled ? '启用' : '停用' }} {{ task.enabled ? "启用" : "停用" }}
</span> </span>
</div> </div>
@ -172,15 +148,15 @@
<div class="task-meta"> <div class="task-meta">
<span class="meta-item"> <span class="meta-item">
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"> <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M9 11l3 3L22 4"/> <path d="M9 11l3 3L22 4" />
<path d="M21 12v7a2 2 0 01-2 2H5a2 2 0 01-2-2V5a2 2 0 012-2h11"/> <path d="M21 12v7a2 2 0 01-2 2H5a2 2 0 01-2-2V5a2 2 0 012-2h11" />
</svg> </svg>
{{ task.objectives?.length || 0 }} 个目标 {{ task.objectives?.length || 0 }} 个目标
</span> </span>
<span class="meta-item"> <span class="meta-item">
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"> <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"/> <path d="M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z" />
<polyline points="14 2 14 8 20 8"/> <polyline points="14 2 14 8 20 8" />
</svg> </svg>
{{ task.steps?.length || 0 }} 个步骤 {{ task.steps?.length || 0 }} 个步骤
</span> </span>
@ -190,8 +166,8 @@
<div class="card-actions" @click.stop> <div class="card-actions" @click.stop>
<el-button type="primary" class="edit-btn" @click="editTask(task)"> <el-button type="primary" class="edit-btn" @click="editTask(task)">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"> <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"/> <path d="M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7" />
<path d="M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"/> <path d="M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z" />
</svg> </svg>
编辑任务 编辑任务
</el-button> </el-button>
@ -204,39 +180,32 @@
<el-empty v-if="!filteredTasks.length && !loading" class="task-empty" description="暂无匹配的实训任务"> <el-empty v-if="!filteredTasks.length && !loading" class="task-empty" description="暂无匹配的实训任务">
<template #image> <template #image>
<svg width="80" height="80" viewBox="0 0 24 24" fill="none" stroke="#2563eb" stroke-width="1" opacity="0.3"> <svg width="80" height="80" viewBox="0 0 24 24" fill="none" stroke="#2563eb" stroke-width="1" opacity="0.3">
<path d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2"/> <path d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2" />
<rect x="9" y="3" width="6" height="4" rx="1"/> <rect x="9" y="3" width="6" height="4" rx="1" />
</svg> </svg>
</template> </template>
</el-empty> </el-empty>
</section> </section>
<!-- 抽屉编辑 --> <!-- 抽屉编辑 -->
<el-drawer <el-drawer v-model="dialogVisible" :size="860" class="training-task-drawer" append-to-body destroy-on-close :with-header="false">
v-model="dialogVisible"
:size="860"
class="training-task-drawer"
append-to-body
destroy-on-close
:with-header="false"
>
<div class="drawer-shell"> <div class="drawer-shell">
<header class="drawer-header"> <header class="drawer-header">
<div class="drawer-heading"> <div class="drawer-heading">
<span class="drawer-kicker"> <span class="drawer-kicker">
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"> <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<circle cx="12" cy="12" r="10"/> <circle cx="12" cy="12" r="10" />
<path d="M12 8v4l3 3"/> <path d="M12 8v4l3 3" />
</svg> </svg>
{{ dialogMode === "view" ? 'Training Task Preview' : 'Training Task Editor' }} {{ dialogMode === "view" ? "Training Task Preview" : "Training Task Editor" }}
</span> </span>
<h3>{{ dialogMode === "view" ? "查看实训任务" : "编辑实训任务" }}</h3> <h3>{{ dialogMode === "view" ? "查看实训任务" : "编辑实训任务" }}</h3>
<p>管理员维护系统默认实训配置,教学班未单独配置时学生端使用这里的实训背景、目标、要求和案例文档。</p> <p>管理员维护系统默认实训配置,教学班未单独配置时学生端使用这里的实训背景、目标、要求和案例文档。</p>
</div> </div>
<button class="drawer-close-button" aria-label="关闭抽屉" @click="dialogVisible = false"> <button class="drawer-close-button" aria-label="关闭抽屉" @click="dialogVisible = false">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"> <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<line x1="18" y1="6" x2="6" y2="18"/> <line x1="18" y1="6" x2="6" y2="18" />
<line x1="6" y1="6" x2="18" y2="18"/> <line x1="6" y1="6" x2="18" y2="18" />
</svg> </svg>
</button> </button>
</header> </header>
@ -244,7 +213,7 @@
<div class="drawer-identity"> <div class="drawer-identity">
<div class="identity-item"> <div class="identity-item">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"> <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M22 19a2 2 0 01-2 2H4a2 2 0 01-2-2V5a2 2 0 012-2h5l2 3h9a2 2 0 012 2z"/> <path d="M22 19a2 2 0 01-2 2H4a2 2 0 01-2-2V5a2 2 0 012-2h5l2 3h9a2 2 0 012 2z" />
</svg> </svg>
<div class="identity-content"> <div class="identity-content">
<span class="identity-label">所属项目</span> <span class="identity-label">所属项目</span>
@ -253,8 +222,8 @@
</div> </div>
<div class="identity-item"> <div class="identity-item">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"> <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2"/> <path d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2" />
<rect x="9" y="3" width="6" height="4" rx="1"/> <rect x="9" y="3" width="6" height="4" rx="1" />
</svg> </svg>
<div class="identity-content"> <div class="identity-content">
<span class="identity-label">实训任务</span> <span class="identity-label">实训任务</span>
@ -263,8 +232,8 @@
</div> </div>
<div class="identity-item status"> <div class="identity-item status">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"> <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M22 11.08V12a10 10 0 11-5.93-9.14"/> <path d="M22 11.08V12a10 10 0 11-5.93-9.14" />
<polyline points="22 4 12 14.01 9 11.01"/> <polyline points="22 4 12 14.01 9 11.01" />
</svg> </svg>
<div class="identity-content"> <div class="identity-content">
<span class="identity-label">任务状态</span> <span class="identity-label">任务状态</span>
@ -298,7 +267,7 @@
<el-form-item label="任务状态:"> <el-form-item label="任务状态:">
<div class="switch-wrapper"> <div class="switch-wrapper">
<el-switch v-model="taskForm.enabled" /> <el-switch v-model="taskForm.enabled" />
<span class="switch-label">{{ taskForm.enabled ? '已启用' : '已停用' }}</span> <span class="switch-label">{{ taskForm.enabled ? "已启用" : "已停用" }}</span>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item label="实训背景:"> <el-form-item label="实训背景:">
@ -319,23 +288,17 @@
<div v-for="(objective, index) in taskForm.objectives" :key="index" class="objective-row"> <div v-for="(objective, index) in taskForm.objectives" :key="index" class="objective-row">
<div class="objective-number">{{ index + 1 }}</div> <div class="objective-number">{{ index + 1 }}</div>
<el-input v-model="taskForm.objectives[index]" placeholder="请输入实训目标" /> <el-input v-model="taskForm.objectives[index]" placeholder="请输入实训目标" />
<button <button v-if="!isReadonly" type="button" class="remove-btn" :disabled="taskForm.objectives.length <= 1" @click="removeObjective(index)">
v-if="!isReadonly"
type="button"
class="remove-btn"
:disabled="taskForm.objectives.length <= 1"
@click="removeObjective(index)"
>
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"> <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<line x1="18" y1="6" x2="6" y2="18"/> <line x1="18" y1="6" x2="6" y2="18" />
<line x1="6" y1="6" x2="18" y2="18"/> <line x1="6" y1="6" x2="18" y2="18" />
</svg> </svg>
</button> </button>
</div> </div>
<button v-if="!isReadonly" type="button" class="add-objective-button" @click="addObjective"> <button v-if="!isReadonly" type="button" class="add-objective-button" @click="addObjective">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"> <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<line x1="12" y1="5" x2="12" y2="19"/> <line x1="12" y1="5" x2="12" y2="19" />
<line x1="5" y1="12" x2="19" y2="12"/> <line x1="5" y1="12" x2="19" y2="12" />
</svg> </svg>
新增目标 新增目标
</button> </button>
@ -352,14 +315,14 @@
<span class="section-number">03</span> <span class="section-number">03</span>
<div class="section-info"> <div class="section-info">
<h4>资料与步骤</h4> <h4>资料与步骤</h4>
<p>上传案例资料、案例视频、实训指导手册与AI排错指导手册,配置实训步骤</p> <p>上传案例资料、案例数据、实训指导手册与AI排错指导手册,配置实训步骤</p>
</div> </div>
</div> </div>
<div v-for="slot in materialSlots" :key="slot.key" class="material-row"> <div v-for="slot in materialSlots" :key="slot.key" class="material-row">
<div class="material-info"> <div class="material-info">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"> <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"/> <path d="M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z" />
<polyline points="14 2 14 8 20 8"/> <polyline points="14 2 14 8 20 8" />
</svg> </svg>
<div class="material-text"> <div class="material-text">
<span class="material-label">{{ slot.label }}</span> <span class="material-label">{{ slot.label }}</span>
@ -368,29 +331,17 @@
</div> </div>
</div> </div>
<div class="material-ops"> <div class="material-ops">
<el-upload <el-upload v-if="!isReadonly" action="#" :auto-upload="false" :show-file-list="false" :on-change="(file) => handleMaterialChange(slot.key, file)">
v-if="!isReadonly"
action="#"
:auto-upload="false"
:show-file-list="false"
:on-change="(file) => handleMaterialChange(slot.key, file)"
>
<el-button type="primary" :loading="uploadingField === slot.key" class="upload-btn"> <el-button type="primary" :loading="uploadingField === slot.key" class="upload-btn">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"> <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M21 15v4a2 2 0 01-2 2H5a2 2 0 01-2-2v-4"/> <path d="M21 15v4a2 2 0 01-2 2H5a2 2 0 01-2-2v-4" />
<polyline points="17 8 12 3 7 8"/> <polyline points="17 8 12 3 7 8" />
<line x1="12" y1="3" x2="12" y2="15"/> <line x1="12" y1="3" x2="12" y2="15" />
</svg> </svg>
{{ uploadingField === slot.key ? '上传中...' : '上传' }} {{ uploadingField === slot.key ? "上传中..." : "上传" }}
</el-button> </el-button>
</el-upload> </el-upload>
<el-button <el-button v-if="!isReadonly && hasMaterial(slot.key)" type="danger" plain class="clear-material-btn" @click="clearMaterial(slot.key)">清除</el-button>
v-if="!isReadonly && hasMaterial(slot.key)"
type="danger"
plain
class="clear-material-btn"
@click="clearMaterial(slot.key)"
>清除</el-button>
</div> </div>
</div> </div>
@ -403,35 +354,28 @@
<div v-for="(step, index) in taskForm.steps" :key="step.id" class="step-item"> <div v-for="(step, index) in taskForm.steps" :key="step.id" class="step-item">
<div class="step-connector" v-if="index > 0"> <div class="step-connector" v-if="index > 0">
<svg width="20" height="12" viewBox="0 0 20 12"> <svg width="20" height="12" viewBox="0 0 20 12">
<path d="M0 6h16M12 1l4 5-4 5" stroke="#2563eb" stroke-width="1.5" fill="none" opacity="0.5"/> <path d="M0 6h16M12 1l4 5-4 5" stroke="#2563eb" stroke-width="1.5" fill="none" opacity="0.5" />
</svg> </svg>
</div> </div>
<div class="step-content"> <div class="step-content">
<span class="step-number">{{ index + 1 }}</span> <span class="step-number">{{ index + 1 }}</span>
<el-input v-model="step.name" placeholder="步骤名称" /> <el-input v-model="step.name" placeholder="步骤名称" />
<template v-if="index === 0 && supportsStepOneChoice(taskForm.taskKey)"> <template v-if="index === 0 && supportsStepOneChoice(taskForm.taskKey)">
<el-button v-if="!isReadonly" type="primary" class="step-question-btn" @click="choiceEditorVisible = true"> <el-button v-if="!isReadonly" type="primary" class="step-question-btn" @click="choiceEditorVisible = true">编辑题目{{ stepOneQuestionCount ? `(${stepOneQuestionCount}题)` : "" }}</el-button>
编辑题目{{ stepOneQuestionCount ? `(${stepOneQuestionCount}题)` : "" }}
</el-button>
<span v-else class="step-question-tag">已配置 {{ stepOneQuestionCount }} 道题</span> <span v-else class="step-question-tag">已配置 {{ stepOneQuestionCount }} 道题</span>
</template> </template>
<button <button v-if="!isReadonly && taskForm.steps.length > 1" type="button" class="remove-btn" @click="removeStep(index)">
v-if="!isReadonly && taskForm.steps.length > 1"
type="button"
class="remove-btn"
@click="removeStep(index)"
>
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"> <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<polyline points="3 6 5 6 21 6"/> <polyline points="3 6 5 6 21 6" />
<path d="M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"/> <path d="M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2" />
</svg> </svg>
</button> </button>
</div> </div>
</div> </div>
<button v-if="!isReadonly" type="button" class="add-step-button" @click="addStep"> <button v-if="!isReadonly" type="button" class="add-step-button" @click="addStep">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"> <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<line x1="12" y1="5" x2="12" y2="19"/> <line x1="12" y1="5" x2="12" y2="19" />
<line x1="5" y1="12" x2="19" y2="12"/> <line x1="5" y1="12" x2="19" y2="12" />
</svg> </svg>
新增步骤 新增步骤
</button> </button>
@ -442,13 +386,13 @@
<footer class="drawer-footer"> <footer class="drawer-footer">
<el-button class="cancel-btn" @click="dialogVisible = false"> <el-button class="cancel-btn" @click="dialogVisible = false">
{{ isReadonly ? '关闭' : '取消' }} {{ isReadonly ? "关闭" : "取消" }}
</el-button> </el-button>
<el-button v-if="!isReadonly" type="primary" class="save-btn" :loading="saving" @click="submitTask"> <el-button v-if="!isReadonly" type="primary" class="save-btn" :loading="saving" @click="submitTask">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"> <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M19 21H5a2 2 0 01-2-2V5a2 2 0 012-2h11l5 5v11a2 2 0 01-2 2z"/> <path d="M19 21H5a2 2 0 01-2-2V5a2 2 0 012-2h11l5 5v11a2 2 0 01-2 2z" />
<polyline points="17 21 17 13 7 13 7 21"/> <polyline points="17 21 17 13 7 13 7 21" />
<polyline points="7 3 7 8 15 8"/> <polyline points="7 3 7 8 15 8" />
</svg> </svg>
保存配置 保存配置
</el-button> </el-button>
@ -459,13 +403,7 @@
</template> </template>
<script setup> <script setup>
import { import { downloadTrainingTaskTemplate, importTrainingTasks, listTrainingTasks, updateTrainingTask, uploadTrainingTaskMaterial } from "@/api/trainingTask";
downloadTrainingTaskTemplate,
importTrainingTasks,
listTrainingTasks,
updateTrainingTask,
uploadTrainingTaskMaterial,
} from "@/api/trainingTask";
import StepOneChoiceQuestionEditor from "@/views/components/StepOneChoiceQuestionEditor.vue"; import StepOneChoiceQuestionEditor from "@/views/components/StepOneChoiceQuestionEditor.vue";
import StepOneQuestionBankPicker from "@/views/components/StepOneQuestionBankPicker.vue"; import StepOneQuestionBankPicker from "@/views/components/StepOneQuestionBankPicker.vue";
import { parseStepOneChoiceQuestions, supportsStepOneChoiceQuestions } from "@/utils/stepOneChoiceQuestions"; import { parseStepOneChoiceQuestions, supportsStepOneChoiceQuestions } from "@/utils/stepOneChoiceQuestions";
@ -483,9 +421,9 @@ const bankPickerVisible = ref(false);
// 四类资料槽位:key 对应 taskForm 的 `${key}Name` / `${key}Url` 字段 // 四类资料槽位:key 对应 taskForm 的 `${key}Name` / `${key}Url` 字段
const materialSlots = [ const materialSlots = [
{ key: "material", label: "案例资料" }, { key: "material", label: "案例资料" },
{ key: "trainingData", label: "案例视频" }, { key: "trainingData", label: "案例数据" },
{ key: "guideManual", label: "实训指导手册" }, { key: "guideManual", label: "实训指导手册" },
{ key: "aiManual", label: "AI排错指导手册" }, { key: "aiManual", label: "AI辅助指导手册" },
]; ];
const tasks = ref([]); const tasks = ref([]);
const dialogVisible = ref(false); const dialogVisible = ref(false);
@ -495,7 +433,7 @@ const taskForm = reactive(createEmptyTask());
const isReadonly = computed(() => dialogMode.value === "view"); const isReadonly = computed(() => dialogMode.value === "view");
const stepOneQuestionCount = computed(() => taskForm.stepOneQuestions?.length || 0); const stepOneQuestionCount = computed(() => taskForm.stepOneQuestions?.length || 0);
const enabledCount = computed(() => tasks.value.filter(t => t.enabled).length); const enabledCount = computed(() => tasks.value.filter((t) => t.enabled).length);
const projects = computed(() => [...new Set(tasks.value.map((task) => task.project).filter(Boolean))]); const projects = computed(() => [...new Set(tasks.value.map((task) => task.project).filter(Boolean))]);
const projectOptions = computed(() => { const projectOptions = computed(() => {
@ -1143,7 +1081,9 @@ function buildPayload() {
&:hover { &:hover {
border-color: rgba(37, 99, 235, 0.45); border-color: rgba(37, 99, 235, 0.45);
transform: translateY(-4px); transform: translateY(-4px);
box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4), 0 0 30px rgba(37, 99, 235, 0.15); box-shadow:
0 20px 40px rgba(0, 0, 0, 0.4),
0 0 30px rgba(37, 99, 235, 0.15);
.card-glow { .card-glow {
opacity: 1; opacity: 1;
@ -1161,10 +1101,22 @@ function buildPayload() {
opacity: 0.6; opacity: 0.6;
transition: opacity 0.3s ease; transition: opacity 0.3s ease;
&.top-left { top: 8px; left: 8px; } &.top-left {
&.top-right { top: 8px; right: 8px; } top: 8px;
&.bottom-left { bottom: 8px; left: 8px; } left: 8px;
&.bottom-right { bottom: 8px; right: 8px; } }
&.top-right {
top: 8px;
right: 8px;
}
&.bottom-left {
bottom: 8px;
left: 8px;
}
&.bottom-right {
bottom: 8px;
right: 8px;
}
} }
} }
@ -1295,8 +1247,12 @@ function buildPayload() {
} }
@keyframes scanline { @keyframes scanline {
0% { left: -100%; } 0% {
100% { left: 200%; } left: -100%;
}
100% {
left: 200%;
}
} }
.task-empty { .task-empty {
@ -1446,7 +1402,9 @@ function buildPayload() {
.status-value { .status-value {
color: #ff6b6b; color: #ff6b6b;
&.enabled { color: #2ba471; } &.enabled {
color: #2ba471;
}
} }
} }
@ -1605,7 +1563,8 @@ function buildPayload() {
border: 1px solid rgba(37, 99, 235, 0.4) !important; border: 1px solid rgba(37, 99, 235, 0.4) !important;
box-shadow: none !important; box-shadow: none !important;
&:hover, &.is-focus { &:hover,
&.is-focus {
border-color: rgba(37, 99, 235, 0.6) !important; border-color: rgba(37, 99, 235, 0.6) !important;
} }
} }
@ -1728,10 +1687,10 @@ function buildPayload() {
} }
.material-label { .material-label {
flex-shrink: 0; flex-shrink: 0;
color: #1f2937; color: #1f2937;
font-weight: 600; font-weight: 600;
} }
.material-link { .material-link {
overflow: hidden; overflow: hidden;
@ -1832,7 +1791,8 @@ function buildPayload() {
border: 1px solid rgba(37, 99, 235, 0.4) !important; border: 1px solid rgba(37, 99, 235, 0.4) !important;
box-shadow: none !important; box-shadow: none !important;
&:hover, &.is-focus { &:hover,
&.is-focus {
border-color: rgba(37, 99, 235, 0.6) !important; border-color: rgba(37, 99, 235, 0.6) !important;
} }
} }

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save