增加完善分类伪静态
This commit is contained in:
@@ -75,6 +75,32 @@ namespace COMCMS.Common
|
|||||||
/// 配送状态 "未配送", "配货中", "已配送", "已收到", "退货中", "已退货"
|
/// 配送状态 "未配送", "配货中", "已配送", "已收到", "退货中", "已退货"
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static string[] DeliverState = { "未配送", "配货中", "已配送", "已收到", "退货中", "已退货" };
|
public static string[] DeliverState = { "未配送", "配货中", "已配送", "已收到", "退货中", "已退货" };
|
||||||
|
/// <summary>
|
||||||
|
/// cms类型
|
||||||
|
/// </summary>
|
||||||
|
public enum CMSType
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 文章分类
|
||||||
|
/// </summary>
|
||||||
|
ArticleCategory=0,
|
||||||
|
/// <summary>
|
||||||
|
/// 文章
|
||||||
|
/// </summary>
|
||||||
|
Article=1,
|
||||||
|
/// <summary>
|
||||||
|
/// 商品分类
|
||||||
|
/// </summary>
|
||||||
|
ProductCategory=2,
|
||||||
|
/// <summary>
|
||||||
|
/// 商品详情
|
||||||
|
/// </summary>
|
||||||
|
Product=3,
|
||||||
|
/// <summary>
|
||||||
|
/// 首页
|
||||||
|
/// </summary>
|
||||||
|
Home=99
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 验证部分
|
#region 验证部分
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ using COMCMS.Core;
|
|||||||
using COMCMS.Common;
|
using COMCMS.Common;
|
||||||
using XCode;
|
using XCode;
|
||||||
|
|
||||||
|
|
||||||
namespace COMCMS.Web.Common
|
namespace COMCMS.Web.Common
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -14,6 +15,11 @@ namespace COMCMS.Web.Common
|
|||||||
public class ViewsHelper
|
public class ViewsHelper
|
||||||
{
|
{
|
||||||
#region 获取分类链接
|
#region 获取分类链接
|
||||||
|
/// <summary>
|
||||||
|
/// 文章分类
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="model"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public static string EchoURL(ArticleCategory model)
|
public static string EchoURL(ArticleCategory model)
|
||||||
{
|
{
|
||||||
if (model == null)
|
if (model == null)
|
||||||
@@ -23,6 +29,46 @@ namespace COMCMS.Web.Common
|
|||||||
else
|
else
|
||||||
return $"/article/index/{model.Id}";
|
return $"/article/index/{model.Id}";
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 商品分类
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="model"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static string EchoURL(Category model)
|
||||||
|
{
|
||||||
|
if (model == null)
|
||||||
|
return "";
|
||||||
|
if (!string.IsNullOrEmpty(model.FilePath))
|
||||||
|
return model.FilePath + "/index.html";
|
||||||
|
else
|
||||||
|
return $"/product/index/{model.Id}";
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="ctype"></param>
|
||||||
|
/// <param name="id"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static string EchoURL(Utils.CMSType ctype,int id)
|
||||||
|
{
|
||||||
|
string url = "/";
|
||||||
|
switch (ctype)
|
||||||
|
{
|
||||||
|
case Utils.CMSType.ArticleCategory:
|
||||||
|
ArticleCategory ac = ArticleCategory.FindById(id);
|
||||||
|
url = EchoURL(ac);
|
||||||
|
break;
|
||||||
|
case Utils.CMSType.ProductCategory:
|
||||||
|
Category pc = Category.FindById(id);
|
||||||
|
url = EchoURL(pc);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
url= "/";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return url;
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ namespace COMCMS.Web.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
#region 测试
|
#region 测试
|
||||||
//[Route("{path:regex([[a-zA-Z0-9-]])}/index.html")]
|
//[Route("c/{*path}/index2.html")]
|
||||||
//public IActionResult Test(string path = "")
|
//public IActionResult Test(string path = "")
|
||||||
//{
|
//{
|
||||||
// string tel = "13332835377";
|
// string tel = "13332835377";
|
||||||
|
|||||||
@@ -31,12 +31,13 @@
|
|||||||
<div class="menu-bg"></div>
|
<div class="menu-bg"></div>
|
||||||
<ul class="nav-list">
|
<ul class="nav-list">
|
||||||
<li id="nav_0"><a href="/" title="首页">首页</a><i></i></li>
|
<li id="nav_0"><a href="/" title="首页">首页</a><i></i></li>
|
||||||
<li id="nav_1"><a asp-controller="Article" asp-action="Index" asp-route-id="1" title="关于我们">关于我们</a><i></i></li>
|
|
||||||
<li id="nav_P"><a asp-controller="Product" asp-action="Index" asp-route-id="1" title="产品中心">产品中心</a><i></i></li>
|
<li id="nav_1"><a href="@ViewsHelper.EchoURL(Utils.CMSType.ArticleCategory,1)" title="关于我们">关于我们</a><i></i></li>
|
||||||
<li id="nav_2"><a asp-controller="Article" asp-action="Index" asp-route-id="2" title="新闻资讯">新闻资讯</a><i></i></li>
|
<li id="nav_P"><a href="@ViewsHelper.EchoURL(Utils.CMSType.ProductCategory,1)" title="产品中心">产品中心</a><i></i></li>
|
||||||
<li id="nav_3"><a asp-controller="Article" asp-action="Index" asp-route-id="3" title="项目案例">项目案例</a><i></i></li>
|
<li id="nav_2"><a href="@ViewsHelper.EchoURL(Utils.CMSType.ArticleCategory,2)" title="新闻资讯">新闻资讯</a><i></i></li>
|
||||||
<li id="nav_4"><a asp-controller="Article" asp-action="Index" asp-route-id="4" title="用户服务">用户服务</a><i></i></li>
|
<li id="nav_3"><a href="@ViewsHelper.EchoURL(Utils.CMSType.ArticleCategory,3)" title="项目案例">项目案例</a><i></i></li>
|
||||||
<li id="nav_5"><a asp-controller="Article" asp-action="Index" asp-route-id="5" title="联系我们">联系我们</a><i></i></li>
|
<li id="nav_4"><a href="@ViewsHelper.EchoURL(Utils.CMSType.ArticleCategory,4)" title="用户服务">用户服务</a><i></i></li>
|
||||||
|
<li id="nav_5"><a href="@ViewsHelper.EchoURL(Utils.CMSType.ArticleCategory,5)" title="联系我们">联系我们</a><i></i></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user