作者 jinglong

增加意见预约吼他

  1 +<?php
  2 +
  3 +namespace app\admin\controller;
  4 +
  5 +use app\common\controller\Backend;
  6 +
  7 +/**
  8 + * 一键预约
  9 + *
  10 + * @icon fa fa-circle-o
  11 + */
  12 +class Reserve extends Backend
  13 +{
  14 +
  15 + /**
  16 + * Platform模型对象
  17 + * @var \app\admin\model\Platform
  18 + */
  19 + protected $model = null;
  20 +
  21 + public function _initialize()
  22 + {
  23 + parent::_initialize();
  24 + $this->model = new \app\admin\model\Platform;
  25 +
  26 + }
  27 +
  28 + /**
  29 + * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
  30 + * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
  31 + * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
  32 + */
  33 +
  34 + /**
  35 + * 查看
  36 + */
  37 + public function index()
  38 + {
  39 + //设置过滤方法
  40 + $this->request->filter(['strip_tags']);
  41 + if ($this->request->isAjax()) {
  42 + //如果发送的来源是Selectpage,则转发到Selectpage
  43 + if ($this->request->request('keyField')) {
  44 + return $this->selectpage();
  45 + }
  46 + list($where, $sort, $order, $offset, $limit) = $this->buildparams();
  47 + $total = $this->model
  48 + ->where($where)
  49 + ->where('id',6)
  50 + ->order($sort, $order)
  51 + ->count();
  52 +
  53 + $list = $this->model
  54 + ->where($where)
  55 + ->where('id',6)
  56 + ->order($sort, $order)
  57 + ->limit($offset, $limit)
  58 + ->select();
  59 +
  60 + $list = collection($list)->toArray();
  61 + $result = array("total" => $total, "rows" => $list);
  62 +
  63 + return json($result);
  64 + }
  65 + return $this->view->fetch();
  66 + }
  67 +
  68 +}
  1 +<?php
  2 +
  3 +return [
  4 + 'Id' => 'ID',
  5 + 'Thumbnail' => '缩略图',
  6 + 'Createtime' => '创建时间',
  7 + 'Updatetime' => '更新时间'
  8 +];
  1 +<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
  2 +
  3 + <div class="form-group">
  4 + <label class="control-label col-xs-12 col-sm-2">{:__('Thumbnail')}:</label>
  5 + <div class="col-xs-12 col-sm-8">
  6 + <div class="input-group">
  7 + <input id="c-thumbnail" data-rule="required" class="form-control" size="50" name="row[thumbnail]" type="text" value="{$row.thumbnail|htmlentities}">
  8 + <div class="input-group-addon no-border no-padding">
  9 + <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>
  10 + <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>
  11 + </div>
  12 + <span class="msg-box n-right" for="c-thumbnail"></span>
  13 + </div>
  14 + <ul class="row list-inline plupload-preview" id="p-thumbnail"></ul>
  15 + </div>
  16 + </div>
  17 +
  18 + <div class="form-group layer-footer">
  19 + <label class="control-label col-xs-12 col-sm-2"></label>
  20 + <div class="col-xs-12 col-sm-8">
  21 + <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
  22 + <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
  23 + </div>
  24 + </div>
  25 +</form>
  1 +<div class="panel panel-default panel-intro">
  2 + {:build_heading()}
  3 +
  4 + <div class="panel-body">
  5 + <div id="myTabContent" class="tab-content">
  6 + <div class="tab-pane fade active in" id="one">
  7 + <div class="widget-body no-padding">
  8 + <div id="toolbar" class="toolbar">
  9 + <a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
  10 + <!--<a href="javascript:;" class="btn btn-success btn-add {:$auth->check('reserve/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>-->
  11 + <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>
  12 + <!--<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>-->
  13 + <!--<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>-->
  14 +
  15 + <!--<div class="dropdown btn-group {:$auth->check('reserve/multi')?'':'hide'}">-->
  16 + <!--<a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a>-->
  17 + <!--<ul class="dropdown-menu text-left" role="menu">-->
  18 + <!--<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>-->
  19 + <!--<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>-->
  20 + <!--</ul>-->
  21 + <!--</div>-->
  22 +
  23 +
  24 + </div>
  25 + <table id="table" class="table table-striped table-bordered table-hover table-nowrap"
  26 + data-operate-edit="{:$auth->check('reserve/edit')}"
  27 + data-operate-del="{:$auth->check('reserve/del')}"
  28 + width="100%">
  29 + </table>
  30 + </div>
  31 + </div>
  32 +
  33 + </div>
  34 + </div>
  35 +</div>
