@@ -162,4 +174,29 @@
DoPost("editCategoryForm");
CKEDITOR.replace('KindInfo');
})
+ function aoutoTransform() {
+ var title = $("#KindName").val();
+ var filePath = $("#FilePath").val();
+ var pid = $("#PId").val();
+ if (!filePath) {
+ $.ajax({
+ type: "POST",
+ url: "/AdminCP/Server/Hanzi2Pinyin",
+ data: { name: title, pid: pid, t: "category" },
+ dataType: "JSON",
+ success: function (data) {
+ if (data.status == "success") {
+ if (data.message) {
+ $("#FilePath").val(data.message);
+ }
+ } else {
+ layer.alert(data.message, { icon: 2 });
+ }
+ },
+ error: function () {
+ layer.alert('执行错误,请联系管理员!', { icon: 2 });
+ }
+ });
+ }
+ }
\ No newline at end of file
diff --git a/COMCMS.Web/Areas/AdminCP/Views/Product/ProductList.cshtml b/COMCMS.Web/Areas/AdminCP/Views/Product/ProductList.cshtml
index 1c6af90..48a733a 100644
--- a/COMCMS.Web/Areas/AdminCP/Views/Product/ProductList.cshtml
+++ b/COMCMS.Web/Areas/AdminCP/Views/Product/ProductList.cshtml
@@ -135,7 +135,10 @@
title: '所属分类'
}, {
field: 'Title',
- title: '商品标题',
+ title: '商品标题',
+ formatter: function (value, row, index) {
+ return '
' + value + ''
+ }
}, {
field: 'Price',
diff --git a/COMCMS.Web/Common/AdminUtils.cs b/COMCMS.Web/Common/AdminUtils.cs
index 07704cc..bb14c2e 100644
--- a/COMCMS.Web/Common/AdminUtils.cs
+++ b/COMCMS.Web/Common/AdminUtils.cs
@@ -81,13 +81,13 @@ namespace COMCMS.Web.Common
return false;
}
}
- else if(typeid == 1)
+ else if(typeid == 1)//商品
{
- if (ArticleCategory.FindCount(ArticleCategory._.FilePath == pathname , null, null, 0, 0) > 0)
+ if (Category.FindCount(Category._.FilePath == pathname & Category._.Id != kid, null, null, 0, 0) > 0)
{
return false;
}
- if (Category.FindCount(Category._.FilePath == pathname & Category._.Id != kid, null, null, 0, 0) > 0)
+ if (ArticleCategory.FindCount(ArticleCategory._.FilePath == pathname, null, null, 0, 0) > 0)
{
return false;
}
diff --git a/COMCMS.Web/Controllers/ProductController.cs b/COMCMS.Web/Controllers/ProductController.cs
index e86991a..0f860c3 100644
--- a/COMCMS.Web/Controllers/ProductController.cs
+++ b/COMCMS.Web/Controllers/ProductController.cs
@@ -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
}
diff --git a/COMCMS.Web/Views/Home/Index.cshtml b/COMCMS.Web/Views/Home/Index.cshtml
index 81f7567..235633b 100644
--- a/COMCMS.Web/Views/Home/Index.cshtml
+++ b/COMCMS.Web/Views/Home/Index.cshtml
@@ -177,7 +177,7 @@
@@ -186,7 +186,7 @@
@(Utils.CutString(Utils.NoHTML(about?.Content), 700))
-
查看详情
+
查看详情
@@ -210,7 +210,7 @@
@foreach(var p in listPorducts)
{