修复BUG,添加发布模组功能
This commit is contained in:
parent
b860f5fcc0
commit
636c673282
|
@ -1,4 +1,5 @@
|
|||
using System.Diagnostics;
|
||||
using RestSharp;
|
||||
using RustTools.muqing;
|
||||
|
||||
namespace RustTools.ApiFox;
|
||||
|
@ -29,10 +30,16 @@ public class mod
|
|||
|
||||
public static async Task<string> list(string sortMode, string limit, string tag)
|
||||
{
|
||||
var v = await wl.postAsync("/php/mod.php?action=list", new string[][]{
|
||||
var strings = new string[][]{
|
||||
new string[] { "sortMode", sortMode },
|
||||
new string[] { "limit", limit},
|
||||
new string[] { "tag",tag }});
|
||||
new string[] { "tag",tag }};
|
||||
//if (string.IsNullOrWhiteSpace(tag)) {
|
||||
// strings = new string[][]{
|
||||
// new string[] { "sortMode", sortMode },
|
||||
// new string[] { "limit", limit} };
|
||||
//}
|
||||
var v = await wl.postAsync("/php/mod.php?action=list",strings) ;
|
||||
return v ?? string.Empty;
|
||||
}
|
||||
|
||||
|
@ -46,4 +53,49 @@ public class mod
|
|||
});
|
||||
return v ?? string.Empty;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 发布模组
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static async Task<string> release(releaseData releaseData)
|
||||
{
|
||||
var client = new RestClient(wl.api);
|
||||
var request = new RestRequest("/php/mod.php?action=release",Method.Post);
|
||||
request.AddParameter("token", "");
|
||||
request.AddParameter("appID", "");
|
||||
request.AddParameter("modId", "");
|
||||
request.AddParameter("modName", "");
|
||||
request.AddParameter("describe", "");
|
||||
request.AddParameter("tags", "");
|
||||
request.AddParameter("unitNumber", "");
|
||||
request.AddParameter("versionName", "");
|
||||
request.AddParameter("minVersion", "");
|
||||
request.AddFile("file", "");
|
||||
request.AddFile("iconFile", "");
|
||||
for (var i = 0; i < releaseData.screenshot.Count; i++)
|
||||
{
|
||||
request.AddFile($"screenshot_{i}", releaseData.screenshot[i]);
|
||||
}
|
||||
|
||||
var response = client.Execute(request);
|
||||
return response.Content??string.Empty;
|
||||
|
||||
}
|
||||
public class releaseData
|
||||
{
|
||||
public string token = "";
|
||||
public string appID = "";
|
||||
public string modId = "";
|
||||
public string modName = "";
|
||||
public string describe = "";
|
||||
public string tags = "";
|
||||
public string unitNumber = "";
|
||||
public string versionName = "";
|
||||
public string minVersion = "";
|
||||
public string file = "";
|
||||
public string iconFile = "";
|
||||
public List<string> screenshot = new();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -65,14 +65,12 @@
|
|||
Style="{StaticResource BodyStrongTextBlockStyle}"
|
||||
Text="{Binding Description}"
|
||||
TextTrimming="CharacterEllipsis" />
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Style="{StaticResource BodyTextBlockStyle}" Text="{Binding UpdateTime}" />
|
||||
<TextBlock
|
||||
Margin="10,0,0,0"
|
||||
Style="{StaticResource BodyTextBlockStyle}"
|
||||
Text="{Binding CoinNumber}" />
|
||||
<TextBlock Style="{StaticResource BodyTextBlockStyle}" Text="次下载" />
|
||||
</StackPanel>
|
||||
<TextBlock Style="{StaticResource BodyTextBlockStyle}">
|
||||
<Run Text="{Binding UpdateTime}" />
|
||||
<Run Text="{Binding DownloadNumber}" />
|
||||
<Run Text="次下载" />
|
||||
</TextBlock>
|
||||
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
|
|
14
RustTools/Themes/PostRwmod.xaml
Normal file
14
RustTools/Themes/PostRwmod.xaml
Normal file
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<UserControl
|
||||
x:Class="RustTools.Themes.PostRwmod"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:RustTools.Themes"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<Grid>
|
||||
|
||||
</Grid>
|
||||
</UserControl>
|
26
RustTools/Themes/PostRwmod.xaml.cs
Normal file
26
RustTools/Themes/PostRwmod.xaml.cs
Normal file
|
@ -0,0 +1,26 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices.WindowsRuntime;
|
||||
using Microsoft.UI.Xaml;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using Microsoft.UI.Xaml.Controls.Primitives;
|
||||
using Microsoft.UI.Xaml.Data;
|
||||
using Microsoft.UI.Xaml.Input;
|
||||
using Microsoft.UI.Xaml.Media;
|
||||
using Microsoft.UI.Xaml.Navigation;
|
||||
using Windows.Foundation;
|
||||
using Windows.Foundation.Collections;
|
||||
|
||||
// To learn more about WinUI, the WinUI project structure,
|
||||
// and more about our project templates, see: http://aka.ms/winui-project-info.
|
||||
|
||||
namespace RustTools.Themes;
|
||||
public sealed partial class PostRwmod : UserControl
|
||||
{
|
||||
public PostRwmod()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
}
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
using System.Collections.ObjectModel;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using Newtonsoft.Json;
|
||||
using RustTools.muqing;
|
||||
|
||||
namespace RustTools.ViewModels;
|
||||
|
||||
|
@ -18,14 +19,14 @@ public partial class RankingViewModel : ObservableRecipient
|
|||
|
||||
public async void ListTab(string tab)
|
||||
{
|
||||
RankingList.Clear();
|
||||
RankingList?.Clear();
|
||||
//List必须小于10才能重新加载
|
||||
var StringList = await ApiFox.mod.list(tab, "10", "");
|
||||
var StringList = await ApiFox.mod.list(tab, "10", string.Empty);
|
||||
var modData = JsonConvert.DeserializeObject<ModListResponse>(StringList);
|
||||
foreach (var item in modData.Data)
|
||||
{
|
||||
item.Icon = item.Icon.Equals("") ? "/Assets/image/image.svg" : item.Icon.Replace("..", "https://rust.coldmint.top");
|
||||
RankingList.Add(item);
|
||||
RankingList?.Add(item);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -140,7 +140,8 @@
|
|||
<TextBlock
|
||||
x:Name="ToastTextBlock"
|
||||
Margin="0,16,0,0"
|
||||
IsTextSelectionEnabled="True" />
|
||||
IsTextSelectionEnabled="True"
|
||||
TextWrapping="Wrap" />
|
||||
</TeachingTip.Content>
|
||||
|
||||
</TeachingTip>
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:viewmodels="using:RustTools.ViewModels"
|
||||
d:DataContext="{d:DesignInstance Type=viewmodels:RankingViewModel}"
|
||||
SizeChanged="Page_SizeChanged"
|
||||
mc:Ignorable="d">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
|
|
|
@ -27,18 +27,13 @@ public sealed partial class RankingPage : Page
|
|||
}
|
||||
|
||||
|
||||
private void Page_SizeChanged(object sender, SizeChangedEventArgs e)
|
||||
{
|
||||
//list.Height = ActualHeight - 100;
|
||||
}
|
||||
|
||||
|
||||
private void MenuFlyoutItem_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var menu = (MenuFlyoutItem)sender;
|
||||
if (menu != null && menu.Tag != null)
|
||||
{
|
||||
var tag = (string)menu.Tag;
|
||||
var tag = menu.Tag.ToString();
|
||||
if (tag == null) { return; }
|
||||
ViewModel.ListTab(tag);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user