Commit 9e428e62 authored by 黄奎's avatar 黄奎

页面修改

parent d40dd5a5
...@@ -14,5 +14,10 @@ namespace Edu.Model.ViewModel.Exam ...@@ -14,5 +14,10 @@ namespace Edu.Model.ViewModel.Exam
/// 试卷编号【查询使用】 /// 试卷编号【查询使用】
/// </summary> /// </summary>
public string QPaperIds { get; set; } public string QPaperIds { get; set; }
/// <summary>
/// 显示标题
/// </summary>
public string ShowTitle { get; set; }
} }
} }
...@@ -5,6 +5,7 @@ using System; ...@@ -5,6 +5,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using VT.FW.DB; using VT.FW.DB;
using System.Linq; using System.Linq;
using System.Text.RegularExpressions;
namespace Edu.Module.Exam namespace Edu.Module.Exam
{ {
...@@ -163,6 +164,8 @@ namespace Edu.Module.Exam ...@@ -163,6 +164,8 @@ namespace Edu.Module.Exam
/// <returns></returns> /// <returns></returns>
public RB_Examination_Paper_ViewModel GetExaminationPaperModule(object PaperId) public RB_Examination_Paper_ViewModel GetExaminationPaperModule(object PaperId)
{ {
// 定义正则表达式用来匹配 img 标签
string str = @"<img\b[^<>]*?\bsrc[\s\t\r\n]*=[\s\t\r\n]*[""']?[\s\t\r\n]*(?<imgUrl>[^\s\t\r\n""'<>]*)[^<>]*?/?[\s\t\r\n]*>";
var extModel = examination_PaperRepository.GetEntity<RB_Examination_Paper_ViewModel>(PaperId); var extModel = examination_PaperRepository.GetEntity<RB_Examination_Paper_ViewModel>(PaperId);
if (extModel != null&& extModel.PaperId>0) if (extModel != null&& extModel.PaperId>0)
{ {
...@@ -179,6 +182,31 @@ namespace Edu.Module.Exam ...@@ -179,6 +182,31 @@ namespace Edu.Module.Exam
foreach (var gItem in extModel.GroupList) foreach (var gItem in extModel.GroupList)
{ {
gItem.DetailsList = detailsList?.Where(qitem => qitem.QuestionTypeId == gItem.QuestionTypeId)?.ToList() ?? new List<RB_Examination_Details_ViewModel>(); gItem.DetailsList = detailsList?.Where(qitem => qitem.QuestionTypeId == gItem.QuestionTypeId)?.ToList() ?? new List<RB_Examination_Details_ViewModel>();
if (gItem.DetailsList != null && gItem.DetailsList.Count > 0)
{
foreach (var sItem in gItem.DetailsList)
{
string newTitle = sItem.Title;
try
{
newTitle = Regex.Replace(newTitle, str, "[图片]");
}
catch
{
newTitle = sItem.Title;
}
try
{
newTitle = Regex.Replace(newTitle, @"<iframe\s*[^>]*>", "[音频", RegexOptions.IgnoreCase);
newTitle = Regex.Replace(newTitle, @"</iframe>", "]", RegexOptions.IgnoreCase);
}
catch
{
newTitle = sItem.Title;
}
sItem.ShowTitle = newTitle;
}
}
} }
} }
} }
......
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