This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
@page "/exam/create"
|
||||
@using AutoMapper
|
||||
@using TechHelper.Client.Pages.Common
|
||||
@using TechHelper.Client.Pages.Exam.ExamView
|
||||
@using TechHelper.Client.Services
|
||||
@using Blazored.TextEditor
|
||||
@using Entities.DTO
|
||||
@@ -9,9 +11,9 @@
|
||||
@using Microsoft.AspNetCore.Components
|
||||
@using System.Globalization;
|
||||
@using TechHelper.Client.Pages.Editor
|
||||
@inject IDialogService DialogService
|
||||
|
||||
|
||||
<MudPaper Elevation="5" Class="d-flex overflow-hidden flex-grow-1" Style="overflow:hidden; position:relative;height:100%">
|
||||
<MudPaper Elevation="5" Class="d-flex overflow-hidden flex-grow-1 pa-1 rounded-xl " Style="overflow:hidden; position:relative;height:100%">
|
||||
<MudDrawerContainer Class="mud-height-full flex-grow-1" Style="height:100%">
|
||||
<MudDrawer @bind-Open="@_open" Elevation="0" Variant="@DrawerVariant.Persistent" Color="Color.Primary" Anchor="Anchor.End" OverlayAutoClose="true">
|
||||
|
||||
@@ -34,45 +36,18 @@
|
||||
|
||||
|
||||
</MudDrawer>
|
||||
<MudStack Row="true" Class="flex-grow-1" Style="height:100%">
|
||||
<ExamView Class="overflow-auto" ClickedStruct="HandleClickedStruct" ParsedExam="ExamContent"></ExamView>
|
||||
<MudStack Class="flex-grow-1 h-100">
|
||||
|
||||
<MudPaper Class="ma-2">
|
||||
<MudPaper Elevation="0" Style="height:calc(100% - 80px)">
|
||||
<BlazoredTextEditor @ref="@_textEditor">
|
||||
<ToolbarContent>
|
||||
<select class="ql-header">
|
||||
<option selected=""></option>
|
||||
<option value="1"></option>
|
||||
<option value="2"></option>
|
||||
<option value="3"></option>
|
||||
<option value="4"></option>
|
||||
<option value="5"></option>
|
||||
</select>
|
||||
<span class="ql-formats">
|
||||
<button class="ql-bold"></button>
|
||||
<button class="ql-italic"></button>
|
||||
<button class="ql-underline"></button>
|
||||
<button class="ql-strike"></button>
|
||||
</span>
|
||||
<span class="ql-formats">
|
||||
<select class="ql-color"></select>
|
||||
<select class="ql-background"></select>
|
||||
</span>
|
||||
<span class="ql-formats">
|
||||
<button class="ql-list" value="ordered"></button>
|
||||
<button class="ql-list" value="bullet"></button>
|
||||
</span>
|
||||
<span class="ql-formats">
|
||||
<button class="ql-link"></button>
|
||||
</span>
|
||||
</ToolbarContent>
|
||||
<EditorContent>
|
||||
</EditorContent>
|
||||
</BlazoredTextEditor>
|
||||
</MudPaper>
|
||||
<MudPaper Class="rounded-xl ma-1 pa-2" Style="background-color:#fefefefe">
|
||||
<MudButton Variant="Variant.Filled" Color="Color.Secondary" Class="rounded-xl" Size="Size.Small" OnClick="OpenEditor">文本编辑器</MudButton>
|
||||
<MudButton Variant="Variant.Filled" Color="Color.Secondary" Class="rounded-xl" Size="Size.Small" OnClick="ParseExam">载入</MudButton>
|
||||
<MudButton Variant="Variant.Filled" Color="Color.Secondary" Class="rounded-xl" Size="Size.Small" OnClick="OpenPublish">发布</MudButton>
|
||||
<MudButton Variant="Variant.Filled" Color="Color.Secondary" Class="rounded-xl" Size="Size.Small" OnClick="OpenPublish">指派</MudButton>
|
||||
</MudPaper>
|
||||
|
||||
|
||||
<ExamView Class="overflow-auto ma-1 pa-2 rounded-xl" ClickedStruct="HandleClickedStruct" ParsedExam="ExamContent"></ExamView>
|
||||
|
||||
<MudPaper MaxWidth="300">
|
||||
|
||||
@if (_parsedExam.Errors.Any())
|
||||
@@ -83,12 +58,6 @@
|
||||
}
|
||||
}
|
||||
</MudPaper>
|
||||
<MudButtonGroup Vertical="true" Color="Color.Primary" Variant="Variant.Filled">
|
||||
<MudIconButton Icon="@Icons.Material.Filled.Settings" OnClick="@ToggleDrawer" Color="Color.Secondary" />
|
||||
<MudIconButton Icon="@Icons.Material.Filled.TransitEnterexit" OnClick="@ParseExam" Color="Color.Secondary" />
|
||||
<MudIconButton Icon="@Icons.Material.Filled.Save" OnClick="@ToggleDrawer" Color="Color.Secondary" />
|
||||
<MudIconButton Icon="@Icons.Material.Filled.Publish" OnClick="@Publish" Color="Color.Secondary" />
|
||||
</MudButtonGroup>
|
||||
</MudStack>
|
||||
</MudDrawerContainer>
|
||||
</MudPaper>
|
||||
@@ -99,7 +68,7 @@
|
||||
private Task<AuthenticationState> authenticationStateTask { get; set; }
|
||||
|
||||
private AssignmentQuestionDto selectedAssignmentQuestion = new AssignmentQuestionDto();
|
||||
|
||||
private IReadOnlyCollection<string> _selected;
|
||||
private bool _open = false;
|
||||
private bool _edit = false;
|
||||
|
||||
@@ -113,16 +82,53 @@
|
||||
private AssignmentDto ExamContent = new AssignmentDto();
|
||||
|
||||
private ExamParserConfig _examParserConfig { get; set; } = new ExamParserConfig();
|
||||
private string EditorText = "";
|
||||
|
||||
|
||||
[Inject]
|
||||
public IMapper Mapper { get; set; }
|
||||
|
||||
|
||||
private void HandleClickedStruct(AssignmentQuestionDto dto)
|
||||
private async void OpenEditor()
|
||||
{
|
||||
_open = true;
|
||||
_edit = true;
|
||||
selectedAssignmentQuestion = dto;
|
||||
var parameters = new DialogParameters<TextEditorDialog> { { x => x.TextEditor, _textEditor } };
|
||||
parameters.Add("EditorText", EditorText);
|
||||
|
||||
var dialog = await DialogService.ShowAsync<TextEditorDialog>("TextEditor", parameters);
|
||||
var result = await dialog.Result;
|
||||
if (!result.Canceled)
|
||||
{
|
||||
_textEditor = result.Data as BlazoredTextEditor ?? new BlazoredTextEditor();
|
||||
await ParseExam();
|
||||
}
|
||||
StateHasChanged();
|
||||
}
|
||||
private async void OpenPublish()
|
||||
{
|
||||
var parameters = new DialogParameters<PublishExamDialog> { { x => x.Exam, ExamContent } };
|
||||
|
||||
var dialog = await DialogService.ShowAsync<PublishExamDialog>("PublishExam", parameters);
|
||||
var result = await dialog.Result;
|
||||
if (!result.Canceled)
|
||||
{
|
||||
await Publish();
|
||||
}
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
private async void HandleClickedStruct(AssignmentQuestionDto dto)
|
||||
{
|
||||
// _open = true;
|
||||
// _edit = true;
|
||||
// StateHasChanged();
|
||||
|
||||
var parameters = new DialogParameters<QuestionCardDialog> { { x => x.Questions, dto } };
|
||||
|
||||
var dialog = await DialogService.ShowAsync<QuestionCardDialog>("Edit_Question", parameters);
|
||||
var result = await dialog.Result;
|
||||
if (!result.Canceled)
|
||||
{
|
||||
}
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
@@ -130,7 +136,7 @@
|
||||
{
|
||||
|
||||
var plainText = await _textEditor.GetText();
|
||||
|
||||
EditorText = plainText;
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(plainText))
|
||||
{
|
||||
@@ -170,4 +176,54 @@
|
||||
Snackbar.Add(apiRespon.Message);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- #region name -->
|
||||
@* <MudButtonGroup Vertical="true" Color="Color.Primary" Variant="Variant.Filled">
|
||||
<MudIconButton Icon="@Icons.Material.Filled.Settings" OnClick="@ToggleDrawer" Color="Color.Secondary" />
|
||||
<MudIconButton Icon="@Icons.Material.Filled.TransitEnterexit" OnClick="@ParseExam" Color="Color.Secondary" />
|
||||
<MudIconButton Icon="@Icons.Material.Filled.Save" OnClick="@ToggleDrawer" Color="Color.Secondary" />
|
||||
<MudIconButton Icon="@Icons.Material.Filled.Publish" OnClick="@Publish" Color="Color.Secondary" />
|
||||
</MudButtonGroup> *@
|
||||
@* <MudPaper Class="ma-2 h-100">
|
||||
<MudPaper Elevation="0" Style="height:calc(100% - 80px)">
|
||||
<BlazoredTextEditor @ref="@_textEditor">
|
||||
<ToolbarContent>
|
||||
<select class="ql-header">
|
||||
<option selected=""></option>
|
||||
<option value="1"></option>
|
||||
<option value="2"></option>
|
||||
<option value="3"></option>
|
||||
<option value="4"></option>
|
||||
<option value="5"></option>
|
||||
</select>
|
||||
<span class="ql-formats">
|
||||
<button class="ql-bold"></button>
|
||||
<button class="ql-italic"></button>
|
||||
<button class="ql-underline"></button>
|
||||
<button class="ql-strike"></button>
|
||||
</span>
|
||||
<span class="ql-formats">
|
||||
<select class="ql-color"></select>
|
||||
<select class="ql-background"></select>
|
||||
</span>
|
||||
<span class="ql-formats">
|
||||
<button class="ql-list" value="ordered"></button>
|
||||
<button class="ql-list" value="bullet"></button>
|
||||
</span>
|
||||
<span class="ql-formats">
|
||||
<button class="ql-link"></button>
|
||||
</span>
|
||||
</ToolbarContent>
|
||||
<EditorContent>
|
||||
</EditorContent>
|
||||
</BlazoredTextEditor>
|
||||
</MudPaper>
|
||||
</MudPaper> *@
|
||||
|
||||
<!-- #endregion -->
|
Reference in New Issue
Block a user