@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">
                <input name="title" type="text" value="代理规则" readonly="readonly">
            </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">
                <textarea name="contents"  rows="100" cols="150" lay-verify=""  id="myEditor" >{{isset($data['content'])?$data['content']:''}}</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('myEditor');
    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');
        form.verify({
            content: function(value){
                layedit.sync(ediIndex);
            }
        });
        //监听提交
        form.on('submit(submitForm)', function (data) {
            return true;
        });
    });
    //提交后结果
    function cbFormSuccess(data) {
        layer.msg(data.msg);
        window.location.reload();
    }
    </script>
@endsection