<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<script type="text/javascript">
    layui.use(['form', 'layedit', 'laydate'], function(){
        var form = layui.form;
        form.render();
        //自定义验证规则
        form.verify({
        context: function(value){
            if(value.length <=0){
                return '请选择导入的文件';
            }
        }
    });
    var newText1 = parent.$('#addtext').val();
        $("#newText1").val(newText1);
    })
    function doSubmit(obj){
        if ($("#myfile").val()==null||$("#myfile").val()==""){
            layer.msg("请选择文件",{icon: 3});
            throw SyntaxError;
        }
        if ($("#inputwrite").val()==null||$("#inputwrite").val()==""){
            layer.msg("请输入项目名称",{icon:3});
            throw SyntaxError;
        }
    layer.msg('加载中', {
        icon: 16
        ,shade: 0.01
        ,offset:['35%','36%']
    });
    $.ajax({
        type: "post",
        url: "${ctx}/project/tem/verfiy",
        // contentType: 'application/x-www-form-urlencoded;charset=utf-8',
        data: {projectName:$("#inputwrite").val(),projectId:$("#newText1").val()},
        dataType: "json",
        success: function(data){
            if(data.code=="1"){
                $("#inputForm").submit();
            }else{
                layer.msg(data.msg, {icon: 5,offset:['33%','33%']});
            }
        }
        });
    }
    $(document).ready(function() {
    // 选择文件触发事件
        $("#btnxz").click(function(){
            $("#myfile").trigger("click");
        })

        $("#myfile").bind("change",function(){
            var solr_file= $("#myfile").val();
            $("#view_input").val(solr_file);
        })
    })
</script>