main
parent
1b33c6cfc4
commit
3e7536fe57
@ -0,0 +1,38 @@ |
|||||||
|
<?php |
||||||
|
|
||||||
|
namespace app\admin\controller\content; |
||||||
|
|
||||||
|
use app\common\controller\Backend; |
||||||
|
|
||||||
|
/** |
||||||
|
* 营销配置 |
||||||
|
* |
||||||
|
* @icon fa fa-circle-o |
||||||
|
*/ |
||||||
|
class Article extends Backend |
||||||
|
{ |
||||||
|
|
||||||
|
/** |
||||||
|
* Article模型对象 |
||||||
|
* @var \app\admin\model\content\Article |
||||||
|
*/ |
||||||
|
protected $model = null; |
||||||
|
|
||||||
|
public function _initialize() |
||||||
|
{ |
||||||
|
parent::_initialize(); |
||||||
|
$this->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中对应的方法复制到当前控制器,然后进行修改 |
||||||
|
*/ |
||||||
|
|
||||||
|
|
||||||
|
} |
@ -0,0 +1,37 @@ |
|||||||
|
<?php |
||||||
|
|
||||||
|
namespace app\admin\controller\content; |
||||||
|
|
||||||
|
use app\common\controller\Backend; |
||||||
|
|
||||||
|
/** |
||||||
|
* 营销配置 |
||||||
|
* |
||||||
|
* @icon fa fa-circle-o |
||||||
|
*/ |
||||||
|
class Company extends Backend |
||||||
|
{ |
||||||
|
|
||||||
|
/** |
||||||
|
* Company模型对象 |
||||||
|
* @var \app\admin\model\content\Company |
||||||
|
*/ |
||||||
|
protected $model = null; |
||||||
|
|
||||||
|
public function _initialize() |
||||||
|
{ |
||||||
|
parent::_initialize(); |
||||||
|
$this->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中对应的方法复制到当前控制器,然后进行修改 |
||||||
|
*/ |
||||||
|
|
||||||
|
|
||||||
|
} |
@ -0,0 +1,18 @@ |
|||||||
|
<?php |
||||||
|
|
||||||
|
return [ |
||||||
|
'Id' => 'ID', |
||||||
|
'Title' => '标题', |
||||||
|
'Type' => '展示位置', |
||||||
|
'Type 1' => '案列介绍', |
||||||
|
'Type 2' => '营销素材', |
||||||
|
'Image' => '主图', |
||||||
|
'Content' => '详情', |
||||||
|
'Status' => '状态', |
||||||
|
'Status 0' => '隐藏', |
||||||
|
'Set status to 0'=> '设为隐藏', |
||||||
|
'Status 1' => '正常', |
||||||
|
'Set status to 1'=> '设为正常', |
||||||
|
'Createtime' => '创建时间', |
||||||
|
'Updatetime' => '更新时间' |
||||||
|
]; |
@ -0,0 +1,14 @@ |
|||||||
|
<?php |
||||||
|
|
||||||
|
return [ |
||||||
|
'Id' => 'ID', |
||||||
|
'Title' => '资质简介', |
||||||
|
'Image' => '资质图片', |
||||||
|
'Status' => '状态', |
||||||
|
'Status 0' => '隐藏', |
||||||
|
'Set status to 0'=> '设为隐藏', |
||||||
|
'Status 1' => '正常', |
||||||
|
'Set status to 1'=> '设为正常', |
||||||
|
'Createtime' => '创建时间', |
||||||
|
'Updatetime' => '更新时间' |
||||||
|
]; |
@ -0,0 +1,63 @@ |
|||||||
|
<?php |
||||||
|
|
||||||
|
namespace app\admin\model\content; |
||||||
|
|
||||||
|
use think\Model; |
||||||
|
|
||||||
|
|
||||||
|
class Article extends Model |
||||||
|
{ |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 表名 |
||||||
|
protected $name = 'article'; |
||||||
|
|
||||||
|
// 自动写入时间戳字段 |
||||||
|
protected $autoWriteTimestamp = 'integer'; |
||||||
|
|
||||||
|
// 定义时间戳字段名 |
||||||
|
protected $createTime = 'createtime'; |
||||||
|
protected $updateTime = 'updatetime'; |
||||||
|
protected $deleteTime = false; |
||||||
|
|
||||||
|
// 追加属性 |
||||||
|
protected $append = [ |
||||||
|
'type_text', |
||||||
|
'status_text' |
||||||
|
]; |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public function getTypeList() |
||||||
|
{ |
||||||
|
return ['1' => __('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] : ''; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} |
@ -0,0 +1,49 @@ |
|||||||
|
<?php |
||||||
|
|
||||||
|
namespace app\admin\model\content; |
||||||
|
|
||||||
|
use think\Model; |
||||||
|
|
||||||
|
|
||||||
|
class Company extends Model |
||||||
|
{ |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 表名 |
||||||
|
protected $name = 'company'; |
||||||
|
|
||||||
|
// 自动写入时间戳字段 |
||||||
|
protected $autoWriteTimestamp = 'integer'; |
||||||
|
|
||||||
|
// 定义时间戳字段名 |
||||||
|
protected $createTime = 'createtime'; |
||||||
|
protected $updateTime = 'updatetime'; |
||||||
|
protected $deleteTime = false; |
||||||
|
|
||||||
|
// 追加属性 |
||||||
|
protected $append = [ |
||||||
|
'status_text' |
||||||
|
]; |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public function getStatusList() |
||||||
|
{ |
||||||
|
return ['0' => __('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] : ''; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} |
@ -0,0 +1,27 @@ |
|||||||
|
<?php |
||||||
|
|
||||||
|
namespace app\admin\validate\content; |
||||||
|
|
||||||
|
use think\Validate; |
||||||
|
|
||||||
|
class Article extends Validate |
||||||
|
{ |
||||||
|
/** |
||||||
|
* 验证规则 |
||||||
|
*/ |
||||||
|
protected $rule = [ |
||||||
|
]; |
||||||
|
/** |
||||||
|
* 提示消息 |
||||||
|
*/ |
||||||
|
protected $message = [ |
||||||
|
]; |
||||||
|
/** |
||||||
|
* 验证场景 |
||||||
|
*/ |
||||||
|
protected $scene = [ |
||||||
|
'add' => [], |
||||||
|
'edit' => [], |
||||||
|
]; |
||||||
|
|
||||||
|
} |
@ -0,0 +1,27 @@ |
|||||||
|
<?php |
||||||
|
|
||||||
|
namespace app\admin\validate\content; |
||||||
|
|
||||||
|
use think\Validate; |
||||||
|
|
||||||
|
class Company extends Validate |
||||||
|
{ |
||||||
|
/** |
||||||
|
* 验证规则 |
||||||
|
*/ |
||||||
|
protected $rule = [ |
||||||
|
]; |
||||||
|
/** |
||||||
|
* 提示消息 |
||||||
|
*/ |
||||||
|
protected $message = [ |
||||||
|
]; |
||||||
|
/** |
||||||
|
* 验证场景 |
||||||
|
*/ |
||||||
|
protected $scene = [ |
||||||
|
'add' => [], |
||||||
|
'edit' => [], |
||||||
|
]; |
||||||
|
|
||||||
|
} |
@ -0,0 +1,59 @@ |
|||||||
|
<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action=""> |
||||||
|
|
||||||
|
<div class="form-group"> |
||||||
|
<label class="control-label col-xs-12 col-sm-2">{:__('Title')}:</label> |
||||||
|
<div class="col-xs-12 col-sm-8"> |
||||||
|
<input id="c-title" data-rule="required" class="form-control" name="row[title]" type="text" value=""> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
<div class="form-group"> |
||||||
|
<label class="control-label col-xs-12 col-sm-2">{:__('Type')}:</label> |
||||||
|
<div class="col-xs-12 col-sm-8"> |
||||||
|
|
||||||
|
<select id="c-type" data-rule="required" class="form-control selectpicker" name="row[type]"> |
||||||
|
{foreach name="typeList" item="vo"} |
||||||
|
<option value="{$key}" {in name="key" value=""}selected{/in}>{$vo}</option> |
||||||
|
{/foreach} |
||||||
|
</select> |
||||||
|
|
||||||
|
</div> |
||||||
|
</div> |
||||||
|
<div class="form-group"> |
||||||
|
<label class="control-label col-xs-12 col-sm-2">{:__('Image')}:</label> |
||||||
|
<div class="col-xs-12 col-sm-8"> |
||||||
|
<div class="input-group"> |
||||||
|
<input id="c-image" data-rule="required" class="form-control" size="50" name="row[image]" type="text" value=""> |
||||||
|
<div class="input-group-addon no-border no-padding"> |
||||||
|
<span><button type="button" id="faupload-image" class="btn btn-danger faupload" data-input-id="c-image" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="false" data-preview-id="p-image"><i class="fa fa-upload"></i> {:__('Upload')}</button></span> |
||||||
|
<span><button type="button" id="fachoose-image" class="btn btn-primary fachoose" data-input-id="c-image" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span> |
||||||
|
</div> |
||||||
|
<span class="msg-box n-right" for="c-image"></span> |
||||||
|
</div> |
||||||
|
<ul class="row list-inline faupload-preview" id="p-image"></ul> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
<div class="form-group"> |
||||||
|
<label class="control-label col-xs-12 col-sm-2">{:__('Content')}:</label> |
||||||
|
<div class="col-xs-12 col-sm-8"> |
||||||
|
<textarea id="c-content" data-rule="required" class="form-control editor" rows="5" name="row[content]" cols="50"></textarea> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
<div class="form-group"> |
||||||
|
<label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label> |
||||||
|
<div class="col-xs-12 col-sm-8"> |
||||||
|
|
||||||
|
<div class="radio"> |
||||||
|
{foreach name="statusList" item="vo"} |
||||||
|
<label for="row[status]-{$key}"><input id="row[status]-{$key}" name="row[status]" type="radio" value="{$key}" {in name="key" value="0"}checked{/in} /> {$vo}</label> |
||||||
|
{/foreach} |
||||||
|
</div> |
||||||
|
|
||||||
|
</div> |
||||||
|
</div> |
||||||
|
<div class="form-group layer-footer"> |
||||||
|
<label class="control-label col-xs-12 col-sm-2"></label> |
||||||
|
<div class="col-xs-12 col-sm-8"> |
||||||
|
<button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</form> |
@ -0,0 +1,59 @@ |
|||||||
|
<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action=""> |
||||||
|
|
||||||
|
<div class="form-group"> |
||||||
|
<label class="control-label col-xs-12 col-sm-2">{:__('Title')}:</label> |
||||||
|
<div class="col-xs-12 col-sm-8"> |
||||||
|
<input id="c-title" data-rule="required" class="form-control" name="row[title]" type="text" value="{$row.title|htmlentities}"> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
<div class="form-group"> |
||||||
|
<label class="control-label col-xs-12 col-sm-2">{:__('Type')}:</label> |
||||||
|
<div class="col-xs-12 col-sm-8"> |
||||||
|
|
||||||
|
<select id="c-type" data-rule="required" class="form-control selectpicker" name="row[type]"> |
||||||
|
{foreach name="typeList" item="vo"} |
||||||
|
<option value="{$key}" {in name="key" value="$row.type"}selected{/in}>{$vo}</option> |
||||||
|
{/foreach} |
||||||
|
</select> |
||||||
|
|
||||||
|
</div> |
||||||
|
</div> |
||||||
|
<div class="form-group"> |
||||||
|
<label class="control-label col-xs-12 col-sm-2">{:__('Image')}:</label> |
||||||
|
<div class="col-xs-12 col-sm-8"> |
||||||
|
<div class="input-group"> |
||||||
|
<input id="c-image" data-rule="required" class="form-control" size="50" name="row[image]" type="text" value="{$row.image|htmlentities}"> |
||||||
|
<div class="input-group-addon no-border no-padding"> |
||||||
|
<span><button type="button" id="faupload-image" class="btn btn-danger faupload" data-input-id="c-image" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="false" data-preview-id="p-image"><i class="fa fa-upload"></i> {:__('Upload')}</button></span> |
||||||
|
<span><button type="button" id="fachoose-image" class="btn btn-primary fachoose" data-input-id="c-image" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span> |
||||||
|
</div> |
||||||
|
<span class="msg-box n-right" for="c-image"></span> |
||||||
|
</div> |
||||||
|
<ul class="row list-inline faupload-preview" id="p-image"></ul> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
<div class="form-group"> |
||||||
|
<label class="control-label col-xs-12 col-sm-2">{:__('Content')}:</label> |
||||||
|
<div class="col-xs-12 col-sm-8"> |
||||||
|
<textarea id="c-content" data-rule="required" class="form-control editor" rows="5" name="row[content]" cols="50">{$row.content|htmlentities}</textarea> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
<div class="form-group"> |
||||||
|
<label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label> |
||||||
|
<div class="col-xs-12 col-sm-8"> |
||||||
|
|
||||||
|
<div class="radio"> |
||||||
|
{foreach name="statusList" item="vo"} |
||||||
|
<label for="row[status]-{$key}"><input id="row[status]-{$key}" name="row[status]" type="radio" value="{$key}" {in name="key" value="$row.status"}checked{/in} /> {$vo}</label> |
||||||
|
{/foreach} |
||||||
|
</div> |
||||||
|
|
||||||
|
</div> |
||||||
|
</div> |
||||||
|
<div class="form-group layer-footer"> |
||||||
|
<label class="control-label col-xs-12 col-sm-2"></label> |
||||||
|
<div class="col-xs-12 col-sm-8"> |
||||||
|
<button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</form> |
@ -0,0 +1,46 @@ |
|||||||
|
<div class="panel panel-default panel-intro"> |
||||||
|
|
||||||
|
<div class="panel-heading"> |
||||||
|
{:build_heading(null,FALSE)} |
||||||
|
<ul class="nav nav-tabs" data-field="status"> |
||||||
|
<li class="{:$Think.get.status === null ? 'active' : ''}"><a href="#t-all" data-value="" data-toggle="tab">{:__('All')}</a></li> |
||||||
|
{foreach name="statusList" item="vo"} |
||||||
|
<li class="{:$Think.get.status === (string)$key ? 'active' : ''}"><a href="#t-{$key}" data-value="{$key}" data-toggle="tab">{$vo}</a></li> |
||||||
|
{/foreach} |
||||||
|
</ul> |
||||||
|
</div> |
||||||
|
|
||||||
|
|
||||||
|
<div class="panel-body"> |
||||||
|
<div id="myTabContent" class="tab-content"> |
||||||
|
<div class="tab-pane fade active in" id="one"> |
||||||
|
<div class="widget-body no-padding"> |
||||||
|
<div id="toolbar" class="toolbar"> |
||||||
|
<a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a> |
||||||
|
<a href="javascript:;" class="btn btn-success btn-add {:$auth->check('content/article/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a> |
||||||
|
<a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('content/article/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a> |
||||||
|
<a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('content/article/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a> |
||||||
|
|
||||||
|
|
||||||
|
<div class="dropdown btn-group {:$auth->check('content/article/multi')?'':'hide'}"> |
||||||
|
<a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a> |
||||||
|
<ul class="dropdown-menu text-left" role="menu"> |
||||||
|
{foreach name="statusList" item="vo"} |
||||||
|
<li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:" data-params="status={$key}">{:__('Set status to ' . $key)}</a></li> |
||||||
|
{/foreach} |
||||||
|
</ul> |
||||||
|
</div> |
||||||
|
|
||||||
|
|
||||||
|
</div> |
||||||
|
<table id="table" class="table table-striped table-bordered table-hover table-nowrap" |
||||||
|
data-operate-edit="{:$auth->check('content/article/edit')}" |
||||||
|
data-operate-del="{:$auth->check('content/article/del')}" |
||||||
|
width="100%"> |
||||||
|
</table> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
|
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</div> |
@ -0,0 +1,41 @@ |
|||||||
|
<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action=""> |
||||||
|
|
||||||
|
<div class="form-group"> |
||||||
|
<label class="control-label col-xs-12 col-sm-2">{:__('Title')}:</label> |
||||||
|
<div class="col-xs-12 col-sm-8"> |
||||||
|
<input id="c-title" data-rule="required" class="form-control" name="row[title]" type="text" value=""> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
<div class="form-group"> |
||||||
|
<label class="control-label col-xs-12 col-sm-2">{:__('Image')}:</label> |
||||||
|
<div class="col-xs-12 col-sm-8"> |
||||||
|
<div class="input-group"> |
||||||
|
<input id="c-image" data-rule="required" class="form-control" size="50" name="row[image]" type="text" value=""> |
||||||
|
<div class="input-group-addon no-border no-padding"> |
||||||
|
<span><button type="button" id="faupload-image" class="btn btn-danger faupload" data-input-id="c-image" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="false" data-preview-id="p-image"><i class="fa fa-upload"></i> {:__('Upload')}</button></span> |
||||||
|
<span><button type="button" id="fachoose-image" class="btn btn-primary fachoose" data-input-id="c-image" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span> |
||||||
|
</div> |
||||||
|
<span class="msg-box n-right" for="c-image"></span> |
||||||
|
</div> |
||||||
|
<ul class="row list-inline faupload-preview" id="p-image"></ul> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
<div class="form-group"> |
||||||
|
<label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label> |
||||||
|
<div class="col-xs-12 col-sm-8"> |
||||||
|
|
||||||
|
<div class="radio"> |
||||||
|
{foreach name="statusList" item="vo"} |
||||||
|
<label for="row[status]-{$key}"><input id="row[status]-{$key}" name="row[status]" type="radio" value="{$key}" {in name="key" value="0"}checked{/in} /> {$vo}</label> |
||||||
|
{/foreach} |
||||||
|
</div> |
||||||
|
|
||||||
|
</div> |
||||||
|
</div> |
||||||
|
<div class="form-group layer-footer"> |
||||||
|
<label class="control-label col-xs-12 col-sm-2"></label> |
||||||
|
<div class="col-xs-12 col-sm-8"> |
||||||
|
<button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</form> |
@ -0,0 +1,41 @@ |
|||||||
|
<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action=""> |
||||||
|
|
||||||
|
<div class="form-group"> |
||||||
|
<label class="control-label col-xs-12 col-sm-2">{:__('Title')}:</label> |
||||||
|
<div class="col-xs-12 col-sm-8"> |
||||||
|
<input id="c-title" data-rule="required" class="form-control" name="row[title]" type="text" value="{$row.title|htmlentities}"> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
<div class="form-group"> |
||||||
|
<label class="control-label col-xs-12 col-sm-2">{:__('Image')}:</label> |
||||||
|
<div class="col-xs-12 col-sm-8"> |
||||||
|
<div class="input-group"> |
||||||
|
<input id="c-image" data-rule="required" class="form-control" size="50" name="row[image]" type="text" value="{$row.image|htmlentities}"> |
||||||
|
<div class="input-group-addon no-border no-padding"> |
||||||
|
<span><button type="button" id="faupload-image" class="btn btn-danger faupload" data-input-id="c-image" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="false" data-preview-id="p-image"><i class="fa fa-upload"></i> {:__('Upload')}</button></span> |
||||||
|
<span><button type="button" id="fachoose-image" class="btn btn-primary fachoose" data-input-id="c-image" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span> |
||||||
|
</div> |
||||||
|
<span class="msg-box n-right" for="c-image"></span> |
||||||
|
</div> |
||||||
|
<ul class="row list-inline faupload-preview" id="p-image"></ul> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
<div class="form-group"> |
||||||
|
<label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label> |
||||||
|
<div class="col-xs-12 col-sm-8"> |
||||||
|
|
||||||
|
<div class="radio"> |
||||||
|
{foreach name="statusList" item="vo"} |
||||||
|
<label for="row[status]-{$key}"><input id="row[status]-{$key}" name="row[status]" type="radio" value="{$key}" {in name="key" value="$row.status"}checked{/in} /> {$vo}</label> |
||||||
|
{/foreach} |
||||||
|
</div> |
||||||
|
|
||||||
|
</div> |
||||||
|
</div> |
||||||
|
<div class="form-group layer-footer"> |
||||||
|
<label class="control-label col-xs-12 col-sm-2"></label> |
||||||
|
<div class="col-xs-12 col-sm-8"> |
||||||
|
<button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</form> |
@ -0,0 +1,46 @@ |
|||||||
|
<div class="panel panel-default panel-intro"> |
||||||
|
|
||||||
|
<div class="panel-heading"> |
||||||
|
{:build_heading(null,FALSE)} |
||||||
|
<ul class="nav nav-tabs" data-field="status"> |
||||||
|
<li class="{:$Think.get.status === null ? 'active' : ''}"><a href="#t-all" data-value="" data-toggle="tab">{:__('All')}</a></li> |
||||||
|
{foreach name="statusList" item="vo"} |
||||||
|
<li class="{:$Think.get.status === (string)$key ? 'active' : ''}"><a href="#t-{$key}" data-value="{$key}" data-toggle="tab">{$vo}</a></li> |
||||||
|
{/foreach} |
||||||
|
</ul> |
||||||
|
</div> |
||||||
|
|
||||||
|
|
||||||
|
<div class="panel-body"> |
||||||
|
<div id="myTabContent" class="tab-content"> |
||||||
|
<div class="tab-pane fade active in" id="one"> |
||||||
|
<div class="widget-body no-padding"> |
||||||
|
<div id="toolbar" class="toolbar"> |
||||||
|
<a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a> |
||||||
|
<a href="javascript:;" class="btn btn-success btn-add {:$auth->check('content/company/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a> |
||||||
|
<a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('content/company/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a> |
||||||
|
<a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('content/company/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a> |
||||||
|
|
||||||
|
|
||||||
|
<div class="dropdown btn-group {:$auth->check('content/company/multi')?'':'hide'}"> |
||||||
|
<a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a> |
||||||
|
<ul class="dropdown-menu text-left" role="menu"> |
||||||
|
{foreach name="statusList" item="vo"} |
||||||
|
<li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:" data-params="status={$key}">{:__('Set status to ' . $key)}</a></li> |
||||||
|
{/foreach} |
||||||
|
</ul> |
||||||
|
</div> |
||||||
|
|
||||||
|
|
||||||
|
</div> |
||||||
|
<table id="table" class="table table-striped table-bordered table-hover table-nowrap" |
||||||
|
data-operate-edit="{:$auth->check('content/company/edit')}" |
||||||
|
data-operate-del="{:$auth->check('content/company/del')}" |
||||||
|
width="100%"> |
||||||
|
</table> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
|
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</div> |
@ -0,0 +1,48 @@ |
|||||||
|
<?php |
||||||
|
|
||||||
|
namespace app\api\controller; |
||||||
|
|
||||||
|
use app\common\controller\Api; |
||||||
|
use app\admin\model\content\Article as articleModel; |
||||||
|
|
||||||
|
class Article extends Api |
||||||
|
{ |
||||||
|
protected $noNeedLogin = ['*']; |
||||||
|
protected $noNeedRight = ['*']; |
||||||
|
protected $model; |
||||||
|
|
||||||
|
public function _initialize() { |
||||||
|
parent::_initialize(); |
||||||
|
|
||||||
|
$this->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); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,27 @@ |
|||||||
|
<?php |
||||||
|
|
||||||
|
namespace app\api\controller; |
||||||
|
|
||||||
|
use app\admin\model\content\Company as companyModel; |
||||||
|
use app\common\controller\Api; |
||||||
|
|
||||||
|
class Company extends Api |
||||||
|
{ |
||||||
|
protected $noNeedLogin = ['*']; |
||||||
|
protected $noNeedRight = ['*']; |
||||||
|
protected $model; |
||||||
|
|
||||||
|
public function _initialize() { |
||||||
|
parent::_initialize(); |
||||||
|
|
||||||
|
$this->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); |
||||||
|
} |
||||||
|
} |
@ -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; |
||||||
|
}); |
@ -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; |
||||||
|
}); |
Loading…
Reference in new issue