团市委改版新加和改版功能

友链,关于我们,信息公开分类,团务百科分类
This commit is contained in:
qinzexin 2025-07-08 10:55:59 +08:00
parent acf45ddd0c
commit 76bde2604e
43 changed files with 1812 additions and 10 deletions

View File

@ -0,0 +1,37 @@
<?php
namespace app\admin\controller\home;
use app\common\controller\Backend;
/**
* 关于我们
*
* @icon fa fa-circle-o
*/
class AboutUs extends Backend
{
/**
* AboutUs模型对象
* @var \app\admin\model\home\AboutUs
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = new \app\admin\model\home\AboutUs;
$this->view->assign("statusList", $this->model->getStatusList());
}
/**
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
*/
}

View File

@ -0,0 +1,38 @@
<?php
namespace app\admin\controller\home;
use app\common\controller\Backend;
/**
* 官网友情链接
*
* @icon fa fa-circle-o
*/
class FriendshipLink extends Backend
{
/**
* FriendshipLink模型对象
* @var \app\admin\model\home\FriendshipLink
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = new \app\admin\model\home\FriendshipLink;
$this->view->assign("statusList", $this->model->getStatusList());
$this->view->assign("typeList", $this->model->getTypeList());
}
/**
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
*/
}

View File

@ -36,4 +36,44 @@ class Information extends Backend
*/ */
/**
* 查看
*/
public function index()
{
//当前是否为关联查询
$this->relationSearch = true;
$this->searchFields = ["id","title","subtitle","source","cate.name","cate.flag"];
//设置过滤方法
$this->request->filter(['strip_tags', 'trim']);
if ($this->request->isAjax()) {
//如果发送的来源是Selectpage则转发到Selectpage
if ($this->request->request('keyField')) {
return $this->selectpage();
}
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
$list = $this->model
->with(['cate'])
->where($where)
->order($sort, $order)
->paginate($limit);
foreach ($list as $row) {
$row->getRelation('cate')->visible(['name']);
}
$result = array("total" => $list->total(), "rows" => $list->items());
return json($result);
}
return $this->view->fetch();
}
} }

View File

@ -0,0 +1,37 @@
<?php
namespace app\admin\controller\home;
use app\common\controller\Backend;
/**
* 信息公开类目
*
* @icon fa fa-circle-o
*/
class InformationCate extends Backend
{
/**
* InformationCate模型对象
* @var \app\admin\model\home\InformationCate
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = new \app\admin\model\home\InformationCate;
$this->view->assign("statusList", $this->model->getStatusList());
}
/**
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
*/
}

View File

@ -0,0 +1,22 @@
<?php
return [
'Status' => '介绍类型',
'Status 1' => '领导班子',
'Set status to 1'=> '设为领导班子',
'Status 2' => '机构职能',
'Set status to 2'=> '设为机构职能',
'Status 3' => '部门设置',
'Set status to 3'=> '设为部门设置',
'Status 4' => '直属单位',
'Set status to 4'=> '设为直属单位',
'Status 5' => '下属部门',
'Set status to 5'=> '设为下属部门',
'Tabtitle' => 'tab标题',
'Title' => '文章标题',
'Content' => '内容',
'Weigh' => '权重',
'Createtime' => '创建时间',
'Updatetime' => '修改时间',
'Deletetime' => '删除时间'
];

View File

