{$post.desc}
+diff --git a/app/index/controller/Category.php b/app/index/controller/Category.php
index 57fdaad..079d3f5 100644
--- a/app/index/controller/Category.php
+++ b/app/index/controller/Category.php
@@ -51,10 +51,10 @@ class Category extends Common
//
$model_category = ModelCategory::with('posts.post')->find($id);
-
+
$this->assign('category',$model_category);
- return $this->fetch('read'.$model_category->tpl_name);
+ return $this->fetch('read'.$model_category->getData('tpl_name'));
}
/**
diff --git a/app/index/controller/Post.php b/app/index/controller/Post.php
new file mode 100644
index 0000000..ce4b7ba
--- /dev/null
+++ b/app/index/controller/Post.php
@@ -0,0 +1,93 @@
+assign('post', $model_post);
+
+ return $this->fetch();
+ }
+
+ /**
+ * 显示编辑资源表单页.
+ *
+ * @param int $id
+ * @return \think\Response
+ */
+ public function edit($id)
+ {
+ //
+ }
+
+ /**
+ * 保存更新的资源
+ *
+ * @param \think\Request $request
+ * @param int $id
+ * @return \think\Response
+ */
+ public function update(Request $request, $id)
+ {
+ //
+ }
+
+ /**
+ * 删除指定资源
+ *
+ * @param int $id
+ * @return \think\Response
+ */
+ public function delete($id)
+ {
+ //
+ }
+}
diff --git a/app/model/Category.php b/app/model/Category.php
index e2e4341..4f01d6c 100644
--- a/app/model/Category.php
+++ b/app/model/Category.php
@@ -4,6 +4,7 @@ declare(strict_types=1);
namespace app\model;
+use think\facade\Config;
use think\Model;
/**
@@ -64,4 +65,40 @@ class Category extends Model
return $list_post;
}
+ public function getTplNameAttr($value)
+ {
+ return Config::get('view_type.category.'.$value);
+ }
+
+ public function getModelParentAttr()
+ {
+ $pid = $this->getData('pid');
+
+ if($pid == 0){
+ return $this;
+ }
+ return Category::where('id',$pid)->find();
+ }
+
+ // 返回除自身以外的其他的同级同类的分类
+ public function getModelSiblingsAttr()
+ {
+ return Category::where('pid',$this->getData('pid'))
+ ->where('level',$this->getData('level'))
+ ->where('id','<>',$this->getData('id'))
+ ->select();
+ }
+
+ /**
+ * 获取同一个父元素的分类,包含自身
+ *
+ * @return void
+ */
+ public function getModelSameParentAttr()
+ {
+ return Category::where('pid',$this->getData('pid'))
+ ->where('level',$this->getData('level'))
+ ->select();
+ }
+
}
diff --git a/app/model/Post.php b/app/model/Post.php
index 8499871..c5cb9fb 100644
--- a/app/model/Post.php
+++ b/app/model/Post.php
@@ -33,6 +33,18 @@ class Post extends Model
return $this->hasMany(PostTag::class,'post_id');
}
+ public function setPublishTimeAttr($value)
+ {
+ return strtotime($value);
+ }
+ public function getPublishTimeTextAttr()
+ {
+
+ $value = $this->getData('publish_time');
+ return date('Y-m-d',$value);
+ }
+
+
public function getCategorysListAttr()
{
$list_post_categorys = $this->getAttr('categorys');
@@ -50,8 +62,6 @@ class Post extends Model
$list = array_column($list_post_tags->append(['tag'])->toArray(),'tag');
- $list = array2level($list);
-
return $list;
}
@@ -66,6 +76,29 @@ class Post extends Model
return $desc;
}
+ public function getDescListAttr()
+ {
+ $desc = $this->getData('desc');
+
+ if(empty($desc)){
+ return '';
+ }
+ $list = explode("\n", $desc);
+
+ return $list;
+ }
+
+ public function getDescHtmlAttr()
+ {
+ $desc = $this->getData('desc');
+
+ if(empty($desc)){
+ return '';
+ }
+
+ return str_replace("\n",'
',$desc);
+ }
+
public function getStatusNameAttr()
{
return self::$stausNameList[$this->getData('status')];
diff --git a/config/view_type.php b/config/view_type.php
index 0712bc9..67996a4 100644
--- a/config/view_type.php
+++ b/config/view_type.php
@@ -6,7 +6,9 @@ return [
'_product' => '产品:_product',
'_case' => '案例:_case',
- '_about' => '关于:_about',
+ '_about_1' => '关于_图块:_about_1',
+ '_about_2' => '关于_招聘:_about_2',
+ '_about_3' => '关于_时间轴:_about_3',
],
'post' => [
'' => '普通:',
diff --git a/public/static/css/index.easy_blue.css b/public/static/css/index.easy_blue.css
index 2cf6450..683bb9e 100644
--- a/public/static/css/index.easy_blue.css
+++ b/public/static/css/index.easy_blue.css
@@ -93,7 +93,7 @@ body{background: #fff;}
.banner .title p{color: #606060; font-size: 36px; text-align: center; line-height: 50px; letter-spacing: 5px;}
.banner .title p.en{font-size: 20px; letter-spacing: 3px;}
.main-news{padding: 70px 0 80px 0;}
-.main-news .content > div{padding-bottom: 40px; border-bottom: 1px dashed #eaeaea; position: relative;}
+.main-news .content > div{padding-bottom: 40px; border-bottom: 1px dashed #eaeaea; position: relative;display: flex;}
.main-news .content .news-img{display: inline-block; width: 30%; vertical-align: top;}
.main-news .content .news-img img{max-width: 90%;}
.main-news .content .news-panel{display: inline-block; width: 70%; vertical-align: top; padding-left: 5px; box-sizing: border-box;}
diff --git a/view/admin/category/index.html b/view/admin/category/index.html
index 62c5531..c4d8d81 100644
--- a/view/admin/category/index.html
+++ b/view/admin/category/index.html
@@ -41,6 +41,7 @@
{$post.desc}
+{$post.desc}
+{$post.title}
+> 职位描述
+我们的蜕变
+{:date('Y 年 m 月 d 日',$post->publish_time)}
+{$post.title}
+{:date('Y 年 m 月 d 日',$post->publish_time)}
+{$post.title}
+{$post.title}
+{$post.desc}
+实时新闻 > 新闻详情
+发布时间:{$post.publish_time_text}
+{$post.desc_html}
++ +
+