@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" lay-filter="submitForm">
        {!! csrf_field() !!}
        {{--<div class="layui-form-item">--}}
            {{--<label class="layui-form-label">代理等级：&nbsp;&nbsp;</label>--}}
            {{--<div class="layui-input-inline">--}}
                {{--<select name="grade" id="agent" lay-filter="filter">--}}
                    {{--<option value="1" selected>铜牌代理</option>--}}
                    {{--<option value="2">银牌代理</option>--}}
                    {{--<option value="3">金牌代理</option>--}}
                {{--</select>--}}
            {{--</div>--}}
            <!--<div class="layui-input-inline" style="color: red;"> *如想看原版，请先切换刷新一下</div>-->
        {{--</div>--}}

        <div class="layui-form-item">
            <label class="layui-form-label">代理优势：&nbsp;&nbsp;</label>

            <div class="layui-input-inline" style="width:1000px">
                {{--、 class="layui-textarea "--}}
                <textarea name="agent_solution"  rows="80" cols="150" lay-verify="content" id="LAY_demo_editor" >{{isset($data['agent_solution'])?$data['agent_solution']:''}}</textarea>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">代理方案：&nbsp;&nbsp;</label>
            {{--class="layui-textarea "--}}
            <div class="layui-input-inline"  style="width:1000px" >
                <textarea name="agent_advantage" rows="80" cols="150"  lay-verify="content" id="LAY_editor" >{{isset($data['agent_advantage'])?$data['agent_advantage']:''}}</textarea>
            </div>
        </div>

        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn sub" lay-submit lay-filter="submitForm">确认</button>
            </div>
        </div>
    </form>
    <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>
        var um = UM.getEditor('LAY_demo_editor');
        var avd=UM.getEditor('LAY_editor');
    layui.use(['form','layedit', 'laydate'], function () {
        var form = layui.form
            , layer = layui.layer
            , layedit = layui.layedit
            , laydate = layui.laydate;
//    var ediIndex = layedit.build('LAY_demo_editor');
//    var editIndex = layedit.build('LAY_editor');
//        form.verify({
//            content: function(value){
//                layedit.sync(editIndex);
//                layedit.sync(ediIndex);
//            }
//        });
        //监听提交
        form.on('submit(submitForm)', function (data) {
            return true;
        });

//        form.on('select(filter)', function(data){
//            var grade=data.value;
////            console.log(data.value); //得到被选中的值
//            $.ajax({
//                url:'/admin/agentDesc/getDesc',
//                dataType:'json',
//                data:{grade:grade},
//                success:function (data) {
//                    var val=data.data;
//                    $('#LAY_demo_editor').text(val.agent_solution);
//                    $('#LAY_editor').text(val.agent_advantage);
//
//                }
//            });
//        });
    });
    //切换修改内容
    $('#agent').change(function () {
        alert(123);
    });
    //提交后结果
    function cbFormSuccess(data) {
        layer.msg(data.msg);
        window.location.reload();
    }
    </script>
@endsection