@using GBLab.Common.Expand;
@using System.Text;
@{
    Layout = "~/Views/School_Pre/Shared/_Layout.cshtml";
    var data = ViewData["data"] as GBLab.Entities.T_CmsGuestBookPager;
    StringBuilder sb = new StringBuilder();
}
@section HeadStyle{
}
@section JavaScript{
    <script type="text/javascript">
        $(function () {
            $("#sub").click(function () {
                subGuestBook();
            });
        });
        function subGuestBook() {
            var name = $('input[name="name"]').val();
            var qq = $('input[name="qq"]').val();
            var title = $('input[name="title"]').val();
            var content = $('textarea[name="content"]').val();
            var typeid = @(ViewContext.RouteData.Values["typeId"].ToString());
            var code = $('input[name="code"]').val();

            // 获取分类信息
            $.ajax({
                type: "POST",
                url: "/cmsguestbook/sub",
                data: "name=" + name + "&title=" + title + "&qq=" + qq + "&content=" + content + "&typeid=" + typeid+ "&code=" + code,
                success: function (data) {
                    var result = $.parseJSON(data);
                    if (result != null && result != undefined) {
                        if (result.statusCode === 200) {
                            alert("[成功]" + result.message);
                            setTimeout("location.reload();", 2000)
                        }
                        if (result.statusCode === 300) {
                            alert("[失败]" + result.message)
                        }
                    }
                },
                error: function (data) {
                    alert('数据提交失败，请联系管理员。')
                }
            });

            console.log(name);
        }
    </script>
}
@{Html.RenderPartial("~/Views/School_Pre/Shared/_Part/_HeaderAd.cshtml");}
@{Html.RenderPartial("~/Views/School_Pre/Views/Module/Common/HeadPath.cshtml");}
<div class="box">
    <div class="guestbooklist col-md-8">
        <div class="leftmenulisthead bs-info">留言列表</div>
        @{
            foreach (var item in data.Data)
            {
                <div class="FeedBlock">
                    <div class="Fleft">
                        <div class="Ficon">
                            <img src="/Resource/Skin/School_Pre/images/PostIcon.gif">
                        </div>
                        <div class="Fname">@(item.F_Name.DefaultIsNullOrEmpty(""))</div>
                    </div>
                    <div class="Fright">
                        <div class="Fcontent">
                            <div class="Ftime">@("留言时间：" + item.F_AddDate.ToString("yyyy-MM-dd hh:mm:ss"))</div>
                            <p class="title">@(item.F_Title.DefaultIsNullOrEmpty(""))</p>
                            <p class="info">@(item.F_Info.DefaultIsNullOrEmpty(""))</p>
                        </div>
                        @if (item.F_ReInfo.DefaultIsNullOrEmpty("") != "")
                        {
                            <div class="Fcontent topnoline">
                                <div class="Ftime">@("回复时间：" + item.F_UpdateDate.ToString("yyyy-MM-dd hh:mm:ss"))</div>
                                <p class="info">@(item.F_ReInfo.DefaultIsNullOrEmpty(""))</p>
                            </div>
                        }
                        <div class="Fline"></div>
                        <div class="clearfix"></div>
                    </div>
                </div>
            }
        }
        <div class="list_pager">
            <nav aria-label="Page navigation">
                <ul class="pagination">
                    @{
                        if (data.rowCount > 10)
                        {
                            @(Html.GetPagerQyyShop(Html.TranPager(data.currentPage, data.resultPage, data.pageSize, data.rowCount), Url.Domain_RouteUrl("Site.CmsGuestBook.Node.ListPage", new { pageindex = "{page}" })))
                        }
                    }
                </ul>
            </nav>
        </div>
        <div class="leftmenulisthead bs-info">提交留言</div>
        <div class="guestbooksub">
            <table border="0" align="center" cellpadding="0" cellspacing="0">
                <tbody>
                    <tr>
                        <td class="tbleft">姓名：</td>
                        <td class="tbright"><input name="name" type="text" size="30" maxlength="30"><span class="FontRed">*</span></td>
                    </tr>
                    <tr>
                        <td class="tbleft">QQ：</td>
                        <td class="tbright"><input name="qq" type="text" size="30" maxlength="30"><span class="FontRed">*</span></td>
                    </tr>
                    <tr>
                        <td class="tbleft">标题：</td>
                        <td class="tbright"><input name="title" type="text" size="30" maxlength="30"><span class="FontRed">*</span></td>
                    </tr>
                    <tr>
                        <td class="tbleft">内容：</td>
                        <td class="tbright">
                            <textarea name="content" rows="7"></textarea>
                            <span class="FontRed">*</span>
                        </td>
                    </tr>
                    <tr>
                        <td class="tbleft">验证码：</td>
                        <td class="tbright">
                            <input name="code" maxlength="5" size="10">
                            <span class="FontRed">*</span>
                            <img src="/Code.aspx" width="55" onclick="this.src=this.src+'?'" style="cursor:hand;">
                            <br />
                            <span class="FontRed">图片看不清？点击重新得到验证码</span>
                        </td>
                    </tr>
                    <tr>
                        <td class="tbleft">&nbsp;</td>
                        <td class="tbright">
                            <button id="sub" type="button">发表留言</button>
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
    </div>
    <div class="col-xs-12 col-md-4">
        @{Html.RenderPartial("~/Views/School_Pre/Views/Module/Common/Menu.cshtml");}
        @{Html.RenderPartial("~/Views/School_Pre/Views/Module/CmsGuestBook/_Part/Top10.cshtml");}
    </div>
</div>