diff --git a/application/admin/controller/content/Article.php b/application/admin/controller/content/Article.php
new file mode 100644
index 0000000..de373d2
--- /dev/null
+++ b/application/admin/controller/content/Article.php
@@ -0,0 +1,38 @@
+model = new \app\admin\model\content\Article;
+ $this->view->assign("typeList", $this->model->getTypeList());
+ $this->view->assign("statusList", $this->model->getStatusList());
+ }
+
+
+
+ /**
+ * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
+ * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
+ * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
+ */
+
+
+}
diff --git a/application/admin/controller/content/Company.php b/application/admin/controller/content/Company.php
new file mode 100644
index 0000000..033d9d6
--- /dev/null
+++ b/application/admin/controller/content/Company.php
@@ -0,0 +1,37 @@
+model = new \app\admin\model\content\Company;
+ $this->view->assign("statusList", $this->model->getStatusList());
+ }
+
+
+
+ /**
+ * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
+ * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
+ * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
+ */
+
+
+}
diff --git a/application/admin/lang/zh-cn/content/article.php b/application/admin/lang/zh-cn/content/article.php
new file mode 100644
index 0000000..5cc97ae
--- /dev/null
+++ b/application/admin/lang/zh-cn/content/article.php
@@ -0,0 +1,18 @@
+ 'ID',
+ 'Title' => '标题',
+ 'Type' => '展示位置',
+ 'Type 1' => '案列介绍',
+ 'Type 2' => '营销素材',
+ 'Image' => '主图',
+ 'Content' => '详情',
+ 'Status' => '状态',
+ 'Status 0' => '隐藏',
+ 'Set status to 0'=> '设为隐藏',
+ 'Status 1' => '正常',
+ 'Set status to 1'=> '设为正常',
+ 'Createtime' => '创建时间',
+ 'Updatetime' => '更新时间'
+];
diff --git a/application/admin/lang/zh-cn/content/company.php b/application/admin/lang/zh-cn/content/company.php
new file mode 100644
index 0000000..65c69ca
--- /dev/null
+++ b/application/admin/lang/zh-cn/content/company.php
@@ -0,0 +1,14 @@
+ 'ID',
+ 'Title' => '资质简介',
+ 'Image' => '资质图片',
+ 'Status' => '状态',
+ 'Status 0' => '隐藏',
+ 'Set status to 0'=> '设为隐藏',
+ 'Status 1' => '正常',
+ 'Set status to 1'=> '设为正常',
+ 'Createtime' => '创建时间',
+ 'Updatetime' => '更新时间'
+];
diff --git a/application/admin/model/content/Article.php b/application/admin/model/content/Article.php
new file mode 100644
index 0000000..3383571
--- /dev/null
+++ b/application/admin/model/content/Article.php
@@ -0,0 +1,63 @@
+ __('Type 1'), '2' => __('Type 2')];
+ }
+
+ public function getStatusList()
+ {
+ return ['0' => __('Status 0'), '1' => __('Status 1')];
+ }
+
+
+ public function getTypeTextAttr($value, $data)
+ {
+ $value = $value ? $value : (isset($data['type']) ? $data['type'] : '');
+ $list = $this->getTypeList();
+ return isset($list[$value]) ? $list[$value] : '';
+ }
+
+
+ public function getStatusTextAttr($value, $data)
+ {
+ $value = $value ? $value : (isset($data['status']) ? $data['status'] : '');
+ $list = $this->getStatusList();
+ return isset($list[$value]) ? $list[$value] : '';
+ }
+
+
+
+
+}
diff --git a/application/admin/model/content/Company.php b/application/admin/model/content/Company.php
new file mode 100644
index 0000000..4dbfef7
--- /dev/null
+++ b/application/admin/model/content/Company.php
@@ -0,0 +1,49 @@
+ __('Status 0'), '1' => __('Status 1')];
+ }
+
+
+ public function getStatusTextAttr($value, $data)
+ {
+ $value = $value ? $value : (isset($data['status']) ? $data['status'] : '');
+ $list = $this->getStatusList();
+ return isset($list[$value]) ? $list[$value] : '';
+ }
+
+
+
+
+}
diff --git a/application/admin/model/content/Notice.php b/application/admin/model/content/Notice.php
index 4ddf318..e89cc97 100644
--- a/application/admin/model/content/Notice.php
+++ b/application/admin/model/content/Notice.php
@@ -44,9 +44,7 @@ class Notice extends Model
return isset($list[$value]) ? $list[$value] : '';
}
- public function getImageAttr($value) {
- if(!empty($value)) return Request::instance()->domain().$value;
- }
+
diff --git a/application/admin/validate/content/Article.php b/application/admin/validate/content/Article.php
new file mode 100644
index 0000000..cacb310
--- /dev/null
+++ b/application/admin/validate/content/Article.php
@@ -0,0 +1,27 @@
+ [],
+ 'edit' => [],
+ ];
+
+}
diff --git a/application/admin/validate/content/Company.php b/application/admin/validate/content/Company.php
new file mode 100644
index 0000000..0d75ac6
--- /dev/null
+++ b/application/admin/validate/content/Company.php
@@ -0,0 +1,27 @@
+ [],
+ 'edit' => [],
+ ];
+
+}
diff --git a/application/admin/view/content/article/add.html b/application/admin/view/content/article/add.html
new file mode 100644
index 0000000..63a02f2
--- /dev/null
+++ b/application/admin/view/content/article/add.html
@@ -0,0 +1,59 @@
+
diff --git a/application/admin/view/content/article/edit.html b/application/admin/view/content/article/edit.html
new file mode 100644
index 0000000..a5166ff
--- /dev/null
+++ b/application/admin/view/content/article/edit.html
@@ -0,0 +1,59 @@
+
diff --git a/application/admin/view/content/article/index.html b/application/admin/view/content/article/index.html
new file mode 100644
index 0000000..d50d629
--- /dev/null
+++ b/application/admin/view/content/article/index.html
@@ -0,0 +1,46 @@
+
+
+
+ {:build_heading(null,FALSE)}
+
+
+
+
+
+
diff --git a/application/admin/view/content/company/add.html b/application/admin/view/content/company/add.html
new file mode 100644
index 0000000..8877f58
--- /dev/null
+++ b/application/admin/view/content/company/add.html
@@ -0,0 +1,41 @@
+
diff --git a/application/admin/view/content/company/edit.html b/application/admin/view/content/company/edit.html
new file mode 100644
index 0000000..d977dbc
--- /dev/null
+++ b/application/admin/view/content/company/edit.html
@@ -0,0 +1,41 @@
+
diff --git a/application/admin/view/content/company/index.html b/application/admin/view/content/company/index.html
new file mode 100644
index 0000000..94a08ba
--- /dev/null
+++ b/application/admin/view/content/company/index.html
@@ -0,0 +1,46 @@
+
+
+
+ {:build_heading(null,FALSE)}
+
+
+
+
+
+
diff --git a/application/api/controller/Article.php b/application/api/controller/Article.php
new file mode 100644
index 0000000..6639849
--- /dev/null
+++ b/application/api/controller/Article.php
@@ -0,0 +1,48 @@
+model = new articleModel();
+ }
+ public function list() {
+ $type = $this->request->param('type');
+ if (empty($type)) {
+ $this->error('参数异常');
+ }
+
+ $list = $this->model
+ ->where('type', $type)
+ ->where('status', 1)
+ ->paginate();
+
+ foreach ($list as &$row) {
+ $row['image'] = $this->request->domain().$row['image'];
+ }
+ $this->success('营销配置', $list);
+ }
+
+ public function detail() {
+ $id = $this->request->param('id');
+ if (empty($id)) {
+ $this->error('参数异常');
+ }
+ $detail = $this->model
+ ->where('status', 1)
+ ->where('id', $id)
+ ->find();
+ $detail['image'] = $this->request->domain().$detail['image'];
+ $this->success('success', $detail);
+ }
+}
\ No newline at end of file
diff --git a/application/api/controller/Company.php b/application/api/controller/Company.php
new file mode 100644
index 0000000..64a55b4
--- /dev/null
+++ b/application/api/controller/Company.php
@@ -0,0 +1,27 @@
+model = new companyModel();
+ }
+
+ public function list() {
+ $list = $this->model->where('status', 1)->paginate(10);
+ foreach ($list as &$row) {
+ $row['image'] = $this->request->domain().$row['image'];
+ }
+ $this->success('资质列表', $list);
+ }
+}
\ No newline at end of file
diff --git a/application/api/controller/Notice.php b/application/api/controller/Notice.php
index e98800e..05ac644 100644
--- a/application/api/controller/Notice.php
+++ b/application/api/controller/Notice.php
@@ -2,15 +2,37 @@
namespace app\api\controller;
use app\common\controller\Api;
+use app\admin\model\content\Notice as noticeModel;
class Notice extends Api {
protected $noNeedLogin = ['*'];
protected $noNeedRight = ['*'];
+ protected $model;
- public function list() {
- $model = new \app\admin\model\content\Notice();
- $list = $model->paginate(10);
+ public function _initialize() {
+ parent::_initialize();
+
+ $this->model = new noticeModel();
+ }
+ public function list() {
+ $list = $this->model->where('status', 1)->paginate(10);
+ foreach ($list as &$row) {
+ $row['image'] = $this->request->domain().$row['image'];
+ }
$this->success('公告列表', $list);
}
+
+ public function detail() {
+ $id = $this->request->param('id');
+ if (empty($id)) {
+ $this->error('参数异常');
+ }
+ $detail = $this->model
+ ->where('status', 1)
+ ->where('id', $id)
+ ->find();
+ $detail['image'] = $this->request->domain().$detail['image'];
+ $this->success('success', $detail);
+ }
}
\ No newline at end of file
diff --git a/public/assets/js/backend/content/article.js b/public/assets/js/backend/content/article.js
new file mode 100644
index 0000000..15bb65f
--- /dev/null
+++ b/public/assets/js/backend/content/article.js
@@ -0,0 +1,56 @@
+define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
+
+ var Controller = {
+ index: function () {
+ // 初始化表格参数配置
+ Table.api.init({
+ extend: {
+ index_url: 'content/article/index' + location.search,
+ add_url: 'content/article/add',
+ edit_url: 'content/article/edit',
+ del_url: 'content/article/del',
+ multi_url: 'content/article/multi',
+ import_url: 'content/article/import',
+ table: 'article',
+ }
+ });
+
+ var table = $("#table");
+
+ // 初始化表格
+ table.bootstrapTable({
+ url: $.fn.bootstrapTable.defaults.extend.index_url,
+ pk: 'id',
+ sortName: 'id',
+ columns: [
+ [
+ {checkbox: true},
+ {field: 'id', title: __('Id')},
+ {field: 'title', title: __('Title'), operate: 'LIKE'},
+ {field: 'type', title: __('Type'), searchList: {"1":__('Type 1'),"2":__('Type 2')}, formatter: Table.api.formatter.normal},
+ {field: 'image', title: __('Image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
+ {field: 'status', title: __('Status'), searchList: {"0":__('Status 0'),"1":__('Status 1')}, formatter: Table.api.formatter.status},
+ {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
+ {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
+ {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
+ ]
+ ]
+ });
+
+ // 为表格绑定事件
+ Table.api.bindevent(table);
+ },
+ add: function () {
+ Controller.api.bindevent();
+ },
+ edit: function () {
+ Controller.api.bindevent();
+ },
+ api: {
+ bindevent: function () {
+ Form.api.bindevent($("form[role=form]"));
+ }
+ }
+ };
+ return Controller;
+});
diff --git a/public/assets/js/backend/content/company.js b/public/assets/js/backend/content/company.js
new file mode 100644
index 0000000..6887e5e
--- /dev/null
+++ b/public/assets/js/backend/content/company.js
@@ -0,0 +1,55 @@
+define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
+
+ var Controller = {
+ index: function () {
+ // 初始化表格参数配置
+ Table.api.init({
+ extend: {
+ index_url: 'content/company/index' + location.search,
+ add_url: 'content/company/add',
+ edit_url: 'content/company/edit',
+ del_url: 'content/company/del',
+ multi_url: 'content/company/multi',
+ import_url: 'content/company/import',
+ table: 'company',
+ }
+ });
+
+ var table = $("#table");
+
+ // 初始化表格
+ table.bootstrapTable({
+ url: $.fn.bootstrapTable.defaults.extend.index_url,
+ pk: 'id',
+ sortName: 'id',
+ columns: [
+ [
+ {checkbox: true},
+ {field: 'id', title: __('Id')},
+ {field: 'title', title: __('Title'), operate: 'LIKE'},
+ {field: 'image', title: __('Image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
+ {field: 'status', title: __('Status'), searchList: {"0":__('Status 0'),"1":__('Status 1')}, formatter: Table.api.formatter.status},
+ {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
+ {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
+ {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
+ ]
+ ]
+ });
+
+ // 为表格绑定事件
+ Table.api.bindevent(table);
+ },
+ add: function () {
+ Controller.api.bindevent();
+ },
+ edit: function () {
+ Controller.api.bindevent();
+ },
+ api: {
+ bindevent: function () {
+ Form.api.bindevent($("form[role=form]"));
+ }
+ }
+ };
+ return Controller;
+});