@@ -40,6 +40,7 @@ class Index extends Api @@ -40,6 +40,7 @@ class Index extends Api
40 "experience": "http://mite.w.brotop.cn/uploads/20200107/95539a1899f02bda4fe1920597affe37.png",//服务体验缩略图 40 "experience": "http://mite.w.brotop.cn/uploads/20200107/95539a1899f02bda4fe1920597affe37.png",//服务体验缩略图
41 "register": "http://mite.w.brotop.cn/uploads/20200107/18e49cc54b697d369a143c9f1f369ac0.png"//会员注册缩略图 41 "register": "http://mite.w.brotop.cn/uploads/20200107/18e49cc54b697d369a143c9f1f369ac0.png"//会员注册缩略图
42 "center": "http://mite.w.brotop.cn/uploads/20200107/18e49cc54b697d369a143c9f1f369ac0.png"//个人中心缩略图 42 "center": "http://mite.w.brotop.cn/uploads/20200107/18e49cc54b697d369a143c9f1f369ac0.png"//个人中心缩略图
  43 + "reserve": "http://mite.w.brotop.cn/uploads/20200107/18e49cc54b697d369a143c9f1f369ac0.png"//一键预约缩略图
43 } 44 }
44 } 45 }
45 }) 46 })
@@ -59,11 +60,13 @@ class Index extends Api @@ -59,11 +60,13 @@ class Index extends Api
59 $experience = Common::findWhereData('platform',['id'=>3],'id,thumbnail');//服务体验 60 $experience = Common::findWhereData('platform',['id'=>3],'id,thumbnail');//服务体验
60 $register = Common::findWhereData('platform',['id'=>4],'id,thumbnail');//会员注册 61 $register = Common::findWhereData('platform',['id'=>4],'id,thumbnail');//会员注册
61 $center = Common::findWhereData('platform',['id'=>5],'id,thumbnail');//个人中心 62 $center = Common::findWhereData('platform',['id'=>5],'id,thumbnail');//个人中心
  63 + $reserve = Common::findWhereData('platform',['id'=>6],'id,thumbnail');//一键预约
62 $arr['thumbnail']['introduce'] = Common::absolutionUrlOne($introduce['thumbnail']); 64 $arr['thumbnail']['introduce'] = Common::absolutionUrlOne($introduce['thumbnail']);
63 $arr['thumbnail']['service'] = Common::absolutionUrlOne($service['thumbnail']); 65 $arr['thumbnail']['service'] = Common::absolutionUrlOne($service['thumbnail']);
64 $arr['thumbnail']['experience'] = Common::absolutionUrlOne($experience['thumbnail']); 66 $arr['thumbnail']['experience'] = Common::absolutionUrlOne($experience['thumbnail']);
65 $arr['thumbnail']['register'] = Common::absolutionUrlOne($register['thumbnail']); 67 $arr['thumbnail']['register'] = Common::absolutionUrlOne($register['thumbnail']);
66 $arr['thumbnail']['center'] = Common::absolutionUrlOne($center['thumbnail']); 68 $arr['thumbnail']['center'] = Common::absolutionUrlOne($center['thumbnail']);
  69 + $arr['thumbnail']['reserve'] = Common::absolutionUrlOne($reserve['thumbnail']);
67 $this->success('成功',$arr); 70 $this->success('成功',$arr);
68 }else{ 71 }else{
69 $this->error('请求方式错误'); 72 $this->error('请求方式错误');
  1 +define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
  2 +
  3 + var Controller = {
  4 + index: function () {
  5 + // 初始化表格参数配置
  6 + Table.api.init({
  7 + extend: {
  8 + index_url: 'reserve/index' + location.search,
  9 + // add_url: 'reserve/add',
  10 + edit_url: 'reserve/edit',
  11 + // del_url: 'reserve/del',
  12 + multi_url: 'reserve/multi',
  13 + table: 'reserve',
  14 + }
  15 + });
  16 +
  17 + var table = $("#table");
  18 +
  19 + // 初始化表格
  20 + table.bootstrapTable({
  21 + url: $.fn.bootstrapTable.defaults.extend.index_url,
  22 + pk: 'id',
  23 + sortName: 'id',
  24 + columns: [
  25 + [
  26 + {checkbox: true},
  27 + {field: 'id', title: __('Id')},
  28 + {field: 'thumbnail', title: __('Thumbnail'),events: Table.api.events.image, formatter: Table.api.formatter.image},
  29 + {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
  30 + // {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
  31 + {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  32 + ]
  33 + ]
  34 + });
  35 +
  36 + // 为表格绑定事件
  37 + Table.api.bindevent(table);
  38 + },
  39 + add: function () {
  40 + Controller.api.bindevent();
  41 + },
  42 + edit: function () {
  43 + Controller.api.bindevent();
  44 + },
  45 + api: {
  46 + bindevent: function () {
  47 + Form.api.bindevent($("form[role=form]"));
  48 + }
  49 + }
  50 + };
  51 + return Controller;
  52 +});