网站首页 网站源码
website
站点相关全部源代码,隐藏了一些关于服务器的信息
@page "/danmaku"
@page "/danmaku/list"
@using Microsoft.AspNetCore.Components
@attribute [Authorize]

<MudText Typo="Typo.h5" Color="Color.Primary" Class="mb-4">弹幕列表</MudText>
<MudTable Hover="true"
          SelectedItems="_selectedItems"
          T="DanmakuModel"
          SelectedItemsChanged="delegate(HashSet<DanmakuModel> set) { OnDanmakuSelected(set); }"
          Loading="_isLoading"
          MultiSelection="true"
          @ref="_table"
          ServerData="x => LoadDataAsync(x)"
          CurrentPage="@(_pageIndex - 1)"
          RowsPerPage="PageSize">
    <ToolBarContent>
        <MudIconButton Icon="@Icons.Material.Filled.Delete"
                       Variant="Variant.Outlined"
                       Color="Color.Primary"
                       Title="删除弹幕"
                       Size="Size.Medium"
                       OnClick="OnDeleteClick"
                       Class="ma-2"/>
        <MudButton
            Variant="Variant.Outlined"
            StartIcon="@Icons.Material.Filled.CloudUpload"
            Size="Size.Medium"
            Color="Color.Primary"
            OnClick="OnImportAcfun"
            Class="ma-2">
            导入Acfun弹幕
        </MudButton>
        <MudButton
            Variant="Variant.Outlined"
            StartIcon="@Icons.Material.Filled.CloudUpload"
            Color="Color.Primary"
            OnClick="OnImportBilibili"
            Class="ma-2">
            导入bilibili弹幕
        </MudButton>
        <MudSpacer/>
        <MudTextField T="string"
                      Placeholder="弹幕"
                      @bind-value="_text"
                      Clearable="true"
                      Adornment="Adornment.Start"
                      AdornmentColor="Color.Primary"
                      AdornmentIcon="@Icons.Material.Filled.Title"
                      IconSize="Size.Medium"
                      Class="mt-2">
        </MudTextField>
        <MudSelect T="string"
                   Placeholder="请选择分组"
                   @bind-value="_group"
                   Clearable="true"
                   AdornmentIcon="@Icons.Material.Filled.Tag"
                   Adornment="Adornment.Start"
                   IconSize="Size.Medium"
                   Class="mt-2"
                   AdornmentColor="Color.Primary">
            @foreach (var item in _groupDic)
            {
                <MudSelectItem Value="@item.Key">@item.Value</MudSelectItem>
            }
        </MudSelect>
        <MudIconButton Icon="@Icons.Material.Filled.Search"
                       Variant="Variant.Outlined"
                       Color="Color.Primary"
                       Title="搜索"
                       Size="Size.Medium"
                       OnClick="Search"
                       Class="ma-2"/>
    </ToolBarContent>
    <HeaderContent>
        <MudTh>
            弹幕内容
        </MudTh>
        <MudTh>
            分组
        </MudTh>
        <MudTh>
            位置
        </MudTh>
        <MudTh>
            大小
        </MudTh>
        <MudTh>
            出现时间
        </MudTh>
        <MudTh>
            发送时间
        </MudTh>
    </HeaderContent>
    <RowTemplate>
        <MudTd DataLabel="弹幕内容">
            @if (!string.IsNullOrWhiteSpace(_text))
            {
                <MudHighlighter Text="@context.Text" HighlightedText="@_text"/>
            }else if (context.Color.StartsWith("#"))
            {
                <MudText title="@context.Color" Style="@($"color:{context.Color}")">@context.Text</MudText>
            }
            else if (int.TryParse(context.Color, out var color))
            {
                var colorRgb = System.Drawing.Color.FromArgb(color);
                <MudText title="@context.Color" Style="@($"color:rgb({colorRgb.R},{colorRgb.G},{colorRgb.B})")">@context.Text</MudText>
            }
            else
            {
                <MudText>@context.Text</MudText>
            }
        </MudTd>
        <MudTd DataLabel="分组">
            <MudHighlighter Text="@_groupDic[context.Group]" HighlightedText="@(_groupDic.ContainsKey(_group) ? _groupDic[_group] : "")"/>
        </MudTd>
        <MudTd DataLabel="位置">
            @context.Position
        </MudTd>
        <MudTd DataLabel="大小">
            @context.Size
        </MudTd>
        <MudTd DataLabel="出现时间">@context.Time</MudTd>
        <MudTd DataLabel="发送时间">@context.SendTime.ToString("yyyy-MM-dd HH:mm:ss")</MudTd>
    </RowTemplate>
    <PagerContent>
        <MudTablePager RowsPerPageString="每页数量"
                       HideRowsPerPage="true"
                       PageSizeOptions="new[] { 15, 20, 30 }"
                       InfoFormat="此页显示{first_item}-{last_item} 共{all_items}条"/>
    </PagerContent>
</MudTable>
loading