You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

50 lines
1.7 KiB

using MyAvaloniaApp.ViewModels.Base;
using ReactiveUI;
using System.Collections.ObjectModel;
namespace MyAvaloniaApp.ViewModels.Pages;
/// <summary>
/// 用户管理页面ViewModel
/// </summary>
public class UsersPageViewModel : RoutableViewModel
{
private ObservableCollection<UserInfo> _users;
/// <summary>
/// 构造函数
/// </summary>
/// <param name="hostScreen">宿主 Screen</param>
public UsersPageViewModel(IScreen hostScreen) : base(hostScreen, "Users")
{
_users = new ObservableCollection<UserInfo>
{
new UserInfo { Id = 1, Name = "张三", Email = "zhangsan@example.com", Role = "管理员", Status = "在线" },
new UserInfo { Id = 2, Name = "李四", Email = "lisi@example.com", Role = "用户", Status = "离线" },
new UserInfo { Id = 3, Name = "王五", Email = "wangwu@example.com", Role = "编辑", Status = "在线" },
new UserInfo { Id = 4, Name = "赵六", Email = "zhaoliu@example.com", Role = "用户", Status = "在线" },
new UserInfo { Id = 5, Name = "钱七", Email = "qianqi@example.com", Role = "管理员", Status = "离线" }
};
}
/// <summary>
/// 用户列表
/// </summary>
public ObservableCollection<UserInfo> Users
{
get => _users;
set => this.RaiseAndSetIfChanged(ref _users, value);
}
}
/// <summary>
/// 用户信息模型
/// </summary>
public class UserInfo
{
public int Id { get; set; }
public string Name { get; set; } = string.Empty;
public string Email { get; set; } = string.Empty;
public string Role { get; set; } = string.Empty;
public string Status { get; set; } = string.Empty;
}