<div class="main f_r">
    <div class="uc_title m_10">
        <label class="current"><span>短消息</span></label>
    </div>
    <table class="list_table m_10" width="100%" cellpadding="0" cellspacing="0">
    	<colgroup>
	        <col />
	        <col width="160px" />
	        <col width="120px" />
	        <col width="120px" />
    	</colgroup>

        <thead><tr><th>标题</th><th>发送时间</th><th>状态</th><th>操作</th></tr></thead>
		<tbody>
        	{set:$queryMessageList = Api::run('getUcenterMessageList',$msgIds)}
			{foreach:items = $queryMessageList->find()}
        	<tr>
            	<td class="t_l"><label class="blue">{$item['title']}</label></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>
			{/query}

            <tr id='show_msg' class="show" style="display:none">
            	<td colspan="4">
            		<i class="close f_r" onclick='$("#show_msg").hide();'></i>
            		<b class="orange">详细内容：</b><p class="gray indent mt_10" id='content'></p>
            	</td>
            </tr>
        </tbody>
        <tfoot><tr><td colspan="4" class="t_l">{$queryMessageList->getPageBar()}</td></tr></tfoot>
    </table>
</div>

<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>