@ -2,6 +2,8 @@
return [ return [
'Title' => '标题', 'Title' => '标题',
'Cate_id' => '类目',
'Cate.name' => '类目名',
'Subtitle' => '副标题', 'Subtitle' => '副标题',
'Source' => '来源', 'Source' => '来源',
'Image' => '封面', 'Image' => '封面',

View File

@ -0,0 +1,21 @@
<?php
return [
'Status' => '友链类型',
'Status 1' => '省级共青团网站',
'Set status to 1'=> '设为省级共青团网站',
'Status 2' => '各地共青团网站',
'Set status to 2'=> '设为各地共青团网站',
'Status 3' => '其他',
'Set status to 3'=> '设为其他',
'Status 4' => '办公入口',
'Set status to 4'=> '设为办公入口',
'Title' => '友情链接标题',
'Type' => '跳转类型',
'Type in' => '内部跳转',
'Type out' => '外部跳转',
'Url' => '跳转链接',
'Weigh' => '权重',
'Createtime' => '创建时间',
'Deletetime' => '删除时间'
];

View File

@ -2,6 +2,8 @@
return [ return [
'Title' => '标题', 'Title' => '标题',
'Cate_id' => '类目',
'Cate.name' => '类目名',
'Subtitle' => '副标题', 'Subtitle' => '副标题',
'Source' => '来源', 'Source' => '来源',
'Image' => '封面', 'Image' => '封面',

View File

@ -0,0 +1,16 @@
<?php
return [
'Image' => 'icon',
'Name' => '类目名',
'Flag' => '分类标识',
'Status' => '状态',
'Status 1' => '上架',
'Set status to 1'=> '设为上架',
'Status 2' => '下架',
'Set status to 2'=> '设为下架',
'Weigh' => '权重',
'Createtime' => '创建时间',
'Updatetime' => '修改时间',
'Deletetime' => '删除时间'
];

View File

@ -1,7 +1,7 @@
<?php <?php
return [ return [
'Cate_id' => '新闻类目',
'Flag' => '分类标识', 'Flag' => '分类标识',
'Title' => '新闻标题', 'Title' => '新闻标题',
'Subtitle' => '新闻副标题', 'Subtitle' => '新闻副标题',
@ -28,5 +28,6 @@ return [
'Createtime' => '创建时间', 'Createtime' => '创建时间',
'Updatetime' => '修改时间', 'Updatetime' => '修改时间',
'Deletetime' => '删除时间', 'Deletetime' => '删除时间',
'Cate_id' => '新闻类目',
'Cate.name' => '类目名' 'Cate.name' => '类目名'
]; ];

View File

@ -0,0 +1,59 @@
<?php
namespace app\admin\model\home;
use think\Model;
use traits\model\SoftDelete;
class AboutUs extends Model
{
use SoftDelete;
// 表名
protected $name = 'home_about_us';
// 自动写入时间戳字段
protected $autoWriteTimestamp = 'integer';
// 定义时间戳字段名
protected $createTime = 'createtime';
protected $updateTime = 'updatetime';
protected $deleteTime = 'deletetime';
// 追加属性
protected $append = [
'status_text'
];
protected static function init()
{
self::afterInsert(function ($row) {
if (!$row['weigh']) {
$pk = $row->getPk();
$row->getQuery()->where($pk, $row[$pk])->update(['weigh' => $row[$pk]]);
}
});
}
public function getStatusList()
{
return ['1' => __('Status 1'), '2' => __('Status 2'), '3' => __('Status 3'), '4' => __('Status 4'), '5' => __('Status 5')];
}
public function getStatusTextAttr($value, $data)
{
$value = $value ?: ($data['status'] ?? '');
$list = $this->getStatusList();
return $list[$value] ?? '';
}
}

View File

@ -0,0 +1,73 @@
<?php
namespace app\admin\model\home;
use think\Model;
use traits\model\SoftDelete;
class FriendshipLink extends Model
{
use SoftDelete;
// 表名
protected $name = 'home_friendship_link';
// 自动写入时间戳字段
protected $autoWriteTimestamp = 'integer';
// 定义时间戳字段名
protected $createTime = 'createtime';
protected $updateTime = false;
protected $deleteTime = 'deletetime';
// 追加属性
protected $append = [
'status_text',
'type_text'
];
protected static function init()
{
self::afterInsert(function ($row) {
if (!$row['weigh']) {
$pk = $row->getPk();
$row->getQuery()->where($pk, $row[$pk])->update(['weigh' => $row[$pk]]);
}
});
}
public function getStatusList()
{
return ['1' => __('Status 1'), '2' => __('Status 2'), '3' => __('Status 3'), '4' => __('Status 4')];
}
public function getTypeList()
{
return ['in' => __('Type in'), 'out' => __('Type out')];
}
public function getStatusTextAttr($value, $data)
{
$value = $value ?: ($data['status'] ?? '');
$list = $this->getStatusList();
return $list[$value] ?? '';
}
public function getTypeTextAttr($value, $data)
{
$value = $value ?: ($data['type'] ?? '');
$list = $this->getTypeList();
return $list[$value] ?? '';
}
}

View File

@ -80,5 +80,10 @@ class Information extends Model
return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value); return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
} }
public function cate()
{
return $this->belongsTo(InformationCate::class, 'cate_id', 'id', [], 'LEFT')->setEagerlyType(0);
}
} }

View File

@ -0,0 +1,59 @@
<?php
namespace app\admin\model\home;
use think\Model;
use traits\model\SoftDelete;
class InformationCate extends Model
{
use SoftDelete;
// 表名
protected $name = 'information_cate';
// 自动写入时间戳字段
protected $autoWriteTimestamp = 'integer';
// 定义时间戳字段名
protected $createTime = 'createtime';
protected $updateTime = 'updatetime';
protected $deleteTime = 'deletetime';
// 追加属性
protected $append = [
'status_text'
];
protected static function init()
{
self::afterInsert(function ($row) {
if (!$row['weigh']) {
$pk = $row->getPk();
$row->getQuery()->where($pk, $row[$pk])->update(['weigh' => $row[$pk]]);
}
});
}
public function getStatusList()
{
return ['1' => __('Status 1'), '2' => __('Status 2')];
}
public function getStatusTextAttr($value, $data)
{
$value = $value ?: ($data['status'] ?? '');
$list = $this->getStatusList();
return $list[$value] ?? '';
}
}

View File

@ -0,0 +1,27 @@
<?php
namespace app\admin\validate\home;
use think\Validate;
class AboutUs extends Validate
{
/**
* 验证规则
*/
protected $rule = [
];
/**
* 提示消息
*/
protected $message = [
];
/**
* 验证场景
*/
protected $scene = [
'add' => [],
'edit' => [],
];
}

