@{
    CurrentUser user = new CurrentUser();
    string table = Request.QueryString["table"];
    int tableId = ViewBag.TableId;
    IEnumerable<dynamic>
    fieldData = Html.GetFieldList((string)ViewBag.Table, "Add", user, PageAdmin.Common.FromEnum.Guest);
}

<div class="main">
    <div class="form">
        <div class="controls">
            <textarea id="content" spellcheck="false" style="height:80%" class="form-control">
                     <!--需要先引用以下js文件，并保证每个页面只引用一次,多余脚本代码请自行优化-->
            <link rel="stylesheet" href="/Incs/bootstrap/css/bootstrap.min.css">

            <link rel="stylesheet" href="/Incs/font-awesome/css/font-awesome.min.css">

            <script src="/Js/jquery.min.js" type="text/javascript"></script>
            <script src="/Js/basic.js" type="text/javascript"></script>
            <script src="/Js/UI/ui.js" type="text/javascript"></script>
            <script src="~/Incs/UEditor/ueditor.config.js" type="text/javascript"></script>
            <script src="~/Incs/UEditor/ueditor.all.min.js" type="text/javascript"></script>
            <form method="post" class="ui-validForm container" v-validate-params="beforeSubmit:'BeforeSubmit',tipsStyle:1">
                    @{
                        string html = "";
                        string beforeSubmitJs = "";
                        var data = new ViewDataDictionary();
                        data.Add("from", PageAdmin.Common.FromEnum.Guest);
                        data.Add("currentUser", user);
                        data.Add("i", 0);
                        int i = 0;
                        if (fieldData != null)
                        {
                            foreach (var row in fieldData)
                            {
                                data["i"] = i;
                                beforeSubmitJs += row.BeforeSubmitJs;
                                html += Convert.ToString(Html.Partial("~/Areas/E/Views/CustomForm/FormPartial.cshtml", (object)row, data));
                                i++;
                            }
                        }}
                    @html
            <div class="form-group">
            <label class="control-label" for="_VerificationCode">验证码*</label>
            <div class="controls">
            <input type="text" id="_VerificationCode" name="_VerificationCode" class="form-control" maxlength="5" placeholder="验证码" v-validate="dataType:'*',nullMsg:'请填写验证码!',minLength:4,minLengthErrorMsg:'验证码最少4个字符!',checkUrl:'/E/VerificationCode/Validate',checkError:'验证码填写错误!'">

            <img src="/E/VerificationCode/" id="_VerificationCodeImg" class="ui-verificationCodeImage" />

            <span class="help-block"></span>
                        </div>
                    </div>
            <div class="form-group">
            <div class="controls">
                            @@Html.AntiForgeryToken()
            <input type="hidden" name="Table" id="Table" value="@table" />

            <input type="hidden" name="Id" id="Id" value="0" />

            <input type="hidden" name="ParentId" id="ParentId" value="0" />

            <input type="hidden" name="ParentGuid" id="ParentGuid" value="" />

            <input type="hidden" name="Guid" id="Guid" value="@("@")Html.Guid()" />

            <button type="button" class="btn  btn-primary ui-pagePost" data-custom-params="url:'/e/SubData/Add',callback:'CallBack',successMsg:'提交成功'">提交</button>
                        </div>
                    </div>
            <script type="text/javascript">
                //提交前验证
                function BeforeSubmit() {
                    //提交前的验证
                    return true;
                }
                //回调函数
                function CallBack(tipsInfo) {
                    if (tipsInfo.State == 1) {
                        Alert("提交成功！", { icon: 1, closeBtn: 0 }, function () { location.href = location.href });
                    }
                    else {
                        alert(msg);
                    }
                }
</script>
                </form>
                      </textarea>
        </div>
        <span class="help-block"><span class="glyphicon glyphicon-info-sign"></span>此表单可用于前端投稿，复制html到视图模板页面中做成模板页即可</span>
    </div>

<div class="submit-footerbar">
    <label class="control-label"></label>
    <div class="controls">
        <button type="button" class="btn btn-primary btn-sm ui-closeDialog">确定</button>
        <button type="button" class="btn btn-sm btn-default ui-closeDialog">关闭</button>
    </div>
</div>
</div>

<script type="text/javascript">
    var winHeight = $(window).height();
    $("#content").css("height", (winHeight - 150) + "px");
</script>


