<%@ page language="C#" autoeventwireup="true" inherits="user_eInfo, kfenlei" %><%@ Register Src="~/inc/top.ascx" TagPrefix="qth8" TagName="top" %><%@ Register Src="~/inc/foot.ascx" TagPrefix="qth8" TagName="foot" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>修改“<%=title %>”信息 - <%=sWebName %></title>
<link rel="stylesheet" href="/template/css.css" type="text/css" />
<link rel="stylesheet" href="/template/top.css" type="text/css" />
</head>
<body>
<div align="center">
<qth8:top ID="top" runat="server" />
<script type="text/javascript" language="javascript" src="/js/layui.js"></script>
<link href="/js/css/layui.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
layui.use(['form','laydate'], function(){
var form = layui.form();
    form.render();
	form.on('select(address)', function(data){
acLoadAddress($("#address").val(),"");
valiPost('exAddress');
});
});
</script>
<div class="main">
<div class="postDiv">
<div class="postLeft">
<div class="postTitle1">修改“<%=title %>”信息<div class="postTitle1s">带<span style="color:#FF0000; font-size:14px; padding:5px;">*</span>为必填项</div></div>
<form action="/action/?s=editMess" class="layui-form" method="post" onsubmit="return valiPost('all')" name="postmess">
<input type="hidden" value="<%=adminpassword %>" name="adminpassword" /><input type="hidden" value="<%=sId%>" name="id" /><input type="hidden" name="sort" value="<%=sSort %>" />
<table width="830" class="formTable" border="0" cellpadding="5" cellspacing="0">
<tr>
<td class="head" width="100"><span class="notnull">*</span>标题：</td>
<td><input type="text" name="title" id="title" onblur="valiPost('exTitle')" class="textInput" value="<%=title %>"/><div class="exDiv" id="exTitle"></div></td>
</tr>
<tr>
<td  class="head"><span class="notnull">*</span>内容：</td>
<td><textarea name="content" class="postTextarea" id="content" onblur="valiPost('exContent')" rows="6" cols="60"><%=content %></textarea><div class="exDiv" id="exContent"></div></td>
</tr>
<%if(iPicCount>0){%>
<tr>
<td class="head">上传图片：</td>
<td><div id="swfupload-control">
<div class="fl5"><input type="button" id="button" /></div>
<div class="exDiv">可以上传<%=sPicCount%>张图片，图片请小于<%=sPicSize1%>。</div>
<div class="clear"></div>
<ul id="preview"></ul>
</div>
<input type="hidden" name="pic" id="pic" value="<%=pic %>" />
<script type="text/javascript" src="<%=sPostPath%>inc/swfupload/swfupload.js"></script>
<script type="text/javascript" src="<%=sPostPath%>inc/jquery.swfupload.js"></script>
<script type="text/javascript">
var s1;
$(function(){
	$('#swfupload-control').swfupload({
		upload_url: "<%=sPostPath%>inc/upload.aspx",
		file_post_name: 'uploadfile',
		file_size_limit : "<%=sPicSize%>",
		file_types : "<%=sUploadType %>",
		file_types_description : "Image files",
		file_upload_limit : <%=sPicCount%>,
		flash_url : "<%=sPostPath%>inc/swfupload.swf",
		button_image_url:'<%=sPostPath%>inc/button.png',
		button_width : 110,
		button_height : 42,
		button_placeholder : $('#button')[0],
		debug: false
	})
		.bind('fileQueued', function(event, file){
			var listitem='<li id="'+file.id+'" >'+
				'<div class="pic" id="pic'+file.id+'"></div>'+
				'<div class="progressbar" ><div class="progress"></div></div>'+
				'<p class="status" >等待上传 | <span class="cancel">删除</span></p>'+
				'</li>';
			$('#preview').append(listitem);
			$('li#'+file.id+' .cancel').bind('click', function(){
				var swfu = $.swfupload.getInstance('#swfupload-control');
				swfu.cancelUpload(file.id);
				$('li#'+file.id).slideUp('fast');
			});
			// start the upload since it's queued
			$(this).swfupload('startUpload');
		})
		.bind('fileQueueError',function(event, file, errorCode, message){
		if(errorCode=='-100')
		{
			alert('最多可以上传<%=sPicCount%>张图片！');
		}
		else
		{
			alert('图片：【'+file.name+'】过大，单张图片请不要超过<%=sPicSize1%>！');
		}
		})
		.bind('fileDialogComplete', function(event, numFilesSelected, numFilesQueued){
			$('#queuestatus').text('');
		})
		.bind('uploadStart', function(event, file){
			$('#preview li#'+file.id).find('p.status').text('0%上传中...');
			$('#preview li#'+file.id).find('span.cancel').hide();
		})
		.bind('uploadProgress', function(event, file, bytesLoaded){
			//Show Progress
			var percentage=Math.round((bytesLoaded/file.size)*100);
			$('#preview li#'+file.id).find('div.progress').css('width', percentage+'%');
			$('#preview li#'+file.id).find('p.status').text(percentage+'%上传中...');
		})
		.bind('uploadSuccess', function(event, file, serverData){
			var item=$('#preview li#'+file.id);
			item.find('div.progress').css('width', '100%');
			item.addClass('success').find('p.status').html('100%上传成功! | <span class="cancel" onclick="delPic(\''+file.id+'\')">删除</span>');
			_q("pic"+file.id).innerHTML='<img src="/'+serverData+'" id="img'+file.id+'" />';
			_q("pic").value+=serverData+",";
		})
		.bind('uploadComplete', function(event, file){
			// upload has completed, try the next one in the queue
			$(this).swfupload('startUpload');
		});
});	
function updatePic()
{
	if(_q("pic").value!="")
	{
		arrPic=_q("pic").value.split(",");
		var picCount=0;
		for(t=0;t<arrPic.length;t++)
		{
			if(arrPic[t]!="")
			{
				picCount++;
				_q("preview").innerHTML+='<li id="'+t+'" >'+
				'<div class="pic" id="pic'+t+'"><img src="/'+arrPic[t]+'" id="img'+t+'" /></div>'+
				'<div class="progressbar" ><div class="progress"></div></div>'+
				'<p class="status" >100%上传成功! | <span class="cancel" onclick="delPic(\''+t+'\')">删除</span></p>'+
				'</li>';
			}
		}
		var swfu = $.swfupload.getInstance('#swfupload-control');
		var stats = swfu.getStats();  
		stats.successful_uploads+=picCount;
		swfu.setStats(stats);
	}
}
function delPic(pid)
{
	var picPath=_q("img"+pid).src;
	$('li#'+pid).slideUp('fast');
	var swfu = $.swfupload.getInstance('#swfupload-control');
	var stats = swfu.getStats();  
	stats.successful_uploads--;
	swfu.setStats(stats);
	var picArr=_q("pic").value.split(',');
	_q("pic").value="";
	for(i=0;i<picArr.length;i++)
	{
		if(picPath.indexOf(picArr[i])<0)
		{
			_q("pic").value+=picArr[i]+",";
		}
	}
}
</script>
</td>
</tr><%}%>
<tr>
<td class="head"><span class="notnull">*</span>地区：</td>
<td><div class="post_city"><%=tools.showAddressSelect("address","address1") %></div><div class="exDiv" id="exAddress"></div></td>
</tr>
<tr>
<td class="head">价格：</td>
<td><input type="text" name="price" id="price" onblur="valiPost('exPrice')" class="textInputP" value="<%=price %>" /><div class="exDiv">（元）</div><div class="exDiv" id="exPrice"></div></td>
</tr>
<tr>
<td class="head"><span class="notnull">*</span>电话：</td>
<td><input type="text" name="tel" id="tel" onblur="valiPost('exTel')" class="textInput" value="<%=tel %>" size="12" /><div class="exDiv" id="exTel"></div></td>
</tr>
<tr>
<td class="head">微信：</td>
<td><input type="text" name="weixin" id="weixin" onblur="valiPost('exWeixin')" class="textInput" value="<%=weixin %>" size="12" /><div class="exDiv" id="exWeixin"></div></td>
</tr>
<tr>
<td class="head">QQ：</td>
<td><input type="text" name="qq" id="qq" onblur="valiPost('exQq')" class="textInput" value="<%=qq %>" size="12" /><div class="exDiv" id="exQq"></div></td>
</tr>
<tr>
<td class="head">联系人：</td>
<td><input type="text" name="name" id="name" onblur="valiPost('exName')" class="textInputP" value="<%=name %>" /><div class="exDiv" id="exName"></div></td>
</tr>
<tr>
<td class="head"><span class="notnull">*</span>有效期：</td>
<td><input type="text" class="textInputP" value="<%=overdate %>" onblur="valiPost('exOverDate')" id="overdate" name="overdate" /><div class="exDiv">（天）</div><div class="exDiv" id="exOverDate"></div></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type="submit" class="postSubmit" value="确认修改信息" /></td>
</tr>
</table>
</form>
</div>
<div class="clear"></div>
</div>
<script type="text/javascript" src="<%=sPostPath%>vali.js"></script>
<script language="javascript" type="text/javascript">
if(getCookie("kState") != null&&getCookie("kState")!="")
{
	var post_con=JSON.parse(getCookie("post_con"));
	$("#title").val(post_con.kTitle);
	$("#name").val(post_con.kName);
	$("#price").val(post_con.kPrice);
	$("#pic").val(post_con.kPic);
	$("#content").val(post_con.kContent);
	$("#tel").val(post_con.kTel);
	$("#weixin").val(post_con.kWeixin);
	$("#qq").val(post_con.kQq);
	$("#overdate").val(post_con.kOverDate);
	$("#address").val(post_con.kAddress);
    acLoadAddress(post_con.kAddress,post_con.kAddress1);
	$("#adminpassword").val(post_con.kAdminPassWord);
	setTimeout('updatePic()',500);
	alert(decodeURI(escape(getCookie("kState"))));
	valiPost("all");
} 
else
{
    setTimeout('updatePic()',500);
    $("#address").val('<%=address  %>');
    acLoadAddress('<%=address  %>','<%=address1  %>');
}
</script>
</div>
<qth8:foot ID="foot" runat="server" />
</div>
</body>
</html>