增加当前图像显示大小功能
This commit is contained in:
parent
9e20c02525
commit
87154584a7
|
@ -261,6 +261,7 @@
|
||||||
<Compile Include="Global.asax.cs">
|
<Compile Include="Global.asax.cs">
|
||||||
<DependentUpon>Global.asax</DependentUpon>
|
<DependentUpon>Global.asax</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Models\InfosModel.cs" />
|
||||||
<Compile Include="Models\LockModel.cs" />
|
<Compile Include="Models\LockModel.cs" />
|
||||||
<Compile Include="Models\MessageCountModel.cs" />
|
<Compile Include="Models\MessageCountModel.cs" />
|
||||||
<Compile Include="Models\QueryDictOption.cs" />
|
<Compile Include="Models\QueryDictOption.cs" />
|
||||||
|
|
|
@ -106,7 +106,7 @@ namespace Bootstrap.Admin.Controllers
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public ActionResult Infos()
|
public ActionResult Infos()
|
||||||
{
|
{
|
||||||
var v = new NavigatorBarModel("~/Admin/Infos");
|
var v = new InfosModel("~/Admin/Infos");
|
||||||
return View(v);
|
return View(v);
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
using System.IO;
|
||||||
|
using System.Web;
|
||||||
|
|
||||||
|
namespace Bootstrap.Admin.Models
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public class InfosModel : NavigatorBarModel
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 获得/设置 头像文件大小
|
||||||
|
/// </summary>
|
||||||
|
public long Size { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="url"></param>
|
||||||
|
public InfosModel(string url) : base(url)
|
||||||
|
{
|
||||||
|
var fileName = HttpContext.Current.Server.MapPath(Icon);
|
||||||
|
if (File.Exists(fileName))
|
||||||
|
{
|
||||||
|
Size = new FileInfo(fileName).Length;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,12 +4,13 @@
|
||||||
$('#fileIcon').fileinput({
|
$('#fileIcon').fileinput({
|
||||||
uploadUrl: Infos.url,
|
uploadUrl: Infos.url,
|
||||||
language: 'zh',
|
language: 'zh',
|
||||||
|
maxFileSize: 5000,
|
||||||
allowedFileExtensions: ['jpg', 'png', 'bmp', 'gif', 'jpeg'],
|
allowedFileExtensions: ['jpg', 'png', 'bmp', 'gif', 'jpeg'],
|
||||||
initialPreview: [
|
initialPreview: [
|
||||||
preIcon
|
preIcon
|
||||||
],
|
],
|
||||||
initialPreviewConfig: [
|
initialPreviewConfig: [
|
||||||
{ caption: "现在头像", size: 730, showZoom: false },
|
{ caption: "现在头像", size: $('#fileIcon').attr('data-init'), showZoom: false },
|
||||||
],
|
],
|
||||||
initialPreviewAsData: true,
|
initialPreviewAsData: true,
|
||||||
overwriteInitial: true,
|
overwriteInitial: true,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
@model NavigatorBarModel
|
@model InfosModel
|
||||||
@{
|
@{
|
||||||
ViewBag.Title = "个人中心";
|
ViewBag.Title = "个人中心";
|
||||||
Layout = "~/Views/Shared/_Admin.cshtml";
|
Layout = "~/Views/Shared/_Admin.cshtml";
|
||||||
|
@ -72,7 +72,7 @@
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<form enctype="multipart/form-data">
|
<form enctype="multipart/form-data">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<input id="fileIcon" class="file" type="file">
|
<input id="fileIcon" class="file" type="file" data-init="@Model.Size">
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue