<header class="uc_head">
	<h3>短消息</h3>
</header>
<section class="uc_table">
	<table>
		<thead>
			<tr>
				<th>标题</th><th width="200">发送时间</th><th width="100">状态</th><th width="100">操作</th>
			</tr>
		</thead>
		<tbody>
		    {set:$queryMessageList = Api::run('getUcenterMessageList');}
			{foreach:items = $queryMessageList->find()}
			<tr>
				<td><h4>{$item['title']}</h4></td>
				<td>{$item['time']}</td>
				<td id="msg_id_{$item['id']}">{if:$queryMessageList->msg->is_read($item['id'])}已读{else:}未读{/if}</td>
				<td class="blue">
					<a class='blue' href="{url:/ucenter/message_del/id/$item['id']}">删除</a>
					<a class="blue" href="javascript:show_msg({$item['id']});">查看</a>
				</td>
			</tr>
			{/foreach}

		</tbody>
	</table>
</section>
{$queryMessageList->getPageBar()}

{if:!$items}
<section class="no_tip">暂无数据</section>
{/if}

<script type="text/javascript">
function show_msg(id)
{
    $.getJSON("{url:/ucenter/message_read}",{"id":id},function(json)
    {
	    if(json.status == 'success')
	    {
	    	$("#msg_id_"+id).html('已读');
	    	art.dialog({'content':json.data.content,'title':json.data.title,ok:function(){return true;}});
	    }
	    else
	    {
	        alert(json.error);
	    }
    });
}
</script>
