首次提交
Azure Static Web Apps CI/CD / Close Pull Request Job (push) Skipped
Build and Deploy / build (push) Failing after 9m48s
Azure Static Web Apps CI/CD / Build and Deploy Job (push) Failing after 9m50s

This commit is contained in:
2026-10-24 01:29:24 +08:00
parent e70d46436c
commit c7fdc11dbd
146 changed files with 9750 additions and 5578 deletions
+314 -127
View File
@@ -11,7 +11,9 @@
@click:close="error = ''"
>
<div class="d-flex align-center">
<v-icon class="mr-2">mdi-alert-circle</v-icon>
<v-icon class="mr-2">
mdi-alert-circle
</v-icon>
{{ error }}
</div>
</v-alert>
@@ -27,7 +29,9 @@
@click:close="success = ''"
>
<div class="d-flex align-center">
<v-icon class="mr-2">mdi-check-circle</v-icon>
<v-icon class="mr-2">
mdi-check-circle
</v-icon>
{{ success }}
</div>
</v-alert>
@@ -43,29 +47,49 @@
<div class="d-flex align-center">
<span class="font-weight-bold">配置验证失败,请检查以下问题:</span>
</div>
<v-list class="bg-transparent" density="compact">
<v-list
class="bg-transparent"
density="compact"
>
<v-list-item
v-for="(error, index) in validationErrors"
:key="index"
class="px-0 py-0"
>
<template v-slot:prepend>
<v-icon color="warning" size="small">mdi-circle-small</v-icon>
<template #prepend>
<v-icon
color="warning"
size="small"
>
mdi-circle-small
</v-icon>
</template>
<v-list-item-title class="text-body-2">{{ error }}</v-list-item-title>
<v-list-item-title class="text-body-2">
{{ error }}
</v-list-item-title>
</v-list-item>
</v-list>
</v-alert>
<!-- 加载状态 -->
<v-card v-if="loading" class="my-4" outlined>
<v-card
v-if="loading"
class="my-4"
outlined
>
<v-card-text>
<v-skeleton-loader class="mx-auto" type="article"></v-skeleton-loader>
<v-skeleton-loader
class="mx-auto"
type="article"
/>
</v-card-text>
</v-card>
<!-- 模式切换按钮和操作按钮 -->
<div v-if="!loading" class="d-flex justify-space-between align-center mb-4">
<div
v-if="!loading"
class="d-flex justify-space-between align-center mb-4"
>
<div class="d-flex align-center gap-2">
<v-btn
:disabled="!isValidConfig"
@@ -140,19 +164,31 @@
class="text-error"
prepend-icon="mdi-delete"
@click="confirmDelete"
>
删除配置
</v-btn>
<v-btn :value="false" prepend-icon="mdi-eye"> 预览</v-btn>
<v-btn :value="true" prepend-icon="mdi-pencil"> 编辑</v-btn>
<v-btn
:value="false"
prepend-icon="mdi-eye"
>
预览
</v-btn>
<v-btn
:value="true"
prepend-icon="mdi-pencil"
>
编辑
</v-btn>
</v-btn-toggle>
</div>
<!-- 预览模式 -->
<div v-if="!loading && !isEditMode">
<div class="mb-8">
<div class="text-h3 font-weight-bold" style="line-height: 1.2">
<div
class="text-h3 font-weight-bold"
style="line-height: 1.2"
>
{{ localConfig.examName || "未设置考试名称" }}
</div>
<div
@@ -161,8 +197,14 @@
>
{{ localConfig.message || "未设置考试提示" }}
</div>
<v-chip v-if="localConfig.room" class="px-4 py-2" size="large">
<v-icon start>mdi-home</v-icon>
<v-chip
v-if="localConfig.room"
class="px-4 py-2"
size="large"
>
<v-icon start>
mdi-home
</v-icon>
考场:{{ localConfig.room }}
</v-chip>
</div>
@@ -178,20 +220,29 @@
lg="4"
md="6"
>
<v-card class="h-100" hover variant="tonal">
<v-card
class="h-100"
hover
variant="tonal"
>
<v-card-title class="bg-primary-lighten-5 pa-4">
<div class="d-flex align-center">
<v-icon class="mr-2">mdi-book-open-page-variant</v-icon>
<v-icon class="mr-2">
mdi-book-open-page-variant
</v-icon>
<span class="">{{ examInfo.name || "未设置科目" }}</span>
</div>
</v-card-title>
<v-card-text class="pa-4">
<div class="mb-3">
<div class="d-flex align-center mb-1">
<v-icon class="mr-2" color="success" size="small"
>mdi-clock-start
</v-icon
<v-icon
class="mr-2"
color="success"
size="small"
>
mdi-clock-start
</v-icon>
<span class="text-body-2 text-grey-darken-1">开始时间</span>
</div>
<div class="text-h6 font-weight-medium text-success">
@@ -200,10 +251,13 @@
</div>
<div>
<div class="d-flex align-center mb-1">
<v-icon class="mr-2" color="error" size="small"
>mdi-clock-end
</v-icon
<v-icon
class="mr-2"
color="error"
size="small"
>
mdi-clock-end
</v-icon>
<span class="text-body-2 text-grey-darken-1">结束时间</span>
</div>
<div class="text-h6 font-weight-medium text-error">
@@ -215,29 +269,50 @@
</v-col>
</v-row>
</div>
<div v-else class="text-center py-12">
<v-icon class="mb-4" color="grey-lighten-2" size="80">
<div
v-else
class="text-center py-12"
>
<v-icon
class="mb-4"
color="grey-lighten-2"
size="80"
>
mdi-calendar-blank
</v-icon>
<div class="text-h5 text-grey-darken-1 mb-2">暂无考试科目安排</div>
<div class="text-h5 text-grey-darken-1 mb-2">
暂无考试科目安排
</div>
<div class="text-body-1 text-grey mb-4">
点击上方"添加科目"按钮开始配置考试时间表
</div>
<v-btn color="primary" variant="outlined" @click="quickEdit">
<v-icon start>mdi-plus</v-icon>
<v-btn
color="primary"
variant="outlined"
@click="quickEdit"
>
<v-icon start>
mdi-plus
</v-icon>
立即添加
</v-btn>
</div>
<!-- JSON预览 -->
<v-card border class="mb-4" elevation="2">
<v-card
border
class="mb-4"
elevation="2"
>
<v-card-title
class="d-flex align-center text-white cursor-pointer"
@click="showJsonPreview = !showJsonPreview"
>
<v-icon class="mr-2">mdi-code-json</v-icon>
<v-icon class="mr-2">
mdi-code-json
</v-icon>
配置预览
<v-spacer></v-spacer>
<v-spacer />
<v-btn
color="white"
@@ -255,12 +330,17 @@
color="white"
size="small"
variant="text"
>
</v-btn>
/>
</v-card-title>
<v-expand-transition>
<v-card-text v-show="showJsonPreview" class="pa-4">
<v-card class="pa-4" variant="tonal">
<v-card-text
v-show="showJsonPreview"
class="pa-4"
>
<v-card
class="pa-4"
variant="tonal"
>
<pre class="json-preview"><code>{{ formattedStorageJson }}</code></pre>
</v-card>
</v-card-text>
@@ -271,14 +351,23 @@
<!-- 编辑模式 -->
<div v-if="!loading && isEditMode">
<!-- 基本信息 -->
<v-card border class="mb-4" elevation="1">
<v-card
border
class="mb-4"
elevation="1"
>
<v-card-title class="d-flex align-center bg-primary-lighten-5 pa-4">
<v-icon class="mr-2">mdi-information</v-icon>
<v-icon class="mr-2">
mdi-information
</v-icon>
<span class="font-weight-bold">基本信息</span>
</v-card-title>
<v-card-text class="pa-6">
<v-row>
<v-col cols="12" md="6">
<v-col
cols="12"
md="6"
>
<v-text-field
v-model="localConfig.examName"
:rules="[
@@ -293,9 +382,12 @@
prepend-inner-icon="mdi-calendar-text"
required
variant="outlined"
></v-text-field>
/>
</v-col>
<v-col cols="12" md="6">
<v-col
cols="12"
md="6"
>
<v-text-field
v-model="localConfig.room"
clearable
@@ -304,13 +396,16 @@
placeholder="如:一号考场"
prepend-inner-icon="mdi-home"
variant="outlined"
></v-text-field>
/>
</v-col>
</v-row>
<v-row>
<v-col cols="12">
<span class="text-subtitle-2 font-weight-bold d-block mb-2">
<v-icon size="small" class="mr-1">mdi-message-text</v-icon>
<v-icon
size="small"
class="mr-1"
>mdi-message-text</v-icon>
考试提示
</span>
<v-textarea
@@ -326,10 +421,13 @@
placeholder="例如:请保持卷面整洁,诚信应考。在听到终考铃时立刻停止作答。"
rows="3"
variant="outlined"
></v-textarea>
/>
<!-- 默认提示选项 -->
<div v-if="!localConfig.message || localConfig.message.trim() === ''" class="mt-3">
<div
v-if="!localConfig.message || localConfig.message.trim() === ''"
class="mt-3"
>
<v-chip-group
class="d-flex gap-2"
column
@@ -343,12 +441,22 @@
variant="outlined"
@click="selectDefaultTip(tip)"
>
<v-icon size="small" start>mdi-plus</v-icon>
<v-icon
size="small"
start
>
mdi-plus
</v-icon>
{{ tip.substring(0, 20) }}...
</v-chip>
</v-chip-group>
<div class="text-caption text-medium-emphasis mt-2 ml-2">
<v-icon class="mr-1" size="x-small">mdi-lightbulb-outline</v-icon>
<v-icon
class="mr-1"
size="x-small"
>
mdi-lightbulb-outline
</v-icon>
点击上方选项快速添加常用考试提示
</div>
</div>
@@ -358,11 +466,17 @@
</v-card>
<!-- 考试科目安排 -->
<v-card border class="mb-4" elevation="1">
<v-card
border
class="mb-4"
elevation="1"
>
<v-card-title class="d-flex align-center bg-success-lighten-5 pa-4">
<v-icon class="mr-2">mdi-format-list-bulleted</v-icon>
<v-icon class="mr-2">
mdi-format-list-bulleted
</v-icon>
<span class="font-weight-bold">考试科目安排</span>
<v-spacer></v-spacer>
<v-spacer />
<!-- 提醒时间开关 -->
<div class="d-flex align-center mr-4">
@@ -373,7 +487,7 @@
hide-details
@change="toggleAlertTimeMode"
>
<template v-slot:label>
<template #label>
<span class="text-body-2">自定义提醒时间</span>
</template>
</v-switch>
@@ -408,14 +522,19 @@
variant="tonal"
class="mr-3"
>
<v-icon start size="small">mdi-numeric-{{ index + 1 }}-circle</v-icon>
<v-icon
start
size="small"
>
mdi-numeric-{{ index + 1 }}-circle
</v-icon>
第 {{ index + 1 }} 科目
</v-chip>
<!-- 考试时长显示 -->
<v-spacer></v-spacer>
<v-spacer />
<div class="d-flex gap-1">
<v-btn
v-if="index > 0"
@@ -425,7 +544,12 @@
variant="text"
@click="moveExamInfo(index, -1)"
>
<v-tooltip activator="parent" location="bottom">上移</v-tooltip>
<v-tooltip
activator="parent"
location="bottom"
>
上移
</v-tooltip>
</v-btn>
<v-btn
v-if="index < localConfig.examInfos.length - 1"
@@ -435,7 +559,12 @@
variant="text"
@click="moveExamInfo(index, 1)"
>
<v-tooltip activator="parent" location="bottom">下移</v-tooltip>
<v-tooltip
activator="parent"
location="bottom"
>
下移
</v-tooltip>
</v-btn>
<v-btn
color="error"
@@ -444,13 +573,21 @@
variant="text"
@click="removeExamInfo(index)"
>
<v-tooltip activator="parent" location="bottom">删除</v-tooltip>
<v-tooltip
activator="parent"
location="bottom"
>
删除
</v-tooltip>
</v-btn>
</div>
</div>
<v-row class="align-start">
<v-col cols="12" md="4">
<v-col
cols="12"
md="4"
>
<!-- 科目名称自动完成选择器 -->
<v-autocomplete
v-model="examInfo.name"
@@ -467,20 +604,23 @@
prepend-inner-icon="mdi-book"
variant="outlined"
>
<template v-slot:prepend-item>
<template #prepend-item>
<v-list-item
v-if="customSubjectInput"
title="自定义:"
>
<template v-slot:append>
<template #append>
<span class="text-primary font-weight-bold">{{ customSubjectInput }}</span>
</template>
</v-list-item>
<v-divider v-if="customSubjectInput"></v-divider>
<v-divider v-if="customSubjectInput" />
</template>
</v-autocomplete>
</v-col>
<v-col cols="12" md="3">
<v-col
cols="12"
md="3"
>
<v-menu
v-model="examInfo.startDateMenu"
:close-on-content-click="false"
@@ -488,7 +628,7 @@
offset-y
transition="scale-transition"
>
<template v-slot:activator="{ props }">
<template #activator="{ props }">
<v-text-field
v-model="examInfo.startFormatted"
:rules="[
@@ -504,19 +644,27 @@
variant="outlined"
@blur="updateStartDateTimeFromInput(index)"
>
<template v-slot:append>
<template #append>
<v-icon>mdi-calendar-clock</v-icon>
</template>
</v-text-field>
</template>
<v-card min-width="500">
<v-card-title class="text-center py-3 bg-primary-lighten-5">
<v-icon class="mr-2" color="primary">mdi-clock-start</v-icon>
<v-icon
class="mr-2"
color="primary"
>
mdi-clock-start
</v-icon>
选择开始时间
</v-card-title>
<v-card-text class="pa-0">
<v-row no-gutters>
<v-col class="border-e" cols="6">
<v-col
class="border-e"
cols="6"
>
<v-date-picker
v-model="examInfo.startDate"
color="primary"
@@ -524,7 +672,7 @@
locale="zh-cn"
show-adjacent-months
@update:model-value="updateStartDateTime(index)"
></v-date-picker>
/>
</v-col>
<v-col cols="6">
<v-time-picker
@@ -534,12 +682,12 @@
format="24hr"
scrollable
@update:model-value="updateStartDateTime(index)"
></v-time-picker>
/>
</v-col>
</v-row>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-spacer />
<v-btn
color="grey"
variant="text"
@@ -551,7 +699,10 @@
</v-card>
</v-menu>
</v-col>
<v-col cols="12" md="3">
<v-col
cols="12"
md="3"
>
<v-menu
v-model="examInfo.endDateMenu"
:close-on-content-click="false"
@@ -559,7 +710,7 @@
offset-y
transition="scale-transition"
>
<template v-slot:activator="{ props }">
<template #activator="{ props }">
<v-text-field
v-model="examInfo.endFormatted"
:rules="[
@@ -576,19 +727,27 @@
variant="outlined"
@blur="updateEndDateTimeFromInput(index)"
>
<template v-slot:append>
<template #append>
<v-icon>mdi-calendar-clock</v-icon>
</template>
</v-text-field>
</template>
<v-card min-width="500">
<v-card-title class="text-center py-3 bg-error-lighten-5">
<v-icon class="mr-2" color="error">mdi-clock-end</v-icon>
<v-icon
class="mr-2"
color="error"
>
mdi-clock-end
</v-icon>
选择结束时间
</v-card-title>
<v-card-text class="pa-0">
<v-row no-gutters>
<v-col class="border-e" cols="6">
<v-col
class="border-e"
cols="6"
>
<v-date-picker
v-model="examInfo.endDate"
color="error"
@@ -596,7 +755,7 @@
locale="zh-cn"
show-adjacent-months
@update:model-value="updateEndDateTime(index)"
></v-date-picker>
/>
</v-col>
<v-col cols="6">
<v-time-picker
@@ -606,12 +765,12 @@
format="24hr"
scrollable
@update:model-value="updateEndDateTime(index)"
></v-time-picker>
/>
</v-col>
</v-row>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-spacer />
<v-btn
color="grey"
variant="text"
@@ -623,60 +782,76 @@
</v-card>
</v-menu>
</v-col>
<v-col cols="12" md="2">
<v-text-field
v-model="examInfo.durationMinutes"
:rules="[
(v) => !!v || '时长不能为空',
(v) => !isNaN(v) || '时长必须是数字',
(v) => parseInt(v) > 0 || '时长必须大于0',
(v) => parseInt(v) <= 1440 || '时长不能超过1440分钟(24小时)'
]"
type="number"
min="1"
max="1440"
density="comfortable"
label="时长(分钟)"
placeholder="例如:120"
prepend-inner-icon="mdi-timer"
variant="outlined"
:hint="durationHint(examInfo)"
persistent-hint
@blur="updateDurationFromInput(index)"
/>
</v-col>
<v-col
cols="12"
md="2"
>
<v-text-field
v-model="examInfo.durationMinutes"
:rules="[
(v) => !!v || '时长不能为空',
(v) => !isNaN(v) || '时长必须是数字',
(v) => parseInt(v) > 0 || '时长必须大于0',
(v) => parseInt(v) <= 1440 || '时长不能超过1440分钟(24小时)'
]"
type="number"
min="1"
max="1440"
density="comfortable"
label="时长(分钟)"
placeholder="例如:120"
prepend-inner-icon="mdi-timer"
variant="outlined"
:hint="durationHint(examInfo)"
persistent-hint
@blur="updateDurationFromInput(index)"
/>
</v-col>
<!-- 提醒时间输入框(仅在启用自定义时显示) -->
<v-col v-if="enableCustomAlertTime" cols="12" md="2">
<v-text-field
v-model="examInfo.alertTime"
:rules="[
(v) => !!v || '提醒时间不能为空',
(v) => !isNaN(v) || '提醒时间必须是数字',
(v) => parseInt(v) >= 0 || '提醒时间不能为负数',
(v) => parseInt(v) <= 120 || '提醒时间不能超过120分钟'
]"
type="number"
min="0"
max="120"
density="comfortable"
label="提醒时间(分钟)"
placeholder="例如:15"
prepend-inner-icon="mdi-bell-ring"
variant="outlined"
hint="考试结束前提醒"
persistent-hint
/>
</v-col>
<!-- 提醒时间输入框(仅在启用自定义时显示) -->
<v-col
v-if="enableCustomAlertTime"
cols="12"
md="2"
>
<v-text-field
v-model="examInfo.alertTime"
:rules="[
(v) => !!v || '提醒时间不能为空',
(v) => !isNaN(v) || '提醒时间必须是数字',
(v) => parseInt(v) >= 0 || '提醒时间不能为负数',
(v) => parseInt(v) <= 120 || '提醒时间不能超过120分钟'
]"
type="number"
min="0"
max="120"
density="comfortable"
label="提醒时间(分钟)"
placeholder="例如:15"
prepend-inner-icon="mdi-bell-ring"
variant="outlined"
hint="考试结束前提醒"
persistent-hint
/>
</v-col>
</v-row>
</div>
</v-list-item>
</v-list>
<div v-else class="text-center py-12">
<v-icon class="mb-4" color="grey-lighten-2" size="80">
<div
v-else
class="text-center py-12"
>
<v-icon
class="mb-4"
color="grey-lighten-2"
size="80"
>
mdi-calendar-blank
</v-icon>
<div class="text-h5 text-grey-darken-1 mb-2">暂无考试科目安排</div>
<div class="text-h5 text-grey-darken-1 mb-2">
暂无考试科目安排
</div>
<div class="text-body-1 text-grey mb-4">
点击上方"添加科目"按钮开始配置
</div>
@@ -695,10 +870,18 @@
</div>
<!-- 删除确认对话框 -->
<v-dialog v-model="deleteDialog" max-width="400">
<v-dialog
v-model="deleteDialog"
max-width="400"
>
<v-card>
<v-card-title class="d-flex align-center">
<v-icon class="mr-2" color="error">mdi-delete-alert</v-icon>
<v-icon
class="mr-2"
color="error"
>
mdi-delete-alert
</v-icon>
确认删除配置
</v-card-title>
<v-card-text>
@@ -706,7 +889,7 @@
<br><small class="text-grey">此操作不可撤销,将会删除所有相关数据</small>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-spacer />
<v-btn
color="grey"
variant="text"
@@ -945,8 +1128,12 @@ export default {
async loadSubjects() {
try {
const response = await dataProvider.loadData("classworks-config-subject");
if (response && Array.isArray(response)) {
this.availableSubjects = response
// 兼容返回数组或包含 value 属性的对象
const dataArray = Array.isArray(response) ? response : (response && Array.isArray(response.value) ? response.value : null);
if (response && response.success !== false && dataArray) {
this.availableSubjects = dataArray
.sort((a, b) => (a.order ?? 0) - (b.order ?? 0))
.map(subject => ({
name: subject.name,