View File

@ -0,0 +1,27 @@
<?php
namespace app\admin\validate\home;
use think\Validate;
class FriendshipLink extends Validate
{
/**
* 验证规则
*/
protected $rule = [
];
/**
* 提示消息
*/
protected $message = [
];
/**
* 验证场景
*/
protected $scene = [
'add' => [],
'edit' => [],
];
}

View File

@ -0,0 +1,27 @@
<?php
namespace app\admin\validate\home;
use think\Validate;
class InformationCate extends Validate
{
/**
* 验证规则
*/
protected $rule = [
];
/**
* 提示消息
*/
protected $message = [
];
/**
* 验证场景
*/
protected $scene = [
'add' => [],
'edit' => [],
];
}

View File

@ -0,0 +1,45 @@
<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">{:__('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="1"}checked{/in} /> {$vo}</label>
{/foreach}
</div>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Tabtitle')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-tabtitle" class="form-control" name="row[tabtitle]" type="text">
</div>
</div>
<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" class="form-control" name="row[title]" type="text">
</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" 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">{:__('Weigh')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-weigh" class="form-control" name="row[weigh]" type="number" value="0">
</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>

View File

@ -0,0 +1,45 @@
<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">{:__('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}" disabled 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">
<label class="control-label col-xs-12 col-sm-2">{:__('Tabtitle')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-tabtitle" class="form-control" name="row[tabtitle]" type="text" value="{$row.tabtitle|htmlentities}">
</div>
</div>
<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" 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">{:__('Content')}:</label>
<div class="col-xs-12 col-sm-8">
<textarea id="c-content" 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">{:__('Weigh')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-weigh" class="form-control" name="row[weigh]" type="number" value="{$row.weigh|htmlentities}">
</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>

View File

@ -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('home/about_us/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('home/about_us/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('home/about_us/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>-->
<!-- <div class="dropdown btn-group {:$auth->check('home/about_us/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>-->
<!-- <a class="btn btn-success btn-recyclebin btn-dialog {:$auth->check('home/about_us/recyclebin')?'':'hide'}" href="home/about_us/recyclebin" title="{:__('Recycle bin')}"><i class="fa fa-recycle"></i> {:__('Recycle bin')}</a>-->
</div>
<table id="table" class="table table-striped table-bordered table-hover table-nowrap"
data-operate-edit="{:$auth->check('home/about_us/edit')}"
data-operate-del="0"
width="100%">
</table>
</div>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,25 @@
<div class="panel panel-default panel-intro">
{:build_heading()}
<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">
{:build_toolbar('refresh')}
<a class="btn btn-info btn-multi btn-disabled disabled {:$auth->check('home/about_us/restore')?'':'hide'}" href="javascript:;" data-url="home/about_us/restore" data-action="restore"><i class="fa fa-rotate-left"></i> {:__('Restore')}</a>
<a class="btn btn-danger btn-multi btn-disabled disabled {:$auth->check('home/about_us/destroy')?'':'hide'}" href="javascript:;" data-url="home/about_us/destroy" data-action="destroy"><i class="fa fa-times"></i> {:__('Destroy')}</a>
<a class="btn btn-success btn-restoreall {:$auth->check('home/about_us/restore')?'':'hide'}" href="javascript:;" data-url="home/about_us/restore" title="{:__('Restore all')}"><i class="fa fa-rotate-left"></i> {:__('Restore all')}</a>
<a class="btn btn-danger btn-destroyall {:$auth->check('home/about_us/destroy')?'':'hide'}" href="javascript:;" data-url="home/about_us/destroy" title="{:__('Destroy all')}"><i class="fa fa-times"></i> {:__('Destroy all')}</a>
</div>
<table id="table" class="table table-striped table-bordered table-hover"
data-operate-restore="{:$auth->check('home/about_us/restore')}"
data-operate-destroy="{:$auth->check('home/about_us/destroy')}"
width="100%">
</table>
</div>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,51 @@
<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">{:__('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="1"}checked{/in} /> {$vo}</label>
{/foreach}
</div>
</div>
</div>
<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" class="form-control" name="row[title]" type="text">
</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="out"}selected{/in}>{$vo}</option>
{/foreach}
</select>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Url')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-url" data-rule="required" class="form-control" name="row[url]" type="text">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Weigh')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-weigh" class="form-control" name="row[weigh]" type="number" value="0">
</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>

View File

@ -0,0 +1,51 @@
<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">{:__('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">
<label class="control-label col-xs-12 col-sm-2">{:__('Title')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-title" 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">{:__('Url')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-url" data-rule="required" class="form-control" name="row[url]" type="text" value="{$row.url|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Weigh')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-weigh" class="form-control" name="row[weigh]" type="number" value="{$row.weigh|htmlentities}">
</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>

View File

@ -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('home/friendship_link/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('home/friendship_link/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('home/friendship_link/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
<div class="dropdown btn-group {:$auth->check('home/friendship_link/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>
<a class="btn btn-success btn-recyclebin btn-dialog {:$auth->check('home/friendship_link/recyclebin')?'':'hide'}" href="home/friendship_link/recyclebin" title="{:__('Recycle bin')}"><i class="fa fa-recycle"></i> {:__('Recycle bin')}</a>
</div>
<table id="table" class="table table-striped table-bordered table-hover table-nowrap"
data-operate-edit="{:$auth->check('home/friendship_link/edit')}"
data-operate-del="{:$auth->check('home/friendship_link/del')}"
width="100%">
</table>
</div>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,25 @@
<div class="panel panel-default panel-intro">
{:build_heading()}
<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">
{:build_toolbar('refresh')}
<a class="btn btn-info btn-multi btn-disabled disabled {:$auth->check('home/friendship_link/restore')?'':'hide'}" href="javascript:;" data-url="home/friendship_link/restore" data-action="restore"><i class="fa fa-rotate-left"></i> {:__('Restore')}</a>
<a class="btn btn-danger btn-multi btn-disabled disabled {:$auth->check('home/friendship_link/destroy')?'':'hide'}" href="javascript:;" data-url="home/friendship_link/destroy" data-action="destroy"><i class="fa fa-times"></i> {:__('Destroy')}</a>
<a class="btn btn-success btn-restoreall {:$auth->check('home/friendship_link/restore')?'':'hide'}" href="javascript:;" data-url="home/friendship_link/restore" title="{:__('Restore all')}"><i class="fa fa-rotate-left"></i> {:__('Restore all')}</a>
<a class="btn btn-danger btn-destroyall {:$auth->check('home/friendship_link/destroy')?'':'hide'}" href="javascript:;" data-url="home/friendship_link/destroy" title="{:__('Destroy all')}"><i class="fa fa-times"></i> {:__('Destroy all')}</a>
</div>
<table id="table" class="table table-striped table-bordered table-hover"
data-operate-restore="{:$auth->check('home/friendship_link/restore')}"
data-operate-destroy="{:$auth->check('home/friendship_link/destroy')}"
width="100%">
</table>
</div>
</div>
</div>
</div>
</div>

View File

@ -1,5 +1,15 @@
<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action=""> <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">{:__('Cate_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-cate_id" data-rule="required" data-source="home/information_cate/index" class="form-control selectpage" name="row[cate_id]" type="text" value="">
</div>
</div>
<div class="form-group"> <div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Title')}:</label> <label class="control-label col-xs-12 col-sm-2">{:__('Title')}:</label>
<div class="col-xs-12 col-sm-8"> <div class="col-xs-12 col-sm-8">

View File

@ -1,5 +1,12 @@
<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action=""> <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">{:__('Cate_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-cate_id" data-rule="required" data-source="home/information_cate/index" class="form-control selectpage" name="row[cate_id]" type="text" value="{$row.cate_id|htmlentities}">
</div>
</div>
<div class="form-group"> <div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Title')}:</label> <label class="control-label col-xs-12 col-sm-2">{:__('Title')}:</label>
<div class="col-xs-12 col-sm-8"> <div class="col-xs-12 col-sm-8">

View File

@ -0,0 +1,53 @@
<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">{:__('Image')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="input-group">
<input id="c-image" class="form-control" size="50" name="row[image]" type="text">
<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">{:__('Name')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-name" data-rule="required" class="form-control" name="row[name]" type="text">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Flag')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-flag" class="form-control" name="row[flag]" type="text">
</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="1"}checked{/in} /> {$vo}</label>
{/foreach}
</div>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Weigh')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-weigh" class="form-control" name="row[weigh]" type="number" value="0">
</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>

View File

@ -0,0 +1,53 @@
<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">{:__('Image')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="input-group">
<input id="c-image" 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">{:__('Name')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-name" data-rule="required" class="form-control" name="row[name]" type="text" value="{$row.name|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Flag')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-flag" class="form-control" name="row[flag]" type="text" value="{$row.flag|htmlentities}">
</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">
<label class="control-label col-xs-12 col-sm-2">{:__('Weigh')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-weigh" class="form-control" name="row[weigh]" type="number" value="{$row.weigh|htmlentities}">
</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>

View File

@ -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('home/information_cate/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('home/information_cate/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('home/information_cate/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
<div class="dropdown btn-group {:$auth->check('home/information_cate/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>
<a class="btn btn-success btn-recyclebin btn-dialog {:$auth->check('home/information_cate/recyclebin')?'':'hide'}" href="home/information_cate/recyclebin" title="{:__('Recycle bin')}"><i class="fa fa-recycle"></i> {:__('Recycle bin')}</a>
</div>
<table id="table" class="table table-striped table-bordered table-hover table-nowrap"
data-operate-edit="{:$auth->check('home/information_cate/edit')}"
data-operate-del="{:$auth->check('home/information_cate/del')}"
width="100%">
</table>
</div>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,25 @@
<div class="panel panel-default panel-intro">
{:build_heading()}
<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">
{:build_toolbar('refresh')}
<a class="btn btn-info btn-multi btn-disabled disabled {:$auth->check('home/information_cate/restore')?'':'hide'}" href="javascript:;" data-url="home/information_cate/restore" data-action="restore"><i class="fa fa-rotate-left"></i> {:__('Restore')}</a>
<a class="btn btn-danger btn-multi btn-disabled disabled {:$auth->check('home/information_cate/destroy')?'':'hide'}" href="javascript:;" data-url="home/information_cate/destroy" data-action="destroy"><i class="fa fa-times"></i> {:__('Destroy')}</a>
<a class="btn btn-success btn-restoreall {:$auth->check('home/information_cate/restore')?'':'hide'}" href="javascript:;" data-url="home/information_cate/restore" title="{:__('Restore all')}"><i class="fa fa-rotate-left"></i> {:__('Restore all')}</a>
<a class="btn btn-danger btn-destroyall {:$auth->check('home/information_cate/destroy')?'':'hide'}" href="javascript:;" data-url="home/information_cate/destroy" title="{:__('Destroy all')}"><i class="fa fa-times"></i> {:__('Destroy all')}</a>
</div>
<table id="table" class="table table-striped table-bordered table-hover"
data-operate-restore="{:$auth->check('home/information_cate/restore')}"
data-operate-destroy="{:$auth->check('home/information_cate/destroy')}"
width="100%">
</table>
</div>
</div>
</div>
</div>
</div>

View File

@ -4,6 +4,8 @@ namespace app\api\controller;
use app\api\controller\home\Base; use app\api\controller\home\Base;
use app\common\controller\Api; use app\common\controller\Api;
use app\common\model\home\AboutUs;
use app\common\model\home\FriendshipLink;
use app\common\model\home\Images; use app\common\model\home\Images;
/** /**
@ -48,4 +50,75 @@ class Index extends Base
} }
$this->success('查询成功', $res); $this->success('查询成功', $res);
} }
/**
* @ApiTitle( 友情链接)
* @ApiSummary(友情链接)
* @ApiMethod(GET)
* @ApiParams(name = "page", type = "string",required=true,description = "页数")
* @ApiParams(name = "limit", type = "string",required=true,description = "条数")
* @ApiParams(name = "status", type = "string",required=true,description = "友链类型:1=省级共青团网站,2=各地共青团网站,3=其他,4=办公入口")
* @ApiReturn({
*
*})
*/
public function friendship_link()
{
$user_id = 0;
$user = $this->auth->getUser();//登录用户
if($user)$user_id = $user['id'];
$params=[];
$page = $this->request->get('page/d', 0); //页数
$limit = $this->request->get('limit/d', 0); //条数
$params["status"] = $this->request->get('status/s', ""); //条数
try{
//当前申请状态
$res = FriendshipLink::allList($page, $limit,$params);
}catch (\Exception $e){
$this->error($e->getMessage());
}
$this->success('查询成功', $res);
}
/**
* @ApiTitle( 关于我们系列文章-建议不传参全查)
* @ApiSummary(友情链接)
* @ApiMethod(GET)
* @ApiParams(name = "page", type = "string",required=true,description = "页数")
* @ApiParams(name = "limit", type = "string",required=true,description = "条数")
* @ApiParams(name = "status", type = "string",required=false,description = "介绍类型:1=领导班子,2=机构职能,3=部门设置,4=直属单位,5=下属部门")
* @ApiReturn({
*
*})
*/
public function about_us()
{
$user_id = 0;
$user = $this->auth->getUser();//登录用户
if($user)$user_id = $user['id'];
$params=[];
$page = $this->request->get('page/d', 1); //页数
$limit = $this->request->get('limit/d', 100); //条数
$params["status"] = $this->request->get('status/s', ""); //条数
try{
//当前申请状态
$res = AboutUs::allList($page, $limit,$params);
}catch (\Exception $e){
$this->error($e->getMessage());
}
$this->success('查询成功', $res);
}
} }

View File

@ -5,6 +5,7 @@ namespace app\api\controller\home;
use app\common\model\home\Information as InformationModel; use app\common\model\home\Information as InformationModel;
use app\common\model\home\NewsCate; use app\common\model\home\NewsCate;
use app\common\model\home\InformationCate;
/** /**
* 信息公开接口 * 信息公开接口
@ -29,6 +30,45 @@ class Information extends Base
/**
* @ApiTitle( 信息公开分类)
* @ApiSummary(信息公开分类)
* @ApiMethod(GET)
* @ApiParams(name = "page", type = "string",required=true,description = "页数")
* @ApiParams(name = "limit", type = "string",required=true,description = "条数")
* @ApiParams(name = "flag", type = "string",required=false,description = "分类标识")
* @ApiReturn({
*
*})
*/
public function cate()
{
$user_id = 0;
$user = $this->auth->getUser();//登录用户
if($user)$user_id = $user['id'];
$params=[];
$page = $this->request->param('page/d', 0); //页数
$limit = $this->request->param('limit/d', 0); //条数
$params["flag"] = $this->request->param('flag/s', ''); //搜索关键字
// $params["hot"] = $this->request->param('hot/s', ''); //搜索关键字
// $params["home"] = $this->request->param('home/s', ''); //搜索关键字
// $params["isnews"] = $this->request->param('isnews/s', ''); //搜索关键字
try{
//当前申请状态
$res = InformationCate::allList($page, $limit,$params);
}catch (\Exception $e){
$this->error($e->getMessage());
}
$this->success('查询成功', $res);
}
/** /**
* @ApiTitle( 信息公开文章列表) * @ApiTitle( 信息公开文章列表)
* @ApiSummary(信息公开文章列表) * @ApiSummary(信息公开文章列表)
@ -37,6 +77,7 @@ class Information extends Base
* @ApiParams(name = "page", type = "string",required=true,description = "页数") * @ApiParams(name = "page", type = "string",required=true,description = "页数")
* @ApiParams(name = "limit", type = "string",required=true,description = "条数") * @ApiParams(name = "limit", type = "string",required=true,description = "条数")
* @ApiParams(name = "recommend", type = "string",required=false,description = "置顶:0=否,1=是") * @ApiParams(name = "recommend", type = "string",required=false,description = "置顶:0=否,1=是")
* @ApiParams(name = "cate_id", type = "int",required=false,description = "团务百科类目id")
* @ApiReturn({ * @ApiReturn({
* *
*}) *})

View File

@ -0,0 +1,70 @@
<?php
namespace app\common\model\home;
use app\common\model\BaseModel;
use think\Model;
use traits\model\SoftDelete;
class AboutUs extends BaseModel
{
use SoftDelete;
// 表名
protected $name = 'home_about_us';
// 自动写入时间戳字段
protected $autoWriteTimestamp = 'integer';
// 定义时间戳字段名
protected $createTime = 'createtime';
protected $updateTime = 'updatetime';
protected $deleteTime = 'deletetime';
// 追加属性
protected $append = [
'status_text'
];
protected static function init()
{
self::afterInsert(function ($row) {
if (!$row['weigh']) {
$pk = $row->getPk();
$row->getQuery()->where($pk, $row[$pk])->update(['weigh' => $row[$pk]]);
}
});
}
public function getStatusList()
{
return ['1' => __('Status 1'), '2' => __('Status 2'), '3' => __('Status 3'), '4' => __('Status 4'), '5' => __('Status 5')];
}
public function getStatusTextAttr($value, $data)
{
$value = $value ?: ($data['status'] ?? '');
$list = $this->getStatusList();
return $list[$value] ?? '';
}
public static function allList($page, $limit,$params=[]){
$sort = "weigh desc,id desc";
// if(!empty($params['status'])){
// $params['status'] = '1';
// }
return (new self)->getBaseList($params, $page, $limit,$sort);
}
}

View File

@ -141,9 +141,9 @@ class EncyclopediaCate extends BaseModel
$sort = "weigh desc,id desc"; $sort = "weigh desc,id desc";
// if(!empty($params['status'])){ if(!empty($params['status'])){
// $params['status'] = '1'; $params['status'] = '1';
// } }
return (new self)->getBaseList($params, $page, $limit,$sort); return (new self)->getBaseList($params, $page, $limit,$sort);
} }

View File

@ -0,0 +1,87 @@
<?php
namespace app\common\model\home;
use app\common\model\BaseModel;
use think\Model;
use traits\model\SoftDelete;
class FriendshipLink extends BaseModel
{
use SoftDelete;
// 表名
protected $name = 'home_friendship_link';
// 自动写入时间戳字段
protected $autoWriteTimestamp = 'integer';
// 定义时间戳字段名
protected $createTime = 'createtime';
protected $updateTime = false;
protected $deleteTime = 'deletetime';
// 追加属性
protected $append = [
'status_text',
'type_text'
];
protected static function init()
{
self::afterInsert(function ($row) {
if (!$row['weigh']) {
$pk = $row->getPk();
$row->getQuery()->where($pk, $row[$pk])->update(['weigh' => $row[$pk]]);
}
});
}
public function getStatusList()
{
return ['1' => __('Status 1'), '2' => __('Status 2'), '3' => __('Status 3'), '4' => __('Status 4')];
}
public function getTypeList()
{
return ['in' => __('Type in'), 'out' => __('Type out')];
}
public function getStatusTextAttr($value, $data)
{
$value = $value ?: ($data['status'] ?? '');
$list = $this->getStatusList();
return $list[$value] ?? '';
}
public function getTypeTextAttr($value, $data)
{
$value = $value ?: ($data['type'] ?? '');
$list = $this->getTypeList();
return $list[$value] ?? '';
}
public static function allList($page, $limit,$params=[]){
$sort = "weigh desc,id desc";
// if(!empty($params['status'])){
// $params['status'] = '1';
// }
return (new self)->getBaseList($params, $page, $limit,$sort);
}
}

View File

@ -0,0 +1,152 @@
<?php
namespace app\common\model\home;
use app\common\model\BaseModel;
use think\Model;
use traits\model\SoftDelete;
class InformationCate extends BaseModel
{
use SoftDelete;
// 表名
protected $name = 'information_cate';
// 自动写入时间戳字段
protected $autoWriteTimestamp = 'integer';
// 定义时间戳字段名
protected $createTime = 'createtime';
protected $updateTime = 'updatetime';
protected $deleteTime = 'deletetime';
// 追加属性
protected $append = [
'status_text'
];
protected static function init()
{
self::afterInsert(function ($row) {
if (!$row['weigh']) {
$pk = $row->getPk();
$row->getQuery()->where($pk, $row[$pk])->update(['weigh' => $row[$pk]]);
}
});
}
public function getStatusList()
{
return ['1' => __('Status 1'), '2' => __('Status 2')];
}
public function getStatusTextAttr($value, $data)
{
$value = $value ?: ($data['status'] ?? '');
$list = $this->getStatusList();
return $list[$value] ?? '';
}
public function getImageAttr($value, $data)
{
if (!empty($value)) return cdnurl($value, true);
}
/**得到基础条件
* @param $status
* @param null $model
* @param string $alisa
*/
public static function getBaseWhere($whereData = [], $model = null, $alisa = '',$with = false)
{
if (!$model) {
$model = new static;
if ($alisa&&!$with) $model = $model->alias($alisa);
}
if ($alisa) $alisa = $alisa . '.';
$tableFields = (new static)->getTableFields();
foreach ($tableFields as $fields)
{
// if(in_array($fields, ["hot","home"]))continue;
// if (isset($whereData[$fields]) && $whereData[$fields]) $model = $model->where("{$alisa}{$fields}", '=', $whereData[$fields]);
if (isset($whereData[$fields]) && $whereData[$fields]){
if(is_array($whereData[$fields])){
$model = $model->where("{$alisa}{$fields}", $whereData[$fields][0], $whereData[$fields][1]);
}else{
$model = $model->where("{$alisa}{$fields}", '=', $whereData[$fields]);
}
}
}
// if (isset($whereData['hot']) && $whereData['hot']!=="" && $whereData['hot']!==null){
// $model = $model->where("{$alisa}hot", 'in', $whereData['hot'] );
// }
//
// if (isset($whereData['home']) && $whereData['home']!=="" && $whereData['home']!==null){
// $model = $model->where("{$alisa}home", 'in', $whereData['home'] );
// }
if (isset($whereData['keywords'])&&$whereData['keywords']){
$model = $model->where("{$alisa}name|{$alisa}flag", 'LIKE', "%{$whereData['keywords']}%" );
}
if (isset($whereData['time'])&&$whereData['time']){
$model = $model->time(["{$alisa}createtime",$whereData['time']]);
}
// if (isset($whereData['has_evaluate'])&&$whereData['has_evaluate']){
// //1查已评价 2查未评价
// if($whereData['has_evaluate'] == 1){
// //1查已评价
// $model = $model->where("{$alisa}classes_evaluate_id", '<>', 0);
// }else{
// //2查未评价
// $model = $model->whereExists(function ($query) use ($alisa) {
// $order_table_name = (new \app\common\model\school\classes\hourorder\Order())->getQuery()->getTable();
// $query->table($order_table_name)->where($order_table_name . '.classes_order_id=' . $alisa . 'id')->where('status', '=', '3');
// })->where("{$alisa}classes_evaluate_id", '=', 0);
//
// }
// }
return $model;
}
public static function allList($page, $limit,$params=[]){
$sort = "weigh desc,id desc";
if(!empty($params['status'])){
$params['status'] = '1';
}
return (new self)->getBaseList($params, $page, $limit,$sort);
}
}

View File

@ -156,9 +156,9 @@ class NewsCate extends BaseModel
$sort = "weigh desc,id desc"; $sort = "weigh desc,id desc";
// if(!empty($params['status'])){ if(!empty($params['status'])){
// $params['status'] = '1'; $params['status'] = '1';
// } }
return (new self)->getBaseList($params, $page, $limit,$sort); return (new self)->getBaseList($params, $page, $limit,$sort);
} }

View File

@ -59,9 +59,9 @@ class RecruitmentInformationCate extends BaseModel
$sort = "weigh desc,id desc"; $sort = "weigh desc,id desc";
// if(!empty($params['status'])){ if(!empty($params['status'])){
// $params['status'] = '1'; $params['status'] = '1';
// } }
return (new self)->getBaseList($params, $page, $limit,$sort); return (new self)->getBaseList($params, $page, $limit,$sort);
} }

View File

@ -0,0 +1,118 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'home/about_us/index' + location.search,
add_url: 'home/about_us/add',
edit_url: 'home/about_us/edit',
del_url: 'home/about_us/del',
multi_url: 'home/about_us/multi',
import_url: 'home/about_us/import',
table: 'home_about_us',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'weigh',
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"2":__('Status 2'),"3":__('Status 3'),"4":__('Status 4'),"5":__('Status 5')}, formatter: Table.api.formatter.status},
{field: 'tabtitle', title: __('Tabtitle'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'title', title: __('Title'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
// {field: 'content', title: __('Content')},
{field: 'weigh', title: __('Weigh'), operate: false},
{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);
},
recyclebin: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
'dragsort_url': ''
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: 'home/about_us/recyclebin' + location.search,
pk: 'id',
sortName: 'id',
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'title', title: __('Title'), align: 'left'},
{
field: 'deletetime',
title: __('Deletetime'),
operate: 'RANGE',
addclass: 'datetimerange',
formatter: Table.api.formatter.datetime
},
{
field: 'operate',
width: '140px',
title: __('Operate'),
table: table,
events: Table.api.events.operate,
buttons: [
{
name: 'Restore',
text: __('Restore'),
classname: 'btn btn-xs btn-info btn-ajax btn-restoreit',
icon: 'fa fa-rotate-left',
url: 'home/about_us/restore',
refresh: true
},
{
name: 'Destroy',
text: __('Destroy'),
classname: 'btn btn-xs btn-danger btn-ajax btn-destroyit',
icon: 'fa fa-times',
url: 'home/about_us/destroy',
refresh: true
}
],
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;
});

