修改BUG:使用最新的bootstrap-input组件,移除class=file,避免组件默认初始化

This commit is contained in:
Argo-Surface 2018-11-22 14:34:21 +08:00
parent 9e84f9eabd
commit 368f6b2ce9
3 changed files with 5 additions and 3 deletions

View File

@ -55,7 +55,7 @@ namespace Bootstrap.Admin.Controllers.Api
fileName = Path.Combine(env.WebRootPath, $"images\\uploader\\{fileName}");
try
{
System.IO.File.Delete(fileName);
if (System.IO.File.Exists(fileName)) System.IO.File.Delete(fileName);
fileName = "default.jpg";
UserHelper.SaveUserIconByName(userName, fileName);
}

View File

@ -101,7 +101,7 @@
<div class="card-body">
<form enctype="multipart/form-data" class="d-none" data-admin="@User.IsInRole("Administrators")">
<div class="form-group">
<input id="fileIcon" class="file" type="file" data-init="@Model.Size" data-file="@Model.FileName">
<input id="fileIcon" type="file" data-init="@Model.Size" data-file="@Model.FileName">
</div>
</form>
<img class="card-img d-none" src="@Url.Content(Model.Icon)" />

View File

@ -19,7 +19,9 @@
],
initialPreviewAsData: true,
overwriteInitial: true,
dropZoneTitle: "请选择头像"
dropZoneTitle: "请选择头像",
msgPlaceholder: "请选择头像",
fileActionSettings: { showUpload: false }
}).on('fileuploaded', function (event, data, previewId, index) {
var url = data.response.initialPreview[0];
if (!!url === true) $headerIcon.attr('src', url);