- 添加学生提交管理服务 (StudentSubmissionService, StudentSubmissionDetailService) - 新增学生提交相关控制器 (StudentSubmissionController, StudentSubmissionDetailController) - 添加学生提交数据传输对象 (StudentSubmissionDetailDto, StudentSubmissionSummaryDto) - 新增学生提交相关页面组件 (StudentExamView, ExamDetailView, StudentCard等) - 添加学生提交信息卡片组件 (SubmissionInfoCard, TeacherSubmissionInfoCard) - 更新数据库迁移文件以支持提交系统
This commit is contained in:
@@ -54,6 +54,11 @@ namespace TechHelper.Client.Services
|
||||
}
|
||||
}
|
||||
|
||||
public StudentDto GetStudents(byte Class)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public async Task<ResponseDto> UserRegister(UserRegistrationToClassDto userRegistrationToClassDto)
|
||||
{
|
||||
try
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
22
TechHelper.Client/Services/IStudentSubmissionService.cs
Normal file
22
TechHelper.Client/Services/IStudentSubmissionService.cs
Normal 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);
|
||||
}
|
||||
}
|
26
TechHelper.Client/Services/StudentSubmissionDetailService.cs
Normal file
26
TechHelper.Client/Services/StudentSubmissionDetailService.cs
Normal 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}");
|
||||
}
|
||||
}
|
||||
}
|
75
TechHelper.Client/Services/StudentSubmissionService.cs
Normal file
75
TechHelper.Client/Services/StudentSubmissionService.cs
Normal 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}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user