diff --git a/projects/Infrastructure/Application/PagedList.cs b/projects/Infrastructure/Application/PagedList.cs index 9968bc80..4f66be67 100644 --- a/projects/Infrastructure/Application/PagedList.cs +++ b/projects/Infrastructure/Application/PagedList.cs @@ -77,6 +77,10 @@ namespace Infrastructure.Application public IEnumerable Validate(ValidationContext validationContext) { + if (PageIndex < 1) + { + yield return new ValidationResult("当前页索引必须大于等于1"); + } if (PageSize > 1000) { yield return new ValidationResult("分页数量超出系统限制"); diff --git a/projects/Infrastructure/Views/Shared/DisplayTemplates/EmailAddress.cshtml b/projects/Infrastructure/Views/Shared/DisplayTemplates/EmailAddress.cshtml new file mode 100644 index 00000000..692d36d7 --- /dev/null +++ b/projects/Infrastructure/Views/Shared/DisplayTemplates/EmailAddress.cshtml @@ -0,0 +1 @@ +@Model \ No newline at end of file diff --git a/projects/Infrastructure/Views/Shared/_Paged.cshtml b/projects/Infrastructure/Views/Shared/_Paged.cshtml index 23e7d03a..b2230d11 100644 --- a/projects/Infrastructure/Views/Shared/_Paged.cshtml +++ b/projects/Infrastructure/Views/Shared/_Paged.cshtml @@ -3,18 +3,14 @@ var links = Model.GetPageIndexs(); var url = Url.Content("~") + this.Context.Request.Path + this.Context.Request.QueryString; var pageIndexParam = "PageIndex"; - var firstUrl = url.RemoveParam("PageIndex"); - var prevUrl = Model.PageIndex - 1 == 1 ? firstUrl : url.SetParam(pageIndexParam, Model.PageIndex - 1); + var empty = "javascript:;"; + var firstUrl = url.RemoveParam(pageIndexParam); + var prevUrl = Model.PageIndex - 1 >= 1 ? url.SetParam(pageIndexParam, Model.PageIndex - 1) : empty; + var lastUrl = Model.TotalCount > 0 ? url.SetParam(pageIndexParam, Model.PageCount()) : empty; + var nextUrl = Model.PageIndex + 1 <= Model.PageCount() ? url.SetParam(pageIndexParam, Model.PageIndex + 1) : empty; - } \ No newline at end of file diff --git a/projects/Infrastructure/Web/BaseStartup.cs b/projects/Infrastructure/Web/BaseStartup.cs index 80a4c74e..48171c82 100644 --- a/projects/Infrastructure/Web/BaseStartup.cs +++ b/projects/Infrastructure/Web/BaseStartup.cs @@ -35,7 +35,6 @@ using Microsoft.IdentityModel.Tokens; using Microsoft.OpenApi.Models; using Newtonsoft.Json; using System; -using System.Buffers; using System.Globalization; using System.IO; using System.Linq; @@ -264,7 +263,11 @@ namespace Infrastructure.Web { OnTokenValidated = context => { - if (DateTime.UtcNow > context.SecurityToken.ValidTo) + if (context.SecurityToken == null) + { + context.Fail("token error"); + } + else if (DateTime.UtcNow > context.SecurityToken.ValidTo) { context.Fail("token time out"); } diff --git a/projects/IoTCenter/Views/Home/Device.cshtml b/projects/IoTCenter/Views/Home/Device.cshtml index 12e74908..00272bff 100644 --- a/projects/IoTCenter/Views/Home/Device.cshtml +++ b/projects/IoTCenter/Views/Home/Device.cshtml @@ -1,5 +1,5 @@ @section bread{ - + }