dev: robot interface
This commit is contained in:
@@ -1,98 +1,16 @@
|
||||
@page "/"
|
||||
@using Frontend.Models
|
||||
@inject ILogger<Index> Logger
|
||||
|
||||
|
||||
<Layout>
|
||||
<Sider Width="200">
|
||||
|
||||
|
||||
</Sider>
|
||||
|
||||
|
||||
<Content>
|
||||
<div class="content-zone">
|
||||
<div class="chat-zone">
|
||||
<AntList TItem="ChatMessage" DataSource="@_messages" Split="@false">
|
||||
<ListItem>
|
||||
@if (context.Left)
|
||||
{
|
||||
<div>
|
||||
<MessageBubble Message="context"/>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div style="margin-left: auto">
|
||||
<MessageBubble Message="context"/>
|
||||
</div>
|
||||
}
|
||||
</ListItem>
|
||||
</AntList>
|
||||
<div style="height: 200px; width: 100%; flex: none">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="control-zone">
|
||||
<div style="padding: 10px 82px 20px">
|
||||
<div class="input-zone">
|
||||
<GridRow>
|
||||
<GridCol Span="22">
|
||||
<Input TValue="@string" @bind-Value="@MessageSending"
|
||||
Placeholder="输入以对话" Bordered="@false" OnPressEnter="@SendMessageClicked"/>
|
||||
</GridCol>
|
||||
<GridCol Span="2">
|
||||
<Button Type="@ButtonType.Primary" @onclick="@SendMessageClicked">
|
||||
发送
|
||||
</Button>
|
||||
</GridCol>
|
||||
</GridRow>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<Chat />
|
||||
</Content>
|
||||
</Layout>
|
||||
|
||||
@code
|
||||
{
|
||||
private string MessageSending { get; set; } = string.Empty;
|
||||
|
||||
private readonly List<ChatMessage> _messages = new()
|
||||
{
|
||||
new ChatMessage
|
||||
{
|
||||
Sender = "凯瑟琳",
|
||||
Text = "向着星辰和深渊!",
|
||||
Left = true
|
||||
},
|
||||
new ChatMessage
|
||||
{
|
||||
Sender = "凯瑟琳",
|
||||
Text = "欢迎来到冒险家协会。",
|
||||
Left = true
|
||||
}
|
||||
};
|
||||
|
||||
private void SendMessageClicked()
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(MessageSending))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_messages.Add(new ChatMessage
|
||||
{
|
||||
Left = false,
|
||||
Sender = "旅行者",
|
||||
Text = MessageSending
|
||||
});
|
||||
|
||||
MessageSending = string.Empty;
|
||||
|
||||
_messages.Add(new ChatMessage
|
||||
{
|
||||
Left = true,
|
||||
Sender = "凯瑟琳",
|
||||
Text = "对不起,做不到。"
|
||||
});
|
||||
}
|
||||
@code {
|
||||
|
||||
}
|
@@ -1,42 +0,0 @@
|
||||
.chat-column {
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
.content-zone {
|
||||
align-items: center;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: 100%;
|
||||
min-height: calc(100vh - 64px);
|
||||
max-height: calc(100vh - 64px);
|
||||
padding: 10px;
|
||||
position: relative;
|
||||
background: linear-gradient(180deg,
|
||||
#f5f4f6,
|
||||
#b5bddf);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.chat-zone {
|
||||
min-width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
position: relative;
|
||||
height: 100%;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.control-zone {
|
||||
min-width: 100%;
|
||||
bottom: 0;
|
||||
position: absolute;
|
||||
background-color: #b5bddf;
|
||||
display: block;
|
||||
box-shadow: 3px 0 0 #b5bddf;
|
||||
}
|
||||
|
||||
.input-zone {
|
||||
padding: 10px;
|
||||
border-radius: 15px;
|
||||
background-color: white;
|
||||
}
|
88
Frontend/Shared/Chat.razor
Normal file
88
Frontend/Shared/Chat.razor
Normal file
@@ -0,0 +1,88 @@
|
||||
@using Frontend.Models
|
||||
|
||||
<div class="content-zone">
|
||||
<div class="chat-zone">
|
||||
<AntList TItem="ChatMessage" DataSource="@_messages" Split="@false">
|
||||
<ListItem>
|
||||
@if (context.Left)
|
||||
{
|
||||
<div>
|
||||
<MessageBubble Message="context"/>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div style="margin-left: auto">
|
||||
<MessageBubble Message="context"/>
|
||||
</div>
|
||||
}
|
||||
</ListItem>
|
||||
</AntList>
|
||||
<div style="height: 200px; width: 100%; flex: none">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="control-zone">
|
||||
<div style="padding: 10px 82px 20px">
|
||||
<div class="input-zone">
|
||||
<GridRow>
|
||||
<GridCol Span="22">
|
||||
<Input TValue="@string" @bind-Value="@MessageSending"
|
||||
Placeholder="输入以对话" Bordered="@false" OnPressEnter="@SendMessageClicked"/>
|
||||
</GridCol>
|
||||
<GridCol Span="2">
|
||||
<Button Type="@ButtonType.Primary" @onclick="@SendMessageClicked">
|
||||
发送
|
||||
</Button>
|
||||
</GridCol>
|
||||
</GridRow>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code
|
||||
{
|
||||
private string MessageSending { get; set; } = string.Empty;
|
||||
|
||||
private readonly List<ChatMessage> _messages = new()
|
||||
{
|
||||
new ChatMessage
|
||||
{
|
||||
Sender = "凯瑟琳",
|
||||
Text = "向着星辰和深渊!",
|
||||
Left = true
|
||||
},
|
||||
new ChatMessage
|
||||
{
|
||||
Sender = "凯瑟琳",
|
||||
Text = "欢迎来到冒险家协会。",
|
||||
Left = true
|
||||
}
|
||||
};
|
||||
|
||||
private void SendMessageClicked()
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(MessageSending))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_messages.Add(new ChatMessage
|
||||
{
|
||||
Left = false,
|
||||
Sender = "旅行者",
|
||||
Text = MessageSending
|
||||
});
|
||||
|
||||
MessageSending = string.Empty;
|
||||
|
||||
_messages.Add(new ChatMessage
|
||||
{
|
||||
Left = true,
|
||||
Sender = "凯瑟琳",
|
||||
Text = "对不起,做不到。"
|
||||
});
|
||||
}
|
||||
}
|
58
Frontend/Shared/Chat.razor.css
Normal file
58
Frontend/Shared/Chat.razor.css
Normal file
@@ -0,0 +1,58 @@
|
||||
.chat-column {
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
.content-zone {
|
||||
align-items: center;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: 100%;
|
||||
min-height: calc(100vh - 64px);
|
||||
max-height: calc(100vh - 64px);
|
||||
padding: 10px;
|
||||
position: relative;
|
||||
background: linear-gradient(180deg,
|
||||
#f5f4f6,
|
||||
#b5bddf);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.chat-zone {
|
||||
min-width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
position: relative;
|
||||
height: 100%;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.chat-zone::-webkit-scrollbar {
|
||||
width: 10px;
|
||||
height: 1px;
|
||||
}
|
||||
|
||||
.chat-zone::-webkit-scrollbar-thumb {
|
||||
border-radius: 10px;
|
||||
-webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
|
||||
background: #bdbdbd;
|
||||
}
|
||||
|
||||
.chat-zone::-webkit-scrollbar-track {
|
||||
border-radius: 10px;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.control-zone {
|
||||
min-width: 100%;
|
||||
bottom: 0;
|
||||
position: absolute;
|
||||
background-color: #b5bddf;
|
||||
display: block;
|
||||
box-shadow: 3px 0 0 #b5bddf;
|
||||
}
|
||||
|
||||
.input-zone {
|
||||
padding: 10px;
|
||||
border-radius: 15px;
|
||||
background-color: white;
|
||||
}
|
Reference in New Issue
Block a user