xiaogang 4 jaren geleden
bovenliggende
commit
956cec629d

+ 78 - 0
app/Admin/Controllers/DocumentController.php

xqd
@@ -0,0 +1,78 @@
+<?php
+
+namespace App\Admin\Controllers;
+
+use App\Models\Document;
+use Dcat\Admin\Form;
+use Dcat\Admin\Grid;
+use Dcat\Admin\Show;
+use Dcat\Admin\Http\Controllers\AdminController;
+
+class DocumentController extends AdminController
+{
+    /**
+     * Make a grid builder.
+     *
+     * @return Grid
+     */
+    protected function grid()
+    {
+        $grid = new Grid(new Document());
+        $grid->model()->orderBy('id','desc');
+
+        $grid->column('id')->sortable();
+        $grid->column('title');
+        // $grid->column('created_at');
+        $grid->column('updated_at')->sortable();
+
+        $grid->filter(function (Grid\Filter $filter) {
+            $filter->equal('id');
+            $filter->like('title','标题');
+
+        });
+
+        //操作管理
+        $grid->actions(function (Grid\Displayers\Actions $actions) {
+            if ($actions->row->id == 1 || $actions->row->id == 2) {
+                $actions->disableDelete();
+            }
+        });
+        return $grid;
+
+    }
+
+    /**
+     * Make a show builder.
+     *
+     * @param mixed $id
+     *
+     * @return Show
+     */
+    protected function detail($id)
+    {
+        return Show::make($id, new Document(), function (Show $show) {
+            $show->field('id');
+            $show->field('title');
+            $show->field('content')->unescape();
+            $show->field('created_at');
+            $show->field('updated_at');
+        });
+    }
+
+    /**
+     * Make a form builder.
+     *
+     * @return Form
+     */
+    protected function form()
+    {
+        return Form::make(new Document(), function (Form $form) {
+            $form->display('id');
+            $form->text('title');
+            $form->editor('content');
+
+            $form->display('created_at');
+            $form->display('updated_at');
+        });
+    }
+}

+ 1 - 0
app/Admin/routes.php

xqd
@@ -19,4 +19,5 @@ Route::group([
     $router->resource('/dynamic-tag', 'DynamicTagController');
     $router->resource('/vip', 'VipController');
     $router->resource('/vip-set', 'VipConfigController');
+    $router->resource('/document', 'DocumentController');
 });

+ 14 - 0
app/Models/Document.php

xqd
@@ -0,0 +1,14 @@
+<?php
+
+namespace App\Models;
+
+use Dcat\Admin\Traits\HasDateTimeFormatter;
+
+use Illuminate\Database\Eloquent\Model;
+
+class Document extends Model
+{
+	use HasDateTimeFormatter;
+    protected $table = 'document';
+    
+}

+ 4 - 4
dcat_admin_ide_helper.php

xqd xqd xqd xqd
@@ -130,7 +130,7 @@ namespace Dcat\Admin {
      * @property Grid\Column|Collection day_price
      * @property Grid\Column|Collection rights
      * @property Grid\Column|Collection chat
-     * @property Grid\Column|Collection destroy
+     * @property Grid\Column|Collection is_destroy
      * @property Grid\Column|Collection identity
      * @property Grid\Column|Collection invisible
      * @property Grid\Column|Collection dynamic
@@ -254,7 +254,7 @@ namespace Dcat\Admin {
      * @method Grid\Column|Collection day_price(string $label = null)
      * @method Grid\Column|Collection rights(string $label = null)
      * @method Grid\Column|Collection chat(string $label = null)
-     * @method Grid\Column|Collection destroy(string $label = null)
+     * @method Grid\Column|Collection is_destroy(string $label = null)
      * @method Grid\Column|Collection identity(string $label = null)
      * @method Grid\Column|Collection invisible(string $label = null)
      * @method Grid\Column|Collection dynamic(string $label = null)
@@ -383,7 +383,7 @@ namespace Dcat\Admin {
      * @property Show\Field|Collection day_price
      * @property Show\Field|Collection rights
      * @property Show\Field|Collection chat
-     * @property Show\Field|Collection destroy
+     * @property Show\Field|Collection is_destroy
      * @property Show\Field|Collection identity
      * @property Show\Field|Collection invisible
      * @property Show\Field|Collection dynamic
@@ -507,7 +507,7 @@ namespace Dcat\Admin {
      * @method Show\Field|Collection day_price(string $label = null)
      * @method Show\Field|Collection rights(string $label = null)
      * @method Show\Field|Collection chat(string $label = null)
-     * @method Show\Field|Collection destroy(string $label = null)
+     * @method Show\Field|Collection is_destroy(string $label = null)
      * @method Show\Field|Collection identity(string $label = null)
      * @method Show\Field|Collection invisible(string $label = null)
      * @method Show\Field|Collection dynamic(string $label = null)

+ 37 - 0
public/xieyi/content.html

xqd
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <title>用户协议</title>
+</head>
+<body>
+<h4 style="text-align: center;">用户协议</h4>
+
+
+</body>
+<script src="jquery-2.1.1.min.js" type="text/javascript" charset="utf-8"></script>
+<script>
+    function getQueryVariable(variable)
+    {
+        var query = window.location.search.substring(1);
+        var vars = query.split("&");
+        for (var i=0;i<vars.length;i++) {
+            var pair = vars[i].split("=");
+            if(pair[0] == variable){return pair[1];}
+        }
+        return(false);
+    }
+    $.ajax({
+        url:'https://t22.9026.com/api/login/xieyi?id='+getQueryVariable('id'),
+        type:'get',
+        data:{},
+        dataType:'json',
+        success:function(res){
+            $('title').append(res.data.title);
+            $('h4').append(res.data.title);
+            $('body').append(res.data.content);
+        }
+    })
+</script>
+</html>

+ 13 - 0
resources/lang/zh_CN/document.php

xqd
@@ -0,0 +1,13 @@
+<?php 
+return [
+    'labels' => [
+        'Document' => '文章和协议管理',
+        'document' => '文章和协议管理',
+    ],
+    'fields' => [
+        'title' => '标题',
+        'content' => '内容',
+    ],
+    'options' => [
+    ],
+];