Commit b6aca874 by felix

每日一更

parent cc413842
...@@ -168,11 +168,4 @@ class House extends Tospur_House{ ...@@ -168,11 +168,4 @@ class House extends Tospur_House{
return 200; return 200;
} }
public static function getCurrentRole(){
$current_user = wp_get_current_user();
if ( !($current_user instanceof WP_User) )
return;
$roles = $current_user->roles;
return $roles[0];
}
} }
\ No newline at end of file
...@@ -192,7 +192,7 @@ class rentHouseList extends WP_List_Table ...@@ -192,7 +192,7 @@ class rentHouseList extends WP_List_Table
); );
$sql = "select * from tospur_house th $sql = "select * from tospur_house th
left join(select user_id as aus_id,house_id from a_house_user) ahu on th.id = ahu.house_id left join(select user_id as aus_id,house_id from a_house_user where user_type = 1) ahu on th.id = ahu.house_id
left join(select id as consul_id,name as consul_name from tospur_consultant) tc on ahu.aus_id = tc.consul_id left join(select id as consul_id,name as consul_name from tospur_consultant) tc on ahu.aus_id = tc.consul_id
left join(select value,literal from dic_buildproperty) db on th.buildproperty_id = db.value left join(select value,literal from dic_buildproperty) db on th.buildproperty_id = db.value
where 1=1 and house_type=2"; where 1=1 and house_type=2";
......
...@@ -68,6 +68,7 @@ class SecHandHouse extends Tospur_House{ ...@@ -68,6 +68,7 @@ class SecHandHouse extends Tospur_House{
$context["district"] = SearchDao::searchCity($context['result']->city_id); $context["district"] = SearchDao::searchCity($context['result']->city_id);
$context["plate"] = SearchDao::searchCity($context['result']->city_id,$context['result']->district_id); $context["plate"] = SearchDao::searchCity($context['result']->city_id,$context['result']->district_id);
$context["mark"] = SearchDao::searchHouseTag($_GET['id']); $context["mark"] = SearchDao::searchHouseTag($_GET['id']);
} }
$context['role'] = SecHandHouse::getCurrentRole(); $context['role'] = SecHandHouse::getCurrentRole();
$context["city"] = SearchDao::searchCity(); $context["city"] = SearchDao::searchCity();
...@@ -75,6 +76,7 @@ class SecHandHouse extends Tospur_House{ ...@@ -75,6 +76,7 @@ class SecHandHouse extends Tospur_House{
$context["room"] = SearchDao::searchRoom(); $context["room"] = SearchDao::searchRoom();
$context["photoType"] = SearchDao::searchPhotoType(); $context["photoType"] = SearchDao::searchPhotoType();
$context["status"] = searchDao::searchStatusType(2); $context["status"] = searchDao::searchStatusType(2);
$context["feature"] = searchDao::searchFeature();
Timber::render("secHandHouse.html",$context); Timber::render("secHandHouse.html",$context);
} }
...@@ -98,7 +100,12 @@ class SecHandHouse extends Tospur_House{ ...@@ -98,7 +100,12 @@ class SecHandHouse extends Tospur_House{
InsertDao::addRecConsultant($houseId,$data); InsertDao::addRecConsultant($houseId,$data);
if(isset($_POST['mark'])&&$_POST['mark']!=""){
InsertDao::addHouseTag($_POST['mark'],$houseId); InsertDao::addHouseTag($_POST['mark'],$houseId);
}
InsertDao::addHouseFeature($houseId,$data);
}else{ }else{
return 507; return 507;
...@@ -137,7 +144,19 @@ class SecHandHouse extends Tospur_House{ ...@@ -137,7 +144,19 @@ class SecHandHouse extends Tospur_House{
$wpdb->delete(Config::A_HOUSE_USER_TABLE,array("house_id" => $houseId)); $wpdb->delete(Config::A_HOUSE_USER_TABLE,array("house_id" => $houseId));
InsertDao::addRecConsultant($houseId,$data); InsertDao::addRecConsultant($houseId,$data);
// $wpdb->delete(Config::A_HOUSE_TAG_TABLE,array("house_id" => $houseId));
$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); InsertDao::addHouseTag($_POST['mark'],$houseId);
}
return $result; return $result;
} }
......
...@@ -181,7 +181,7 @@ class secHandHouseList extends WP_List_Table ...@@ -181,7 +181,7 @@ class secHandHouseList extends WP_List_Table
//$data = $this->example_data; //$data = $this->example_data;
$sql = "select * from tospur_house th $sql = "select * from tospur_house th
left join(select user_id as aus_id,house_id from a_house_user) ahu on th.id = ahu.house_id left join(select user_id as aus_id,house_id from a_house_user where user_type = 1) ahu on th.id = ahu.house_id
left join(select id as consul_id,name as consul_name from tospur_consultant) tc on ahu.aus_id = tc.consul_id left join(select id as consul_id,name as consul_name from tospur_consultant) tc on ahu.aus_id = tc.consul_id
left join(select value,literal from dic_buildproperty) db on th.buildproperty_id = db.value left join(select value,literal from dic_buildproperty) db on th.buildproperty_id = db.value
where 1=1 and house_type=1"; where 1=1 and house_type=1";
......
...@@ -34,13 +34,13 @@ ...@@ -34,13 +34,13 @@
<th><label for="from">所属地区</label></th> <th><label for="from">所属地区</label></th>
<td> <td>
<select id="baseCity" name="baseCity"> <select id="baseCity" name="baseCity">
<option value=""> 城市</option> <option value="-1"> 城市</option>
{% for item in city %} {% for item in city %}
<option {{ item.id == result.city_id?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option> <option {{ item.id == result.city_id?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %} {% endfor %}
</select> </select>
<select id="baseAreaId" name="baseAreaId"> <select id="baseAreaId" name="baseAreaId">
<option value = "">区域</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>
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
{% endif %} {% endif %}
</select> </select>
<select id="basePlateId" name="basePlateId"> <select id="basePlateId" name="basePlateId">
<option value = "">板块</option> <option value = "-1">板块</option>
{% if district %} {% if district %}
{% for item in plate %} {% for item in plate %}
<option {{ item.id == result.plate_id?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option> <option {{ item.id == result.plate_id?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
...@@ -386,6 +386,7 @@ ...@@ -386,6 +386,7 @@
var cityName = $("#baseCity").find("option:selected").text(); var cityName = $("#baseCity").find("option:selected").text();
var option = $("<option>").attr("value",cityId).append(cityName); var option = $("<option>").attr("value",cityId).append(cityName);
$("#cityId").append(option); $("#cityId").append(option);
if(cityId != -1){
var area = $("#areaId"); var area = $("#areaId");
$.ajax({ $.ajax({
type: "GET", type: "GET",
...@@ -414,23 +415,8 @@ ...@@ -414,23 +415,8 @@
addOption(json,price); addOption(json,price);
} }
}); });
addList(0);
$.ajax({
type: "post",
url: "/tospur/wp-admin/admin-ajax.php",
data: "action=searchHouse&cityId="+cityId+"&houseType=0",
success:function(json){
var result = json.result;
for(var i = 0; i <result.length; i++){
var name = result[i]["name"];
var id = result[i]['id'];
var imgUrl = json.images[id];
var img = $("<img>").attr({"src":imgUrl,"height":100,"width":100});
var li = $("<li>").attr("id",id).addClass("addImg").append(img).append(name);
$("#houseList").append(li);
} }
}
});
}); });
//区域联动板块 //区域联动板块
...@@ -452,30 +438,7 @@ ...@@ -452,30 +438,7 @@
//推荐房源下显示图片信息以及房名 //推荐房源下显示图片信息以及房名
$("#areaId,#plateId,#buildProperty,#room,#acreage,#price").change(function(){ $("#areaId,#plateId,#buildProperty,#room,#acreage,#price").change(function(){
$("#houseList").find("li").remove(); addList(0);
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=0",
success:function(json){
var result = json.result;
for(var i = 0; i <result.length; i++){
var name = result[i]["name"];
var id = result[i]['id'];
var imgUrl = json.images[id];
var img = $("<img>").attr({"src":imgUrl,"height":100,"width":100});
var li = $("<li>").attr("id",id).addClass("addImg").append(img).append(name);
$("#houseList").append(li);
}
}
});
}); });
//添加房源中搜索框的搜索 //添加房源中搜索框的搜索
...@@ -590,7 +553,9 @@ ...@@ -590,7 +553,9 @@
$("#houseImg,#consultantImg,#picList").on("click",".imgCancel,.consultantCancel,.picDelet",function(){ $("#houseImg,#consultantImg,#picList").on("click",".imgCancel,.consultantCancel,.picDelet",function(){
$(this).parent("p").remove(); $(this).parent("p").remove();
}); });
$("#preview,#picList,#houseImg,#consultantImg").on("click",".existsCancel",function(){
$(this).parent().remove();
});
$("#submit").click(function(){ $("#submit").click(function(){
if($("#housename").val()==""){ if($("#housename").val()==""){
...@@ -653,9 +618,54 @@ ...@@ -653,9 +618,54 @@
} }
} }
$("#preview,#picList,#houseImg,#consultantImg").on("click",".existsCancel",function(){
$(this).parent().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":100,"width":100});
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); })(jQuery);
......
...@@ -89,13 +89,13 @@ ...@@ -89,13 +89,13 @@
<th><label for="from">所属地区</label></th> <th><label for="from">所属地区</label></th>
<td> <td>
<select id="baseCity" name="baseCity"> <select id="baseCity" name="baseCity">
<option value=""> 城市</option> <option value="-1"> 城市</option>
{% for item in city %} {% for item in city %}
<option {{ item.id == result.city_id?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option> <option {{ item.id == result.city_id?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %} {% endfor %}
</select> </select>
<select id="baseAreaId" name="baseAreaId"> <select id="baseAreaId" name="baseAreaId">
<option value = "">区域</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>
...@@ -103,7 +103,7 @@ ...@@ -103,7 +103,7 @@
{% endif %} {% endif %}
</select> </select>
<select id="basePlateId" name="basePlateId"> <select id="basePlateId" name="basePlateId">
<option value = "">板块</option> <option value = "-1">板块</option>
{% if district %} {% if district %}
{% for item in plate %} {% for item in plate %}
<option {{ item.id == result.plate_id?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option> <option {{ item.id == result.plate_id?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
...@@ -336,6 +336,7 @@ ...@@ -336,6 +336,7 @@
var option = $("<option>").attr("value",cityId).append(cityName); var option = $("<option>").attr("value",cityId).append(cityName);
$("#cityId").append(option); $("#cityId").append(option);
var area = $("#areaId"); var area = $("#areaId");
if(cityId != -1){
$.ajax({ $.ajax({
type: "GET", type: "GET",
url: "/tospur/wp-admin/admin-ajax.php", url: "/tospur/wp-admin/admin-ajax.php",
...@@ -363,24 +364,9 @@ ...@@ -363,24 +364,9 @@
addOption(json,price); addOption(json,price);
} }
}); });
addList(2);
$.ajax({
type: "post",
url: "/tospur/wp-admin/admin-ajax.php",
data: "action=searchHouse&cityId="+cityId+"&houseType=2",
success:function(json){
var result = json.result;
for(var i = 0; i <result.length; i++){
var name = result[i]["name"];
var id = result[i]['id'];
var imgUrl = json.images[id];
var img = $("<img>").attr({"src":imgUrl,"height":100,"width":100});
var li = $("<li>").attr("id",id).addClass("addImg").append(img).append(name);
$("#houseList").append(li);
}
} }
}); });
});
//区域联动板块 //区域联动板块
...@@ -402,37 +388,7 @@ ...@@ -402,37 +388,7 @@
//推荐房源下显示图片信息以及房名 //推荐房源下显示图片信息以及房名
$("#areaId,#plateId,#buildProperty,#room,#acreage,#price").change(function(){ $("#areaId,#plateId,#buildProperty,#room,#acreage,#price").change(function(){
$("#houseList").find("li").remove(); addList(2);
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=2",
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 = json.images[id];
var img = $("<img>").attr({"src":imgUrl,"height":100,"width":100});
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);
}
}
}
});
}); });
//添加房源中搜索框的搜索 //添加房源中搜索框的搜索
...@@ -547,6 +503,9 @@ ...@@ -547,6 +503,9 @@
$("#houseImg,#consultantImg,#picList").on("click",".imgCancel,.consultantCancel,.picDelet",function(){ $("#houseImg,#consultantImg,#picList").on("click",".imgCancel,.consultantCancel,.picDelet",function(){
$(this).parent("p").remove(); $(this).parent("p").remove();
}); });
$("#picList,#houseImg,#consultantImg").on("click",".existsCancel",function(){
$(this).parent().remove();
});
$("#submit").click(function(){ $("#submit").click(function(){
if($("#housename").val()==""){ if($("#housename").val()==""){
...@@ -624,9 +583,42 @@ ...@@ -624,9 +583,42 @@
} }
return map; return map;
} }
$("#picList,#houseImg,#consultantImg").on("click",".existsCancel",function(){
$(this).parent().remove(); 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":100,"width":100});
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); })(jQuery);
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
<td> <input name="community_name" type="text" value="{{result.community_name}}" class="regular-text code" style="width: 150px;"></td> <td> <input name="community_name" type="text" value="{{result.community_name}}" class="regular-text code" style="width: 150px;"></td>
</tr> </tr>
<tr> <tr>
<th><label for="housename">标签:</label></th> <th><label for="mark">标签:</label></th>
<td> <input name="mark" id="mark" type="text" value="{{mark}}" class="regular-text code"></td> <td> <input name="mark" id="mark" type="text" value="{{mark}}" class="regular-text code"></td>
</tr> </tr>
{% if not houseId %} {% if not houseId %}
...@@ -93,13 +93,13 @@ ...@@ -93,13 +93,13 @@
<th><label for="from">所属地区</label></th> <th><label for="from">所属地区</label></th>
<td> <td>
<select id="baseCity" name="baseCity"> <select id="baseCity" name="baseCity">
<option value=""> 城市</option> <option value="-1"> 城市</option>
{% for item in city %} {% for item in city %}
<option {{ item.id == result.city_id?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option> <option {{ item.id == result.city_id?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %} {% endfor %}
</select> </select>
<select id="baseAreaId" name="baseAreaId"> <select id="baseAreaId" name="baseAreaId">
<option value = "">区域</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>
...@@ -107,7 +107,7 @@ ...@@ -107,7 +107,7 @@
{% endif %} {% endif %}
</select> </select>
<select id="basePlateId" name="basePlateId"> <select id="basePlateId" name="basePlateId">
<option value = "">板块</option> <option value = "-1">板块</option>
{% if district %} {% if district %}
{% for item in plate %} {% for item in plate %}
<option {{ item.id == result.plate_id?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option> <option {{ item.id == result.plate_id?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
...@@ -190,6 +190,23 @@ ...@@ -190,6 +190,23 @@
</td> </td>
</tr> </tr>
<tr> <tr>
<th><label for="feature">房源特色</label></th>
<td>
<div id="feature">
{% for item in featureOld %}
<p>
<span>{{ item.name }}</span>
<input type="button" value="删除" class="featureCancel existsCancel">
<input type="hidden" name="data[houseFeature][]" value="{{item.tag_id}}">
</p>
{% endfor %}
</div><br/>
<button type="button" class="button action" data-toggle="modal" data-target="#houseFeature" id="featureBt">
添加特色
</button>
</td>
</tr>
<tr>
<th><label for="consultant">置业顾问</label></th> <th><label for="consultant">置业顾问</label></th>
<td> <td>
<div id="consultantImg"> <div id="consultantImg">
...@@ -293,6 +310,24 @@ ...@@ -293,6 +310,24 @@
</div> </div>
</div> </div>
<!-- 房源特色出层 -->
<div class="modal fade" id="houseFeature" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<table class="form-table" id="featureTable">
<tbody>
<tr>
<th style="width: 45px"><label for="feature">特色:</label></th>
{% for item in feature %}
<td id="{{ item.id }}">{{ item.value }}</td>
{% endfor %}
</tr>
</tbody>
</table>
</div>
</div>
</div>
<script> <script>
(function($){ (function($){
...@@ -342,11 +377,12 @@ ...@@ -342,11 +377,12 @@
$("#houseList").find("li").remove(); $("#houseList").find("li").remove();
var acreage =$("#acreage"); var acreage =$("#acreage");
var price = $("#price"); var price = $("#price");
var area = $("#areaId");
var cityId = $("#baseCity").val(); var cityId = $("#baseCity").val();
var cityName = $("#baseCity").find("option:selected").text(); var cityName = $("#baseCity").find("option:selected").text();
var option = $("<option>").attr("value",cityId).append(cityName); var option = $("<option>").attr("value",cityId).append(cityName);
$("#cityId").append(option); $("#cityId").append(option);
var area = $("#areaId"); if(cityId != -1){
$.ajax({ $.ajax({
type: "GET", type: "GET",
url: "/tospur/wp-admin/admin-ajax.php", url: "/tospur/wp-admin/admin-ajax.php",
...@@ -374,23 +410,8 @@ ...@@ -374,23 +410,8 @@
addOption(json,price); addOption(json,price);
} }
}); });
addList(1)
$.ajax({
type: "post",
url: "/tospur/wp-admin/admin-ajax.php",
data: "action=searchHouse&cityId="+cityId+"&houseType=1",
success:function(json){
var result = json.result;
for(var i = 0; i <result.length; i++){
var name = result[i]["name"];
var id = result[i]['id'];
var imgUrl = json.images[id];
var img = $("<img>").attr({"src":imgUrl,"height":100,"width":100});
var li = $("<li>").attr("id",id).addClass("addImg").append(img).append(name);
$("#houseList").append(li);
} }
}
});
}); });
//区域联动板块 //区域联动板块
...@@ -412,37 +433,7 @@ ...@@ -412,37 +433,7 @@
//推荐房源下显示图片信息以及房名 //推荐房源下显示图片信息以及房名
$("#areaId,#plateId,#buildProperty,#room,#acreage,#price").change(function(){ $("#areaId,#plateId,#buildProperty,#room,#acreage,#price").change(function(){
$("#houseList").find("li").remove(); addList(1)
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=1",
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 = json.images[id];
var img = $("<img>").attr({"src":imgUrl,"height":100,"width":100});
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);
}
}
}
});
}); });
//添加房源中搜索框的搜索 //添加房源中搜索框的搜索
...@@ -501,8 +492,7 @@ ...@@ -501,8 +492,7 @@
url: "/tospur/wp-admin/admin-ajax.php", url: "/tospur/wp-admin/admin-ajax.php",
data: "action=searchConsultant&consulCityId="+consulCityId+"&consultantName="+consultantName, data: "action=searchConsultant&consulCityId="+consulCityId+"&consultantName="+consultantName,
success:function(json){ success:function(json){
for( for(var i = 0; i <=json.length-1; i++){
var i = 0; i <=json.length-1; i++){
var name = json[i]["consultantName"]; var name = json[i]["consultantName"];
var imgUrl = json[i]["imageUrl"]; var imgUrl = json[i]["imageUrl"];
var img = $("<img>").attr({"src":imgUrl,"height":100,"width":100}); var img = $("<img>").attr({"src":imgUrl,"height":100,"width":100});
...@@ -546,6 +536,15 @@ ...@@ -546,6 +536,15 @@
$("#picList").append(p); $("#picList").append(p);
i++ i++
}); });
//显示选中的特色
$("#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);
$("#feature").append(p);
});
//房源相册 //房源相册
$("#picList").on("change",".picFiles",function(){ $("#picList").on("change",".picFiles",function(){
...@@ -554,10 +553,14 @@ ...@@ -554,10 +553,14 @@
}); });
//删除房源相册、推荐房源、推荐置业顾问 //删除房源相册、推荐房源、推荐置业顾问
$("#houseImg,#consultantImg,#picList").on("click",".imgCancel,.consultantCancel,.picDelet",function(){ $("#houseImg,#consultantImg,#picList,#feature").on("click",".imgCancel,.consultantCancel,.picDelet,.featureCancel",function(){
$(this).parent("p").remove(); $(this).parent("p").remove();
}); });
$("#picList,#houseImg,#consultantImg").on("click",".existsCancel",function(){
$(this).parent().remove();
});
$("#submit").click(function(){ $("#submit").click(function(){
if($("#housename").val()==""){ if($("#housename").val()==""){
alert("请输入楼盘名"); alert("请输入楼盘名");
...@@ -635,9 +638,40 @@ ...@@ -635,9 +638,40 @@
return map; return map;
} }
$("#picList,#houseImg,#consultantImg").on("click",".existsCancel",function(){ function addList(houseType){
$(this).parent().remove(); $("#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":100,"width":100});
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); })(jQuery);
......
...@@ -179,6 +179,23 @@ class InsertDao{ ...@@ -179,6 +179,23 @@ class InsertDao{
} }
} }
} }
public static function addHouseFeature($houseId,$data){
global $wpdb;
if($data["houseFeature"]){
foreach($data["houseFeature"] as $val){
$a_house_feature = array(
"house_id" => $houseId,
"tag_id" =>$val
);
$a_house_featureRes = $wpdb->insert(Config::A_HOUSE_TAG_TABLE,$a_house_feature);
if(!$a_house_featureRes){
return 506;
}
}
}
}
public static function addHouseTag($tags, $house_id) public static function addHouseTag($tags, $house_id)
{ {
...@@ -212,11 +229,12 @@ class InsertDao{ ...@@ -212,11 +229,12 @@ class InsertDao{
} }
} }
//删除该房源的标签关联后,添加新的标签关联 //删除该房源的标签关联后,添加新的标签关联
$wpdb->delete( $wpdb->query(
'a_house_tag', $wpdb->prepare(
array( "DELETE FROM a_house_tag
'house_id' => $house_id 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 = 0);", $house_id)
); );
foreach ($tags_ids as $value) { foreach ($tags_ids as $value) {
$wpdb->insert( $wpdb->insert(
......
...@@ -168,7 +168,7 @@ class SearchDao ...@@ -168,7 +168,7 @@ class SearchDao
'index' => $_POST['index'] 'index' => $_POST['index']
) )
); );
$array = SearchDao::get_house_image_and_tags($house_result); $array = SearchDao::get_house_list($house_result);
wp_send_json($array); wp_send_json($array);
} }
...@@ -182,7 +182,7 @@ class SearchDao ...@@ -182,7 +182,7 @@ class SearchDao
if ($array['houseType'] == 0) { if ($array['houseType'] == 0) {
$addSql = " left join (select buildproperty_id,house_area,image_id,house_id as bph_id from a_district_area) ada on th.id = ada.bph_id". $addSql = " left join (select buildproperty_id,house_area,image_id,house_id as bph_id from a_district_area) ada on th.id = ada.bph_id".
" left join (select value as bp_value,literal as bp_literal from dic_buildproperty) dbp on ada.buildproperty_id = dbp.bp_value"; " left join (select value as bp_value,literal as bp_literal from dic_buildproperty) dbp on ada.buildproperty_id = dbp.bp_value";
$orderbySql = " group by ada.bph_id order by th.creattime DESC"; $orderbySql = " group by th.id order by th.creattime DESC";
}else if ($array['houseType'] == 1) { }else if ($array['houseType'] == 1) {
$addSql = " left join (select value as bp_value,literal as bp_literal from dic_buildproperty) dbp on th.buildproperty_id = dbp.bp_value"; $addSql = " left join (select value as bp_value,literal as bp_literal from dic_buildproperty) dbp on th.buildproperty_id = dbp.bp_value";
if ($array['feature'] > -1) { if ($array['feature'] > -1) {
...@@ -194,10 +194,13 @@ class SearchDao ...@@ -194,10 +194,13 @@ class SearchDao
$addSql = " left join (select value as bp_value,literal as bp_literal from dic_buildproperty) dbp on th.buildproperty_id = dbp.bp_value"; $addSql = " left join (select value as bp_value,literal as bp_literal from dic_buildproperty) dbp on th.buildproperty_id = dbp.bp_value";
$orderbySql = " order by th.creattime DESC"; $orderbySql = " order by th.creattime DESC";
} }
$sql = "select * from tospur_house th". $sql = "select *,(SELECT GROUP_CONCAT(left(tt.name,3)) from a_house_tag aht".
" LEFT JOIN tospur_tag tt on tt.id = aht.tag_id".
" where aht.house_id = th.id) as tags from tospur_house th".
$addSql. $addSql.
" left join dic_city dc on th.plate_id = dc.plateId". " left join dic_city dc on th.plate_id = dc.plateId".
" left join (select id as rid,value as r_value,literal from dic_room) dr on th.room_id = dr.r_value". " left join (select id as rid,value as r_value,literal from dic_room) dr on th.room_id = dr.r_value".
" left join (select id as image_id,path from tospur_image) ti on ti.image_id = th.frontCover_id".
" where 1=1"; " where 1=1";
if ($array['cityId'] > -1) { if ($array['cityId'] > -1) {
$params[] = $array['cityId']; $params[] = $array['cityId'];
...@@ -297,7 +300,7 @@ class SearchDao ...@@ -297,7 +300,7 @@ class SearchDao
return $result; return $result;
} }
public static function get_house_image_and_tags($house_result) public static function get_house_list($house_result)
{ {
$array = array(); $array = array();
if ($house_result) { if ($house_result) {
...@@ -306,19 +309,8 @@ class SearchDao ...@@ -306,19 +309,8 @@ class SearchDao
foreach ($house_result as $key => $value) { foreach ($house_result as $key => $value) {
$house_id = $value->id; $house_id = $value->id;
$house_ids[] = $house_id; $house_ids[] = $house_id;
} if($value->path){
$tag_result = SearchDao::search_house_tag($house_ids); $value->path = home_url() . Image::getImage($value->path,'small');
//标签
if ($tag_result) {
foreach ($tag_result as $key => $value) {
$array['tags'][$value->house_id][] = $value->name;
}
}
//图片
$image_result = SearchDao::search_house_image($house_ids);
if ($image_result) {
foreach ($image_result as $key => $value) {
$array['images'][$value->house_id] = home_url() . Image::getImage($value->path,'small');
} }
} }
$array['result'] = $house_result; $array['result'] = $house_result;
...@@ -328,30 +320,6 @@ class SearchDao ...@@ -328,30 +320,6 @@ class SearchDao
return $array; return $array;
} }
public static function search_house_image($house_ids)
{
$string = '(' . implode(',', array_map('intval', $house_ids)) . ')';
$sql = 'select * from (select ahi.house_id,ti.path,ti.image_type,case ti.image_type ' .
'when 1 then 1 ' .
'when 5 then 1 ' .
'ELSE 2 ' .
'end as type from ' . Config::A_HOUSE_IMAGE_TABLE . ' ahi ' .
'left join ' . Config::TOSPUR_IMAGE_TABLE . ' ti on ahi.image_id = ti.id ' .
'where house_id in ' . $string . ' order by type) as image group by house_id;';
global $wpdb;
return $wpdb->get_results($sql);
}
public static function search_house_tag($house_ids)
{
$string = '(' . implode(',', array_map('intval', $house_ids)) . ')';
$sql = 'select aht.house_id,tt.name from ' . Config::A_HOUSE_TAG_TABLE . ' aht' .
' left join ' . Config::TOSPUR_TAG_TABLE . ' tt on aht.tag_id = tt.id' .
' where house_id in ' . $string . ' and tt.type = 0;';
global $wpdb;
return $wpdb->get_results($sql);
}
public static function searchFeature() public static function searchFeature()
{ {
$sql = 'select id,name as value from '.Config::TOSPUR_TAG_TABLE.' where type = 1;'; $sql = 'select id,name as value from '.Config::TOSPUR_TAG_TABLE.' where type = 1;';
...@@ -400,22 +368,26 @@ class SearchDao ...@@ -400,22 +368,26 @@ class SearchDao
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,'small'); $value->path = Image::getImage($value->path,'big');
} }
$context['mainImage'] = $mainImage; $context['mainImage'] = $mainImage;
$recommendSql = "select th.id,th.name,th.average_price,th.latest_news,th.address,ti.path,dr.literal,(SELECT GROUP_CONCAT(left(tt.name,3)) from a_house_tag aht
LEFT JOIN tospur_tag tt on tt.id = aht.tag_id
where aht.house_id = th.id) as tags from tospur_house th
LEFT JOIN tospur_image ti on th.frontCover_id = ti.id
LEFT JOIN dic_room dr on dr.value = th.room_id
where th.id in(select recommend_id from a_house_recommend where house_id = %d);";
}else{
$recommendSql = "select th.id,th.name,th.community_name,ti.path,dr.value,th.rent,th.decoration,th.covered_area,th.total_price,(SELECT GROUP_CONCAT(left(tt.name,3)) from a_house_tag aht
LEFT JOIN tospur_tag tt on tt.id = aht.tag_id
where aht.house_id = th.id) as tags from tospur_house th
LEFT JOIN dic_room dr on dr.id = th.room_id
LEFT JOIN tospur_image ti on th.frontCover_id = ti.id
where th.id in(select recommend_id from a_house_recommend where house_id = %d);";
} }
$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)); $recommends = $wpdb->get_results($wpdb->prepare($recommendSql,$hid));
if(count($recommends) == 0){
$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 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));
}
foreach($recommends as $key => $value){ foreach($recommends as $key => $value){
$value->path = Image::getImage($value->path,'small'); $value->path = Image::getImage($value->path,'small');
} }
......
<?php <?php
require_once('const.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();
...@@ -15,8 +14,12 @@ if ($user_id != 0) { ...@@ -15,8 +14,12 @@ if ($user_id != 0) {
$context['consultant_mobile'] = $_GET['mobile']; $context['consultant_mobile'] = $_GET['mobile'];
$context['consultant_score_url'] = $const_score_page . '&consultant_id=' . $consultant_id; $context['consultant_score_url'] = $const_score_page . '&consultant_id=' . $consultant_id;
$context['default_head'] = get_avatar_url(1); $context['default_head'] = get_avatar_url(1);
Timber::render('consultant_info.html', $context);
}else{
wp_redirect($const_login_page);
exit;
} }
Timber::render('consultant_info.html', $context);
?> ?>
\ No newline at end of file
...@@ -4,21 +4,27 @@ $context = array(); ...@@ -4,21 +4,27 @@ $context = array();
$context['theme'] = get_template_directory_uri(); $context['theme'] = get_template_directory_uri();
$context['url'] = home_url(); $context['url'] = home_url();
require_once(WP_PLUGIN_DIR . "/tospur/Dao/SearchDao.php"); $current_user = wp_get_current_user();
$city = SearchDao::searchCity(); $user_id = $current_user->ID;
$context['city'] = $city; if ($user_id != 0) {
$city_id = $_GET['city_id']; require_once(WP_PLUGIN_DIR . "/tospur/Dao/SearchDao.php");
if (!isset($city_id)) { $city = SearchDao::searchCity();
$context['city'] = $city;
$city_id = $_GET['city_id'];
if (!isset($city_id)) {
$city_id = $city[0]->id; $city_id = $city[0]->id;
} }
foreach ($city as $value) { foreach ($city as $value) {
if ($value->id == $city_id) { if ($value->id == $city_id) {
$context['city_name'] = $value->value; $context['city_name'] = $value->value;
} }
} }
$context['city_id'] = $city_id; $context['city_id'] = $city_id;
$context['default_head'] = get_avatar_url(1); $context['default_head'] = get_avatar_url(1);
Timber::render('consultant_list.html', $context);
Timber::render('consultant_list.html', $context);
}else{
wp_redirect($const_login_page);
exit;
}
?> ?>
\ No newline at end of file
...@@ -399,7 +399,7 @@ body { ...@@ -399,7 +399,7 @@ body {
position: relative; position: relative;
} }
.addWrap .swipe .swipe-wrap div img { .addWrap .swipe .swipe-wrap div img {
max-width: 100%; width: 100%;
} }
.addWrap ul { .addWrap ul {
position: absolute; position: absolute;
...@@ -424,7 +424,7 @@ body { ...@@ -424,7 +424,7 @@ body {
opacity: 0.7; opacity: 0.7;
} }
.addWrap ul li.active { .addWrap ul li.active {
background-color: #ffffff; background-color: #898989;
} }
.detail_row { .detail_row {
width: 100%; width: 100%;
...@@ -745,7 +745,7 @@ body { ...@@ -745,7 +745,7 @@ body {
.footer ul li:nth-child(3) .btn.btn-wechat span:nth-child(1) { .footer ul li:nth-child(3) .btn.btn-wechat span:nth-child(1) {
width: 30px; width: 30px;
height: 30px; height: 30px;
background: url("../img/white_wechat_icon.png") no-repeat; background: url("../img/white_bespeak_icon.png") no-repeat;
background-size: cover; background-size: cover;
-webkit-background-size: cover; -webkit-background-size: cover;
margin: 0 auto; margin: 0 auto;
...@@ -758,7 +758,6 @@ body { ...@@ -758,7 +758,6 @@ body {
height: 100%; height: 100%;
position: relative; position: relative;
overflow: hidden; overflow: hidden;
background-color: #000000;
} }
.modal #carousel_wrapper #carousel_scroller { .modal #carousel_wrapper #carousel_scroller {
height: 100%; height: 100%;
...@@ -777,20 +776,6 @@ body { ...@@ -777,20 +776,6 @@ body {
padding: 0; padding: 0;
overflow: hidden; overflow: hidden;
} }
.modal #carousel_wrapper #carousel_scroller ul li p {
margin-bottom: 0;
width: 100%;
height: 100%;
display: table;
}
.modal #carousel_wrapper #carousel_scroller ul li p span {
display: table-cell;
vertical-align: middle;
text-align: center;
}
.modal #carousel_wrapper #carousel_scroller ul li p span img {
max-width: 100%;
}
.modal #carousel_wrapper .indicators { .modal #carousel_wrapper .indicators {
position: absolute; position: absolute;
bottom: 0; bottom: 0;
...@@ -816,3 +801,20 @@ body { ...@@ -816,3 +801,20 @@ body {
.modal #carousel_wrapper .indicators li.carousel_active { .modal #carousel_wrapper .indicators li.carousel_active {
opacity: 1; opacity: 1;
} }
.modal p {
margin-bottom: 0;
width: 100%;
height: 100%;
display: table;
}
.modal p span {
display: table-cell;
vertical-align: middle;
text-align: center;
}
.modal p span img {
max-width: 100%;
}
.modal-backdrop.in {
opacity: 1;
}
...@@ -565,8 +565,11 @@ a:hover { ...@@ -565,8 +565,11 @@ a:hover {
width: 100%; width: 100%;
height: 45px; height: 45px;
line-height: 45px; line-height: 45px;
background-color: rgba(255, 255, 255, 0.9);
}
.footer a {
color: #7d7d7d; color: #7d7d7d;
font-size: 20px; font-size: 20px;
font-weight: bold; font-weight: bold;
background-color: rgba(255, 255, 255, 0.9); display: block;
} }
...@@ -356,7 +356,19 @@ body { ...@@ -356,7 +356,19 @@ body {
a:hover { a:hover {
text-decoration: none; text-decoration: none;
} }
.tab-content .tab-pane ul li { #tabWrapper {
position: absolute;
z-index: 1;
top: 40px;
bottom: 0;
left: 0;
width: 100%;
overflow: hidden;
}
#tabWrapper #tabScroller {
padding-bottom: 15px;
}
#tabWrapper #tabScroller .tab-pane ul li {
width: 100%; width: 100%;
height: 60px; height: 60px;
line-height: 60px; line-height: 60px;
...@@ -364,10 +376,10 @@ a:hover { ...@@ -364,10 +376,10 @@ a:hover {
color: #898989; color: #898989;
font-size: 18px; font-size: 18px;
} }
.tab-content .tab-pane ul li:nth-child(odd) { #tabWrapper #tabScroller .tab-pane ul li:nth-child(odd) {
background-color: #ffffff; background-color: #ffffff;
} }
.tab-content .tab-pane ul li.arrow { #tabWrapper #tabScroller .tab-pane ul li.arrow {
width: 100%; width: 100%;
height: 60px; height: 60px;
background: url("../img/gray_leftarrow_icon.png") no-repeat; background: url("../img/gray_leftarrow_icon.png") no-repeat;
...@@ -375,17 +387,17 @@ a:hover { ...@@ -375,17 +387,17 @@ a:hover {
-webkit-background-size: 30px 30px; -webkit-background-size: 30px 30px;
background-position: 95% center; background-position: 95% center;
} }
.tab-content .tab-pane ul li label { #tabWrapper #tabScroller .tab-pane ul li label {
color: #000000; color: #000000;
margin-bottom: 0; margin-bottom: 0;
padding: 0 0 0 10px; padding: 0 0 0 10px;
} }
.tab-content .tab-pane ul li p { #tabWrapper #tabScroller .tab-pane ul li p {
margin-bottom: 0; margin-bottom: 0;
padding: 0; padding: 0;
height: 100%; height: 100%;
} }
.tab-content .tab-pane ul li p .form-control { #tabWrapper #tabScroller .tab-pane ul li p .form-control {
color: #898989; color: #898989;
font-size: 18px; font-size: 18px;
background-color: transparent; background-color: transparent;
...@@ -395,11 +407,16 @@ a:hover { ...@@ -395,11 +407,16 @@ a:hover {
-webkit-box-shadow: none; -webkit-box-shadow: none;
-webkit-appearance: none; -webkit-appearance: none;
} }
.tab-content .tab-pane > p { #tabWrapper #tabScroller .tab-pane ul li p .form-control::-webkit-outer-spin-button,
#tabWrapper #tabScroller .tab-pane ul li p .form-control::-webkit-inner-spin-button {
-webkit-appearance: none !important;
margin: 0;
}
#tabWrapper #tabScroller .tab-pane > p {
padding-right: 15px; padding-right: 15px;
color: #898989; color: #898989;
} }
.tab-content .tab-pane .btn { #tabWrapper #tabScroller .tab-pane .btn {
width: 86%; width: 86%;
display: block; display: block;
color: #ffffff; color: #ffffff;
...@@ -418,12 +435,12 @@ a:hover { ...@@ -418,12 +435,12 @@ 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;
} }
.tab-content .tab-pane .btn:active { #tabWrapper #tabScroller .tab-pane .btn:active {
background-color: #117bb9; background-color: #117bb9;
} }
.tab-content .tab-pane .btn:focus { #tabWrapper #tabScroller .tab-pane .btn:focus {
outline: 0; outline: 0;
} }
.tab-content .tab-pane:last-child .btn { #tabWrapper #tabScroller .tab-pane:last-child .btn {
margin-top: 5%; margin-top: 5%;
} }
...@@ -397,6 +397,11 @@ a:hover { ...@@ -397,6 +397,11 @@ a:hover {
.main ul li p .form-control::-webkit-input-placeholder { .main ul li p .form-control::-webkit-input-placeholder {
color: #7d7d7d; color: #7d7d7d;
} }
.main ul li p .form-control::-webkit-outer-spin-button,
.main ul li p .form-control::-webkit-inner-spin-button {
-webkit-appearance: none !important;
margin: 0;
}
.main ul li p .form-control.width-sm { .main ul li p .form-control.width-sm {
width: 45px; width: 45px;
} }
......
...@@ -109,10 +109,6 @@ function ajax_get_house(url, loading, ajax_data, context) { ...@@ -109,10 +109,6 @@ function ajax_get_house(url, loading, ajax_data, context) {
$.each(data.result, function (index, value) { $.each(data.result, function (index, value) {
var houseType = value.house_type; var houseType = value.house_type;
var template = $('#template_' + houseType).html(); var template = $('#template_' + houseType).html();
if (data.tags)
var data_tags = data.tags[value.id];
if (data.images)
var data_images = data.images[value.id];
var div = $('<div class="row">'); var div = $('<div class="row">');
div.append(template); div.append(template);
div.find('[data-attr=name]').text(value.name); div.find('[data-attr=name]').text(value.name);
...@@ -121,7 +117,12 @@ function ajax_get_house(url, loading, ajax_data, context) { ...@@ -121,7 +117,12 @@ function ajax_get_house(url, loading, ajax_data, context) {
div.find('[data-attr=type]').text(value.literal); div.find('[data-attr=type]').text(value.literal);
div.find('[data-attr=address]').text(value.address); div.find('[data-attr=address]').text(value.address);
div.find('[data-attr=latest_news]').text(value.latest_news); div.find('[data-attr=latest_news]').text(value.latest_news);
div.find('[data-attr=price]').html('<em>' + (value.average_price / 10000).toFixed(2) + '万</em>/m<em>2</em>'); var price = value.average_price;
if (price.length > 4) {
price = (price / 10000).toFixed(2) + '万';
}
div.find('[data-attr=price]').html('<em>' + rent + '</em>/月');
div.find('[data-attr=price]').html('<em>' + price + '</em>/m<em>2</em>');
} else if (houseType == 1) { } else if (houseType == 1) {
div.find('[data-attr=community]').text(value.community_name); div.find('[data-attr=community]').text(value.community_name);
div.find('[data-attr=apartment]').text(value.bp_literal); div.find('[data-attr=apartment]').text(value.bp_literal);
...@@ -134,16 +135,20 @@ function ajax_get_house(url, loading, ajax_data, context) { ...@@ -134,16 +135,20 @@ function ajax_get_house(url, loading, ajax_data, context) {
div.find('[data-attr=decoration]').text(value.decoration); div.find('[data-attr=decoration]').text(value.decoration);
var rent = value.rent; var rent = value.rent;
if (rent.length > 4) { if (rent.length > 4) {
rent = rent / 10000 + '万'; rent = (rent / 10000).toFixed(2) + '万';
} }
div.find('[data-attr=price]').html('<em>' + rent + '</em>/月'); div.find('[data-attr=price]').html('<em>' + rent + '</em>/月');
} }
var image = div.find('[data-attr=image]'); var image = div.find('[data-attr=image]');
if (data_images) { if (value.path){
image.attr('src', data_images); image.attr('src', value.path);
}else{
image.attr('src', url + '/wp-content/themes/tospur/img/img.jpg');
} }
if (data_tags) { if (value.tags) {
$.each(data_tags, function (k, v) { var tagsArray = value.tags.split(',');
console.log(tagsArray);
$.each(tagsArray, function (k, v) {
if (k < 3) { if (k < 3) {
tags.prepend('<span class="label">' + v + '</span>'); tags.prepend('<span class="label">' + v + '</span>');
} }
......
...@@ -23,8 +23,11 @@ if ($current_user_id != 0) { ...@@ -23,8 +23,11 @@ if ($current_user_id != 0) {
} else { } else {
$context['result'] = null; $context['result'] = null;
} }
}
Timber::render('list.html', $context); Timber::render('list.html', $context);
}else{
wp_redirect($const_login_page);
exit;
}
?> ?>
\ No newline at end of file
...@@ -8,6 +8,9 @@ $current_user = wp_get_current_user(); ...@@ -8,6 +8,9 @@ $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;
}else{
wp_redirect($const_login_page);
exit;
} }
Timber::render('myHouse.html', $context); Timber::render('myHouse.html', $context);
......
...@@ -19,7 +19,7 @@ if ($user_id != 0) { ...@@ -19,7 +19,7 @@ if ($user_id != 0) {
$context['consultant_id'] = $_GET['consultant_id']; $context['consultant_id'] = $_GET['consultant_id'];
Timber::render('view.html', $context); Timber::render('view.html', $context);
}else{ }else{
wp_redirect(home_url()."?page=login"); wp_redirect($const_login_page);
exit; exit;
} }
......
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
$(document).ready(function(){ $(document).ready(function(){
$("#slider").bind("tap",function(){ $("#slider").bind("tap",function(){
$("#carousel_wrapper").parent().show(); $("#carouselModal").modal('show');
var carousel = $("#carousel_wrapper"); var carousel = $("#carousel_wrapper");
var carouselWidth = carousel.width(); var carouselWidth = carousel.width();
...@@ -66,8 +66,8 @@ ...@@ -66,8 +66,8 @@
}); });
return false; return false;
}); });
$("#carousel_wrapper").parent().bind("click",function(){ $("#carouselModal,#photoModal").bind("click",function(){
$(this).hide(); $(this).modal('hide');
return false; return false;
}); });
...@@ -93,13 +93,22 @@ ...@@ -93,13 +93,22 @@
$(".map").bind("tap",function(){ $(".map").bind("tap",function(){
location.href = "{{ siteUrl }}/?page=map&a={{result.address}}&c={{cityName}}&hn={{result.community_name}}<br>{{result.address}}&p={{result.location}}"; location.href = "{{ siteUrl }}/?page=map&a={{result.address}}&c={{cityName}}&hn={{result.community_name}}<br>{{result.address}}&p={{result.location}}";
}); });
$(".recommendCont").on("tap",".row",function(){
window.location.href = '{{ siteUrl }}/?page=detail&hid=' + $(this).attr("data-id");
});
$("#scroller").on("tap","*[data-image-url]",function(){
$("#photoModal").find("img").eq(0).attr("src",$(this).attr("data-image-url"));
$("#photoModal").modal("show");
return false;
});
}); });
</script> </script>
</head> </head>
<body> <body>
<p class="collect"> <p class="collect"></p>
</p>
<!-- 图片滚动 --> <!-- 图片滚动 -->
<div class="addWrap"> <div class="addWrap">
...@@ -129,9 +138,9 @@ ...@@ -129,9 +138,9 @@
{% if result.average_price>=10000 %} {% if result.average_price>=10000 %}
{{(result.average_price/10000)|round(2, 'floor')}}万 {{(result.average_price/10000)|round(2, 'floor')}}万
{% else %} {% else %}
{{result.average_price}} {{result.average_price}}
{% endif %} {% endif %}
</em>/m<em>2</em></span> </em>m<em>2</em></span>
</li> </li>
<li class="col-xs-5"> <li class="col-xs-5">
<button type="button" class="btn btn-xs" id="calculator">房贷计算器</button> <button type="button" class="btn btn-xs" id="calculator">房贷计算器</button>
...@@ -148,10 +157,10 @@ ...@@ -148,10 +157,10 @@
<div id="scroller"> <div id="scroller">
<ul class="list-inline text-nowrap"> <ul class="list-inline text-nowrap">
{% for item in mainImage %} {% for item in mainImage %}
<li> <li data-image-url="{{siteUrl}}{{ item.path }}">
<p><img src="{{siteUrl}}{{ item.path }}"></p> <p><img src="{{siteUrl}}{{ item.path }}"></p>
<p>{{item.type}}</p> <p>{{item.type}}</p>
<p>{{item.area}}/m<em>2</em></p> <p>{{item.area}}m<em>2</em></p>
</li> </li>
{% endfor %} {% endfor %}
</ul> </ul>
...@@ -197,19 +206,43 @@ ...@@ -197,19 +206,43 @@
{{result.overview}} {{result.overview}}
</p> </p>
</div> </div>
<div class="detail_row"> <div class="detail_row recommend">
<p class="detail_title pull-left">推荐房源</p>
<div class="detail_row recommend">
<p class="detail_title">推荐房源</p> <p class="detail_title">推荐房源</p>
<div class="recommendCont"> <div class="recommendCont">
</div>
</div>
<ul class="list-unstyled recommendCont">
{% for item in recommends %} {% for item in recommends %}
<a href="{{siteUrl}}?page=detail&hid={{item.id}}"><li class="col-xs-3"><p style="background-image:url({{siteUrl}}{{ item.path }});"></p></li></a> <div data-id="{{item.id}}" class="row">
<p>
{% if item.path %}
<img src="{{siteUrl}}{{item.path}}">
{% else %}
<img src="{{siteUrl}}/wp-content/themes/tospur/img/img.jpg">
{% endif %}
</p>
<ul class="list-unstyled">
<li class="address">
<span>{{item.name}}</span>
<span class="pull-right">{{item.literal}}</span>
</li>
<li>{{item.address}}</li>
<li>{{item.latest_news}}</li>
<li>
{% for tag in item.tags|split(',') %}
<span class="label">{{tag}}</span>
{% endfor %} {% endfor %}
<span class="pull-right">
<em>
{% if item.average_price>=10000 %}
{{(item.average_price/10000)|round(2, 'floor')}}万
{% else %}
{{item.average_price}}元
{% endif %}
</em>/m<em>2</em>
</span>
</li>
</ul> </ul>
</div>
{% endfor %}
</div>
</div> </div>
<div class="detail_row" id="consultantDiv"> <div class="detail_row" id="consultantDiv">
<p class="detail_title">置业顾问</p> <p class="detail_title">置业顾问</p>
...@@ -267,7 +300,7 @@ ...@@ -267,7 +300,7 @@
<!-- 二手房详细 --> <!-- 二手房详细 -->
</footer> </footer>
<div class="modal"> <div class="modal" id="carouselModal">
<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">
...@@ -287,6 +320,10 @@ ...@@ -287,6 +320,10 @@
</ul> </ul>
</div> </div>
</div> </div>
<div class="modal" id="photoModal">
<p>
<span><img></span>
</p>
</div>
</body> </body>
</html> </html>
\ No newline at end of file
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
$(document).ready(function(){ $(document).ready(function(){
$("#slider").bind("tap",function(){ $("#slider").bind("tap",function(){
$("#carousel_wrapper").parent().show(); $("#carouselModal").modal("show");
var carousel = $("#carousel_wrapper"); var carousel = $("#carousel_wrapper");
var carouselWidth = carousel.width(); var carouselWidth = carousel.width();
carousel.find("#carousel_scroller ul li").css({"width":carouselWidth}); carousel.find("#carousel_scroller ul li").css({"width":carouselWidth});
...@@ -65,8 +65,8 @@ ...@@ -65,8 +65,8 @@
}); });
return false; return false;
}); });
$("#carousel_wrapper").parent().bind("click",function(){ $("#carouselModal").bind("click",function(){
$(this).hide(); $("#carouselModal").modal("hide");
return false; return false;
}); });
...@@ -96,13 +96,17 @@ ...@@ -96,13 +96,17 @@
$(".col-xs-2").bind("tap",function(){ $(".col-xs-2").bind("tap",function(){
location.href = "{{siteUrl}}?page=consultant_info&consultant_id={{ consultant[0].id }}"; location.href = "{{siteUrl}}?page=consultant_info&consultant_id={{ consultant[0].id }}";
}); });
$(".recommendCont").on("tap",".row",function(){
window.location.href = '{{ siteUrl }}/?page=detail&hid=' + $(this).attr("data-id");
});
}); });
</script> </script>
</head> </head>
<body> <body>
<p class="collect"> <p class="collect">
<i class="iconfont">&#xe604;</i> <i class="iconfont"></i>
</p> </p>
<!-- 图片滚动 --> <!-- 图片滚动 -->
...@@ -138,6 +142,7 @@ ...@@ -138,6 +142,7 @@
<!-- 二手房详细 --> <!-- 二手房详细 -->
<ul class="list-unstyled"> <ul class="list-unstyled">
<li class="col-xs-7">房源编号:{{result.house_number}}</li> <li class="col-xs-7">房源编号:{{result.house_number}}</li>
{% if result.house_type == 1%}
<li class="col-xs-5"> <li class="col-xs-5">
<button type="button" class="btn btn-xs" id="calculator">房贷计算器</button> <button type="button" class="btn btn-xs" id="calculator">房贷计算器</button>
</li> </li>
...@@ -148,9 +153,16 @@ ...@@ -148,9 +153,16 @@
{% if result.average_price>=10000 %} {% if result.average_price>=10000 %}
{{(result.average_price/10000)|round(2, 'floor')}}万 {{(result.average_price/10000)|round(2, 'floor')}}万
{% else %} {% else %}
{{result.average_price}}元 {{result.average_price}}
{% endif %} {% endif %}
</li> </li>
{% else %}
<li class="col-xs-5">
</li>
<li class="col-xs-7 price">
租金:<span><em>{{result.rent}}/月</em></span>
</li>
{% endif %}
</ul> </ul>
<!-- 二手房详细 --> <!-- 二手房详细 -->
</div> </div>
...@@ -168,27 +180,75 @@ ...@@ -168,27 +180,75 @@
</ul> </ul>
</div> </div>
<div class="detail_row"> <div class="detail_row">
<p class="detail_title">房源点评</p> <a class="collapsed" data-toggle="collapse" href="#collapseSummary" aria-expanded="false">
<p>{{result.overview}}</p> <p class="detail_title">房源点评<span class="pull-right"></span></p>
</a>
<p class="collapse" id="collapseSummary" style="min-height: 60px; display: block; overflow: hidden; height: 0px;" aria-expanded="false">
{{result.overview}}
</p>
</div> </div>
<div class="detail_row"> <div class="detail_row">
<p class="detail_title">位置及周边</p> <a class="collapsed" data-toggle="collapse" href="#collapseAddress">
<ul class="list-unstyled"> <p class="detail_title">位置及周边<span class="pull-right"></span></p>
</a>
<ul class="list-unstyled collapse" id="collapseAddress" style="min-height:60px;display:block;overflow:hidden;height:0;">
<li>地址:{{result.address}}</li> <li>地址:{{result.address}}</li>
<li>交通线路:{{result.traffic}}</li> <li>交通线路:{{result.traffic}}</li>
<li>周边配套:{{result.periphery}}</li> <li>周边配套:{{result.periphery}}</li>
</ul> </ul>
<p class="map"> <p class="map"></p>
<span></span>
</p>
</div> </div>
<div class="detail_row"> <div class="detail_row recommend">
<p class="detail_title pull-left">推荐房源</p> <p class="detail_title">推荐房源</p>
<ul class="list-unstyled recommendCont"> <div class="recommendCont">
{% for item in recommends %} {% for item in recommends %}
<a href="{{siteUrl}}?page=detail&hid={{item.id}}"><li class="col-xs-3"><p style="background-image:url({{siteUrl}}{{ item.path }});"></p></li></a> <div data-id="{{item.id}}" class="row">
<p>
{% if item.path %}
<img src="{{siteUrl}}{{item.path}}">
{% else %}
<img src="{{siteUrl}}/wp-content/themes/tospur/img/img.jpg">
{% endif %}
</p>
<ul class="list-unstyled">
<li class="multiLine_omit">
{{item.name}}
</li>
<li>{{item.community_name}}</li>
<li>
<span>{{item.value}}</span>
{% if result.house_type == 2 %}
<span>{{item.decoration}}</span>
{% endif %}
<span>{{item.covered_area}}平米</span>
</li>
<li>
{% for tag in item.tags|split(',') %}
{% if loop.index <=3 %}
<span class="label">{{tag}}</span>
{% endif %}
{% endfor %} {% endfor %}
<span class="pull-right">
{% if result.house_type == 1 %}
<em>
{{(item.total_price/10000)|round(2, 'floor')}}万
</em>
{% elseif result.house_type == 2 %}
<em>
{% if item.rent>=10000 %}
{{(item.rent/10000)|round(2, 'floor')}}万
{% else %}
{{item.rent}}
{% endif %}
/月
</em>
{% endif %}
</span>
</li>
</ul> </ul>
</div>
{% endfor %}
</div>
</div> </div>
{% if consultant[0] %} {% if consultant[0] %}
<footer class="footer navbar-fixed-bottom"> <footer class="footer navbar-fixed-bottom">
...@@ -218,17 +278,17 @@ ...@@ -218,17 +278,17 @@
<span>电话联系</span> <span>电话联系</span>
</a> </a>
{% endif %} {% endif %}
<!--<a href="#" class="btn btn-wechat"> <a href="{{siteUrl}}?page=view&house_id={{hid}}&consultant_id={{consultant[0].id}}" class="btn btn-wechat">
<span></span> <span></span>
<span>微信联系</span> <span>一键预约</span>
</a>--> </a>
</li> </li>
</ul> </ul>
<!-- 二手房详细 --> <!-- 二手房详细 -->
</footer> </footer>
{% endif %} {% endif %}
<div class="modal"> <div class="modal" id="carouselModal">
<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">
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<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"/>
<meta name="format-detection" content="telephone=no"/> <meta name="format-detection" content="telephone=no"/>
<title>列表</title> <title>{% if houseType == 0%}新房列表{% elseif houseType == 1 %}二手房列表{% elseif houseType == 2 %}租房列表{% endif %}</title>
<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/list.css"> <link rel="stylesheet" type="text/css" href="{{ theme }}/css/list.css">
<script type="text/javascript" src="{{ theme }}/js/iscroll.js"></script> <script type="text/javascript" src="{{ theme }}/js/iscroll.js"></script>
...@@ -29,8 +29,10 @@ ...@@ -29,8 +29,10 @@
</div> </div>
</div> </div>
<div class="has-feedback pull-right"> <div class="has-feedback pull-right">
<form id="searchForm" method="post">
<input type="text" class="form-control" placeholder="输入楼盘名/地段名搜索" id="searchText"> <input type="text" class="form-control" placeholder="输入楼盘名/地段名搜索" id="searchText">
<span class="glyphicon glyphicon-search form-control-feedback" id="searchBtn"></span> <span class="glyphicon glyphicon-search form-control-feedback" id="searchBtn"></span>
</form>
</div> </div>
</div> </div>
...@@ -309,7 +311,6 @@ ...@@ -309,7 +311,6 @@
other.children(":first").addClass('active'); other.children(":first").addClass('active');
} }
$.each(other_item,function(i,item){ $.each(other_item,function(i,item){
console.log(searchData[id]+"=="+item[roomAndAcreageKey]);
var active = searchData[id]==item[roomAndAcreageKey]?' class="active"':''; var active = searchData[id]==item[roomAndAcreageKey]?' class="active"':'';
other.append('<a data-id="'+item[roomAndAcreageKey]+'"'+active+'>'+item.value+'</a>'); other.append('<a data-id="'+item[roomAndAcreageKey]+'"'+active+'>'+item.value+'</a>');
}); });
...@@ -330,13 +331,20 @@ ...@@ -330,13 +331,20 @@
} }
}); });
$('#searchBtn').bind('tap',function(){ $('#searchBtn').bind('tap',function(){
searchNameAndAddress();
});
$('#searchForm').submit(function(){
searchNameAndAddress();
return false;
});
ajax_get_house('{{ url }}', loading, searchData, scroller);
});
function searchNameAndAddress(){
searchData.index = 0; searchData.index = 0;
searchData.searchText = $('#searchText').val(); searchData.searchText = $('#searchText').val();
scroller.html(''); scroller.html('');
ajax_get_house('{{ url }}', loading, searchData, scroller); ajax_get_house('{{ url }}', loading, searchData, scroller);
}); }
ajax_get_house('{{ url }}', loading, searchData, scroller);
});
var searchData = { var searchData = {
action: 'search_house', action: 'search_house',
cityId: {{ cityId }}, cityId: {{ cityId }},
......
...@@ -35,8 +35,9 @@ ...@@ -35,8 +35,9 @@
</li> </li>
</ul> </ul>
<div class="tab-content"> <div id="tabWrapper">
<div class="tab-pane fade in active" id="commerce_loan"> <div id="tabScroller" class="tab-content">
<div class="tab-pane fade in active" id="commerce_loan">
<ul class="list-unstyled"> <ul class="list-unstyled">
<li> <li>
<label class="col-xs-3">房价总额:</label> <label class="col-xs-3">房价总额:</label>
...@@ -113,9 +114,9 @@ ...@@ -113,9 +114,9 @@
</ul> </ul>
<p class="text-right">商业贷款利率5.40%</p> <p class="text-right">商业贷款利率5.40%</p>
<input type="submit" value="开始计算" class="btn btn-lg"> <input type="submit" value="开始计算" class="btn btn-lg">
</div> </div>
<div class="tab-pane fade" id="accumulationFund_loan"> <div class="tab-pane fade" id="accumulationFund_loan">
<ul class="list-unstyled"> <ul class="list-unstyled">
<li> <li>
<label class="col-xs-3">房价总额:</label> <label class="col-xs-3">房价总额:</label>
...@@ -192,9 +193,9 @@ ...@@ -192,9 +193,9 @@
</ul> </ul>
<p class="text-right">公积金贷款利率3.50%</p> <p class="text-right">公积金贷款利率3.50%</p>
<input type="submit" value="开始计算" class="btn btn-lg"> <input type="submit" value="开始计算" class="btn btn-lg">
</div> </div>
<div class="tab-pane fade" id="combined_loan"> <div class="tab-pane fade" id="combined_loan">
<ul class="list-unstyled"> <ul class="list-unstyled">
<li> <li>
<label class="col-xs-3">房价总额:</label> <label class="col-xs-3">房价总额:</label>
...@@ -310,7 +311,8 @@ ...@@ -310,7 +311,8 @@
</ul> </ul>
<p class="text-right">公积金贷款利率3.50% 商业贷款利率5.40%</p> <p class="text-right">公积金贷款利率3.50% 商业贷款利率5.40%</p>
<input type="submit" value="开始计算" class="btn btn-lg"> <input type="submit" value="开始计算" class="btn btn-lg">
</div> </div>
</div>
</div> </div>
</div> </div>
<div class="pt-page pt-page-2"> <div class="pt-page pt-page-2">
...@@ -352,7 +354,18 @@ ...@@ -352,7 +354,18 @@
<script> <script>
var daikuan_money = 0; var daikuan_money = 0;
var page = 0; var page = 0;
var flag = false;
var tabScroll;
$(document).ready(function () { $(document).ready(function () {
tabScroll = new IScroll('#tabWrapper',{
click: true
});
$('#tab a').click(function(){
tabScroll.scrollTo(0,0);
setTimeout(function(){
tabScroll.refresh();
},200);
});
var notice = $('#notice'); var notice = $('#notice');
var myModal = $('#myModal'); var myModal = $('#myModal');
$('[data-id=fangjia_money]').change(function () { $('[data-id=fangjia_money]').change(function () {
...@@ -390,8 +403,6 @@ ...@@ -390,8 +403,6 @@
var commerce_year = Number(tab.find('[data-id=commerce_year]').val()); var commerce_year = Number(tab.find('[data-id=commerce_year]').val());
var accumulationFund_result = loan_calc(accumulationFund_money, accumulationFund_year, 3.5); var accumulationFund_result = loan_calc(accumulationFund_money, accumulationFund_year, 3.5);
var commerce_result = loan_calc(commerce_money, commerce_year, rate); var commerce_result = loan_calc(commerce_money, commerce_year, rate);
console.log(accumulationFund_result);
console.log(commerce_result);
$('#money').text('贷款总额:' + (accumulationFund_money + commerce_money).toFixed(2) + '万元'); $('#money').text('贷款总额:' + (accumulationFund_money + commerce_money).toFixed(2) + '万元');
$('#acpi_interest').text(Math.round(accumulationFund_result.acpi.interest + commerce_result.acpi.interest)); $('#acpi_interest').text(Math.round(accumulationFund_result.acpi.interest + commerce_result.acpi.interest));
$('#ac_interest').text(Math.round(accumulationFund_result.ac.interest + commerce_result.ac.interest)); $('#ac_interest').text(Math.round(accumulationFund_result.ac.interest + commerce_result.ac.interest));
...@@ -446,20 +457,21 @@ ...@@ -446,20 +457,21 @@
animation: 1, animation: 1,
showPage: page showPage: page
}); });
flag = true;
} }
return false; return false;
}); });
window.addEventListener("popstate", function(e) { if (window.location.hash == '#result') {
window.history.back();
}
window.addEventListener("popstate", function (e) {
if (window.location.hash == '' && page == 1) { if (window.location.hash == '' && page == 1) {
console.log(page);
page = 0; page = 0;
PageTransitions.nextPage({ PageTransitions.nextPage({
animation: 2, animation: 2,
showPage: page showPage: page
}); });
}else if(page == 0){
window.history.back();
} }
}); });
}); });
......
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