Commit 8757fdb4 authored by 黄奎's avatar 黄奎

页面修改

parent bf4b8147
using Edu.Common.Enum;
using System;
using System.Collections.Generic;
using System.Text;
using VT.FW.DB;
namespace Edu.Model.Entity.Exam
{
/// <summary>
/// 学员单词预习实体类
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_StuWords_Prep
{
/// <summary>
/// 预习主键编号
/// </summary>
public int Id { get; set; }
/// <summary>
/// 班级编号
/// </summary>
public int ClassId { get; set; }
/// <summary>
/// 课程编号
/// </summary>
public int CourseId { get; set; }
/// <summary>
/// Account表(Id字段)学员账号
/// </summary>
public int Stu_Account_Id { get; set; }
/// <summary>
/// 章节编号
/// </summary>
public int ChapterId { get; set; }
/// <summary>
/// 创建人
/// </summary>
public int CreateBy { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateTime { get; set; }
/// <summary>
/// 学校Id
/// </summary>
public int School_Id { get; set; }
/// <summary>
/// 集团编号
/// </summary>
public int Group_Id { get; set; }
/// <summary>
/// 状态
/// </summary>
public DateStateEnum Status { get; set; }
/// <summary>
/// 学习单词数量
/// </summary>
public int StudyNum { get; set; }
/// <summary>
/// 单词总数
/// </summary>
public int TotalNum { get; set; }
/// <summary>
/// 得分
/// </summary>
public decimal Score { get; set; }
/// <summary>
/// 开始时间
/// </summary>
public DateTime? StartTime { get; set; }
/// <summary>
/// 结束时间
/// </summary>
public DateTime? EndTime { get; set; }
}
}
using Edu.Common.Enum;
using System;
using System.Collections.Generic;
using System.Text;
using VT.FW.DB;
namespace Edu.Model.Entity.Exam
{
/// <summary>
/// 学员单词复习实体类
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_StuWords_Review
{
/// <summary>
/// 复习主键编号
/// </summary>
public int Id { get; set; }
/// <summary>
/// 班级编号
/// </summary>
public int ClassId { get; set; }
/// <summary>
/// 课程编号
/// </summary>
public int CourseId { get; set; }
/// <summary>
/// Account表(Id字段)学员账号
/// </summary>
public int Stu_Account_Id { get; set; }
/// <summary>
/// 章节编号
/// </summary>
public int ChapterId { get; set; }
/// <summary>
/// 创建人
/// </summary>
public int CreateBy { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateTime { get; set; }
/// <summary>
/// 学校Id
/// </summary>
public int School_Id { get; set; }
/// <summary>
/// 集团编号
/// </summary>
public int Group_Id { get; set; }
/// <summary>
/// 状态
/// </summary>
public DateStateEnum Status { get; set; }
/// <summary>
/// 复习单词数量
/// </summary>
public int ReviewNum { get; set; }
/// <summary>
/// 单词总数
/// </summary>
public int TotalNum { get; set; }
/// <summary>
/// 得分
/// </summary>
public decimal Score { get; set; }
/// <summary>
/// 开始时间
/// </summary>
public DateTime? StartTime { get; set; }
/// <summary>
/// 结束时间
/// </summary>
public DateTime? EndTime { get; set; }
}
}

using Edu.Model.Entity.Exam;
using System;
using System.Collections.Generic;
using System.Text;
namespace Edu.Model.ViewModel.Exam
{
/// <summary>
/// 学员单词预习扩展实体类
/// </summary>
public class RB_StuWords_Prep_Extend: RB_StuWords_Prep
{
}
}
using Edu.Model.Entity.Exam;
using System;
using System.Collections.Generic;
using System.Text;
namespace Edu.Model.ViewModel.Exam
{
/// <summary>
/// 学员单词扩展复习实体类
/// </summary>
public class RB_StuWords_Review_Extend : RB_StuWords_Review
{
}
}
......@@ -4903,7 +4903,10 @@ namespace Edu.Module.Course
return new
{
NextWord = NextNum,
ReviewWord = ReviewNum
NextCourseNo,
ReviewWord = ReviewNum,
ReviewCourseNo,
CourseId= courseId
};
}
......
......@@ -5,10 +5,12 @@ using System.Collections.Generic;
using System.Text;
using System.Linq;
using Edu.Model.ViewModel.Question;
using Edu.Repository.Exam;
using Edu.Model.ViewModel.Exam;
using VT.FW.DB;
namespace Edu.Module.Exam
{
/// <summary>
/// 课程预习测试处理类
/// </summary>
......@@ -19,6 +21,16 @@ namespace Edu.Module.Exam
/// </summary>
private readonly RB_Course_WordsRepository course_WordsRepository = new RB_Course_WordsRepository();
/// <summary>
/// 学员单词学习仓储层对象
/// </summary>
private readonly RB_StuWords_PrepRepository stuWords_PrepRepository = new RB_StuWords_PrepRepository();
/// <summary>
/// 学员单词复习仓储层对象
/// </summary>
private readonly RB_StuWords_ReviewRepository stuWords_ReviewRepository = new RB_StuWords_ReviewRepository();
/// <summary>
/// 生成课程复习和预习单词
/// </summary>
......@@ -146,21 +158,36 @@ namespace Edu.Module.Exam
break;
}
options= options?.OrderBy(qitem => Guid.NewGuid())?.ToList();
options = options?.OrderBy(qitem => Guid.NewGuid())?.ToList();
for (var j = 1; j <= options.Count; j++)
{
options[j].Name = Common.Plugin.StringHelper.ReturnEnChar(j);
options[j].ShowName = Common.Plugin.StringHelper.ReturnEnChar(j);
}
reviewGroupList.Add(new
{
QuestionTypeName = "单选题",
QuestionTypeId = 1,
QuestionTypeKey = "single",
QuestionContent = options,
Title = title
});
}
reviewGroupList.Add(new
else
{
QuestionTypeName = "单选题",
QuestionTypeId = 1,
QuestionTypeKey = "single",
QuestionContent = options,
Title = title
});
List<fillInItem> fillInItems = new List<fillInItem>();
reviewGroupList.Add(new
{
QuestionTypeName = "填空题",
QuestionTypeId = 3,
QuestionTypeKey = "fill-in",
QuestionContent = fillInItems,
Title = title
});
}
}
//填空题
else
......@@ -191,5 +218,172 @@ namespace Edu.Module.Exam
};
return result;
}
/// <summary>
/// 单词学习或复习
/// </summary>
/// <param name="CourseId">课程编号</param>
/// <param name="ChapterId">当前章节编号</param>
/// <param name="PrevChapterId">上一章节编号</param>
/// <returns></returns>
public object GetStudyCourseWords(int CourseId, int ChapterId, int PrevChapterId)
{
List<object> list = new List<object>();
List<object> reviewList = new List<object>();
var dataList = course_WordsRepository.GetCourseWordsListRepository(new RB_Course_Words_Extend()
{
CourseId = CourseId,
QChapterIds = ChapterId+","+ PrevChapterId
});
if (dataList != null && dataList.Count > 0)
{
foreach (var item in dataList.Where(qitem=>qitem.ChapterId==ChapterId))
{
list.Add(new
{
item.Id,
item.CourseId,
item.ChapterId,
item.WordType,
item.WordContent,
item.WordTone,
item.WordWrite,
item.ChineseMean,
item.FileUrl
});
}
foreach (var item in dataList.Where(qitem => qitem.ChapterId == PrevChapterId))
{
reviewList.Add(new
{
item.Id,
item.CourseId,
item.ChapterId,
item.WordType,
item.WordContent,
item.WordTone,
item.WordWrite,
item.ChineseMean,
item.FileUrl
});
}
}
return new
{
StudyList = list,
ReviewList = reviewList
};
}
/// <summary>
/// 新增修改学员单词学习
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public bool SetStuWordsPrepModule(RB_StuWords_Prep_Extend model)
{
bool flag = false;
var wordsList = course_WordsRepository.GetCourseWordsListRepository(new RB_Course_Words_Extend()
{
CourseId = model.CourseId,
ChapterId = model.ChapterId
});
if (model.Id > 0)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_StuWords_Prep_Extend.StudyNum),model.StudyNum },
};
fileds.Add(nameof(RB_StuWords_Prep_Extend.Score), GetScoreModule(model.StudyNum, (wordsList?.Count ?? 0)));
if (model.StudyNum == (wordsList?.Count ?? 0))
{
fileds.Add(nameof(RB_StuWords_Prep_Extend.EndTime), DateTime.Now);
}
flag = stuWords_PrepRepository.Update(fileds, new WhereHelper(nameof(RB_StuWords_Prep_Extend.Id),model.Id));
}
else
{
model.StudyNum = 1;
model.TotalNum = wordsList?.Count() ?? 0;
model.Score = GetScoreModule(model.StudyNum, model.TotalNum);
model.StartTime = DateTime.Now;
var newId = stuWords_PrepRepository.Insert(model);
model.Id = newId;
flag = newId > 0;
}
return flag;
}
/// <summary>
/// 获取学习分数
/// </summary>
/// <param name="StartNum"></param>
/// <param name="TotalNum"></param>
/// <returns></returns>
public int GetScoreModule(int StartNum, int TotalNum)
{
int score = 0;
if (TotalNum > 0)
{
var progress= Convert.ToDecimal(StartNum) / Convert.ToDecimal(TotalNum) * 100;
if (progress > 0 && progress <= 33)
{
score = 1;
}
if (progress > 33 && progress < 70)
{
score = 2;
}
if (progress >= 70)
{
score = 3;
}
}
else
{
score = 1;
}
return score;
}
/// <summary>
/// 新增修改学员复习
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public bool SetStuWordsReviewModule(RB_StuWords_Review_Extend model)
{
bool flag = false;
var wordsList = course_WordsRepository.GetCourseWordsListRepository(new RB_Course_Words_Extend()
{
CourseId = model.CourseId,
ChapterId = model.ChapterId
});
if (model.Id > 0)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_StuWords_Review_Extend.ReviewNum),model.ReviewNum },
};
fileds.Add(nameof(RB_StuWords_Review_Extend.Score), GetScoreModule(model.ReviewNum, (wordsList?.Count ?? 0)));
if (model.ReviewNum == (wordsList?.Count ?? 0))
{
fileds.Add(nameof(RB_StuWords_Prep_Extend.EndTime), DateTime.Now);
}
flag = stuWords_ReviewRepository.Update(fileds, new WhereHelper(nameof(RB_StuWords_Review_Extend.Id), model.Id));
}
else
{
model.ReviewNum = 1;
model.TotalNum = wordsList?.Count() ?? 0;
model.Score = GetScoreModule(model.ReviewNum, model.TotalNum);
model.StartTime = DateTime.Now;
var newId = stuWords_ReviewRepository.Insert(model);
model.Id = newId;
flag = newId > 0;
}
return flag;
}
}
}
using Edu.Model.Entity.Exam;
using System;
using System.Collections.Generic;
using System.Text;
namespace Edu.Repository.Exam
{
/// <summary>
/// 学员单词预习仓储层
/// </summary>
public class RB_StuWords_PrepRepository : BaseRepository<RB_StuWords_Prep>
{
}
}
using Edu.Model.Entity.Exam;
using System;
using System.Collections.Generic;
using System.Text;
namespace Edu.Repository.Exam
{
/// <summary>
/// 学员单词复习仓储层
/// </summary>
public class RB_StuWords_ReviewRepository : BaseRepository<RB_StuWords_Review>
{
}
}
......@@ -307,11 +307,15 @@ namespace Edu.WebApi.Controllers.Applet
{
Words = classModule.GetIndexWords(studentModel.ClassId, studentModel.CourseId, appletUserInfo.Group_Id);
}
else {
else
{
Words = new
{
NextWord = 0,
ReviewWord = 0
ReviewWord = 0,
NextCourseNo=0,
ReviewCourseNo=0,
CourseId=0,
};
}
......
using Edu.Common.API;
using Edu.Common.Plugin;
using Edu.Model.ViewModel.Exam;
using Edu.Module.Exam;
using Edu.WebApi.Filter;
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Edu.WebApi.Controllers.Applet
{
[Route("api/[controller]/[action]")]
[ApiExceptionFilter]
[ApiController]
[EnableCors("AllowCors")]
public class AppletWordsController : AppletBaseController
{
private readonly CourseExamModule courseExamModule = new CourseExamModule();
/// <summary>
/// 获取今日学习单词列表
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetStudyWords()
{
var CourseId = base.ParmJObj.GetInt("CourseId");
var ChapterId = base.ParmJObj.GetInt("ChapterId");
var PrevChapterId = base.ParmJObj.GetInt("PrevChapterId");
var list = courseExamModule.GetStudyCourseWords(CourseId, ChapterId, PrevChapterId);
return ApiResult.Success(data: list);
}
/// <summary>
/// 新增修改学员学习
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult SetStuWordsPrep()
{
var model = new RB_StuWords_Prep_Extend()
{
Id = base.ParmJObj.GetInt("Id"),
ClassId = base.ParmJObj.GetInt("ClassId"),
CourseId = base.ParmJObj.GetInt("CourseId"),
Stu_Account_Id = base.ParmJObj.GetInt("Stu_Account_Id"),
ChapterId=base.ParmJObj.GetInt("ChapterId"),
StudyNum=base.ParmJObj.GetInt("StudyNum"),
};
model.CreateBy = base.AppletUserInfo.Id;
model.CreateTime = DateTime.Now;
model.School_Id = 0;
model.Group_Id = base.AppletUserInfo.Group_Id;
model.Status = Common.Enum.DateStateEnum.Normal;
bool flag = courseExamModule.SetStuWordsPrepModule(model);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
/// <summary>
/// 新增修改学员复习
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult SetStuWordsReview()
{
var model = new RB_StuWords_Review_Extend()
{
Id = base.ParmJObj.GetInt("Id"),
ClassId = base.ParmJObj.GetInt("ClassId"),
CourseId = base.ParmJObj.GetInt("CourseId"),
Stu_Account_Id = base.ParmJObj.GetInt("Stu_Account_Id"),
ChapterId = base.ParmJObj.GetInt("ChapterId"),
ReviewNum = base.ParmJObj.GetInt("ReviewNum"),
};
model.CreateBy = base.AppletUserInfo.Id;
model.CreateTime = DateTime.Now;
model.School_Id = 0;
model.Group_Id = base.AppletUserInfo.Group_Id;
model.Status = Common.Enum.DateStateEnum.Normal;
bool flag = courseExamModule.SetStuWordsReviewModule(model);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment