diff --git a/app/admin/controller/Article.php b/app/admin/controller/Article.php index 702fb84..c0256ac 100644 --- a/app/admin/controller/Article.php +++ b/app/admin/controller/Article.php @@ -86,8 +86,8 @@ class Article extends AuthController $data['uid'] = $this->adminId; if (!empty($data['content'])){ $content = $data['content']; - unset($data['content']); } + unset($data['content']); if ($data['is_recommend']) $data['is_recommend'] = 1; if ($data['is_hot']) $data['is_hot'] = 1; if ($data['display']) $data['display'] = 1; @@ -110,6 +110,7 @@ class Article extends AuthController $ainfo = aModel::get($id); if (!$ainfo)return app("json")->fail("数据不存在"); $res = aModel::where('id',$id)->save($data); + if (!empty($content)){ //更新文档 $res = DocumentArticle::where('id',$id)->save(['content'=>$content]); @@ -166,9 +167,10 @@ class Article extends AuthController ]; $category = cModel::systemPage($where); $category = get_tree_list($category); + $info = aModel::get($request->param(['id'])); + $info->content = DocumentArticle::get($request->param(['id']))->content; $this->assign("category",$category); - $this->assign("info",aModel::get($request->param(['id']))); + $this->assign("info",$info); return $this->fetch(); - } } \ No newline at end of file diff --git a/app/admin/view/article/add.html b/app/admin/view/article/add.html index d966f06..33642eb 100644 --- a/app/admin/view/article/add.html +++ b/app/admin/view/article/add.html @@ -246,7 +246,7 @@ return false; } $.post(url="/admin/article/save",$('.add-form').serialize(),function (res) { - if (res.code == 200) {lightyear.notify(res.msg, 'success', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');setTimeout(function () {parent.location.reload()},2000)} + if (res.code == 200) {lightyear.notify(res.msg, 'success', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');setTimeout(function () {location.href='/admin/article/index';},2000)} else lightyear.notify(res.msg, 'danger', 3000, 'mdi mdi-emoticon-happy', 'top', 'center'); }); return true; diff --git a/app/admin/view/article/edit.html b/app/admin/view/article/edit.html index 202bd8b..f9e989e 100644 --- a/app/admin/view/article/edit.html +++ b/app/admin/view/article/edit.html @@ -28,6 +28,7 @@
+
@@ -49,13 +50,26 @@
    - -
  • - - + {notempty name="info.cover_path"} +
  • + {$info.cover_path|basename} +
    + +
    +
  • + + {else /} + +
  • + + + +
  • + {/notempty}
@@ -246,7 +260,7 @@ return false; } $.post(url="/admin/article/save",$('.add-form').serialize(),function (res) { - if (res.code == 200) {lightyear.notify(res.msg, 'success', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');setTimeout(function () {parent.location.reload()},2000)} + if (res.code == 200) {lightyear.notify(res.msg, 'success', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');setTimeout(function () {location.href='/admin/article/index';},2000)} else lightyear.notify(res.msg, 'danger', 3000, 'mdi mdi-emoticon-happy', 'top', 'center'); }); return true;