Skip to content
This repository has been archived by the owner on Jan 5, 2024. It is now read-only.

Commit

Permalink
修改上传回调的代码
Browse files Browse the repository at this point in the history
  • Loading branch information
teacher-zhou committed Jul 20, 2023
1 parent f3b85bb commit 70b1a41
Showing 1 changed file with 25 additions and 27 deletions.
52 changes: 25 additions & 27 deletions src/TDesign/Components/TUpload.cs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ public async Task Upload(InputFileChangeEventArgs e)
catch ( IOException ex )
{
result.Status = Status.Default;
result.Tip = ex.Message;
result.Message = ex.Message;
}
finally
{
Expand All @@ -202,11 +202,14 @@ public async Task Upload(InputFileChangeEventArgs e)
{
using var readStream = await response.Content.ReadAsStreamAsync();

var serverUploadResults = await JsonSerializer.DeserializeAsync<IList<UploadResult>>(readStream, new JsonSerializerOptions { PropertyNameCaseInsensitive = true });

if(serverUploadResults is not null )
if ( readStream is not null )
{
_results.AddRange(serverUploadResults);
var serverUploadResults = await JsonSerializer.DeserializeAsync<IList<UploadResult>>(readStream, new JsonSerializerOptions { PropertyNameCaseInsensitive = true });

if ( serverUploadResults is not null )
{
_results.AddRange(serverUploadResults);
}
}
}
}
Expand All @@ -232,22 +235,22 @@ public enum UploadTheme
/// 输入框形式的文件上传风格。
/// </summary>
[CssClass("single-file-input")]FileInput,
/// <summary>
/// 文件批量上传。
/// </summary>
[CssClass("flow-file-flow")]FileFlow,
/// <summary>
/// 默认图片上传风格。
/// </summary>
Image,
/// <summary>
/// 图片批量上传风格。
/// </summary>
[CssClass("flow-image-flow")]ImageFlow,
/// <summary>
/// 完全自定义风格。
/// </summary>
Custom,
///// <summary>
///// 文件批量上传。
///// </summary>
//[CssClass("flow-file-flow")]FileFlow,
///// <summary>
///// 默认图片上传风格。
///// </summary>
//Image,
///// <summary>
///// 图片批量上传风格。
///// </summary>
//[CssClass("flow-image-flow")]ImageFlow,
///// <summary>
///// 完全自定义风格。
///// </summary>
//Custom,
}

/// <summary>
Expand Down Expand Up @@ -275,10 +278,5 @@ public class UploadResult
/// <summary>
/// 获取或设置上传后的提示
/// </summary>
public string? Tip { get; set; }

/// <summary>
/// 获取
/// </summary>
public Dictionary<string, string> Data { get; set; } = new();
public string? Message { get; set; }
}

0 comments on commit 70b1a41

Please sign in to comment.