<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort() + path+"/";
	request.setAttribute("contextPath", basePath);
	
	String redirectUrl= request.getParameter("redirectUrl");
	request.setAttribute("redirectUrl", redirectUrl);
%>
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="format-detection" content="telephone=no">
    <title>消息通知</title>
    <script type="text/javascript" src="${contextPath }res/js/jquery.min.js"></script>
    <script src="${contextPath }app/lib/flexible.js"></script>
    <link rel="stylesheet" href="${contextPath }app/lib/flexible.css">
	<link rel="stylesheet" href="${contextPath }app/css/basem.css">
	<link rel="stylesheet" href="${contextPath }app/css/logome.css">
</head>
<body>
	<div class="titbox blubg">
		<a class="titreturn left" href="${contextPath }web/mgmUserCtl/index.cs?userId=${USER_ID}"><img src="${contextPath }app/img/fanhui16@2x.png" alt=""></a>
		<h1>消息通知</h1>
	</div>
	<div class="top50">
		<div class="safe">
			<ul>
			<c:forEach  items="${lists}" var="message">
			    <c:if test="${message.state==0}">
					<li class="messageli" id="F${message.id}">
							<h2 class="metime"  style="color: #000">${message.createDate}<i>【未读】</i></h2>
							<p class="messagep" onclick="updateState(${message.id},this)" style="color: #000" >${message.content}</p>
					</li>
				</c:if>
				 <c:if test="${message.state==1}">
					<li class="messageli" id="F${message.id}">
							<h2 class="metime">${message.createDate}<i>【已读】</i></h2>
							<p class="messagep"  style="color:#666">${message.content}</p>
					</li>
				</c:if>
			</c:forEach>
			</ul> 
		</div>	
	</div>
	
</body>
<script type="text/javascript">
		function updateState(id){
			 $.post('${contextPath }web/messageWebCtl/updateMgmMessageState.cs', {
					"id" : id
				}, function(data) {
					var datas=eval(data.data);
					if (data.ret == 1) {
						 $("#F"+id+" h2 i").html("【已读】"); 
						 $("#F"+id+" h2").css("color","#666");
						 $("#F"+id+" p").css("color","#666");
					}else{
						layer.msg(data.msg);
					}
				}, "json"); 
		 }
	</script>
</html>