From 09b50b2733cd09da6de911aa44e4fe08689df4d6 Mon Sep 17 00:00:00 2001 From: 1099438829 <1099438829@qq.com> Date: Mon, 7 Jun 2021 00:15:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E9=83=A8=E5=88=86bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/controller/Article.php | 20 +- app/admin/view/article/add.html | 3 + app/admin/view/article/edit.html | 2 + public/template/default/pc/index/index.html | 511 +------------------- 4 files changed, 45 insertions(+), 491 deletions(-) diff --git a/app/admin/controller/Article.php b/app/admin/controller/Article.php index 6aa980e..e87d10b 100644 --- a/app/admin/controller/Article.php +++ b/app/admin/controller/Article.php @@ -114,8 +114,17 @@ class Article extends AuthController if (!$ainfo)return app("json")->fail("数据不存在"); aModel::where('id',$id)->save($data); if (!empty($content)){ - //更新文档 - DocumentArticle::where('id',$id)->save(['content'=>$content]); + $contentInfo = DocumentArticle::where('id',$id)->find(); + if (!$contentInfo){ + $updateData = [ + 'id' => $id, + 'content' => $content + ]; + DocumentArticle::insert($updateData); + }else{ + //更新文档 + DocumentArticle::where('id',$id)->save(['content'=>$content]); + } } } $res = true; @@ -184,7 +193,12 @@ class Article extends AuthController $category = cModel::systemPage($where); $category = get_tree_list($category); $info = aModel::get($where['id']); - $info->content = DocumentArticle::get($where['id'])->content; + $content = DocumentArticle::get($where['id']); + if ($content){ + $info->content = $content->content; + }else{ + $info->content = ''; + } $this->assign("category",$category); $this->assign("info",$info); return $this->fetch(); diff --git a/app/admin/view/article/add.html b/app/admin/view/article/add.html index 0ff0050..09a836d 100644 --- a/app/admin/view/article/add.html +++ b/app/admin/view/article/add.html @@ -216,6 +216,9 @@ $(".add-form").submit(function () { let Arr = $('.add-form').serializeArray(); let checkResult = true; + let content= tinyMCE.activeEditor.getContent(); + $("#content").val(content); + $.each(Arr,function (index,item) { try { switch (item.name) { diff --git a/app/admin/view/article/edit.html b/app/admin/view/article/edit.html index d07b335..465e2c9 100644 --- a/app/admin/view/article/edit.html +++ b/app/admin/view/article/edit.html @@ -230,6 +230,8 @@ $(".add-form").submit(function () { let Arr = $('.add-form').serializeArray(); let checkResult = true; + let content= tinyMCE.activeEditor.getContent(); + $("#content").val(content); $.each(Arr,function (index,item) { try { switch (item.name) { diff --git a/public/template/default/pc/index/index.html b/public/template/default/pc/index/index.html index c7fe02a..79f1775 100644 --- a/public/template/default/pc/index/index.html +++ b/public/template/default/pc/index/index.html @@ -21,8 +21,11 @@
@@ -713,7 +248,7 @@
-

近期热门

+

近期热门https://www.zyxpp.com/wp-admin/admin-ajax.php