更新伪静态文章栏目规则,生成伪静态页面分页代码
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label text-danger">文章标题:</label>
|
||||
<label class="col-sm-3 control-label">文章标题:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="Title" name="Title" maxlength="200" type="text" class="form-control" required aria-required="true" placeholder="填写文章标题">
|
||||
</div>
|
||||
@@ -33,7 +33,7 @@
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">静态化文件名:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="FileName" name="FileName" maxlength="200" type="text" class="form-control" required aria-required="true" placeholder="填写静态化文件名,大小写字母、数字和-,如:about.html,不能是index.html" value="">
|
||||
<input id="FileName" name="FileName" maxlength="200" type="text" class="form-control" aria-required="true" placeholder="填写静态化文件名,大小写字母、数字和-,如:about.html,不能是index.html" value="">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">栏目路径:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="FilePath" name="FilePath" maxlength="100" type="text" class="form-control" required aria-required="true" placeholder="填写栏目路径,SEO优化使用,最多支持4级目录,可以输入字母、数字和-">
|
||||
<input id="FilePath" name="FilePath" maxlength="100" type="text" class="form-control" aria-required="true" placeholder="填写栏目路径,SEO优化使用,最多支持4级目录,可以输入字母、数字和-">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
@@ -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") {
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">静态化文件名:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="FileName" name="FileName" maxlength="200" type="text" class="form-control" required aria-required="true" placeholder="填写静态化文件名,大小写字母、数字和-,如:about.html,不能是index.html" value="@Model.FileName">
|
||||
<input id="FileName" name="FileName" maxlength="200" type="text" class="form-control" aria-required="true" placeholder="填写静态化文件名,大小写字母、数字和-,如:about.html,不能是index.html" value="@Model.FileName">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">栏目路径:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="FilePath" name="FilePath" maxlength="100" type="text" class="form-control" required aria-required="true" value="@Model.FilePath" placeholder="填写栏目路径,SEO优化使用,最多支持4级目录,可以输入字母、数字和-">
|
||||
<input id="FilePath" name="FilePath" maxlength="100" type="text" class="form-control" aria-required="true" value="@Model.FilePath" placeholder="填写栏目路径,SEO优化使用,最多支持4级目录,可以输入字母、数字和-">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
@@ -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 });
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -38,13 +38,13 @@
|
||||
<script src="~/js/bootstrap-colorpicker/js/bootstrap-colorpicker.js"></script>
|
||||
</environment>
|
||||
<environment names="Staging,Production">
|
||||
<script src="https://ajax.aspnetcdn.com/ajax/jquery/jquery-2.2.0.min.js"
|
||||
<script src="https://cdn.staticfile.org/jquery/2.2.4/jquery.min.js"
|
||||
asp-fallback-src="~/lib/jquery/dist/jquery.min.js"
|
||||
asp-fallback-test="window.jQuery"
|
||||
crossorigin="anonymous"
|
||||
integrity="sha384-K+ctZQ+LL8q6tP7I94W+qzQsfRV2a+AfHIi9k8z8l9ggpc8X+Ytst4yBo/hH+8Fk">
|
||||
</script>
|
||||
<script src="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.7/bootstrap.min.js"
|
||||
<script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"
|
||||
asp-fallback-src="~/lib/bootstrap/dist/js/bootstrap.min.js"
|
||||
asp-fallback-test="window.jQuery && window.jQuery.fn && window.jQuery.fn.modal"
|
||||
crossorigin="anonymous"
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="MailKit" Version="2.6.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.1.3" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.2" />
|
||||
<PackageReference Include="MimeKit" Version="2.6.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.1.4" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.3" />
|
||||
<PackageReference Include="MimeKit" Version="2.7.0" />
|
||||
<PackageReference Include="MySql.Data" Version="8.0.20" />
|
||||
<PackageReference Include="NewLife.XCode" Version="9.17.2020.501" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||
@@ -16,7 +16,7 @@
|
||||
<PackageReference Include="Senparc.Weixin" Version="6.7.502" />
|
||||
<PackageReference Include="Senparc.Weixin.MP" Version="16.10.502" />
|
||||
<PackageReference Include="Senparc.Weixin.MP.MvcExtension" Version="4.1.1" />
|
||||
<PackageReference Include="Senparc.Weixin.TenPay" Version="1.5.502" />
|
||||
<PackageReference Include="Senparc.Weixin.TenPay" Version="1.5.502.1" />
|
||||
<PackageReference Include="Senparc.Weixin.WxOpen" Version="3.8.502" />
|
||||
<PackageReference Include="System.Data.SqlClient" Version="4.8.1" />
|
||||
<PackageReference Include="ZKWeb.System.Drawing" Version="4.0.1" />
|
||||
|
||||
@@ -95,6 +95,14 @@ namespace COMCMS.Web.Common
|
||||
Category pc = Category.FindById(id);
|
||||
url = EchoURL(pc);
|
||||
break;
|
||||
case Utils.CMSType.Article:
|
||||
Article a = Article.FindById(id);
|
||||
url = EchoURL(a);
|
||||
break;
|
||||
case Utils.CMSType.Product:
|
||||
Product p = Product.FindById(id);
|
||||
url = EchoURL(p);
|
||||
break;
|
||||
default:
|
||||
url= "/";
|
||||
break;
|
||||
@@ -126,7 +134,16 @@ namespace COMCMS.Web.Common
|
||||
}
|
||||
else
|
||||
return $"/article/detail/{model.Id}";
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 生成文章详情地址
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
/// <returns></returns>
|
||||
public static string EchoArticleURL(int id)
|
||||
{
|
||||
Article model = Article.FindById(id);
|
||||
return EchoArticleURL(model);
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -88,9 +88,9 @@
|
||||
<li>暂无相关记录...</li>
|
||||
}
|
||||
</ul>
|
||||
<!-- 分页按钮 -->
|
||||
<!-- 分页按钮 $"/Article/Index/{Model.Id}" + "?page={0}"-->
|
||||
<div class="normal">
|
||||
@Html.Raw(Pages.GetPageStr(ViewBag.pagesize, (int)ViewBag.totalCount, ViewBag.page, $"/Article/Index/{Model.Id}" + "?page={0}", 99, 10, ""))
|
||||
@Html.Raw(Pages.GetPageStr(ViewBag.pagesize, (int)ViewBag.totalCount, ViewBag.page, ViewsHelper.EchoURL(Model), 3, 10, ""))
|
||||
</div>
|
||||
<!-- 点击加载更多 -->
|
||||
</div>
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
@foreach (var item in productCategories)
|
||||
{
|
||||
<url>
|
||||
<loc>@(url)@(ViewsHelper.EchoURL(item)))</loc>
|
||||
<loc>@(url)@(ViewsHelper.EchoURL(item))</loc>
|
||||
<priority>0.80</priority>
|
||||
<lastmod>@(lastmod)</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
@@ -39,7 +39,7 @@
|
||||
@foreach (var item in articles)
|
||||
{
|
||||
<url>
|
||||
<loc>@(url)@(ViewsHelper.EchoURL(item)))</loc>
|
||||
<loc>@(url)@(ViewsHelper.EchoURL(item))</loc>
|
||||
<priority>0.80</priority>
|
||||
<lastmod>@(lastmod)</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
@@ -48,7 +48,7 @@
|
||||
@foreach (var item in products)
|
||||
{
|
||||
<url>
|
||||
<loc>@(url)@(ViewsHelper.EchoURL(item)))</loc>
|
||||
<loc>@(url)@(ViewsHelper.EchoURL(item))</loc>
|
||||
<priority>0.80</priority>
|
||||
<lastmod>@(lastmod)</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
|
||||
@@ -13,11 +13,11 @@
|
||||
"SignSalt": "comcms"
|
||||
},
|
||||
"connectionStrings": {
|
||||
"mssqlconnon": {
|
||||
"dbconn": {
|
||||
"connectionString": "Server=.;Port=3306;Database=comcms;Uid=root;Pwd=root;SslMode=None;charset=utf8mb4",
|
||||
"providerName": "MySql.Data.MySqlClient"
|
||||
},
|
||||
"dbconn": {
|
||||
"mssqlconnon": {
|
||||
"connectionString": "server=.;database=comcmscore;uid=sa;pwd=123456",
|
||||
"providerName": "System.Data.SqlClient"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user