@extends('vip.layouts')
@section('content')
<!--blues-->
    <form class="layui-form" action="{{ url()->full() }}" id="submitForm" name="submitForm" method="post" eventType=eventAjaxForm>
        {!! csrf_field() !!}
        @if(S('ACTION')=='add')
        <div class="layui-form-item">
            <label class="layui-form-label">版本号</label>
            <div class="layui-input-block">
                <input type="text" name="version_no" autocomplete="off" class="layui-input"
                       value="{{isset($datas['version_no'])?$datas['version_no']:''}}">
            </div>
        </div>
        @endif

        @if(S('ACTION')=='edit')
        <div class="layui-form-item">
            <label class="layui-form-label">版本号</label>
            <div class="layui-input-block">
                <input type="text" name="version_no" autocomplete="off" class="layui-input"
                       value="{{isset($data['version_no'])?$data['version_no']:''}}">
            </div>
        </div>
        @endif

        <div class="layui-form-item">
            <label class="layui-form-label">版本介绍</label>
            <div class="layui-input-block">
                <textarea  name="version_details"  id="myEditor1" style="width:1000px;height:240px;">{{isset($data['version_details'])?$data['version_details']:''}}</textarea>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">详细说明</label>
            <div class="layui-input-block">
                <textarea  name="version_remark"  id="myEditor2" style="width:1000px;height:240px;">{{isset($data['version_remark'])?$data['version_remark']:''}}</textarea>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">设备</label>
            <div class="layui-input-block">
                <input type="radio" name="settype" value="0"    @if(isset($data['settype'])&&$data['settype']==0)checked @endif title="WEB" >
                <input type="radio" name="settype" value="1"  @if(isset($data['settype'])&&$data['settype']==1)checked @endif title="IOS" >
                <input type="radio" name="settype" value="2"  @if(isset($data['settype'])&&$data['settype']==2)checked @endif title="ANDROID" >
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">是否禁用</label>
            <div class="layui-input-block">
                <input type="radio" name="status" value="1" title="启用"  @if(isset($data['status'])&&$data['status']==1)checked @endif >
                <input type="radio" name="status" value="0" title="禁用"  @if(isset($data['status'])&&$data['status']==0)checked @endif>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">APP版本</label>
            <div class="layui-input-block">
                <input type="text" name="app_version"    class="layui-input"
                       value="{{isset($data['other'])?$data['other']:''}}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">下载地址</label>
            <div class="layui-input-block">
                <input type="text" name="download_url"    class="layui-input"
                       value="{{isset($data['download_url'])?$data['download_url']:''}}">
            </div>
        </div>


        <div class="layui-form-item">
            <div class="layui-input-block">
                @if(checkRriv('/admin/Notice/view'))<button class="layui-btn" lay-submit lay-filter="submitForm">立即提交</button>@endif
                <button type="reset" class="layui-btn layui-btn-normal">重置</button>
            </div>
        </div>
    </form>
    <link href={{ asset("baidu/themes/default/css/umeditor.css") }} type="text/css" rel="stylesheet">
    <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
        layui.use(['form', 'layedit', 'laydate'], function () {
            var form = layui.form
                , layer = layui.layer
                , layedit = layui.layedit
                , laydate = layui.laydate;
            //图片上传接口
            layedit.set({
                uploadImage: {
                    url: '/admin/notice/upImg' //接口url
                    ,type: 'post' //默认post
                }
            });
            var um = UM.getEditor('myEditor1');
            var um = UM.getEditor('myEditor2',{
                initialFrameWidth : 1000,
                initialFrameHeight: 400
            });


            form.verify({
                title: function(value){
                    if(value.length < 4){
                        return '标题至少得4个字符啊';
                    }
                }
                ,pass: [/(.+){6,12}$/, '密码必须6到12位']
                ,content: function(value){
                    layedit.sync(editIndex);
                }
            });
            form.on('select(testSelect)', function(data){
               console.log(data.value);
               if (data.value==20) {
                    $('.single').show();
                    // $('#labels').hide();
               }else{
                   $('.single').hide();
                   // $('#labels').show();
               }
            });

            //监听提交
            form.on('submit(submitForm)', function (data) {

                return true
            });


        });
        //创建一个编辑器
function cbFormSuccess(data){
	layer.msg(data.msg);
	setTimeout(function(){
        window.history.back(-1);
    },1);
}
</script>
@endsection