diff --git a/COMCMS.Web/Areas/AdminCP/Controllers/PermissionController.cs b/COMCMS.Web/Areas/AdminCP/Controllers/PermissionController.cs index 536d6d7..1dc3afe 100644 --- a/COMCMS.Web/Areas/AdminCP/Controllers/PermissionController.cs +++ b/COMCMS.Web/Areas/AdminCP/Controllers/PermissionController.cs @@ -115,6 +115,85 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers return Json(tip); } + + #region 编辑事件详情 + [HttpGet] + [MyAuthorize("add", "eventkey")] + public IActionResult EditEventKey(int id) + { + TargetEvent entity = TargetEvent.Find(TargetEvent._.Id == id); + if (entity == null) + { + return EchoTipPage("系统找不到本记录!"); + } + Admin.WriteLogActions("查看/编辑事件详情(id:" + entity.Id + ");"); + return View(entity); + } + + [HttpPost] + [MyAuthorize("add", "eventkey","JSON")] + public IActionResult EditEventKey(TargetEvent model) + { + if (string.IsNullOrWhiteSpace(model.EventKey)) + { + tip.Message = "请填写事件KEY"; + return Json(tip); + } + if (string.IsNullOrWhiteSpace(model.EventName)) + { + tip.Message = "请填写事件名称"; + return Json(tip); + } + TargetEvent entity = TargetEvent.Find(TargetEvent._.Id == model.Id); + if (entity == null) + { + tip.Message = "系统找不到本记录!"; + return Json(tip); + } + if (entity.EventKey != model.EventKey) + { + if (TargetEvent.FindCount(TargetEvent._.EventKey == model.EventKey, null, null, 0, 0) > 0) + { + tip.Message = "事件key已经存在,请重新填写一个"; + return Json(tip); + } + } + entity.EventKey = model.EventKey; + entity.EventName = model.EventName; + entity.Rank = model.Rank; + if (string.IsNullOrWhiteSpace(Request.Form["IsDisable"]) || Request.Form["IsDisable"] != "1") + entity.IsDisable = 0; + else + entity.IsDisable = 1; + entity.Update(); + Admin.WriteLogActions("编辑事件详情(id:" + entity.Id + ");"); + tip.Status = JsonTip.SUCCESS; + tip.Message = "编辑事件权限详情成功"; + tip.ReturnUrl = "close"; + return Json(tip); + } + #endregion + + #region 删除事件权限 + [HttpPost] + [MyAuthorize("del", "eventkey", "JSON")] + public JsonResult DelEventKey(int id) + { + TargetEvent entity = TargetEvent.Find(TargetEvent._.Id == id); + if (entity == null) + { + tip.Message = "系统找不到本记录!"; + return Json(tip); + } + Admin.WriteLogActions("删除事件详情(" + JsonConvert.SerializeObject(entity) + ");"); + entity.Delete(); + tip.Status = JsonTip.SUCCESS; + tip.Message = "删除事件权限详情成功"; + return Json(tip); + } + + #endregion + #endregion #region 后台栏目管理 diff --git a/COMCMS.Web/Areas/AdminCP/Views/Index/Index.cshtml b/COMCMS.Web/Areas/AdminCP/Views/Index/Index.cshtml index 6599029..922d8b3 100644 --- a/COMCMS.Web/Areas/AdminCP/Views/Index/Index.cshtml +++ b/COMCMS.Web/Areas/AdminCP/Views/Index/Index.cshtml @@ -78,7 +78,7 @@ { var l2 = Model.FindAll(s => s.PId == m1.Id && s.IsHide != 1);
  • - + @if (!string.IsNullOrWhiteSpace(m1.ClassName)) { diff --git a/COMCMS.Web/Areas/AdminCP/Views/Permission/AddEventKey.cshtml b/COMCMS.Web/Areas/AdminCP/Views/Permission/AddEventKey.cshtml index c81b1f9..a6eac91 100644 --- a/COMCMS.Web/Areas/AdminCP/Views/Permission/AddEventKey.cshtml +++ b/COMCMS.Web/Areas/AdminCP/Views/Permission/AddEventKey.cshtml @@ -33,7 +33,7 @@
    -
    diff --git a/COMCMS.Web/Areas/AdminCP/Views/Permission/EditEventKey.cshtml b/COMCMS.Web/Areas/AdminCP/Views/Permission/EditEventKey.cshtml new file mode 100644 index 0000000..bdeb23e --- /dev/null +++ b/COMCMS.Web/Areas/AdminCP/Views/Permission/EditEventKey.cshtml @@ -0,0 +1,56 @@ +@model TargetEvent +@{ + ViewBag.title = "查看/编辑权限事件"; +} + +
    +
    +
    +
    @(ViewBag.title)
    +
    +
    +
    +
    + @using (Html.BeginForm(null, null, FormMethod.Post, new { id = "editEventKeyForm", @class = "form-horizontal m-t" })) + { +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    +
    + + +
    +
    + } +
    +
    +
    + \ No newline at end of file diff --git a/COMCMS.Web/Areas/AdminCP/Views/Permission/EventKey.cshtml b/COMCMS.Web/Areas/AdminCP/Views/Permission/EventKey.cshtml index 9b560c9..701bb66 100644 --- a/COMCMS.Web/Areas/AdminCP/Views/Permission/EventKey.cshtml +++ b/COMCMS.Web/Areas/AdminCP/Views/Permission/EventKey.cshtml @@ -68,8 +68,6 @@ cardView: false, //是否显示详细视图 detailView: false, //是否显示父子表 columns: [{ - checkbox: true - }, { field: 'EventName', title: '事件名称' }, { @@ -80,8 +78,22 @@ title: '排序' }, { field: 'IsDisable', - title: '是否禁用' - }, ] + title: '是否禁用', + formatter: function (value, row, index) { + if (value == 0) { + return '启用'; + } else { + return '禁用'; + } + } + }, + { + field: 'Id', + title: '操作', + formatter: 'actionFormatter', + width: 140 + } + ] }); }; @@ -96,7 +108,12 @@ }; return oTableInit; }; - + function actionFormatter(value, row, index) { + return [ + '
    编辑', + ' 删除', + ].join(''); + } var ButtonInit = function () { var oInit = new Object(); diff --git a/README.md b/README.md index 6d02615..9f6c250 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,10 @@ # COMCMS_NETCORE COMCMS NETCORE版本,一个简单的CMS后台管理系统,带前台演示。 -主要是演示了.net core 一个系统后台如何搭建。前台如何使用。可以简单的完成一个企业站。通过二次开发,可以支持商城系统、小程序、app服务器端等... +主要是演示了.net 8 一个系统后台如何搭建。前台如何使用。可以简单的完成一个企业站。通过二次开发,可以支持商城系统、小程序、app服务器端等... ### 更新日志 +- 2024-06-26 升级到.net 8 调整后台UI,精简js插件 - 2022-11-23 升级到.net 7 和使用SkiaSharp 替换掉System.Drawing - 2021-02-02 升级组件,删除ZKWeb组件,增加文章Tag标签 - 2020-12-02 升级到.net5;增加文章栏目、商品分类快速修改排序;增加jwt授权登录