<?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}<div class="ui-pt-15">暂无留言</div>{/rs:eof}
            <div class="ui-card ui-card-book ui-mt-20 ui-scrollspy" data-am="ui-am-slide-bottom" data-time="{$i*100}">
                <div class="ui-card-header"><div class="ui-card-header-title">{$rs[truename]}</div><div class="ui-card-header-more ui-text-gray">{date('Y-m-d H:i',$rs[createdate])}</div></div>
                <div class="ui-card-body">
                    <div>{$rs[remark]}</div>
                </div>
                {if strlen($rs[reply])>0}
                <div class="ui-card-footer">
                    <strong>回复：</strong>{$rs[reply]} 
                </div>
                {/if}
            </div>
            {/sdcms:rs}
            <div class="ui-page ui-page-center ui-page-blue ui-page-mid ui-mt-20 ui-mb"><ul>{$showpage}</ul></div>
        </section>
        
        <section>
        	<div class="subject">
                <b>我要留言</b>
            </div>
            <div class="ui-mt-20"></div>
            <form class="ui-form" method="post">
                <div class="ui-form-group">
                    <input type="text" name="truename" class="ui-form-ip" placeholder="请输入姓名" data-rule="姓名:required;">
                </div>
                <div class="ui-form-group">
                    <input type="text" name="mobile" maxlength="11" class="ui-form-ip" placeholder="请输入手机号码" data-rule="手机号码:required;mobile;">
                </div>
                <div class="ui-form-group">
                    <input type="text" name="tel" class="ui-form-ip" placeholder="请输入座机号码（可选）">
                </div>
                <div class="ui-form-group">
                    <textarea name="remark" class="ui-form-ip ui-form-limit" data-max="255" rows="4" placeholder="请输入留言内容" data-rule="留言内容:required;"></textarea>
                    <div class="ui-form-limit-text"><span>0</span>/255</div>
                </div>
                <div class="ui-form-group">
                    <div class="ui-input-group">
                        <input type="text" name="code" id="code" class="ui-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="ui-form-group ui-row">
                	<input type="hidden" name="token" value="{$token}">
                    <input type="submit" class="ui-btn ui-btn-blue ui-btn-block ui-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:'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>