增加文章栏目伪静态规则1
This commit is contained in:
@@ -71,7 +71,7 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
return Json(tip);
|
||||
}
|
||||
|
||||
if (!model.FilePath.StartsWith("/"))
|
||||
if (model.FilePath.StartsWith("/"))
|
||||
{
|
||||
tip.Message = "栏目路径请以/开头!";
|
||||
return Json(tip);
|
||||
@@ -165,7 +165,7 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
tip.Message = "栏目路径请以/开头!";
|
||||
return Json(tip);
|
||||
}
|
||||
if (!model.FilePath.EndsWith("/"))
|
||||
if (model.FilePath.EndsWith("/"))
|
||||
{
|
||||
tip.Message = "栏目路径结尾不用加上/";
|
||||
return Json(tip);
|
||||
@@ -203,6 +203,7 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
alist.Save();
|
||||
}
|
||||
}
|
||||
bool idNeedUpdateAllArticleFilePath = entity.FilePath == model.FilePath;
|
||||
//赋值
|
||||
entity.PId = model.PId;
|
||||
entity.KindName = model.KindName;
|
||||
@@ -225,10 +226,23 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
entity.KindDomain = model.KindDomain;
|
||||
entity.Rank = model.Rank;
|
||||
entity.Pic = model.Pic;
|
||||
model.FilePath = model.FilePath;
|
||||
entity.FilePath = model.FilePath;
|
||||
|
||||
|
||||
entity.Save();
|
||||
//修改所有文章的路径
|
||||
if (idNeedUpdateAllArticleFilePath)
|
||||
{
|
||||
IList<Article> listArticles = Article.FindAll(Article._.KId == entity.Id, null, null, 0, 0);
|
||||
if(listArticles !=null && listArticles.Count > 0)
|
||||
{
|
||||
foreach (var item in listArticles)
|
||||
{
|
||||
item.FilePath = entity.FilePath;
|
||||
}
|
||||
listArticles.BatchUpdate();
|
||||
}
|
||||
}
|
||||
Core.Admin.WriteLogActions("修改文章栏目(id:" + entity.Id + ");");
|
||||
tip.Status = JsonTip.SUCCESS;
|
||||
tip.Message = "修改文章栏目成功";
|
||||
|
||||
@@ -28,7 +28,13 @@
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">栏目名称:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="KindName" name="KindName" maxlength="200" type="text" class="form-control" value="@Model.KindName" required aria-required="true" placeholder="填写栏目名称">
|
||||
<input id="KindName" name="KindName" maxlength="200" type="text" class="form-control" value="@Model.KindName" required aria-required="true" placeholder="填写栏目名称" onblur="aoutoTransform()">
|
||||
</div>
|
||||
</div>
|
||||
<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级目录,可以输入字母、数字和-">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
@@ -37,12 +43,7 @@
|
||||
<input id="SubTitle" type="text" class="form-control" name="SubTitle" placeholder="栏目副标题,非必填" value="@Model.SubTitle" maxlength="200">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" style="display:none">
|
||||
<label class="col-sm-3 control-label">栏目优化名称:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="KindDomain" name="KindDomain" maxlength="200" type="text" class="form-control" value="@Model.KindDomain" aria-required="true" placeholder="栏目优化名称,请填写英文或数字或-">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">Banner图片:</label>
|
||||
<div class="col-sm-8">
|
||||
@@ -163,5 +164,29 @@
|
||||
$(".upload-img").InitUploader({ filesize: "10240", sendurl: "/AdminCP/Upload/DoWebuploaderImage", swf: "/js/webuploader/uploader.swf", filetypes: "gif,jpg,png,bmp", notwater: true });
|
||||
DoPost("editArticleKindForm");
|
||||
CKEDITOR.replace('KindInfo');
|
||||
})
|
||||
});
|
||||
function aoutoTransform() {
|
||||
var title = $("#KindName").val();
|
||||
var filePath = $("#FilePath").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);
|
||||
}
|
||||
} else {
|
||||
layer.alert(data.message, { icon: 2 });
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
layer.alert('执行错误,请联系管理员!', { icon: 2 });
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user