<header class="uc_head">
	<h3 class="current">短消息</h3>
</header>
{set:$queryMessageList = Api::run('getUcenterMessageList',$msgIds)}
{set:$queryMessage = $queryMessageList->find()}
{if:$queryMessage}
<section class="uc_table">
	<table>
		<thead>
			<tr>
				<th>标题</th><th>发送时间</th><th>状态</th><th>操作</th>
			</tr>
		</thead>
		<tbody>
			{foreach:items = $queryMessage}
			<tr>
				<td><h4>{$item['title']}</h4></td>
				<td>{$item['time']}</td>
				<td id="msg_id_{$item['id']}">{if:$msgObj->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:void(0)" onclick='show_msg(this,{echo:JSON::encode($item)})'>查看</a>
				</td>
			</tr>
			{/foreach}
			<tr id='show_msg' class="" style="display:none">
				<td colspan="4">
					<div class="show_message">
						<div class="close" onclick='$("#show_msg").hide();'></div>
						<strong>详细内容：</strong>
						<p id='content'></p>
					</div>
				</td>
			</tr>
		</tbody>
	</table>
</section>
{else:}
<section class="nodata">暂无数据</section>
{/if}
{$queryMessageList->getPageBar()}


<script type="text/javascript">
//阅读消息
function show_msg(_self,obj)
{
	$('#show_msg').insertAfter($(_self).parent().parent());
	$('#show_msg #content').html(obj.content);
	$('#show_msg').show();

	$.get("{url:/ucenter/message_read}",{"id":obj.id},function(data){
		if(data == 1)
		{
			$("#msg_id_"+obj.id).addClass('bold');
			$("#msg_id_"+obj.id).html('已读');
		}
	});
}
</script>
