@extends('vip.layouts')
<link href={{ asset("baidu/themes/default/css/umeditor.css") }} type="text/css" rel="stylesheet">
@section('content')

    <form class="layui-form" action="{{ url()->full() }}" id="submitForm" name="submitForm" method="post"
          eventType=eventAjaxForm>
        {!! csrf_field() !!}
        <div class="layui-form-item">
            <label class="layui-form-label">游戏名</label>
            <div class="layui-input-block">
                <input type="text" name="name" required lay-verify="required" autocomplete="off" class="layui-input"
                       value="{{isset(
      $data['name'])?$data['name']:''}}" disabled="disabled">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">游戏代码</label>
            <div class="layui-input-inline">
                <input type="text" name="table_name" required lay-verify="required" autocomplete="off" class="layui-input"
                       value="{{isset($data['table_name'])?$data['table_name']:''}}">
            </div>
            <div class="layui-form-mid layui-word-aux" style="color: red">*游戏代码请谨慎修改，如修改错误将导致该游戏不可用</div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">关闭理由</label>
            <div class="layui-input-block">
                <input type="text" name="close_info" lay-verify="" placeholder="请输入关闭理由" autocomplete="off"
                       class="layui-input" value="{{isset($data['closeinfo'])?$data['closeinfo']:''}}">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">热度排序</label>
            <div class="layui-input-inline" style="width: 60px">
                <input type="number" name="hot" lay-verify="" autocomplete="off" class="layui-input"
                       value="{{isset($data['hot'])?$data['hot']:''}}">
            </div>
            <div class="layui-form-mid layui-word-aux">*热度越大排位越靠前</div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">玩法介绍</label>
            <div class="layui-input-block">
                <textarea name="play_desc" lay-verify="content"
                    rows="80"  cols="150"    id="LAY_demo_editor">{{$data['play_desc']}}</textarea>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">游戏关闭</label>
            <div class="layui-input-block">
                <input type="radio" name="close_status" value="1" title="开启"
                       @if($data['close_status']==1) checked @endif>
                <input type="radio" name="close_status" value="0" title="关闭"
                       @if($data['close_status']==0) checked @endif>
            </div>
        </div>

        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn" lay-submit lay-filter="submitForm">立即提交</button>
                <button type="reset" class="layui-btn layui-btn-normal">重置</button>
            </div>
        </div>
    </form>
    <script type="text/javascript" src={{ asset("baidu/third-party/jquery.min.js") }}></script>
    <script type="text/javascript" charset="utf-8" src={{ asset("baidu/umeditor.config.js") }}></script>
    <script type="text/javascript" charset="utf-8" src={{ asset("baidu/umeditor.min.js") }}></script>
    <script type="text/javascript" src={{ asset("baidu/lang/zh-cn/zh-cn.js") }}></script>
    <script>
        //Demo
        var um = UM.getEditor('LAY_demo_editor');
        layui.use(['form', 'layedit', 'laydate'], function () {
            var form = layui.form
                , layer = layui.layer
                , layedit = layui.layedit
                , laydate = layui.laydate;

//            var editIndex = layedit.build('LAY_demo_editor');
            form.verify({
                title: function(value){
                    if(value.length < 5){
                        return '标题至少得5个字符啊';
                    }
                }
                ,pass: [/(.+){6,12}$/, '密码必须6到12位']
//                ,content: function(value){
////                    layedit.sync(editIndex);
//                }
            });
            //监听提交
            form.on('submit(submitForm)', function (data) {
                return true;
            });


        });
        //创建一个编辑器

    </script>
@endsection
