diff --git a/COMCMS.API/COMCMS.API.csproj b/COMCMS.API/COMCMS.API.csproj index 57f6c52..1f840f8 100644 --- a/COMCMS.API/COMCMS.API.csproj +++ b/COMCMS.API/COMCMS.API.csproj @@ -5,9 +5,9 @@ - - - + + + diff --git a/COMCMS.Common/COMCMS.Common.csproj b/COMCMS.Common/COMCMS.Common.csproj index 1767c84..dc219a0 100644 --- a/COMCMS.Common/COMCMS.Common.csproj +++ b/COMCMS.Common/COMCMS.Common.csproj @@ -6,7 +6,7 @@ - + diff --git a/COMCMS.Common/Pages.cs b/COMCMS.Common/Pages.cs index 0e5f005..bebcf31 100644 --- a/COMCMS.Common/Pages.cs +++ b/COMCMS.Common/Pages.cs @@ -43,17 +43,11 @@ namespace COMCMS.Common pageLink = url + "?" + strQueryString; string currPage = MyHttpContext.Current.Request.Query["page"]; string id = MyHttpContext.Current.Request.Query["id"]; + if (isRewrite == 5) { url = $"/{filepath}/index.html"; } - if (url == "memberdownloads.aspx" && isRewrite == 2) - { - string t = MyHttpContext.Current.Request.Query["t"]; - if (string.IsNullOrEmpty(t) || !Utils.IsInt(t)) - t = "1"; - url = string.Format("memberdownloads-{0}.aspx", t); - } switch (isRewrite) { @@ -71,8 +65,15 @@ namespace COMCMS.Common pageLink = url.Replace(".", "-{0}."); break; case 3: - url = url.Replace(".aspx", ".html");//避免设置错之后出现问题 - pageLink = url.Replace(".", "-{0}."); + if(url.EndsWith(".html") || url.EndsWith(".aspx")) + { + url = url.Replace(".aspx", ".html");//避免设置错之后出现问题 + pageLink = url.Replace(".", "-{0}."); + } + else + { + pageLink = url + "?page={0}"; + } break; case 5: pageLink = url.Replace(".", "-{0}."); diff --git a/COMCMS.Core/COMCMS.Core.csproj b/COMCMS.Core/COMCMS.Core.csproj index fcbd11a..31cd277 100644 --- a/COMCMS.Core/COMCMS.Core.csproj +++ b/COMCMS.Core/COMCMS.Core.csproj @@ -5,7 +5,7 @@ - + diff --git a/COMCMS.Web/Areas/AdminCP/Controllers/ArticleController.cs b/COMCMS.Web/Areas/AdminCP/Controllers/ArticleController.cs index 3b76cbf..9d66dbf 100644 --- a/COMCMS.Web/Areas/AdminCP/Controllers/ArticleController.cs +++ b/COMCMS.Web/Areas/AdminCP/Controllers/ArticleController.cs @@ -69,29 +69,28 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers tip.Message = "文章栏目标题不能为空!"; return Json(tip); } - if (string.IsNullOrEmpty(model.FilePath)) + + if (!string.IsNullOrEmpty(model.FilePath)) { - tip.Message = "文章栏目路径不能为空!"; - return Json(tip); + if (!model.FilePath.StartsWith("/")) + { + tip.Message = "栏目路径请以/开头!"; + return Json(tip); + } + if (model.FilePath.EndsWith("/")) + { + tip.Message = "栏目路径结尾不用加上/"; + return Json(tip); + } + + if (model.FilePath.Count(x => x == '/') > 4) + { + tip.Message = "最多只能四级路径!"; + return Json(tip); + } } - if (!model.FilePath.StartsWith("/")) - { - tip.Message = "栏目路径请以/开头!"; - return Json(tip); - } - if (model.FilePath.EndsWith("/")) - { - tip.Message = "栏目路径结尾不用加上/"; - return Json(tip); - } - if (model.FilePath.Count(x => x == '/') > 4) - { - tip.Message = "最多只能四级路径!"; - return Json(tip); - } - - if (!AdminUtils.CheckFilePathIsOK(model.FilePath, 0, 0)) + if (!string.IsNullOrEmpty(model.FilePath) && !AdminUtils.CheckFilePathIsOK(model.FilePath, 0, 0)) { tip.Message = "栏目路径不可用,请重新填写!"; return Json(tip); @@ -163,27 +162,29 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers Json(tip); } - if (string.IsNullOrEmpty(model.FilePath)) + if (!string.IsNullOrEmpty(model.FilePath)) { - tip.Message = "文章栏目路径不能为空!"; - return Json(tip); + if (!model.FilePath.StartsWith("/")) + { + tip.Message = "栏目路径请以/开头!"; + return Json(tip); + } + if (model.FilePath.EndsWith("/")) + { + tip.Message = "栏目路径结尾不用加上/"; + return Json(tip); + } + + if (model.FilePath.Count(x => x == '/') > 4) + { + tip.Message = "最多只能四级路径!"; + return Json(tip); + } } - if (!model.FilePath.StartsWith("/")) - { - tip.Message = "栏目路径请以/开头!"; - return Json(tip); - } - if (model.FilePath.EndsWith("/")) - { - tip.Message = "栏目路径结尾不用加上/"; - return Json(tip); - } - if (model.FilePath.Count(x => x == '/') > 4) - { - tip.Message = "最多只能四级路径!"; - return Json(tip); - } - if (!AdminUtils.CheckFilePathIsOK(model.FilePath, entity.Id, 0)) + + + + if (!string.IsNullOrEmpty(model.FilePath) && !AdminUtils.CheckFilePathIsOK(model.FilePath, entity.Id, 0)) { tip.Message = "栏目路径不可用,请重新填写!"; return Json(tip); diff --git a/COMCMS.Web/Areas/AdminCP/Controllers/ServerController.cs b/COMCMS.Web/Areas/AdminCP/Controllers/ServerController.cs index 9d772c4..c2bbcf3 100644 --- a/COMCMS.Web/Areas/AdminCP/Controllers/ServerController.cs +++ b/COMCMS.Web/Areas/AdminCP/Controllers/ServerController.cs @@ -16,13 +16,24 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers public class ServerController : AdminBaseController { #region 中文转拼音 - public IActionResult Hanzi2Pinyin(string name) + [HttpPost] + public IActionResult Hanzi2Pinyin(string name,int pid=0,string t="") { - string pinyin = ""; + string pinyin = "/"; + if(t == "articlecategory" && pid>0) + { + ArticleCategory pcategory = ArticleCategory.FindById(pid); + if(pcategory !=null && !string.IsNullOrEmpty(pcategory.FilePath)) + { + pinyin = pcategory.FilePath+"/"; + } + } + if (!string.IsNullOrEmpty(name)) { - pinyin = PinYinHelper.GetPinyin(name).ToLower().Replace(" ","-"); + pinyin += PinYinHelper.GetPinyin(name).ToLower().Replace(" ","-"); } + tip.Status = JsonTip.SUCCESS; tip.Message = pinyin; return Json(tip); diff --git a/COMCMS.Web/Areas/AdminCP/Views/Article/AddArticle.cshtml b/COMCMS.Web/Areas/AdminCP/Views/Article/AddArticle.cshtml index 46dc4a2..b0de8c6 100644 --- a/COMCMS.Web/Areas/AdminCP/Views/Article/AddArticle.cshtml +++ b/COMCMS.Web/Areas/AdminCP/Views/Article/AddArticle.cshtml @@ -25,7 +25,7 @@
- +
@@ -33,7 +33,7 @@
- +
diff --git a/COMCMS.Web/Areas/AdminCP/Views/Article/AddArticleCategory.cshtml b/COMCMS.Web/Areas/AdminCP/Views/Article/AddArticleCategory.cshtml index 25e12e9..cd02c46 100644 --- a/COMCMS.Web/Areas/AdminCP/Views/Article/AddArticleCategory.cshtml +++ b/COMCMS.Web/Areas/AdminCP/Views/Article/AddArticleCategory.cshtml @@ -34,7 +34,7 @@
- +
@@ -163,11 +163,12 @@ 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}, + url: "/AdminCP/Server/Hanzi2Pinyin", + data: { name: title, pid: pid,t:"articlecategory" }, dataType: "JSON", success: function (data) { if (data.status == "success") { diff --git a/COMCMS.Web/Areas/AdminCP/Views/Article/EditArticle.cshtml b/COMCMS.Web/Areas/AdminCP/Views/Article/EditArticle.cshtml index eec1bdf..388a0fe 100644 --- a/COMCMS.Web/Areas/AdminCP/Views/Article/EditArticle.cshtml +++ b/COMCMS.Web/Areas/AdminCP/Views/Article/EditArticle.cshtml @@ -32,7 +32,7 @@
- +
diff --git a/COMCMS.Web/Areas/AdminCP/Views/Article/EditArticleCategory.cshtml b/COMCMS.Web/Areas/AdminCP/Views/Article/EditArticleCategory.cshtml index fff93ca..738c952 100644 --- a/COMCMS.Web/Areas/AdminCP/Views/Article/EditArticleCategory.cshtml +++ b/COMCMS.Web/Areas/AdminCP/Views/Article/EditArticleCategory.cshtml @@ -34,7 +34,7 @@
- +
@@ -168,25 +168,26 @@ 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}, - dataType: "JSON", - success: function (data) { - if (data.status == "success") { - if (data.message) { - $("#FilePath").val(data.message); + type: "POST", + url: "/AdminCP/Server/Hanzi2Pinyin", + data: { name: title, pid: pid, t: "articlecategory" }, + dataType: "JSON", + success: function (data) { + if (data.status == "success") { + if (data.message) { + $("#FilePath").val(data.message); + } + } else { + layer.alert(data.message, { icon: 2 }); } - } else { - layer.alert(data.message, { icon: 2 }); + }, + error: function () { + layer.alert('执行错误,请联系管理员!', { icon: 2 }); } - }, - error: function () { - layer.alert('执行错误,请联系管理员!', { icon: 2 }); - } - }); + }); } } \ No newline at end of file diff --git a/COMCMS.Web/Areas/AdminCP/Views/Shared/_CommonLayout.cshtml b/COMCMS.Web/Areas/AdminCP/Views/Shared/_CommonLayout.cshtml index 5a53f34..16fd962 100644 --- a/COMCMS.Web/Areas/AdminCP/Views/Shared/_CommonLayout.cshtml +++ b/COMCMS.Web/Areas/AdminCP/Views/Shared/_CommonLayout.cshtml @@ -38,13 +38,13 @@ - -