feat: 添加学生提交系统功能
Some checks failed
TechAct / explore-gitea-actions (push) Failing after 30s

- 添加学生提交管理服务 (StudentSubmissionService, StudentSubmissionDetailService)
- 新增学生提交相关控制器 (StudentSubmissionController, StudentSubmissionDetailController)
- 添加学生提交数据传输对象 (StudentSubmissionDetailDto, StudentSubmissionSummaryDto)
- 新增学生提交相关页面组件 (StudentExamView, ExamDetailView, StudentCard等)
- 添加学生提交信息卡片组件 (SubmissionInfoCard, TeacherSubmissionInfoCard)
- 更新数据库迁移文件以支持提交系统
This commit is contained in:
SpecialX
2025-09-09 15:42:31 +08:00
parent 6a65281850
commit 439c8a2421
47 changed files with 5486 additions and 119 deletions

View File

@@ -54,6 +54,11 @@ namespace TechHelper.Client.Services
}
}
public StudentDto GetStudents(byte Class)
{
throw new NotImplementedException();
}
public async Task<ResponseDto> UserRegister(UserRegistrationToClassDto userRegistrationToClassDto)
{
try

View File

@@ -10,5 +10,6 @@ namespace TechHelper.Client.Services
public Task<ResponseDto> CreateClass(UserRegistrationToClassDto userClass);
public Task<ApiResponse> GetClassStudents();
public Task<ApiResponse> GetGradeClasses(byte grade);
public StudentDto GetStudents(byte Class);
}
}

View File

@@ -0,0 +1,14 @@
using Entities.DTO;
namespace TechHelper.Client.Services
{
public interface IStudentSubmissionDetailService
{
/// <summary>
/// 获取学生提交的详细信息
/// </summary>
/// <param name="submissionId">提交ID</param>
/// <returns>学生提交详细信息</returns>
Task<StudentSubmissionDetailDto> GetSubmissionDetailAsync(Guid submissionId);
}
}

View File

@@ -0,0 +1,22 @@
using Entities.DTO;
using TechHelper.Services;
namespace TechHelper.Client.Services
{
public interface IStudentSubmissionService
{
/// <summary>
/// 获取当前学生的所有提交摘要
/// </summary>
/// <returns>学生提交摘要列表</returns>
Task<ApiResponse> GetMySubmissionsAsync();
/// <summary>
/// 获取当前学生的提交摘要(分页)
/// </summary>
/// <param name="pageNumber">页码默认为1</param>
/// <param name="pageSize">每页数量默认为10</param>
/// <returns>分页的学生提交摘要列表</returns>
Task<ApiResponse> GetMySubmissionsPagedAsync(int pageNumber = 1, int pageSize = 10);
}
}

View File

@@ -0,0 +1,26 @@
using Entities.DTO;
using TechHelper.Client.HttpRepository;
using System.Net.Http.Json;
namespace TechHelper.Client.Services
{
public class StudentSubmissionDetailService : IStudentSubmissionDetailService
{
private readonly HttpClient _httpClient;
public StudentSubmissionDetailService(HttpClient httpClient)
{
_httpClient = httpClient;
}
public async Task<StudentSubmissionDetailDto> GetSubmissionDetailAsync(Guid submissionId)
{
var response = await _httpClient.GetAsync($"api/student-submission-detail/{submissionId}");
if (response.IsSuccessStatusCode)
{
return await response.Content.ReadFromJsonAsync<StudentSubmissionDetailDto>();
}
throw new HttpRequestException($"获取学生提交详细信息失败: {response.StatusCode}");
}
}
}

View File

@@ -0,0 +1,75 @@
using Entities.DTO;
using TechHelper.Services;
using System.Net.Http.Json;
using Newtonsoft.Json;
namespace TechHelper.Client.Services
{
public class StudentSubmissionService : IStudentSubmissionService
{
private readonly HttpClient _client;
public StudentSubmissionService(HttpClient client)
{
_client = client;
}
/// <summary>
/// 获取当前学生的所有提交摘要
/// </summary>
/// <returns>学生提交摘要列表</returns>
public async Task<ApiResponse> GetMySubmissionsAsync()
{
try
{
var response = await _client.GetAsync("student-submission/my-submissions");
if (response.IsSuccessStatusCode)
{
var content = await response.Content.ReadAsStringAsync();
var submissions = JsonConvert.DeserializeObject<List<StudentSubmissionSummaryDto>>(content);
return ApiResponse.Success(result: submissions);
}
else
{
var errorContent = await response.Content.ReadAsStringAsync();
return ApiResponse.Error(message: $"获取学生提交信息失败: {response.StatusCode} - {errorContent}");
}
}
catch (Exception ex)
{
return ApiResponse.Error(message: $"内部错误: {ex.Message}");
}
}
/// <summary>
/// 获取当前学生的提交摘要(分页)
/// </summary>
/// <param name="pageNumber">页码默认为1</param>
/// <param name="pageSize">每页数量默认为10</param>
/// <returns>分页的学生提交摘要列表</returns>
public async Task<ApiResponse> GetMySubmissionsPagedAsync(int pageNumber = 1, int pageSize = 10)
{
try
{
var response = await _client.GetAsync($"student-submission/my-submissions-paged?pageNumber={pageNumber}&pageSize={pageSize}");
if (response.IsSuccessStatusCode)
{
var content = await response.Content.ReadAsStringAsync();
var result = JsonConvert.DeserializeObject<StudentSubmissionSummaryResponseDto>(content);
return ApiResponse.Success(result: result);
}
else
{
var errorContent = await response.Content.ReadAsStringAsync();
return ApiResponse.Error(message: $"获取学生提交信息失败: {response.StatusCode} - {errorContent}");
}
}
catch (Exception ex)
{
return ApiResponse.Error(message: $"内部错误: {ex.Message}");
}
}
}
}