Commit 8540b52b authored by 黄奎's avatar 黄奎

页面修改

parent 5ec3bad0
...@@ -316,10 +316,16 @@ namespace Edu.Common ...@@ -316,10 +316,16 @@ namespace Edu.Common
return builder.ToString(); return builder.ToString();
} }
public static string GetSpanString(string value) /// <summary>
/// 拼接下划线
/// </summary>
/// <param name="value"></param>
/// <param name="isAddNbsp"></param>
/// <returns></returns>
public static string GetSpanString(string value,bool isAddNbsp=false)
{ {
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"<span style='text-decoration: underline;'>{0}</span>", value); builder.AppendFormat(@"<span style='text-decoration: underline;'>{1}{0}{1}</span>", value, (isAddNbsp ? "&nbsp;&nbsp;" : ""));
return builder.ToString(); return builder.ToString();
} }
} }
......
...@@ -5,6 +5,7 @@ using Edu.Model.ViewModel.Question; ...@@ -5,6 +5,7 @@ using Edu.Model.ViewModel.Question;
using Edu.Repository.Question; using Edu.Repository.Question;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text.RegularExpressions;
using VT.FW.DB; using VT.FW.DB;
namespace Edu.Module.Question namespace Edu.Module.Question
...@@ -249,7 +250,7 @@ namespace Edu.Module.Question ...@@ -249,7 +250,7 @@ namespace Edu.Module.Question
/// </summary> /// </summary>
/// <param name="QuestionId"></param> /// <param name="QuestionId"></param>
/// <returns></returns> /// <returns></returns>
public RB_Question_ViewModel GetQuestionModule(object QuestionId) public RB_Question_ViewModel GetQuestionModule(object QuestionId,int isReplaceClozeTitle=0)
{ {
var extModel = questionRepository.GetEntity<RB_Question_ViewModel>(QuestionId); var extModel = questionRepository.GetEntity<RB_Question_ViewModel>(QuestionId);
if (extModel != null) if (extModel != null)
...@@ -263,6 +264,20 @@ namespace Edu.Module.Question ...@@ -263,6 +264,20 @@ namespace Edu.Module.Question
{ {
extModel.QuestionPointList = GetPointListModule(new RB_Question_Point_ViewModel() { QPointIds = extModel.Knowledge }); extModel.QuestionPointList = GetPointListModule(new RB_Question_Point_ViewModel() { QPointIds = extModel.Knowledge });
} }
if (extModel.QuestionTypeKey == "cloze" && !string.IsNullOrEmpty(extModel.Title)&& isReplaceClozeTitle==1)
{
string categoryRule1 = @"##[1234567890]##";
Regex categoryReg = new Regex(categoryRule1);
MatchCollection matchs = categoryReg.Matches(extModel.Title);
foreach (var item in matchs)
{
if (item != null && !string.IsNullOrEmpty(item.ToString()))
{
var content = item.ToString().Replace("#", "");
extModel.Title = extModel.Title.Replace(item.ToString(), Common.ConvertHelper.GetSpanString(content, isAddNbsp: true));
}
}
}
} }
return extModel; return extModel;
} }
......
...@@ -673,7 +673,8 @@ namespace Edu.WebApi.Controllers.Course ...@@ -673,7 +673,8 @@ namespace Edu.WebApi.Controllers.Course
public ApiResult GetQuestion() public ApiResult GetQuestion()
{ {
var QuestionId = base.ParmJObj.GetInt("QuestionId", 0); var QuestionId = base.ParmJObj.GetInt("QuestionId", 0);
var extModel = questionModule.GetQuestionModule(QuestionId); int isReplaceClozeTitle = base.ParmJObj.GetInt("isReplaceClozeTitle", 0);
var extModel = questionModule.GetQuestionModule(QuestionId,isReplaceClozeTitle:isReplaceClozeTitle);
return ApiResult.Success(data: extModel); return ApiResult.Success(data: extModel);
} }
......
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