Commit 3414a351 by felix

每日一更

parent 5cfde9dd
<?php <?php
require_once(PLUGIN_DIR . 'Dao/SearchDao.php'); require_once(PLUGIN_DIR . 'Dao/SearchDao.php');
require_once(PLUGIN_DIR . 'Dao/InsertDao.php'); require_once(PLUGIN_DIR . 'Dao/InsertDao.php');
require_once(PLUGIN_DIR . 'Tools/Image.php'); require_once(PLUGIN_DIR . 'Tools/Image.php');
require_once(PLUGIN_DIR . 'Tools/Core.php'); require_once(PLUGIN_DIR . 'Tools/Core.php');
require_once(PLUGIN_DIR . 'Admin/Tospur_House.php'); require_once(PLUGIN_DIR . 'Admin/Tospur_House.php');
class House extends Tospur_House{ class House extends Tospur_House{
public static function init_view(){ public static function init_view(){
wp_enqueue_script('jquery-ui'); wp_enqueue_script('jquery-ui');
wp_enqueue_script('bootstrapjs'); wp_enqueue_script('bootstrapjs');
wp_enqueue_script('validate'); wp_enqueue_script('publicjs');
wp_enqueue_style('jquery-ui_css');
wp_enqueue_style('bootstrapcss'); wp_enqueue_script('validate');
wp_enqueue_style('bootstrapMinCss'); wp_enqueue_style('jquery-ui_css');
wp_enqueue_style('bootstrapMinCss');
global $wpdb;
$type = $_POST["type"]; global $wpdb;
$context = array(); $type = $_POST["type"];
$context['siteUrl'] = get_site_url(); $context = array();
if($type==1){ $context['siteUrl'] = get_site_url();
$insert_tospur_house_array = array( if($type==1){
'name' => $_POST['housename'], $insert_tospur_house_array = array(
'average_price' => $_POST['average_price'], 'name' => $_POST['housename'],
'latest_news' => $_POST['latest_news'], 'average_price' => $_POST['average_price'],
'address' => $_POST['address'], 'latest_news' => $_POST['latest_news'],
'traffic' => $_POST['traffic'], 'address' => $_POST['address'],
'periphery' => $_POST['periphery'], 'traffic' => $_POST['traffic'],
'developer' => $_POST['developers'], 'periphery' => $_POST['periphery'],
'check_in_time' => $_POST['check_in_time'], 'developer' => $_POST['developers'],
'property_age' => $_POST['property_age'], 'check_in_time' => $_POST['check_in_time'],
'decoration' => $_POST['decoration'], 'property_age' => $_POST['property_age'],
'covered_area' => $_POST['covered_area'], 'decoration' => $_POST['decoration'],
'volume_rate' => $_POST['volume_rate'], 'covered_area' => $_POST['covered_area'],
'greening_rate' => $_POST['greening_rate'], 'volume_rate' => $_POST['volume_rate'],
'households' => $_POST['households'], 'greening_rate' => $_POST['greening_rate'],
'parking_spaces' => $_POST['parking_spaces'], 'households' => $_POST['households'],
'property_management' => $_POST['property_management'], 'parking_spaces' => $_POST['parking_spaces'],
'overview' => $_POST['overview'], 'property_management' => $_POST['property_management'],
'city_id' => $_POST['baseCity'], 'overview' => $_POST['overview'],
'district_id' => $_POST['baseAreaId'], 'city_id' => $_POST['baseCity'],
'plate_id' => $_POST["basePlateId"], 'district_id' => $_POST['baseAreaId'],
'room_id' => $_POST['baseRoom'], 'plate_id' => $_POST["basePlateId"],
"location" => $_POST["location"], 'room_id' => $_POST['baseRoom'],
'status' =>$_POST['status'], "location" => $_POST["location"],
"property_money" => $_POST["property_money"], "property_money" => $_POST["property_money"],
'community_name' => $_POST["community_name"], 'community_name' => $_POST["community_name"],
); );
$wpdb->query("START TRANSACTION"); $wpdb->query("START TRANSACTION");
if(isset($_POST['houseId'])){ if(isset($_POST['houseId'])){
$result = House::data_update($_POST['houseId'],$insert_tospur_house_array); $insert_tospur_house_array['status'] = 0;
if($result != 203){ $result = House::data_update($_POST['houseId'],$insert_tospur_house_array);
$wpdb->query("ROLLBACK"); if($result != 203){
print_r($result); $wpdb->query("ROLLBACK");
echo "新房房源修改失败"; print_r($result);
}else{ echo "新房房源修改失败";
$wpdb->query("COMMIT"); }else{
echo "新房房源修改成功"; $wpdb->query("COMMIT");
} echo "新房房源修改成功";
}else{ }
$result = House::data_insert($insert_tospur_house_array); }else{
if($result != 200){ $insert_tospur_house_array['status'] = $_POST['status'];
$wpdb->query("ROLLBACK"); $result = House::data_insert($insert_tospur_house_array);
print_r($result);; if($result != 200){
echo "新增房源失败"; $wpdb->query("ROLLBACK");
}else{ print_r($result);;
$wpdb->query("COMMIT"); echo "新增房源失败";
echo "新增房源成功"; }else{
} $wpdb->query("COMMIT");
} echo "新增房源成功";
exit; }
}else if(isset($_GET['edit'])){ }
$context['houseId'] = $_GET['id']; exit;
$context = array_merge($context,SearchDao::getDetailInfo($_GET['id'],"edit")); }else if(isset($_GET['edit'])){
$context["district"] = SearchDao::searchCity($context['result']->city_id); $context['houseId'] = $_GET['id'];
$context["plate"] = SearchDao::searchCity($context['result']->city_id,$context['result']->district_id); $context = array_merge($context,SearchDao::getDetailInfo($_GET['id'],"edit"));
$context["mark"] = SearchDao::searchHouseTag($_GET['id']); $context["district"] = SearchDao::searchCity($context['result']->city_id);
} $context["plate"] = SearchDao::searchCity($context['result']->city_id,$context['result']->district_id);
$context['role'] = SecHandHouse::getCurrentRole(); $context["mark"] = SearchDao::searchHouseTag($_GET['id']);
$context["city"] = SearchDao::searchCity(); $context["searchStatus"] = SearchDao::searchStatus($_GET['id'],1);
$context["buildProperty"] = SearchDao::searchBuildProperty(); }
$context["room"] = SearchDao::searchRoom(); $context['role'] = House::getCurrentRole();
$context["photoType"] = SearchDao::searchPhotoType(); $context["city"] = SearchDao::searchCity();
$context["status"] = searchDao::searchStatusType(1); $context["buildProperty"] = SearchDao::searchBuildProperty();
Timber::render("newhouse.html",$context); $context["room"] = SearchDao::searchRoom();
} $context["photoType"] = SearchDao::searchPhotoType();
$context["status"] = searchDao::searchStatusType(1);
public static function data_update($houseId,$insert_tospur_house_array){ Timber::render("newhouse.html",$context);
global $wpdb; }
$data = $_POST["data"];
$wpdb->update(Config::TOSPUR_HOUSE_TABLE,$insert_tospur_house_array,array("id" => $houseId)); public static function data_update($houseId,$insert_tospur_house_array){
$result = 203; global $wpdb;
$exist_ids = array(); $data = $_POST["data"];
if(isset($_POST['exists'])){ $wpdb->update(Config::TOSPUR_HOUSE_TABLE,$insert_tospur_house_array,array("id" => $houseId));
foreach($_POST['exists'] as $id => $item){ $result = 203;
$wpdb->update(Config::A_DISTRICT_AREA_TABLE,array( $exist_ids = array();
"buildproperty_id" => $item['buildProperty'], if(isset($_POST['exists'])){
"house_area" => $item['housearea'] foreach($_POST['exists'] as $id => $item){
),array("image_id" => $id)); $wpdb->update(Config::A_DISTRICT_AREA_TABLE,array(
$exist_ids[] = $id; "buildproperty_id" => $item['buildProperty'],
} "house_area" => $item['housearea']
$old_exists_ids = explode(",",$_POST['exists_ids']); ),array("image_id" => $id));
$delete_ids = array(); $exist_ids[] = $id;
foreach(array_diff($old_exists_ids,$exist_ids) as $key => $id){ }
$delete_ids[] = $id; $old_exists_ids = explode(",",$_POST['exists_ids']);
} $delete_ids = array();
$delete_ids = implode(",",$delete_ids); foreach(array_diff($old_exists_ids,$exist_ids) as $key => $id){
$wpdb->query("delete from ".Config::A_DISTRICT_AREA_TABLE." where house_id = {$houseId} and image_id in ({$delete_ids});"); $delete_ids[] = $id;
$wpdb->query("delete from ".Config::A_HOUSE_IMAGE_TABLE." where house_id = {$houseId} and image_id in ({$delete_ids});"); }
} $delete_ids = implode(",",$delete_ids);
InsertDao::addMainImage($houseId,$data); $wpdb->query("delete from ".Config::A_DISTRICT_AREA_TABLE." where house_id = {$houseId} and image_id in ({$delete_ids});");
$wpdb->query("delete from ".Config::A_HOUSE_IMAGE_TABLE." where house_id = {$houseId} and image_id in ({$delete_ids});");
$exists_photo_ids = array(); }
if(isset($_POST['exists_photo'])){ InsertDao::addMainImage($houseId,$data);
foreach($_POST['exists_photo'] as $id => $item){
$wpdb->update(Config::TOSPUR_IMAGE_TABLE,array( $exists_photo_ids = array();
"image_type" => $item['type'], if(isset($_POST['exists_photo'])){
),array("id" => $id)); foreach($_POST['exists_photo'] as $id => $item){
$exists_photo_ids[] = $id; $wpdb->update(Config::TOSPUR_IMAGE_TABLE,array(
} "image_type" => $item['type'],
} ),array("id" => $id));
$old_exists_photo_ids = explode(",",$_POST['exists_photo_ids']); $exists_photo_ids[] = $id;
$delete_photo_ids = array(); }
foreach(array_diff($old_exists_photo_ids,$exists_photo_ids) as $key => $id){ }
$delete_photo_ids[] = $id; $old_exists_photo_ids = explode(",",$_POST['exists_photo_ids']);
} $delete_photo_ids = array();
$delete_photo_ids = implode(",",$delete_photo_ids); foreach(array_diff($old_exists_photo_ids,$exists_photo_ids) as $key => $id){
$wpdb->query("delete from ".Config::A_HOUSE_IMAGE_TABLE." where house_id = {$houseId} and image_id in ({$delete_photo_ids});"); $delete_photo_ids[] = $id;
}
$wpdb->delete(Config::A_HOUSE_RECOMMEND_TABLE,array("house_id" => $houseId)); $delete_photo_ids = implode(",",$delete_photo_ids);
$res = InsertDao::addRecommend($houseId,$data); $wpdb->query("delete from ".Config::A_HOUSE_IMAGE_TABLE." where house_id = {$houseId} and image_id in ({$delete_photo_ids});");
if($res == 504){
$result = $res; $wpdb->delete(Config::A_HOUSE_RECOMMEND_TABLE,array("house_id" => $houseId));
echo "推荐房源修改失败"; $res = InsertDao::addRecommend($houseId,$data);
} if($res == 504){
$result = $res;
$wpdb->delete(Config::A_HOUSE_USER_TABLE,array("house_id" => $houseId)); echo "推荐房源修改失败";
$res = InsertDao::addRecConsultant($houseId,$data); }
if($res == 505){
$result = $res; $wpdb->delete(Config::A_HOUSE_USER_TABLE,array("house_id" => $houseId));
echo "推荐置业顾问修改失败"; $res = InsertDao::addRecConsultant($houseId,$data);
} if($res == 505){
InsertDao::addHouseTag($_POST['mark'],$houseId); $result = $res;
return $result; echo "推荐置业顾问修改失败";
} }
InsertDao::addHouseTag($_POST['mark'],$houseId);
public static function data_insert($params){ return $result;
global $wpdb; }
//房源与类型以及面积信息
$data = $_POST["data"]; public static function data_insert($params){
//获取新房信息,存入tospur_house表 global $wpdb;
$params['user_id'] = get_current_user_id(); //房源与类型以及面积信息
$params['creattime'] = date("Y-m-d H:i:s"); $data = $_POST["data"];
$params['house_type'] = 0; //获取新房信息,存入tospur_house表
$res = $wpdb->get_results('SELECT * FROM tospur_house WHERE name="' . $_POST['housename'] . '" and address="' . $_POST['address'] . '" and house_type=0', OBJECT); $params['user_id'] = get_current_user_id();
if (!$res) { $params['creattime'] = date("Y-m-d H:i:s");
$houseId = InsertDao::insert_tospur_house($params); $params['house_type'] = 0;
$res = $wpdb->get_results('SELECT * FROM tospur_house WHERE name="' . $_POST['housename'] . '" and address="' . $_POST['address'] . '" and house_type=0', OBJECT);
InsertDao::addMainImage($houseId,$data); if (!$res) {
$houseId = InsertDao::insert_tospur_house($params);
InsertDao::addRecommend($houseId,$data);
InsertDao::addMainImage($houseId,$data);
InsertDao::addRecConsultant($houseId,$data);
InsertDao::addRecommend($houseId,$data);
InsertDao::addHouseTag($_POST['mark'],$houseId);
InsertDao::addRecConsultant($houseId,$data);
}else{
return 506; InsertDao::addHouseTag($_POST['mark'],$houseId);
}
return 200; }else{
} return 506;
}
return 200;
}
} }
\ No newline at end of file
...@@ -38,18 +38,13 @@ class feature ...@@ -38,18 +38,13 @@ class feature
public static function add_feature_html() public static function add_feature_html()
{ {
$context = array(); wp_enqueue_style('bootstrapMinCss');
$context['url'] = home_url();
$context['admin_url'] = admin_url();
Timber::render('add_feature.html', $context);
}
public static function feature_list_html()
{
$context = array(); $context = array();
$context['view'] = plugins_url() . '/tospur/Admin/views'; $context['view'] = plugins_url() . '/tospur/Admin/views';
$context['result'] = feature::search_feature(); $context['result'] = feature::search_feature();
Timber::render('feature_list.html', $context); $context['url'] = home_url();
$context['admin_url'] = admin_url();
Timber::render('feature.html', $context);
} }
} }
......
<?php <?php
require_once(PLUGIN_DIR . 'Dao/SearchDao.php'); require_once(PLUGIN_DIR . 'Dao/SearchDao.php');
require_once(PLUGIN_DIR . 'Dao/InsertDao.php'); require_once(PLUGIN_DIR . 'Dao/InsertDao.php');
require_once(PLUGIN_DIR . 'Tools/Image.php'); require_once(PLUGIN_DIR . 'Tools/Image.php');
class RentHouse extends Tospur_House{ class RentHouse extends Tospur_House{
//二手房信息 //二手房信息
public static function rentHouse_html(){ public static function rentHouse_html(){
wp_enqueue_script('bootstrapjs'); wp_enqueue_script('bootstrapjs');
wp_enqueue_style('bootstrapcss'); wp_enqueue_script('publicjs');
global $wpdb;
$type = $_POST["type"]; wp_enqueue_script('validate');
$context = array(); wp_enqueue_style('bootstrapMinCss');
$context['siteUrl'] = get_site_url(); global $wpdb;
//获取新房信息,存入tospur_house表 $type = $_POST["type"];
$insert_tospur_house_array = array( $context = array();
'name' => $_POST['housename'], $context['siteUrl'] = get_site_url();
'house_number' =>$_POST['house_number'], //获取新房信息,存入tospur_house表
'rent'=>$_POST['rent'], $insert_tospur_house_array = array(
'buildproperty_id'=>$_POST['buildproperty_id'], 'name' => $_POST['housename'],
'covered_area' =>$_POST['covered_area'], 'house_number' =>$_POST['house_number'],
'floor' =>$_POST['floor'], 'rent'=>$_POST['rent'],
'faceto'=>$_POST['faceto'], 'buildproperty_id'=>$_POST['buildproperty_id'],
'decoration' => $_POST['decoration'], 'covered_area' =>$_POST['covered_area'],
'age'=>$_POST['age'], 'floor' =>$_POST['floor'],
'matching_facilities'=>$_POST['matching_facilities'], 'faceto'=>$_POST['faceto'],
'flat'=>$_POST['flat'], 'decoration' => $_POST['decoration'],
'suite'=>$_POST["suite"], 'age'=>$_POST['age'],
'overview' => $_POST['overview'], 'matching_facilities'=>$_POST['matching_facilities'],
'city_id' => $_POST['baseCity'], 'flat'=>$_POST['flat'],
'district_id' => $_POST['baseAreaId'], 'suite'=>$_POST["suite"],
'plate_id' => $_POST["basePlateId"], 'overview' => $_POST['overview'],
'address' => $_POST['address'], 'city_id' => $_POST['baseCity'],
'community_name'=>$_POST['community_name'], 'district_id' => $_POST['baseAreaId'],
'traffic' => $_POST['traffic'], 'plate_id' => $_POST["basePlateId"],
'periphery' => $_POST['periphery'], 'address' => $_POST['address'],
'status' =>$_POST['status'], 'community_name'=>$_POST['community_name'],
'owner_name'=>$_POST['owner_name'], 'traffic' => $_POST['traffic'],
'owner_phone'=>$_POST['owner_phone'], 'periphery' => $_POST['periphery'],
"location" => $_POST["location"], 'owner_name'=>$_POST['owner_name'],
); 'owner_phone'=>$_POST['owner_phone'],
if($type==3){ "location" => $_POST["location"],
$wpdb->query("START TRANSACTION"); "totalFloor"=>$_POST["totalFloor"],
if(isset($_POST['houseId'])){ "useArea"=>$_POST["useArea"],
$result = RentHouse::data_update($_POST['houseId'],$insert_tospur_house_array); "street"=>$_POST["street"],
if($result != 202){ "propertyProof"=>$_POST["propertyProof"],
$wpdb->query("ROLLBACK"); "roomNum"=>$_POST["roomNum"],
print_r($result);; "livingRoom"=>$_POST["livingRoom"],
echo "租房房源修改失败"; "bathRoom"=>$_POST["bathRoom"],
}else{ "kitchen"=>$_POST["kitchen"],
$wpdb->query("COMMIT"); "balcony"=>$_POST["balcony"],
echo "租房房源修改成功"; "propertyRight"=>$_POST["propertyRight"],
} "structure"=>$_POST["structure"],
"key"=>$_POST["key"],
}else { "garage"=>$_POST["garage"]
$result = RentHouse::rentHouseData_insert($insert_tospur_house_array); );
if ($result != 200) { if($type==3){
$wpdb->query("ROLLBACK"); $wpdb->query("START TRANSACTION");
print_r($result);; if(isset($_POST['houseId'])){
echo "租房房源新增失败"; $insert_tospur_house_array['status'] = 0;
} else { $result = RentHouse::data_update($_POST['houseId'],$insert_tospur_house_array);
$wpdb->query("COMMIT"); if($result != 202){
echo "租房房源新增成功"; $wpdb->query("ROLLBACK");
} print_r($result);;
} echo "租房房源修改失败";
exit; }else{
}else if(isset($_GET['edit'])){ $wpdb->query("COMMIT");
$context['houseId'] = $_GET['id']; echo "租房房源修改成功";
$context = array_merge($context,SearchDao::getDetailInfo($_GET['id'])); }
$context["district"] = SearchDao::searchCity($context['result']->city_id);
$context["plate"] = SearchDao::searchCity($context['result']->city_id,$context['result']->district_id); }else {
$context["mark"] = SearchDao::searchHouseTag($_GET['id']); $insert_tospur_house_array['status'] = $_POST['status'];
} $result = RentHouse::rentHouseData_insert($insert_tospur_house_array);
$context['role'] = SecHandHouse::getCurrentRole(); if ($result != 200) {
$context["city"] = SearchDao::searchCity(); $wpdb->query("ROLLBACK");
$context["buildProperty"] = SearchDao::searchBuildProperty(); print_r($result);
$context["room"] = SearchDao::searchRoom(); echo "租房房源新增失败";
$context["photoType"] = SearchDao::searchPhotoType(); } else {
$context["status"] = searchDao::searchStatusType(2); $wpdb->query("COMMIT");
Timber::render("rentHouse.html",$context); echo "租房房源新增成功";
}
} }
exit;
public static function rentHouseData_insert($params) }else if(isset($_GET['edit'])){
{ $context['houseId'] = $_GET['id'];
global $wpdb; $context = array_merge($context,SearchDao::getDetailInfo($_GET['id']));
//房源与类型以及面积信息 $context["district"] = SearchDao::searchCity($context['result']->city_id);
$data = $_POST["data"]; $context["plate"] = SearchDao::searchCity($context['result']->city_id,$context['result']->district_id);
$params['user_id'] = get_current_user_id(); $context["mark"] = SearchDao::searchHouseTag($_GET['id']);
$params['creattime'] = date("Y-m-d H:i:s"); $context["searchStatus"] = SearchDao::searchStatus($_GET['id'],2);
$params['house_type'] = 2; $context["rent"] = SearchDao::searchRent($_GET['id']);
$res = $wpdb->get_results('SELECT * FROM tospur_house WHERE address="' .$params['address'] . '" and owner_name="' .$params['owner_name'] . '" and owner_phone="'.$params['owner_phone'].'" and house_type=2', OBJECT); }
if(!$res){ $context['role'] = RentHouse::getCurrentRole();
$houseId = InsertDao::insert_tospur_house($params); $context["city"] = SearchDao::searchCity();
$context["buildProperty"] = SearchDao::searchBuildProperty();
InsertDao::addMainImage($houseId,$data); $context["room"] = SearchDao::searchRoom();
$context["photoType"] = SearchDao::searchPhotoType();
InsertDao::addRecommend($houseId,$data); $context["status"] = searchDao::searchStatusType(2);
for($i = 1981; $i<= 2020; $i++){
InsertDao::addRecConsultant($houseId,$data); $context["age"][]=$i;
}
InsertDao::addHouseTag($_POST['mark'],$houseId); Timber::render("rentHouse.html",$context);
}else{
return 508; }
}
return 200; public static function rentHouseData_insert($params)
} {
global $wpdb;
//房源与类型以及面积信息
public static function data_update($houseId,$params){ $data = $_POST["data"];
global $wpdb; $params['user_id'] = get_current_user_id();
$data = $_POST["data"]; $params['creattime'] = date("Y-m-d H:i:s");
$res = $wpdb->update(Config::TOSPUR_HOUSE_TABLE,$params,array("id" => $houseId)); $params['house_type'] = 2;
$result = 202; $res = $wpdb->get_results('SELECT * FROM tospur_house WHERE address="' .$params['address'] . '" and owner_name="' .$params['owner_name'] . '" and owner_phone="'.$params['owner_phone'].'" and house_type=2', OBJECT);
if(!$res){
InsertDao::addMainImage($houseId,$data); $houseId = InsertDao::insert_tospur_house($params);
$exists_photo_ids = array();
if(isset($_POST['exists_photo'])){ InsertDao::addMainImage($houseId,$data);
foreach($_POST['exists_photo'] as $id => $item){
$wpdb->update(Config::TOSPUR_IMAGE_TABLE,array( InsertDao::addRecommend($houseId,$data);
"image_type" => $item['type'],
),array("id" => $id)); InsertDao::addRecConsultant($houseId,$data);
$exists_photo_ids[] = $id;
} InsertDao::addHouseTag($_POST['mark'],$houseId);
} }else{
$old_exists_photo_ids = explode(",",$_POST['exists_photo_ids']); return 508;
$delete_photo_ids = array(); }
foreach(array_diff($old_exists_photo_ids,$exists_photo_ids) as $key => $id){ return 200;
$delete_photo_ids[] = $id; }
}
$delete_photo_ids = implode(",",$delete_photo_ids);
$wpdb->query("delete from ".Config::A_HOUSE_IMAGE_TABLE." where house_id = {$houseId} and image_id in ({$delete_photo_ids});"); public static function data_update($houseId,$params){
global $wpdb;
$wpdb->delete(Config::A_HOUSE_RECOMMEND_TABLE,array("house_id" => $houseId)); $data = $_POST["data"];
InsertDao::addRecommend($houseId,$data); $res = $wpdb->update(Config::TOSPUR_HOUSE_TABLE,$params,array("id" => $houseId));
$result = 202;
$wpdb->delete(Config::A_HOUSE_USER_TABLE,array("house_id" => $houseId));
InsertDao::addRecConsultant($houseId,$data); InsertDao::addMainImage($houseId,$data);
$exists_photo_ids = array();
InsertDao::addHouseTag($_POST['mark'],$houseId); if(isset($_POST['exists_photo'])){
return $result; foreach($_POST['exists_photo'] as $id => $item){
} $wpdb->update(Config::TOSPUR_IMAGE_TABLE,array(
} "image_type" => $item['type'],
),array("id" => $id));
$exists_photo_ids[] = $id;
}
}
$old_exists_photo_ids = explode(",",$_POST['exists_photo_ids']);
$delete_photo_ids = array();
foreach(array_diff($old_exists_photo_ids,$exists_photo_ids) as $key => $id){
$delete_photo_ids[] = $id;
}
$delete_photo_ids = implode(",",$delete_photo_ids);
$wpdb->query("delete from ".Config::A_HOUSE_IMAGE_TABLE." where house_id = {$houseId} and image_id in ({$delete_photo_ids});");
$wpdb->delete(Config::A_HOUSE_RECOMMEND_TABLE,array("house_id" => $houseId));
InsertDao::addRecommend($houseId,$data);
$wpdb->delete(Config::A_HOUSE_USER_TABLE,array("house_id" => $houseId));
InsertDao::addRecConsultant($houseId,$data);
InsertDao::addHouseTag($_POST['mark'],$houseId);
return $result;
}
}
<?php <?php
require_once(PLUGIN_DIR . 'Dao/SearchDao.php'); require_once(PLUGIN_DIR . 'Dao/SearchDao.php');
require_once(PLUGIN_DIR . 'Dao/InsertDao.php'); require_once(PLUGIN_DIR . 'Dao/InsertDao.php');
require_once(PLUGIN_DIR . 'Tools/Image.php'); require_once(PLUGIN_DIR . 'Tools/Image.php');
class SecHandHouse extends Tospur_House{ class SecHandHouse extends Tospur_House{
//二手房信息 //二手房信息
public static function secHandHouse_html(){ public static function secHandHouse_html(){
wp_enqueue_script('bootstrapjs'); wp_enqueue_script('bootstrapjs');
wp_enqueue_style('bootstrapcss'); wp_enqueue_script('publicjs');
wp_enqueue_style('bootstrapMinCss');
global $wpdb; wp_enqueue_script('validate');
$type = $_POST["type"]; wp_enqueue_style('bootstrapMinCss');
$context = array(); global $wpdb;
$context['siteUrl'] = get_site_url(); $type = $_POST["type"];
$insert_tospur_house_array = array( $context = array();
'name' => $_POST['housename'], $context['siteUrl'] = get_site_url();
'house_number' =>$_POST['house_number'], $insert_tospur_house_array = array(
'total_price' =>$_POST['total_price'], 'name' => $_POST['housename'],
'average_price' => $_POST['average_price'], 'house_number' =>$_POST['house_number'],
'buildproperty_id'=>$_POST['buildproperty_id'], 'total_price' =>$_POST['total_price'],
'covered_area' =>$_POST['covered_area'], 'average_price' => $_POST['average_price'],
'floor' =>$_POST['floor'], 'buildproperty_id'=>$_POST['buildproperty_id'],
'faceto'=>$_POST['faceto'], 'covered_area' =>$_POST['covered_area'],
'decoration' => $_POST['decoration'], 'floor' =>$_POST['floor'],
'age'=>$_POST['age'], 'faceto'=>$_POST['faceto'],
'flat'=>$_POST['flat'], 'decoration' => $_POST['decoration'],
'suite'=>$_POST["suite"], 'age'=>$_POST['age'],
'overview' => $_POST['overview'], 'flat'=>$_POST['flat'],
'city_id' => $_POST['baseCity'], 'suite'=>$_POST["suite"],
'district_id' => $_POST['baseAreaId'], 'overview' => $_POST['overview'],
'plate_id' => $_POST["basePlateId"], 'city_id' => $_POST['baseCity'],
'address' => $_POST['address'], 'district_id' => $_POST['baseAreaId'],
'community_name'=>$_POST['community_name'], 'plate_id' => $_POST["basePlateId"],
'traffic' => $_POST['traffic'], 'address' => $_POST['address'],
'periphery' => $_POST['periphery'], 'community_name'=>$_POST['community_name'],
'status' =>$_POST['status'], 'traffic' => $_POST['traffic'],
'owner_name'=>$_POST['owner_name'], 'periphery' => $_POST['periphery'],
'owner_phone'=>$_POST['owner_phone'], 'owner_name'=>$_POST['owner_name'],
"location" => $_POST["location"], 'owner_phone'=>$_POST['owner_phone'],
); "location" => $_POST["location"],
if($type==2){ "totalFloor"=>$_POST["totalFloor"],
$wpdb->query("START TRANSACTION"); "useArea"=>$_POST["useArea"],
if(isset($_POST['houseId'])){ "street"=>$_POST["street"],
$result = SecHandHouse::data_update($_POST['houseId'],$insert_tospur_house_array); "propertyProof"=>$_POST["propertyProof"],
if($result != 201){ "roomNum"=>$_POST["roomNum"],
$wpdb->query("ROLLBACK"); "livingRoom"=>$_POST["livingRoom"],
print_r( $result);; "bathRoom"=>$_POST["bathRoom"],
echo "二手房房源修改失败"; "kitchen"=>$_POST["kitchen"],
}else{ "balcony"=>$_POST["balcony"],
$wpdb->query("COMMIT"); "propertyRight"=>$_POST["propertyRight"],
echo "二手房房源修改成功"; "structure"=>$_POST["structure"],
} "key"=>$_POST["key"],
"matching_facilities"=>$_POST["matching_facilities"],
}else { "garage"=>$_POST["garage"]
$result = SecHandHouse::secHouseData_insert($insert_tospur_house_array); );
if ($result != 200) { if($type==2){
$wpdb->query("ROLLBACK"); $wpdb->query("START TRANSACTION");
print_r( $result);; if(isset($_POST['houseId'])){
echo "二手房房源新增失败"; $insert_tospur_house_array['status'] = 0;
} else { $result = SecHandHouse::data_update($_POST['houseId'],$insert_tospur_house_array);
$wpdb->query("COMMIT"); if($result != 201){
echo "二手房房源新增成功"; $wpdb->query("ROLLBACK");
} print_r( $result);;
} echo "二手房房源修改失败";
exit; }else{
}else if(isset($_GET['edit'])){ $wpdb->query("COMMIT");
$context['houseId'] = $_GET['id']; echo "二手房房源修改成功";
$context = array_merge($context,SearchDao::getDetailInfo($_GET['id'])); }
$context["district"] = SearchDao::searchCity($context['result']->city_id);
$context["plate"] = SearchDao::searchCity($context['result']->city_id,$context['result']->district_id); }else {
$context["mark"] = SearchDao::searchHouseTag($_GET['id']); $insert_tospur_house_array['status'] = $_POST['status'];
$context["featureOld"] = SearchDao::searchFeatureByHouse($_GET['id']); $result = SecHandHouse::secHouseData_insert($insert_tospur_house_array);
if ($result != 200) {
} $wpdb->query("ROLLBACK");
$context['role'] = SecHandHouse::getCurrentRole(); print_r( $result);;
$context["city"] = SearchDao::searchCity(); echo "二手房房源新增失败";
$context["buildProperty"] = SearchDao::searchBuildProperty(); } else {
$context["room"] = SearchDao::searchRoom(); $wpdb->query("COMMIT");
$context["photoType"] = SearchDao::searchPhotoType(); echo "二手房房源新增成功";
$context["status"] = searchDao::searchStatusType(2); }
$context["feature"] = searchDao::searchFeature(); }
Timber::render("secHandHouse.html",$context); exit;
}else if(isset($_GET['edit'])){
} $context['houseId'] = $_GET['id'];
$context = array_merge($context,SearchDao::getDetailInfo($_GET['id']));
public static function secHouseData_insert($params) $context["district"] = SearchDao::searchCity($context['result']->city_id);
{ $context["plate"] = SearchDao::searchCity($context['result']->city_id,$context['result']->district_id);
global $wpdb; $context["mark"] = SearchDao::searchHouseTag($_GET['id']);
//房源与类型以及面积信息 $context['featureOld'] = SearchDao::searchFeatureOld($_GET['id']);
$data = $_POST["data"]; $context["searchStatus"] = SearchDao::searchStatus($_GET['id'],2);
$params['user_id'] = get_current_user_id();
$params['creattime'] = date("Y-m-d H:i:s"); }
$params['house_type'] = 1; $context['role'] = SecHandHouse::getCurrentRole();
//获取新房信息,存入tospur_house表 $context["city"] = SearchDao::searchCity();
$res = $wpdb->get_results('SELECT * FROM tospur_house WHERE address="' .$params['address'] . '" and owner_name="' .$params['owner_name'] . '" and owner_phone="'.$params['owner_phone'].'" and house_type=1', OBJECT); $context["buildProperty"] = SearchDao::searchBuildProperty();
if(!$res){ $context["room"] = SearchDao::searchRoom();
$houseId = InsertDao::insert_tospur_house($params); $context["photoType"] = SearchDao::searchPhotoType();
$context["status"] = searchDao::searchStatusType(2);
InsertDao::addMainImage($houseId,$data); $context["feature"] = searchDao::searchFeature();
for($i = 1981; $i<= 2020; $i++){
InsertDao::addRecommend($houseId,$data); $context["age"][]=$i;
}
InsertDao::addRecConsultant($houseId,$data); Timber::render("secHandHouse.html",$context);
if(isset($_POST['mark'])&&$_POST['mark']!=""){ }
InsertDao::addHouseTag($_POST['mark'],$houseId);
} public static function secHouseData_insert($params)
{
InsertDao::addHouseFeature($houseId,$data); global $wpdb;
//房源与类型以及面积信息
$data = $_POST["data"];
}else{ $params['user_id'] = get_current_user_id();
return 507; $params['creattime'] = date("Y-m-d H:i:s");
} $params['house_type'] = 1;
return 200; //获取新房信息,存入tospur_house表
} $res = $wpdb->get_results('SELECT * FROM tospur_house WHERE address="' .$params['address'] . '" and owner_name="' .$params['owner_name'] . '" and owner_phone="'.$params['owner_phone'].'" and house_type=1', OBJECT);
if(!$res){
public static function data_update($houseId,$params){ $houseId = InsertDao::insert_tospur_house($params);
global $wpdb;
$data = $_POST["data"]; InsertDao::addMainImage($houseId,$data);
$res = $wpdb->update(Config::TOSPUR_HOUSE_TABLE,$params,array("id" => $houseId));
$result = 201; InsertDao::addRecommend($houseId,$data);
InsertDao::addMainImage($houseId,$data); InsertDao::addRecConsultant($houseId,$data);
$exists_photo_ids = array(); if(isset($_POST['mark'])&&$_POST['mark']!=""){
if(isset($_POST['exists_photo'])){ InsertDao::addHouseTag($_POST['mark'],$houseId);
foreach($_POST['exists_photo'] as $id => $item){ }
$wpdb->update(Config::TOSPUR_IMAGE_TABLE,array(
"image_type" => $item['type'], InsertDao::addHouseFeature($houseId,$data);
),array("id" => $id));
$exists_photo_ids[] = $id;
} }else{
} return 507;
$old_exists_photo_ids = explode(",",$_POST['exists_photo_ids']); }
$delete_photo_ids = array(); return 200;
foreach(array_diff($old_exists_photo_ids,$exists_photo_ids) as $key => $id){ }
$delete_photo_ids[] = $id;
} public static function data_update($houseId,$params){
$delete_photo_ids = implode(",",$delete_photo_ids); global $wpdb;
$wpdb->query("delete from ".Config::A_HOUSE_IMAGE_TABLE." where house_id = {$houseId} and image_id in ({$delete_photo_ids});"); $data = $_POST["data"];
$res = $wpdb->update(Config::TOSPUR_HOUSE_TABLE,$params,array("id" => $houseId));
$wpdb->delete(Config::A_HOUSE_RECOMMEND_TABLE,array("house_id" => $houseId)); $result = 201;
InsertDao::addRecommend($houseId,$data);
InsertDao::addMainImage($houseId,$data);
$wpdb->delete(Config::A_HOUSE_USER_TABLE,array("house_id" => $houseId));
InsertDao::addRecConsultant($houseId,$data); $exists_photo_ids = array();
if(isset($_POST['exists_photo'])){
$wpdb->query( foreach($_POST['exists_photo'] as $id => $item){
$wpdb->prepare( $wpdb->update(Config::TOSPUR_IMAGE_TABLE,array(
"DELETE FROM a_house_tag "image_type" => $item['type'],
WHERE tag_id in(select tag_id from (select tag_id,tt.type from a_house_tag as aht ),array("id" => $id));
left JOIN tospur_tag tt on aht.tag_id = tt.id) as a $exists_photo_ids[] = $id;
where house_id = %d and a.type = 1);", $houseId) }
); }
InsertDao::addHouseFeature($houseId,$data); $old_exists_photo_ids = explode(",",$_POST['exists_photo_ids']);
$delete_photo_ids = array();
if(isset($_POST['mark'])&&$_POST['mark']!="") { foreach(array_diff($old_exists_photo_ids,$exists_photo_ids) as $key => $id){
InsertDao::addHouseTag($_POST['mark'],$houseId); $delete_photo_ids[] = $id;
} }
return $result; $delete_photo_ids = implode(",",$delete_photo_ids);
} $wpdb->query("delete from ".Config::A_HOUSE_IMAGE_TABLE." where house_id = {$houseId} and image_id in ({$delete_photo_ids});");
} $wpdb->delete(Config::A_HOUSE_RECOMMEND_TABLE,array("house_id" => $houseId));
InsertDao::addRecommend($houseId,$data);
$wpdb->delete(Config::A_HOUSE_USER_TABLE,array("house_id" => $houseId));
InsertDao::addRecConsultant($houseId,$data);
$wpdb->query(
$wpdb->prepare(
"DELETE FROM a_house_tag
WHERE tag_id in(select tag_id from (select tag_id,tt.type from a_house_tag as aht
left JOIN tospur_tag tt on aht.tag_id = tt.id) as a
where house_id = %d and a.type = 1);", $houseId)
);
InsertDao::addHouseFeature($houseId,$data);
if(isset($_POST['mark'])&&$_POST['mark']!="") {
InsertDao::addHouseTag($_POST['mark'],$houseId);
}
return $result;
}
}
<h2>添加特色</h2>
<label for="feature">特色:</label>
<input id="feature" type="text">
<input type="submit" id="submit" class="button">
<script>
var admin_url = '{{ admin_url }}';
(function ($) {
$(document).ready(function () {
$('#submit').click(function () {
var name = $('#feature').val();
if (name.trim() != '') {
$.ajax({
type: 'POST',
url: '{{ url }}/wp-admin/admin-ajax.php/',
data: 'action=add_feature&name=' + name,
success: function (data) {
switch (data.code) {
case 2000:
window.location.href = admin_url + 'admin.php?page=feature_list';
break;
case 2001:
alert('不能重复添加特色');
break;
default:
break;
}
}
});
} else {
alert('请输入特色');
}
});
});
})(jQuery);
</script>
\ No newline at end of file
...@@ -2,7 +2,24 @@ ...@@ -2,7 +2,24 @@
<label for="feature">特色:</label> <label for="feature">特色:</label>
<input id="feature" type="text"> <input id="feature" type="text">
<input type="submit" id="submit" class="button"> <input type="submit" id="submit" class="button">
<h2>特色列表</h2>
<table class="table">
<thead>
</thead>
<tbody>
{% for item in result %}
{% if loop.index0%4 == 0%}
<tr>
{% endif %}
<td>{{ item.name }}</td>
{% if loop.index0%4 == 3%}
</tr>
{% endif %}
{% endfor %}
</tbody>
</table>
<script> <script>
var admin_url = '{{ admin_url }}';
(function ($) { (function ($) {
$(document).ready(function () { $(document).ready(function () {
$('#submit').click(function () { $('#submit').click(function () {
...@@ -13,10 +30,15 @@ ...@@ -13,10 +30,15 @@
url: '{{ url }}/wp-admin/admin-ajax.php/', url: '{{ url }}/wp-admin/admin-ajax.php/',
data: 'action=add_feature&name=' + name, data: 'action=add_feature&name=' + name,
success: function (data) { success: function (data) {
if (data) { switch (data.code) {
alert('添加成功'); case 2000:
} else { window.location.href = admin_url + 'admin.php?page=add_feature';
alert('添加失败'); break;
case 2001:
alert('不能重复添加特色');
break;
default:
break;
} }
} }
}); });
......
<link rel="stylesheet" type="text/css" href="{{ view }}/css/bootstrap.min.css">
<h2>特色列表</h2>
<table class="table">
<thead>
<tr>
<th style="">
<div class="th-inner">ID</div>
<div class="fht-cell"></div>
</th>
<th style="">
<div class="th-inner">名称</div>
<div class="fht-cell"></div>
</th>
</tr>
</thead>
<tbody>
{% for item in result %}
<tr>
<td>{{ item.id }}</td>
<td>{{ item.name }}</td>
</tr>
{% endfor %}
</tbody>
</table>
\ No newline at end of file
(function($){
function searchConsultant(consulCityId,consultantName){
$.ajax({
type: "GET",
url: "/tospur/wp-admin/admin-ajax.php",
data: "action=searchConsultant&consulCityId="+consulCityId+"&consultantName="+consultantName,
success:function(json){
for(var i = 0; i <=json.length-1; i++){
var name = json[i]["consultantName"];
var imgUrl = json[i]["imageUrl"];
var img = $("<img>").attr({"src":imgUrl,"height":100,"width":100,"style":"margin-right:50px"});
var li = $("<li>").attr("id",json[i]["id"]).append(img).append(name).addClass("consultantImg");
$("#consultantList").append(li);
}
}
});
}
})(jQuery);
\ No newline at end of file
<!DOCTYPE HTML> <!DOCTYPE HTML>
<html> <html>
<head> <head>
{% set title = houseId?"修改新房房源":"添加新房房源" %} {% set title = houseId?"修改新房房源":"添加新房房源" %}
<meta charset="utf-8"> <meta charset="utf-8">
<title>{{title}}</title> <title>{{title}}</title>
</head> </head>
<body> <body>
<h2 class="title">{{title}}</h2> <h2 class="title">{{title}}</h2>
<form action="" method="POST" enctype="multipart/form-data" id="newHouse"> <form action="" method="POST" enctype="multipart/form-data" id="newHouse">
<div class="row"> <div class="row">
<div class="col-md-11"> <div class="col-md-11">
<div class="row"> <div class="row">
<div class="col-md-8"> <div class="col-md-4">
<table class="form-table"> <label for="housename">楼盘名:</label>
<tbody> <input name="housename" id="housename" type="text" value="{{result.name}}" class="form-control" >
<tr> </div>
<th><label for="housename">楼盘名</label></th> <div class="col-md-4">
<td> <input name="housename" id="housename" type="text" value="{{result.name}}" class="form-control" style="width: 150px;"></td> <label for="mark">标签:</label>
</tr> <input name="mark" id="mark" type="text" value="{{mark}}" class="form-control">
</div>
<tr> <div class="col-md-4">
<th><label for="mark">标签:</label></th> <label for="community_name">小区名:</label>
<td> <input name="mark" id="mark" type="text" value="{{mark}}" class="form-control"></td> <input name="community_name" id="community_name" type="text" value="{{result.community_name}}" class="form-control" >
</tr> </div>
<tr> </div><br>
<th><label for="community_name">小区名</label></th> <div class="row">
<td> <input name="community_name" id="community_name" type="text" value="{{result.community_name}}" style="width: 150px;" class="form-control" ></td> <div class="col-md-8">
</tr> <label for="address">地址:</label>
<tr> <input name="address" type="text" value="{{result.address}}" class="form-control">
<th><label for="address">地址</label></th> </div>
<td> <input name="address" type="text" value="{{result.address}}" class="form-control"></td> <div class="col-md-4">
</tr> <label for="average_price">均价:</label>
<tr> <p>
<th><label for="average_price">均价</label></th> <input name="average_price" id="average_price" type="text" value="{{result.average_price}}" class="form-control" style="width:80%;display: inline-block">
<td> <input name="average_price" id="average_price" type="text" value="{{result.average_price}}" class="form-control" style="width: 90px;"></td> </p>
</tr> </div>
<tr> </div><br>
<th><label for="latest_news">最新动态</label></th> <div class="row">
<td><textarea name="latest_news" rows="4" cols="40" class="form-control" style="width: 400px;">{{result.latest_news}}</textarea></td> <div class="col-md-8">
</tr> <label for="latest_news">最新动态:</label>
</tbody> <textarea name="latest_news" rows="4" cols="40" class="form-control" >{{result.latest_news}}</textarea>
</table> </div>
</div> </div><br>
</div> <h2 class="title">位置及周边</h2>
<h2 class="title">位置及周边</h2> <div class="row">
<div class="row"> <div class="col-md-4">
<div class="col-md-8"> <label for="from">所属地区:</label>
<table class="form-table"> <div class="row">
<tbody> <div class="col-md-3">
<tr> <select id="baseCity" name="baseCity" class="required">
<th><label for="from">所属地区</label></th> <option value="-1"> 城市</option>
<td> {% for item in city %}
<select id="baseCity" name="baseCity"> <option {{ item.id == result.city_id?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
<option value="-1"> 城市</option> {% endfor %}
{% for item in city %} </select>
<option {{ item.id == result.city_id?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option> </div>
{% endfor %} <div class="col-md-3">
</select> <select id="baseAreaId" name="baseAreaId">
<select id="baseAreaId" name="baseAreaId"> <option value = "-1">区域</option>
<option value = "-1">区域</option> {% if district %}
{% if district %} {% for item in district %}
{% for item in district %} <option {{ item.id == result.district_id?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
<option {{ item.id == result.district_id?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option> {% endfor %}
{% endfor %} {% endif %}
{% endif %} </select>
</select> </div>
<select id="basePlateId" name="basePlateId"> <div class="col-md-3">
<option value = "-1">板块</option> <select id="basePlateId" name="basePlateId">
{% if district %} <option value = "-1">板块</option>
{% for item in plate %} {% if district %}
<option {{ item.id == result.plate_id?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option> {% for item in plate %}
{% endfor %} <option {{ item.id == result.plate_id?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endif %} {% endfor %}
</select> {% endif %}
</td> </select>
</tr> </div>
<tr> </div>
<th><label for="location">地域坐标</label></th> </div>
<td> <input name="location" id="location" type="text" value="{{result.location}}" class="form-control"></td> <div class="col-md-4">
</tr> <th><label for="location">地域坐标:</label>
<tr> <td> <input name="location" id="location" type="text" value="{{result.location}}" class="form-control">
<th><label for="traffic">交通线路</label></th> </div>
<td> <input name="traffic" type="text" value="{{result.traffic}}" class="form-control" style="width: 300px;"></td> <div class="col-md-4">
</tr> <label for="traffic">交通线路:</label>
<tr> <input name="traffic" type="text" value="{{result.traffic}}" class="form-control">
<th><label for="periphery">周边配套</label></th> </div>
<td> <input name="periphery" type="text" value="{{result.periphery}}" class="form-control" style="width: 300px;"></td> </div><br>
</tr> <div class="row">
</tbody> <div class="col-md-4">
</table> <label for="periphery">周边配套:</label>
</div> <input name="periphery" type="text" value="{{result.periphery}}" class="form-control">
</div> </div>
</div><br>
<h2 class="title">基本信息</h2> <h2 class="title">基本信息</h2>
<div class="row"> <div class="row">
<div class="col-md-8"> <div class="col-md-4">
<table class="form-table"> <div class="row">
<tbody> <div class="col-md-4">
<tr> <label for="developers">建筑类型:</label>
<th><label for="developers">建筑类型</label></th> <select id="baseRoom" name="baseRoom">
<td> {% for item in room %}
<select id="baseRoom" name="baseRoom"> <option {{ item.id == result.room_id?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% for item in room %} {% endfor %}
<option {{ item.id == result.room_id?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option> </select>
{% endfor %} </div>
</select> </div>
</td> </div>
</tr> <div class="col-md-4">
<tr> <label for="developers">开发商:</label>
<th><label for="developers">开发商</label></th> <input name="developers" type="text" value="{{result.developer}}" class="form-control" >
<td> <input name="developers" type="text" value="{{result.developer}}" class="form-control" style="width: 150px;"></td> </div>
</tr> <div class="col-md-4">
<tr> <label for="check_in_time">入住时间:</label>
<th><label for="check_in_time">入住时间</label></th> <input name="check_in_time" id="checkin" type="text" value="{{result.check_in_time}}" class="form-control" >
<td> <input name="check_in_time" id="checkin" type="text" value="{{result.check_in_time}}" class="form-control" style="width: 150px;"></td> </div>
</tr> </div><br>
<tr>
<th><label for="property_age">产权年限</label></th> <div class="row">
<td> <input name="property_age" type="text" value="{{result.property_age}}" class="form-control" style="width: 90px;"></td> <div class="col-md-4">
</tr> <label for="property_age">产权年限:</label>
<tr> <input name="property_age" type="text" value="{{result.property_age}}" class="form-control" >
<th><label for="decoration">装修状况</label></th> </div>
<td> <input name="decoration" type="text" value="{{result.decoration}}" class="form-control"style="width: 90px;"></td> <div class="col-md-4">
</tr> <label for="decoration">装修状况:</label></th>
<tr> <input name="decoration" type="text" value="{{result.decoration}}" class="form-control">
<th><label for="covered_area">建筑面积</label></th> </div>
<td> <input name="covered_area" type="text" value="{{result.covered_area}}" class="form-control" style="width: 90px;"></td> <div class="col-md-4">
</tr> <label for="covered_area">建筑面积:</label></th>
<tr> <div class="row">
<th><label for="volume_rate">容积率</label></th> <div class="col-md-9">
<td> <input name="volume_rate" type="text" value="{{result.volume_rate}}" class="form-control" style="width: 50px;"></td> <input name="covered_area" type="text" value="{{result.covered_area}}" class="form-control" >
</tr> </div>
<tr> <div class="col-md-3">
<th><label for="greening_rate">绿化率</label></th> <font>平方米</font>
<td> <input name="greening_rate" type="text" value="{{result.greening_rate}}" class="form-control" style="width: 50px;"></td> </div>
</tr> </div>
<tr> </div>
<th><label for="households">规划户数</label></th> </div><br>
<td> <input name="households" type="text" value="{{result.households}}" class="form-control" style="width: 50px;"></td> <div class="row">
</tr> <div class="col-md-4">
<tr> <label for="volume_rate">容积率:</label>
<th><label for="parking_spaces">车位数</label></th> <input name="volume_rate" type="text" value="{{result.volume_rate}}" class="form-control">
<td> <input name="parking_spaces" type="text" value="{{result.parking_spaces}}" class="form-control" style="width: 50px;"></td> </div>
</tr> <div class="col-md-4">
<tr> <label for="greening_rate">绿化率:</label>
<th><label for="property_management">物业公司</label></th> <input name="greening_rate" type="text" value="{{result.greening_rate}}" class="form-control" >
<td> <input name="property_management" type="text" value="{{result.property_management}}" class="form-control" style="width: 150px;"></td> </div>
</tr> <div class="col-md-4">
<tr> <label for="households">规划户数:</label>
<th><label for="property_money">物业费</label></th> <input name="households" type="text" value="{{result.households}}" class="form-control" >
<td> <input name="property_money" type="text" value="{{result.property_money}}" class="form-control" style="width: 50px;"></td> </div>
</tr> </div><br>
<tr>
<th><label for="overview">楼盘概述</label></th> <div class="row">
<td> <textarea name="overview" rows="4" cols="40" class="form-control" style="width: 400px;">{{result.overview}}</textarea></td> <div class="col-md-4">
</tr> <label for="parking_spaces">车位数:</label>
</tbody> <input name="parking_spaces" type="text" value="{{result.parking_spaces}}" class="form-control" >
</table> </div>
</div> <div class="col-md-4">
</div> <label for="property_management">物业公司:</label></th>
<input name="property_management" type="text" value="{{result.property_management}}" class="form-control" >
<h2 class="title">关联信息</h2> </div>
<div class="row"> <div class="col-md-4">
<div class="col-md-12">
<table class="form-table"> <label for="property_money">物业费:</label>
<tbody> <input name="property_money" type="text" value="{{result.property_money}}" class="form-control">
<tr> </div>
<th><label for="mainHouse">主力户型</label></th> </div><br>
<td> <div class="row">
<div id="preview"> <div class="col-md-6">
{% set exists_ids = "" %} <label for="overview">楼盘概述:</label>
{% for item in mainImage %} <textarea name="overview" rows="4" cols="40" class="form-control">{{result.overview}}</textarea>
{% if exists_ids != "" %} </div>
{% set exists_ids = exists_ids~"," %} </div><br>
{% endif %} <h2 class="title">关联信息</h2>
{% set exists_ids = exists_ids~item.id %} <table class="form-table">
<div> <tbody>
<img src="{{siteUrl}}{{item.path}}" heghit="100" width="100"><br /> <tr>
<select name="exists[{{item.id}}][buildProperty]"> <th><label for="mainHouse">主力户型</label></th>
{% for i in buildProperty %} <td>
<option {{ i.id == item.buildproperty_id?"selected":"" }} value="{{i.id}}">{{i.value}}</option> <div id="preview">
{% endfor %} {% set exists_ids = "" %}
</select> {% for item in mainImage %}
<input type="text" placeholder="面积" name="exists[{{item.id}}][housearea]" class="form-control" value="{{item.area}}"> {% if exists_ids != "" %}
<input type="button" value="取消" class="cancel existsCancel"> {% set exists_ids = exists_ids~"," %}
</div> {% endif %}
{% endfor %} {% set exists_ids = exists_ids~item.id %}
<input type="hidden" name="exists_ids" value="{{exists_ids}}" > <div>
<input type="file" name="files[0]" property="0" class = "files"multiple class="browser button button-hero"> <img src="{{siteUrl}}{{item.path}}" height="90" width="140" style="margin-right: 50px;margin-top:10px">
<P></P> <select name="exists[{{item.id}}][buildProperty]" style="margin-right: 50px">
</div> {% for i in buildProperty %}
</td> <option {{ i.id == item.buildproperty_id?"selected":"" }} value="{{i.id}}">{{i.value}}</option>
</tr> {% endfor %}
<tr> </select>
<th><label>房源相册</label></th> <input type="text" placeholder="面积" name="exists[{{item.id}}][housearea]" class="form-control" value="{{item.area}}" style="width: 100px;display:inline-block; margin-right: 50px">
<td> <input type="button" value="取消" class="button action cancel existsCancel" style="margin-top: 30px">
<div id="picList"> </div>
{% set exists_photo_ids = "" %} {% endfor %}
{% for item in images %} <p></p>
{% if exists_photo_ids != "" %} <input type="hidden" name="exists_ids" value="{{exists_ids}}" >
{% set exists_photo_ids = exists_photo_ids~"," %} <input type="file" name="files[0]" property="0" class = "files"multiple class="browser button button-hero">
{% endif %} </div>
{% set exists_photo_ids = exists_photo_ids~item.image_id %} </td>
<p> </tr>
<input type="radio" name="frontCover" value="{{item.image_id}}" {{ result.frontCover_id == item.image_id?"checked":"" }} /> <tr>
<select name="exists_photo[{{ item.image_id }}][type]"> <th><label>房源相册</label></th>
{% for i in photoType %} <td>
<option {{ i.id == item.image_type?"selected":"" }} value="{{ i.id }}">{{ i.value }}</option> {% if houseId %}
{% endfor %} <div class="row">
</select> <div class="col-md-3">
<img src="{{siteUrl}}{{item.path}}" heghit="100" width="100"> <font>类型</font>
<input type="button" value="取消" class="cancel existsCancel"> </div>
</p> <div class="col-md-3">
{% endfor %} <font>相册</font>
<input type="hidden" name="exists_photo_ids" value="{{exists_photo_ids}}" > </div>
</div><br /> <div class="col-md-3">
<button type="button" id="housePicture" class="button action" data-toggle="modal"> <font>设为封面</font>
新增 </div>
</button> </div>
</td> {% endif %}
</tr> <div id="picList">
<tr> {% set exists_photo_ids = "" %}
<th><label for="traffic">推荐房源</label></th> {% for item in images %}
<td> {% if exists_photo_ids != "" %}
<div id="houseImg"> {% set exists_photo_ids = exists_photo_ids~"," %}
{% for item in recommends %} {% endif %}
<p> {% set exists_photo_ids = exists_photo_ids~item.image_id %}
<img src="{{siteUrl}}{{item.path}}" height="100" width="100"> <div class="row">
<input type="button" value="删除" class="imgCancel existsCancel"> <div class="col-md-3">
<input type="hidden" name="data[recommend][]" value="{{item.id}}"> <select name="exists_photo[{{ item.image_id }}][type]" style="margin-right: 50px">
</p> {% for i in photoType %}
{% endfor %} <option {{ i.id == item.image_type?"selected":"" }} value="{{ i.id }}">{{ i.value }}</option>
</div><br /> {% endfor %}
<button type="button" class="button action" data-toggle="modal" data-target="#myModal" id="recHouseBt"> </select>
添加房源 </div>
</button> <div class="col-md-3">
</td> <img src="{{siteUrl}}{{item.path}}" height="90" width="140" style="margin-right: 50px">
</tr> </div>
<tr> <div class="col-md-3">
<th><label for="periphery">置业顾问</label></th> <input type="radio" name="frontCover" style="margin-right: 50px" value="{{item.image_id}}" {{ result.frontCover_id == item.image_id?"checked":"" }} />
<td> </div>
<div id="consultantImg"> <div class="col-md-2">
{% for item in consultant %} <input type="button" value="删除" class="button action cancel existsCancel">
<p> </div>
<span>{{item.name}}</span> </div>
<input type="button" value="删除" class="consultantCancel existsCancel"> {% endfor %}
<input type="hidden" name="data[recConsultant][]" value="{{item.id}}"> <input type="hidden" name="exists_photo_ids" value="{{exists_photo_ids}}" >
</p> </div>
{% endfor %} <button type="button" id="housePicture" class="button action" data-toggle="modal" style="margin-top: 10px">
</div><br /> 新增
<button type="button" class="button action" data-toggle="modal" data-target="#myConsultant" id="recConsultantBt"> </button>
选择置业顾问 </td>
</button> </tr>
</td> <tr>
</tr> <th><label for="traffic">推荐房源</label></th>
{% if role == 'administrator' %} <td>
<tr> <div id="houseImg">
<th><label for="from">状态</label></th> {% for item in recommends %}
<td> <p>
<select id="status" name="status"> <img src="{{siteUrl}}{{item.path}}" height="90" width="140" style="margin-right: 50px">
{% for item in status %} <input type="button" value="删除" class="button action imgCancel existsCancel">
<option value={{item.id}}>{{item.value}}</option> <input type="hidden" name="data[recommend][]" value="{{item.id}}">
{% endfor %} </p>
</select> {% endfor %}
</td> </div><br />
</tr> <button type="button" class="button action" data-toggle="modal" data-target="#myModal" id="recHouseBt">
{% endif %} 添加房源
</tbody> </button>
</table> </td>
</div> </tr>
</div> <tr>
<th><label for="periphery">置业顾问</label></th>
<input type="text" name="type" value="1" hidden="hidden"> <td>
{% if houseId %} <div id="consultantImg">
<input type="text" name="houseId" value="{{houseId}}" hidden="hidden"> {% for item in consultant %}
{% endif %} <p>
</div> <img src="{{item.imageUrl}}" height="90" width="140" style="margin-right: 50px">
<div class = "col-md-1"> <span style="margin-right: 50px">{{item.name}}</span>
<input type="submit" id="submit" class="button action" style="position: fixed;"> <input type="button" value="删除" class="button action consultantCancel existsCancel">
</div> <input type="hidden" name="data[recConsultant][]" value="{{item.id}}">
</div> </p>
</form> {% endfor %}
</div><br />
<button type="button" class="button action" data-toggle="modal" data-target="#myConsultant" id="recConsultantBt">
<!-- Modal --> 选择置业顾问
<!-- 新增房源弹出层 --> </button>
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> </td>
<div class="modal-dialog" role="document"> </tr>
<div class="modal-content"> </tbody>
</table>
<div class="modal-body" style="height: 300px;overflow: auto;"> <input type="text" name="type" value="1" hidden="hidden">
<select id="cityId"> {% if houseId %}
</select> <input type="text" name="houseId" value="{{houseId}}" hidden="hidden">
<select id="areaId"> {% endif %}
<option value = "-1">区域</option> </div>
</select> <div class = "col-md-1">
<select id="plateId"> <input type="submit" id="submit" class="button action" style="position: fixed;">
<option value = "-1">板块</option> {% if role == 'administrator' %}
</select> <div class="row" style="position: fixed;top:60px;">
<select id="price"> <select id="status" name="status">
<option value = "-1">价格</option> {% for item in status %}
</select> <option {{ item.id == searchStatus.id?"selected":"" }} value={{item.id}}>{{item.value}}</option>
<select id="buildProperty"> {% endfor %}
<option value = "-1">房型</option> </select>
{% for item in buildProperty %} </div>
<option value="{{ item.id }}">{{ item.value }}</option> {% endif %}
{% endfor %} </div>
</select> </div>
<select id="room"> </form>
<option value = "-1">类型</option>
{% for item in room %}
<option value="{{ item.id }}">{{ item.value }}</option> <!-- Modal -->
{% endfor %} <!-- 新增房源弹出层 -->
</select> <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<select id="acreage"> <div class="modal-dialog" role="document">
<option value = "-1">面积</option> <div class="modal-content">
</select>
<input type="text" placeholder="请出入楼盘名/地段名搜索" id="searchtext"> <div class="modal-body" style="height: 300px;overflow: auto;">
<button type="button" class="button action" id="search">搜索</button> <select id="cityId">
<ul id="houseList"> </select>
</ul> <select id="areaId">
</div> <option value = "-1">区域</option>
</div> </select>
</div> <select id="plateId">
</div> <option value = "-1">板块</option>
</select>
<!-- 置业顾问弹出层 --> <select id="price">
<div class="modal fade" id="myConsultant" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> <option value = "-1">价格</option>
<div class="modal-dialog" role="document"> </select>
<div class="modal-content"> <select id="buildProperty">
<div class="modal-body" style="height: 300px;overflow: auto;"> <option value = "-1">房型</option>
<select id="consultCity"> {% for item in buildProperty %}
</select> <option value="{{ item.id }}">{{ item.value }}</option>
<input type="text" placeholder="请出入置业顾问姓名搜索" id="consultantName" class="form-control"> {% endfor %}
<button type="button" class="button action" id="searchConsult">搜索</button> </select>
<ul id="consultantList"> <select id="room">
</ul> <option value = "-1">类型</option>
</div> {% for item in room %}
</div> <option value="{{ item.id }}">{{ item.value }}</option>
</div> {% endfor %}
</div> </select>
<select id="acreage">
<option value = "-1">面积</option>
<script> </select>
(function($){ <input type="text" placeholder="请出入楼盘名/地段名搜索" id="searchtext">
$(document).ready(function(){ <button type="button" class="button action" id="search">搜索</button>
var titleFlag = 0; <ul id="houseList">
//主力房源中选择图片file的下标 </ul>
var i = 0; </div>
//入住时间选择 </div>
$("#checkin").datepicker({ </div>
dateFormat: "yy-mm-dd" </div>
});
//主力房源选择文件 <!-- 置业顾问弹出层 -->
$("form").on("change",".files",function(){ <div class="modal fade" id="myConsultant" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
readURL(this,1); <div class="modal-dialog" role="document">
$(this).hide(); <div class="modal-content">
}); <div class="modal-body" style="height: 300px;overflow: auto;">
<select id="consultCity">
//主力房源中图片的删除功能 </select>
$("form").on("click",".cancel",function(){ <input type="text" placeholder="请出入置业顾问姓名搜索" id="consultantName" class="form-control">
$buttonid = $(this).attr("property"); <button type="button" class="button action" id="searchConsult">搜索</button>
$("[property = "+$buttonid+"]").remove(); <ul id="consultantList">
$("form input[type='file']:last-child").show(); </ul>
</div>
}); </div>
//基本信息的联动AJAX </div>
$("#baseCity").change(function(){ </div>
var cityId = $("#baseCity").val();
var baserArea = $("#baseAreaId");
$('#baseAreaId').find('option:not(:first-child)').remove(); <script>
$('#basePlateId').find('option:not(:first-child)').remove(); (function($){
$(document).ready(function(){
//城市联动区域 var titleFlag = 0;
$.ajax({ //主力房源中选择图片file的下标
type: "GET", var i = 0;
url: "/tospur/wp-admin/admin-ajax.php", //入住时间选择
data: "action=serachCity&cityId="+cityId, $("#checkin").datepicker({
success:function(json){ dateFormat: "yy-mm-dd"
addOption(json,baserArea); });
} //主力房源选择文件
}); $("form").on("change",".files",function(){
}); readURL(this,1);
//区域联动板块 $(this).hide();
$("#baseAreaId").change(function(){ });
var basePlate = $("#basePlateId");
var areaId = $("#baseAreaId").val(); //主力房源中图片的删除功能
var cityId = $("#baseCity").val(); $("form").on("click",".cancel",function(){
$('#basePlateId').find('option:not(:first-child)').remove(); $buttonid = $(this).attr("property");
$.ajax({ $("[property = "+$buttonid+"]").remove();
type: "GET", $("form input[type='file']:last-child").show();
url: "/tospur/wp-admin/admin-ajax.php",
data: "action=serachCity&cityId="+cityId+"&districtId="+areaId, });
success:function(json){ //基本信息的联动AJAX
addOption(json,basePlate); $("#baseCity").change(function(){
} var cityId = $("#baseCity").val();
}); var baserArea = $("#baseAreaId");
}); $('#baseAreaId').find('option:not(:first-child)').remove();
$('#basePlateId').find('option:not(:first-child)').remove();
//根据上方选择的城市,选择推荐房源的默认城市
$("#recHouseBt").click(function(){ //城市联动区域
$('#cityId').find('option').remove(); $.ajax({
$('#areaId').find('option:not(:first-child)').remove(); type: "GET",
$('#plateId').find('option:not(:first-child)').remove(); url: "/tospur/wp-admin/admin-ajax.php",
$('#price').find('option:not(:first-child)').remove(); data: "action=serachCity&cityId="+cityId,
$('#acreage').find('option:not(:first-child)').remove(); success:function(json){
$("#houseList").find("li").remove(); addOption(json,baserArea);
var acreage =$("#acreage"); }
var price = $("#price"); });
var cityId = $("#baseCity").val(); });
var cityName = $("#baseCity").find("option:selected").text(); //区域联动板块
var option = $("<option>").attr("value",cityId).append(cityName); $("#baseAreaId").change(function(){
$("#cityId").append(option); var basePlate = $("#basePlateId");
if(cityId != -1){ var areaId = $("#baseAreaId").val();
var area = $("#areaId"); var cityId = $("#baseCity").val();
$.ajax({ $('#basePlateId').find('option:not(:first-child)').remove();
type: "GET", $.ajax({
url: "/tospur/wp-admin/admin-ajax.php", type: "GET",
data: "action=serachCity&cityId="+cityId, url: "/tospur/wp-admin/admin-ajax.php",
success:function(json){ data: "action=serachCity&cityId="+cityId+"&districtId="+areaId,
addOption(json,area); success:function(json){
} addOption(json,basePlate);
}); }
});
//城市联动房子面积 });
$.ajax({
type: "GET", //根据上方选择的城市,选择推荐房源的默认城市
url: "/tospur/wp-admin/admin-ajax.php", $("#recHouseBt").click(function(){
data: "action=searchArea&cityId="+cityId, $('#cityId').find('option').remove();
success:function(json){ $('#areaId').find('option:not(:first-child)').remove();
addOption(json,acreage); $('#plateId').find('option:not(:first-child)').remove();
} $('#price').find('option:not(:first-child)').remove();
}); $('#acreage').find('option:not(:first-child)').remove();
//城市联动房子价格 $("#houseList").find("li").remove();
$.ajax({ var acreage =$("#acreage");
type: "GET", var price = $("#price");
url: "/tospur/wp-admin/admin-ajax.php", var cityId = $("#baseCity").val();
data: "action=searchUnitPriceRange&cityId="+cityId, var cityName = $("#baseCity").find("option:selected").text();
success:function(json){ var option = $("<option>").attr("value",cityId).append(cityName);
addOption(json,price); $("#cityId").append(option);
} if(cityId != -1){
}); var area = $("#areaId");
addList(0); $.ajax({
} type: "GET",
}); url: "/tospur/wp-admin/admin-ajax.php",
data: "action=serachCity&cityId="+cityId,
//区域联动板块 success:function(json){
$("#areaId").change(function(){ addOption(json,area);
var areaId = $("#areaId").val(); }
var cityId = $("#cityId").val(); });
var plate = $("#plateId");
$("#houseList").find("li").remove(); //城市联动房子面积
$('#plateId').find('option:not(:first-child)').remove(); $.ajax({
$.ajax({ type: "GET",
type: "GET", url: "/tospur/wp-admin/admin-ajax.php",
url: "/tospur/wp-admin/admin-ajax.php", data: "action=searchArea&cityId="+cityId,
data: "action=serachCity&cityId="+cityId+"&districtId="+areaId, success:function(json){
success:function(json){ addOption(json,acreage);
addOption(json,plate); }
} });
}); //城市联动房子价格
}); $.ajax({
type: "GET",
//推荐房源下显示图片信息以及房名 url: "/tospur/wp-admin/admin-ajax.php",
$("#areaId,#plateId,#buildProperty,#room,#acreage,#price").change(function(){ data: "action=searchUnitPriceRange&cityId="+cityId,
addList(0); success:function(json){
}); addOption(json,price);
}
//添加房源中搜索框的搜索 });
$("#search").click(function(){ addList(0);
$searchtext = $("#searchtext").val(); }
$("#houseList").find("li").remove(); });
$.ajax({
type: "post", //区域联动板块
url: "/tospur/wp-admin/admin-ajax.php", $("#areaId").change(function(){
data: "action=searchHouse&searchText="+$searchtext, var areaId = $("#areaId").val();
success:function(json){ var cityId = $("#cityId").val();
var result = json.result; var plate = $("#plateId");
for(var i = 0; i < result.length; i++){ $("#houseList").find("li").remove();
var name = result[i]["name"]; $('#plateId').find('option:not(:first-child)').remove();
var id = result[i]['id']; $.ajax({
var imgUrl = json.images[id]; type: "GET",
var img = $("<img>").attr({"src":imgUrl,"height":100,"width":100}); url: "/tospur/wp-admin/admin-ajax.php",
var li = $("<li>").addClass("addImg").append(img).append(name); data: "action=serachCity&cityId="+cityId+"&districtId="+areaId,
$("#houseList").append(li); success:function(json){
} addOption(json,plate);
} }
}); });
}) });
//根据上方选择的城市,选择推荐置业顾问的默认城市 //推荐房源下显示图片信息以及房名
$("#recConsultantBt").click(function(){ $("#areaId,#plateId,#buildProperty,#room,#acreage,#price").change(function(){
$('#consultCity').find('option').remove(); addList(0);
$("#consultantList").find("li").remove(); });
var consulCityId = $("#baseCity").val();
var consultantName =$("#consultantName").val(); //添加房源中搜索框的搜索
var cityName = $("#baseCity").find("option:selected").text(); $("#search").click(function(){
var option = $("<option>").attr("value",consulCityId).append(cityName); $searchtext = $("#searchtext").val();
$("#consultCity").append(option); $("#houseList").find("li").remove();
$.ajax({ $.ajax({
type: "GET", type: "post",
url: "/tospur/wp-admin/admin-ajax.php", url: "/tospur/wp-admin/admin-ajax.php",
data: "action=searchConsultant&consulCityId="+consulCityId+"&consultantName="+consultantName, data: "action=searchHouse&searchText="+$searchtext,
success:function(json){ success:function(json){
for(var i = 0; i <=json.length-1; i++){ var result = json.result;
var name = json[i]["consultantName"]; for(var i = 0; i < result.length; i++){
var imgUrl = json[i]["imageUrl"]; var name = result[i]["name"];
var img = $("<img>").attr({"src":imgUrl,"height":100,"width":100}); var id = result[i]['id'];
var li = $("<li>").attr("id",json[i]["id"]).append(img).append(name).addClass("consultantImg"); var imgUrl = json.images[id];
$("#consultantList").append(li); var img = $("<img>").attr({"src":imgUrl,"height":90,"width":140});
} var li = $("<li>").addClass("addImg").append(img).append(name);
} $("#houseList").append(li);
}); }
}); }
});
//添加置业顾问弹出层中搜索框的搜索内容 })
$("#searchConsult").click(function(){
var consulCityId = $("#consultCity").val(); //根据上方选择的城市,选择推荐置业顾问的默认城市
var consultantName =$("#consultantName").val(); $("#recConsultantBt").click(function(){
$("#consultantList").find("li").remove(); $('#consultCity').find('option').remove();
$.ajax({ $("#consultantList").find("li").remove();
type: "GET", var consulCityId = $("#baseCity").val();
url: "/tospur/wp-admin/admin-ajax.php", var consultantName =$("#consultantName").val();
data: "action=searchConsultant&consulCityId="+consulCityId+"&consultantName="+consultantName, var cityName = $("#baseCity").find("option:selected").text();
success:function(json){ var option = $("<option>").attr("value",consulCityId).append(cityName);
for(var i = 0; i <=json.length-1; i++){ $("#consultCity").append(option);
var name = json[i]["consultantName"]; $.ajax({
var imgUrl = json[i]["imageUrl"]; type: "GET",
var img = $("<img>").attr({"src":imgUrl,"height":100,"width":100}); url: "/tospur/wp-admin/admin-ajax.php",
var li = $("<li>").append(img).append(name).addClass("consultantImg"); data: "action=searchConsultant&consulCityId="+consulCityId+"&consultantName="+consultantName,
$("#consultantList").append(li); success:function(json){
} for(var i = 0; i <=json.length-1; i++){
} var name = json[i]["consultantName"];
}); var imgUrl = json[i]["imageUrl"];
}) var img = $("<img>").attr({"src":imgUrl,"height":90,"width":140,"style":"margin-right:50px"});
var li = $("<li>").attr("id",json[i]["id"]).append(img).append(name).addClass("consultantImg");
//点击添加房源中显示的列表,在界面中显示 $("#consultantList").append(li);
$("#houseList").on("click",".addImg",function(){ }
var recommendHouse = $("<input>").attr({"type":"hidden","name":"data[recommend][]","value": $(this).attr("id")}); }
var url = $(this).find("img").attr("src"); });
var img = $("<img>").attr({"src":url,"height":100,"width":100}); });
var cancel = $("<input>").attr({"type":"button","value":"删除"}).addClass("button action imgCancel");
var p = $("<p>").append(img).append(cancel).append(recommendHouse); //添加置业顾问弹出层中搜索框的搜索内容
$("#houseImg").append(p); $("#searchConsult").click(function(){
controlCommand(); var consulCityId = $("#consultCity").val();
}); var consultantName =$("#consultantName").val();
//添加置业顾问 $("#consultantList").find("li").remove();
$("#consultantList").on("click",".consultantImg",function(){ $.ajax({
var recommendConsultant = $("<input>").attr({"type":"hidden","name":"data[recConsultant][]","value": $(this).attr("id")}); type: "GET",
var cancel = $("<input>").attr({"type":"button","value":"删除"}).addClass("button action consultantCancel"); url: "/tospur/wp-admin/admin-ajax.php",
var font = $("<font>").append( $(this).text()); data: "action=searchConsultant&consulCityId="+consulCityId+"&consultantName="+consultantName,
var p = $("<p>").append(font).append(cancel).append(recommendConsultant); success:function(json){
$("#consultantImg").append(p); for(var i = 0; i <=json.length-1; i++){
}); var name = json[i]["consultantName"];
var imgUrl = json[i]["imageUrl"];
//新增房源相册 var img = $("<img>").attr({"src":imgUrl,"height":90,"width":140});
$("#housePicture").click(function(){ var li = $("<li>").attr("id",json[i]["id"]).append(img).append(name).addClass("consultantImg");
var checkBox = $("<input>").attr({"type":"radio","name":"frontCover","value":i}); $("#consultantList").append(li);
var picDelet = $("<input>").attr({"type":"button","value":"删除"}).addClass("button action picDelet"); }
var file = $("<input>").attr({"type":"file","name":"files["+i+"]"}).addClass("picFiles"); }
var select = $("<select>").attr("name","data["+i+"][type]"); });
var checkTd = $("<th>").append(checkBox); })
var picDeletTd = $("<td>").append(picDelet);
var selectTd = $("<th>").append(select); //点击添加房源中显示的列表,在界面中显示
var fileTd = $("<th>").append(file); $("#houseList").on("click",".addImg",function(){
{% for item in photoType %} var recommendHouse = $("<input>").attr({"type":"hidden","name":"data[recommend][]","value": $(this).attr("id")});
select.append($("<option>").attr("value",{{item.id}}).append('{{item.value}}')); var url = $(this).find("img").attr("src");
{% endfor%} var img = $("<img>").attr({"src":url,"height":90,"width":140,"style":"margin-right:50px"});
var p = $("<p>").append(checkTd).append(selectTd).append(fileTd).append(picDeletTd); var cancel = $("<input>").attr({"type":"button","value":"删除"}).addClass("button action imgCancel");
var fontA = $("<font>").append("设为封面"); var p = $("<p>").append(img).append(cancel).append(recommendHouse);
var fontB = $("<font>").append("类型"); $("#houseImg").append(p);
var fontC = $("<font>").append("相册"); controlCommand();
var tdA = $("<th>").append(fontA); });
var tdB = $("<th>").append(fontB); //添加置业顾问
var tdC = $("<th>").append(fontC); $("#consultantList").on("click",".consultantImg",function(){
var titleP = $("<p>").append(tdA).append(tdB).append(tdC); var url = $(this).find("img").attr("src");
$("#picList").append(p); var img = $("<img>").attr({"src":url,"height":90,"width":140,"style":"margin-right:55px"});
if( titleFlag== 0){ var recommendConsultant = $("<input>").attr({"type":"hidden","name":"data[recConsultant][]","value": $(this).attr("id")});
$("#picList").before(titleP); var cancel = $("<input>").attr({"type":"button","value":"删除"}).addClass("button action consultantCancel");
titleFlag = 1 var font = $("<font>").attr("style","margin-right:50px").append( $(this).text());
} var p = $("<p>").append(img).append(font).append(cancel).append(recommendConsultant);
i++ $("#consultantImg").append(p);
}); });
//房源相册 //新增房源相册
$("#picList").on("change",".picFiles",function(){ $("#housePicture").click(function(){
readURL(this,2); var radio = $("<input>").attr({"type":"radio","name":"frontCover","value":i,});
$(this).hide(); var picDelet = $("<input>").attr({"type":"button","value":"删除"}).addClass("button action existsCancel");
}); var file = $("<input>").attr({"type":"file","name":"files["+i+"]"}).addClass("picFiles");
var select = $("<select>").attr({"name":"data["+i+"][type]"});
//删除房源相册、推荐房源、推荐置业顾问 var dicRadio = $("<div>").append(radio).addClass("col-md-3");
$("#houseImg,#consultantImg,#picList").on("click",".imgCancel,.consultantCancel,.picDelet",function(){ var dicPicDelet = $("<div>").append(picDelet).addClass("col-md-2");
$(this).parents("p").remove(); var dicFile = $("<div>").append(file).addClass("col-md-3");
}); var dicSelect = $("<div>").append(select).addClass("col-md-3");
$("#preview,#picList,#houseImg,#consultantImg").on("click",".existsCancel",function(){ var div = $("<div>").append(dicSelect).append(dicFile).append(dicRadio).append(dicPicDelet).addClass("row");
$(this).parent().remove(); {% for item in photoType %}
}); select.append($("<option>").attr("value",{{item.id}}).append('{{item.value}}'));
{% endfor%}
$('#newHouse').validate({ var fontA = $("<div>").append("<font>").append("设为封面").addClass("col-md-3");
onkeyup: false, var fontB = $("<div>").append("<font>").append("类型").addClass("col-md-3");
onfocusout: false, var fontC = $("<div>").append("<font>").append("相册").addClass("col-md-3");
rules: { var titleP = $("<div>").append(fontB).append(fontC).append(fontA).addClass("row");
housename:'required', $("#picList").append(div);
mark:'required', var url = getUrlParmas();
community_name:'required', if(!url.id){
address:'required', if( titleFlag== 0){
average_price:'required', $("#picList").before(titleP);
latest_news:'required' titleFlag = 1
}, }
messages: { }
housename:'请输入楼盘名称',
mark:'请输入标签', i++
community_name:'请输入小区名称', });
address:'请输入地址',
average_price:'请输入均价', //房源相册
latest_news:'请输入最新动态' $("#picList").on("change",".picFiles",function(){
}, readURL(this,2);
errorLabelContainer: "#notice", $(this).hide();
errorElement: 'span', });
submitHandler: function (form) {
form.submit(); //删除房源相册、推荐房源、推荐置业顾问
} $("#houseImg,#consultantImg").on("click",".imgCancel,.consultantCancel,.picDelet",function(){
}); $(this).parents("p").remove();
});
//file上传之前,显示图片的方法 $("#preview,#houseImg,#consultantImg").on("click",".existsCancel",function(){
function readURL(input,type) { $(this).parent().remove();
if(type == 1){ });
if (input.files && input.files[0]){
var reader = new FileReader(); $("#picList").on("click",".existsCancel",function(){
reader.onload = function (e) { $(this).parent().parent().remove();
var img = $("<img>").attr({"id":"target","src":e.target.result,"heghit":100,"width":100}); });
var button = $("<input>").attr({"type":"button","value":"取消","property":+i,"id":+i}).addClass("button action cancel");
var type = $("<input>").attr({"type":"hidden","name":"data["+i+"][type]","value":4,"property":+i}); $('#newHouse').validate({
var file = $("<input>").attr({"type":"file","name":"files["+(i+1)+"]","property":+(i+1)}).addClass("files"); onkeyup: false,
var select = $("<select>").attr({"name":"data["+i+"][buildProperty]"}); onfocusout: false,
{% for item in buildProperty %}{{item.id}} errorClass: "my-error-class",
select.append($("<option>").attr("value",{{item.id}}).append('{{item.value}}')); rules: {
{% endfor%} housename:'required',
var areatext = $("<input>").attr({"type":"text","placeholder":"面积","name":"data["+i+"][housearea]"}).addClass("form-control"); mark:'required',
var div = $("<div>").append(select).append(areatext).append(button).append(type); community_name:'required',
var span = $("<span>").attr({"property":+i}).append(img).append(div); address:'required',
$("form").find("#preview > p").before(file); average_price:'required',
$("#preview > p").append(span); latest_news:'required',
i++; baseCity:{
} selectcheck: true
} },
}else{ baseAreaId:{
if (input.files && input.files[0]){ selectcheck: true
var reader = new FileReader(); },
reader.onload = function (e){ basePlateId:{
var img = $("<img>").attr({"src":e.target.result,"heghit":100,"width":100}); selectcheck: true
$(input).before(img); }
}
} },
} messages: {
reader.readAsDataURL(input.files[0]); housename:'请输入楼盘名称',
} mark:'请输入标签',
function addOption(json,select){ community_name:'请输入小区名称',
var selectId = select.attr("id"); address:'请输入地址',
for(var i = 0; i <=json.length-1; i++){ average_price:'请输入均价',
var id = json[i]["id"]; latest_news:'请输入最新动态'
var value = json[i]["value"]; },
if(selectId == "acreage" || selectId == "price"){ errorLabelContainer: "#notice",
id = value; errorElement: 'div',
} submitHandler: function (form) {
var Option = $("<option>").attr({"value": id}).append(value); if($("#preview div").length == 0 ){
select.append(Option); alert("请选择主力户型");
} }else if($("#consultantImg > p").length == 0){
} alert("请选择置业顾问");
} else{
function controlCommand(){ form.submit();
var num = $("#houseImg > p").length; }
if(num>3){ }
alert("最多只能推荐3个房源"); });
$("#houseImg").find("p:last-child").remove(); jQuery.validator.addMethod('selectcheck', function (value) {
} return (value != '-1');
} },"请选择城市区域");
//file上传之前,显示图片的方法
function readURL(input,type) {
function getUrlParmas(){ if(type == 1){
var href = location.search.substr(1,location.search.length-1); if (input.files && input.files[0]){
var params = href.split("&"); var reader = new FileReader();
var map = {}; reader.onload = function (e) {
for(item in params){ var img = $("<img>").attr({"id":"target","src":e.target.result,"height":90,"width":140,"style":"margin-right:50px;margin-top:10px"});
var key = params[item].split("=")[0] || ""; var button = $("<input>").attr({"type":"button","value":"取消","property":+i,"id":+i}).addClass("button action cancel");
var value = params[item].split("=")[1] || ""; var type = $("<input>").attr({"type":"hidden","name":"data["+i+"][type]","value":4,"property":+i});
map[key] = value; var mainHousePic = $("<input>").attr({"type":"hidden","name":"data["+i+"][mainHouse]","value":0,"property":+i});
} var file = $("<input>").attr({"type":"file","name":"files["+(i+1)+"]","property":+(i+1)}).addClass("files");
return map; var select = $("<select>").attr({"name":"data["+i+"][buildProperty]","style":"margin-right:50px"});
} {% for item in buildProperty %}{{item.id}}
select.append($("<option>").attr("value",{{item.id}}).append('{{item.value}}'));
function addList($houseType){ {% endfor%}
$("#houseList").find("li").remove(); var areatext = $("<input>").attr({"type":"text","placeholder":"面积","name":"data["+i+"][housearea]","style":"width: 100px;display:inline-block;margin-right:50px"}).addClass("form-control");
var cityId = $("#baseCity").val(); var div = $("<div>").attr({"property":+i}).append(img).append(select).append(areatext).append(button).append(type).append(mainHousePic);
var buildPropertyId = $("#buildProperty").val(); $("form").find("#preview > p").after(file);
var room = $("#room").val(); $("#preview > p").append(div);
var areaId = $("#areaId").val(); i++;
var cityId = $("#cityId").val(); }
var plateId = $("#plateId").val(); }
var acreage = $("#acreage").val(); }else{
var price = $("#price").val(); if (input.files && input.files[0]){
$.ajax({ var reader = new FileReader();
type: "post", reader.onload = function (e){
url: "/tospur/wp-admin/admin-ajax.php", var img = $("<img>").attr({"src":e.target.result,"height":90,"width":140});
data: "action=searchHouse&cityId="+cityId+"&districtId="+areaId+"&plateId="+plateId+"&buildPropertyId="+buildPropertyId+"&roomId="+room+"&acreage="+acreage+"&totalPrice="+price+"&houseType="+$houseType, $(input).before(img);
success:function(json){ }
var result = json.result; }
var urlParams = getUrlParmas(); }
for(var i = 0; i <result.length; i++){ reader.readAsDataURL(input.files[0]);
var name = result[i]["name"]; }
var id = result[i]['id']; function addOption(json,select){
var imgUrl = result[i]['path']; var selectId = select.attr("id");
var img = $("<img>").attr({"src":imgUrl,"height":100,"width":100}); for(var i = 0; i <=json.length-1; i++){
var li = $("<li>").attr("id",id).addClass("addImg").append(img).append(name); var id = json[i]["id"];
if(urlParams["id"]){ var value = json[i]["value"];
if(urlParams["id"]!=id){ if(selectId == "acreage" || selectId == "price"){
$("#houseList").append(li); id = value;
} }
}else{ var Option = $("<option>").attr({"value": id}).append(value);
$("#houseList").append(li); select.append(Option);
} }
} }
}
}); function controlCommand(){
} var num = $("#houseImg > p").length;
}); if(num>3){
})(jQuery); alert("最多只能推荐3个房源");
$("#houseImg").find("p:last-child").remove();
</script> }
}
</body>
function getUrlParmas(){
var href = location.search.substr(1,location.search.length-1);
var params = href.split("&");
var map = {};
for(item in params){
var key = params[item].split("=")[0] || "";
var value = params[item].split("=")[1] || "";
map[key] = value;
}
return map;
}
function addList($houseType){
$("#houseList").find("li").remove();
var cityId = $("#baseCity").val();
var buildPropertyId = $("#buildProperty").val();
var room = $("#room").val();
var areaId = $("#areaId").val();
var cityId = $("#cityId").val();
var plateId = $("#plateId").val();
var acreage = $("#acreage").val();
var price = $("#price").val();
$.ajax({
type: "post",
url: "/tospur/wp-admin/admin-ajax.php",
data: "action=searchHouse&cityId="+cityId+"&districtId="+areaId+"&plateId="+plateId+"&buildPropertyId="+buildPropertyId+"&roomId="+room+"&acreage="+acreage+"&totalPrice="+price+"&houseType="+$houseType,
success:function(json){
var result = json.result;
var urlParams = getUrlParmas();
for(var i = 0; i <result.length; i++){
var name = result[i]["name"];
var id = result[i]['id'];
var imgUrl = result[i]['path'];
var img = $("<img>").attr({"src":imgUrl,"height":90,"width":140,"style":"margin-right:50px"});
var li = $("<li>").attr("id",id).addClass("addImg").append(img).append(name);
if(urlParams["id"]){
if(urlParams["id"]!=id){
$("#houseList").append(li);
}
}else{
$("#houseList").append(li);
}
}
}
});
}
});
})(jQuery);
</script>
</body>
</html> </html>
\ No newline at end of file
<!DOCTYPE HTML> <!DOCTYPE HTML>
<html> <html>
<head> <head>
{% set title = houseId?"修改租房房源":"添租新房房源" %} {% set title = houseId?"修改租房房源":"添租新房房源" %}
<meta charset="utf-8"> <meta charset="utf-8">
<title>{{title}}</title> <title>{{title}}</title>
</head> </head>
<body> <body>
<h2 class="title">{{title}}</h2> <h2 class="title">{{title}}</h2>
<form action="" method="POST" enctype="multipart/form-data"> <form action="" method="POST" enctype="multipart/form-data" id="rentHouse">
<table class="form-table"> <div class="row">
<tbody> <div class="col-md-11">
<tr> <div class="row">
<th><label for="housename">房源名:</label></th> <div class="col-md-4">
<td> <input name="housename" id="housename" type="text" value="{{result.name}}" class="regular-text code" style="width: 150px;"></td> <label for="housename">房源名:</label>
</tr> <input name="housename" id="housename" type="text" value="{{result.name}}" class="form-control" >
<tr> </div>
<th><label for="mark">标签:</label></th> <div class="col-md-4">
<td> <input name="mark" id="mark" type="text" value="{{mark}}" class="regular-text code"></td> <label for="community_name">小区名称:</label>
</tr> <input name="community_name" type="text" value="{{result.community_name}}" class="form-control">
{% if not houseId %} </div>
<tr> <div class="col-md-4">
<th><label for="owner_name">业主姓名</label></th> <label for="rent">租金:</label>
<td> <input name="owner_name" id="owner_name" type="text" value="" class="regular-text code" style="width: 150px;"></td> <div class="row">
</tr> <p>
<tr> <input name="rent" id="rent" type="text" value="{{rent.value}}" class="form-control" style="width:80%;display: inline-block"> 元/月
<th><label for="owner_phone">业主电话</label></th> </p>
<td> <input name="owner_phone" id="owner_phone" type="text" value="" class="regular-text code" style="width: 150px;"></td> </div>
</tr> </div>
{% endif %} </div><br>
<tr> <div class="row">
<th><label for="rent">租金</label></th> <div class="col-md-6">
<td> <input name="rent" id="rent" type="text" value="{{result.rent}}" class="regular-text code" style="width: 90px;"></td> <label for="mark">标签:</label>
</tr> <input name="mark" id="mark" type="text" value="{{mark}}" class="form-control">
</div>
</tbody> </div><br>
</table> <div class="row">
<h2 class="title">基本信息</h2> {% if not houseId %}
<table class="form-table"> <div class="col-md-4">
<tbody> <label for="owner_name">业主姓名:</label>
<tr> <input name="owner_name" id="owner_name" type="text" value="" class="form-control">
<th><label for="from">户型</label></th> </div>
<td> <div class="col-md-4">
<select id="buildproperty_id" name="buildproperty_id"> <label for="owner_phone">业主电话:</label>
<option value="-1"> 户型</option> <input name="owner_phone" id="owner_phone" type="text" value="" class="form-control">
{% for item in buildProperty %} </div>
<option {{ item.id == result.buildproperty_id?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option> {% endif %}
{% endfor %}
</select> </div><br>
</td>
</tr>
<tr>
<th><label for="covered_area">面积</label></th> <h2 class="title">基本信息</h2>
<td> <input name="covered_area" type="text" value="{{result.covered_area}}" class="regular-text code" style="width: 90px;"></td> <div class="row">
</tr> <div class="col-md-12">
<tr> <label for="suite">门牌号码:</label></th>
<th><label for="floor">楼层:</label></th> <input name="suite" type="text" value="{{result.suite}}"style="width: 10%">
<td> <input name="floor" type="text" value="{{result.floor}}" class="regular-text code" style="width: 90px;"></td> &nbsp;
</tr> <label for="floor">楼层:</label>
<tr> <input name="floor" type="text" value="{{result.floor}}" style="width: 5%">
<th><label for="faceto">朝向:</label></th> &nbsp;
<td> <input name="faceto" type="text" value="{{result.faceto}}" class="regular-text code" style="width: 70px;"></td> <label for="totalFloor">总层:</label>
</tr> <input type="text" name="totalFloor"value="{{result.totalFloor}}" style="width: 5%">
<tr> &nbsp;
<th><label for="decoration">装修状况</label></th> <label for="faceto">朝向:</label>
<td> <input name="decoration" type="text" value="{{result.decoration}}" class="regular-text code" style="width: 70px;"></td> <select name="faceto">
</tr> <option value="其他">其他</option>
<tr> <option value="东"></option>
<th><label for="age">建筑年代</label></th> <option value="南"></option>
<td> <input name="age" type="text" value="{{result.age}}" class="regular-text code" style="width: 70px;"></td> <option value="西">西</option>
</tr> <option value="北"></option>
<tr> <option value="东西">东西</option>
<th><label for="matching_facilities">配套设施</label></th> <option value="南北">南北</option>
<td> <input name="matching_facilities" type="text" value="{{result.matching_facilities}}" class="regular-text code"></td> <option value="南南">南南</option>
</tr> <option value="东南">东南</option>
<tr> <option value="东北">东北</option>
<th><label for="flat">楼号</label></th> <option value="西南">西南</option>
<td> <input name="flat" type="text" value="{{result.flat}}" class="regular-text code" style=" width: 50px;"></td> <option value="西北">西北</option>
</tr> </select>
<tr> &nbsp;
<th><label for="suite"></label></th> <label for="age">建筑年代:</label>
<td> <input name="suite" type="text" value="{{result.suite}}" class="regular-text code" style=" width: 50px;"></td> <!--<input name="age" type="text" value="{{result.age}}" class="form-control">-->
</tr> <select name="age">
<tr> <option>未知</option>
<th><label for="overview">房源点评</label></th> {% for item in age%}
<td> <textarea name="overview" rows="4" cols="40" class="large-text code" style=" width: 400px;">{{result.overview}}</textarea></td> <option {{ item == result.age?"selected":"" }}value="{{item}}">{{item}}</option>
</tr> {% endfor %}
<tr> </select>
<th><label for="from">所属地区</label></th> &nbsp;
<td> <label for="propertyRight">产权:</label>
<select id="baseCity" name="baseCity"> <select name="propertyRight">
<option value="-1"> 城市</option> <option value="个人产权">个人产权</option>
{% for item in city %} <option value="单位产权">单位产权</option>
<option {{ item.id == result.city_id?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option> <option value="售后产权">售后产权</option>
{% endfor %} <option value="家庭成员共有">家庭成员共有</option>
</select> <option value="使用权">使用权</option>
<select id="baseAreaId" name="baseAreaId"> <option value="小产权">小产权</option>
<option value = -1">区域</option> <option value="协议房">协议房</option>
{% if district %} <option value="私产">私产</option>
{% for item in district %} <option value="公产">公产</option>
<option {{ item.id == result.district_id?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option> <option value="合同发票">合同发票</option>
{% endfor %} <option value="三联单">三联单</option>
{% endif %} <option value="其他">其他</option>
</select> </select>
<select id="basePlateId" name="basePlateId"> </div>
<option value = "-1">板块</option> </div><br>
{% if district %} <div class="row">
{% for item in plate %} <div class="col-md-12">
<option {{ item.id == result.plate_id?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option> <label for="propertyProof">产证:</label>
{% endfor %} <input type="text" name="propertyProof" value="{{result.propertyProof}}">
{% endif %} &nbsp;
</select> <label for="decoration">装修状况:</label>
</td> <select name="decoration">
</tr> <option value="毛坯">毛坯</option>
<tr> <option value="简单装修">简单装修</option>
<th><label for="location">地域坐标</label></th> <option value="中等装修">中等装修</option>
<td> <input name="location" id="location" type="text" value="{{result.location}}" class="regular-text code"></td> <option value="精装修">精装修</option>
</tr> <option value="豪华装修">豪华装修</option>
</tbody> </select>
</table> &nbsp;
<h2 class="title">位置及周边</h2> <label for="useArea">使用面积:</label>
<table class="form-table"> <input type="text" name="useArea" value="{{result.useArea}}" style="width: 10%;display: inline-block">平方米
<tbody> &nbsp;
<tr> <label for="covered_area">建筑面积:</label>
<th><label for="address">地址</label></th> <input name="covered_area" type="text" value="{{result.covered_area}}" style="width:10%;display: inline-block">平方米
<td> <input name="address" type="text" value="{{result.address}}" class="regular-text code"></td> &nbsp;
</tr> <input type="checkbox" id="keyCheck" {{ result.key?"checked":"" }}> <label for="key">钥匙:</label><input type="text" {% if not result.key %} disabled="true" {% endif %} id="key" name="key" value="{{result.key}}" style="width: 10%">
<tr> </div>
<th><label for="address">小区名称</label></th> </div><br>
<td> <input name="community_name" type="text" value="{{result.community_name}}" class="regular-text code" style="width: 150px;"></td> <div class="row">
</tr> <div class="col-md-12">
<tr> <input type="checkbox" id="garageCheck" {{ result.garage?"checked":"" }}> <label for="garage">车库:</label><input type="text" {% if not result.garage %}disabled="true"{% endif %} id="garage" name="garage" value="{{result.garage}}" style="width: 10%">
<th><label for="traffic">交通线路</label></th> &nbsp;
<td> <input name="traffic" type="text" value="{{result.traffic}}" class="regular-text code" style="width: 300px;"></td> <label for="street">街道:</label>
</tr> <input type="text" name="street" value="{{result.street}}">
<tr> &nbsp;
<th><label for="periphery">周边配套</label></th> <label for="flat">楼号:</label>
<td> <input name="periphery" type="text" value="{{result.periphery}}" class="regular-text code" ></td> <input name="flat" type="text" value="{{result.flat}}" style="width: 10%;">
</tr> &nbsp;
</tbody> <label for="matching_facilities">设施:</label>
</table> <input type="text" name="matching_facilities" value="{{result.matching_facilities}}">
&nbsp;
<h2 class="title">关联信息</h2> <label for="structure">结构:</label>
<table class="form-table"> <select name="structure">
<tbody> <option value="其他">其他</option>
<tr> <option value="框架">框架</option>
<th><label>房源相册</label></th> <option value="砖混">砖混</option>
<td> <option value="剪力">剪力</option>
<div id="picList"> <option value="钢混">钢混</option>
{% set exists_photo_ids = "" %} <option value="木混">木混</option>
{% for item in images %} <option value="砖木">砖木</option>
{% if exists_photo_ids != "" %} </select>
{% set exists_photo_ids = exists_photo_ids~"," %} </div>
{% endif %} </div><br>
{% set exists_photo_ids = exists_photo_ids~item.image_id %} <div class="row">
<p> <div class="col-md-12">
<input type="radio" name="frontCover" value="{{item.image_id}}" {{ result.frontCover_id == item.image_id?"checked":"" }} /> <label for="from">户型:</label>
<select name="exists_photo[{{ item.image_id }}][type]"> <select id="buildproperty_id" name="buildproperty_id">
{% for i in photoType %} {% for item in buildProperty %}
<option {{ i.id == item.image_type?"selected":"" }} value="{{ i.id }}">{{ i.value }}</option> <option {{ item.id == result.buildproperty_id?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %} {% endfor %}
</select> </select>
<img src="{{siteUrl}}{{item.path}}" heghit="100" width="100"> <label for="roomNum">室:</label>
<input type="button" value="取消" class="cancel existsCancel"> <select name="roomNum">
</p> <option value="0">0</option>
{% endfor %} <option value="1">1</option>
<input type="hidden" name="exists_photo_ids" value="{{exists_photo_ids}}" > <option value="2">2</option>
</div><br /> <option value="3">3</option>
<button type="button" id="housePicture" class="button action" data-toggle="modal"> <option value="4">4</option>
新增 <option value="5">5</option>
</button> <option value="6">6</option>
</td> <option value="7">7</option>
</tr> <option value="8">8</option>
<tr> </select>
<th><label for="recommend">推荐房源</label></th> <label for="livingRoom">厅:</label>
<td> <select name="livingRoom">
<div id="houseImg"></div><br /> <option value="0">0</option>
<button type="button" class="button action" data-toggle="modal" data-target="#myModal" id="recHouseBt" > <option value="1">1</option>
添加房源 <option value="2">2</option>
</button> <option value="3">3</option>
</td> <option value="4">4</option>
</tr> </select>
<tr> <label for="bathRoom">卫:</label>
<th><label for="consultant">置业顾问</label></th> <select name="bathRoom">
<td> <option value="0">0</option>
<div id="consultantImg"> <option value="1">1</option>
{% for item in consultant %} <option value="2">2</option>
<p> <option value="3">3</option>
<span>{{item.name}}</span> <option value="4">4</option>
<input type="button" value="删除" class="consultantCancel existsCancel"> </select>
<input type="hidden" name="data[recConsultant][]" value="{{item.id}}"> <label for="kitchen">厨:</label>
</p> <select name="kitchen">
{% endfor %} <option value="0">0</option>
</div><br /> <option value="1">1</option>
<button type="button" class="button action" data-toggle="modal" data-target="#myConsultant" id="recConsultantBt"> <option value="2">2</option>
选择置业顾问 <option value="3">3</option>
</button> </select>
</td> <label for="balcony">阳台:</label>
</tr> <select name="balcony">
{% if role == 'administrator' %} <option value="0">0</option>
<tr> <option value="1">1</option>
<th><label for="from">状态</label></th> <option value="2">2</option>
<td> <option value="3">3</option>
<select id="status" name="status"> </select>
{% for item in status %} </div>
<option value={{item.id}}>{{item.value}}</option> </div><br>
{% endfor %} <div class="row">
</select> <div class="col-md-12">
</td> <label for="overview">房源点评:</label>
</tr> <textarea name="overview" rows="4" cols="40" class="form-control" >{{result.overview}}</textarea>
{% endif %} </div>
</tbody> </div><br>
</table> <h2 class="title">位置及周边</h2>
<input type="text" name="type" value="3" hidden="hidden"> <div class="row">
{% if houseId %} <div class="col-md-4">
<input type="text" name="houseId" value="{{houseId}}" hidden="hidden"> <label for="from">所属地区:</label>
{% endif %} <div class="row">
<input type="submit" id="submit" class="button action"> <div class="col-md-3">
</form> <select id="baseCity" name="baseCity" class="required">
<option value="-1"> 城市</option>
{% for item in city %}
<!-- Modal --> <option {{ item.id == result.city_id?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
<!-- 新增房源弹出层 --> {% endfor %}
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> </select>
<div class="modal-dialog" role="document"> </div>
<div class="modal-content"> <div class="col-md-3">
<select id="baseAreaId" name="baseAreaId">
<div class="modal-body" style="height: 300px;overflow: auto;"> <option value = "-1">区域</option>
<select id="cityId"> {% if district %}
</select> {% for item in district %}
<select id="areaId"> <option {{ item.id == result.district_id?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
<option value = "-1">区域</option> {% endfor %}
</select> {% endif %}
<select id="plateId"> </select>
<option value = "-1">板块</option> </div>
</select> <div class="col-md-3">
<select id="price"> <select id="basePlateId" name="basePlateId">
<option value = "-1">价格</option> <option value = "-1">板块</option>
</select> {% if district %}
<select id="buildProperty"> {% for item in plate %}
<option value = "-1">房型</option> <option {{ item.id == result.plate_id?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% for item in buildProperty %} {% endfor %}
<option value="{{ item.id }}">{{ item.value }}</option> {% endif %}
{% endfor %} </select>
</select> </div>
<select id="room"> </div>
<option value = "-1">类型</option> </div>
{% for item in room %} <div class="col-md-4">
<option value="{{ item.id }}">{{ item.value }}</option> <label for="address">地址:</label>
{% endfor %} <input name="address" type="text" value="{{result.address}}" class="form-control">
</select> </div>
<select id="acreage"> <div class="col-md-4">
<option value = "-1">面积</option> <label for="traffic">交通线路:</label>
</select> <input name="traffic" type="text" value="{{result.traffic}}" class="form-control">
<input type="text" placeholder="请出入楼盘名/地段名搜索" id="searchtext"> </div>
<button type="button" class="button action" id="search">搜索</button> </div><br>
<ul id="houseList"> <div class="row">
</ul>
</div> <div class="col-md-4">
</div> <label for="periphery">周边配套:</label>
</div> <input name="periphery" type="text" value="{{result.periphery}}" class="form-control">
</div> </div>
<div class="col-md-4">
<!-- 置业顾问弹出层 --> <label for="location">地域坐标:</label>
<div class="modal fade" id="myConsultant" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> <input name="location" id="location" type="text" value="{{result.location}}" class="form-control">
<div class="modal-dialog" role="document"> </div>
<div class="modal-content"> </div><br>
<div class="modal-body" style="height: 300px;overflow: auto;">
<select id="consultCity"> <h2 class="title">关联信息</h2>
<option value=""> 城市</option> <table class="form-table">
{% for item in city %} <tbody>
<option value="{{ item.id }}">{{ item.value }}</option> <tr>
{% endfor %} <th><label>房源相册:</label></th>
</select> <td>
<input type="text" placeholder="请出入置业顾问姓名搜索" id="consultantName"> {% if houseId %}
<button type="button" class="button action" id="searchConsult">搜索</button> <div class="row">
<ul id="consultantList"> <div class="col-md-3">
</ul> <font>类型</font>
</div> </div>
</div> <div class="col-md-3">
</div> <font>相册</font>
</div> </div>
<div class="col-md-3">
<font>设为封面</font>
<script> </div>
(function($){ </div>
$(document).ready(function(){ {% endif %}
var titleFlag = 0; <div id="picList">
//主力房源中选择图片file的下标 {% set exists_photo_ids = "" %}
var i = 0; {% for item in images %}
//基本信息的联动AJAX {% if exists_photo_ids != "" %}
$("#baseCity").change(function(){ {% set exists_photo_ids = exists_photo_ids~"," %}
var cityId = $("#baseCity").val(); {% endif %}
var baserArea = $("#baseAreaId"); {% set exists_photo_ids = exists_photo_ids~item.image_id %}
$('#baseAreaId').find('option:not(:first-child)').remove(); <div class="row">
$('#basePlateId').find('option:not(:first-child)').remove(); <div class="col-md-3">
<select name="exists_photo[{{ item.image_id }}][type]" style="margin-right: 50px">
//城市联动区域 {% for i in photoType %}
$.ajax({ <option {{ i.id == item.image_type?"selected":"" }} value="{{ i.id }}">{{ i.value }}</option>
type: "GET", {% endfor %}
url: "/tospur/wp-admin/admin-ajax.php", </select>
data: "action=serachCity&cityId="+cityId, </div>
success:function(json){ <div class="col-md-3">
addOption(json,baserArea); <img src="{{siteUrl}}{{item.path}}" height="90" width="140" style="margin-right: 50px">
} </div>
}); <div class="col-md-3">
}); <input type="radio" name="frontCover" style="margin-right: 50px" value="{{item.image_id}}" {{ result.frontCover_id == item.image_id?"checked":"" }} />
//区域联动板块 </div>
$("#baseAreaId").change(function(){ <div class="col-md-2">
var basePlate = $("#basePlateId"); <input type="button" value="删除" class="button action cancel existsCancel">
var areaId = $("#baseAreaId").val(); </div>
var cityId = $("#baseCity").val(); </div>
$('#basePlateId').find('option:not(:first-child)').remove(); {% endfor %}
$.ajax({ <input type="hidden" name="exists_photo_ids" value="{{exists_photo_ids}}" >
type: "GET", </div>
url: "/tospur/wp-admin/admin-ajax.php", <button type="button" id="housePicture" class="button action" data-toggle="modal" style="margin-top: 10px">
data: "action=serachCity&cityId="+cityId+"&districtId="+areaId, 新增
success:function(json){ </button>
addOption(json,basePlate); </td>
} </tr>
}); <tr>
}); <th><label for="traffic">推荐房源</label></th>
<td>
//根据上方选择的城市,选择推荐房源的默认城市 <div id="houseImg">
$("#recHouseBt").click(function(){ {% for item in recommends %}
$('#cityId').find('option').remove(); <p>
$('#areaId').find('option:not(:first-child)').remove(); <img src="{{siteUrl}}{{item.path}}" height="90" width="140" style="margin-right: 50px">
$('#plateId').find('option:not(:first-child)').remove(); <input type="button" value="删除" class="button action imgCancel existsCancel">
$('#price').find('option:not(:first-child)').remove(); <input type="hidden" name="data[recommend][]" value="{{item.id}}">
$('#acreage').find('option:not(:first-child)').remove(); </p>
$("#houseList").find("li").remove(); {% endfor %}
var acreage =$("#acreage"); </div><br />
var price = $("#price"); <button type="button" class="button action" data-toggle="modal" data-target="#myModal" id="recHouseBt">
var cityId = $("#baseCity").val(); 添加房源
var cityName = $("#baseCity").find("option:selected").text(); </button>
var option = $("<option>").attr("value",cityId).append(cityName); </td>
$("#cityId").append(option); </tr>
var area = $("#areaId"); <tr>
if(cityId != -1){ <th><label for="periphery">置业顾问</label></th>
$.ajax({ <td>
type: "GET", <div id="consultantImg">
url: "/tospur/wp-admin/admin-ajax.php", {% for item in consultant %}
data: "action=serachCity&cityId="+cityId, <p>
success:function(json){ <img src="{{item.imageUrl}}" height="100" width="100" style="margin-right: 50px">
addOption(json,area); <span style="margin-right: 50px">{{item.name}}</span>
} <input type="button" value="删除" class="button action consultantCancel existsCancel">
}); <input type="hidden" name="data[recConsultant][]" value="{{item.id}}">
</p>
//城市联动房子面积 {% endfor %}
$.ajax({ </div><br />
type: "GET", <button type="button" class="button action" data-toggle="modal" data-target="#myConsultant" id="recConsultantBt">
url: "/tospur/wp-admin/admin-ajax.php", 选择置业顾问
data: "action=searchArea&cityId="+cityId, </button>
success:function(json){ </td>
addOption(json,acreage); </tr>
} </tbody>
}); </table>
//城市联动房子价格
$.ajax({ <input type="text" name="type" value="3" hidden="hidden">
type: "GET", {% if houseId %}
url: "/tospur/wp-admin/admin-ajax.php", <input type="text" name="houseId" value="{{houseId}}" hidden="hidden">
data: "action=searchUnitPriceRange&cityId="+cityId, {% endif %}
success:function(json){ </div>
addOption(json,price); <div class="col-md-1">
} <input type="submit" id="submit" class="button action" style="position: fixed;">
}); {% if role == 'administrator' %}
addList(2); <div class="row" style="position: fixed;top:50px;">
} <select id="status" name="status">
}); {% for item in status %}
<option {{ item.id == searchStatus.id?"selected":"" }} value={{item.id}}>{{item.value}}</option>
{% endfor %}
//区域联动板块 </select>
$("#areaId").change(function(){ </div>
var areaId = $("#areaId").val(); {% endif %}
var cityId = $("#cityId").val(); </div>
var plate = $("#plateId"); </div>
$("#houseList").find("li").remove(); </form>
$('#plateId').find('option:not(:first-child)').remove();
$.ajax({
type: "GET", <!-- Modal -->
url: "/tospur/wp-admin/admin-ajax.php", <!-- 新增房源弹出层 -->
data: "action=serachCity&cityId="+cityId+"&districtId="+areaId, <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
success:function(json){ <div class="modal-dialog" role="document">
addOption(json,plate); <div class="modal-content">
}
}); <div class="modal-body" style="height: 300px;overflow: auto;">
}); <select id="cityId">
</select>
//推荐房源下显示图片信息以及房名 <select id="areaId">
$("#areaId,#plateId,#buildProperty,#room,#acreage,#price").change(function(){ <option value = "-1">区域</option>
addList(2); </select>
}); <select id="plateId">
<option value = "-1">板块</option>
//添加房源中搜索框的搜索 </select>
$("#search").click(function(){ <select id="price">
$searchtext = $("#searchtext").val(); <option value = "-1">价格</option>
$("#houseList").find("li").remove(); </select>
$.ajax({ <select id="buildProperty">
type: "post", <option value = "-1">房型</option>
url: "/tospur/wp-admin/admin-ajax.php", {% for item in buildProperty %}
data: "action=searchHouse&searchText="+$searchtext, <option value="{{ item.id }}">{{ item.value }}</option>
success:function(json){ {% endfor %}
var result = json.result; </select>
for(var i = 0; i < result.length; i++){ <select id="room">
var name = result[i]["name"]; <option value = "-1">类型</option>
var id = result[i]['id']; {% for item in room %}
var imgUrl = json.images[id]; <option value="{{ item.id }}">{{ item.value }}</option>
var img = $("<img>").attr({"src":imgUrl,"height":100,"width":100}); {% endfor %}
var li = $("<li>").addClass("addImg").append(img).append(name); </select>
$("#houseList").append(li); <select id="acreage">
} <option value = "-1">面积</option>
} </select>
}); <input type="text" placeholder="请出入楼盘名/地段名搜索" id="searchtext">
}) <button type="button" class="button action" id="search">搜索</button>
<ul id="houseList">
//根据上方选择的城市,选择推荐置业顾问的默认城市 </ul>
$("#recConsultantBt").click(function(){ </div>
$('#consultCity').find('option').remove(); </div>
$("#consultantList").find("li").remove(); </div>
var consulCityId = $("#baseCity").val(); </div>
var consultantName =$("#consultantName").val();
var cityName = $("#baseCity").find("option:selected").text(); <!-- 置业顾问弹出层 -->
var option = $("<option>").attr("value",consulCityId).append(cityName); <div class="modal fade" id="myConsultant" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
$("#consultCity").append(option); <div class="modal-dialog" role="document">
$.ajax({ <div class="modal-content">
type: "GET", <div class="modal-body" style="height: 300px;overflow: auto;">
url: "/tospur/wp-admin/admin-ajax.php", <select id="consultCity">
data: "action=searchConsultant&consulCityId="+consulCityId+"&consultantName="+consultantName, <option value=""> 城市</option>
success:function(json){ {% for item in city %}
for(var i = 0; i <=json.length-1; i++){ <option value="{{ item.id }}">{{ item.value }}</option>
var name = json[i]["consultantName"]; {% endfor %}
var imgUrl = json[i]["imageUrl"]; </select>
var img = $("<img>").attr({"src":imgUrl,"height":100,"width":100}); <input type="text" placeholder="请出入置业顾问姓名搜索" id="consultantName">
var li = $("<li>").attr("id",json[i]["id"]).append(img).append(name).addClass("consultantImg"); <button type="button" class="button action" id="searchConsult">搜索</button>
$("#consultantList").append(li); <ul id="consultantList">
} </ul>
} </div>
}); </div>
}); </div>
//添加置业顾问弹出层中搜索框的搜索内容 </div>
$("#searchConsult").click(function(){
var consulCityId = $("#consultCity").val();
var consultantName =$("#consultantName").val(); <script>
$("#consultantList").find("li").remove(); (function($){
$.ajax({ $(document).ready(function(){
type: "GET", var titleFlag = 0;
url: "/tospur/wp-admin/admin-ajax.php", //主力房源中选择图片file的下标
data: "action=searchConsultant&consulCityId="+consulCityId+"&consultantName="+consultantName, var i = 0;
success:function(json){ //基本信息的联动AJAX
for( $("#baseCity").change(function(){
var i = 0; i <=json.length-1; i++){ var cityId = $("#baseCity").val();
var name = json[i]["consultantName"]; var baserArea = $("#baseAreaId");
var imgUrl = json[i]["imageUrl"]; $('#baseAreaId').find('option:not(:first-child)').remove();
var img = $("<img>").attr({"src":imgUrl,"height":100,"width":100}); $('#basePlateId').find('option:not(:first-child)').remove();
var li = $("<li>").append(img).append(name).addClass("consultantImg");
$("#consultantList").append(li); //城市联动区域
} $.ajax({
} type: "GET",
}); url: "/tospur/wp-admin/admin-ajax.php",
}) data: "action=serachCity&cityId="+cityId,
success:function(json){
//点击添加房源中显示的列表,在界面中显示 addOption(json,baserArea);
$("#houseList").on("click",".addImg",function(){ }
var recommendHouse = $("<input>").attr({"type":"hidden","name":"data[recommend][]","value": $(this).attr("id")}); });
var url = $(this).find("img").attr("src"); });
var img = $("<img>").attr({"src":url,"height":100,"width":100}); //区域联动板块
var cancel = $("<input>").attr({"type":"button","value":"删除"}).addClass("imgCancel"); $("#baseAreaId").change(function(){
var p = $("<p>").append(img).append(cancel).append(recommendHouse); var basePlate = $("#basePlateId");
$("#houseImg").append(p); var areaId = $("#baseAreaId").val();
controlCommand("houseImg",3,0); var cityId = $("#baseCity").val();
}); $('#basePlateId').find('option:not(:first-child)').remove();
//添加置业顾问 $.ajax({
$("#consultantList").on("click",".consultantImg",function(){ type: "GET",
var recommendConsultant = $("<input>").attr({"type":"hidden","name":"data[recConsultant][]","value": $(this).attr("id")}); url: "/tospur/wp-admin/admin-ajax.php",
var cancel = $("<input>").attr({"type":"button","value":"删除"}).addClass("consultantCancel"); data: "action=serachCity&cityId="+cityId+"&districtId="+areaId,
var font = $("<font>").append( $(this).text()); success:function(json){
var p = $("<p>").append(font).append(cancel).append(recommendConsultant); addOption(json,basePlate);
$("#consultantImg").append(p); }
controlCommand("consultantImg",1,1); });
}); });
//新增房源相册 //根据上方选择的城市,选择推荐房源的默认城市
$("#housePicture").click(function(){ $("#recHouseBt").click(function(){
var checkBox = $("<input>").attr({"type":"radio","name":"frontCover","value":i}); $('#cityId').find('option').remove();
var picDelet = $("<input>").attr({"type":"button","value":"删除"}).addClass("button action picDelet"); $('#areaId').find('option:not(:first-child)').remove();
var file = $("<input>").attr({"type":"file","name":"files["+i+"]"}).addClass("picFiles"); $('#plateId').find('option:not(:first-child)').remove();
var select = $("<select>").attr("name","data["+i+"][type]"); $('#price').find('option:not(:first-child)').remove();
var checkTd = $("<th>").append(checkBox); $('#acreage').find('option:not(:first-child)').remove();
var picDeletTd = $("<td>").append(picDelet); $("#houseList").find("li").remove();
var selectTd = $("<th>").append(select); var acreage =$("#acreage");
var fileTd = $("<th>").append(file); var price = $("#price");
{% for item in photoType %} var cityId = $("#baseCity").val();
select.append($("<option>").attr("value",{{item.id}}).append('{{item.value}}')); var cityName = $("#baseCity").find("option:selected").text();
{% endfor%} var option = $("<option>").attr("value",cityId).append(cityName);
var p = $("<p>").append(checkTd).append(selectTd).append(fileTd).append(picDeletTd); $("#cityId").append(option);
var fontA = $("<font>").append("设为封面"); var area = $("#areaId");
var fontB = $("<font>").append("类型"); if(cityId != -1){
var fontC = $("<font>").append("相册"); $.ajax({
var tdA = $("<th>").append(fontA); type: "GET",
var tdB = $("<th>").append(fontB); url: "/tospur/wp-admin/admin-ajax.php",
var tdC = $("<th>").append(fontC); data: "action=serachCity&cityId="+cityId,
var titleP = $("<p>").append(tdA).append(tdB).append(tdC); success:function(json){
$("#picList").append(p); addOption(json,area);
if( titleFlag== 0){ }
$("#picList").before(titleP); });
titleFlag = 1
} //城市联动房子面积
i++ $.ajax({
}); type: "GET",
url: "/tospur/wp-admin/admin-ajax.php",
//房源相册 data: "action=searchArea&cityId="+cityId,
$("#picList").on("change",".picFiles",function(){ success:function(json){
readURL(this,2); addOption(json,acreage);
$(this).hide(); }
}); });
//城市联动房子价格
//删除房源相册、推荐房源、推荐置业顾问 $.ajax({
$("#houseImg,#consultantImg,#picList").on("click",".imgCancel,.consultantCancel,.picDelet",function(){ type: "GET",
$(this).parent("p").remove(); url: "/tospur/wp-admin/admin-ajax.php",
}); data: "action=searchUnitPriceRange&cityId="+cityId,
$("#picList,#houseImg,#consultantImg").on("click",".existsCancel",function(){ success:function(json){
$(this).parent().remove(); addOption(json,price);
}); }
});
$("#submit").click(function(){ addList(2);
if($("#housename").val()==""){ }
alert("请输入楼盘名"); });
return false;
}
}); //区域联动板块
$("#areaId").change(function(){
//file上传之前,显示图片的方法 var areaId = $("#areaId").val();
function readURL(input,type) { var cityId = $("#cityId").val();
if(type == 1){ var plate = $("#plateId");
if (input.files && input.files[0]){ $("#houseList").find("li").remove();
var reader = new FileReader(); $('#plateId').find('option:not(:first-child)').remove();
reader.onload = function (e) { $.ajax({
var img = $("<img>").attr({"id":"target","src":e.target.result,"heghit":100,"width":100}); type: "GET",
var button = $("<input>").attr({"type":"button","value":"取消","property":+i,"id":+i}).addClass("cancel"); url: "/tospur/wp-admin/admin-ajax.php",
var type = $("<input>").attr({"type":"hidden","name":"data["+i+"][type]","value":0,"property":+i}); data: "action=serachCity&cityId="+cityId+"&districtId="+areaId,
var file = $("<input>").attr({"type":"file","name":"files["+(i+1)+"]","property":+(i+1)}).addClass("files"); success:function(json){
var select = $("<select>").attr({"name":"data["+i+"][buildProperty]"}); addOption(json,plate);
{% for item in buildProperty %}{{item.id}} }
select.append($("<option>").attr("value",{{item.id}}).append('{{item.value}}')); });
{% endfor%} });
var areatext = $("<input>").attr({"type":"text","placeholder":"面积","name":"data["+i+"][housearea]"}).addClass("regular-text");
var div = $("<div>").append(select).append(areatext).append(button).append(type); //推荐房源下显示图片信息以及房名
var span = $("<span>").attr({"property":+i}).append(img).append(div); $("#areaId,#plateId,#buildProperty,#room,#acreage,#price").change(function(){
$("form").find("#preview > p").before(file); addList(2);
$("#preview > p").append(span); });
i++;
} //添加房源中搜索框的搜索
} $("#search").click(function(){
}else{ $searchtext = $("#searchtext").val();
if (input.files && input.files[0]){ $("#houseList").find("li").remove();
var reader = new FileReader(); $.ajax({
reader.onload = function (e){ type: "post",
var img = $("<img>").attr({"src":e.target.result,"heghit":100,"width":100}); url: "/tospur/wp-admin/admin-ajax.php",
$(input).before(img); data: "action=searchHouse&searchText="+$searchtext,
} success:function(json){
} var result = json.result;
} for(var i = 0; i < result.length; i++){
reader.readAsDataURL(input.files[0]); var name = result[i]["name"];
} var id = result[i]['id'];
function addOption(json,select){ var imgUrl = json.images[id];
var selectId = select.attr("id"); var img = $("<img>").attr({"src":imgUrl,"height":90,"width":140,"style":"margin-right:50px"});
for(var i = 0; i <=json.length-1; i++){ var li = $("<li>").addClass("addImg").append(img).append(name);
var id = json[i]["id"]; $("#houseList").append(li);
var value = json[i]["value"]; }
if(selectId == "acreage" || selectId == "price"){ }
id = value; });
} })
var Option = $("<option>").attr({"value": id}).append(value);
select.append(Option); //根据上方选择的城市,选择推荐置业顾问的默认城市
} $("#recConsultantBt").click(function(){
} $('#consultCity').find('option').remove();
$("#consultantList").find("li").remove();
function controlCommand(id,number,type){ var consulCityId = $("#baseCity").val();
var num = $("#"+id+" > p").length; var consultantName =$("#consultantName").val();
if(num>number){ var cityName = $("#baseCity").find("option:selected").text();
if(type==0){ var option = $("<option>").attr("value",consulCityId).append(cityName);
alert("最多只能推荐3个房源"); $("#consultCity").append(option);
}else if(type==1){ $.ajax({
alert("您只能推荐一位置业顾问"); type: "GET",
} url: "/tospur/wp-admin/admin-ajax.php",
$("#"+id).find("p:last-child").remove(); data: "action=searchConsultant&consulCityId="+consulCityId+"&consultantName="+consultantName,
} success:function(json){
} for(var i = 0; i <=json.length-1; i++){
var name = json[i]["consultantName"];
function getUrlParmas(){ var imgUrl = json[i]["imageUrl"];
var href = location.search.substr(1,location.search.length-1); var img = $("<img>").attr({"src":imgUrl,"height":90,"width":140,"style":"margin-right:50px"});
var params = href.split("&"); var li = $("<li>").attr("id",json[i]["id"]).append(img).append(name).addClass("consultantImg");
var map = {}; $("#consultantList").append(li);
for(item in params){ }
var key = params[item].split("=")[0] || ""; }
var value = params[item].split("=")[1] || ""; });
map[key] = value; });
} //添加置业顾问弹出层中搜索框的搜索内容
return map; $("#searchConsult").click(function(){
} var consulCityId = $("#consultCity").val();
var consultantName =$("#consultantName").val();
function addList($houseType){ $("#consultantList").find("li").remove();
$("#houseList").find("li").remove(); $.ajax({
var cityId = $("#baseCity").val(); type: "GET",
var buildPropertyId = $("#buildProperty").val(); url: "/tospur/wp-admin/admin-ajax.php",
var room = $("#room").val(); data: "action=searchConsultant&consulCityId="+consulCityId+"&consultantName="+consultantName,
var areaId = $("#areaId").val(); success:function(json){
var cityId = $("#cityId").val(); for(
var plateId = $("#plateId").val(); var i = 0; i <=json.length-1; i++){
var acreage = $("#acreage").val(); var name = json[i]["consultantName"];
var price = $("#price").val(); var imgUrl = json[i]["imageUrl"];
$.ajax({ var img = $("<img>").attr({"src":imgUrl,"height":100,"width":100,"style":"margin-right:50px"});
type: "post", var li = $("<li>").attr("id",json[i]["id"]).append(img).append(name).addClass("consultantImg");
url: "/tospur/wp-admin/admin-ajax.php", $("#consultantList").append(li);
data: "action=searchHouse&cityId="+cityId+"&districtId="+areaId+"&plateId="+plateId+"&buildPropertyId="+buildPropertyId+"&roomId="+room+"&acreage="+acreage+"&totalPrice="+price+"&houseType="+$houseType, }
success:function(json){ }
var result = json.result; });
var urlParams = getUrlParmas(); })
for(var i = 0; i <result.length; i++){
var name = result[i]["name"]; //点击添加房源中显示的列表,在界面中显示
var id = result[i]['id']; $("#houseList").on("click",".addImg",function(){
var imgUrl = result[i]['path']; var recommendHouse = $("<input>").attr({"type":"hidden","name":"data[recommend][]","value": $(this).attr("id")});
var img = $("<img>").attr({"src":imgUrl,"height":100,"width":100}); var url = $(this).find("img").attr("src");
var li = $("<li>").attr("id",id).addClass("addImg").append(img).append(name); var img = $("<img>").attr({"src":url,"height":90,"width":140,"style":"margin-right:50px"});
if(urlParams["id"]){ var cancel = $("<input>").attr({"type":"button","value":"删除"}).addClass("button action imgCancel");
if(urlParams["id"]!=id){ var p = $("<p>").append(img).append(cancel).append(recommendHouse);
$("#houseList").append(li); $("#houseImg").append(p);
} controlCommand("houseImg",3,0);
}else{ });
$("#houseList").append(li); //添加置业顾问
} $("#consultantList").on("click",".consultantImg",function(){
} var url = $(this).find("img").attr("src");
} var img = $("<img>").attr({"src":url,"height":100,"width":100,"style":"margin-right:50px"});
}); var recommendConsultant = $("<input>").attr({"type":"hidden","name":"data[recConsultant][]","value": $(this).attr("id")});
} var cancel = $("<input>").attr({"type":"button","value":"删除"}).addClass("button action consultantCancel");
var font = $("<font>").attr("style","margin-right:50px").append( $(this).text());
var p = $("<p>").append(img).append(font).append(cancel).append(recommendConsultant);
}); $("#consultantImg").append(p);
})(jQuery); controlCommand("consultantImg",1,1);
});
</script>
//新增房源相册
</body> $("#housePicture").click(function(){
var radio = $("<input>").attr({"type":"radio","name":"frontCover","value":i,});
var picDelet = $("<input>").attr({"type":"button","value":"删除"}).addClass("button action existsCancel");
var file = $("<input>").attr({"type":"file","name":"files["+i+"]"}).addClass("picFiles");
var select = $("<select>").attr({"name":"data["+i+"][type]"});
var dicRadio = $("<div>").append(radio).addClass("col-md-3");
var dicPicDelet = $("<div>").append(picDelet).addClass("col-md-2");
var dicFile = $("<div>").append(file).addClass("col-md-3");
var dicSelect = $("<div>").append(select).addClass("col-md-3");
var div = $("<div>").append(dicSelect).append(dicFile).append(dicRadio).append(dicPicDelet).addClass("row");
{% for item in photoType %}
select.append($("<option>").attr("value",{{item.id}}).append('{{item.value}}'));
{% endfor%}
var p = $("<p>").append(div);
var fontA = $("<div>").append("<font>").append("设为封面").addClass("col-md-3");
var fontB = $("<div>").append("<font>").append("类型").addClass("col-md-3");
var fontC = $("<div>").append("<font>").append("相册").addClass("col-md-3");
var titleP = $("<div>").append(fontB).append(fontC).append(fontA).addClass("row");
$("#picList").append(p);
var url = getUrlParmas();
if(!url.id){
if( titleFlag== 0){
$("#picList").before(titleP);
titleFlag = 1
}
}
i++
});
//房源相册
$("#picList").on("change",".picFiles",function(){
readURL(this,2);
$(this).hide();
});
//删除房源相册、推荐房源、推荐置业顾问
$("#houseImg,#consultantImg").on("click",".imgCancel,.consultantCancel,.picDelet",function(){
$(this).parents("p").remove();
});
$("#houseImg,#consultantImg").on("click",".existsCancel",function(){
$(this).parent().remove();
});
$("#picList").on("click",".existsCancel",function(){
$(this).parent().parent().remove();
});
$("input[id='keyCheck']").change(function(){
textDisable("keyCheck","key");
});
$("input[id='garageCheck']").change(function(){
textDisable("garageCheck","garage");
});
$("form").find("select[name='faceto']").val("{{result.faceto}}");
$("form").find("select[name='age']").val("{{result.age}}");
$("form").find("select[name='propertyRight']").val("{{result.propertyRight}}");
$("form").find("select[name='decoration']").val("{{result.decoration}}");
$("form").find("select[name='source']").val("{{result.source}}");
$("form").find("select[name='structure']").val("{{result.structure}}");
$("form").find("select[name='roomNum']").val("{{result.roomNum}}");
$("form").find("select[name='livingRoom']").val("{{result.livingRoom}}");
$("form").find("select[name='bathRoom']").val("{{result.bathRoom}}");
$("form").find("select[name='kitchen']").val("{{result.kitchen}}");
$("form").find("select[name='balcony']").val("{{result.balcony}}");
$('#rentHouse').validate({
onkeyup: false,
onfocusout: false,
errorClass: "my-error-class",
rules: {
housename:'required',
mark:'required',
rent:'required',
owner_name:'required',
owner_phone:'required',
community_name:'required',
baseCity:{
selectcheck: true
},
baseAreaId:{
selectcheck: true
},
basePlateId:{
selectcheck: true
}
},
messages: {
housename:'请输入房源名称',
mark:'请输入标签',
owner_name:'请输入业主姓名',
owner_phone:'请输入业主电话',
rent:'请输入租金',
community_name:'请输入小区名称',
},
errorLabelContainer: "#notice",
errorElement: 'div',
submitHandler: function (form) {
if($("#consultantImg > p").length == 0 ){
alert("请选择置业顾问");
}else{
form.submit();
}
}
});
jQuery.validator.addMethod('selectcheck', function (value) {
return (value != '-1');
},"请选择城市区域");
function textDisable(checkId,textId){
if($('input[id="'+checkId+'"]:checked').length > 0){
$("#"+textId).removeAttr("disabled");
}else{
$("#"+textId).attr("disabled","true");
}
}
//file上传之前,显示图片的方法
function readURL(input,type) {
if(type == 1){
if (input.files && input.files[0]){
var reader = new FileReader();
reader.onload = function (e) {
var img = $("<img>").attr({"id":"target","src":e.target.result,"heghit":90,"width":140});
var button = $("<input>").attr({"type":"button","value":"取消","property":+i,"id":+i}).addClass("cancel");
var type = $("<input>").attr({"type":"hidden","name":"data["+i+"][type]","value":0,"property":+i});
var file = $("<input>").attr({"type":"file","name":"files["+(i+1)+"]","property":+(i+1)}).addClass("files");
var select = $("<select>").attr({"name":"data["+i+"][buildProperty]"});
{% for item in buildProperty %}{{item.id}}
select.append($("<option>").attr("value",{{item.id}}).append('{{item.value}}'));
{% endfor%}
var areatext = $("<input>").attr({"type":"text","placeholder":"面积","name":"data["+i+"][housearea]"}).addClass("regular-text");
var div = $("<div>").append(select).append(areatext).append(button).append(type);
var span = $("<span>").attr({"property":+i}).append(img).append(div);
$("form").find("#preview > p").before(file);
$("#preview > p").append(span);
i++;
}
}
}else{
if (input.files && input.files[0]){
var reader = new FileReader();
reader.onload = function (e){
var img = $("<img>").attr({"src":e.target.result,"heghit":90,"width":140});
$(input).before(img);
}
}
}
reader.readAsDataURL(input.files[0]);
}
function addOption(json,select){
var selectId = select.attr("id");
for(var i = 0; i <=json.length-1; i++){
var id = json[i]["id"];
var value = json[i]["value"];
if(selectId == "acreage" || selectId == "price"){
id = value;
}
var Option = $("<option>").attr({"value": id}).append(value);
select.append(Option);
}
}
function controlCommand(id,number,type){
var num = $("#"+id+" > p").length;
if(num>number){
if(type==0){
alert("最多只能推荐3个房源");
}else if(type==1){
alert("您只能推荐一位置业顾问");
}
$("#"+id).find("p:last-child").remove();
}
}
function getUrlParmas(){
var href = location.search.substr(1,location.search.length-1);
var params = href.split("&");
var map = {};
for(item in params){
var key = params[item].split("=")[0] || "";
var value = params[item].split("=")[1] || "";
map[key] = value;
}
return map;
}
function addList($houseType){
$("#houseList").find("li").remove();
var cityId = $("#baseCity").val();
var buildPropertyId = $("#buildProperty").val();
var room = $("#room").val();
var areaId = $("#areaId").val();
var cityId = $("#cityId").val();
var plateId = $("#plateId").val();
var acreage = $("#acreage").val();
var price = $("#price").val();
$.ajax({
type: "post",
url: "/tospur/wp-admin/admin-ajax.php",
data: "action=searchHouse&cityId="+cityId+"&districtId="+areaId+"&plateId="+plateId+"&buildPropertyId="+buildPropertyId+"&roomId="+room+"&acreage="+acreage+"&totalPrice="+price+"&houseType="+$houseType,
success:function(json){
var result = json.result;
var urlParams = getUrlParmas();
for(var i = 0; i <result.length; i++){
var name = result[i]["name"];
var id = result[i]['id'];
var imgUrl = result[i]['path'];
var img = $("<img>").attr({"src":imgUrl,"height":90,"width":140,"style":"margin-right:50px"});
var li = $("<li>").attr("id",id).addClass("addImg").append(img).append(name);
if(urlParams["id"]){
if(urlParams["id"]!=id){
$("#houseList").append(li);
}
}else{
$("#houseList").append(li);
}
}
}
});
}
});
})(jQuery);
</script>
</body>
</html> </html>
\ No newline at end of file
<!DOCTYPE HTML> <!DOCTYPE HTML>
<html> <html>
<head> <head>
{% set title = houseId?"修改二手房房源":"添加二手房房源" %} {% set title = houseId?"修改二手房房源":"添加二手房房源" %}
<meta charset="utf-8"> <meta charset="utf-8">
<title>{{title}}</title> <title>{{title}}</title>
</head> </head>
<body> <body>
<h2 class="title">{{title}}</h2> <h2 class="title">{{title}}</h2>
<form action="" method="POST" enctype="multipart/form-data"> <form action="" method="POST" enctype="multipart/form-data" id="secHouse">
<div class="row"> <div class="row">
<div class="col-md-11"> <div class="col-md-11">
<div class="row"> <div class="row">
<div class="col-md-8"> <div class="col-md-3">
<table class="form-table"> <label for="housename">房源名:</label>
<tbody> <input name="housename" id="housename" type="text" value="{{result.name}}" class="form-control" >
<tr> </div>
<th><label for="housename">房源名:</label></th> <div class="col-md-3">
<td> <input name="housename" id="housename" type="text" value="{{result.name}}" class="form-control" style="width: 150px;"></td> <label for="address">小区名称:</label>
</tr> <input name="community_name" type="text" value="{{result.community_name}}" class="form-control">
<tr> </div>
<th><label for="address">小区名称</label></th> <div class="col-md-3">
<td> <input name="community_name" type="text" value="{{result.community_name}}" class="form-control" style="width: 150px;"></td> <label for="total_price">售价:</label>
</tr> <div class="row">
<tr> <p>
<th><label for="mark">标签:</label></th> <input name="total_price" id="total_price" type="text" value="{{result.total_price}}" class="form-control" style="width:80%;display: inline-block"> 万元
<td> <input name="mark" id="mark" type="text" value="{{mark}}" class="form-control"></td> </p>
</tr>
{% if not houseId %} </div>
<tr> </div>
<th><label for="owner_name">业主姓名</label></th> <div class="col-md-3">
<td> <input name="owner_name" id="owner_name" type="text" value="" class="form-control" style="width: 150px;"></td> <label for="average_price">单价:</label>
</tr> <p>
<tr> <input name="average_price" id="average_price" type="text" value="{{result.average_price}}" class="form-control" style="width:80%;display: inline-block">
<th><label for="owner_phone">业主电话</label></th> </p>
<td> <input name="owner_phone" id="owner_phone" type="text" value="" class="form-control" style="width: 150px;"></td> </div>
</tr> </div><br>
{% endif %} <div class="row">
<tr> <div class="col-md-6">
<th><label for="total_price">售价</label></th> <label for="mark">标签:</label>
<td> <input name="total_price" id="total_price" type="text" value="{{result.total_price}}" class="form-control" style="width: 90px;"></td> <input name="mark" id="mark" type="text" value="{{mark}}" class="form-control">
</tr> </div>
<tr> </div><br>
<th><label for="average_price">单价</label></th> <div class="row">
<td> <input name="average_price" id="average_price" type="text" value="{{result.average_price}}" class="form-control" style="width: 90px;"></td> {% if not houseId %}
</tr> <div class="col-md-4">
</tbody> <label for="owner_name">业主姓名:</label>
</table> <input name="owner_name" id="owner_name" type="text" value="" class="form-control">
</div> </div>
</div> <div class="col-md-4">
<h2 class="title">基本信息</h2> <label for="owner_phone">业主电话:</label>
<div class="row"> <input name="owner_phone" id="owner_phone" type="text" value="" class="form-control">
<div class="col-md-8"> </div>
<table class="form-table"> {% endif %}
<tbody>
<tr> </div><br>
<th><label for="from">户型</label></th>
<td>
<select id="buildproperty_id" name="buildproperty_id">
{% for item in buildProperty %} <h2 class="title">基本信息</h2>
<option {{ item.id == result.buildproperty_id?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option> <div class="row">
{% endfor %} <div class="col-md-12">
</select> <label for="suite">门牌号码:</label></th>
</td> <input name="suite" type="text" value="{{result.suite}}"style="width: 10%">
</tr> &nbsp;
<tr> <label for="floor">楼层:</label>
<th><label for="covered_area">面积</label></th> <input name="floor" type="text" value="{{result.floor}}" style="width: 5%">
<td> <input name="covered_area" type="text" value="{{result.covered_area}}" class="form-control" style="width: 90px;"></td> &nbsp;
</tr> <label for="totalFloor">总层:</label>
<tr> <input type="text" name="totalFloor"value="{{result.totalFloor}}" style="width: 5%">
<th><label for="floor">楼层:</label></th> &nbsp;
<td> <input name="floor" type="text" value="{{result.floor}}" class="form-control" style=" width: 70px;"></td> <label for="faceto">朝向:</label>
</tr> <select name="faceto">
<tr> <option value="其他">其他</option>
<th><label for="faceto">朝向:</label></th> <option value="东"></option>
<td> <input name="faceto" type="text" value="{{result.faceto}}" class="form-control" style=" width: 70px;"></td> <option value="南"></option>
</tr> <option value="西">西</option>
<tr> <option value="北"></option>
<th><label for="decoration">装修状况</label></th> <option value="东西">东西</option>
<td> <input name="decoration" type="text" value="{{result.decoration}}" class="form-control" style=" width: 70px;"></td> <option value="南北">南北</option>
</tr> <option value="南南">南南</option>
<tr> <option value="东南">东南</option>
<th><label for="age">建筑年代</label></th> <option value="东北">东北</option>
<td> <input name="age" type="text" value="{{result.age}}" class="form-control" style=" width: 70px;"></td> <option value="西南">西南</option>
</tr> <option value="西北">西北</option>
<tr> </select>
<th><label for="flat">楼号</label></th> &nbsp;
<td> <input name="flat" type="text" value="{{result.flat}}" class="form-control" style=" width: 50px;"></td> <label for="age">建筑年代:</label>
</tr> <!--<input name="age" type="text" value="{{result.age}}" class="form-control">-->
<tr> <select name="age">
<th><label for="suite"></label></th> <option>未知</option>
<td> <input name="suite" type="text" value="{{result.suite}}" class="form-control" style=" width: 50px;"></td> {% for item in age%}
</tr> <option {{ item == result.age?"selected":"" }}value="{{item}}">{{item}}</option>
<tr> {% endfor %}
<th><label for="overview">房源点评</label></th> </select>
<td> <textarea name="overview" rows="4" cols="40" class="form-control" style=" width: 400px;">{{result.overview}}</textarea></td> &nbsp;
</tr> <label for="propertyRight">产权:</label>
<select name="propertyRight">
</tbody> <option value="个人产权">个人产权</option>
</table> <option value="单位产权">单位产权</option>
</div> <option value="售后产权">售后产权</option>
</div> <option value="家庭成员共有">家庭成员共有</option>
<option value="使用权">使用权</option>
<h2 class="title">位置及周边</h2> <option value="小产权">小产权</option>
<div class="row"> <option value="协议房">协议房</option>
<div class="col-md-8"> <option value="私产">私产</option>
<table class="form-table"> <option value="公产">公产</option>
<tbody> <option value="合同发票">合同发票</option>
<tr> <option value="三联单">三联单</option>
<th><label for="from">所属地区</label></th> <option value="其他">其他</option>
<td> </select>
<select id="baseCity" name="baseCity"> </div>
<option value="-1"> 城市</option> </div><br>
{% for item in city %} <div class="row">
<option {{ item.id == result.city_id?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option> <div class="col-md-12">
{% endfor %} <label for="propertyProof">产证:</label>
</select> <input type="text" name="propertyProof" value="{{result.propertyProof}}">
<select id="baseAreaId" name="baseAreaId"> &nbsp;
<option value = "-1">区域</option> <label for="decoration">装修状况:</label>
{% if district %} <select name="decoration">
{% for item in district %} <option value="毛坯">毛坯</option>
<option {{ item.id == result.district_id?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option> <option value="简单装修">简单装修</option>
{% endfor %} <option value="中等装修">中等装修</option>
{% endif %} <option value="精装修">精装修</option>
</select> <option value="豪华装修">豪华装修</option>
<select id="basePlateId" name="basePlateId"> </select>
<option value = "-1">板块</option> &nbsp;
{% if district %} <label for="useArea">使用面积:</label>
{% for item in plate %} <input type="text" name="useArea" value="{{result.useArea}}" style="width: 10%;display: inline-block">平方米
<option {{ item.id == result.plate_id?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option> &nbsp;
{% endfor %} <label for="covered_area">建筑面积:</label>
{% endif %} <input name="covered_area" type="text" value="{{result.covered_area}}" style="width:10%;display: inline-block">平方米
</select> &nbsp;
</td> <input type="checkbox" id="keyCheck" {{ result.key?"checked":"" }}> <label for="key">钥匙:</label><input type="text" {% if not result.key %} disabled="true" {% endif %} id="key" name="key" value="{{result.key}}" style="width: 10%">
</tr> </div>
</div><br>
<tr> <div class="row">
<th><label for="location">地域坐标</label></th> <div class="col-md-12">
<td> <input name="location" id="location" type="text" value="{{result.location}}" class="form-control"></td> <input type="checkbox" id="garageCheck" {{ result.garage?"checked":"" }}> <label for="garage">车库:</label><input type="text" {% if not result.garage %}disabled="true"{% endif %} id="garage" name="garage" value="{{result.garage}}" style="width: 10%">
</tr> &nbsp;
<tr> <label for="street">街道:</label>
<th><label for="address">地址</label></th> <input type="text" name="street" value="{{result.street}}">
<td> <input name="address" type="text" value="{{result.address}}" class="form-control"></td> &nbsp;
</tr> <label for="flat">楼号:</label>
<tr> <input name="flat" type="text" value="{{result.flat}}" style="width: 10%;">
<th><label for="traffic">交通线路</label></th> &nbsp;
<td> <input name="traffic" type="text" value="{{result.traffic}}" class="form-control" style="width: 300px;"></td> <label for="matching_facilities">设施:</label>
</tr> <input type="text" name="matching_facilities" value="{{result.matching_facilities}}">
<tr> &nbsp;
<th><label for="periphery">周边配套</label></th> <label for="structure">结构:</label>
<td> <input name="periphery" type="text" value="{{result.periphery}}" class="form-control" style="width: 300px;"></td> <select name="structure">
</tr> <option value="其他">其他</option>
</tbody> <option value="框架">框架</option>
</table> <option value="砖混">砖混</option>
</div> <option value="剪力">剪力</option>
</div> <option value="钢混">钢混</option>
<h2 class="title">关联信息</h2> <option value="木混">木混</option>
<div class="row"> <option value="砖木">砖木</option>
<div class="col-md-12"> </select>
<table class="form-table"> </div>
<tbody> </div><br>
<tr> <div class="row">
<th><label>房源相册</label></th> <div class="col-md-12">
<td> <label for="from">户型:</label>
<div id="picList"> <select id="buildproperty_id" name="buildproperty_id">
{% set exists_photo_ids = "" %} {% for item in buildProperty %}
{% for item in images %} <option {{ item.id == result.buildproperty_id?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% if exists_photo_ids != "" %} {% endfor %}
{% set exists_photo_ids = exists_photo_ids~"," %} </select>
{% endif %} <label for="roomNum">室:</label>
{% set exists_photo_ids = exists_photo_ids~item.image_id %} <select name="roomNum">
<p> <option value="0">0</option>
<input type="radio" name="frontCover" value="{{item.image_id}}" {{ result.frontCover_id == item.image_id?"checked":"" }} /> <option value="1">1</option>
<select name="exists_photo[{{ item.image_id }}][type]"> <option value="2">2</option>
{% for i in photoType %} <option value="3">3</option>
<option {{ i.id == item.image_type?"selected":"" }} value="{{ i.id }}">{{ i.value }}</option> <option value="4">4</option>
{% endfor %} <option value="5">5</option>
</select> <option value="6">6</option>
<img src="{{siteUrl}}{{item.path}}" heghit="100" width="100"> <option value="7">7</option>
<input type="button" value="取消" class="cancel existsCancel"> <option value="8">8</option>
</p> </select>
{% endfor %} <label for="livingRoom">厅:</label>
<input type="hidden" name="exists_photo_ids" value="{{exists_photo_ids}}" > <select name="livingRoom">
</div><br /> <option value="0">0</option>
<button type="button" id="housePicture" class="button action" data-toggle="modal"> <option value="1">1</option>
新增 <option value="2">2</option>
</button> <option value="3">3</option>
</td> <option value="4">4</option>
</tr> </select>
<tr> <label for="bathRoom">卫:</label>
<th><label for="traffic">推荐房源</label></th> <select name="bathRoom">
<td> <option value="0">0</option>
<div id="houseImg"> <option value="1">1</option>
{% for item in recommends %} <option value="2">2</option>
<p> <option value="3">3</option>
<img src="{{siteUrl}}{{item.path}}" height="100" width="100"> <option value="4">4</option>
<input type="button" value="删除" class="imgCancel existsCancel"> </select>
<input type="hidden" name="data[recommend][]" value="{{item.id}}"> <label for="kitchen">厨:</label>
</p> <select name="kitchen">
{% endfor %} <option value="0">0</option>
</div><br /> <option value="1">1</option>
<button type="button" class="button action" data-toggle="modal" data-target="#myModal" id="recHouseBt"> <option value="2">2</option>
添加房源 <option value="3">3</option>
</button> </select>
</td> <label for="balcony">阳台:</label>
</tr> <select name="balcony">
<tr> <option value="0">0</option>
<th><label for="feature">房源特色</label></th> <option value="1">1</option>
<td> <option value="2">2</option>
<div id="feature"> <option value="3">3</option>
{% for item in featureOld %} </select>
<p> </div>
<span>{{ item.name }}</span> </div><br>
<input type="button" value="删除" class="featureCancel existsCancel"> <div class="row">
<input type="hidden" name="data[houseFeature][]" value="{{item.tag_id}}"> <div class="col-md-12">
</p> <label for="overview">房源点评:</label>
{% endfor %} <textarea name="overview" rows="4" cols="40" class="form-control" >{{result.overview}}</textarea>
</div><br/> </div>
<button type="button" class="button action" data-toggle="modal" data-target="#houseFeature" id="featureBt"> </div><br>
添加特色 <h2 class="title">位置及周边</h2>
</button> <div class="row">
</td> <div class="col-md-4">
</tr> <label for="from">所属地区:</label>
<tr> <div class="row">
<th><label for="consultant">置业顾问</label></th> <div class="col-md-3">
<td> <select id="baseCity" name="baseCity" class="required">
<div id="consultantImg"> <option value="-1"> 城市</option>
{% for item in consultant %} {% for item in city %}
<p> <option {{ item.id == result.city_id?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
<span>{{item.name}}</span> {% endfor %}
<input type="button" value="删除" class="consultantCancel existsCancel"> </select>
<input type="hidden" name="data[recConsultant][]" value="{{item.id}}"> </div>
</p> <div class="col-md-3">
{% endfor %} <select id="baseAreaId" name="baseAreaId">
</div><br /> <option value = "-1">区域</option>
<button type="button" class="button action" data-toggle="modal" data-target="#myConsultant" id="recConsultantBt"> {% if district %}
选择置业顾问 {% for item in district %}
</button> <option {{ item.id == result.district_id?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
</td> {% endfor %}
</tr> {% endif %}
{% if role == 'administrator' %} </select>
<tr> </div>
<th><label for="from">状态</label></th> <div class="col-md-3">
<td> <select id="basePlateId" name="basePlateId">
<select id="status" name="status"> <option value = "-1">板块</option>
{% for item in status %} {% if district %}
<option value={{item.id}}>{{item.value}}</option> {% for item in plate %}
{% endfor %} <option {{ item.id == result.plate_id?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
</select> {% endfor %}
</td> {% endif %}
</tr> </select>
{% endif %} </div>
</tbody> </div>
</table> </div>
</div>
</div> <div class="col-md-4">
<label for="address">地址:</label>
<input name="address" type="text" value="{{result.address}}" class="form-control">
<input type="text" name="type" value="2" hidden="hidden"> </div>
{% if houseId %} <div class="col-md-4">
<input type="text" name="houseId" value="{{houseId}}" hidden="hidden"> <label for="traffic">交通线路:</label>
{% endif %} <input name="traffic" type="text" value="{{result.traffic}}" class="form-control">
</div> </div>
<div class="col-md-1"> </div><br>
<input type="submit" id="submit" class="button action"> <div class="row">
</div>
</div> <div class="col-md-4">
</form> <label for="periphery">周边配套:</label>
<input name="periphery" type="text" value="{{result.periphery}}" class="form-control">
<!-- Modal --> </div>
<!-- 新增房源弹出层 --> <div class="col-md-4">
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> <label for="location">地域坐标:</label>
<div class="modal-dialog" role="document"> <input name="location" id="location" type="text" value="{{result.location}}" class="form-control">
<div class="modal-content"> </div>
</div><br>
<div class="modal-body" style="height: 300px;overflow: auto;">
<select id="cityId"> <h2 class="title">关联信息</h2>
<option value="-1"> 城市</option> <table class="form-table">
{% for item in city %} <tbody>
<option value="{{ item.id }}">{{ item.value }}</option> <tr>
{% endfor %} <th><label>房源相册:</label></th>
</select> <td>
<select id="areaId"> {% if houseId %}
<option value = "-1">区域</option> <div class="row">
</select> <div class="col-md-3">
<select id="plateId"> <font>类型</font>
<option value = "-1">板块</option> </div>
</select> <div class="col-md-3">
<select id="price"> <font>相册</font>
<option value = "-1">价格</option> </div>
</select> <div class="col-md-3">
<select id="buildProperty"> <font>设为封面</font>
<option value = "-1">房型</option> </div>
{% for item in buildProperty %} </div>
<option value="{{ item.id }}">{{ item.value }}</option> {% endif %}
{% endfor %} <div id="picList">
</select> {% set exists_photo_ids = "" %}
<select id="room"> {% for item in images %}
<option value = "-1">类型</option> {% if exists_photo_ids != "" %}
{% for item in room %} {% set exists_photo_ids = exists_photo_ids~"," %}
<option value="{{ item.id }}">{{ item.value }}</option> {% endif %}
{% endfor %} {% set exists_photo_ids = exists_photo_ids~item.image_id %}
</select> <div class="row">
<select id="acreage"> <div class="col-md-3">
<option value = "-1">面积</option> <select name="exists_photo[{{ item.image_id }}][type]" style="margin-right: 50px">
</select> {% for i in photoType %}
<input type="text" placeholder="请出入楼盘名/地段名搜索" id="searchtext" class="form-control"> <option {{ i.id == item.image_type?"selected":"" }} value="{{ i.id }}">{{ i.value }}</option>
<button type="button" class="button action" id="search">搜索</button> {% endfor %}
<ul id="houseList"> </select>
</ul> </div>
</div> <div class="col-md-3">
</div> <img src="{{siteUrl}}{{item.path}}" height="90" width="140" style="margin-right: 50px">
</div> </div>
</div> <div class="col-md-3">
<input type="radio" name="frontCover" style="margin-right: 50px" value="{{item.image_id}}" {{ result.frontCover_id == item.image_id?"checked":"" }} />
<!-- 置业顾问弹出层 --> </div>
<div class="modal fade" id="myConsultant" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> <div class="col-md-2">
<div class="modal-dialog" role="document"> <input type="button" value="删除" class="button action cancel existsCancel">
<div class="modal-content"> </div>
<div class="modal-body" style="height: 300px;overflow: auto;"> </div>
<select id="consultCity"> {% endfor %}
<option value=""> 城市</option> <input type="hidden" name="exists_photo_ids" value="{{exists_photo_ids}}" >
{% for item in city %} </div>
<option value="{{ item.id }}">{{ item.value }}</option> <button type="button" id="housePicture" class="button action" data-toggle="modal" style="margin-top: 10px">
{% endfor %} 新增
</select> </button>
<input type="text" placeholder="请出入置业顾问姓名搜索" id="consultantName" class="form-control"> </td>
<button type="button" class="button action" id="searchConsult">搜索</button> </tr>
<ul id="consultantList"> <tr>
</ul> <th><label for="traffic">推荐房源</label></th>
</div> <td>
</div> <div id="houseImg">
</div> {% for item in recommends %}
</div> <p>
<img src="{{siteUrl}}{{item.path}}" height="90" width="140" style="margin-right: 50px">
<!-- 房源特色出层 --> <input type="button" value="删除" class="button action imgCancel existsCancel">
<div class="modal fade" id="houseFeature" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> <input type="hidden" name="data[recommend][]" value="{{item.id}}">
<div class="modal-dialog" role="document"> </p>
<div class="modal-content"> {% endfor %}
<table class="form-table" id="featureTable"> </div><br />
<tbody> <button type="button" class="button action" data-toggle="modal" data-target="#myModal" id="recHouseBt">
<tr> 添加房源
<th style="width: 45px"><label for="feature">特色:</label></th> </button>
{% for item in feature %} </td>
<td id="{{ item.id }}">{{ item.value }}</td> </tr>
{% endfor %} <tr>
</tr> <th><label for="feature">房源特色</label></th>
</tbody> <td>
</table> <div id="feature">
</div> {% for item in featureOld %}
</div> <p>
</div> <span style="margin-right:50px">{{ item.name }}</span>
<input type="button" value="删除" class="button action featureCancel existsCancel">
<input type="hidden" name="data[houseFeature][]" value="{{item.tag_id}}">
<script> </p>
(function($){ {% endfor %}
$(document).ready(function(){ </div><br/>
var titleFlag = 0; <button type="button" class="button action" data-toggle="modal" data-target="#houseFeature" id="featureBt">
//主力房源中选择图片file的下标 添加特色
var i = 0; </button>
//基本信息的联动AJAX </td>
$("#baseCity").change(function(){ </tr>
var cityId = $("#baseCity").val(); <tr>
var baserArea = $("#baseAreaId"); <th><label for="periphery">置业顾问</label></th>
$('#baseAreaId').find('option:not(:first-child)').remove(); <td>
$('#basePlateId').find('option:not(:first-child)').remove(); <div id="consultantImg">
{% for item in consultant %}
//城市联动区域 <p>
$.ajax({ <img src="{{item.imageUrl}}" height="100" width="100" style="margin-right: 50px">
type: "GET", <span style="margin-right: 50px">{{item.name}}</span>
url: "/tospur/wp-admin/admin-ajax.php", <input type="button" value="删除" class="button action consultantCancel existsCancel">
data: "action=serachCity&cityId="+cityId, <input type="hidden" name="data[recConsultant][]" value="{{item.id}}">
success:function(json){ </p>
addOption(json,baserArea); {% endfor %}
} </div><br />
}); <button type="button" class="button action" data-toggle="modal" data-target="#myConsultant" id="recConsultantBt">
}); 选择置业顾问
//区域联动板块 </button>
$("#baseAreaId").change(function(){ </td>
var basePlate = $("#basePlateId"); </tr>
var areaId = $("#baseAreaId").val(); </tbody>
var cityId = $("#baseCity").val(); </table>
$('#basePlateId').find('option:not(:first-child)').remove(); <div>
$.ajax({
type: "GET",
url: "/tospur/wp-admin/admin-ajax.php", </div>
data: "action=serachCity&cityId="+cityId+"&districtId="+areaId, <input type="text" name="type" value="2" hidden="hidden">
success:function(json){ {% if houseId %}
addOption(json,basePlate); <input type="text" name="houseId" value="{{houseId}}" hidden="hidden">
} {% endif %}
}); </div>
}); <div class="col-md-1">
<input type="submit" id="submit" class="button action" style="position: fixed;">
//根据上方选择的城市,选择推荐房源的默认城市 {% if role == 'administrator' %}
$("#recHouseBt").click(function(){ <div class="row" style="position: fixed;top:50px;">
$('#cityId').find('option').remove(); <select id="status" name="status">
$('#areaId').find('option:not(:first-child)').remove(); {% for item in status %}
$('#plateId').find('option:not(:first-child)').remove(); <option {{ item.id == searchStatus.id?"selected":"" }} value={{item.id}}>{{item.value}}</option>
$('#price').find('option:not(:first-child)').remove(); {% endfor %}
$('#acreage').find('option:not(:first-child)').remove(); </select>
$("#houseList").find("li").remove(); </div>
var acreage =$("#acreage"); {% endif %}
var price = $("#price"); </div>
var area = $("#areaId"); </div>
var cityId = $("#baseCity").val(); </form>
var cityName = $("#baseCity").find("option:selected").text();
var option = $("<option>").attr("value",cityId).append(cityName); <!-- Modal -->
$("#cityId").append(option); <!-- 新增房源弹出层 -->
if(cityId != -1){ <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
$.ajax({ <div class="modal-dialog" role="document">
type: "GET", <div class="modal-content">
url: "/tospur/wp-admin/admin-ajax.php",
data: "action=serachCity&cityId="+cityId, <div class="modal-body" style="height: 300px;overflow: auto;">
success:function(json){ <select id="cityId">
addOption(json,area); <option value="-1"> 城市</option>
} {% for item in city %}
}); <option value="{{ item.id }}">{{ item.value }}</option>
{% endfor %}
//城市联动房子面积 </select>
$.ajax({ <select id="areaId">
type: "GET", <option value = "-1">区域</option>
url: "/tospur/wp-admin/admin-ajax.php", </select>
data: "action=searchArea&cityId="+cityId, <select id="plateId">
success:function(json){ <option value = "-1">板块</option>
addOption(json,acreage); </select>
} <select id="price">
}); <option value = "-1">价格</option>
//城市联动房子价格 </select>
$.ajax({ <select id="buildProperty">
type: "GET", <option value = "-1">房型</option>
url: "/tospur/wp-admin/admin-ajax.php", {% for item in buildProperty %}
data: "action=searchUnitPriceRange&cityId="+cityId, <option value="{{ item.id }}">{{ item.value }}</option>
success:function(json){ {% endfor %}
addOption(json,price); </select>
} <select id="room">
}); <option value = "-1">类型</option>
addList(1) {% for item in room %}
} <option value="{{ item.id }}">{{ item.value }}</option>
}); {% endfor %}
</select>
//区域联动板块 <select id="acreage">
$("#areaId").change(function(){ <option value = "-1">面积</option>
var areaId = $("#areaId").val(); </select>
var cityId = $("#cityId").val(); <input type="text" placeholder="请出入楼盘名/地段名搜索" id="searchtext" class="form-control">
var plate = $("#plateId"); <button type="button" class="button action" id="search">搜索</button>
$("#houseList").find("li").remove(); <ul id="houseList">
$('#plateId').find('option:not(:first-child)').remove(); </ul>
$.ajax({ </div>
type: "GET", </div>
url: "/tospur/wp-admin/admin-ajax.php", </div>
data: "action=serachCity&cityId="+cityId+"&districtId="+areaId, </div>
success:function(json){
addOption(json,plate); <!-- 置业顾问弹出层 -->
} <div class="modal fade" id="myConsultant" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
}); <div class="modal-dialog" role="document">
}); <div class="modal-content">
<div class="modal-body" style="height: 300px;overflow: auto;">
//推荐房源下显示图片信息以及房名 <select id="consultCity">
$("#areaId,#plateId,#buildProperty,#room,#acreage,#price").change(function(){ <option value=""> 城市</option>
addList(1) {% for item in city %}
}); <option value="{{ item.id }}">{{ item.value }}</option>
{% endfor %}
//添加房源中搜索框的搜索 </select>
$("#search").click(function(){ <input type="text" placeholder="请出入置业顾问姓名搜索" id="consultantName" class="form-control">
$searchtext = $("#searchtext").val(); <button type="button" class="button action" id="searchConsult">搜索</button>
$("#houseList").find("li").remove(); <ul id="consultantList">
$.ajax({ </ul>
type: "post", </div>
url: "/tospur/wp-admin/admin-ajax.php", </div>
data: "action=searchHouse&searchText="+$searchtext, </div>
success:function(json){ </div>
var result = json.result;
for(var i = 0; i < result.length; i++){ <!-- 房源特色出层 -->
var name = result[i]["name"]; <div class="modal fade" id="houseFeature" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
var id = result[i]['id']; <div class="modal-dialog" role="document">
var imgUrl = json.images[id]; <div class="modal-content">
var img = $("<img>").attr({"src":imgUrl,"height":100,"width":100}); <div id="featureTable">
var li = $("<li>").addClass("addImg").append(img).append(name); <div class="row">
$("#houseList").append(li); <div class="col-md-2">
} <label for="feature">特色:</label>
} </div>
}); <div class="col-md-10" id="featureList">
}) {% for item in feature %}
<div id="{{ item.id }}">{{ item.value }}</div>
//根据上方选择的城市,选择推荐置业顾问的默认城市 {% endfor %}
$("#recConsultantBt").click(function(){ </div>
$('#consultCity').find('option').remove(); </div>
$("#consultantList").find("li").remove(); </div>
var consulCityId = $("#baseCity").val(); </div>
var consultantName =$("#consultantName").val(); </div>
var cityName = $("#baseCity").find("option:selected").text(); </div>
var option = $("<option>").attr("value",consulCityId).append(cityName);
$("#consultCity").append(option);
$.ajax({
type: "GET",
url: "/tospur/wp-admin/admin-ajax.php", <script>
data: "action=searchConsultant&consulCityId="+consulCityId+"&consultantName="+consultantName, (function($){
success:function(json){ $(document).ready(function(){
for(var i = 0; i <=json.length-1; i++){ var titleFlag = 0;
var name = json[i]["consultantName"]; //主力房源中选择图片file的下标
var imgUrl = json[i]["imageUrl"]; var i = 0;
var img = $("<img>").attr({"src":imgUrl,"height":100,"width":100}); //基本信息的联动AJAX
var li = $("<li>").attr("id",json[i]["id"]).append(img).append(name).addClass("consultantImg"); $("#baseCity").change(function(){
$("#consultantList").append(li); var cityId = $("#baseCity").val();
} var baserArea = $("#baseAreaId");
} $('#baseAreaId').find('option:not(:first-child)').remove();
}); $('#basePlateId').find('option:not(:first-child)').remove();
});
//添加置业顾问弹出层中搜索框的搜索内容 //城市联动区域
$("#searchConsult").click(function(){ $.ajax({
var consulCityId = $("#consultCity").val(); type: "GET",
var consultantName =$("#consultantName").val(); url: "/tospur/wp-admin/admin-ajax.php",
$("#consultantList").find("li").remove(); data: "action=serachCity&cityId="+cityId,
$.ajax({ success:function(json){
type: "GET", addOption(json,baserArea);
url: "/tospur/wp-admin/admin-ajax.php", }
data: "action=searchConsultant&consulCityId="+consulCityId+"&consultantName="+consultantName, });
success:function(json){ });
for(var i = 0; i <=json.length-1; i++){ //区域联动板块
var name = json[i]["consultantName"]; $("#baseAreaId").change(function(){
var imgUrl = json[i]["imageUrl"]; var basePlate = $("#basePlateId");
var img = $("<img>").attr({"src":imgUrl,"height":100,"width":100}); var areaId = $("#baseAreaId").val();
var li = $("<li>").append(img).append(name).addClass("consultantImg"); var cityId = $("#baseCity").val();
$("#consultantList").append(li); $('#basePlateId').find('option:not(:first-child)').remove();
} $.ajax({
} type: "GET",
}); url: "/tospur/wp-admin/admin-ajax.php",
}) data: "action=serachCity&cityId="+cityId+"&districtId="+areaId,
success:function(json){
//点击添加房源中显示的列表,在界面中显示 addOption(json,basePlate);
$("#houseList").on("click",".addImg",function(){ }
var recommendHouse = $("<input>").attr({"type":"hidden","name":"data[recommend][]","value": $(this).attr("id")}); });
var url = $(this).find("img").attr("src"); });
var img = $("<img>").attr({"src":url,"height":100,"width":100});
var cancel = $("<input>").attr({"type":"button","value":"删除"}).addClass("imgCancel"); //根据上方选择的城市,选择推荐房源的默认城市
var p = $("<p>").append(img).append(cancel).append(recommendHouse); $("#recHouseBt").click(function(){
$("#houseImg").append(p); $('#cityId').find('option').remove();
controlCommand("houseImg",3,0); $('#areaId').find('option:not(:first-child)').remove();
}); $('#plateId').find('option:not(:first-child)').remove();
//添加置业顾问 $('#price').find('option:not(:first-child)').remove();
$("#consultantList").on("click",".consultantImg",function(){ $('#acreage').find('option:not(:first-child)').remove();
var recommendConsultant = $("<input>").attr({"type":"hidden","name":"data[recConsultant][]","value": $(this).attr("id")}); $("#houseList").find("li").remove();
var cancel = $("<input>").attr({"type":"button","value":"删除"}).addClass("consultantCancel"); var acreage =$("#acreage");
var font = $("<font>").append( $(this).text()); var price = $("#price");
var p = $("<p>").append(font).append(cancel).append(recommendConsultant); var area = $("#areaId");
$("#consultantImg").append(p); var cityId = $("#baseCity").val();
controlCommand("consultantImg",1,1); var cityName = $("#baseCity").find("option:selected").text();
}); var option = $("<option>").attr("value",cityId).append(cityName);
$("#cityId").append(option);
//新增房源相册 if(cityId != -1){
$("#housePicture").click(function(){ $.ajax({
var checkBox = $("<input>").attr({"type":"radio","name":"frontCover","value":i}); type: "GET",
var picDelet = $("<input>").attr({"type":"button","value":"删除"}).addClass("button action picDelet"); url: "/tospur/wp-admin/admin-ajax.php",
var file = $("<input>").attr({"type":"file","name":"files["+i+"]"}).addClass("picFiles"); data: "action=serachCity&cityId="+cityId,
var select = $("<select>").attr("name","data["+i+"][type]"); success:function(json){
var checkTd = $("<th>").append(checkBox); addOption(json,area);
var picDeletTd = $("<td>").append(picDelet); }
var selectTd = $("<th>").append(select); });
var fileTd = $("<th>").append(file);
{% for item in photoType %} //城市联动房子面积
select.append($("<option>").attr("value",{{item.id}}).append('{{item.value}}')); $.ajax({
{% endfor%} type: "GET",
var p = $("<p>").append(checkTd).append(selectTd).append(fileTd).append(picDeletTd); url: "/tospur/wp-admin/admin-ajax.php",
var fontA = $("<font>").append("设为封面"); data: "action=searchArea&cityId="+cityId,
var fontB = $("<font>").append("类型"); success:function(json){
var fontC = $("<font>").append("相册"); addOption(json,acreage);
var tdA = $("<th>").append(fontA); }
var tdB = $("<th>").append(fontB); });
var tdC = $("<th>").append(fontC); //城市联动房子价格
var titleP = $("<p>").append(tdA).append(tdB).append(tdC); $.ajax({
$("#picList").append(p); type: "GET",
if( titleFlag== 0){ url: "/tospur/wp-admin/admin-ajax.php",
$("#picList").before(titleP); data: "action=searchUnitPriceRange&cityId="+cityId,
titleFlag = 1 success:function(json){
} addOption(json,price);
i++ }
}); });
//显示选中的特色 addList(1)
$("#featureTable").find("tr > td").click(function(){ }
var houseFeature = $("<input>").attr({"type":"hidden","name":"data[houseFeature][]","value": $(this).attr("id")}); });
var cancel = $("<input>").attr({"type":"button","value":"删除"}).addClass("featureCancel");
var font = $("<font>").append( $(this).text()); //区域联动板块
var p =$("<p>").append(houseFeature).append(font).append(cancel); $("#areaId").change(function(){
$("#feature").append(p); var areaId = $("#areaId").val();
var cityId = $("#cityId").val();
}); var plate = $("#plateId");
$("#houseList").find("li").remove();
//房源相册 $('#plateId').find('option:not(:first-child)').remove();
$("#picList").on("change",".picFiles",function(){ $.ajax({
readURL(this,2); type: "GET",
$(this).hide(); url: "/tospur/wp-admin/admin-ajax.php",
}); data: "action=serachCity&cityId="+cityId+"&districtId="+areaId,
success:function(json){
//删除房源相册、推荐房源、推荐置业顾问 addOption(json,plate);
$("#houseImg,#consultantImg,#picList,#feature").on("click",".imgCancel,.consultantCancel,.picDelet,.featureCancel",function(){ }
$(this).parent("p").remove(); });
}); });
$("#picList,#houseImg,#consultantImg").on("click",".existsCancel",function(){ //推荐房源下显示图片信息以及房名
$(this).parent().remove(); $("#areaId,#plateId,#buildProperty,#room,#acreage,#price").change(function(){
}); addList(1)
});
$("#submit").click(function(){
if($("#housename").val()==""){ //添加房源中搜索框的搜索
alert("请输入楼盘名"); $("#search").click(function(){
return false; $searchtext = $("#searchtext").val();
} $("#houseList").find("li").remove();
}); $.ajax({
type: "post",
//file上传之前,显示图片的方法 url: "/tospur/wp-admin/admin-ajax.php",
function readURL(input,type) { data: "action=searchHouse&searchText="+$searchtext,
if(type == 1){ success:function(json){
if (input.files && input.files[0]){ var result = json.result;
var reader = new FileReader(); for(var i = 0; i < result.length; i++){
reader.onload = function (e) { var name = result[i]["name"];
var img = $("<img>").attr({"id":"target","src":e.target.result,"heghit":100,"width":100}); var id = result[i]['id'];
var button = $("<input>").attr({"type":"button","value":"取消","property":+i,"id":+i}).addClass("cancel"); var imgUrl = json.images[id];
var type = $("<input>").attr({"type":"hidden","name":"data["+i+"][type]","value":0,"property":+i}); var img = $("<img>").attr({"src":imgUrl,"height":90,"width":140,"style":"margin-right:50px"});
var file = $("<input>").attr({"type":"file","name":"files["+(i+1)+"]","property":+(i+1)}).addClass("files"); var li = $("<li>").addClass("addImg").append(img).append(name);
var select = $("<select>").attr({"name":"data["+i+"][buildProperty]"}); $("#houseList").append(li);
{% for item in buildProperty %}{{item.id}} }
select.append($("<option>").attr("value",{{item.id}}).append('{{item.value}}')); }
{% endfor%} });
var areatext = $("<input>").attr({"type":"text","placeholder":"面积","name":"data["+i+"][housearea]"}).addClass("form-control"); })
var div = $("<div>").append(select).append(areatext).append(button).append(type);
var span = $("<span>").attr({"property":+i}).append(img).append(div); //根据上方选择的城市,选择推荐置业顾问的默认城市
$("form").find("#preview > p").before(file); $("#recConsultantBt").click(function(){
$("#preview > p").append(span); $('#consultCity').find('option').remove();
i++; $("#consultantList").find("li").remove();
} var consulCityId = $("#baseCity").val();
} var consultantName =$("#consultantName").val();
}else{ var cityName = $("#baseCity").find("option:selected").text();
if (input.files && input.files[0]){ var option = $("<option>").attr("value",consulCityId).append(cityName);
var reader = new FileReader(); $("#consultCity").append(option);
reader.onload = function (e){ $.ajax({
var img = $("<img>").attr({"src":e.target.result,"heghit":100,"width":100}); type: "GET",
$(input).before(img); url: "/tospur/wp-admin/admin-ajax.php",
} data: "action=searchConsultant&consulCityId="+consulCityId+"&consultantName="+consultantName,
} success:function(json){
} for(var i = 0; i <=json.length-1; i++){
reader.readAsDataURL(input.files[0]); var name = json[i]["consultantName"];
} var imgUrl = json[i]["imageUrl"];
function addOption(json,select){ var img = $("<img>").attr({"src":imgUrl,"height":90,"width":140,"style":"margin-right:50px"});
var selectId = select.attr("id"); var li = $("<li>").attr("id",json[i]["id"]).append(img).append(name).addClass("consultantImg");
for(var i = 0; i <=json.length-1; i++){ $("#consultantList").append(li);
var id = json[i]["id"]; }
var value = json[i]["value"]; }
if(selectId == "acreage" || selectId == "price"){ });
id = value; });
} //添加置业顾问弹出层中搜索框的搜索内容
var Option = $("<option>").attr({"value": id}).append(value); $("#searchConsult").click(function(){
select.append(Option); var consulCityId = $("#consultCity").val();
} var consultantName =$("#consultantName").val();
} $("#consultantList").find("li").remove();
$.ajax({
function controlCommand(id,number,type){ type: "GET",
var num = $("#"+id+" > p").length; url: "/tospur/wp-admin/admin-ajax.php",
if(num>number){ data: "action=searchConsultant&consulCityId="+consulCityId+"&consultantName="+consultantName,
if(type==0){ success:function(json){
alert("最多只能推荐3个房源"); for(var i = 0; i <=json.length-1; i++){
}else if(type==1){ var name = json[i]["consultantName"];
alert("您只能推荐一位置业顾问"); var imgUrl = json[i]["imageUrl"];
} var img = $("<img>").attr({"src":imgUrl,"height":100,"width":100,"style":"margin-right:50px"});
$("#"+id).find("p:last-child").remove(); var li = $("<li>").attr("id",json[i]["id"]).append(img).append(name).addClass("consultantImg");
} $("#consultantList").append(li);
} }
}
function getUrlParmas(){ });
var href = location.search.substr(1,location.search.length-1); })
var params = href.split("&");
var map = {}; //点击添加房源中显示的列表,在界面中显示
for(item in params){ $("#houseList").on("click",".addImg",function(){
var key = params[item].split("=")[0] || ""; var recommendHouse = $("<input>").attr({"type":"hidden","name":"data[recommend][]","value": $(this).attr("id")});
var value = params[item].split("=")[1] || ""; var url = $(this).find("img").attr("src");
map[key] = value; var img = $("<img>").attr({"src":url,"height":90,"width":140,"style":"margin-right:50px"});
} var cancel = $("<input>").attr({"type":"button","value":"删除"}).addClass("button action imgCancel");
return map; var p = $("<p>").append(img).append(cancel).append(recommendHouse);
} $("#houseImg").append(p);
controlCommand("houseImg",3,0);
function addList(houseType){ });
$("#houseList").find("li").remove(); //添加置业顾问
var cityId = $("#baseCity").val(); $("#consultantList").on("click",".consultantImg",function(){
var buildPropertyId = $("#buildProperty").val(); var url = $(this).find("img").attr("src");
var room = $("#room").val(); var img = $("<img>").attr({"src":url,"height":100,"width":100,"style":"margin-right:50px"});
var areaId = $("#areaId").val(); var recommendConsultant = $("<input>").attr({"type":"hidden","name":"data[recConsultant][]","value": $(this).attr("id")});
var cityId = $("#cityId").val(); var cancel = $("<input>").attr({"type":"button","value":"删除"}).addClass("button action consultantCancel");
var plateId = $("#plateId").val(); var font = $("<font>").attr("style","margin-right:50px").append( $(this).text());
var acreage = $("#acreage").val(); var p = $("<p>").append(img).append(font).append(cancel).append(recommendConsultant);
var price = $("#price").val(); $("#consultantImg").append(p);
$.ajax({ controlCommand("consultantImg",1,1);
type: "post", });
url: "/tospur/wp-admin/admin-ajax.php",
data: "action=searchHouse&cityId="+cityId+"&districtId="+areaId+"&plateId="+plateId+"&buildPropertyId="+buildPropertyId+"&roomId="+room+"&acreage="+acreage+"&totalPrice="+price+"&houseType="+houseType, //新增房源相册
success:function(json){ $("#housePicture").click(function(){
var result = json.result; var radio = $("<input>").attr({"type":"radio","name":"frontCover","value":i,});
var urlParams = getUrlParmas(); var picDelet = $("<input>").attr({"type":"button","value":"删除"}).addClass("button action existsCancel");
for(var i = 0; i <result.length; i++){ var file = $("<input>").attr({"type":"file","name":"files["+i+"]"}).addClass("picFiles");
var name = result[i]["name"]; var select = $("<select>").attr({"name":"data["+i+"][type]"});
var id = result[i]['id']; var dicRadio = $("<div>").append(radio).addClass("col-md-3");
var imgUrl = result[i]['path']; var dicPicDelet = $("<div>").append(picDelet).addClass("col-md-2");
var img = $("<img>").attr({"src":imgUrl,"height":100,"width":100}); var dicFile = $("<div>").append(file).addClass("col-md-3");
var li = $("<li>").attr("id",id).addClass("addImg").append(img).append(name); var dicSelect = $("<div>").append(select).addClass("col-md-3");
if(urlParams["id"]){ var div = $("<div>").append(dicSelect).append(dicFile).append(dicRadio).append(dicPicDelet).addClass("row");
if(urlParams["id"]!=id){ {% for item in photoType %}
$("#houseList").append(li); select.append($("<option>").attr("value",{{item.id}}).append('{{item.value}}'));
} {% endfor%}
}else{ var p = $("<p>").append(div);
$("#houseList").append(li); var fontA = $("<div>").append("<font>").append("设为封面").addClass("col-md-3");
} var fontB = $("<div>").append("<font>").append("类型").addClass("col-md-3");
} var fontC = $("<div>").append("<font>").append("相册").addClass("col-md-3");
} var titleP = $("<div>").append(fontB).append(fontC).append(fontA).addClass("row");
}); $("#picList").append(p);
} var url = getUrlParmas();
}); if(!url.id){
})(jQuery); if( titleFlag== 0){
$("#picList").before(titleP);
</script> titleFlag = 1
}
</body> }
i++
});
//显示选中的特色
$("#featureTable").find("#featureList > div").click(function(){
var houseFeature = $("<input>").attr({"type":"hidden","name":"data[houseFeature][]","value": $(this).attr("id")});
var cancel = $("<input>").attr({"type":"button","value":"删除"}).addClass("button action featureCancel");
var font = $("<font>").attr("style","margin-right:50px").append( $(this).text());
var p =$("<p>").append(houseFeature).append(font).append(cancel);
$("#feature").append(p);
});
//房源相册
$("#picList").on("change",".picFiles",function(){
readURL(this,2);
$(this).hide();
});
//删除房源相册、推荐房源、推荐置业顾问
$("#houseImg,#consultantImg,#feature").on("click",".imgCancel,.consultantCancel,.picDelet,.featureCancel",function(){
$(this).parents("p").remove();
});
$("#houseImg,#consultantImg").on("click",".existsCancel",function(){
$(this).parent().remove();
});
$("#picList").on("click",".existsCancel",function(){
$(this).parent().parent().remove();
});
$("input[id='keyCheck']").change(function(){
textDisable("keyCheck","key");
});
$("input[id='garageCheck']").change(function(){
textDisable("garageCheck","garage");
});
$('#secHouse').validate({
onkeyup: false,
onfocusout: false,
errorClass: "my-error-class",
rules: {
housename:'required',
mark:'required',
owner_name:'required',
owner_phone:'required',
total_price:'required',
community_name:'required',
average_price:'required',
latest_news:'required',
baseCity:{
selectcheck: true
},
baseAreaId:{
selectcheck: true
},
basePlateId:{
selectcheck: true
}
},
messages: {
housename:'请输入房源名称',
mark:'请输入标签',
owner_name:'请输入业主姓名',
owner_phone:'请输入业主电话',
total_price:'请输入售价',
community_name:'请输入小区名称',
average_price:'请输入单价'
},
errorLabelContainer: "#notice",
errorElement: 'div',
submitHandler: function (form) {
if ($("#feature > p").length == 0){
alert("请选择房源特色");
}else if($("#consultantImg > p").length == 0 ){
alert("请选择置业顾问");
}else{
form.submit();
}
}
});
jQuery.validator.addMethod('selectcheck', function (value) {
return (value != '-1');
},"请选择城市区域");
$("form").find("select[name='faceto']").val("{{result.faceto}}");
$("form").find("select[name='age']").val("{{result.age}}");
$("form").find("select[name='propertyRight']").val("{{result.propertyRight}}");
$("form").find("select[name='decoration']").val("{{result.decoration}}");
$("form").find("select[name='source']").val("{{result.source}}");
$("form").find("select[name='structure']").val("{{result.structure}}");
$("form").find("select[name='roomNum']").val("{{result.roomNum}}");
$("form").find("select[name='livingRoom']").val("{{result.livingRoom}}");
$("form").find("select[name='bathRoom']").val("{{result.bathRoom}}");
$("form").find("select[name='kitchen']").val("{{result.kitchen}}");
$("form").find("select[name='balcony']").val("{{result.balcony}}");
function textDisable(checkId,textId){
if($('input[id="'+checkId+'"]:checked').length > 0){
$("#"+textId).removeAttr("disabled");
}else{
$("#"+textId).attr("disabled","true");
}
}
//file上传之前,显示图片的方法
function readURL(input,type) {
if(type == 1){
if (input.files && input.files[0]){
var reader = new FileReader();
reader.onload = function (e) {
var img = $("<img>").attr({"id":"target","src":e.target.result,"heghit":140,"width":90,"style":"margin-right:50px;margin-top:10px"});
var button = $("<input>").attr({"type":"button","value":"取消","property":+i,"id":+i}).addClass("button action cancel");
var type = $("<input>").attr({"type":"hidden","name":"data["+i+"][type]","value":4,"property":+i});
var mainHousePic = $("<input>").attr({"type":"hidden","name":"data["+i+"][mainHouse]","value":0,"property":+i});
var file = $("<input>").attr({"type":"file","name":"files["+(i+1)+"]","property":+(i+1)}).addClass("files");
var select = $("<select>").attr({"name":"data["+i+"][buildProperty]","style":"margin-right:50px"});
{% for item in buildProperty %}{{item.id}}
select.append($("<option>").attr("value",{{item.id}}).append('{{item.value}}'));
{% endfor%}
var areatext = $("<input>").attr({"type":"text","placeholder":"面积","name":"data["+i+"][housearea]","style":"width: 100px;display:inline-block;margin-right:50px"}).addClass("form-control");
var div = $("<div>").attr({"property":+i}).append(img).append(select).append(areatext).append(button).append(type).append(mainHousePic).addClass("row");
$("form").find("#preview > p").after(file);
$("#preview > p").append(div);
i++;
}
}
}else{
if (input.files && input.files[0]){
var reader = new FileReader();
reader.onload = function (e){
var img = $("<img>").attr({"src":e.target.result,"heghit":90,"width":140});
$(input).before(img);
}
}
}
reader.readAsDataURL(input.files[0]);
}
function addOption(json,select){
var selectId = select.attr("id");
for(var i = 0; i <=json.length-1; i++){
var id = json[i]["id"];
var value = json[i]["value"];
if(selectId == "acreage" || selectId == "price"){
id = value;
}
var Option = $("<option>").attr({"value": id}).append(value);
select.append(Option);
}
}
function controlCommand(id,number,type){
var num = $("#"+id+" > p").length;
if(num>number){
if(type==0){
alert("最多只能推荐3个房源");
}else if(type==1){
alert("您只能推荐一位置业顾问");
}
$("#"+id).find("p:last-child").remove();
}
}
function getUrlParmas(){
var href = location.search.substr(1,location.search.length-1);
var params = href.split("&");
var map = {};
for(item in params){
var key = params[item].split("=")[0] || "";
var value = params[item].split("=")[1] || "";
map[key] = value;
}
return map;
}
function addList(houseType){
$("#houseList").find("li").remove();
var cityId = $("#baseCity").val();
var buildPropertyId = $("#buildProperty").val();
var room = $("#room").val();
var areaId = $("#areaId").val();
var cityId = $("#cityId").val();
var plateId = $("#plateId").val();
var acreage = $("#acreage").val();
var price = $("#price").val();
$.ajax({
type: "post",
url: "/tospur/wp-admin/admin-ajax.php",
data: "action=searchHouse&cityId="+cityId+"&districtId="+areaId+"&plateId="+plateId+"&buildPropertyId="+buildPropertyId+"&roomId="+room+"&acreage="+acreage+"&totalPrice="+price+"&houseType="+houseType,
success:function(json){
var result = json.result;
var urlParams = getUrlParmas();
for(var i = 0; i <result.length; i++){
var name = result[i]["name"];
var id = result[i]['id'];
var imgUrl = result[i]['path'];
var img = $("<img>").attr({"src":imgUrl,"height":90,"width":140,"style":"margin-right:50px"});
var li = $("<li>").attr("id",id).addClass("addImg").append(img).append(name);
if(urlParams["id"]){
if(urlParams["id"]!=id){
$("#houseList").append(li);
}
}else{
$("#houseList").append(li);
}
}
}
});
}
});
})(jQuery);
</script>
</body>
</html> </html>
\ No newline at end of file
...@@ -23,6 +23,7 @@ class Config { ...@@ -23,6 +23,7 @@ class Config {
const TOSPUR_TAG_TABLE = 'tospur_tag'; const TOSPUR_TAG_TABLE = 'tospur_tag';
const TOSPUR_VIEW_HOUSE_TABLE = 'tospur_view_house'; const TOSPUR_VIEW_HOUSE_TABLE = 'tospur_view_house';
const TOSPUR_VERIFY_TABLE = 'tospur_verify'; const TOSPUR_VERIFY_TABLE = 'tospur_verify';
const TOSPUR_SALE_TABLE = 'tospur_sale';
const WP_USERS_TABLE = 'wp_users'; const WP_USERS_TABLE = 'wp_users';
......
...@@ -115,7 +115,7 @@ class InsertDao{ ...@@ -115,7 +115,7 @@ class InsertDao{
} }
//房源类型、面积与图片关联表 //房源类型、面积与图片关联表
if($data[$key]["type"] == "0"){ if($data[$key]["mainHouse"] == "0"){
$houseTypeArea = array( $houseTypeArea = array(
'house_id' => $houseId, 'house_id' => $houseId,
"buildproperty_id" => $data["$key"]["buildProperty"], "buildproperty_id" => $data["$key"]["buildProperty"],
......
...@@ -387,6 +387,7 @@ class SearchDao ...@@ -387,6 +387,7 @@ class SearchDao
LEFT JOIN ".Config::TOSPUR_IMAGE_TABLE." ti on ti.id = ada.image_id LEFT JOIN ".Config::TOSPUR_IMAGE_TABLE." ti on ti.id = ada.image_id
where ada.house_id = %d"; where ada.house_id = %d";
$mainImage = $wpdb->get_results($wpdb->prepare($mainImagesSql,$hid)); $mainImage = $wpdb->get_results($wpdb->prepare($mainImagesSql,$hid));
foreach($mainImage as $key => $value){ foreach($mainImage as $key => $value){
$value->path = Image::getImage($value->path,'big'); $value->path = Image::getImage($value->path,'big');
} }
...@@ -461,4 +462,28 @@ class SearchDao ...@@ -461,4 +462,28 @@ class SearchDao
return $results; return $results;
} }
public static function searchFeatureOld($hid){
global $wpdb;
$featureSql ="select tag_id,name from a_house_tag aht
LEFT JOIN (select id as tid,name ,type from tospur_tag) tt on aht.tag_id = tt.tid where aht.house_id = %d and type = 1";
$feature = $wpdb->get_results($wpdb->prepare($featureSql,$hid));
return $feature;
}
public static function searchStatus($hid,$statusType){
global $wpdb;
$statusSql = "select status_id as id from tospur_house th
left join(select status_type,status_id,status_name from tospur_status) ts on th.status = ts.status_id where th.id=".$hid." and status_type=".$statusType;
$status = $wpdb->get_row($statusSql);
return $status;
}
public static function searchRent($hid){
global $wpdb;
$rentSql = "select rent as value from tospur_house where id = %d";
$results = $wpdb->get_row($wpdb->prepare($rentSql,$hid));
return $results;
}
} }
\ No newline at end of file
<?php
require_once(PLUGIN_DIR . 'Config.php');
class TospurDao
{
//insert 预约看房
public static function insert_view_house($house_id, $user_id, $date, $index, $time, $consultant_id)
{
$insert_view_house_array = array(
'house_id' => $house_id,
'user_id' => $user_id,
'date' => $date,
'time_index' => $index,
'time' => $time,
'consultant_id' => $consultant_id,
'handle' => 0
);
global $wpdb;
$result = $wpdb->insert(Config::TOSPUR_VIEW_HOUSE_TABLE, $insert_view_house_array);
return $result;
}
public static function update_view_house($id)
{
global $wpdb;
$result = $wpdb->update(Config::TOSPUR_VIEW_HOUSE_TABLE, array(
'handle' => 1,
'handle_date' => current_time('Y-m-d H:i:s')
), array(
'id' => $id
));
return $result;
}
public static function update_view_house_consultant($house_id, $consultant_id)
{
global $wpdb;
$result = $wpdb->update(Config::TOSPUR_VIEW_HOUSE_TABLE, array(
'consultant_id' => $consultant_id
), array(
'id' => $house_id
));
return $result;
}
//search 预约看房 user_id
public static function search_view_house_by_user_id($user_id)
{
global $wpdb;
$sql = 'select v.house_id,v.date,v.time,v.consultant_id,v.handle,h.name from ' . Config::TOSPUR_VIEW_HOUSE_TABLE . ' v ' .
'left join ' . Config::TOSPUR_HOUSE_TABLE . ' h on v.house_id = h.id ' .
'where v.user_id = ' . $user_id . ' order by v.date desc';
return $wpdb->get_results($sql);
}
//search 预约看房 consultant_id
public static function search_view_house_by_consultant_id($consultant_id)
{
global $wpdb;
$sql = 'select v.id,v.house_id,v.date,v.time,v.user_id,v.handle,h.name from ' . Config::TOSPUR_VIEW_HOUSE_TABLE . ' v ' .
'left join ' . Config::TOSPUR_HOUSE_TABLE . ' h on v.house_id = h.id ' .
'where v.consultant_id = ' . $consultant_id . ' order by v.date desc';
return $wpdb->get_results($sql);
}
//insert 置业顾问评分
public static function insert_consultant_score($consultant_id, $user_id, $score, $valid = 1)
{
$insert_consultant_score_array = array(
'consultant_id' => $consultant_id,
'user_id' => $user_id,
'score' => $score,
'valid' => $valid
);
global $wpdb;
$result = $wpdb->insert(Config::TOSPUR_CONSULTANT_SCORE_TABLE, $insert_consultant_score_array);
return $result;
}
public static function search_score_type($user_id, $consultant_id)
{
global $wpdb;
$sql = 'select type from (SELECT user_id,consultant_id,handle_date,1 as type FROM ' . Config::TOSPUR_VIEW_HOUSE_TABLE .
' where handle = 1 and user_id = ' . $user_id . ' and consultant_id = ' . $consultant_id . ' UNION' .
' SELECT user_id,consultant_id,handle_date,2 as type FROM ' . Config::TOSPUR_SALE_TABLE .
' where handle = 1 and user_id = ' . $user_id . ' and consultant_id = ' . $consultant_id . ') as u' .
' order by handle_date desc limit 1';
return $wpdb->get_var($sql);
}
//search 置业顾问信息
public static function search_consultant_info($consultant_id)
{
global $wpdb;
$sql = 'select c.*,u.display_name,s.average_score from ' . Config::TOSPUR_CONSULTANT . ' c ' .
'left join ' . Config::WP_USERS_TABLE . ' u on c.id = u.ID ' .
'left join (select consultant_id,sum(score)/count(score) as average_score from ' . Config::TOSPUR_CONSULTANT_SCORE_TABLE . ' group by consultant_id) s ' .
'on c.id = s.consultant_id where c.id = ' . $consultant_id;
return $wpdb->get_row($sql);
}
public static function update_consultant_score($score_id, $valid)
{
global $wpdb;
$result = $wpdb->update(Config::TOSPUR_CONSULTANT_SCORE_TABLE, array(
'valid' => $valid
), array(
'id' => $score_id
));
return $result;
}
public static function search_tospur_verify($phone, $code)
{
global $wpdb;
$sql = 'select code from ' . Config::TOSPUR_VERIFY_TABLE . ' where phone = ' . $phone . ' and status = 0 ' .
'and create_time > NOW() - INTERVAL 30 MINUTE ' .
'order by create_time desc limit 1';
return $wpdb->get_var($sql);
}
public static function insert_tospur_verify($phone, $code)
{
$insert_tospur_verify_array = array(
'phone' => $phone,
'code' => $code,
'create_time' => current_time('Y-m-d H:i:s'),
'status' => 0
);
global $wpdb;
$result = $wpdb->insert(Config::TOSPUR_VERIFY_TABLE, $insert_tospur_verify_array);
return $result;
}
public static function update_tospur_verify($phone)
{
global $wpdb;
$wpdb->update(Config::TOSPUR_VERIFY_TABLE, array(
'status' => 1
), array(
'phone' => $phone
));
}
public static function search_consultant_by_city($city_id, $index)
{
global $wpdb;
$consultant_sql = 'select c.*,u.display_name,s.average_score from ' . Config::TOSPUR_CONSULTANT . ' c ' .
'left join ' . Config::WP_USERS_TABLE . ' u on c.id = u.ID ' .
'left join (select consultant_id,sum(score)/count(score) as average_score from ' . Config::TOSPUR_CONSULTANT_SCORE_TABLE . ' where valid=1 group by consultant_id) s on c.id = s.consultant_id ' .
'where cityid = ' . $city_id . ' LIMIT ' . $index . ',20;';
return $wpdb->get_results($consultant_sql);
}
public static function insert_tospur_sale($post)
{
$post['submission_date'] = current_time('Y-m-d H:i:s');
unset($post['action']);
global $wpdb;
$result = $wpdb->insert(Config::TOSPUR_SALE_TABLE, $post);
return $result;
}
}
?>
\ No newline at end of file
...@@ -121,7 +121,7 @@ class consultantScoreList extends WP_List_Table ...@@ -121,7 +121,7 @@ class consultantScoreList extends WP_List_Table
{ {
global $wpdb; global $wpdb;
$per_page = 5; $per_page = 10;
$columns = $this->get_columns(); $columns = $this->get_columns();
$hidden = array(); $hidden = array();
$sortable = $this->get_sortable_columns(); $sortable = $this->get_sortable_columns();
......
...@@ -13,9 +13,10 @@ add_action('init', 'tospur_init'); ...@@ -13,9 +13,10 @@ add_action('init', 'tospur_init');
function tospur_init() function tospur_init()
{ {
require_once(PLUGIN_DIR . 'Config.php'); require_once(PLUGIN_DIR . 'Config.php');
require_once(PLUGIN_DIR . 'Tools/TCSync.php'); require_once(PLUGIN_DIR . 'Tools/TCSync.php');
require_once(PLUGIN_DIR . 'Tools/Image.php'); require_once(PLUGIN_DIR . 'Tools/Image.php');
require_once(PLUGIN_DIR . 'Dao/SearchDao.php'); require_once(PLUGIN_DIR . 'Dao/SearchDao.php');
require_once(PLUGIN_DIR . 'Dao/TospurDao.php');
require_once(PLUGIN_DIR . 'Admin/House.php'); require_once(PLUGIN_DIR . 'Admin/House.php');
require_once(PLUGIN_DIR . 'Admin/newHouseList.php'); require_once(PLUGIN_DIR . 'Admin/newHouseList.php');
require_once(PLUGIN_DIR . 'Admin/secHandHouse.php'); require_once(PLUGIN_DIR . 'Admin/secHandHouse.php');
...@@ -71,6 +72,8 @@ function tospur_register_script_style(){ ...@@ -71,6 +72,8 @@ function tospur_register_script_style(){
wp_register_script('jquery-ui',plugins_url('Admin/views', __FILE__)."/js/jquery-ui.js"); wp_register_script('jquery-ui',plugins_url('Admin/views', __FILE__)."/js/jquery-ui.js");
wp_register_script('validate',plugins_url('Admin/views', __FILE__)."/js/jquery.validate.js"); wp_register_script('validate',plugins_url('Admin/views', __FILE__)."/js/jquery.validate.js");
wp_register_script('bootstrapjs',plugins_url('Admin/views', __FILE__)."/js/bootstrap.min.js"); wp_register_script('bootstrapjs',plugins_url('Admin/views', __FILE__)."/js/bootstrap.min.js");
wp_register_script('publicjs',plugins_url('Admin/views', __FILE__)."/js/public.js");
wp_register_style('jquery-ui_css', plugins_url('Admin/views', __FILE__)."/css/jquery-ui.css"); wp_register_style('jquery-ui_css', plugins_url('Admin/views', __FILE__)."/css/jquery-ui.css");
wp_register_style('bootstrapcss', plugins_url('Admin/views', __FILE__)."/css/bootstrap.css"); wp_register_style('bootstrapcss', plugins_url('Admin/views', __FILE__)."/css/bootstrap.css");
wp_register_style('bootstrapMinCss', plugins_url('Admin/views', __FILE__)."/css/bootstrap.min.css"); wp_register_style('bootstrapMinCss', plugins_url('Admin/views', __FILE__)."/css/bootstrap.min.css");
...@@ -111,7 +114,7 @@ function valid_consultant_score() ...@@ -111,7 +114,7 @@ function valid_consultant_score()
$score_id = $_POST['id']; $score_id = $_POST['id'];
$valid = $_POST['valid']; $valid = $_POST['valid'];
if (isset($score_id) && isset($valid)) { if (isset($score_id) && isset($valid)) {
$result = dao::update_consultant_score($score_id, $valid); $result = TospurDao::update_consultant_score($score_id, $valid);
$array = array(); $array = array();
if ($result) { if ($result) {
$array['code'] = 2000; $array['code'] = 2000;
...@@ -126,7 +129,7 @@ function update_consultant() ...@@ -126,7 +129,7 @@ function update_consultant()
$house_id = $_POST['id']; $house_id = $_POST['id'];
$consultant_id = $_POST['consultant_id']; $consultant_id = $_POST['consultant_id'];
if (isset($consultant_id) && isset($house_id)) { if (isset($consultant_id) && isset($house_id)) {
$result = dao::update_view_house_consultant($house_id, $consultant_id); $result = TospurDao::update_view_house_consultant($house_id, $consultant_id);
$array = array(); $array = array();
if ($result) { if ($result) {
$array['code'] = 2000; $array['code'] = 2000;
...@@ -144,7 +147,6 @@ function reset_menu() ...@@ -144,7 +147,6 @@ function reset_menu()
add_submenu_page('newHouseList', '添加新房', '添加新房', 'moderate_comments', 'newHouse', 'House::init_view'); add_submenu_page('newHouseList', '添加新房', '添加新房', 'moderate_comments', 'newHouse', 'House::init_view');
add_menu_page('secHandHouseList','二手房列表', 'moderate_comments', 'secHandHouseList', 'function_secHandHouseList', 'dashicons-menu', 7); add_menu_page('secHandHouseList','二手房列表', 'moderate_comments', 'secHandHouseList', 'function_secHandHouseList', 'dashicons-menu', 7);
add_submenu_page('secHandHouseList', '添加二手房', '添加二手房', 'moderate_comments', 'secHandHouse', 'SecHandHouse::secHandHouse_html'); add_submenu_page('secHandHouseList', '添加二手房', '添加二手房', 'moderate_comments', 'secHandHouse', 'SecHandHouse::secHandHouse_html');
add_submenu_page('secHandHouseList', '特色列表', '特色列表', 'moderate_comments', 'feature_list', 'feature::feature_list_html');
add_submenu_page('secHandHouseList', '添加特色', '添加特色', 'moderate_comments', 'add_feature', 'feature::add_feature_html'); add_submenu_page('secHandHouseList', '添加特色', '添加特色', 'moderate_comments', 'add_feature', 'feature::add_feature_html');
add_menu_page('rentHouseList','租房列表', 'moderate_comments', 'rentHouseList', 'function_rentHouseList', 'dashicons-menu', 8); add_menu_page('rentHouseList','租房列表', 'moderate_comments', 'rentHouseList', 'function_rentHouseList', 'dashicons-menu', 8);
add_submenu_page('rentHouseList', '添加租房', '添加租房', 'moderate_comments', 'rentHouse', 'RentHouse::rentHouse_html'); add_submenu_page('rentHouseList', '添加租房', '添加租房', 'moderate_comments', 'rentHouse', 'RentHouse::rentHouse_html');
......
...@@ -85,7 +85,7 @@ class viewHouseList extends WP_List_Table ...@@ -85,7 +85,7 @@ class viewHouseList extends WP_List_Table
{ {
global $wpdb; global $wpdb;
$per_page = 5; $per_page = 10;
$columns = $this->get_columns(); $columns = $this->get_columns();
$hidden = array(); $hidden = array();
//$sortable = $this->get_sortable_columns(); //$sortable = $this->get_sortable_columns();
......
...@@ -7,7 +7,6 @@ $current_user = wp_get_current_user(); ...@@ -7,7 +7,6 @@ $current_user = wp_get_current_user();
$user_id = $current_user->ID; $user_id = $current_user->ID;
if ($user_id != 0) { if ($user_id != 0) {
$context['user_id'] = $user_id; $context['user_id'] = $user_id;
$current_user = wp_get_current_user();
$consultant_id = isset($_GET['consultant_id'])?$_GET['consultant_id']:$current_user->ID; $consultant_id = isset($_GET['consultant_id'])?$_GET['consultant_id']:$current_user->ID;
$context['consultant_id'] = $consultant_id; $context['consultant_id'] = $consultant_id;
$context['consultant'] = get_consultant_info($consultant_id); $context['consultant'] = get_consultant_info($consultant_id);
......
...@@ -442,13 +442,14 @@ a:hover { ...@@ -442,13 +442,14 @@ a:hover {
height: 45px; height: 45px;
background-color: #f9f9f9; background-color: #f9f9f9;
} }
.footer .btn { .footer .btn-group {
width: 94%; border-spacing: 10px 5px;
display: block; }
.footer .btn-group .btn {
color: #ffffff; color: #ffffff;
font-weight: bold; font-weight: bold;
margin: 5px auto; margin: 0;
padding: 1px; padding: 2px 12px 0;
background-color: #008cd7; background-color: #008cd7;
border-top-left-radius: 4px; border-top-left-radius: 4px;
border-top-right-radius: 4px; border-top-right-radius: 4px;
...@@ -461,28 +462,40 @@ a:hover { ...@@ -461,28 +462,40 @@ a:hover {
box-shadow: 0 2px 0 0 #117bb9; box-shadow: 0 2px 0 0 #117bb9;
-webkit-box-shadow: 0 2px 0 0 #117bb9; -webkit-box-shadow: 0 2px 0 0 #117bb9;
} }
.footer .btn:active { .footer .btn-group .btn:active {
background-color: #117bb9; background-color: #117bb9;
} }
.footer .btn:focus { .footer .btn-group .btn:focus {
outline: 0; outline: 0;
} }
.footer .btn.btn-wechat span { .footer .btn-group .btn.btn-phone span {
width: 30px; width: 30px;
height: 30px; height: 30px;
background: url("../img/white_wechat_icon.png") no-repeat; background: url("../img/white_phone_icon.png") no-repeat;
background-size: cover; background-size: cover;
-webkit-background-size: cover; -webkit-background-size: cover;
display: inline-block; display: inline-block;
vertical-align: middle; vertical-align: middle;
margin-right: 6px;
} }
.footer .btn.btn-phone span { .footer .btn-group .btn.btn-wechat span {
width: 30px; width: 30px;
height: 30px; height: 30px;
background: url("../img/white_phone_icon.png") no-repeat; background: url("../img/white_wechat_icon.png") no-repeat;
background-size: cover; background-size: cover;
-webkit-background-size: cover; -webkit-background-size: cover;
display: inline-block; display: inline-block;
vertical-align: middle; vertical-align: middle;
margin-right: 6px;
}
.footer .btn-group .btn:first-child:not(:last-child):not(.dropdown-toggle) {
border-top-right-radius: 4px;
border-bottom-right-radius: 4px;
-webkit-border-top-right-radius: 4px;
-webkit-border-bottom-right-radius: 4px;
}
.footer .btn-group .btn:last-child:not(:first-child) {
border-top-left-radius: 4px;
border-bottom-left-radius: 4px;
-webkit-border-top-left-radius: 4px;
-webkit-border-bottom-left-radius: 4px;
} }
...@@ -577,6 +577,12 @@ body { ...@@ -577,6 +577,12 @@ body {
.detail_row.recommend .recommendCont { .detail_row.recommend .recommendCont {
margin: 0 -10px; margin: 0 -10px;
} }
.detail_row.recommend .recommendCont ul {
font-size: 14px;
}
.detail_row.recommend .recommendCont ul .address span:nth-child(1) {
font-size: 16px;
}
.detail_row .peopleCont li { .detail_row .peopleCont li {
width: 100%; width: 100%;
height: 60px; height: 60px;
......
...@@ -573,3 +573,12 @@ a:hover { ...@@ -573,3 +573,12 @@ a:hover {
font-weight: bold; font-weight: bold;
display: block; display: block;
} }
.footer a span {
width: 30px;
height: 30px;
background: url("../img/blue_phone_icon.png") no-repeat;
background-size: cover;
-webkit-background-size: cover;
display: inline-block;
vertical-align: middle;
}
.tab {
width: 100%;
height: 40px;
margin-bottom: 0;
border-bottom: 1px solid #008cd7;
}
.tab li .btn {
color: #000000;
font-size: 18px;
font-weight: bold;
position: static;
}
.tab li .btn:after {
content: "";
width: 88%;
height: 4px;
position: absolute;
bottom: 0;
left: 0;
right: 0;
margin: 0 auto;
}
.tab li .btn:active {
box-shadow: none;
-webkit-box-shadow: none;
}
.tab li.active .btn:after {
background-color: #008cd7;
}
.row {
width: 100%;
height: 121px;
margin: 0;
padding: 15px 0;
border-bottom: 1px solid #b7b7b7;
}
.row p {
width: 140px;
height: 100%;
float: left;
padding: 0 10px;
margin-bottom: 0;
overflow: hidden;
}
.row p img {
height: 100%;
border-top-left-radius: 6px;
border-top-right-radius: 6px;
border-bottom-left-radius: 6px;
border-bottom-right-radius: 6px;
-webkit-border-top-left-radius: 6px;
-webkit-border-top-right-radius: 6px;
-webkit-border-bottom-left-radius: 6px;
-webkit-border-bottom-right-radius: 6px;
}
.row ul {
height: 100%;
padding-right: 10px;
margin-bottom: 0;
overflow: hidden;
zoom: 1;
position: relative;
color: #5a5a5a;
font-size: 15px;
}
.row ul li {
height: 18px;
line-height: 18px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.row ul li span {
margin-right: 15px;
}
.row ul li span:last-child {
margin-right: 0;
}
.row ul li.address {
height: 22px;
line-height: 22px;
margin-top: 2px;
}
.row ul li.address span:nth-child(1) {
color: #000000;
font-size: 19px;
font-weight: bold;
}
.row ul li:last-child {
position: absolute;
left: 0;
right: 10px;
bottom: 0;
font-size: 0;
}
.row ul li:last-child .label {
color: #ff0000;
padding: 1px 4px;
font-size: 9px;
border: 1px solid #acacac;
margin: 0 5px 0 0;
vertical-align: middle;
border-top-left-radius: 3px;
border-top-right-radius: 3px;
border-bottom-left-radius: 3px;
border-bottom-right-radius: 3px;
-webkit-border-top-left-radius: 3px;
-webkit-border-top-right-radius: 3px;
-webkit-border-bottom-left-radius: 3px;
-webkit-border-bottom-right-radius: 3px;
}
.row ul li:last-child span {
color: #000000;
font-size: 15px;
}
.row ul li:last-child span em {
font-style: normal;
}
.row ul li:last-child span em:nth-child(1) {
color: #ff0000;
font-size: 19px;
font-weight: bold;
}
.row ul li:last-child span em:nth-child(2) {
font-size: 7px;
vertical-align: top;
}
.row ul li.multiLine_omit {
color: #000000;
font-weight: bold;
height: 36px;
margin-top: 0;
-webkit-line-clamp: 2;
display: -webkit-box;
-webkit-box-orient: vertical;
white-space: normal;
}
.row:active {
background-color: #e9e9e9;
}
.modal .modal-dialog {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
width: 280px;
height: 130px;
}
.modal .modal-dialog .modal-content {
color: #000000;
font-size: 16px;
border: 0;
border-top-left-radius: 8px;
border-top-right-radius: 8px;
border-bottom-left-radius: 8px;
border-bottom-right-radius: 8px;
-webkit-border-top-left-radius: 8px;
-webkit-border-top-right-radius: 8px;
-webkit-border-bottom-left-radius: 8px;
-webkit-border-bottom-right-radius: 8px;
box-shadow: none;
-webkit-box-shadow: none;
}
.modal .modal-dialog .modal-content h4 {
font-size: 19px;
font-weight: bold;
margin: 0 20px;
padding-top: 15px;
}
.modal .modal-dialog .modal-content p {
margin: 12px 20px 14px;
}
.modal .modal-dialog .modal-content p:nth-of-type(2) {
margin: 0;
font-size: 0;
}
.modal .modal-dialog .modal-content p:nth-of-type(2) .btn {
width: 50%;
}
.modal .modal-dialog .modal-content p:nth-of-type(2) .btn:nth-child(2) {
border-left-color: #cfd0d0;
}
.modal .modal-dialog .modal-content .btn {
border-top-color: #cfd0d0;
background-color: transparent;
font-weight: bold;
border-top-left-radius: 0;
border-top-right-radius: 0;
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
-webkit-border-top-left-radius: 0;
-webkit-border-top-right-radius: 0;
-webkit-border-bottom-left-radius: 0;
-webkit-border-bottom-right-radius: 0;
}
.modal .modal-dialog .modal-content .btn:active {
background-color: #e9e9e9;
border-bottom-left-radius: 8px;
border-bottom-right-radius: 8px;
-webkit-border-bottom-left-radius: 8px;
-webkit-border-bottom-right-radius: 8px;
box-shadow: none;
-webkit-box-shadow: none;
}
.modal .modal-dialog .modal-content .btn:focus {
outline: 0;
}
.loading {
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
z-index: 1040;
background-color: rgba(0, 0, 0, 0.5);
}
.loading ul {
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
width: 40px;
height: 40px;
}
.loading ul li {
position: absolute;
width: 100%;
height: 100%;
}
.loading ul li:nth-child(1) p:nth-child(2) {
animation-delay: -0.9s;
-webkit-animation-delay: -0.9s;
}
.loading ul li:nth-child(1) p:nth-child(3) {
animation-delay: -0.6s;
-webkit-animation-delay: -0.6s;
}
.loading ul li:nth-child(1) p:nth-child(4) {
animation-delay: -0.3s;
-webkit-animation-delay: -0.3s;
}
.loading ul li:nth-child(2) {
transform: rotateZ(45deg);
-webkit-transform: rotateZ(45deg);
}
.loading ul li:nth-child(2) p:nth-child(1) {
animation-delay: -1.1s;
-webkit-animation-delay: -1.1s;
}
.loading ul li:nth-child(2) p:nth-child(2) {
animation-delay: -0.8s;
-webkit-animation-delay: -0.8s;
}
.loading ul li:nth-child(2) p:nth-child(3) {
animation-delay: -0.5s;
-webkit-animation-delay: -0.5s;
}
.loading ul li:nth-child(2) p:nth-child(4) {
animation-delay: -0.2s;
-webkit-animation-delay: -0.2s;
}
.loading ul li:nth-child(3) {
transform: rotateZ(90deg);
-webkit-transform: rotateZ(90deg);
}
.loading ul li:nth-child(3) p:nth-child(1) {
animation-delay: -1s;
-webkit-animation-delay: -1s;
}
.loading ul li:nth-child(3) p:nth-child(2) {
animation-delay: -0.7s;
-webkit-animation-delay: -0.7s;
}
.loading ul li:nth-child(3) p:nth-child(3) {
animation-delay: -0.4s;
-webkit-animation-delay: -0.4s;
}
.loading ul li:nth-child(3) p:nth-child(4) {
animation-delay: -0.1s;
-webkit-animation-delay: -0.1s;
}
.loading ul li p {
width: 10px;
height: 10px;
margin-bottom: 0;
border-top-left-radius: 50%;
border-top-right-radius: 50%;
border-bottom-left-radius: 50%;
border-bottom-right-radius: 50%;
-webkit-border-top-left-radius: 50%;
-webkit-border-top-right-radius: 50%;
-webkit-border-bottom-left-radius: 50%;
-webkit-border-bottom-right-radius: 50%;
position: absolute;
background-color: #ffffff;
animation: bouncedelay 1.2s infinite ease-in-out both;
-webkit-animation: bouncedelay 1.2s infinite ease-in-out both;
}
.loading ul li p:nth-child(1) {
top: 0;
left: 0;
}
.loading ul li p:nth-child(2) {
top: 0;
right: 0;
}
.loading ul li p:nth-child(3) {
bottom: 0;
right: 0;
}
.loading ul li p:nth-child(4) {
bottom: 0;
left: 0;
}
@keyframes bouncedelay {
0%,
80%,
100% {
transform: scale(0);
-webkit-transform: scale(0);
}
40% {
transform: scale(1);
-webkit-transform: scale(1);
}
}
@-webkit-keyframes bouncedelay {
0%,
80%,
100% {
transform: scale(0);
-webkit-transform: scale(0);
}
40% {
transform: scale(1);
-webkit-transform: scale(1);
}
}
html,
body {
width: 100%;
height: 100%;
}
body {
user-select: none;
-webkit-user-select: none;
tap-highlight-color: rgba(0, 0, 0, 0);
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
color: #707070;
background-color: #f9f9f9;
}
a:hover {
text-decoration: none;
}
.container-fluid {
width: 100%;
height: 100%;
background: url("../img/formBg.jpg") no-repeat;
background-size: 100% 100%;
-webkit-background-size: 100% 100%;
background-attachment: fixed;
overflow: auto;
padding: 0 25px;
}
.container-fluid form {
width: 400px;
margin: 0 auto;
}
.container-fluid form h2 {
margin: 100px 0;
color: #ffffff;
font-weight: bold;
width: 100%;
height: 34px;
background: url("../img/logo.png") no-repeat;
background-size: 150px 34px;
-webkit-background-size: 150px 34px;
background-position: center;
}
.container-fluid form .has-feedback {
margin-bottom: 0;
background-color: #ffffff;
border: 1px solid #cfd0d0;
}
.container-fluid form .has-feedback .form-control {
height: 60px;
color: #7d7d7d;
border: 0;
box-shadow: none;
-webkit-box-shadow: none;
border-top-left-radius: 0;
border-top-right-radius: 0;
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
-webkit-border-top-left-radius: 0;
-webkit-border-top-right-radius: 0;
-webkit-border-bottom-left-radius: 0;
-webkit-border-bottom-right-radius: 0;
-webkit-appearance: none;
}
.container-fluid form .has-feedback .form-control::-webkit-input-placeholder {
color: #7d7d7d;
}
.container-fluid form .has-feedback:first-of-type {
margin-bottom: -1px;
border-top-left-radius: 4px;
border-top-right-radius: 4px;
-webkit-border-top-left-radius: 4px;
-webkit-border-top-right-radius: 4px;
}
.container-fluid form .has-feedback:first-of-type .form-control {
border-top-left-radius: 3px;
border-top-right-radius: 3px;
-webkit-border-top-left-radius: 3px;
-webkit-border-top-right-radius: 3px;
}
.container-fluid form .has-feedback:last-of-type {
margin-top: -1px;
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
-webkit-border-bottom-left-radius: 4px;
-webkit-border-bottom-right-radius: 4px;
}
.container-fluid form .has-feedback:last-of-type .form-control {
border-bottom-left-radius: 3px;
border-bottom-right-radius: 3px;
-webkit-border-bottom-left-radius: 3px;
-webkit-border-bottom-right-radius: 3px;
}
.container-fluid form .has-feedback.username .form-control-feedback {
width: 30px;
height: 30px;
background: url("../img/gray_username_icon.png") no-repeat;
background-size: cover;
-webkit-background-size: cover;
top: 15px;
right: 15px;
}
.container-fluid form .has-feedback.password .form-control-feedback {
width: 30px;
height: 30px;
background: url("../img/gray_password_icon.png") no-repeat;
background-size: cover;
-webkit-background-size: cover;
top: 15px;
right: 15px;
}
.container-fluid form .has-feedback.code .form-control {
width: 60%;
}
.container-fluid form .has-feedback.code .form-control-feedback {
top: 6px;
right: 4px;
width: 35%;
height: 46px;
line-height: 46px;
color: #ffffff;
font-size: 16px;
background-color: #0bacd3;
box-shadow: 0 2px 0 0 #088aa9;
-webkit-box-shadow: 0 2px 0 0 #088aa9;
border-top-left-radius: 4px;
border-top-right-radius: 4px;
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
-webkit-border-top-left-radius: 4px;
-webkit-border-top-right-radius: 4px;
-webkit-border-bottom-left-radius: 4px;
-webkit-border-bottom-right-radius: 4px;
pointer-events: auto;
}
.container-fluid form .has-feedback.code .form-control-feedback:active {
background-color: #088aa9;
}
.container-fluid form .btn {
color: #ffffff;
font-weight: bold;
margin: 100px 0 0;
padding: 8px;
background-color: #008cd7;
border-top-left-radius: 4px;
border-top-right-radius: 4px;
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
-webkit-border-top-left-radius: 4px;
-webkit-border-top-right-radius: 4px;
-webkit-border-bottom-left-radius: 4px;
-webkit-border-bottom-right-radius: 4px;
box-shadow: 0 2px 0 0 #117bb9;
-webkit-box-shadow: 0 2px 0 0 #117bb9;
}
.container-fluid form .btn:active {
background-color: #117bb9;
}
.container-fluid form .btn:focus {
outline: 0;
}
.container-fluid form .btn.btn-register {
margin-top: 20%;
}
.container-fluid form a {
display: block;
color: #ffffff;
font-size: 16px;
}
.container-fluid form a span {
width: 30px;
height: 1px;
display: inline-block;
vertical-align: middle;
margin: 0 5px;
background-color: rgba(255, 255, 255, 0.4);
}
.container-fluid form a:active {
color: #636363;
}
.container-fluid form a:active span {
background-color: #636363;
}
.container-fluid form a.link-register {
margin-top: 30%;
padding-bottom: 25px;
}
...@@ -356,31 +356,41 @@ body { ...@@ -356,31 +356,41 @@ body {
a:hover { a:hover {
text-decoration: none; text-decoration: none;
} }
.main { #wrapper {
position: absolute;
z-index: 1;
top: 40px;
bottom: 0;
left: 0;
width: 100%; width: 100%;
padding-bottom: 5%; overflow: hidden;
}
#wrapper #scroller {
padding-bottom: 15px;
} }
.main ul li { #wrapper #scroller ul li {
margin: 0 15px; margin: 0 15px;
padding: 13px 0; height: 60px;
line-height: 60px;
border-bottom: 1px solid #b7b7b7; border-bottom: 1px solid #b7b7b7;
color: #7d7d7d; color: #7d7d7d;
font-size: 18px; font-size: 18px;
overflow: hidden; overflow: hidden;
} }
.main ul li label { #wrapper #scroller ul li label {
margin-bottom: 0; margin-bottom: 0;
padding: 5px 0 0 4px; padding: 0 0 0 4px;
} }
.main ul li p { #wrapper #scroller ul li p {
margin-bottom: 0; margin-bottom: 0;
padding: 0; padding: 0;
height: 100%;
} }
.main ul li p .form-control { #wrapper #scroller ul li p .form-control {
color: #7d7d7d; color: #7d7d7d;
font-size: 18px; font-size: 18px;
background-color: transparent; background-color: transparent;
border-color: transparent; border: 0;
display: inline-block; display: inline-block;
box-shadow: none; box-shadow: none;
-webkit-box-shadow: none; -webkit-box-shadow: none;
...@@ -394,29 +404,34 @@ a:hover { ...@@ -394,29 +404,34 @@ a:hover {
-webkit-border-bottom-right-radius: 0; -webkit-border-bottom-right-radius: 0;
-webkit-appearance: none; -webkit-appearance: none;
} }
.main ul li p .form-control::-webkit-input-placeholder { #wrapper #scroller ul li p .form-control::-webkit-input-placeholder {
color: #7d7d7d; color: #7d7d7d;
} }
.main ul li p .form-control::-webkit-outer-spin-button, #wrapper #scroller ul li p .form-control::-webkit-outer-spin-button,
.main ul li p .form-control::-webkit-inner-spin-button { #wrapper #scroller ul li p .form-control::-webkit-inner-spin-button {
-webkit-appearance: none !important; -webkit-appearance: none !important;
margin: 0; margin: 0;
} }
.main ul li p .form-control.width-sm { #wrapper #scroller ul li p .form-control.width-sm {
width: 45px; width: 36px;
padding: 6px;
} }
.main ul li p textarea.form-control { #wrapper #scroller ul li p textarea.form-control {
resize: none; resize: none;
background-color: #ffffff; background-color: #ffffff;
border-color: #e9e9e9; border: 1px solid #e9e9e9;
} }
.main ul li:last-child { #wrapper #scroller ul li p em {
border-bottom: 0; font-size: 9px;
position: relative;
top: -6px;
font-style: normal;
} }
.main ul li:last-child label { #wrapper #scroller ul li:last-child {
margin-bottom: 18px; height: auto;
border-bottom: 0;
} }
.main .btn { #wrapper #scroller .btn {
width: 86%; width: 86%;
display: block; display: block;
color: #ffffff; color: #ffffff;
...@@ -435,9 +450,9 @@ a:hover { ...@@ -435,9 +450,9 @@ a:hover {
box-shadow: 0 2px 0 0 #117bb9; box-shadow: 0 2px 0 0 #117bb9;
-webkit-box-shadow: 0 2px 0 0 #117bb9; -webkit-box-shadow: 0 2px 0 0 #117bb9;
} }
.main .btn:active { #wrapper #scroller .btn:active {
background-color: #117bb9; background-color: #117bb9;
} }
.main .btn:focus { #wrapper #scroller .btn:focus {
outline: 0; outline: 0;
} }
...@@ -14,10 +14,10 @@ if ($_POST) { ...@@ -14,10 +14,10 @@ if ($_POST) {
} else if (!$password) { } else if (!$password) {
$context['error'] = '请输入新密码'; $context['error'] = '请输入新密码';
} else { } else {
$search_code = dao::search_tospur_verify($phone, $code); $search_code = TospurDao::search_tospur_verify($phone, $code);
if ($code == $search_code) { if ($code == $search_code) {
wp_set_password($password, $user->data->ID); wp_set_password($password, $user->data->ID);
dao::update_tospur_verify($phone); TospurDao::update_tospur_verify($phone);
$context['error'] = '成功修改密码'; $context['error'] = '成功修改密码';
} else { } else {
$context['error'] = '验证码错误'; $context['error'] = '验证码错误';
......
<?php <?php
require_once(dirname(__FILE__) . '/dao.php'); require_once('const.php');
require_once(dirname(__FILE__) . '/../../plugins/tospur/Dao/TospurDao.php');
require_once(dirname(__FILE__) . '/../../plugins/tospur/Dao/SearchDao.php'); require_once(dirname(__FILE__) . '/../../plugins/tospur/Dao/SearchDao.php');
require_once(dirname(__FILE__) . '/../../plugins/tospur/Tools/Image.php'); require_once(dirname(__FILE__) . '/../../plugins/tospur/Tools/Image.php');
...@@ -35,9 +36,6 @@ function page_template($template) ...@@ -35,9 +36,6 @@ function page_template($template)
case 'consultant_list': case 'consultant_list':
$page = $theme . '/consultant_list.php'; $page = $theme . '/consultant_list.php';
break; break;
case 'score':
$page = $theme . '/score.php';
break;
case 'comment': case 'comment':
$page = $theme . '/comment.php'; $page = $theme . '/comment.php';
break; break;
...@@ -53,6 +51,12 @@ function page_template($template) ...@@ -53,6 +51,12 @@ function page_template($template)
case 'loan_calculator': case 'loan_calculator':
$page = $theme . '/loan_calculator.php'; $page = $theme . '/loan_calculator.php';
break; break;
case 'manager':
$page = $theme . '/manager.php';
break;
case 'sale':
$page = $theme . '/sale.php';
break;
} }
return $page; return $page;
} else { } else {
...@@ -85,7 +89,7 @@ function send_code() ...@@ -85,7 +89,7 @@ function send_code()
$array['code'] = 2002; $array['code'] = 2002;
} else { } else {
$code = generate_code(); $code = generate_code();
$insert_result = dao::insert_tospur_verify($phone, strtolower($code)); $insert_result = TospurDao::insert_tospur_verify($phone, strtolower($code));
$response = wp_remote_post('http://218.1.67.130:8988/api/NanTongWechat/MobileSendMessage' . $response = wp_remote_post('http://218.1.67.130:8988/api/NanTongWechat/MobileSendMessage' .
'?mobilePhone=' . $phone . '&VerificationCode=' . $code '?mobilePhone=' . $phone . '&VerificationCode=' . $code
); );
...@@ -114,7 +118,7 @@ function view_house() ...@@ -114,7 +118,7 @@ function view_house()
$date = $_POST['date']; $date = $_POST['date'];
} }
$time = (9 + $index) . ':00-' . (10 + $index) . ':00'; $time = (9 + $index) . ':00-' . (10 + $index) . ':00';
$result = dao::insert_view_house($_POST['house_id'], $_POST['user_id'], $date, $index, $time, $_POST['consultant_id']); $result = TospurDao::insert_view_house($_POST['house_id'], $_POST['user_id'], $date, $index, $time, $_POST['consultant_id']);
$array = array(); $array = array();
if ($result) { if ($result) {
$array['code'] = 2000; $array['code'] = 2000;
...@@ -131,7 +135,7 @@ function handle_view_house() ...@@ -131,7 +135,7 @@ function handle_view_house()
{ {
$id = $_POST['id']; $id = $_POST['id'];
if (isset($id)) { if (isset($id)) {
$result = dao::update_view_house($id); $result = TospurDao::update_view_house($id);
$array = array(); $array = array();
if ($result) { if ($result) {
$array['code'] = 2000; $array['code'] = 2000;
...@@ -147,12 +151,18 @@ add_action('wp_ajax_add_score', 'add_consultant_score'); ...@@ -147,12 +151,18 @@ add_action('wp_ajax_add_score', 'add_consultant_score');
function add_consultant_score() function add_consultant_score()
{ {
if (isset($_POST['score'])) { if (isset($_POST['score'])) {
$result = dao::insert_consultant_score($_POST['consultant_id'], $_POST['user_id'], $_POST['score']); $type = TospurDao::search_score_type($_POST['user_id'], $_POST['consultant_id']);
$result = null;
if ($type) {
$result = TospurDao::insert_consultant_score($_POST['consultant_id'], $_POST['user_id'], $_POST['score']);
}
$array = array(); $array = array();
if ($result) { if ($type && $result) {
$array['code'] = 2000; $array['code'] = 2000;
} else { } else if(!$type){
$array['code'] = 2001; $array['code'] = 2001;
} else if(!$result){
$array['code'] = 2002;
} }
wp_send_json($array); wp_send_json($array);
} }
...@@ -161,14 +171,14 @@ function add_consultant_score() ...@@ -161,14 +171,14 @@ function add_consultant_score()
//置业顾问信息 //置业顾问信息
function get_consultant_info($consultant_id) function get_consultant_info($consultant_id)
{ {
return dao::search_consultant_info($consultant_id); return TospurDao::search_consultant_info($consultant_id);
} }
add_action('wp_ajax_get_consultant', 'get_consultant'); add_action('wp_ajax_get_consultant', 'get_consultant');
function get_consultant() function get_consultant()
{ {
if (isset($_POST['city_id']) && isset($_POST['index'])) { if (isset($_POST['city_id']) && isset($_POST['index'])) {
$result = dao::search_consultant_by_city($_POST['city_id'], $_POST['index']); $result = TospurDao::search_consultant_by_city($_POST['city_id'], $_POST['index']);
$array = array(); $array = array();
if ($result) { if ($result) {
$array['code'] = 2000; $array['code'] = 2000;
...@@ -224,7 +234,7 @@ function add_collect($house_id) ...@@ -224,7 +234,7 @@ function add_collect($house_id)
add_filter('login_redirect', 'new_login_redirect', 10, 3); add_filter('login_redirect', 'new_login_redirect', 10, 3);
function new_login_redirect($redirect_to, $request, $user) function new_login_redirect($redirect_to, $request, $user)
{ {
if ($user - ID > 0) { if ($user->ID > 0) {
$role = $user->roles[0]; $role = $user->roles[0];
if ($role == 'administrator' || $role == 'editor') { if ($role == 'administrator' || $role == 'editor') {
return admin_url('admin.php?page=newHouseList'); return admin_url('admin.php?page=newHouseList');
...@@ -236,4 +246,44 @@ function new_login_redirect($redirect_to, $request, $user) ...@@ -236,4 +246,44 @@ function new_login_redirect($redirect_to, $request, $user)
} }
} }
add_action('wp_logout', 'auto_redirect_after_logout');
function auto_redirect_after_logout()
{
header('Location: ' . home_url('/?page=manager'));
exit;
}
add_filter('login_url', 'my_login_page', 10, 2);
function my_login_page($login_url, $redirect)
{
return home_url('/?page=manager&redirect_to=' . $redirect);
}
function user_redirect($user)
{
$url = null;
if ($user->ID > 0) {
$role = $user->roles[0];
if ($role == 'administrator' || $role == 'editor') {
$url = admin_url('admin.php?page=newHouseList');
} else {
$url = site_url();
}
header('Location:' . $url);
}
}
add_action('wp_ajax_submit_sale', 'submit_sale');
function submit_sale()
{
$array = array('code' => 2001);
if ($_POST) {
$result = TospurDao::insert_tospur_sale($_POST);
if ($result) {
$array['code'] = 2000;
}
}
wp_send_json($array);
}
?> ?>
\ No newline at end of file
<?php <?php
require_once(dirname(__FILE__) . '/dao.php');
$context = array(); $context = array();
$context['theme'] = get_template_directory_uri(); $context['theme'] = get_template_directory_uri();
$context['url'] = home_url(); $context['url'] = home_url();
...@@ -12,10 +11,10 @@ if ($current_user_id != 0) { ...@@ -12,10 +11,10 @@ if ($current_user_id != 0) {
$result = null; $result = null;
switch ($role) { switch ($role) {
case 'subscriber': case 'subscriber':
$result = dao::search_view_house_by_user_id($current_user_id); $result = TospurDao::search_view_house_by_user_id($current_user_id);
break; break;
case 'editor': case 'editor':
$result = dao::search_view_house_by_consultant_id($current_user_id); $result = TospurDao::search_view_house_by_consultant_id($current_user_id);
break; break;
} }
if ($result) { if ($result) {
......
<?php
$context = array();
$context['theme'] = get_template_directory_uri();
if (is_user_logged_in()) {
$user = wp_get_current_user();
user_redirect($user);
} else {
if ($_POST) {
$phone = $_POST['phone'];
$password = $_POST['password'];
if (!$phone) {
$context['error'] = '请输入用户名';
} else if (!$password) {
$context['error'] = '请输入密码';
} else {
if (strlen($phone) != 11 && $phone != 'admin') {
$response = wp_remote_post('http://218.1.67.130:8988/api/NanTongWechat/LoginWechat' .
'?userName=' . $phone . '&password=' . $password
);
$body = json_decode($response['body']);
$data = $body->data;
if ($data) {
$password = $data->WorkNoAndId;
}
}
$creds['user_login'] = $phone;
$creds['user_password'] = $password;
$creds['remember'] = true;
$user = wp_signon($creds, false);
if (!is_wp_error($user)) {
user_redirect($user);
} else if ($user->get_error_code() == 'invalid_username') {
$context['error'] = '此帐号尚未注册';
} else if ($user->get_error_code() == 'incorrect_password') {
$context['error'] = '您输入的密码有误';
}
}
}
Timber::render('manager.html', $context);
}
?>
\ No newline at end of file
<?php <?php
require_once('const.php');
$context = array(); $context = array();
$context['theme'] = get_template_directory_uri(); $context['theme'] = get_template_directory_uri();
......
...@@ -15,11 +15,11 @@ if ($_POST) { ...@@ -15,11 +15,11 @@ if ($_POST) {
} else if (!$password) { } else if (!$password) {
$context['error'] = '请输入密码'; $context['error'] = '请输入密码';
} else { } else {
$search_code = dao::search_tospur_verify($phone, $code); $search_code = TospurDao::search_tospur_verify($phone, $code);
if ($code == $search_code) { if ($code == $search_code) {
$result = wp_create_user($phone, $password); $result = wp_create_user($phone, $password);
if (is_integer($result)) { if (is_integer($result)) {
dao::update_tospur_verify($phone); TospurDao::update_tospur_verify($phone);
$creds['user_login'] = $phone; $creds['user_login'] = $phone;
$creds['user_password'] = $password; $creds['user_password'] = $password;
$creds['remember'] = true; $creds['remember'] = true;
......
<?php
$context = array();
$context['theme'] = get_template_directory_uri();
$context['url'] = home_url();
$current_user = wp_get_current_user();
$user_id = $current_user->ID;
if ($user_id != 0) {
$context['user_id'] = $user_id;
$context['consultant_id'] = $_GET['consultant_id'];
}
Timber::render('score.html', $context);
?>
\ No newline at end of file
...@@ -6,14 +6,6 @@ $context['url'] = home_url(); ...@@ -6,14 +6,6 @@ $context['url'] = home_url();
$current_user = wp_get_current_user(); $current_user = wp_get_current_user();
$user_id = $current_user->ID; $user_id = $current_user->ID;
if ($user_id != 0) { if ($user_id != 0) {
$date = current_time('Y-m-d');
$datetime = new DateTime($cureent_time . '+1 day');
$date = $datetime->format('Y-m-d');
$context['data'] = array(
'jt' => $date,
'mt' => new DateTime($date . '+1 day'),
'ht' => $date
);
$context['user_id'] = $user_id; $context['user_id'] = $user_id;
$context['house_id'] = $_GET['house_id']; $context['house_id'] = $_GET['house_id'];
$context['consultant_id'] = $_GET['consultant_id']; $context['consultant_id'] = $_GET['consultant_id'];
...@@ -23,5 +15,4 @@ if ($user_id != 0) { ...@@ -23,5 +15,4 @@ if ($user_id != 0) {
exit; exit;
} }
?> ?>
\ No newline at end of file
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<html> <html>
<head lang="en"> <head lang="en">
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/> <meta name="viewport" content="width=360, user-scalable=0"/>
<meta name="apple-mobile-web-app-capable" content="yes"/> <meta name="apple-mobile-web-app-capable" content="yes"/>
<meta name="apple-mobile-web-app-status-bar-style" content="black"/> <meta name="apple-mobile-web-app-status-bar-style" content="black"/>
<title>信息反馈</title> <title>信息反馈</title>
......
...@@ -32,9 +32,6 @@ ...@@ -32,9 +32,6 @@
</div> </div>
<p>同策房屋</p> <p>同策房屋</p>
</li> </li>
<li class="col-xs-3">
<a class="btn btn-block" data-toggle="modal" data-target="#scoreDiv">评分</a>
</li>
</ul> </ul>
<h4>诚信宣言</h4> <h4>诚信宣言</h4>
<div id="people_wrapper"> <div id="people_wrapper">
...@@ -63,9 +60,14 @@ ...@@ -63,9 +60,14 @@
</div> </div>
</div> </div>
<footer class="footer navbar-fixed-bottom"> <footer class="footer navbar-fixed-bottom">
<a href="tel:{{ consultant_mobile }}" class="btn btn-phone"> <div class="btn-group btn-group-justified">
<span></span>电话联系 <a href="tel:{{ consultant_mobile }}" class="btn btn-phone">
</a> <span></span>电话联系
</a>
<a data-toggle="modal" data-target="#scoreDiv" class="btn btn-phone">
评分
</a>
</div>
</footer> </footer>
<div class="loading" id="loading" style="display: none;"> <div class="loading" id="loading" style="display: none;">
<ul class="list-unstyled"> <ul class="list-unstyled">
...@@ -184,10 +186,18 @@ ...@@ -184,10 +186,18 @@
url: '{{ url }}/wp-admin/admin-ajax.php/', url: '{{ url }}/wp-admin/admin-ajax.php/',
data: 'action=add_score&user_id={{user_id}}&consultant_id={{consultant_id}}&score='+$("#score").val(), data: 'action=add_score&user_id={{user_id}}&consultant_id={{consultant_id}}&score='+$("#score").val(),
success: function (data) { success: function (data) {
if (data.code == 2000) { switch (data.code){
alert('评分成功'); case 2000:
}else{ alert('评分成功');
alert('您已经提交过评分了'); break;
case 2001:
alert('未和置业顾问接触过,不能评分');
break;
case 2002:
alert('您已经提交过评分了');
break;
default:
break;
} }
}, },
complete:function(){ complete:function(){
......
...@@ -274,10 +274,10 @@ ...@@ -274,10 +274,10 @@
{% else %} {% else %}
<a href="tel:{{item.mobile}}" class="btn btn-xs btn-phone"> <a href="tel:{{item.mobile}}" class="btn btn-xs btn-phone">
{% endif %} {% endif %}
<span></span>电话联系 <span></span>电话
</a> </a>
<a href="{{siteUrl}}?page=view&house_id={{hid}}&consultant_id={{item.id}}" class="btn btn-xs btn-booking"> <a href="{{siteUrl}}?page=view&house_id={{hid}}&consultant_id={{item.id}}" class="btn btn-xs btn-booking">
<span></span>一键预约 <span></span>预约
</a> </a>
</ol> </ol>
</li> </li>
......
...@@ -62,6 +62,9 @@ ...@@ -62,6 +62,9 @@
notice.html('<span>{{ error }}</span>'); notice.html('<span>{{ error }}</span>');
myModal.modal('show'); myModal.modal('show');
{% endif %} {% endif %}
document.addEventListener('touchmove', function(e){
e.preventDefault();
});
}); });
</script> </script>
</head> </head>
......
...@@ -45,6 +45,9 @@ ...@@ -45,6 +45,9 @@
notice.html('<span>{{ error }}</span>'); notice.html('<span>{{ error }}</span>');
myModal.modal('show'); myModal.modal('show');
{% endif %} {% endif %}
document.addEventListener('touchmove', function(e){
e.preventDefault();
});
}); });
</script> </script>
</head> </head>
......
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<meta name="viewport" content="width=360, user-scalable=0"/>
<meta name="apple-mobile-web-app-capable" content="yes"/>
<meta name="apple-mobile-web-app-status-bar-style" content="black"/>
<title>登录</title>
<link rel="stylesheet" type="text/css" href="{{ theme }}/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="{{ theme }}/css/manager.css">
<script src="{{ theme }}/js/jquery.min.js"></script>
<script src="{{ theme }}/js/jquery.validate.js"></script>
<script src="{{ theme }}/js/bootstrap.min.js"></script>
<script>
$(document).ready(function () {
var notice = $('#notice');
var myModal = $('#myModal');
$('#loginForm').validate({
onkeyup: false,
onfocusout: false,
rules: {
phone: 'required',
password: 'required'
},
messages: {
phone: '请输入用户名',
password: '请输入密码'
},
errorLabelContainer: "#notice",
errorElement: 'span',
invalidHandler: function () {
myModal.modal('show');
},
submitHandler: function (form) {
form.submit();
}
});
notice.bind('DOMNodeInserted',function(){
$(this).children(':not(:first)').remove();
});
myModal.on('hide.bs.modal',function(){
notice.children().remove();
});
{% if(error) %}
notice.html('<span>{{ error }}</span>');
myModal.modal('show');
{% endif %}
});
</script>
</head>
<body>
<div class="container-fluid text-center">
<form id="loginForm" method="post">
<h2></h2>
<p class="has-feedback username">
<label for="phone" class="sr-only">用户名</label>
<input type="tel" name="phone" id="phone" class="form-control input-lg" placeholder="账号">
<span class="form-control-feedback"></span>
</p>
<p class="has-feedback password">
<label for="password" class="sr-only">密码</label>
<input type="password" name="password" id="password" class="form-control input-lg" placeholder="密码">
<span class="form-control-feedback"></span>
</p>
<input type="submit" id="login_submit" value="登录" class="btn btn-lg btn-block">
</form>
</div>
<div class="modal fade" id="myModal">
<div class="modal-dialog">
<div class="modal-content text-center">
<h4>提示</h4>
<p id="notice"></p>
<button type="button" class="btn btn-lg btn-block" data-dismiss="modal">确认</button>
</div>
</div>
</div>
</body>
</html>
\ No newline at end of file
...@@ -62,6 +62,9 @@ ...@@ -62,6 +62,9 @@
notice.html('<span>{{ error }}</span>'); notice.html('<span>{{ error }}</span>');
myModal.modal('show'); myModal.modal('show');
{% endif %} {% endif %}
document.addEventListener('touchmove', function(e){
e.preventDefault();
});
}); });
</script> </script>
</head> </head>
......
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<meta name="viewport" content="width=360, user-scalable=0"/>
<meta name="apple-mobile-web-app-capable" content="yes"/>
<meta name="apple-mobile-web-app-status-bar-style" content="black"/>
<title></title>
<style></style>
<link rel="stylesheet" href="{{ theme }}/css/bootstrap.min.css">
<link rel="stylesheet" href="{{ theme }}/css/star-rating.min.css">
<script src="{{ theme }}/js/jquery.min.js"></script>
<script src="{{ theme }}/js/star-rating.min.js"></script>
<script>
$(document).ready(function () {
var score = 0;
$('#score').rating({
min: 0,
max: 5,
step: 0.5,
size: 'xs',
showClear: false,
showCaption: false,
hoverEnabled: false,
starCaptions: function (data) {
console.log(data);
score = data;
$(this).val(score);
}
});
var scoreForm = $('#scoreForm');
scoreForm.submit(function () {
if (score > 0) {
$.ajax({
type: 'POST',
url: '{{ url }}/wp-admin/admin-ajax.php/',
data: 'action=add_score&' + scoreForm.serialize(),
success: function (data) {
if (data.code == 2000) {
alert('评分成功');
}else{
alert('不能重复评分');
}
}
});
} else {
alert('请选择评分');
}
return false;
});
});
</script>
</head>
<body>
<form id="scoreForm" method="post">
<br>
<label for="score">评分</label>
<input type="hidden" id="score" name="score" value="0">
<input type="hidden" name="user_id" value="{{ user_id }}">
<input type="hidden" name="consultant_id" value="{{ consultant_id }}">
<br>
<p class="submit">
<input type="submit" id="score_submit" value="提交">
</p>
</form>
</body>
</html>
\ No newline at end of file
...@@ -59,6 +59,9 @@ ...@@ -59,6 +59,9 @@
} }
return false; return false;
}); });
document.addEventListener('touchmove', function(e){
e.preventDefault();
});
}); });
</script> </script>
</head> </head>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment