<!DOCTYPE html>
<html>
<head>
@include('admin.common_bak.header')
<!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>

    <![endif]-->

   {{-- <script type="text/javascript" charset="utf-8" src="{{ asset('laravel-u-editor/ueditor.config.js') }}"></script>
    <script type="text/javascript" charset="utf-8" src="{{ asset('laravel-u-editor/ueditor.all.min.js') }}"> </script>
    <!--建议手动加在语言，避免在ie下有时因为加载语言失败导致编辑器加载失败-->
    <!--这里加载的语言文件会覆盖你在配置项目里添加的语言类型，比如你在配置项目里配置的是英文，这里加载的中文，那最后就是中文-->
    <script type="text/javascript" charset="utf-8" src="{{ asset('laravel-u-editor/lang/zh-cn/zh-cn.js') }}"></script>

--}}
    <!-- 引用控制层插件样式 -->
    <script src="{{asset('fileupload/js/vendor/jquery.ui.widget.js')}}"></script>
    <script src="{{asset('fileupload/js/jquery.fileupload.js')}}"></script>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>

</head>

<body>
<div class="x-body layui-anim layui-anim-up">
    <form class="layui-form">
        {{ csrf_field() }}
        <div class="layui-form-item" style="width: 50%">
            <input type="hidden" name="id" value="{{$id}}">
            <label class="layui-form-label">新闻标题</label>
            <div class="layui-input-block">
                <input type="text" name="title" readonly   class="layui-input" value="{{urldecode($title)}}" style="width:500px;">
                <div class="layui-form-mid layui-word-aux"></div>
            </div>
        </div>

        <div class="layui-form-item" style="width: 50%">
            <label class="layui-form-label">发布时间</label>
            <div class="layui-input-block">
                <input class="layui-input"  type="text" id="new_datetime" name="new_datetime" readonly placeholder="请输入新闻时间" autocomplete="off" value="{{$new_datetime}}">
                <div class="layui-form-mid layui-word-aux">请选择新闻发布时间</div>
            </div>
        </div>


        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn" lay-submit lay-filter="add">立即提交</button>
            </div>
        </div>
    </form>


</div>
<script>
    layui.use(['laydate','table'], function(){
        $ = layui.jquery;
        var form = layui.form
            ,layer = layui.layer
            ,laydate = layui.laydate

        //执行一个laydate实例
         laydate.render({
            elem: '#new_datetime', //指定元素
            type:  'datetime',
            format:'yyyy-MM-dd HH:mm:ss',
        });
        //监听提交
        form.on('submit(add)', function(data){
            var aa = layer.load(1);
            //发异步，把数据提交给php
            var formdata = new FormData(data.form);
            $('#sub').attr('disabled','disabled').css({'background':'#d4d4d4'});
            fetch_response('POST',"/web/news/modified_newDatetime",formdata).then(function(res){
                if(res.code==200){
                    layer.close(aa);
                    layer.alert("修改成功", {icon: 6},function () {
                        window.parent.location.reload(); //刷新父页面
                        var index = parent.layer.getFrameIndex(window.name);// 获得frame索引
                        parent.layer.close(index);//关闭当前frame
                    });
                }else{
                    layer.close(aa);
                    layer.msg(res.msg,{icon:5});
                    $('#sub').removeAttr('disabled').css('background','#009688');
                }
            })
            return false;
        });

    });

</script>
</body>

</html>