From 58a449fe019adf0b9296249ecc7a4dd412f3f85c Mon Sep 17 00:00:00 2001 From: meoacgx Date: Fri, 19 Dec 2025 02:39:56 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E5=88=9B=E5=BB=BA?= =?UTF-8?q?=E9=A2=91=E9=81=93=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 频道基本信息配置 - 公开/私密设置 - 用户名设置 - 可选功能配置(评论、表情、签名) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .../Components/Pages/ChannelCreate.razor | 124 ++++++++++++++++++ 1 file changed, 124 insertions(+) create mode 100644 src/TelegramPanel.Web/Components/Pages/ChannelCreate.razor diff --git a/src/TelegramPanel.Web/Components/Pages/ChannelCreate.razor b/src/TelegramPanel.Web/Components/Pages/ChannelCreate.razor new file mode 100644 index 0000000..822de52 --- /dev/null +++ b/src/TelegramPanel.Web/Components/Pages/ChannelCreate.razor @@ -0,0 +1,124 @@ +@page "/channels/create" +@inject IChannelService ChannelService +@inject ISnackbar Snackbar +@inject NavigationManager Navigation + +创建频道 - Telegram Panel + +创建频道 + + + + + + + -- 请选择账号 -- + 账号1 (+86xxxxxxxx) + 账号2 (+86yyyyyyyy) + + + + + + + + + @if (isPublic) + { + + } + + + + 可选设置 + + + + + + + 取消 + + + @if (creating) + { + + 创建中... + } + else + { + 创建频道 + } + + + + + + +@code { + private int selectedAccountId = 0; + private string channelTitle = ""; + private string channelAbout = ""; + private bool isPublic = false; + private string username = ""; + private bool enableComments = true; + private bool enableReactions = true; + private bool signMessages = false; + private bool creating = false; + + private async Task CreateChannel() + { + if (selectedAccountId == 0) + { + Snackbar.Add("请选择账号", Severity.Error); + return; + } + + if (string.IsNullOrEmpty(channelTitle)) + { + Snackbar.Add("请输入频道名称", Severity.Error); + return; + } + + if (isPublic && string.IsNullOrEmpty(username)) + { + Snackbar.Add("公开频道需要设置用户名", Severity.Error); + return; + } + + creating = true; + + try + { + var channelInfo = await ChannelService.CreateChannelAsync(selectedAccountId, channelTitle, channelAbout, isPublic); + + if (isPublic && !string.IsNullOrEmpty(username)) + { + await ChannelService.SetChannelVisibilityAsync(selectedAccountId, channelInfo.TelegramId, true, username); + } + + Snackbar.Add($"频道 \"{channelTitle}\" 创建成功", Severity.Success); + Navigation.NavigateTo("/channels"); + } + catch (Exception ex) + { + Snackbar.Add($"创建失败:{ex.Message}", Severity.Error); + } + finally + { + creating = false; + } + } + + private void Cancel() + { + Navigation.NavigateTo("/channels"); + } +}