diff --git a/Bootstrap.Admin/Bootstrap.Admin.csproj b/Bootstrap.Admin/Bootstrap.Admin.csproj
index e2ddf7d3..147f9dc4 100644
--- a/Bootstrap.Admin/Bootstrap.Admin.csproj
+++ b/Bootstrap.Admin/Bootstrap.Admin.csproj
@@ -261,6 +261,7 @@
Global.asax
+
diff --git a/Bootstrap.Admin/Controllers/AdminController.cs b/Bootstrap.Admin/Controllers/AdminController.cs
index 59e497f0..ff3580fd 100644
--- a/Bootstrap.Admin/Controllers/AdminController.cs
+++ b/Bootstrap.Admin/Controllers/AdminController.cs
@@ -106,7 +106,7 @@ namespace Bootstrap.Admin.Controllers
///
public ActionResult Infos()
{
- var v = new NavigatorBarModel("~/Admin/Infos");
+ var v = new InfosModel("~/Admin/Infos");
return View(v);
}
///
diff --git a/Bootstrap.Admin/Models/InfosModel.cs b/Bootstrap.Admin/Models/InfosModel.cs
new file mode 100644
index 00000000..9cab72ce
--- /dev/null
+++ b/Bootstrap.Admin/Models/InfosModel.cs
@@ -0,0 +1,28 @@
+using System.IO;
+using System.Web;
+
+namespace Bootstrap.Admin.Models
+{
+ ///
+ ///
+ ///
+ public class InfosModel : NavigatorBarModel
+ {
+ ///
+ /// 获得/设置 头像文件大小
+ ///
+ public long Size { get; set; }
+ ///
+ ///
+ ///
+ ///
+ public InfosModel(string url) : base(url)
+ {
+ var fileName = HttpContext.Current.Server.MapPath(Icon);
+ if (File.Exists(fileName))
+ {
+ Size = new FileInfo(fileName).Length;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/Bootstrap.Admin/Scripts/Infos.js b/Bootstrap.Admin/Scripts/Infos.js
index a3f8259e..d9c0bf77 100644
--- a/Bootstrap.Admin/Scripts/Infos.js
+++ b/Bootstrap.Admin/Scripts/Infos.js
@@ -4,12 +4,13 @@
$('#fileIcon').fileinput({
uploadUrl: Infos.url,
language: 'zh',
+ maxFileSize: 5000,
allowedFileExtensions: ['jpg', 'png', 'bmp', 'gif', 'jpeg'],
initialPreview: [
preIcon
],
initialPreviewConfig: [
- { caption: "现在头像", size: 730, showZoom: false },
+ { caption: "现在头像", size: $('#fileIcon').attr('data-init'), showZoom: false },
],
initialPreviewAsData: true,
overwriteInitial: true,
diff --git a/Bootstrap.Admin/Views/Admin/Infos.cshtml b/Bootstrap.Admin/Views/Admin/Infos.cshtml
index b830f3a4..32e2d1fd 100644
--- a/Bootstrap.Admin/Views/Admin/Infos.cshtml
+++ b/Bootstrap.Admin/Views/Admin/Infos.cshtml
@@ -1,4 +1,4 @@
-@model NavigatorBarModel
+@model InfosModel
@{
ViewBag.Title = "个人中心";
Layout = "~/Views/Shared/_Admin.cshtml";
@@ -72,7 +72,7 @@