177 lines
3.8 KiB
JavaScript
177 lines
3.8 KiB
JavaScript
![]() |
$(document).ready(function(){
|
||
|
|
||
|
clearErrorTips("tip","errorTips");
|
||
|
var msg={"adid":adid};
|
||
|
sendClientMsg(root+"Ad/adInfor",msg,"");
|
||
|
|
||
|
$("body").click(function(event){
|
||
|
var _id=$(event.target).attr("id");
|
||
|
var arr=String(_id).split("_");
|
||
|
|
||
|
if (arr[0]=="editAd")
|
||
|
{
|
||
|
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 (cityd=="")
|
||
|
{
|
||
|
setErrorTips("cityd_tip","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 (cityid=="")
|
||
|
{
|
||
|
setErrorTips("icity_tip","errorTips",message[6]);
|
||
|
return false;
|
||
|
}
|
||
|
if (areaid=="")
|
||
|
{
|
||
|
setErrorTips("area_tip","errorTips",message[6]);
|
||
|
return false;
|
||
|
}
|
||
|
if (communityid=="")
|
||
|
{
|
||
|
setErrorTips("community_tip","errorTips",message[6]);
|
||
|
return false;
|
||
|
}
|
||
|
|
||
|
var msg={"adid":adid,"cityid":cityid,"areaid":areaid,"communityid":communityid};
|
||
|
sendClientMsg(root+"Ad/editAd",msg,"");
|
||
|
}
|
||
|
else if (arr[0]=="addPhoto")
|
||
|
{
|
||
|
var msg={"id":adid};
|
||
|
sendClientMsg(root+"Ad/editPhoto",msg,"");
|
||
|
}
|
||
|
else if (arr[0]=="delPhoto")
|
||
|
{
|
||
|
imgname=arr[1];
|
||
|
tip(message[10],sendPhotoImg);
|
||
|
}
|
||
|
})
|
||
|
|
||
|
});
|
||
|
|
||
|
var imgname="";
|
||
|
|
||
|
var adcity="";
|
||
|
var cityid="";
|
||
|
|
||
|
var adarea="";
|
||
|
var areaid="";
|
||
|
|
||
|
var adcommunity="";
|
||
|
var communityid="";
|
||
|
|
||
|
function sendPhotoImg()
|
||
|
{
|
||
|
var msg={"id":adid,"photo":imgname};
|
||
|
sendClientMsg(root+"Ad/delPhoto",msg,"");
|
||
|
}
|
||
|
|
||
|
function adInfor(msg)
|
||
|
{
|
||
|
$("[name=number]").val(msg["number"]);
|
||
|
$("[name=cityd]").val(msg["cityd"]);
|
||
|
$("[name=vacancy]").val(msg["free"]);
|
||
|
$("[name=size]").val(msg["size"]);
|
||
|
$("[name=cityd]").val(msg["citydess"]);
|
||
|
adcity=msg["city"];
|
||
|
adarea=msg["area"];
|
||
|
adcommunity=msg["community"];
|
||
|
|
||
|
cityid=msg["cityid"];
|
||
|
areaid=msg["areaid"];
|
||
|
communityid=msg["communityid"];
|
||
|
|
||
|
if (msg["img"] != "")
|
||
|
{
|
||
|
$(".adimg").html('<img src="'+upload_url+msg["img"]+'" />');
|
||
|
}
|
||
|
createSelect("#icity",msg["citylist"]);
|
||
|
setSelect("#icity",msg["city"]);
|
||
|
|
||
|
$("#area").append('<option value="'+msg["areaid"]+'">'+msg["area"]+'</option>');
|
||
|
$("#community").append('<option value="'+msg["communityid"]+'">'+msg["community"]+'</option>');
|
||
|
|
||
|
$("#icity").change(function(){
|
||
|
var str=$("#icity").val();
|
||
|
if (str!="")
|
||
|
{
|
||
|
cityid=str;
|
||
|
var msg={"cityid":cityid};
|
||
|
sendClientMsg(root+"City/getArea",msg,"");
|
||
|
}else
|
||
|
{
|
||
|
areaid="";
|
||
|
communityid="";
|
||
|
$("#area").html('<option value="">请选择</option>');
|
||
|
$("#community").html('<option value="">请选择</option>');
|
||
|
}
|
||
|
});
|
||
|
|
||
|
$("#area").change(function(){
|
||
|
var str=$("#area").val();
|
||
|
if (str!="")
|
||
|
{
|
||
|
areaid=str;
|
||
|
var msg={"areaid":areaid};
|
||
|
sendClientMsg(root+"City/getCommunity",msg,"");
|
||
|
}else
|
||
|
{
|
||
|
communityid="";
|
||
|
$("#community").html('<option value="">请选择</option>');
|
||
|
}
|
||
|
});
|
||
|
|
||
|
$("#community").change(function(){
|
||
|
var str=$("#community").val();
|
||
|
if (str!="")
|
||
|
{
|
||
|
communityid=str;
|
||
|
}
|
||
|
});
|
||
|
|
||
|
if (msg["photo"]!="")
|
||
|
{
|
||
|
var imgarr = msg["photo"].split('|');
|
||
|
var title='<tr><th>广告牌实拍图</th><th>操作</th></tr>';
|
||
|
var str='';
|
||
|
|
||
|
for(var i in imgarr)
|
||
|
{
|
||
|
str+='<tr><td class="center"><img src="'+upload_url+imgarr[i]+'" /></td><td class="center"><a href="javascript:void(0);" id="delPhoto_'+imgarr[i]+'" class="inner_btn">删除</a></td></tr>';
|
||
|
}
|
||
|
|
||
|
$(".img_list").append(title+str);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function setArea(msg)
|
||
|
{
|
||
|
createSelect("#area", msg);
|
||
|
communityid="";
|
||
|
$("#community").html('<option value="">请选择</option>');
|
||
|
}
|
||
|
|
||
|
function setCommunity(msg)
|
||
|
{
|
||
|
createSelect("#community", msg);
|
||
|
}
|