fix(#IW3Y8): 服务器端文件缺失时删除个人头像出错
#Comment comment #IW3Y8 默认显示空白,删除头像后显示默认头像 #Issue close https://gitee.com/LongbowEnterprise/dashboard/issues?id=IW3Y8
This commit is contained in:
parent
1698640bcf
commit
7a0d3a0dbc
|
@ -26,7 +26,7 @@ namespace Bootstrap.Admin.Controllers.Api
|
|||
[ButtonAuthorize(Url = "~/Admin/Profiles", Auth = "saveIcon")]
|
||||
public JsonResult Post(string id, [FromServices]IHostingEnvironment env, [FromForm]DeleteFileCollection files)
|
||||
{
|
||||
if (!id.Equals("Delete", StringComparison.OrdinalIgnoreCase) || files.Key.Equals("default.jpg", StringComparison.OrdinalIgnoreCase)) return new JsonResult(new object());
|
||||
if (!id.Equals("Delete", StringComparison.OrdinalIgnoreCase)) return new JsonResult(new object());
|
||||
|
||||
var previewUrl = string.Empty;
|
||||
long fileSize = 0;
|
||||
|
@ -56,7 +56,7 @@ namespace Bootstrap.Admin.Controllers.Api
|
|||
error = string.IsNullOrEmpty(error) ? error : $"服务器端错误-{error}",
|
||||
initialPreview = new string[] { previewUrl },
|
||||
initialPreviewConfig = new object[] {
|
||||
new { caption = "现在头像", size = fileSize, showZoom = true, key = "default.jpg" }
|
||||
new { caption = "", size = fileSize, showZoom = true, key = "default.jpg" }
|
||||
},
|
||||
append = false
|
||||
});
|
||||
|
|
|
@ -88,7 +88,7 @@
|
|||
</div>
|
||||
<div class="dropdown userinfo">
|
||||
<a data-toggle="dropdown" class="dropdown-toggle shadow-default" href="#">
|
||||
<img id="headerIcon" alt="" src="@Url.Content(Model.Icon)">
|
||||
<img id="headerIcon" alt="" src="@Url.Content(Model.Icon)" />
|
||||
<span id="userDisplayName" data-userName="@Model.UserName" class="username text-truncate d-inline-block">@Model.DisplayName</span>
|
||||
</a>
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
preIcon
|
||||
],
|
||||
initialPreviewConfig: [
|
||||
{ caption: "现在头像", size: $file.attr('data-init'), showZoom: true, showRemove: defFileName !== 'default.jpg', key: defFileName }
|
||||
{ caption: "", size: $file.attr('data-init'), showZoom: true, showRemove: defFileName !== 'default.jpg', key: defFileName }
|
||||
],
|
||||
initialPreviewAsData: true,
|
||||
overwriteInitial: true,
|
||||
|
@ -51,7 +51,7 @@
|
|||
$.formatUrl('images/uploader/default.jpg')
|
||||
],
|
||||
initialPreviewConfig: [
|
||||
{ caption: "现在头像", size: 7195, showZoom: true, showRemove: false, key: 'default.jpg' }
|
||||
{ caption: "", size: 7195, showZoom: true, showRemove: false, key: 'default.jpg' }
|
||||
]
|
||||
});
|
||||
this._initPreviewCache();
|
||||
|
|
Loading…
Reference in New Issue