<?php if(!defined('IN_SDCMS')) exit;?>{include file="mobile/top.php"}
<title>在线留言_{sdcms[web_name]}</title>
<meta name="keywords" content="{sdcms[seo_key]}">
<meta name="description" content="{sdcms[seo_desc]}">
</head>

<body>
	{include file="mobile/head.php"}

    <article>
    	<section>
        	<div class="subject">
                <b>在线留言</b>
            </div>
            <div class="clear"></div>
            {sdcms:rs pagesize="10" num="3" table="sd_book" where="islock=1" order="ontop desc,id desc"}
            {rs:eof}暂无留言{/rs:eof}
            <div class="card mt-20">
                <div class="card-header"><h5>{$rs[truename]}</h5><div class="card-header-more text-gray">{date('Y-m-d H:i:s',$rs[createdate])}</div></div>
                <div class="card-body">
                    <div>{$rs[remark]}</div>
                </div>
                {if strlen($rs[reply])>0}
                <div class="card-footer">
                    <strong>回复：</strong>{$rs[reply]} 
                </div>
                {/if}
            </div>
            {/sdcms:rs}
            <div class="page page-center page-mid mt mb"><ul>{$showpage}</ul></div>
        </section>
        
        <section>
        	<div class="subject">
                <b>我要留言</b>
            </div>
            <div class="mt-20"></div>
            <form class="ui-form" method="post">
                <div class="form-group">
                    <input type="text" name="truename" class="form-ip" placeholder="请输入姓名" data-rule="姓名:required;">
                </div>
                <div class="form-group">
                    <input type="text" name="mobile" maxlength="11" class="form-ip" placeholder="请输入手机号码" data-rule="手机号码:required;mobile;">
                </div>
                <div class="form-group">
                    <input type="text" name="tel" class="form-ip" placeholder="请输入座机号码（可选）">
                </div>
                <div class="form-group">
                    <textarea name="remark" class="form-ip form-limit" data-max="255" rows="4" placeholder="请输入留言内容" data-rule="留言内容:required;"></textarea>
                    <div class="form-limit-text"><span>0</span>/255</div>
                </div>
                <div class="form-group">
                    <div class="input-group">
                        <input type="text" name="code" id="code" class="form-ip radius-right-none" placeholder="请输入验证码" data-rule="验证码:required;">
                        <div class="code"><img src="{U('code')}" height="40" id="verify" title="点击更换验证码"></div>
                    </div>
                </div>
                <div class="form-group row">
                    <input type="submit" class="btn btn-blue btn-block btn-big" value="提交">
                </div>
            </form>
        </section>
    </article>
    {include file="mobile/foot.php"}
<script>
$(function()
{
	$("#verify").click(function()
	{
		$(this).attr("src",$(this).attr("src")+"{iif(sdcms[url_mode]==1,"&","?")}rnd="+Math.round());
		$("#code").val("");
	});
	$(".ui-form").form(
	{
		type:2,
		align:'bottom-center',
		result:function(form)
		{
			$.ajax(
			{
				type:'post',
				cache:false,
				dataType:'json',
				url:'{THIS_LOCAL}',
				data:$(form).serialize(),
				error:function(e){alert(e.responseText);},
				success:function(d)
				{
					if(d.state=='success')
					{
						sdcms.success(d.msg);
						setTimeout(function(){location.href='{THIS_LOCAL}';},1500);
					}
					else
					{
						$("#verify").click();
						sdcms.error(d.msg);
					}  
				}
			});
		}
	});
})
</script>
</body>
</html>