Commit 9af48fab by felix

每日一更

parent 5a0a2ded
...@@ -66,90 +66,97 @@ class House { ...@@ -66,90 +66,97 @@ class House {
$houseid = $wpdb->insert_id; $houseid = $wpdb->insert_id;
} }
//主力房源的图片与房子信息关联插入数据库 //主力房源的图片与房子信息关联插入数据库
foreach($uploadedfile["name"] as $key=> $value) { if(isset($uploadedfile["name"])){
$uploadParam = array( foreach($uploadedfile["name"] as $key=> $value) {
"name" => $uploadedfile["name"][$key], $uploadParam = array(
"type" => $uploadedfile["type"][$key], "name" => $uploadedfile["name"][$key],
"tmp_name" => $uploadedfile["tmp_name"][$key], "type" => $uploadedfile["type"][$key],
"error" => $uploadedfile["error"][$key], "tmp_name" => $uploadedfile["tmp_name"][$key],
"size" => $uploadedfile["size"][$key] "error" => $uploadedfile["error"][$key],
); "size" => $uploadedfile["size"][$key]
//因为file提交过来有一个空的数组,所以这里判断在filename不为空的情况下,再做后续操作 );
if ($uploadParam["name"] != "") { //因为file提交过来有一个空的数组,所以这里判断在filename不为空的情况下,再做后续操作
//上传图片 if ($uploadParam["name"] != "") {
if (!function_exists('wp_handle_upload')) { //上传图片
require_once(ABSPATH . 'wp-admin/includes/file.php'); if (!function_exists('wp_handle_upload')) {
} require_once(ABSPATH . 'wp-admin/includes/file.php');
$overrides = array('test_form' => false);
$movefile = wp_handle_upload($uploadParam, $overrides);
$str = preg_replace('#^https?://#', '', $movefile["url"]);
$length = strpos($str, "/",strpos($str, "/")+1);
$url = substr($str,$length);
if ($movefile && !isset($movefile['error'])) {
//上传成功后将图片信息存入tospur_image表
$insert_image_array = array(
'name' => $uploadParam["name"],
'path' => $url,
'creattime' => date("Y-m-d H:i:s"),
'alt' => "",
'image_type' =>$data[$key]["type"]
);
//插入图片表
$imgRes = $wpdb->insert('tospur_image', $insert_image_array);
if (!$imgRes) {
return 501;
} }
//获取插入图片的id $overrides = array('test_form' => false);
$imgid = $wpdb->insert_id; $movefile = wp_handle_upload($uploadParam, $overrides);
//房源类型、面积与图片关联表 $str = preg_replace('#^https?://#', '', $movefile["url"]);
if($data[$key]["type"] == "0"){ $length = strpos($str, "/",strpos($str, "/")+1);
$houseTypeArea = array( $url = substr($str,$length);
if ($movefile && !isset($movefile['error'])) {
//上传成功后将图片信息存入tospur_image表
$insert_image_array = array(
'name' => $uploadParam["name"],
'path' => $url,
'creattime' => date("Y-m-d H:i:s"),
'alt' => "",
'image_type' =>$data[$key]["type"]
);
//插入图片表
$imgRes = $wpdb->insert('tospur_image', $insert_image_array);
if (!$imgRes) {
return 501;
}
//获取插入图片的id
$imgid = $wpdb->insert_id;
//房源类型、面积与图片关联表
if($data[$key]["type"] == "0"){
$houseTypeArea = array(
'house_id' => $houseid,
"buildproperty_id" => $data["$key"]["buildProperty"],
"house_area" => $data["$key"]["housearea"],
"image_id" => $imgid
);
$houseTypeAreaRes = $wpdb->insert('a_district_area', $houseTypeArea);
if (!$houseTypeAreaRes) {
return 502;
}
}
//将房源id与图片id储存到关联表中
$house_img_array = array(
'house_id' => $houseid, 'house_id' => $houseid,
"buildproperty_id" => $data["$key"]["buildProperty"], 'image_id' => $imgid,
"house_area" => $data["$key"]["housearea"],
"image_id" => $imgid
); );
$houseTypeAreaRes = $wpdb->insert('a_district_area', $houseTypeArea); $houseImgRes = $wpdb->insert('a_house_image', $house_img_array);
if (!$houseTypeAreaRes) { if (!$houseImgRes) {
return 502; return 503;
} }
} else {
return $movefile['error'];
} }
//将房源id与图片id储存到关联表中
$house_img_array = array(
'house_id' => $houseid,
'image_id' => $imgid,
);
$houseImgRes = $wpdb->insert('a_house_image', $house_img_array);
if (!$houseImgRes) {
return 503;
}
} else {
return $movefile['error'];
} }
} }
} }
//插入推荐房源id与添加新房id到关联表a_house_recommend if(isset($data["recommend"])){
foreach($data["recommend"] as $value){ //插入推荐房源id与添加新房id到关联表a_house_recommend
$a_house_recommendArray = array( foreach($data["recommend"] as $value){
"house_id" => $houseid, $a_house_recommendArray = array(
"recommend_id" =>$value "house_id" => $houseid,
); "recommend_id" =>$value
$a_house_recommendRes = $wpdb->insert('a_house_recommend', $a_house_recommendArray); );
if(!$a_house_recommendRes){ $a_house_recommendRes = $wpdb->insert('a_house_recommend', $a_house_recommendArray);
return 504; if(!$a_house_recommendRes){
return 504;
}
} }
} }
//插入推荐置业顾问user_id与新房id到关联表a_house_recommend
foreach($data["recConsultant"] as $val){ if($data["recConsultant"]){
$a_house_userArray = array( //插入推荐置业顾问user_id与新房id到关联表a_house_recommend
"user_id" => $val, foreach($data["recConsultant"] as $val){
"house_id" => $houseid, $a_house_userArray = array(
"user_type" =>1 "user_id" => $val,
); "house_id" => $houseid,
$a_house_userRes = $wpdb->insert('a_house_user', $a_house_userArray); "user_type" =>1
if(!$a_house_userRes){ );
return 505; $a_house_userRes = $wpdb->insert('a_house_user', $a_house_userArray);
if(!$a_house_userRes){
return 505;
}
} }
} }
} }
......
...@@ -377,7 +377,7 @@ ...@@ -377,7 +377,7 @@
var file = $("<input>").attr({"type":"file","name":"files["+i+"]"}).addClass("picFiles"); var file = $("<input>").attr({"type":"file","name":"files["+i+"]"}).addClass("picFiles");
var select = $("<select>").attr("name","data["+i+"][type]"); var select = $("<select>").attr("name","data["+i+"][type]");
{% for item in photoType %} {% for item in photoType %}
select.append($("<option>").attr("value",{{item.id}}).append('{{item.photoType}}')); select.append($("<option>").attr("value",{{item.id}}).append('{{item.value}}'));
{% endfor%} {% endfor%}
var p = $("<p>").append(select).append(file).append(picDelet); var p = $("<p>").append(select).append(file).append(picDelet);
$("#picList").append(p); $("#picList").append(p);
...@@ -413,7 +413,7 @@ ...@@ -413,7 +413,7 @@
var type = $("<input>").attr({"type":"hidden","name":"data["+i+"][type]","value":0,"property":+i}); 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 file = $("<input>").attr({"type":"file","name":"files["+(i+1)+"]","property":+(i+1)}).addClass("files");
var select = $("<select>").attr({"name":"data["+i+"][buildProperty]"}); var select = $("<select>").attr({"name":"data["+i+"][buildProperty]"});
{% for item in buildProperty %} {% for item in buildProperty %}{{item.id}}
select.append($("<option>").attr("value",{{item.id}}).append('{{item.value}}')); select.append($("<option>").attr("value",{{item.id}}).append('{{item.value}}'));
{% endfor%} {% endfor%}
var areatext = $("<input>").attr({"type":"text","placeholder":"面积","name":"data["+i+"][housearea]"}).addClass("regular-text"); var areatext = $("<input>").attr({"type":"text","placeholder":"面积","name":"data["+i+"][housearea]"}).addClass("regular-text");
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
class Config { class Config {
//table name //table name
const A_DISTRICT_AREA_TABLE = 'a_district_area';
const DIC_CITY_TABLE = 'dic_city'; const DIC_CITY_TABLE = 'dic_city';
const DIC_ROOM_TABLE = 'dic_room'; const DIC_ROOM_TABLE = 'dic_room';
const DIC_BUILDPROPERTY_TABLE = 'dic_buildproperty'; const DIC_BUILDPROPERTY_TABLE = 'dic_buildproperty';
...@@ -12,6 +13,7 @@ class Config { ...@@ -12,6 +13,7 @@ class Config {
const TOSPUR_ORGANIZATION_TABLE = 'tospur_organization'; const TOSPUR_ORGANIZATION_TABLE = 'tospur_organization';
const TOSPUR_CONSULTANT = 'tospur_consultant'; const TOSPUR_CONSULTANT = 'tospur_consultant';
const TOSPUR_HOUSE_TABLE = 'tospur_house'; const TOSPUR_HOUSE_TABLE = 'tospur_house';
const TOSPUR_IMAGE_TABLE = 'tospur_image';
//sync url //sync url
......
<?php <?php
class dao define('tospur_view_house_table', 'tospur_view_house');
{
//insert 预约看房 class dao
public static function insert_view_house($house_id, $user_id, $date, $index, $time, $consultant_id) {
{ //insert 预约看房
$insert_view_house_array = array( public static function insert_view_house($house_id, $user_id, $date, $index, $time, $consultant_id)
'house_id' => $house_id, {
'user_id' => $user_id, $insert_view_house_array = array(
'date' => $date, 'house_id' => $house_id,
'time_index' => $index, 'user_id' => $user_id,
'time' => $time, 'date' => $date,
'consultant_id' => $consultant_id, 'time_index' => $index,
'handle' => 0 'time' => $time,
); 'consultant_id' => $consultant_id,
global $wpdb; 'handle' => 0
$result = $wpdb->insert('view_house', $insert_view_house_array); );
return $result; global $wpdb;
} $result = $wpdb->insert(tospur_view_house_table, $insert_view_house_array);
return $result;
public static function update_view_house($id) }
{
global $wpdb; public static function update_view_house($id)
$result = $wpdb->update('view_house', array( {
'handle' => 1, global $wpdb;
'handle_date' => current_time('Y-m-d H:i:s') $result = $wpdb->update(tospur_view_house_table, array(
), array( 'handle' => 1,
'id' => $id 'handle_date' => current_time('Y-m-d H:i:s')
)); ), array(
return $result; 'id' => $id
} ));
return $result;
public static function update_view_house_consultant($house_id, $consultant_id) }
{
global $wpdb; public static function update_view_house_consultant($house_id, $consultant_id)
$result = $wpdb->update('view_house', array( {
'consultant_id' => $consultant_id global $wpdb;
), array( $result = $wpdb->update(tospur_view_house_table, array(
'id' => $house_id 'consultant_id' => $consultant_id
)); ), array(
return $result; 'id' => $house_id
} ));
return $result;
//search 预约看房 user_id }
public static function search_view_house_by_user_id($user_id)
{ //search 预约看房 user_id
global $wpdb; public static function search_view_house_by_user_id($user_id)
$sql = "select v.house_id,v.date,v.time,v.consultant_id,v.handle from view_house v where user_id = " . $user_id . " order by v.date desc"; {
return $wpdb->get_results($sql); global $wpdb;
} $sql = "select v.house_id,v.date,v.time,v.consultant_id,v.handle from " . tospur_view_house_table . " v where 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)
{ //search 预约看房 consultant_id
global $wpdb; public static function search_view_house_by_consultant_id($consultant_id)
$sql = "select v.id,v.house_id,v.user_id,v.date,v.time,v.handle from view_house v where consultant_id = " . $consultant_id . " order by v.date desc"; {
return $wpdb->get_results($sql); global $wpdb;
} $sql = "select v.id,v.house_id,v.user_id,v.date,v.time,v.handle from " . tospur_view_house_table . " v where 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 置业顾问评分
$insert_consultant_score_array = array( public static function insert_consultant_score($consultant_id, $user_id, $score, $valid = 1)
'consultant_id' => $consultant_id, {
'user_id' => $user_id, $insert_consultant_score_array = array(
'score' => $score, 'consultant_id' => $consultant_id,
'valid' => $valid 'user_id' => $user_id,
); 'score' => $score,
global $wpdb; 'valid' => $valid
$result = $wpdb->insert('tospur_consultant_score', $insert_consultant_score_array); );
return $result; global $wpdb;
} $result = $wpdb->insert('tospur_consultant_score', $insert_consultant_score_array);
return $result;
//search 置业顾问评分 }
public static function search_consultant_score($consultant_id)
{ //search 置业顾问评分
global $wpdb; public static function search_consultant_score($consultant_id)
$sql = "select sum(score)/count(score) as average_score from tospur_consultant_score where consultant_id = " . $consultant_id . " and valid = 1;"; {
return $wpdb->get_var($sql); global $wpdb;
} $sql = "select sum(score)/count(score) as average_score from tospur_consultant_score where consultant_id = " . $consultant_id . " and valid = 1;";
return $wpdb->get_var($sql);
public static function update_consultant_score($score_id, $valid) }
{
global $wpdb; public static function update_consultant_score($score_id, $valid)
$result = $wpdb->update('tospur_consultant_score', array( {
'valid' => $valid global $wpdb;
), array( $result = $wpdb->update('tospur_consultant_score', array(
'id' => $score_id 'valid' => $valid
)); ), array(
return $result; 'id' => $score_id
} ));
return $result;
public static function search_tospur_verify($phone, $code) }
{
global $wpdb; public static function search_tospur_verify($phone, $code)
$sql = "select code from tospur_verify where phone = " . $phone . " and status = 0 " . {
"and create_time > NOW() - INTERVAL 30 MINUTE " . global $wpdb;
"order by create_time desc limit 1"; $sql = "select code from tospur_verify where phone = " . $phone . " and status = 0 " .
return $wpdb->get_var($sql); "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( public static function insert_tospur_verify($phone, $code)
'phone' => $phone, {
'code' => $code, $insert_tospur_verify_array = array(
'create_time' => current_time('Y-m-d H:i:s'), 'phone' => $phone,
'status' => 0 'code' => $code,
); 'create_time' => current_time('Y-m-d H:i:s'),
global $wpdb; 'status' => 0
$result = $wpdb->insert('tospur_verify', $insert_tospur_verify_array); );
return $result; global $wpdb;
} $result = $wpdb->insert('tospur_verify', $insert_tospur_verify_array);
return $result;
public static function update_tospur_verify($phone) }
{
global $wpdb; public static function update_tospur_verify($phone)
$wpdb->update('tospur_verify', array( {
'status' => 1 global $wpdb;
), array( $wpdb->update('tospur_verify', array(
'phone' => $phone '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 tospur_consultant c ' .
'left join wp_users u on c.id = u.ID ' .
'left join (select consultant_id,sum(score)/count(score) as average_score from tospur_consultant_score 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 search_house_image($house_ids)
{
$sql = 'select ahi.house_id,ti.path from a_house_image ahi' .
' left join tospur_image ti on ahi.image_id = ti.id' .
' where ti.image_type in (1,5) and house_id in ' . $house_ids . ' group by house_id';
global $wpdb;
return $wpdb->get_results($sql);
}
public static function search_house_tag($house_ids)
{
$sql = 'select aht.house_id,tt.name from a_house_tag aht' .
' left join tospur_tag tt on aht.tag_id = tt.id' .
' where house_id in ' . $house_ids;
global $wpdb;
return $wpdb->get_results($sql);
}
}
?> ?>
\ No newline at end of file
...@@ -2,12 +2,46 @@ ...@@ -2,12 +2,46 @@
require_once(WP_PLUGIN_DIR."/tospur/Config.php"); require_once(WP_PLUGIN_DIR."/tospur/Config.php");
$context = array(); $context = array();
$context['theme'] = get_template_directory_uri(); $context['theme'] = get_template_directory_uri();
$context['siteUrl'] = get_site_url();
if(isset($_GET['hid'])){ if(isset($_GET['hid'])){
$hid = $_GET['hid']; $hid = $_GET['hid'];
$context['hid'] = $hid;
$sql = "select * from ".Config::TOSPUR_HOUSE_TABLE." where id = %d"; $sql = "select * from ".Config::TOSPUR_HOUSE_TABLE." where id = %d";
$result = $wpdb->get_row($wpdb->prepare($sql,$hid)); $result = $wpdb->get_row($wpdb->prepare($sql,$hid));
$context['result'] = $result; $context['result'] = $result;
$context['cityName'] = SearchDao::getCityNameWithId($result->city_id);
$mainImagesSql = "SELECT db.literal as type,ada.house_area as area,ti.path FROM ".Config::A_DISTRICT_AREA_TABLE." ada
LEFT JOIN ".Config::DIC_BUILDPROPERTY_TABLE." db on db.value = ada.buildproperty_id
LEFT JOIN ".Config::TOSPUR_IMAGE_TABLE." ti on ti.id = ada.image_id
where ada.house_id = %d";
$mainImage = $wpdb->get_results($wpdb->prepare($mainImagesSql,$hid));
$context['mainImage'] = $mainImage;
$recommendSql = "select ahi.house_id as id,ti.path from a_house_image ahi
left join tospur_image ti on ahi.image_id = ti.id
where ti.image_type in (1,5) and house_id
in (select recommend_id from a_house_recommend where house_id = %d) group by house_id";
$recommends = $wpdb->get_results($wpdb->prepare($recommendSql,$hid));
$context['recommends'] = $recommends;
$consultantSql = 'select id,name,mobile,imageUrl,s.average_score from tospur_consultant c
LEFT JOIN (select consultant_id,sum(score)/count(score) as average_score
from tospur_consultant_score
where valid=1 group by consultant_id) s on c.id = s.consultant_id
where id in(select user_id from a_house_user where user_type = 1 and house_id = %d);';
$consultant = $wpdb->get_results($wpdb->prepare($consultantSql,$hid));
$context['consultant'] = $consultant;
$imagesSql = 'select * from tospur_image ti
LEFT JOIN a_house_image ahi on ti.id = ahi.image_id
WHERE ahi.house_id = %d order by image_type;';
$images = $wpdb->get_results($wpdb->prepare($imagesSql,$hid));
$context['images'] = $images;
Timber::render('detail.html', $context); Timber::render('detail.html', $context);
}else{ }else{
Timber::render('error.html', $context); Timber::render('error.html', $context);
......
...@@ -35,6 +35,9 @@ function page_template($template) ...@@ -35,6 +35,9 @@ function page_template($template)
case 'detail': case 'detail':
$page = $theme . '/detail.php'; $page = $theme . '/detail.php';
break; break;
case 'map':
$page = $theme . '/map.php';
break;
default: default:
$page = $template; $page = $template;
break; break;
...@@ -97,6 +100,7 @@ function view_house() ...@@ -97,6 +100,7 @@ function view_house()
} }
$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 = dao::insert_view_house($_POST['house_id'], $_POST['user_id'], $date, $index, $time, $_POST['consultant_id']);
print_r($result);
$array = array(); $array = array();
if ($result) { if ($result) {
$array['code'] = 2000; $array['code'] = 2000;
...@@ -146,4 +150,23 @@ function get_consultant_score($consultant_id) ...@@ -146,4 +150,23 @@ function get_consultant_score($consultant_id)
return dao::search_consultant_score($consultant_id); return dao::search_consultant_score($consultant_id);
} }
add_action('wp_ajax_add_collect', 'add_collect');
function add_collect($house_id){
$insert_a_house_user_array = array(
'user_id' => get_current_user_id(),
'house_id' => $_POST["hid"],
'user_type' => 0
);
global $wpdb;
$result = $wpdb->insert('a_house_user', $insert_a_house_user_array);
$array = array();
if ($result) {
$array['code'] = 2000;
} else {
$array['code'] = 2001;
}
wp_send_json($array);
}
?> ?>
\ No newline at end of file
wp-content/themes/tospur/img/star.png

5.61 KB | W: | H:

wp-content/themes/tospur/img/star.png

7.18 KB | W: | H:

wp-content/themes/tospur/img/star.png
wp-content/themes/tospur/img/star.png
wp-content/themes/tospur/img/star.png
wp-content/themes/tospur/img/star.png
  • 2-up
  • Swipe
  • Onion skin
<?php
require_once(WP_PLUGIN_DIR."/tospur/Config.php");
$context = array();
$context['theme'] = get_template_directory_uri();
$context['siteUrl'] = get_site_url();
$context['address'] = $_GET['a'];
$context['city'] = $_GET['c'];
$context['point'] = $_GET['p'];
$context['houseName'] = $_GET['hn'];
Timber::render('map.html', $context);
?>
\ No newline at end of file
...@@ -6,7 +6,8 @@ $context['url'] = home_url(); ...@@ -6,7 +6,8 @@ $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) {
wp_redirect(get_site_url()."?page=login");
exit;
}else{ }else{
$date = current_time('Y-m-d'); $date = current_time('Y-m-d');
$datetime = new DateTime($cureent_time . '+1 day'); $datetime = new DateTime($cureent_time . '+1 day');
...@@ -19,8 +20,8 @@ if ($user_id == 0) { ...@@ -19,8 +20,8 @@ if ($user_id == 0) {
$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'];
Timber::render('view.html', $context);
} }
Timber::render('view.html', $context);
?> ?>
\ No newline at end of file
...@@ -10,9 +10,12 @@ ...@@ -10,9 +10,12 @@
<!--CSS--> <!--CSS-->
<link rel="stylesheet" type="text/css" href="{{ theme }}/css/bootstrap.min.css"> <link rel="stylesheet" type="text/css" href="{{ theme }}/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="{{ theme }}/css/detail.css"> <link rel="stylesheet" type="text/css" href="{{ theme }}/css/detail.css">
<link rel="stylesheet" type="text/css" href="{{ theme }}/css/star-rating.min.css">
<script type="text/javascript" src="{{ theme }}/js/iscroll.js"></script> <script type="text/javascript" src="{{ theme }}/js/iscroll.js"></script>
<script type="text/javascript" src="{{ theme }}/js/swipe.js"></script> <script type="text/javascript" src="{{ theme }}/js/swipe.js"></script>
<script type="text/javascript" src="{{ theme }}/js/jquery.min.js"></script> <script type="text/javascript" src="{{ theme }}/js/jquery.min.js"></script>
<script type="text/javascript" src="{{ theme }}/js/jquery.mobile.custom.min.js"></script>
<script type="text/javascript" src="{{ theme }}/js/star-rating.min.js"></script>
<script type="text/javascript" src="{{ theme }}/js/bootstrap.min.js"></script> <script type="text/javascript" src="{{ theme }}/js/bootstrap.min.js"></script>
<script type="text/javascript"> <script type="text/javascript">
var myScroll; var myScroll;
...@@ -36,20 +39,56 @@ ...@@ -36,20 +39,56 @@
preventDefault: false, preventDefault: false,
click: true click: true
}); });
carouselScroll = new IScroll('#carousel_wrapper', {
bounce: false, },false);
scrollX: true,
scrollY: false, $(document).ready(function(){
momentum: false, $("#slider").bind("tap",function(){
snap: true, $("#carousel_wrapper").parent().show();
snapSpeed: 400, carouselScroll = new IScroll('#carousel_wrapper', {
click: true bounce: false,
scrollX: true,
scrollY: false,
momentum: false,
snap: true,
snapSpeed: 400,
click: true
});
carouselScroll.on('scrollEnd',function(){
$("#carousel_indicator li").removeClass("carousel_active");
$("#carousel_indicator li").eq(this.currentPage.pageX).addClass("carousel_active");
});
var carousel = $("#carousel_wrapper");
var carouselWidth = carousel.width();
carousel.find("#carousel_scroller ul li").css({"width":carouselWidth});
carousel.find("#carousel_indicator li").removeClass("carousel_active");
carousel.find("#carousel_indicator li:first").addClass("carousel_active");
return false;
}); });
carouselScroll.on('scrollEnd',function(){ $("#carousel_wrapper").parent().bind("click",function(){
$("#carousel_indicator li").removeClass("carousel_active"); $(this).hide();
$("#carousel_indicator li").eq(this.currentPage.pageX).addClass("carousel_active"); return false;
}); });
},false);
$(".collect").bind("tap",function(){
$.ajax({
type: 'POST',
url: '{{ siteUrl }}/wp-admin/admin-ajax.php/',
data: 'action=add_collect&hid={{hid}}',
success: function (data) {
if (data.code == 2000) {
alert('收藏成功');
} else {
alert('收藏失败');
}
}
});
});
$(".map").bind("tap",function(){
location.href = "{{ siteUrl }}/?page=map&a={{result.address}}&c={{cityName}}&hn={{result.community_name}}<br>{{result.address}}&p={{result.location}}";
});
});
</script> </script>
</head> </head>
<body> <body>
...@@ -62,25 +101,17 @@ ...@@ -62,25 +101,17 @@
<div class="addWrap"> <div class="addWrap">
<div id="slider" class="swipe"> <div id="slider" class="swipe">
<div class="swipe-wrap"> <div class="swipe-wrap">
<div> {% for item in images %}
<img src="{{ theme }}/img/img1.jpg"> <div>
</div> <img src="{{siteUrl}}{{item.path}}">
<div> </div>
<img src="{{ theme }}/img/img1.jpg"> {% endfor %}
</div>
<div>
<img src="{{ theme }}/img/img1.jpg">
</div>
<div>
<img src="{{ theme }}/img/img1.jpg">
</div>
</div> </div>
</div> </div>
<ul id="indicator" class="list-inline text-center"> <ul id="indicator" class="list-inline text-center">
<li class="active"></li> {% for i in 1..images|length %}
<li></li> <li {% if loop.index0 == 0 %}class="active"{% endif %}></li>
<li></li> {% endfor %}
<li></li>
</ul> </ul>
</div> </div>
<!-- /图片滚动 --> <!-- /图片滚动 -->
...@@ -118,41 +149,13 @@ ...@@ -118,41 +149,13 @@
<div id="wrapper"> <div id="wrapper">
<div id="scroller"> <div id="scroller">
<ul class="list-inline text-nowrap"> <ul class="list-inline text-nowrap">
<li> {% for item in mainImage %}
<p><img src="{{ theme }}/img/img1.jpg"></p> <li>
<p>一居</p> <p><img src="{{siteUrl}}{{ item.path }}"></p>
<p>60平米以下</p> <p>{{item.type}}</p>
</li> <p>{{item.area}}平</p>
<li> </li>
<p><img src="{{ theme }}/img/img1.jpg"></p> {% endfor %}
<p>一居</p>
<p>60平米以下</p>
</li>
<li>
<p><img src="{{ theme }}/img/img1.jpg"></p>
<p>一居</p>
<p>60平米以下</p>
</li>
<li>
<p><img src="{{ theme }}/img/img1.jpg"></p>
<p>一居</p>
<p>60平米以下</p>
</li>
<li>
<p><img src="{{ theme }}/img/img1.jpg"></p>
<p>一居</p>
<p>60平米以下</p>
</li>
<li>
<p><img src="{{ theme }}/img/img1.jpg"></p>
<p>一居</p>
<p>60平米以下</p>
</li>
<li>
<p><img src="{{ theme }}/img/img1.jpg"></p>
<p>一居</p>
<p>60平米以下</p>
</li>
</ul> </ul>
</div> </div>
</div> </div>
...@@ -171,75 +174,74 @@ ...@@ -171,75 +174,74 @@
<div class="detail_row"> <div class="detail_row">
<a class="collapsed" data-toggle="collapse" href="#collapseExample"><p class="detail_title">基本信息<i class="iconfont pull-right"></i></p></a> <a class="collapsed" data-toggle="collapse" href="#collapseExample"><p class="detail_title">基本信息<i class="iconfont pull-right"></i></p></a>
<ul class="list-unstyled collapse infoCont" id="collapseExample"> <ul class="list-unstyled collapse infoCont" id="collapseExample">
<li>开发商:<span>上海韩汇置业有限公司</span></li> <li>开发商:<span>{{result.developer}}</span></li>
<li>建筑类型:</li> <li>建筑类型:{{result.periphery}}</li>
<li>装修状况:</li> <li>装修状况:{{result.decoration}}</li>
<li>容积率:</li> <li>容积率:{{result.volume_rate}}</li>
<li>规划户数:</li> <li>规划户数:{{result.households}}</li>
<li>物业公司:</li> <li>物业公司:{{result.property_management}}</li>
<li>入住时间:<span>2015-12-31</span></li> <li>入住时间:<span>{{result.check_in_time}}</span></li>
<li>产权年限:</li> <li>产权年限:{{result.property_age}}</li>
<li>建筑面积:</li> <li>建筑面积:{{result.covered_area}}</li>
<li>绿化率:</li> <li>绿化率:{{result.greening_rate}}</li>
<li>车位数:</li> <li>车位数:{{result.parking_spaces}}</li>
<li>物业费:</li> <li>物业费:{{result.property_money}}</li>
</ul> </ul>
</div> </div>
<div class="detail_row"> <div class="detail_row">
<p class="detail_title">楼盘概述</p> <p class="detail_title">楼盘概述</p>
<p>开发商对于楼盘的描述...</p> <p>{{result.overview}}</p>
</div> </div>
<div class="detail_row"> <div class="detail_row">
<p class="detail_title pull-left">推荐房源</p> <p class="detail_title pull-left">推荐房源</p>
<ul class="list-unstyled recommendCont"> <ul class="list-unstyled recommendCont">
<li class="col-xs-3"><p style="background-image:url({{ theme }}/img/img1.jpg);"></p></li> {% for item in recommends %}
<li class="col-xs-3"><p style="background-image:url({{ theme }}/img/img1.jpg);"></p></li> <a href="{{siteUrl}}?page=detail&hid={{item.id}}"><li class="col-xs-3"><p style="background-image:url({{siteUrl}}{{ item.path }});"></p></li></a>
<li class="col-xs-3"><p style="background-image:url({{ theme }}/img/img1.jpg);"></p></li> {% endfor %}
</ul> </ul>
</div> </div>
<div class="detail_row"> <div class="detail_row" id="consultantDiv">
<p class="detail_title">置业顾问</p> <p class="detail_title">置业顾问</p>
<ul class="list-unstyled peopleCont"> <ul class="list-unstyled peopleCont">
<li> {% for item in consultant %}
<ol class="col-xs-2 text-center"> <li>
<img src="{{ theme }}/img/head.png"> <ol class="col-xs-2 text-center">
</ol> {% if item.imageUrl %}
<ol class="col-xs-4"> <img src="{{ item.imageUrl }}">
<p>邓绿</p> {% else %}
<p><img src="{{ theme }}/img/star.png" width="100px"></p> <img src="{{ theme }}/img/head.png">
</ol> {% endif %}
<ol class="col-xs-6"> </ol>
<button type="button" class="btn btn-xs btn-phone"> <ol class="col-xs-4">
<span></span>电话联系 <p>{{item.name}}</p>
</button> <p>
<button type="button" class="btn btn-xs btn-booking"> <div class="star-rating rating-xs rating-disabled" style="font-size:12px;">
<span></span>一键预约 <div class="rating-container rating-gly-star" data-content="">
</button> <div class="rating-stars" data-content="" style="width: {{item.average_score*2*10}}%;"></div>
</ol> </div>
</li> </div>
<li> </p>
<ol class="col-xs-2 text-center"> </ol>
<img src="img/head.png"> <ol class="col-xs-6">
</ol> {% if not item.mobile %}
<ol class="col-xs-4"> <a class="btn btn-xs btn-phone" disabled="disabled">
<p>邓绿</p> {% else %}
<p><img src="{{ theme }}/img/star.png" width="100px"></p> <a href="tel:{{item.mobile}}" class="btn btn-xs btn-phone">
</ol> {% endif %}
<ol class="col-xs-6"> <span></span>电话联系
<button type="button" class="btn btn-xs btn-phone"> </a>
<span></span>电话联系 <a href="{{siteUrl}}?page=view&house_id={{hid}}&consultant_id={{item.id}}" class="btn btn-xs btn-booking">
</button> <span></span>一键预约
<button type="button" class="btn btn-xs btn-booking"> </a>
<span></span>一键预约 </ol>
</button> </li>
</ol> {% endfor %}
</li>
</ul> </ul>
</div> </div>
<footer class="footer navbar-fixed-bottom"> <footer class="footer navbar-fixed-bottom">
<button type="button" class="btn">置业顾问</button> <a href="#consultantDiv" class="btn">置业顾问</a>
<button type="button" class="btn">预约看房</button> <a href="{{siteUrl}}?page=view&house_id={{hid}}" class="btn">预约看房</a>
<!-- 二手房详细 --> <!-- 二手房详细 -->
<!-- <ul class="list-inline text-right"> <!-- <ul class="list-inline text-right">
<li class="text-center phone"> <li class="text-center phone">
...@@ -258,33 +260,19 @@ ...@@ -258,33 +260,19 @@
<div id="carousel_wrapper"> <div id="carousel_wrapper">
<div id="carousel_scroller"> <div id="carousel_scroller">
<ul class="list-inline text-nowrap"> <ul class="list-inline text-nowrap">
<li> {% for item in images %}
<p> <li>
<span><img src="{{ theme }}/img/img1.jpg"></span> <p>
</p> <span><img src="{{siteUrl}}{{item.path}}"></span>
</li> </p>
<li> </li>
<p> {% endfor %}
<span><img src="{{ theme }}/img/img1.jpg"></span>
</p>
</li>
<li>
<p>
<span><img src="{{ theme }}/img/img1.jpg"></span>
</p>
</li>
<li>
<p>
<span><img src="{{ theme }}/img/img1.jpg"></span>
</p>
</li>
</ul> </ul>
</div> </div>
<ul id="carousel_indicator" class="list-inline text-center indicators"> <ul id="carousel_indicator" class="list-inline text-center indicators">
<li class="carousel_active"></li> {% for i in 1..images|length %}
<li></li> <li></li>
<li></li> {% endfor %}
<li></li>
</ul> </ul>
</div> </div>
</div> </div>
......
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no"/>
<style type="text/css">
body, html, #allmap {
width: 100%;
height: 100%;
overflow: hidden;
margin: 0;
font-family: "微软雅黑";
}
.hn {
margin: 10px 0 5px 0
}
</style>
<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=DhzdodNVxoDSiBzRfZod4FG8"></script>
<title>地图</title>
</head>
<body>
<div id="allmap"></div>
</body>
</html>
<script type="text/javascript">
//map.html?a=南通市城山家园&hn=城山家园</br>同普路1220号&c=南通市&p=120.890824,31.971025
// 创建Map实例
var map = new BMap.Map("allmap");
var url_address = '{{address}}';
var url_city = '{{city}}';
var url_point = '{{point}}';
var url_houseName = "<a class='hn'>{{houseName}}</a>";
if (url_point) {
var pointLng = url_point.split(',')[0];
var pointLat = url_point.split(',')[1];
fromPoint(pointLng,pointLat);
} else if (!!url_address) {
fromAddress();
}
function fromAddress() {
// 创建地址解析器实例
var myGeo = new BMap.Geocoder();
// 将地址解析结果显示在地图上,并调整地图视野
myGeo.getPoint(url_address, function (point) {
if (point) {
map.centerAndZoom(point, 18);
map.addOverlay(new BMap.Marker(point));
showinfo(point);
} else {
alert("您选择地址没有解析到结果!");
}
},url_city);
}
function fromPoint(lng,lat) {
var point = new BMap.Point(lng, lat);
map.centerAndZoom(point, 18);
map.addOverlay(new BMap.Marker(point));
showinfo(point);
}
function showinfo(point) {
var opts = {
width: 0, // 信息窗口宽度
height: 0, // 信息窗口高度
//title: "楼盘名称", // 信息窗口标题
enableCloseOnClick: false, //
offset: new BMap.Size(10, -20) //信息窗位置偏移值
}
var infoWindow = new BMap.InfoWindow(url_houseName, opts); // 创建信息窗口对象
map.openInfoWindow(infoWindow, point); //开启信息窗口
}
function getUrlParam(name) {
var reg= new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
if (r != null) return decodeURI(r[2]);
return null;
}
</script>
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