layui.use(["layer", "form", "laydate", "upload"], function(){
    $ = layui.$;
    form = layui.form;
    layer = layui.layer;
    laydate = layui.laydate;
    upload = layui.upload;
    //视频
    upload.render({
        elem: '.file_videos' //绑定元素
        ,url: '/upload/uploadFile' //上传接口
        ,method: 'post'  //可选项。HTTP类型，默认post
        ,accept: 'video'
        ,acceptMime: 'video/*'
        ,headers: {token: token}
        ,done: function(res){
            $(this.item[0]).parent().next().append("<video src="+ res.data +" controls=\"\" data-v-400c2eb9=\"\"></video>");
        }
        ,error: function(){
            //请求异常回调
        }
    });

    //图片上传
    upload.render({
        elem: '.file_img' //绑定元素
        ,url: '/upload/uploadFile' //上传接口
        ,method: 'post'  //可选项。HTTP类型，默认post
        ,accept: 'images'
        ,acceptMime: 'image/*'
        ,headers: {token: token}
        ,done: function(res){
            $(this.item[0]).parent().next().append("<div class=\"editor-assets-content-info\" data-v-400c2eb9=\"\">\n" +
                "                                    <div class=\"el-image\" data-v-400c2eb9=\"\"><img alt=\"upload-assets\"\n" +
                "                                                                                  src="+ res.data +"\n" +
                "                                                                                  class=\"el-image__inner el-image__preview\"\n" +
                "                                                                                  style=\"object-fit: cover;\"><!--v-if-->\n" +
                "                                    </div>\n" +
                "                                    <svg viewBox=\"0 0 1024 1024\" xmlns=\"http://www.w3.org/2000/svg\" onclick=\"closeSvg(this)\" data-v-400c2eb9=\"\">\n" +
                "                                        <path fill=\"currentColor\"\n" +
                "                                              d=\"M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896zm0 393.664L407.936 353.6a38.4 38.4 0 1 0-54.336 54.336L457.664 512 353.6 616.064a38.4 38.4 0 1 0 54.336 54.336L512 566.336 616.064 670.4a38.4 38.4 0 1 0 54.336-54.336L566.336 512 670.4 407.936a38.4 38.4 0 1 0-54.336-54.336L512 457.664z\"></path>\n" +
                "                                    </svg>\n" +
                "                                </div>");
        }
        ,error: function(){
            //请求异常回调
        }
    });

    laydate.render({
        elem: '.select_date_input'
        ,format: 'yyyy.MM.dd'
    });

    //点击加号新增时间点
    $(document).on("click",".add_date",(e) => {
        $(".add_date").css("bottom", "5px");
        $(".positioning_div").append("<div class=\"date_content_div\">\n" +
            "<input type=\"text\" class=\"layui-input date_hours_content_input\" placeholder=\"请输入时间\">\n" +
            "<input type=\"text\" class=\"layui-input date_hours_content date_content_input\" placeholder=\"请输入内容\">\n" +
            "</div>")
    });

    getPrivateOrder(); //数据渲染

    getData();//内容渲染
});