@using Entities.DTO @using Entities.Contracts @using Newtonsoft.Json @using TechHelper.Client.Exam @* @Question.Id *@ 问题属性 @foreach (var item in QuestionTypes) { var qt = item; @* Style = "@($"background - color:{ item.Value.Color} ")"*@ @item.Value.DisplayName } @code { [Parameter] public QuestionDto Question { get; set; } = new QuestionDto(); public int diffi = 0; Dictionary QuestionTypes = new Dictionary(); [Inject] private ILocalStorageService LocalStorageService { get; set; } protected override void OnInitialized() { base.OnInitialized(); var cs = LocalStorageService.GetItem("GlobalInfo"); var GlobalInfo = JsonConvert.DeserializeObject>(cs); if (GlobalInfo != null) { QuestionTypes = GlobalInfo; } } private void HandleSelectedValueChanged(QuestionType type) { Question.Type = type; } private void HandleSelected(int num) { Question.DifficultyLevel = (DifficultyLevel)num; } private void HandleQTSelectedValueChanged(string type) { Question.QType = type; StateHasChanged(); } }