WIn_RustTools/RustTools/ViewModels/ConcernViewModel.cs
2024-08-15 09:40:33 +08:00

94 lines
3.8 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System.Collections.ObjectModel;
using CommunityToolkit.Mvvm.ComponentModel;
using Newtonsoft.Json;
using RustTools.DataList;
using RustTools.muqing;
namespace RustTools.ViewModels;
public partial class ConcernViewModel : ObservableRecipient
{
public ObservableCollection<CommunityList.Data> communitylist = new();
public ObservableCollection<MovingInfo.Data> MovingInfoList = new();
private readonly string json = @"
{
""code"": 0,
""message"": ""获取成功共3条记录"",
""data"": [
{
""account"": ""offical"",
""cover"": ""../user/offical/cover.png"",
""introduce"": null,
""fans"": ""64"",
""follower"": ""5"",
""praise"": ""0"",
""userName"": ""铁锈助手官方"",
""headIcon"": ""http://rust.coldmint.top/user/offical/icon.png"",
""email"": ""2923268971@qq.com"",
""permission"": ""2"",
""loginTime"": ""2023-10-21 22:28:18"",
""gender"": ""1"",
""enable"": ""true"",
""dynamicColor"": ""null""
},
{
""account"": ""coldmint"",
""cover"": ""http://rust.coldmint.top/user/coldmint/covers/181d019f-7cb7-9c07-389e-5a78b98eea54.png"",
""introduce"": ""我是薄荷老师。”"",
""fans"": ""141"",
""follower"": ""13"",
""praise"": ""0"",
""userName"": ""薄荷今天吃什么?"",
""headIcon"": ""https://rust.coldmint.top/user/coldmint/icons/4006dc55-9101-39cc-7076-34c4b32924d5.png"",
""email"": ""cold_mint@qq.com"",
""permission"": ""1"",
""loginTime"": ""2024-08-02 22:04:48"",
""gender"": ""-1"",
""enable"": ""true"",
""dynamicColor"": ""null""
},
{
""account"": ""muqing"",
""cover"": ""../user/muqing/covers/d4083a79-1e7f-d3bc-5944-ae9bce0d6714.png"",
""introduce"": ""nihao"",
""fans"": ""1"",
""follower"": ""1"",
""praise"": ""0"",
""userName"": ""薄荷是我的老婆"",
""headIcon"": ""../user/muqing/icons/cf0582bb-584c-176f-098b-a9a95af22a44.png"",
""email"": ""2583089389@qq.com"",
""permission"": ""3"",
""loginTime"": ""2024-04-18 14:08:22"",
""gender"": ""1"",
""enable"": ""true"",
""dynamicColor"": ""null""
}
]
}";
public ConcernViewModel()
{
var response = JsonConvert.DeserializeObject<CommunityList>(json);
var a = new CommunityList.Data
{
UserName = "全部",
HeadIcon = "/Assets/tool.png"
};
communitylist.Add(a);
foreach (var item in response.data)
{
//item.UserName
item.HeadIcon = item.HeadIcon.Replace("..", wl.api);
communitylist.Add(item);
}
MovingInfoList.Add(new MovingInfo.Data("123123"));
MovingInfoList.Add(new MovingInfo.Data("123123"));
MovingInfoList.Add(new MovingInfo.Data("123123"));
MovingInfoList.Add(new MovingInfo.Data("123123"));
MovingInfoList.Add(new MovingInfo.Data("123123"));
MovingInfoList.Add(new MovingInfo.Data("123123"));
MovingInfoList.Add(new MovingInfo.Data("123123"));
}
}