作者 jinglong

增加意见预约吼他

<?php
namespace app\admin\controller;
use app\common\controller\Backend;
/**
* 一键预约
*
* @icon fa fa-circle-o
*/
class Reserve extends Backend
{
/**
* Platform模型对象
* @var \app\admin\model\Platform
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = new \app\admin\model\Platform;
}
/**
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
*/
/**
* 查看
*/
public function index()
{
//设置过滤方法
$this->request->filter(['strip_tags']);
if ($this->request->isAjax()) {
//如果发送的来源是Selectpage,则转发到Selectpage
if ($this->request->request('keyField')) {
return $this->selectpage();
}
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
$total = $this->model
->where($where)
->where('id',6)
->order($sort, $order)
->count();
$list = $this->model
->where($where)
->where('id',6)
->order($sort, $order)
->limit($offset, $limit)
->select();
$list = collection($list)->toArray();
$result = array("total" => $total, "rows" => $list);
return json($result);
}
return $this->view->fetch();
}
}
... ...
<?php
return [
'Id' => 'ID',
'Thumbnail' => '缩略图',
'Createtime' => '创建时间',
'Updatetime' => '更新时间'
];
... ...
<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">{:__('Thumbnail')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="input-group">
<input id="c-thumbnail" data-rule="required" class="form-control" size="50" name="row[thumbnail]" type="text" value="{$row.thumbnail|htmlentities}">
<div class="input-group-addon no-border no-padding">
<span><button type="button" id="plupload-thumbnail" class="btn btn-danger plupload" data-input-id="c-thumbnail" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="false" data-preview-id="p-thumbnail"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" id="fachoose-thumbnail" class="btn btn-primary fachoose" data-input-id="c-thumbnail" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
</div>
<span class="msg-box n-right" for="c-thumbnail"></span>
</div>
<ul class="row list-inline plupload-preview" id="p-thumbnail"></ul>
</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-success btn-embossed disabled">{:__('OK')}</button>
<button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
</div>
</div>
</form>
... ...
<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">
<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('reserve/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('reserve/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('reserve/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>-->
<!--<a href="javascript:;" class="btn btn-danger btn-import {:$auth->check('reserve/import')?'':'hide'}" title="{:__('Import')}" id="btn-import-file" data-url="ajax/upload" data-mimetype="csv,xls,xlsx" data-multiple="false"><i class="fa fa-upload"></i> {:__('Import')}</a>-->
<!--<div class="dropdown btn-group {:$auth->check('reserve/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">-->
<!--<li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=normal"><i class="fa fa-eye"></i> {:__('Set to normal')}</a></li>-->
<!--<li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=hidden"><i class="fa fa-eye-slash"></i> {:__('Set to hidden')}</a></li>-->
<!--</ul>-->
<!--</div>-->
</div>
<table id="table" class="table table-striped table-bordered table-hover table-nowrap"
data-operate-edit="{:$auth->check('reserve/edit')}"
data-operate-del="{:$auth->check('reserve/del')}"
width="100%">
</table>
</div>
</div>
</div>
</div>
</div>
... ...
... ... @@ -40,6 +40,7 @@ class Index extends Api
"experience": "http://mite.w.brotop.cn/uploads/20200107/95539a1899f02bda4fe1920597affe37.png",//服务体验缩略图
"register": "http://mite.w.brotop.cn/uploads/20200107/18e49cc54b697d369a143c9f1f369ac0.png"//会员注册缩略图
"center": "http://mite.w.brotop.cn/uploads/20200107/18e49cc54b697d369a143c9f1f369ac0.png"//个人中心缩略图
"reserve": "http://mite.w.brotop.cn/uploads/20200107/18e49cc54b697d369a143c9f1f369ac0.png"//一键预约缩略图
}
}
})
... ... @@ -59,11 +60,13 @@ class Index extends Api
$experience = Common::findWhereData('platform',['id'=>3],'id,thumbnail');//服务体验
$register = Common::findWhereData('platform',['id'=>4],'id,thumbnail');//会员注册
$center = Common::findWhereData('platform',['id'=>5],'id,thumbnail');//个人中心
$reserve = Common::findWhereData('platform',['id'=>6],'id,thumbnail');//一键预约
$arr['thumbnail']['introduce'] = Common::absolutionUrlOne($introduce['thumbnail']);
$arr['thumbnail']['service'] = Common::absolutionUrlOne($service['thumbnail']);
$arr['thumbnail']['experience'] = Common::absolutionUrlOne($experience['thumbnail']);
$arr['thumbnail']['register'] = Common::absolutionUrlOne($register['thumbnail']);
$arr['thumbnail']['center'] = Common::absolutionUrlOne($center['thumbnail']);
$arr['thumbnail']['reserve'] = Common::absolutionUrlOne($reserve['thumbnail']);
$this->success('成功',$arr);
}else{
$this->error('请求方式错误');
... ...
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'reserve/index' + location.search,
// add_url: 'reserve/add',
edit_url: 'reserve/edit',
// del_url: 'reserve/del',
multi_url: 'reserve/multi',
table: 'reserve',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'id',
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'thumbnail', title: __('Thumbnail'),events: Table.api.events.image, formatter: Table.api.formatter.image},
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
// {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', 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;
});
\ No newline at end of file
... ...