@extends('vip.layouts')
@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="team_name" required lay-verify="required" autocomplete="off" class="layui-input"
                       value="{{isset($data['team_name'])?$data['team_name']:''}}">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">队伍图标</label>
            <div class="layui-input-inline">
                <input type="text" name="team_icon" required lay-verify="required" autocomplete="off" class="layui-input"
                       value="{{isset($data['team_icon'])?$data['team_icon']:''}}">
                <!--<input type="text" id="show_icon" autocomplete="off" class="layui-input" style="display: none;"
                       value="" disabled="disabled" />-->
            </div>
            <div class="layui-input-inline">
                <p class="layui-layer-tips">请输入队伍图片网络地址</p>

            </div>
           <!-- <div class="layui-form-mid layui-word-aux" style="color: red">
                <button type="button" class="layui-btn" id="team_icon" >
                    <i class="layui-icon">&#xe67c;</i>上传图片
                </button>
            </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>
        //Demo
        layui.use(['form', 'layedit', 'laydate','upload'], function () {
            var form = layui.form
                , layer = layui.layer
                , layedit = layui.layedit
                , laydate = layui.laydate
                ,upload = layui.upload;

            var editIndex = layedit.build('LAY_demo_editor');
            //执行实例
            /*var uploadInst = upload.render({
                elem: '#team_icon'//绑定元素
                ,url: '/admin/Match/upload' //上传接口
                ,done: function(data){
                    var val=data.data;
                    //上传完毕回调
                    $('input[name="team_icon"]').val(val.path);
                    $('input[name="team_icon"]').hide();
                    $('#show_icon').val(val.name);
                    $('#show_icon').show();
                    layer.msg(data.msg);
                }
                ,error: function(){
                    //请求异常回调
                    layer.msg('请求异常');
                }
            });*/
          
            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
