增加文章Tag标签
This commit is contained in:
@@ -479,7 +479,7 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
ArticleCategory.UpdateDetailCount(model.KId);
|
||||
SessionHelper.WriteSession("com_add_article_kid", model.KId);
|
||||
//添加TAG
|
||||
//Tag.InsertTags(model.Tags, RTType.RatuoModule.Article, model.Id, model.Title);
|
||||
Tags.InsertTags(model.Tags, Utils.CMSType.Article, model.Id, model.Title);
|
||||
Core.Admin.WriteLogActions("添加文章(id:" + model.Id + ");");
|
||||
tip.Status = JsonTip.SUCCESS;
|
||||
tip.Message = "添加文章成功";
|
||||
@@ -637,7 +637,7 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
|
||||
//model.AuthorId = Core.Admin.GetMyInfo().Id;
|
||||
entity.Update();
|
||||
//Tag.ModifyTags(model.Tags, RTType.RatuoModule.Article, model.Id, model.Title);
|
||||
Tags.ModifyTags(model.Tags, Utils.CMSType.Article, model.Id, model.Title);
|
||||
Core.Admin.WriteLogActions("编辑文章(id:" + model.Id + ");");
|
||||
tip.Status = JsonTip.SUCCESS;
|
||||
tip.Message = "编辑文章详情成功";
|
||||
@@ -681,7 +681,7 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
|
||||
int kid = entity.Id;
|
||||
//删除TAG
|
||||
//Tag.DeleteTag(RTType.RatuoModule.Article, entity.Id);
|
||||
Tags.DeleteTag(entity.Tags, Utils.CMSType.Article, entity.Id);
|
||||
Core.Admin.WriteLogActions("删除文章(id:" + entity.Id + ");");
|
||||
entity.Delete();
|
||||
ArticleCategory.UpdateDetailCount(kid);
|
||||
|
||||
@@ -6,24 +6,23 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="MailKit" Version="2.10.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="5.0.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="5.0.0" />
|
||||
<PackageReference Include="Microsoft.Data.Sqlite.Core" Version="5.0.0" />
|
||||
<PackageReference Include="MailKit" Version="2.10.1" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="5.0.2" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="5.0.2" />
|
||||
<PackageReference Include="Microsoft.Data.Sqlite.Core" Version="5.0.2" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.10.9" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="5.0.0" />
|
||||
<PackageReference Include="MimeKit" Version="2.10.0" />
|
||||
<PackageReference Include="MySql.Data" Version="8.0.22" />
|
||||
<PackageReference Include="NewLife.XCode" Version="10.0.2020.1201" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="5.0.1" />
|
||||
<PackageReference Include="MimeKit" Version="2.10.1" />
|
||||
<PackageReference Include="MySql.Data" Version="8.0.23" />
|
||||
<PackageReference Include="NewLife.XCode" Version="10.0.2021.101" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||
<PackageReference Include="Senparc.NeuChar" Version="1.2.201" />
|
||||
<PackageReference Include="Senparc.Weixin" Version="6.7.600" />
|
||||
<PackageReference Include="Senparc.Weixin.MP" Version="16.10.601" />
|
||||
<PackageReference Include="Senparc.NeuChar" Version="1.3.200" />
|
||||
<PackageReference Include="Senparc.Weixin" Version="6.8.200" />
|
||||
<PackageReference Include="Senparc.Weixin.MP" Version="16.11.200" />
|
||||
<PackageReference Include="Senparc.Weixin.MP.MvcExtension" Version="4.1.1" />
|
||||
<PackageReference Include="Senparc.Weixin.TenPay" Version="1.5.600" />
|
||||
<PackageReference Include="Senparc.Weixin.WxOpen" Version="3.8.601" />
|
||||
<PackageReference Include="Senparc.Weixin.TenPay" Version="1.6.200.2" />
|
||||
<PackageReference Include="Senparc.Weixin.WxOpen" Version="3.10.200.1" />
|
||||
<PackageReference Include="System.Data.SqlClient" Version="4.8.2" />
|
||||
<PackageReference Include="ZKWeb.System.Drawing" Version="4.0.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -0,0 +1,104 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using COMCMS.Common;
|
||||
using COMCMS.Core;
|
||||
using COMCMS.Core.Models;
|
||||
using COMCMS.Web.Common;
|
||||
using XCode;
|
||||
|
||||
namespace COMCMS.Web.Controllers
|
||||
{
|
||||
public class TagController : HomeBaseController
|
||||
{
|
||||
#region Tag首页
|
||||
[HttpGet]
|
||||
public IActionResult Index(int page=1)
|
||||
{
|
||||
int numPerPage, currentPage, startRowIndex;
|
||||
numPerPage = 40;
|
||||
if (page > 0)
|
||||
currentPage = page;
|
||||
else
|
||||
currentPage = 1;
|
||||
startRowIndex = (currentPage - 1) * numPerPage;
|
||||
var where = Tags._.Counts > 0;
|
||||
|
||||
long totalCount = Tags.FindCount(where, null, null, startRowIndex, numPerPage);
|
||||
IList<Tags> list = new List<Tags>();
|
||||
if (totalCount > 0)
|
||||
{
|
||||
list = Tags.FindAll(where, Tags._.Id.Desc(), null, startRowIndex, numPerPage);
|
||||
}
|
||||
|
||||
int pageCount = (int)totalCount / numPerPage;//总页数
|
||||
if (totalCount % numPerPage > 0)
|
||||
{
|
||||
pageCount += 1;
|
||||
}
|
||||
//ViewBag.list = list;//列表
|
||||
//分页信息
|
||||
ViewBag.totalCount = totalCount;
|
||||
ViewBag.pageCount = pageCount;
|
||||
ViewBag.page = page;
|
||||
ViewBag.pagesize = numPerPage;
|
||||
ViewBag.cfg = cfg;
|
||||
return View(list);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Tag标签列表页面
|
||||
[HttpGet]
|
||||
[Route("tag/{name}")]
|
||||
[Route("tag/{name}/{page:int}")]
|
||||
public IActionResult TagList(string name, int page = 1)
|
||||
{
|
||||
Tags entity = Tags.Find(Tags._.TagName == name);
|
||||
if(entity == null)
|
||||
{
|
||||
return EchoTip("系统找不到本标签!");
|
||||
}
|
||||
|
||||
int numPerPage, currentPage, startRowIndex;
|
||||
numPerPage = 20;
|
||||
if (page > 0)
|
||||
currentPage = page;
|
||||
else
|
||||
currentPage = 1;
|
||||
|
||||
if(currentPage == 1)
|
||||
{
|
||||
entity.Hits++;
|
||||
entity.Update();
|
||||
}
|
||||
startRowIndex = (currentPage - 1) * numPerPage;
|
||||
var where = TagsDetail._.TagName == entity.TagName;
|
||||
|
||||
long totalCount = TagsDetail.FindCount(where, null, null, startRowIndex, numPerPage);
|
||||
IList<TagsDetail> list = new List<TagsDetail>();
|
||||
if (totalCount > 0)
|
||||
{
|
||||
list = TagsDetail.FindAll(where, TagsDetail._.Id.Desc(), null, startRowIndex, numPerPage);
|
||||
}
|
||||
|
||||
int pageCount = (int)totalCount / numPerPage;//总页数
|
||||
if (totalCount % numPerPage > 0)
|
||||
{
|
||||
pageCount += 1;
|
||||
}
|
||||
ViewBag.list = list;//列表
|
||||
//分页信息
|
||||
ViewBag.totalCount = totalCount;
|
||||
ViewBag.pageCount = pageCount;
|
||||
ViewBag.page = page;
|
||||
ViewBag.pagesize = numPerPage;
|
||||
ViewBag.cfg = cfg;
|
||||
//IList<Tags> list = Tags.FindAll()
|
||||
return View(entity);
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
@@ -211,7 +211,7 @@
|
||||
</div>
|
||||
<div class="foot-bottom">
|
||||
<div class="cont">
|
||||
<span>@ViewBag.cfg.Copyright <a href="http://www.comcms.com/" target="_blank"> 技术支持:COMCMS</a> <a href="http://www.miitbeian.gov.cn/" target="_blank">粤ICP备8888888号-1</a> Powered by .NET Core 3.1 on @COMCMS.Common.Utils.GetOSPlatform() Server</span>
|
||||
<span>@ViewBag.cfg.Copyright <a href="http://www.comcms.com/" target="_blank"> 技术支持:COMCMS</a> <a href="http://www.miitbeian.gov.cn/" target="_blank">粤ICP备8888888号-1</a> Powered by .NET 5.0 on @COMCMS.Common.Utils.GetOSPlatform() Server</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
@model IList<Tags>
|
||||
@{
|
||||
ViewBag.title = "TAG标签";
|
||||
ViewBag.keywords = "TAG标签";
|
||||
ViewBag.description = "TAG标签";
|
||||
|
||||
}
|
||||
|
||||
<div class="banner normal sec-banner">
|
||||
<em style="background: url('/images/default/slide-1.jpg') center top no-repeat; background-size: 100%;"></em>
|
||||
</div>
|
||||
<!-- mb banner -->
|
||||
<div class="banner mobile sec-banner">
|
||||
<em style="background: url('/images/default/slide-1.jpg') center top no-repeat; background-size: 100%;"></em>
|
||||
</div>
|
||||
<div class="sec-nav">
|
||||
<div class="cont">
|
||||
<ul class="sec-nav-list">
|
||||
<li class="sec-on">TAG标签</li>
|
||||
</ul>
|
||||
|
||||
<script type="text/javascript">
|
||||
function mbSecNav() {
|
||||
var num = $('.sec-nav-list li').length;
|
||||
if (num >= 3) {
|
||||
$('.sec-nav-list li').css({ 'width': (640 / 3 / 100) + 'rem' });
|
||||
} else if (num == 2) {
|
||||
$('.sec-nav-list li').css({ 'width': (640 / 2 / 100) + 'rem' });
|
||||
} else if (num == 1) {
|
||||
$('.sec-nav-list li').css({ 'width': (213 / 100) + 'rem' });
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="content newsC">
|
||||
<div class="news-bg">
|
||||
<div class="cont">
|
||||
<ul class="tag-list">
|
||||
@foreach (Tags a in Model)
|
||||
{
|
||||
<li>
|
||||
<a href="/tag/@a.TagName" title="@a.TagName">
|
||||
@a.TagName(@a.Counts)
|
||||
</a>
|
||||
</li>
|
||||
}
|
||||
@if (Model == null || Model.Count < 1)
|
||||
{
|
||||
<li>暂无相关记录...</li>
|
||||
}
|
||||
</ul>
|
||||
<div class="normal">
|
||||
@Html.Raw(Pages.GetPageStr(ViewBag.pagesize, (int)ViewBag.totalCount, ViewBag.page, "/Tag?page={0}", 3, 10, ""))
|
||||
</div>
|
||||
<!-- 点击加载更多 -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,61 @@
|
||||
@model Tags
|
||||
@{
|
||||
ViewBag.title = Model.TagName;
|
||||
ViewBag.keywords = Model.Keywords;
|
||||
ViewBag.description = Model.Description;
|
||||
|
||||
}
|
||||
|
||||
<div class="banner normal sec-banner">
|
||||
<em style="background: url('/images/default/slide-1.jpg') center top no-repeat; background-size: 100%;"></em>
|
||||
</div>
|
||||
<!-- mb banner -->
|
||||
<div class="banner mobile sec-banner">
|
||||
<em style="background: url('/images/default/slide-1.jpg') center top no-repeat; background-size: 100%;"></em>
|
||||
</div>
|
||||
<div class="sec-nav">
|
||||
<div class="cont">
|
||||
<ul class="sec-nav-list">
|
||||
<li class="sec-on">标签:@Model.TagName</li>
|
||||
</ul>
|
||||
|
||||
<script type="text/javascript">
|
||||
function mbSecNav() {
|
||||
var num = $('.sec-nav-list li').length;
|
||||
if (num >= 3) {
|
||||
$('.sec-nav-list li').css({ 'width': (640 / 3 / 100) + 'rem' });
|
||||
} else if (num == 2) {
|
||||
$('.sec-nav-list li').css({ 'width': (640 / 2 / 100) + 'rem' });
|
||||
} else if (num == 1) {
|
||||
$('.sec-nav-list li').css({ 'width': (213 / 100) + 'rem' });
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="content newsC">
|
||||
<div class="news-bg">
|
||||
<div class="cont">
|
||||
<ul class="tag-list">
|
||||
@foreach (TagsDetail a in ViewBag.list)
|
||||
{
|
||||
<li>
|
||||
<a href="@ViewsHelper.EchoArticleURL(a.RId)" title="@a.Title">
|
||||
@a.Title
|
||||
</a>
|
||||
</li>
|
||||
}
|
||||
@if (ViewBag.list == null || ViewBag.list.Count < 1)
|
||||
{
|
||||
<li>暂无相关记录...</li>
|
||||
}
|
||||
</ul>
|
||||
<div class="normal">
|
||||
@Html.Raw(Pages.GetPageStr(ViewBag.pagesize, (int)ViewBag.totalCount, ViewBag.page, "/tag/"+Model.TagName+"/{0}", 3, 10, ""))
|
||||
</div>
|
||||
<!-- 点击加载更多 -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1766,6 +1766,27 @@ img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.tag-list {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
flex-direction:row;
|
||||
order:2;
|
||||
justify-content:space-around;
|
||||
align-content:flex-start;
|
||||
}
|
||||
.tag-list li {
|
||||
border-bottom: 1px dashed #dedede;
|
||||
height: 60px;
|
||||
height: 0.6rem;
|
||||
line-height: 0.6rem;
|
||||
width:48%;
|
||||
margin-bottom:0.08rem;
|
||||
}
|
||||
/*.tag-list::after {
|
||||
content: '';
|
||||
flex: auto;*/ /* 或者flex: 1 */
|
||||
/*}*/
|
||||
|
||||
|
||||
.news-pic {
|
||||
width: 220px;
|
||||
|
||||
Reference in New Issue
Block a user