From 69c3133e4cedd121400ba605e374aa1b62cc9404 Mon Sep 17 00:00:00 2001 From: "DESKTOP-CLI22EN\\HogenWang" Date: Sun, 2 Dec 2018 01:20:33 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- COMCMS.Web/Controllers/ServerController.cs | 57 + COMCMS.Web/Startup.cs | 2 +- .../Views/Article/Detail_Contact.cshtml | 8 +- .../Views/Article/Index_Guestbook.cshtml | 66 + COMCMS.Web/Views/Shared/_Layout.cshtml | 12 +- COMCMS.Web/wwwroot/images/default/bg_50.png | Bin 0 -> 302209 bytes COMCMS.Web/wwwroot/images/default/bg_66.png | Bin 0 -> 370198 bytes COMCMS.Web/wwwroot/images/default/style.css | 4178 ++++++++++++++--- COMCMS.Web/wwwroot/js/public.js | 115 +- 9 files changed, 3830 insertions(+), 608 deletions(-) create mode 100644 COMCMS.Web/Controllers/ServerController.cs create mode 100644 COMCMS.Web/Views/Article/Index_Guestbook.cshtml create mode 100644 COMCMS.Web/wwwroot/images/default/bg_50.png create mode 100644 COMCMS.Web/wwwroot/images/default/bg_66.png diff --git a/COMCMS.Web/Controllers/ServerController.cs b/COMCMS.Web/Controllers/ServerController.cs new file mode 100644 index 0000000..fb27c5c --- /dev/null +++ b/COMCMS.Web/Controllers/ServerController.cs @@ -0,0 +1,57 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; +using COMCMS.Common; +using COMCMS.Core; +using COMCMS.Core.Models; +using COMCMS.Web.Common; +using XCode; + +namespace COMCMS.Web.Controllers +{ + /// + /// 服务端处理 + /// + public class ServerController : HomeBaseController + { + #region 提交前台底部留言 + [HttpPost] + [AutoValidateAntiforgeryToken] + public IActionResult DoPostMessage(string name,string phone,string content) + { + if (string.IsNullOrWhiteSpace(name)) + { + tip.Message = "请填写您的姓名!"; + return Json(tip); + } + if (!Utils.IsTel(phone)) + { + tip.Message = "请填写正确的手机号码!"; + return Json(tip); + } + if (string.IsNullOrWhiteSpace(content)) + { + tip.Message = "请填写您的留言内容!"; + return Json(tip); + } + + Guestbook entity = new Guestbook() + { + AddTime = DateTime.Now, + IP = Utils.GetIP(), + KId = 1, + Nickname = name, + Content = Utils.NoHTML(content), + Tel = phone + }; + entity.Insert(); + + tip.Message = "留言成功,感谢您的留言!"; + tip.Status = JsonTip.SUCCESS; + return Json(tip); + } + #endregion + } +} \ No newline at end of file diff --git a/COMCMS.Web/Startup.cs b/COMCMS.Web/Startup.cs index 4451f8d..9b7dbb1 100644 --- a/COMCMS.Web/Startup.cs +++ b/COMCMS.Web/Startup.cs @@ -103,7 +103,7 @@ namespace COMCMS.Web { app.Use(async (context, next) => { - context.Response.Headers.Add("X-Frame-Options", "SAMEORIGIN"); + //context.Response.Headers.Add("X-Frame-Options", "SAMEORIGIN"); await next(); }); diff --git a/COMCMS.Web/Views/Article/Detail_Contact.cshtml b/COMCMS.Web/Views/Article/Detail_Contact.cshtml index d9716c8..9f65201 100644 --- a/COMCMS.Web/Views/Article/Detail_Contact.cshtml +++ b/COMCMS.Web/Views/Article/Detail_Contact.cshtml @@ -5,7 +5,8 @@ ViewBag.description = Model.Description; IList
alist = Article.FindAll(Article._.KId == Model.KId, Article._.Sequence.Asc(), null, 0, 0); int topkid = ViewBag.kind.PId > 0 ? ViewBag.kind.PId : ViewBag.kind.Id; - + //获取同级分类 + IList sameList = ArticleCategory.FindAll(ArticleCategory._.PId == ViewBag.kind.PId, ArticleCategory._.Rank.Asc(), null, 0, 0); }