View File

@ -0,0 +1,117 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'home/friendship_link/index' + location.search,
add_url: 'home/friendship_link/add',
edit_url: 'home/friendship_link/edit',
del_url: 'home/friendship_link/del',
multi_url: 'home/friendship_link/multi',
import_url: 'home/friendship_link/import',
table: 'home_friendship_link',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'weigh',
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"2":__('Status 2'),"3":__('Status 3'),"4":__('Status 4')}, formatter: Table.api.formatter.status},
{field: 'title', title: __('Title'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'type', title: __('Type'), searchList: {"in":__('Type in'),"out":__('Type out')}, formatter: Table.api.formatter.normal},
{field: 'url', title: __('Url'), operate: 'LIKE', formatter: Table.api.formatter.url},
{field: 'weigh', title: __('Weigh'), operate: false},
{field: 'createtime', title: __('Createtime'), 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);
},
recyclebin: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
'dragsort_url': ''
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: 'home/friendship_link/recyclebin' + location.search,
pk: 'id',
sortName: 'id',
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'title', title: __('Title'), align: 'left'},
{
field: 'deletetime',
title: __('Deletetime'),
operate: 'RANGE',
addclass: 'datetimerange',
formatter: Table.api.formatter.datetime
},
{
field: 'operate',
width: '140px',
title: __('Operate'),
table: table,
events: Table.api.events.operate,
buttons: [
{
name: 'Restore',
text: __('Restore'),
classname: 'btn btn-xs btn-info btn-ajax btn-restoreit',
icon: 'fa fa-rotate-left',
url: 'home/friendship_link/restore',
refresh: true
},
{
name: 'Destroy',
text: __('Destroy'),
classname: 'btn btn-xs btn-danger btn-ajax btn-destroyit',
icon: 'fa fa-times',
url: 'home/friendship_link/destroy',
refresh: true
}
],
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;
});

