<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%
String path = request.getContextPath();
String basePath = path + "/common/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<LINK rel="Bookmark" href="/favicon.ico" >
<LINK rel="Shortcut Icon" href="/favicon.ico" />
<!--[if lt IE 9]>
<script type="text/javascript" src="lib/html5.js"></script>
<script type="text/javascript" src="lib/respond.min.js"></script>
<script type="text/javascript" src="lib/PIE_IE678.js"></script>
<![endif]-->
<link href="<%=basePath %>admin/css/H-ui.min.css" rel="stylesheet" type="text/css" />
<link href="<%=basePath %>admin/css/H-ui.admin.css" rel="stylesheet" type="text/css" />
<link href="<%=basePath %>admin/css/style.css" rel="stylesheet" type="text/css" />
<link href="<%=basePath %>admin/lib/Hui-iconfont/1.0.1/iconfont.css" rel="stylesheet" type="text/css" />

<!--[if IE 6]>
<script type="text/javascript" src="http://lib.h-ui.net/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<title>图文素材管理</title>
<style type="text/css">
	.matext{font-size: 16px; color: #0088CC; font-weight: bold;}
	.maimg{width: 100%; height: 150px;}
</style>

</head>
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 微信管理 <span class="c-gray en">&gt;</span> 素材列表 <a class="btn btn-success radius r mr-20" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="pd-20" align="center">
  <div class="text-c bk-gray radius box-shadow" style="width: 800px;">
	<div class="text-l bk-gray radius pd-5 f-16 c-black"  style="background-color: #E8F5FF; font-weight: bold;">&nbsp;素材管理</div>
	<div class="text-c radius pt-10 pb-10" style="float: inherit;padding-left: 2%; padding-right: 2%;">
		<!-- 显示在左侧的素材 -->
		<div class="text-c f-l" style="width: 375px;">
			<!-- 添加素材按钮 -->
			<div class="text-c bk-gray radius pd-20 mt-20" style="border: 3px dashed gray;">
				<div class="f-l text-c" style="width: 40%;">
					<a href="${pageContext.request.contextPath }/admin/wx/showOneImageTextEdit" style="text-decoration: none;">
						<i class="Hui-iconfont f-100">&#xe646;</i><br/>+单图文
					</a>
				</div>
				<div class="f-r text-c" style="width: 40%;">
					<a href="${pageContext.request.contextPath }/admin/wx/showMoreImageTextEdit" style="text-decoration: none;">
						<i class="Hui-iconfont f-100">&#xe613;</i><br/>+多图文
					</a>
				</div>
			</div>
			<input type="hidden" id="token" value="${token }"/>
			<c:if test="${!empty resultLists }">
				<c:forEach items="${resultLists }" var="resultList" varStatus="status">
					<c:if test="${status.index%2 == 1 }">
					<!-- 一个图文素材 -->
					<div class="text-c bk-gray radius mt-20 box-shadow" id="imageTextShow${resultList.imageTextMD5 }">
						<div  class="text-l pl-10 pt-10 pr-10">
							<span class="matext">${resultList.title }</span>
							<p><fmt:formatDate value="${resultList.createtime }" pattern="yyyy-MM-dd"/></p>
						</div>
						<div class="text-c pl-10 pb-10 pr-10" style="border-bottom: 1px solid #E8F5FF;">
							<img src="${resultList.imageurl }" alt="图片" class="maimg"> 
						</div>
						<c:if test="${!empty (resultList.subVoList) }">
							<c:forEach items="${resultList.subVoList }" var="imageTextMore">
								<!-- 小图 -->
								<div class="text-l min_img box-shadow" style="border-bottom: 1px solid #E8F5FF;width: 100%; height: 70px;" id="minzhezhao">
									<div class="f-l mt-10  mt-10" style="width: 75%;">
										<p class="ml-10">&nbsp;&nbsp;${imageTextMore.title }</p>
									</div>
									<div class="f-r text-r mt-5 mb-5" style="width: 24%;">
										<img src="${imageTextMore.imageUrl }" alt="缩略图"  style="width: 60px; height: 60px; margin-right: 10px;"> 
									</div>
								</div>
							</c:forEach>
						</c:if>
						<div class="text-c " style="width: 100%; background-color: #E8F5FF; float: left;">
							<a href="${pageContext.request.contextPath }/admin/wx/toOneImageTextOrMoreImageText/${resultList.imageTextMD5 }">
							<!-- 编辑 -->
								<span class="text-c f-l"  style="width: 48%;" onclick="editImageTextAndMore('${resultList.imageTextMD5 }')">
									<i class="Hui-iconfont f-30">&#xe6df;</i>	
								</span>
							</a>
							<div class="text-c f-l f-30">|</div>
							<a href="javascript:void();" onclick="deleteImageText('${resultList.imageTextMD5 }')">
							<!-- 删除 -->
								<span class="text-c f-l"  style="width: 48%;">
									<i class="Hui-iconfont f-30">&#xe6e2;</i>
								</span>
							</a>
						</div>
					</div>
					</c:if>
				</c:forEach>
			</c:if>
		</div>
		<!-- 显示在右侧的素材 -->
		<div class="text-c f-r" style="width: 375px;">
			<c:if test="${!empty resultLists }">
				<c:forEach items="${resultLists }" var="resultList" varStatus="status">
					<c:if test="${status.index%2 == 0 }">
					<!-- 一个图文素材 -->
					<div class="text-c bk-gray radius mt-20 box-shadow" id="imageTextShow${resultList.imageTextMD5 }">
						<div  class="text-l pl-10 pt-10 pr-10">
							<span class="matext">${resultList.title }</span>
							<p><fmt:formatDate value="${resultList.createtime }" pattern="yyyy-MM-dd"/></p>
						</div>
						<div class="text-c pl-10 pb-10 pr-10" style="border-bottom: 1px solid #E8F5FF;">
							<img src="${resultList.imageurl }" alt="" class="maimg"> 
						</div>
						<c:if test="${!empty (resultList.subVoList) }">
							<c:forEach items="${resultList.subVoList }" var="imageTextMore">
								<!-- 小图 -->
								<div class="text-l min_img box-shadow" style="border-bottom: 1px solid #E8F5FF;width: 100%; height: 70px;" id="minzhezhao">
									<div class="f-l mt-10  mt-10" style="width: 75%;">
										<p class="ml-10">&nbsp;&nbsp;${imageTextMore.title }</p>
									</div>
									<div class="f-r text-r  mt-5 mb-5" style="width: 24%;">
										<img src="${imageTextMore.imageUrl }" alt="缩略图"  style="width: 60px; height: 60px; margin-right: 10px;"> 
									</div>
								</div>
							</c:forEach>
						</c:if>
						<div class="text-c" style="width: 100%; background-color: #E8F5FF; float: left;">
							<a href="${pageContext.request.contextPath }/admin/wx/toOneImageTextOrMoreImageText/${resultList.imageTextMD5 }">
								<span class="text-c f-l"  style="width: 48%;">
									<i class="Hui-iconfont f-30">&#xe6df;</i>	
								</span>
							</a>
							<div class="text-c f-l f-30">|</div>
							<a href="javascript:void();" onclick="deleteImageText('${resultList.imageTextMD5 }')">
								<span class="text-c f-l"  style="width: 48%;">
									<i class="Hui-iconfont f-30">&#xe6e2;</i>
								</span>
							</a>
						</div>
					</div>
					</c:if>
				</c:forEach>
			</c:if>
					
		</div>
	</div>
  <div align="right" class="mt-10 mb-10 mr-10">
		<%@include file="/common/other/paper/pager.jsp"%>
  </div>
  </div>
</div>
<script type="text/javascript" src="<%=basePath %>admin/lib/jquery/1.9.1/jquery.min.js"></script> 
<script type="text/javascript" src="<%=basePath %>admin/lib/Validform/5.3.2/Validform.min.js"></script>  
<script type="text/javascript" src="<%=basePath %>admin/lib/layer/1.9.3/layer.js"></script>
<script type="text/javascript" src="<%=basePath %>admin/js/H-ui.js"></script> 
<script type="text/javascript" src="<%=basePath %>admin/js/H-ui.admin.js"></script> 
<script type="text/javascript">

	function deleteImageText(id) {
		layer.confirm('确认要删除吗？',function(index){
			var url = "${pageContext.request.contextPath }/admin/wx/deleteImageTextByMainId/"+id+"/"+$("#token").val();
			var json = {"time":new Date()};
			$.post(url, json, function(result) {
				if(result.msg == "删除成功!") {
					//$("#imageTextShow"+id).remove();
					layer.msg(result.msg, {icon: 6,time:2000});
					location.href = "${pageContext.request.contextPath}/admin/wx//showMaterialList";
				} else {
					layer.msg(result.msg, {icon: 5,time:3000});
				}
			});
		});
	}
</script>
</body>
</html>