完善商品栏目管理选择模板,商品栏目、商品伪静态地址生成

This commit is contained in:
2024-06-26 17:48:08 +08:00
parent 3328ba055b
commit 48b68889b0
14 changed files with 294 additions and 64 deletions
+24 -2
View File
@@ -8,6 +8,7 @@ using COMCMS.Core;
using COMCMS.Core.Models;
using COMCMS.Web.Common;
using XCode;
using static Google.Protobuf.WellKnownTypes.Field.Types;
namespace COMCMS.Web.Controllers
{
@@ -60,7 +61,14 @@ namespace COMCMS.Web.Controllers
ViewBag.cfg = cfg;
ViewBag.list = list;
return View(entity);
string templatesname = "Index.cshtml";//模板名称
if (!string.IsNullOrEmpty(entity.TemplateFile))
{
templatesname = entity.TemplateFile;
//return Content(templatesname);
}
return View("~/Views/Product/" + templatesname, entity);
}
#endregion
@@ -73,6 +81,11 @@ namespace COMCMS.Web.Controllers
{
return EchoTip("系统找不到本记录!");
}
Category kind = Category.FindById(entity.KId);
if (kind == null)
{
return AlertAndGoBack("系统找不到本文章栏目!");
}
//文章更多图片列表
if (!string.IsNullOrEmpty(entity.ItemImg))
{
@@ -92,7 +105,16 @@ namespace COMCMS.Web.Controllers
ViewBag.cfg = cfg;
ViewBag.category = entity.Category;
return View(entity);
string templatesname = "";//模板名称
if (!string.IsNullOrEmpty(kind.TemplateFile))
{
templatesname = kind.DetailTemplateFile;//.Replace(".cshtml", "").Replace(".aspx", "");
return View("~/Views/Product/" + templatesname, entity);
}
else
{
return View("~/Views/Product/Detail.cshtml", entity);
}
}
#endregion
}