Commit 5a0a2ded by felix

每日一更

parent 4aa30a4b
......@@ -54,7 +54,8 @@ class House {
"room_id" => $_POST["baseRoom"],
"property_money" => $_POST["property_money"],
'creattime' => date("Y-m-d H:i:s"),
'user_id' => get_current_user_id()
'user_id' => get_current_user_id(),
'community_name' => $_POST["community_name"]
);
$res = $wpdb->get_results('SELECT * FROM tospur_house WHERE name="' . $_POST['name'] . '" and address="' . $_POST['address'] . '"', OBJECT);
if (!$res) {
......@@ -127,5 +128,29 @@ class House {
}
}
}
//插入推荐房源id与添加新房id到关联表a_house_recommend
foreach($data["recommend"] as $value){
$a_house_recommendArray = array(
"house_id" => $houseid,
"recommend_id" =>$value
);
$a_house_recommendRes = $wpdb->insert('a_house_recommend', $a_house_recommendArray);
if(!$a_house_recommendRes){
return 504;
}
}
//插入推荐置业顾问user_id与新房id到关联表a_house_recommend
foreach($data["recConsultant"] as $val){
$a_house_userArray = array(
"user_id" => $val,
"house_id" => $houseid,
"user_type" =>1
);
$a_house_userRes = $wpdb->insert('a_house_user', $a_house_userArray);
if(!$a_house_userRes){
return 505;
}
}
}
}
\ No newline at end of file
......@@ -10,6 +10,7 @@
<form action="" method="POST" enctype="multipart/form-data">
<div>
楼盘名:<input type="text" name="name" id="housename"><br><br>
小区名:<input type="text" name="name" id="community_name"><br><br>
均价:<input type="text" name=" average_price"><br><br>
最新动态:<textarea rows="3" cols="20" name="event"></textarea><br><br>
<div id="preview">
......@@ -63,15 +64,25 @@
<div id="picList"></div>
</div>
<!-- Button trigger modal -->
推荐房源:<button type="button" class="button action" data-toggle="modal" data-target="#myModal">
添加房源
</button>
<div id="houseImg"></div>
置业顾问:<button type="button" class="button action" data-toggle="modal" data-target="#myConsultant">
选择置业顾问
</button>
<div id="consultantImg"></div>
<input type="submit" id="submit" class="button action">
</form>
<!-- Button trigger modal -->
推荐房源:<button type="button" class="button action" data-toggle="modal" data-target="#myModal">
添加房源
</button>
<div id="houseImg"></div>
<!-- Modal -->
<!-- 新增房源弹出层 -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
......@@ -116,6 +127,26 @@
</div>
</div>
<!-- 置业顾问弹出层 -->
<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">
<option value=""> 城市</option>
{% for item in city %}
<option value="{{ item.id }}">{{ item.value }}</option>
{% endfor %}
</select>
<input type="text" placeholder="请出入置业顾问姓名搜索" id="consultantName">
<button type="button" class="button action" id="searchConsult">搜索</button>
<ul id="consultantList">
</ul>
</div>
</div>
</div>
</div>
<script>
(function($){
......@@ -123,8 +154,6 @@
//主力房源中选择图片file的下标
var i = 0;
//房源相册的下标
//入住时间选择
$("#checkin").datepicker({
dateFormat: "yy-mm-dd"
......@@ -249,8 +278,7 @@
url: "/tospur/wp-admin/admin-ajax.php",
data: "action=searchHouse&cityId="+cityId+"&districtId="+areaId+"&plateId="+plateId+"&buildPropertyId="+buildPropertyId+"&roomId="+room+"&acreage="+acreage+"&totalPrice="+price,
success:function(json){
for(
var i = 0; i <=json.length-1; i++){
for(var i = 0; i <=json.length-1; i++){
var name = json[i]["name"];
var imgUrl = json[i]["path"];
var img = $("<img>").attr({"src":imgUrl,"height":100,"width":100});
......@@ -260,6 +288,7 @@
}
});
});
//添加房源中搜索框的搜索
$("#search").click(function(){
$searchtext = $("#searchtext").val();
......@@ -280,27 +309,75 @@
});
})
//删除添加房源下的房源
//搜索对应城市的置业顾问
$("#consultCity").change(function(){
var consulCityId = $("#consultCity").val();
var consultantName =$("#consultantName").val();
$("#consultantList").find("li").remove();
$.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});
var li = $("<li>").attr("id",json[i]["id"]).append(img).append(name).addClass("consultantImg");
$("#consultantList").append(li);
}
}
});
});
//添加置业顾问弹出层中搜索框的搜索内容
$("#searchConsult").click(function(){
var consulCityId = $("#consultCity").val();
var consultantName =$("#consultantName").val();
$("#consultantList").find("li").remove();
$.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});
var li = $("<li>").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("imgCancel");
var p = $("<p>").addClass("imgClass").append(img).append(cancel);
var p = $("<p>").append(img).append(cancel).append(recommendHouse);
$("#houseImg").append(p);
controlCommand();
});
$("#houseImg").on("click",".imgCancel",function(){
$(this).parent("p").remove();
//添加置业顾问
$("#consultantList").on("click",".consultantImg",function(){
var recommendConsultant = $("<input>").attr({"type":"hidden","name":"data[recConsultant][]","value": $(this).attr("id")});
var cancel = $("<input>").attr({"type":"button","value":"删除"}).addClass("consultantCancel");
var font = $("<font>").append( $(this).text());
var p = $("<p>").append(font).append(cancel).append(recommendConsultant);
$("#consultantImg").append(p);
});
//新增房源相册
$("#housePicture").click(function(){
var picDelet = $("<font>").append("删除").addClass("picDelet");
var file = $("<input>").attr({"type":"file","name":"files["+i+"]"}).addClass("picFiles");
var select = $("<select>").attr("name","data["+i+"][type]");
{% for item in photoType %}
select.append($("<option>").attr("value",{{item.id}}).append('{{item.value}}'));
select.append($("<option>").attr("value",{{item.id}}).append('{{item.photoType}}'));
{% endfor%}
var p = $("<p>").append(select).append(file).append(picDelet);
$("#picList").append(p);
......@@ -313,10 +390,10 @@
$(this).hide();
});
$("#picList").on("click",".picDelet",function(){
//删除房源相册、推荐房源、推荐置业顾问
$("#houseImg,#consultantImg,#picList").on("click",".imgCancel,.consultantCancel,.picDelet",function(){
$(this).parent("p").remove();
})
});
$("#submit").click(function(){
if($("#housename").val()==""){
......@@ -358,8 +435,6 @@
}
reader.readAsDataURL(input.files[0]);
}
function addOption(json,select){
var selectId = select.attr("id");
for(var i = 0; i <=json.length-1; i++){
......
......@@ -11,6 +11,8 @@ class Config {
const DIC_PHOTOTYPE_TABLE = "dic_phototype";
const TOSPUR_ORGANIZATION_TABLE = 'tospur_organization';
const TOSPUR_CONSULTANT = 'tospur_consultant';
const TOSPUR_HOUSE_TABLE = 'tospur_house';
//sync url
const user_url = 'http://218.1.67.130:8988/api/NanTongWechat/GetPropertyConsultant?cityId=1';
......
<?php
require_once(PLUGIN_DIR . 'Config.php');
class SearchDao{
public static function ajax_serachCity(){
wp_send_json(SearchDao::searchCity($_GET["cityId"],$_GET['districtId']));
......@@ -162,7 +163,7 @@ class SearchDao{
}
$sql = $sql." group by bph_id order by th.creattime DESC";
print_r($wpdb->prepare($sql,$params));
$result = $wpdb->get_results($wpdb->prepare($sql,$params));
return $result;
}
......@@ -176,4 +177,24 @@ class SearchDao{
$result = $wpdb->get_results('select id,photo_name as value from '.Config::DIC_PHOTOTYPE_TABLE);
return $result;
}
public static function ajax_searchConsultant(){
wp_send_json(SearchDao::searchConsultant($_GET["consulCityId"],$_GET["consultantName"]));
}
public static function searchConsultant($consulCityId = NULL,$consultantName = NULL){
global $wpdb;
$sql = "select id,name as consultantName,imageUrl from ".Config::TOSPUR_CONSULTANT." where 1=1";
$params = array();
if($consulCityId != NULL){
$params[] = $consulCityId;
$sql = $sql." and cityId=%d";
}
if($consultantName != NULL){
$params[] = '%'.$consultantName.'%';
$sql = $sql." and name like %s";
}
$result = $wpdb->get_results($wpdb->prepare($sql,$params));
return $result;
}
}
\ No newline at end of file
......@@ -89,7 +89,8 @@ function tospur_ajax_set()
add_action('wp_ajax_nopriv_searchOrganization', 'SearchDao::ajax_searchOrganization');
add_action( 'wp_ajax_searchHouse', 'SearchDao::ajax_searchHouse' );
add_action( 'wp_ajax_nopriv_searchHouse', 'SearchDao::ajax_searchHouse');
add_action( 'wp_ajax_searchConsultant', 'SearchDao::ajax_searchConsultant' );
add_action( 'wp_ajax_nopriv_searchConsultant', 'SearchDao::ajax_searchConsultant');
//后台处理 置业顾问评分
add_action('wp_ajax_valid_consultant_score', 'valid_consultant_score');
//后台处理 置业顾问
......
@font-face {
font-family: 'iconfont';
<<<<<<< HEAD
src: url('http://at.alicdn.com/t/font_1439179733_4587424.eot');
src: url('http://at.alicdn.com/t/font_1439179733_4587424.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */ url('http://at.alicdn.com/t/font_1439179733_4587424.woff') format('woff'), /* chrome、firefox */ url('http://at.alicdn.com/t/font_1439179733_4587424.ttf') format('truetype'), /* chrome、firefox、opera、Safari, Android, iOS 4.2+*/ url('http://at.alicdn.com/t/font_1439179733_4587424.svg#iconfont') format('svg');
=======
src: url('http://at.alicdn.com/t/font_1439002040_1403098.eot');
src: url('http://at.alicdn.com/t/font_1439002040_1403098.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */ url('http://at.alicdn.com/t/font_1439002040_1403098.woff') format('woff'), /* chrome、firefox */ url('http://at.alicdn.com/t/font_1439002040_1403098.ttf') format('truetype'), /* chrome、firefox、opera、Safari, Android, iOS 4.2+*/ url('http://at.alicdn.com/t/font_1439002040_1403098.svg#iconfont') format('svg');
>>>>>>> remotes/origin/dev
src: url('http://at.alicdn.com/t/font_1439432624_5842593.eot');
src: url('http://at.alicdn.com/t/font_1439432624_5842593.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */ url('http://at.alicdn.com/t/font_1439432624_5842593.woff') format('woff'), /* chrome、firefox */ url('http://at.alicdn.com/t/font_1439432624_5842593.ttf') format('truetype'), /* chrome、firefox、opera、Safari, Android, iOS 4.2+*/ url('http://at.alicdn.com/t/font_1439432624_5842593.svg#iconfont') format('svg');
/* IE9*/
/* iOS 4.1- */
......@@ -19,7 +14,34 @@
-webkit-text-stroke-width: 0.2px;
-moz-osx-font-smoothing: grayscale;
}
<<<<<<< HEAD
.tab {
width: 100%;
height: 40px;
margin-bottom: 0;
border-bottom: 1px solid #008cd7;
}
.tab li .btn {
color: #000000;
font-size: 18px;
font-weight: bold;
}
.tab li .btn:after {
content: "";
width: 88%;
height: 4px;
position: absolute;
bottom: -1px;
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;
}
.modal .modal-dialog {
position: absolute;
top: 0;
......@@ -68,19 +90,150 @@
-webkit-border-bottom-right-radius: 0;
}
.modal .modal-dialog .modal-content .btn:active {
box-shadow: none;
-webkit-box-shadow: none;
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;
}
=======
>>>>>>> remotes/origin/dev
.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%;
......@@ -94,13 +247,13 @@ body {
color: #707070;
background-color: #f9f9f9;
}
<<<<<<< HEAD
a:hover {
text-decoration: none;
}
body {
height: auto;
padding-bottom: 45px;
}
=======
>>>>>>> remotes/origin/dev
.collect {
position: fixed;
top: 10px;
......@@ -174,16 +327,23 @@ body {
height: auto;
padding: 10px;
overflow: hidden;
<<<<<<< HEAD
position: relative;
=======
>>>>>>> remotes/origin/dev
border-bottom: 1px solid #b7b7b7;
}
.detail_row a .iconfont {
color: #b7b7b7;
font-size: 12px;
font-weight: normal;
}
.detail_row a .iconfont:after {
content: "\e602";
}
.detail_row a.collapsed .iconfont:after {
content: "\e601";
}
.detail_row p {
margin-bottom: 0;
}
<<<<<<< HEAD
.detail_row ul {
margin-bottom: 0;
}
......@@ -192,6 +352,7 @@ body {
}
.detail_row .detail_title {
color: #000000;
font-size: 16px;
font-weight: bold;
margin-bottom: 5px;
}
......@@ -239,15 +400,7 @@ body {
.detail_row #wrapper {
width: 100%;
height: auto;
margin-top: 8px;
=======
.detail_row .detail_title {
color: #000000;
}
.detail_row #wrapper {
width: 100%;
margin-top: 5px;
>>>>>>> remotes/origin/dev
margin-top: 10px;
overflow: hidden;
}
.detail_row #wrapper #scroller {
......@@ -283,7 +436,6 @@ body {
.detail_row #wrapper #scroller ul li:last-child {
margin-right: 0;
}
<<<<<<< HEAD
.detail_row .map {
position: absolute;
top: 5px;
......@@ -299,49 +451,19 @@ body {
background-size: cover;
-webkit-background-size: cover;
display: inline-block;
=======
.detail_row ul {
margin-bottom: 0;
}
.detail_row ul li {
padding: 0;
}
.detail_row ul li .btn {
color: #ff0000;
border-color: #959595;
background-color: transparent;
}
.detail_row ul li.price span {
color: #000000;
}
.detail_row ul li.price span em {
font-style: normal;
}
.detail_row ul li.price span em:nth-child(1) {
color: #ff0000;
font-size: 16px;
font-weight: bold;
}
.detail_row ul li.price span em:nth-child(2) {
position: relative;
top: -5px;
font-size: 7px;
>>>>>>> remotes/origin/dev
.detail_row .infoCont li {
margin-bottom: 2px;
}
.detail_row .infoCont li span {
color: #000000;
}
.detail_row .recommendCont {
<<<<<<< HEAD
margin-top: 5px;
overflow: hidden;
zoom: 1;
=======
overflow: hidden;
>>>>>>> remotes/origin/dev
}
.detail_row .recommendCont li {
margin: 5px 0 0 15px;
margin: 10px 0 0 15px;
}
.detail_row .recommendCont li p {
width: 100%;
......@@ -359,7 +481,6 @@ body {
-webkit-border-bottom-left-radius: 5px;
-webkit-border-bottom-right-radius: 5px;
}
<<<<<<< HEAD
.detail_row .peopleCont li {
width: 100%;
height: 60px;
......@@ -412,7 +533,7 @@ body {
display: inline-block;
vertical-align: middle;
}
.detail_row .peopleCont li ol .btn-bespeak {
.detail_row .peopleCont li ol .btn-booking {
width: 48%;
padding: 3px;
color: #008cd7;
......@@ -428,7 +549,7 @@ body {
-webkit-border-bottom-left-radius: 4px;
-webkit-border-bottom-right-radius: 4px;
}
.detail_row .peopleCont li ol .btn-bespeak span {
.detail_row .peopleCont li ol .btn-booking span {
width: 16px;
height: 16px;
background: url("../img/blue_bespeak_icon.png") no-repeat;
......@@ -515,6 +636,7 @@ body {
font-size: 0;
}
.modal #carousel_wrapper #carousel_scroller ul li {
width: 360px;
height: 100%;
padding: 0;
overflow: hidden;
......@@ -557,10 +679,4 @@ body {
}
.modal #carousel_wrapper .indicators li.carousel_active {
opacity: 1;
=======
.detail_row .single_omit {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
>>>>>>> remotes/origin/dev
}
<?php
require_once(WP_PLUGIN_DIR."/tospur/Config.php");
$context = array();
$context['theme'] = get_template_directory_uri();
if(isset($_GET['hid'])){
$hid = $_GET['hid'];
$sql = "select * from ".Config::TOSPUR_HOUSE_TABLE." where id = %d";
$result = $wpdb->get_row($wpdb->prepare($sql,$hid));
$context['result'] = $result;
Timber::render('detail.html', $context);
}else{
Timber::render('error.html', $context);
}
?>
\ No newline at end of file
......@@ -32,6 +32,9 @@ function page_template($template)
case 'score':
$page = $theme . '/score.php';
break;
case 'detail':
$page = $theme . '/detail.php';
break;
default:
$page = $template;
break;
......
<?php
$context = array();
$context['theme'] = get_template_directory_uri();
require_once(WP_PLUGIN_DIR."/tospur/Dao/SearchDao.php");
$context = array();
$context['theme'] = get_template_directory_uri();
require_once(WP_PLUGIN_DIR."/tospur/Dao/SearchDao.php");
$cityId = 1;
if($_GET['cityId'])
$cityId = $_GET['cityId'];
$context['cityId'] = $cityId;
$context['cityName'] = SearchDao::getCityNameWithId($cityId);
$context['select']['city'] = SearchDao::searchCity();
$context['select']['district'] = SearchDao::searchCity($cityId);
$plateArray = array();
foreach($context['select']['district'] as $item){
$plateArray[$item->id] = array();
foreach(SearchDao::searchCity($cityId,$item->id) as $i){
$plateArray[$item->id][] = $i;
$cityId = 1;
if($_GET['cityId'])
$cityId = $_GET['cityId'];
$context['cityId'] = $cityId;
$context['cityName'] = SearchDao::getCityNameWithId($cityId);
$context['select']['city'] = SearchDao::searchCity();
$context['select']['district'] = SearchDao::searchCity($cityId);
$plateArray = array();
foreach($context['select']['district'] as $item){
$plateArray[$item->id] = array();
foreach(SearchDao::searchCity($cityId,$item->id) as $i){
$plateArray[$item->id][] = $i;
}
}
}
$context['select']['plate'] = json_encode($plateArray);
$context['select']['buildProperty'] = SearchDao::searchBuildProperty();
$context['select']['room'] = json_encode(SearchDao::searchRoom());
$context['select']['unitPriceRange'] = SearchDao::searchUnitPriceRange($cityId);
$context['select']['totalPrice'] = SearchDao::searchTotalPrice($cityId);
$context['select']['area'] = json_encode(SearchDao::searchArea($cityId));
$context['select']['plate'] = json_encode($plateArray);
$context['select']['buildProperty'] = SearchDao::searchBuildProperty();
$context['select']['room'] = json_encode(SearchDao::searchRoom());
$context['select']['unitPriceRange'] = SearchDao::searchUnitPriceRange($cityId);
$context['select']['totalPrice'] = SearchDao::searchTotalPrice($cityId);
$context['select']['area'] = json_encode(SearchDao::searchArea($cityId));
$context['site_url'] = site_url();
Timber::render('index.html', $context);
$context['site_url'] = site_url();
Timber::render('index.html', $context);
?>
\ No newline at end of file
......@@ -75,4 +75,78 @@ Date.prototype.Format = function (fmt) {
if (new RegExp("(" + k + ")").test(fmt))
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
return fmt;
};
\ No newline at end of file
};
//将数据存储到lacalstorage和cookie中,
var ugenLocalStorage =
{
set: function(name, value)
{
var date = new Date(),
expires = '',
type = typeof(value),
valueToUse = ''
//cookie后的时间变量,固定为了365天
date.setTime(date.getTime() + (365 * 24 * 60 * 60 * 1000));
expires = "; expires=" + date.toUTCString();
//判断数据类型是string还是map
if (type === "object" && type !== "undefined") {
if(!("JSON" in window)) throw "Bummer, your browser doesn't support JSON parsing.";
valueToUse = JSON.stringify(value);
} else {
valueToUse = value;
}
//储存在localStorage中
localStorage[name] = valueToUse;
//储存在cookie中
document.cookie = name + "=" +encodeURIComponent(valueToUse) + expires
},
get: function(name){
//判断是否存在localstorage,有返回localstorage没有返回cookie
if(localStorage[name]){
return localStorage[name];
}else
{
var nameEQ = name + "=",
//从cookie中拿出数据使用';'分开
ca = document.cookie.split(';'),
value = '',
//存放数据第一个字符变量
firstChar = '',
parsed={};
for (var i = 0; i < ca.length; i++)
{
var c = ca[i];
//循环每个字符,直到为空
while (c.charAt(0) == ' ') c = c.substring(1, c.length);
//判断nameEQ与储存数据name是否匹配
if (c.indexOf(nameEQ) === 0)
{
//将cookie数据解码
value = decodeURIComponent(c.substring(nameEQ.length, c.length));
firstChar = value.substring(0, 1);
//判断是否为map形式
if(firstChar=="{")
{
try
{
parsed = JSON.parse(value);
if("v" in parsed) return parsed.v;
} catch(e)
{
return value;
}
}
if (value=="undefined") return undefined;
return value;
}
}
return null;
}
}
}
\ No newline at end of file
somthing error
\ No newline at end of file
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