- 添加学生提交管理服务 (StudentSubmissionService, StudentSubmissionDetailService) - 新增学生提交相关控制器 (StudentSubmissionController, StudentSubmissionDetailController) - 添加学生提交数据传输对象 (StudentSubmissionDetailDto, StudentSubmissionSummaryDto) - 新增学生提交相关页面组件 (StudentExamView, ExamDetailView, StudentCard等) - 添加学生提交信息卡片组件 (SubmissionInfoCard, TeacherSubmissionInfoCard) - 更新数据库迁移文件以支持提交系统
This commit is contained in:
@@ -1,39 +1,97 @@
|
||||
<MudPaper Class="ma-2 pa-2 rounded-xl d-flex flex-column flex-grow-1 overflow-auto" MaxHeight="100%">
|
||||
@using TechHelper.Client.Services
|
||||
@inject IStudentSubmissionService StudentSubmissionService
|
||||
|
||||
<MudPaper Class="ma-2 pa-2 rounded-xl d-flex flex-column flex-grow-1 overflow-auto" MaxHeight="100%">
|
||||
|
||||
<StudentSubmissionPreviewCard />
|
||||
@foreach (var submission in _studentSubmissions)
|
||||
@if (_isLoading)
|
||||
{
|
||||
<StudentSubmissionPreviewCard StudentSubmission="@submission" />
|
||||
<div class="d-flex justify-content-center align-items-center" style="height: 200px;">
|
||||
<MudProgressCircular Color="Color.Primary" Size="Size.Large" />
|
||||
</div>
|
||||
}
|
||||
else if (_studentSubmissions == null || _studentSubmissions.Count == 0)
|
||||
{
|
||||
<div class="d-flex justify-content-center align-items-center" style="height: 200px;">
|
||||
<MudText TextColor="Color.TextSecondary" Align="Align.Center">暂无提交记录</MudText>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
@foreach (var submission in _studentSubmissions)
|
||||
{
|
||||
<StudentSubmissionPreviewCard StudentSubmission="@submission" />
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
</MudPaper>
|
||||
|
||||
@code {
|
||||
// 假设的学生提交数据模型
|
||||
// 学生提交数据模型
|
||||
public class StudentSubmission
|
||||
{
|
||||
public string StudentName { get; set; }
|
||||
public int TotalProblems { get; set; }
|
||||
public int ErrorCount { get; set; }
|
||||
public DateTime CreatedDate { get; set; }
|
||||
public float Score { get; set; }
|
||||
public string AssignmentName { get; set; }
|
||||
public string Status { get; set; }
|
||||
public TimeSpan TimeSpent { get; set; }
|
||||
public int Score { get; set; }
|
||||
}
|
||||
|
||||
// 模拟数据列表
|
||||
// 学生提交列表
|
||||
private List<StudentSubmission> _studentSubmissions = new();
|
||||
private bool _isLoading = true;
|
||||
|
||||
protected override void OnInitialized()
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
// 模拟获取或初始化数据,实际应用中可能来自数据库或API
|
||||
_studentSubmissions = new List<StudentSubmission>
|
||||
{
|
||||
new() { StudentName = "张三", TotalProblems = 10, ErrorCount = 2, TimeSpent = TimeSpan.FromMinutes(25), Score = 80 },
|
||||
new() { StudentName = "李四", TotalProblems = 10, ErrorCount = 1, TimeSpent = TimeSpan.FromMinutes(20), Score = 90 },
|
||||
new() { StudentName = "王五", TotalProblems = 10, ErrorCount = 5, TimeSpent = TimeSpan.FromMinutes(30), Score = 50 },
|
||||
new() { StudentName = "赵六", TotalProblems = 10, ErrorCount = 3, TimeSpent = TimeSpan.FromMinutes(28), Score = 70 },
|
||||
new() { StudentName = "钱七", TotalProblems = 10, ErrorCount = 0, TimeSpent = TimeSpan.FromMinutes(18), Score = 100 }
|
||||
// ... 可以添加更多模拟数据
|
||||
};
|
||||
await LoadStudentSubmissions();
|
||||
}
|
||||
}
|
||||
|
||||
private async Task LoadStudentSubmissions()
|
||||
{
|
||||
try
|
||||
{
|
||||
_isLoading = true;
|
||||
StateHasChanged();
|
||||
|
||||
var result = await StudentSubmissionService.GetMySubmissionsAsync();
|
||||
|
||||
if (result.Status && result.Result != null)
|
||||
{
|
||||
// 从服务器获取的数据映射到我们的模型
|
||||
var submissions = result.Result as List<Entities.DTO.StudentSubmissionSummaryDto>;
|
||||
|
||||
if (submissions != null)
|
||||
{
|
||||
_studentSubmissions = submissions.Select(submission => new StudentSubmission
|
||||
{
|
||||
AssignmentName = submission.AssignmentName,
|
||||
CreatedDate = submission.CreatedDate,
|
||||
ErrorCount = submission.ErrorCount,
|
||||
Score = submission.Score,
|
||||
StudentName = submission.StudentName,
|
||||
Status = submission.Status,
|
||||
TotalProblems = submission.TotalQuestions,
|
||||
TimeSpent = TimeSpan.FromMinutes(30) // 默认值,实际应用中可以从服务器获取
|
||||
}).ToList();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// 如果API调用失败,使用空列表
|
||||
_studentSubmissions = new List<StudentSubmission>();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// 处理异常,可以记录日志
|
||||
_studentSubmissions = new List<StudentSubmission>();
|
||||
}
|
||||
finally
|
||||
{
|
||||
_isLoading = false;
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -2,10 +2,10 @@
|
||||
@using TechHelper.Client.Pages.Student.BaseInfoCard;
|
||||
@using TechHelper.Client.Pages.Common;
|
||||
|
||||
<MudPaper Class="w-100 h-100 d-flex flex-row">
|
||||
<MudPaper Class="flex-grow-1 mx-2 d-flex flex-column">
|
||||
<AssignmentInfoCard></AssignmentInfoCard>
|
||||
<MudPaper Class="d-flex flex-row">
|
||||
<MudPaper Class="w-100 h-100 d-flex flex-row" Style="background-color: transparent" Elevation="0">
|
||||
<MudPaper Class="flex-grow-1 mx-2 d-flex flex-column" Style="background-color:transparent" Elevation="0">
|
||||
<SubmissionInfoCard ></SubmissionInfoCard>
|
||||
<MudPaper Class="d-flex flex-row" Style="background-color:transparent" Elevation="0">
|
||||
<NotifyCard></NotifyCard>
|
||||
<HomeworkCard></HomeworkCard>
|
||||
<NotifyCard></NotifyCard>
|
||||
@@ -13,7 +13,7 @@
|
||||
</MudPaper>
|
||||
<StudentSubmissionPreviewTableCard></StudentSubmissionPreviewTableCard>
|
||||
</MudPaper>
|
||||
<MudPaper Width="300px" Class="mx-2 align-content-center d-flex flex-column flex-grow-1">
|
||||
<MudPaper Width="300px" Class="mx-2 align-content-center d-flex flex-column flex-grow-1" Style="background-color: transparent" Elevation="0">
|
||||
<HeadIconCard></HeadIconCard>
|
||||
<TotalErrorQuestionType></TotalErrorQuestionType>
|
||||
|
||||
@@ -22,42 +22,4 @@
|
||||
|
||||
|
||||
@code {
|
||||
public double[] data = { 25, 77, 28, 5 };
|
||||
public string[] labels = { "Oil", "Coal", "Gas", "Biomass" };
|
||||
private AxisChartOptions _axisChartOptions = new AxisChartOptions();
|
||||
private ChartOptions options = new ChartOptions();
|
||||
public List<ChartSeries> Series = new List<ChartSeries>()
|
||||
{
|
||||
new ChartSeries() { Name = "Series 1", Data = new double[] { 90, 79, 72, 69, 62, 62, 55, 65, 70 } },
|
||||
new ChartSeries() { Name = "Series 2", Data = new double[] { 35, 41, 35, 51, 49, 62, 69, 91, 148 } },
|
||||
};
|
||||
public string[] XAxisLabels = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep" };
|
||||
|
||||
Random random = new Random();
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
options.InterpolationOption = InterpolationOption.NaturalSpline;
|
||||
options.YAxisFormat = "c2";
|
||||
_axisChartOptions.MatchBoundsToSize = true;
|
||||
}
|
||||
|
||||
public void RandomizeData()
|
||||
{
|
||||
foreach (var series in Series)
|
||||
{
|
||||
for (int i = 0; i < series.Data.Length - 1; i++)
|
||||
{
|
||||
series.Data[i] = random.NextDouble() * 100 + 10;
|
||||
}
|
||||
}
|
||||
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
void OnClickMenu(InterpolationOption interpolationOption)
|
||||
{
|
||||
options.InterpolationOption = interpolationOption;
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user