142 lines
2.9 KiB
JavaScript
142 lines
2.9 KiB
JavaScript
var cid="";
|
|
var aid="";
|
|
var coid="";
|
|
$(document).ready(function(){
|
|
|
|
if (pagename=="communityad")
|
|
{
|
|
$("#adcity").hide();
|
|
}
|
|
|
|
var msg={};
|
|
sendClientMsg(root+"City/getCity",msg,"");
|
|
|
|
$("body").unbind('click');
|
|
$("body").click(function(event){
|
|
var _id=$(event.target).attr("id");
|
|
var arr=String(_id).split("_");
|
|
|
|
if (arr[0]=="addAd")
|
|
{
|
|
clearErrorTips("tip","errorTips");
|
|
|
|
var number=trimAll($("[name=number]").val(),"g");
|
|
//var vacancy=trimAll($("[name=vacancy]").val(),"g");
|
|
var size=trimAll($("[name=size]").val(),"g");
|
|
var cityd=trimAll($("[name=cityd]").val(),"g");
|
|
|
|
if (pagename=="communityad")
|
|
{
|
|
cid=userid;
|
|
aid=areaid;
|
|
coid=communityid;
|
|
}else
|
|
{
|
|
cid=$("#icity").val();
|
|
aid=$("#area").val();
|
|
coid=$("#community").val();
|
|
|
|
if (cid == "")
|
|
{
|
|
setErrorTips("icity_tip","errorTips",message[6]);
|
|
return false;
|
|
}
|
|
if (aid == "")
|
|
{
|
|
setErrorTips("area_tip","errorTips",message[6]);
|
|
return false;
|
|
}
|
|
if (coid == "")
|
|
{
|
|
setErrorTips("community_tip","errorTips",message[6]);
|
|
return false;
|
|
}
|
|
}
|
|
if (cityd == "")
|
|
{
|
|
setErrorTips("size_cityd","errorTips",message[6]);
|
|
return false;
|
|
}
|
|
if (number=="")
|
|
{
|
|
setErrorTips("number_tip","errorTips",message[6]);
|
|
return false;
|
|
}
|
|
/*if (vacancy=="")
|
|
{
|
|
setErrorTips("vacancy_tip","errorTips",message[6]);
|
|
return false;
|
|
}*/
|
|
if (size=="")
|
|
{
|
|
setErrorTips("size_tip","errorTips",message[6]);
|
|
return false;
|
|
}
|
|
|
|
//if (number_bool&&vacancy_bool&&size_bool&&city_bool&&area_bool&&community_bool)
|
|
//{
|
|
var msg={"number":number,"vacancy":0,"size":size,"cityid":cid,"areaid":aid,"communityid":coid,"citydess":cityd};
|
|
sendClientMsg(root+"Ad/addAd",msg,"");
|
|
//}
|
|
|
|
}
|
|
})
|
|
|
|
});
|
|
function setCity(msg)
|
|
{
|
|
createSelect("#icity",msg);
|
|
$("#area").html('<option value="">请选择</option>');
|
|
$("#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;
|
|
}
|
|
});
|
|
}
|
|
|
|
function setArea(msg)
|
|
{
|
|
createSelect("#area", msg);
|
|
coid="";
|
|
$("#community").html('<option value="">请选择</option>');
|
|
}
|
|
|
|
function setCommunity(msg)
|
|
{
|
|
createSelect("#community", msg);
|
|
}
|