View File

@ -28,6 +28,11 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
[ [
{checkbox: true}, {checkbox: true},
{field: 'id', title: __('Id')}, {field: 'id', title: __('Id')},
{field: 'cate_id', title: __('Cate_id')},
{field: 'cate.name', title: __('Cate.name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'title', title: __('Title'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content}, {field: 'title', title: __('Title'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'subtitle', title: __('Subtitle'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content}, {field: 'subtitle', title: __('Subtitle'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},

View File

@ -0,0 +1,118 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'home/information_cate/index' + location.search,
add_url: 'home/information_cate/add',
edit_url: 'home/information_cate/edit',
del_url: 'home/information_cate/del',
multi_url: 'home/information_cate/multi',
import_url: 'home/information_cate/import',
table: 'information_cate',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'weigh',
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'image', title: __('Image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
{field: 'name', title: __('Name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'flag', title: __('Flag'), operate: 'LIKE', formatter: Table.api.formatter.flag},
{field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"2":__('Status 2')}, formatter: Table.api.formatter.status},
{field: 'weigh', title: __('Weigh'), operate: false},
{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);
},
recyclebin: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
'dragsort_url': ''
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: 'home/information_cate/recyclebin' + location.search,
pk: 'id',
sortName: 'id',
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'name', title: __('Name'), align: 'left'},
{
field: 'deletetime',
title: __('Deletetime'),
operate: 'RANGE',
addclass: 'datetimerange',
formatter: Table.api.formatter.datetime
},
{
field: 'operate',
width: '140px',
title: __('Operate'),
table: table,
events: Table.api.events.operate,
buttons: [
{
name: 'Restore',
text: __('Restore'),
classname: 'btn btn-xs btn-info btn-ajax btn-restoreit',
icon: 'fa fa-rotate-left',
url: 'home/information_cate/restore',
refresh: true
},
{
name: 'Destroy',
text: __('Destroy'),
classname: 'btn btn-xs btn-danger btn-ajax btn-destroyit',
icon: 'fa fa-times',
url: 'home/information_cate/destroy',
refresh: true
}
],
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;
});