|
@@ -1,8 +1,6 @@
|
|
-@using Masuit.MyBlogs.Core.Common
|
|
|
|
-@using Masuit.MyBlogs.Core.Models.DTO
|
|
|
|
|
|
+@using Masuit.MyBlogs.Core.Models.DTO
|
|
@using Masuit.MyBlogs.Core.Models.ViewModel
|
|
@using Masuit.MyBlogs.Core.Models.ViewModel
|
|
@using Masuit.Tools
|
|
@using Masuit.Tools
|
|
-@using Masuit.Tools.Core.Net
|
|
|
|
@using Microsoft.AspNetCore.Mvc.Rendering
|
|
@using Microsoft.AspNetCore.Mvc.Rendering
|
|
@model SearchResult<Masuit.MyBlogs.Core.Models.DTO.PostDto>
|
|
@model SearchResult<Masuit.MyBlogs.Core.Models.DTO.PostDto>
|
|
@{
|
|
@{
|
|
@@ -37,15 +35,12 @@
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</form>
|
|
@if (hotSearches.Any()) {
|
|
@if (hotSearches.Any()) {
|
|
- <span>搜索推荐:</span>
|
|
|
|
- foreach (var item in hotSearches) {
|
|
|
|
- @Html.ActionLink(item.Keywords + "(" + item.Count + ")", "Search", new {
|
|
|
|
- wd = item.Keywords
|
|
|
|
- }, new {
|
|
|
|
- @class = "label label-danger"
|
|
|
|
- })
|
|
|
|
- <span> </span>
|
|
|
|
- }
|
|
|
|
|
|
+ <div class="copyright-card">
|
|
|
|
+ <h2 class="recommend-title">搜索推荐:</h2>
|
|
|
|
+ @for (var index = 0; index < hotSearches.Count; index++) {
|
|
|
|
+ <a asp-action="Search" asp-route-wd="@hotSearches[index].Keywords" class="margin-bot10 tag-cloud-item tag@(index+1)">@hotSearches[index].Keywords (@hotSearches[index].Count)</a>
|
|
|
|
+ }
|
|
|
|
+ </div>
|
|
}
|
|
}
|
|
</div>
|
|
</div>
|
|
@if (Model.Results.Any()) {
|
|
@if (Model.Results.Any()) {
|
|
@@ -57,7 +52,7 @@
|
|
}
|
|
}
|
|
|
|
|
|
var p = Model.Results[i];
|
|
var p = Model.Results[i];
|
|
- <div class="article-card" style="margin-top: 15px;">
|
|
|
|
|
|
+ <div class="article-card" style="margin: 15px 0;">
|
|
<div class="article-content">
|
|
<div class="article-content">
|
|
<a asp-action="Details" asp-controller="Post" asp-route-id="@p.Id" asp-route-kw="@ViewBag.Keyword" class="article-title" target="_blank">
|
|
<a asp-action="Details" asp-controller="Post" asp-route-id="@p.Id" asp-route-kw="@ViewBag.Keyword" class="article-title" target="_blank">
|
|
@Html.Raw(p.Title)
|
|
@Html.Raw(p.Title)
|
|
@@ -84,11 +79,10 @@
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@if (relateKeywords?.Count > 0) {
|
|
@if (relateKeywords?.Count > 0) {
|
|
- <div class="margin-bot10">
|
|
|
|
- <h3>相关搜索:</h3>
|
|
|
|
- @foreach (var kw in relateKeywords) {
|
|
|
|
- <a asp-action="Search" asp-route-wd="@kw">@kw</a>
|
|
|
|
- <span> </span>
|
|
|
|
|
|
+ <div class="copyright-card">
|
|
|
|
+ <h2 class="recommend-title">相关搜索:</h2>
|
|
|
|
+ @for (var index = 0; index < relateKeywords.Count; index++) {
|
|
|
|
+ <a asp-action="Search" asp-route-wd="@relateKeywords[index]" class="margin-bot10 tag-cloud-item tag@(index+1)">@relateKeywords[index]</a>
|
|
}
|
|
}
|
|
</div>
|
|
</div>
|
|
}
|
|
}
|
|
@@ -112,71 +106,45 @@
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@if (pages > 1) {
|
|
@if (pages > 1) {
|
|
- <ul class="margin-clear pagination">
|
|
|
|
- @if (current == 1) {
|
|
|
|
- <li class="disabled">
|
|
|
|
- <a>首页</a>
|
|
|
|
- </li>
|
|
|
|
- <li class="disabled">
|
|
|
|
- <a aria-label="Previous">
|
|
|
|
- <span aria-hidden="true">«</span>
|
|
|
|
- </a>
|
|
|
|
- </li>
|
|
|
|
- } else {
|
|
|
|
- <li>
|
|
|
|
- <a aria-label="Previous" asp-action="Search" asp-route-wd="@ViewBag.Keyword">首页</a>
|
|
|
|
- </li>
|
|
|
|
- <li>
|
|
|
|
- <a aria-label="Previous" asp-action="Search" asp-route-page="@(page - 1 <= 0 ? 1 : page - 1)" asp-route-wd="@ViewBag.Keyword">
|
|
|
|
- <span aria-hidden="true">«</span>
|
|
|
|
|
|
+ <div class="article-list-footer">
|
|
|
|
+ <div class="pagination">
|
|
|
|
+ @if (current == 1) {
|
|
|
|
+ <button class="disabled page-btn" disabled="disabled">«</button>
|
|
|
|
+ } else {
|
|
|
|
+ <a asp-action="Search" asp-route-wd="@ViewBag.Keyword">
|
|
|
|
+ <button class="page-btn">首页</button>
|
|
</a>
|
|
</a>
|
|
- </li>
|
|
|
|
- }
|
|
|
|
- @if (pageStart > 1) {
|
|
|
|
- <li class="disabled">
|
|
|
|
- <a aria-label="Previous">
|
|
|
|
- <span aria-hidden="true">...</span>
|
|
|
|
|
|
+ <a asp-action="Search" asp-route-page="@(page - 1 <= 0 ? 1 : page - 1)" asp-route-wd="@ViewBag.Keyword">
|
|
|
|
+ <button class="page-btn">«</button>
|
|
</a>
|
|
</a>
|
|
- </li>
|
|
|
|
- }
|
|
|
|
- @for (int i = pageStart; i <= pageEnd; i++) {
|
|
|
|
- if (i == current) {
|
|
|
|
- <li class="disabled">
|
|
|
|
- <a>@i</a>
|
|
|
|
- </li>
|
|
|
|
- } else {
|
|
|
|
- <li>
|
|
|
|
- <a asp-action="Search" asp-route-page="@i" asp-route-wd="@ViewBag.Keyword">@i</a>
|
|
|
|
- </li>
|
|
|
|
}
|
|
}
|
|
- }
|
|
|
|
- @if (pageEnd < pages) {
|
|
|
|
- <li class="disabled">
|
|
|
|
- <a aria-label="Previous">
|
|
|
|
- <span aria-hidden="true">...</span>
|
|
|
|
- </a>
|
|
|
|
- </li>
|
|
|
|
- }
|
|
|
|
- @if (current == pages) {
|
|
|
|
- <li class="disabled">
|
|
|
|
- <a>
|
|
|
|
- <span aria-hidden="true">»</span>
|
|
|
|
|
|
+ @if (pageStart > 1) {
|
|
|
|
+ <span class="ellipsis">...</span>
|
|
|
|
+ }
|
|
|
|
+ @for (int i = pageStart; i <= pageEnd; i++) {
|
|
|
|
+ if (i == current) {
|
|
|
|
+ <button class="active page-btn">@i</button>
|
|
|
|
+ } else {
|
|
|
|
+ <a asp-action="Search" asp-route-page="@i" asp-route-wd="@ViewBag.Keyword">
|
|
|
|
+ <button class="page-btn">@i</button>
|
|
|
|
+ </a>
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ @if (pageEnd < pages) {
|
|
|
|
+ <span class="ellipsis">...</span>
|
|
|
|
+ }
|
|
|
|
+ @if (current == pages) {
|
|
|
|
+ <button class="disabled page-btn" disabled="disabled">»</button>
|
|
|
|
+ } else {
|
|
|
|
+ <a asp-action="Search" asp-route-page="@(current + 1)" asp-route-wd="@ViewBag.Keyword">
|
|
|
|
+ <button class="page-btn">»</button>
|
|
</a>
|
|
</a>
|
|
- </li>
|
|
|
|
- <li class="disabled">
|
|
|
|
- <a>最后一页</a>
|
|
|
|
- </li>
|
|
|
|
- } else {
|
|
|
|
- <li>
|
|
|
|
- <a aria-label="Next" asp-action="Search" asp-route-page="@(current + 1)" asp-route-wd="@ViewBag.Keyword">
|
|
|
|
- <span aria-hidden="true">»</span>
|
|
|
|
|
|
+ <a asp-action="Search" asp-route-page="@pages" asp-route-wd="@ViewBag.Keyword">
|
|
|
|
+ <button class="page-btn">最后一页</button>
|
|
</a>
|
|
</a>
|
|
- </li>
|
|
|
|
- <li>
|
|
|
|
- <a aria-label="Next" asp-action="Search" asp-route-page="@pages" asp-route-wd="@ViewBag.Keyword">最后一页</a>
|
|
|
|
- </li>
|
|
|
|
- }
|
|
|
|
- </ul>
|
|
|
|
|
|
+ }
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
}
|
|
}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|