180 lines
4.7 KiB
JavaScript
180 lines
4.7 KiB
JavaScript
var cid="";
|
|
var aid="";
|
|
var coid="";
|
|
var pagecurrent=1;
|
|
var initcity="false";
|
|
$(document).ready(function(){
|
|
|
|
$(".list").hide();
|
|
$(".tip").hide();
|
|
|
|
if (pagename=="communityad")
|
|
{
|
|
$("#communityad").hide();
|
|
var msg={"pagecurrent":pagecurrent,"communityid":communityid};
|
|
}else
|
|
{
|
|
initcity="true";
|
|
var msg={"pagecurrent":pagecurrent,"initcity":initcity};
|
|
}
|
|
sendClientMsg(root+"Ad/lst",msg,"");
|
|
|
|
$("body").unbind('click');
|
|
$("body").click(function(event){
|
|
var _id=$(event.target).attr("id");
|
|
var arr=String(_id).split("_");
|
|
|
|
if (arr[0]=="del")
|
|
{
|
|
adid=arr[1];
|
|
tip(message[10],sendDelAdMsg);
|
|
}else if (arr[0]=="add")
|
|
{
|
|
loadPage(admin_page_url+"add_ad.php?"+Math.random(),null);
|
|
}else if (arr[0]=="edit")
|
|
{
|
|
adid=arr[1];
|
|
loadPage(admin_page_url+"edit_ad.php?"+Math.random(),null);
|
|
}else if (arr[0]=="search")
|
|
{
|
|
cid=$("#icity").val();
|
|
aid=$("#area").val();
|
|
coid=$("#community").val();
|
|
|
|
var msg={"pagecurrent":pagecurrent,"cityid":cid,"areaid":aid,"communityid":coid};
|
|
sendClientMsg(root+"Ad/lst",msg,"");
|
|
}else if (arr[0]=="vacancy")
|
|
{
|
|
adid=arr[1];
|
|
loadPage(admin_page_url+"vacancy.php?"+Math.random(),null);
|
|
}else if(arr[0]=="update"){
|
|
adid=arr[1];
|
|
sendClientMsg(root+"Ad/updateFree",{id:adid},"");
|
|
}
|
|
});
|
|
|
|
|
|
});
|
|
function sendDelAdMsg()
|
|
{
|
|
var msg = {"id":adid};
|
|
sendClientMsg(root+"Ad/delAd",msg,"");
|
|
}
|
|
|
|
function adList(msg)
|
|
{
|
|
var _totalcity=msg[0];
|
|
|
|
$(".list").hide();
|
|
$(".tip").hide();
|
|
|
|
if (pagename=="adManage"&&initcity=="true")
|
|
{
|
|
//createSelect("#icity",msg['citylist']);
|
|
//$("#area").html('<option value="">请选择</option>');
|
|
//$("#area").html("#area",msg['arealist']);
|
|
createSelect("#area",msg['arealist']);
|
|
$("#community").html('<option value="">请选择</option>');
|
|
|
|
/*$("#icity").change(function(){
|
|
var str=$("#icity").val();
|
|
if (str!="")
|
|
{
|
|
cid=str;
|
|
var msg={"cityid":cid};
|
|
sendClientMsg(root+"City/getArea",msg,"");
|
|
}else
|
|
{
|
|
cid="";
|
|
coid="";
|
|
$("#area").html('<option value="">请选择</option>');
|
|
$("#community").html('<option value="">请选择</option>');
|
|
}
|
|
});*/
|
|
|
|
$("#area").change(function(){
|
|
var str=$("#area").val();
|
|
if (str!="")
|
|
{
|
|
aid=str;
|
|
var msg={"areaid":aid};
|
|
sendClientMsg(root+"City/getCommunity",msg,"");
|
|
}else
|
|
{
|
|
coid="";
|
|
$("#community").html('<option value="">请选择</option>');
|
|
}
|
|
});
|
|
|
|
$("#community").change(function(){
|
|
var str=$("#community").val();
|
|
if (str!="")
|
|
{
|
|
coid=str;
|
|
}
|
|
});
|
|
|
|
initcity="false";
|
|
}
|
|
|
|
if (_totalcity == 0)
|
|
{
|
|
$(".tip").show();
|
|
$(".tip").html("当前没有数据");
|
|
}else
|
|
{
|
|
var _totalpage=msg[1];
|
|
var _current=msg[2];
|
|
var _list=msg[3];
|
|
|
|
$(".list").show();
|
|
$(".ad_list").html("");
|
|
|
|
$(".totalpage").html(_totalpage);
|
|
$(".currentpage").html(_current);
|
|
|
|
var title='<tr><th>编号</th><th>空余广告位</th><th>尺寸</th><th>城区</th><th>社区</th><th>社区详细</th><th>广告位分布图</th><th>操作</th></tr>';
|
|
var str='';
|
|
|
|
for(var i in _list)
|
|
{
|
|
if (_list[i].img!="")
|
|
{
|
|
var _img='<img src="'+upload_url+_list[i].img+'" width="300px" height="100px"/>';
|
|
}else
|
|
{
|
|
var _img='';
|
|
}
|
|
str+='<tr><td class="center">'+_list[i].number+'</td><td class="center">'+_list[i].free+'</td><td class="center">'+_list[i].size+'</td><td class="center">'+_list[i].area+'</td><td class="center">'+_list[i].community+'</td><td class="center">'+_list[i].citydess+'</td><td class="center">'+_img+'</td><td class="center"><a href="javascript:void(0);" id="vacancy_'+_list[i].id+'" class="inner_btn">广告位</a><a href="javascript:void(0);" id="edit_'+_list[i].id+'" class="inner_btn">修改</a><a href="javascript:void(0);" id="del_'+_list[i].id+'" class="inner_btn">删除</a><a href="javascript:void(0);" id="update_'+_list[i].id+'" class="inner_btn">更新空位</a></td></tr>';
|
|
}
|
|
|
|
if (pagename=="communityad")
|
|
{
|
|
var msg={"pagecurrent":pagecurrent,"communityid":communityid};
|
|
}else
|
|
{
|
|
var msg={"pagecurrent":pagecurrent,"cityid":cid,"areaid":aid,"communityid":coid};
|
|
}
|
|
previousPage(root+"Ad/lst",msg,"");
|
|
nextPage(root+"Ad/lst",msg,"");
|
|
numPage(root+"Ad/lst",msg,"");
|
|
|
|
$(".ad_list").append(title+str);
|
|
}
|
|
}
|
|
|
|
function setArea(msg)
|
|
{
|
|
createSelect("#area", msg);
|
|
coid="";
|
|
$("#community").html('<option value="">请选择</option>');
|
|
}
|
|
|
|
function setCommunity(msg)
|
|
{
|
|
createSelect("#community", msg);
|
|
}
|
|
|
|
function updateAd(frees,id){
|
|
$("#update_"+id).parent().parent().find("td:eq(1)").html(frees);
|
|
} |