Commit 9734ab07 by shz

tospur

parent f65f4c8f
...@@ -132,9 +132,9 @@ class consultantScoreList extends WP_List_Table ...@@ -132,9 +132,9 @@ class consultantScoreList extends WP_List_Table
//$data = $this->example_data; //$data = $this->example_data;
$sql = "SELECT s.id,c.display_name as consultant,u.user_login as user,s.score,s.valid FROM tospur_consultant_score s " . $sql = "SELECT s.id,c.name as consultant,u.user_login as user,s.score,s.valid FROM tospur_consultant_score s" .
"left join wp_users u on s.user_id = u.ID " . " left join wp_users u on s.user_id = u.ID" .
"left join wp_users c on s.consultant_id = c.ID"; " left join tospur_consultant c on s.consultant_id = c.id";
$result = $wpdb->get_results($sql); $result = $wpdb->get_results($sql);
$data = array(); $data = array();
foreach ($result as $key => $value) { foreach ($result as $key => $value) {
......
...@@ -88,7 +88,7 @@ class customer extends Tospur_House ...@@ -88,7 +88,7 @@ class customer extends Tospur_House
$current_user = wp_get_current_user(); $current_user = wp_get_current_user();
$context['role'] = $current_user->roles[0]; $context['role'] = $current_user->roles[0];
if ($context['role'] == 'author') { if ($context['role'] == 'zygw') {
$context['consultant_id'] = $current_user->ID; $context['consultant_id'] = $current_user->ID;
} }
$context['city'] = SearchDao::searchCity(); $context['city'] = SearchDao::searchCity();
......
<?php <?php
$house_id = $_GET['id']; global $wpdb;
$house_sql = 'SELECT v.id, h.name, u.user_login as phone, v.date, v.time, v.consultant_id as consultant_id, v.handle, v.handle_date FROM tospur_view_house v '
$id = $_GET['id'];
$role_flag = current_user_can('zygw');
if (isset($_POST['submit']) && !$role_flag) {
$consultant_id = $_POST['data']['recConsultant'][0];
if (isset($consultant_id) && $consultant_id != null && isset($id)) {
$result = TospurDao::update_view_house_consultant($id, $consultant_id);
} else {
echo '<script>alert("请选择置业顾问")</script>';
}
} else if (isset($_POST['handle']) && $role_flag) {
$wpdb->update('tospur_view_house',
array(
'handle' => 1,
'handle_date' => current_time('Y-m-d H:i:s'),
),
array('id' => $id)
);
}
$house_sql = 'SELECT v.id,h.name,h.city_id as cityId,u.user_login as phone,v.date,v.time,v.consultant_id as consultant_id,v.handle,v.handle_date,c.imageUrl,c.name as consultant_name FROM tospur_view_house v '
. 'left join tospur_house h on v.house_id = h.id ' . 'left join tospur_house h on v.house_id = h.id '
. 'left join wp_users u on v.user_id = u.id ' . 'left join wp_users u on v.user_id = u.id '
. 'where v.id = ' . $house_id; . 'left join tospur_consultant c on v.consultant_id = c.id '
$consultant_sql = 'SELECT u.id,u.display_name FROM wp_users u ' . 'where v.id = ' . $id;
. 'left join wp_usermeta m on u.id=m.user_id where meta_key="wp_user_level" and meta_value=7;';
global $wpdb;
$context['house_result'] = $wpdb->get_row($house_sql); $context['role_flag'] = $role_flag;
$context['consultant_result'] = $wpdb->get_results($consultant_sql); $context['city'] = SearchDao::searchCity();
$result = $wpdb->get_row($house_sql);
$context['url'] = home_url(); if ($result->consultant_id && !$role_flag) {
$context['id'] = $house_id; $context['consultant'][0] = array(
'id' => $result->consultant_id,
'imageUrl' => $result->imageUrl,
'name' => $result->consultant_name
);
}
$context['cityId'] = $result->cityId;
$context['page'] = 'view';
$context['house_result'] = $result;
Timber::render('handle.html', $context); Timber::render('handle.html', $context);
......
...@@ -92,18 +92,21 @@ class viewHouseList extends WP_List_Table ...@@ -92,18 +92,21 @@ class viewHouseList extends WP_List_Table
$this->_column_headers = array($columns, $hidden); $this->_column_headers = array($columns, $hidden);
$sql = 'SELECT v.id, h.name, u.user_login as phone, v.date, v.time, c.display_name as consultant, v.handle, v.handle_date FROM tospur_view_house v ' $sql = 'SELECT v.id, h.name, u.user_login as phone, v.date, v.time, c.name as consultant, v.handle, v.handle_date FROM tospur_view_house v '
. 'left join tospur_house h on v.house_id = h.id ' . 'left join tospur_house h on v.house_id = h.id '
. 'left join wp_users u on v.user_id = u.id ' . 'left join wp_users u on v.user_id = u.id '
. 'left join wp_users c on v.consultant_id = c.id ' . 'left join tospur_consultant c on v.consultant_id = c.id';
. 'order by handle'; if (current_user_can('zygw')) {
$sql .= " where c.id = " . get_current_user_id();
}
$sql .= ' order by handle';
$result = $wpdb->get_results($sql); $result = $wpdb->get_results($sql);
$data = array(); $data = array();
foreach ($result as $key => $value) { foreach ($result as $key => $value) {
$data[$key] = array( $data[$key] = array(
'id' => $value->id, 'id' => $value->id,
'name' => $value->name, 'name' => $value->name,
'date' => $value->date.' '.$value->time, 'date' => $value->date . ' ' . $value->time,
'phone' => $value->phone, 'phone' => $value->phone,
'consultant' => $value->consultant, 'consultant' => $value->consultant,
'handle' => $value->handle, 'handle' => $value->handle,
......
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
row.append(left).append(mid).append(right); row.append(left).append(mid).append(right);
var p = $("<p>").append(row).append(recommendConsultant); var p = $("<p>").append(row).append(recommendConsultant);
$("#consultantImg").append(p); $("#consultantImg").append(p);
{% if (house_type == 1 or house_type == 2 or page == 'customer') %} {% if (house_type == 1 or house_type == 2 or page == 'customer' or page == 'view') %}
controlCommand("consultantImg",1,1); controlCommand("consultantImg",1,1);
{% endif %} {% endif %}
} }
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
<li role="presentation"> <li role="presentation">
<a href="#customer_tracking" aria-controls="customer_tracking" role="tab" data-toggle="tab">房源跟进</a> <a href="#customer_tracking" aria-controls="customer_tracking" role="tab" data-toggle="tab">房源跟进</a>
</li> </li>
{% if role == 'administrator' or role == 'editor' %} {% if role != 'zygw' %}
<li role="presentation"> <li role="presentation">
<a href="#addConsultant" aria-controls="addConsultant" role="tab" data-toggle="tab">置业顾问</a> <a href="#addConsultant" aria-controls="addConsultant" role="tab" data-toggle="tab">置业顾问</a>
</li> </li>
...@@ -40,12 +40,12 @@ ...@@ -40,12 +40,12 @@
{% include 'save_customer_tracking.html' %} {% include 'save_customer_tracking.html' %}
{{ macro.customer_tracking_list(houseId, 2) }} {{ macro.customer_tracking_list(houseId, 2) }}
</div> </div>
{% if role == 'administrator' or role == 'editor' %} {% if role == 'zygw' %}
<input type="hidden" name="data[recConsultant][]" value="{{ consultant_id }}">
{% else %}
<div role="tabpanel" class="tab-pane" id="addConsultant"> <div role="tabpanel" class="tab-pane" id="addConsultant">
{% include 'addConsultant.html' %} {% include 'addConsultant.html' %}
</div> </div>
{% elseif role == 'author' %}
<input type="hidden" name="consultant_id" value="{{ consultant_id }}">
{% endif %} {% endif %}
</div> </div>
{% if houseId %} {% if houseId %}
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
</div> </div>
<div class="col-md-1"> <div class="col-md-1">
<input type="submit" id="submit" class="button action" style="position: fixed;"> <input type="submit" id="submit" class="button action" style="position: fixed;">
{% if role == 'administrator' or role == 'editor' %} {% if role != 'zygw' %}
<div class="row" style="position: fixed;top:50px;"> <div class="row" style="position: fixed;top:50px;">
<select id="status" name="status"> <select id="status" name="status">
{% for item in status %} {% for item in status %}
......
<div class="wrap"> <div class="wrap">
<h2>客户列表</h2> <h2>客户列表</h2>
<form method="get"> <form method="get" id="search_form">
<input type="hidden" name="page" value="customerList"> <input type="hidden" name="page" value="customerList">
<div id="search_form"> <div>
<input type="hidden" name="hasSearch" value="1"/> <input type="hidden" name="hasSearch" value="1"/>
{% include 'selectOrganization.html' %}
<label for="status" class="hidden"></label> <label for="status" class="hidden"></label>
<select name="status" id="status"> <select name="status" id="status">
<option value="-1">状态</option> <option value="-1">状态</option>
{% for item in status %} {% set customer_status_array = function('SearchDao::searchStatusType', 5) %}
<option {{ item.id == status_id ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option> {% for item in customer_status_array %}
<option {{ item.id == req.status ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %} {% endfor %}
</select> </select>
<label for="customer_type" class="hidden"></label> <label for="customer_type" class="hidden"></label>
<select name="customer_type" id="customer_type"> <select name="customer_type" id="customer_type">
<option value="-1">客户类型</option> <option value="-1">客户类型</option>
{% for item in customer_type %} {% set customer_type_array = function('SearchDao::searchStatusType', 6) %}
<option {{ item.id == customer_type_id ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option> {% for item in customer_type_array %}
<option {{ item.id == req.customer_type ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %} {% endfor %}
</select> </select>
<label for="demand_type" class="hidden"></label> <label for="demand_type" class="hidden"></label>
...@@ -29,74 +32,80 @@ ...@@ -29,74 +32,80 @@
<select id="listCity" name="listCity"> <select id="listCity" name="listCity">
<option value="-1"> 城市</option> <option value="-1"> 城市</option>
{% for item in city %} {% for item in city %}
<option {{ item.id == cityId ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option> <option {{ item.id == req.listCity ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %} {% endfor %}
</select> </select>
<label for="listDistrict" class="hidden"></label> <label for="listDistrict" class="hidden"></label>
<select id="listDistrict" name="listDistrict"> <select id="listDistrict" name="listDistrict">
<option value="-1">区域</option> <option value="-1">区域</option>
{% set district = function('SearchDao::searchCity', req.listCity) %}
{% if district %} {% if district %}
{% for item in district %} {% for item in district %}
<option {{ item.id == districtId ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option> <option {{ item.id == req.listDistrict ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %} {% endfor %}
{% endif %} {% endif %}
</select> </select>
<label for="listPlate" class="hidden"></label> <label for="listPlate" class="hidden"></label>
<select id="listPlate" name="listPlate"> <select id="listPlate" name="listPlate">
<option value="-1">板块</option> <option value="-1">板块</option>
{% set plate = function('SearchDao::searchCity', req.listCity, req.listDistrict) %}
{% if plate %} {% if plate %}
{% for item in plate %} {% for item in plate %}
<option {{ item.id == plateId ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option> <option {{ item.id == req.listPlate ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %} {% endfor %}
{% endif %} {% endif %}
</select> </select>
<label for="totalPrice" class="hidden"></label> <label for="totalPrice" class="hidden"></label>
<select id="totalPrice" name="totalPrice" class="hidden"> <select id="totalPrice" name="totalPrice" class="hidden">
<option value="">总价</option> <option value="-1">总价</option>
{% set dicTotalPrice = function('SearchDao::searchTotalPrice', req.listCity) %}
{% if dicTotalPrice %} {% if dicTotalPrice %}
{% for item in dicTotalPrice %} {% for item in dicTotalPrice %}
<option {{ item.value == totalPrice ?"selected":"" }} value="{{ item.value }}">{{ item.value }}</option> <option {{ item.value == req.totalPrice ?"selected":"" }} value="{{ item.value }}">{{ item.value }}</option>
{% endfor %} {% endfor %}
{% endif %} {% endif %}
</select> </select>
<label for="rentalPrice" class="hidden"></label> <label for="rentalPrice" class="hidden"></label>
<select id="rentalPrice" name="rentalPrice" class="hidden"> <select id="rentalPrice" name="rentalPrice" class="hidden">
<option value ="">月租</option> <option value ="-1">月租</option>
{% set dicRentalPrice = function('SearchDao::searchRentalPrice', req.listCity) %}
{% if dicRentalPrice %} {% if dicRentalPrice %}
{% for item in dicRentalPrice %} {% for item in dicRentalPrice %}
<option {{ item.value == rentalPrice ?"selected":"" }} value="{{ item.value }}">{{ item.value }}</option> <option {{ item.value == req.rentalPrice ?"selected":"" }} value="{{ item.value }}">{{ item.value }}</option>
{% endfor %} {% endfor %}
{% endif %} {% endif %}
</select> </select>
<label for="buildProperty" class="hidden"></label> <label for="buildProperty" class="hidden"></label>
<select id="buildProperty" name="buildProperty"> <select id="buildProperty" name="buildProperty">
<option value="-1">房型</option> <option value="-1">房型</option>
{% for item in buildProperty %} {% set buildProperty_array = function('SearchDao::searchBuildProperty') %}
<option {{ item.id == buildPropertyId ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option> {% for item in buildProperty_array %}
<option {{ item.id == req.buildProperty ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %} {% endfor %}
</select> </select>
<label for="acreage" class="hidden"></label> <label for="acreage" class="hidden"></label>
<select id="acreage" name="acreage"> <select id="acreage" name="acreage">
<option value="">面积</option> <option value="-1">面积</option>
{% if acreage %} {% set dicArea = function('SearchDao::searchArea', req.listCity) %}
{% if dicArea %}
{% for item in dicArea %} {% for item in dicArea %}
<option {{ item.value == acreage ?"selected":"" }} value="{{ item.value }}">{{ item.value }}</option> <option {{ item.value == req.acreage ?"selected":"" }} value="{{ item.value }}">{{ item.value }}</option>
{% endfor %} {% endfor %}
{% endif %} {% endif %}
</select> </select>
</div> </div>
<div style="margin-top: 10px;"> <div style="margin-top: 10px;">
<input type="text" placeholder="请输入姓名" name="search_name" value="{{ search_name }}"> <input type="text" placeholder="请输入姓名" name="search_name" value="{{ req.search_name }}">
<input type="text" placeholder="请输入置业顾问" name="search_consultant_name" value="{{ search_consultant_name }}"> <input type="text" placeholder="请输入置业顾问" name="search_consultant_name" value="{{ req.search_consultant_name }}">
<input type="text" placeholder="请输入电话" name="search_phone" value="{{ search_phone }}"> <input type="text" placeholder="请输入电话" name="search_phone" value="{{ req.search_phone }}">
</div> </div>
<div style="margin-top: 10px;"> <div style="margin-top: 10px;">
<span>日期</span> <label>日期:</label>
<label for="search_min_time" class="hidden"></label> <label for="search_min_time" class="hidden"></label>
<input type="date" name="search_min_time" id="search_min_time" value="{{ search_min_time }}"> <input type="date" name="search_min_time" id="search_min_time" value="{{ req.search_min_time }}">
<label for="search_max_time" class="hidden"></label> <label for="search_max_time" class="hidden"></label>
<input type="date" name="search_max_time" id="search_max_time" value="{{ search_max_time }}"> <input type="date" name="search_max_time" id="search_max_time" value="{{ req.search_max_time }}">
<input type="submit" id="submit" class="button action" value="搜索"> <input type="submit" id="submit" class="button action" value="搜索">
</div> </div>
</form> </form>
...@@ -110,7 +119,7 @@ ...@@ -110,7 +119,7 @@
<script> <script>
$(document).ready(function () { $(document).ready(function () {
var demand_type_select = $('#demand_type'); var demand_type_select = $('#demand_type');
demand_type_select.val('{{ demand_type }}'); demand_type_select.val('{{ req.demand_type|default(-1) }}');
search_form_set_page(); search_form_set_page();
var acreage = $("#acreage"); var acreage = $("#acreage");
...@@ -157,5 +166,16 @@ ...@@ -157,5 +166,16 @@
} }
allot_consultant('customerlist'); allot_consultant('customerlist');
$('form').submit(function () {
var organization = getOrganization();
var select = $('select[data-depth]:not(.hidden)');
if (select.length > 1 && organization == -1) {
alert('请选择门店');
return false;
} else {
$(this).append('<input type="hidden" name="organization" value="' + organization + '">');
}
});
}); });
</script> </script>
\ No newline at end of file
<div class="wrap"> <div class="wrap">
<h2>签约-房客跟进</h2> <h2>签约-房客跟进</h2>
<form method="get">
<form method="get" id="search_form">
<input type="hidden" name="page" value="customerTrackingList"> <input type="hidden" name="page" value="customerTrackingList">
<div id="search_form">
<div>
{% include 'selectOrganization.html' %}
<label for="status_type" class="hidden"></label> <label for="status_type" class="hidden"></label>
<select name="status_type" id="status_type"> <select name="status_type" id="status_type">
<option value="-1">跟进类型</option> <option value="-1">跟进类型</option>
{% for item in status %} {% for item in status %}
<option <option
{{ item.id == status_type ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option> {{ item.id == (req.status_type) ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %} {% endfor %}
</select> </select>
<label for="search_consultant_name" class="hidden"></label> <label for="search_consultant_name" class="hidden"></label>
<input type="text" placeholder="请输入置业顾问" name="search_consultant_name" id="search_consultant_name" <input type="text" placeholder="请输入置业顾问" name="search_consultant_name" id="search_consultant_name"
value="{{ search_consultant_name }}"> value="{{ req.search_consultant_name }}">
<span>日期</span> <label>日期:</label>
<label for="search_min_time" class="hidden"></label> <label for="search_min_time" class="hidden"></label>
<input type="date" name="search_min_time" id="search_min_time" value="{{ search_min_time }}"> <input type="date" name="search_min_time" id="search_min_time" value="{{ req.search_min_time }}">
<label for="search_max_time" class="hidden"></label> <label for="search_max_time" class="hidden"></label>
<input type="date" name="search_max_time" id="search_max_time" value="{{ search_max_time }}"> <input type="date" name="search_max_time" id="search_max_time" value="{{ req.search_max_time }}">
<input type="submit" id="submit" class="button action" value="搜索"> <input type="submit" id="submit" class="button action" value="搜索">
</div> </div>
</form>
<form method="post">
{{ function("addCustomerTrackingTable") }} {{ function("addCustomerTrackingTable") }}
</form> </form>
</div> </div>
<script> <script>
$(document).ready(function () { $(document).ready(function () {
search_form_set_page(); search_form_set_page();
$('form').submit(function () {
var organization = getOrganization();
var select = $('select[data-depth]:not(.hidden)');
if (select.length > 1 && organization == -1) {
alert('请选择门店');
return false;
} else {
$(this).append('<input type="hidden" name="organization" value="' + organization + '">');
}
});
}); });
</script> </script>
\ No newline at end of file
<!DOCTYPE html> <style>
<html> .handle ul {
<head lang="en"> margin-top: 30px;
<meta charset="UTF-8">
<title></title>
<style></style>
<script>
(function ($) {
$(document).ready(function () {
$('#handle').click(function () {
var consultant_id = $('#consultant option:selected').val();
$.ajax({
type: 'POST',
url: '{{ url }}/wp-admin/admin-ajax.php/',
data: 'action=update_consultant&id={{ id }}&consultant_id=' + consultant_id,
success: function (data) {
if (data.code == 2000) {
alert('提交处理成功');
} else {
alert('提交处理失败');
} }
.handle ul li {
margin: 20px 0;
} }
}); .handle ul li span:nth-of-type(1) {
}); font-weight: bold;
}); font-size: 14px;
})(jQuery); display: inline-block;
</script> width: 120px;
</head> }
<body> .handle ul li span:nth-of-type(2) {
<div> font-size: 14px;
display: inline-block;
width: 400px;
}
</style>
<form method="post">
<div class="handle">
<ul> <ul>
<li>楼盘名/房源名:{{ house_result.name }}</li> <li>
<li>用户:{{ house_result.phone }}</li> <span>楼盘名/房源名:</span>
<li>预约时间:{{ house_result.date }} {{ house_result.time }}</li> <span>{{ house_result.name }}</span>
</li>
<li>
<span>用户:</span>
<span>{{ house_result.phone }}</span>
</li>
<li>
<span>预约时间:</span>
<span>{{ house_result.date }} {{ house_result.time }}</span>
</li>
</ul> </ul>
</div> {% if role_flag %}
<label for="consultant"></label> <input type="hidden" name="handle" value="1">
<select id="consultant"> {% else %}
{% for consultant in consultant_result %} {% include 'addConsultant.html' %}
<option value="{{ consultant.id }}" <input type="hidden" id="baseCity" value="{{ cityId }}">
{% if(house_result.consultant_id==consultant.id) %}selected="selected"{% endif %}>{{ consultant.display_name }}</option> <input type="hidden" name="submit" value="1">
{% endfor %} {% include 'recConsultant.html' %}
</select> {{ block('recConsultant') }}
<button id="handle">提交处理</button> {% endif %}
</body> <input type="submit" id="handle" class="button action" value="提交处理">
</html> </div>
\ No newline at end of file </form>
\ No newline at end of file
...@@ -17,16 +17,6 @@ ...@@ -17,16 +17,6 @@
width: 400px; width: 400px;
} }
</style> </style>
<script>
(function ($) {
$(document).ready(function () {
$('#handle').click(function () {
var consultant_id = $('#consultant').find('option:selected').val();
alert(consultant_id);
});
});
})(jQuery);
</script>
{% if house_type == 1 %} {% if house_type == 1 %}
{% set unit = '万元' %} {% set unit = '万元' %}
{% set price = '售价' %} {% set price = '售价' %}
......
{% if function('current_user_can', 'zygw') %}
<style> <style>
.customer_tracking h2 { .customer_tracking h2 {
margin-bottom: 30px; margin-bottom: 30px;
...@@ -40,3 +41,4 @@ ...@@ -40,3 +41,4 @@
</span> </span>
</p> </p>
</div> </div>
{% endif %}
\ No newline at end of file
...@@ -6,6 +6,7 @@ class CustomerTrackingDao ...@@ -6,6 +6,7 @@ class CustomerTrackingDao
{ {
public static function insert($house_id, $request) public static function insert($house_id, $request)
{ {
if(current_user_can('zygw')){
$page = $request['page']; $page = $request['page'];
$origin = 0; $origin = 0;
switch ($page) { switch ($page) {
...@@ -34,6 +35,7 @@ class CustomerTrackingDao ...@@ -34,6 +35,7 @@ class CustomerTrackingDao
return '新增客户跟踪失败'; return '新增客户跟踪失败';
} }
} }
}
public static function search($house_id, $origin) public static function search($house_id, $origin)
{ {
......
...@@ -379,7 +379,9 @@ class SearchDao ...@@ -379,7 +379,9 @@ class SearchDao
$mainImage = $wpdb->get_results($wpdb->prepare($mainImagesSql,$hid)); $mainImage = $wpdb->get_results($wpdb->prepare($mainImagesSql,$hid));
foreach($mainImage as $key => $value){ foreach($mainImage as $key => $value){
$value->path = Image::getImage($value->path,'big'); $path = $value->path;
$value->path = Image::getImage($path,'big');
$value->smallPath = Image::getImage($path,'small');
} }
$context['mainImage'] = $mainImage; $context['mainImage'] = $mainImage;
...@@ -424,11 +426,12 @@ class SearchDao ...@@ -424,11 +426,12 @@ class SearchDao
} }
$images = $wpdb->get_results($wpdb->prepare($imagesSql,$hid,$hid)); $images = $wpdb->get_results($wpdb->prepare($imagesSql,$hid,$hid));
foreach($images as $key => $value){ foreach($images as $key => $value){
$value->path = Image::getImage($value->path,'big'); $path = $value->path;
$value->path = Image::getImage($path,'big');
$context['normalImages'][]->path = Image::getImage($path,'normal');
} }
$context['images'] = $images; $context['images'] = $images;
return $context; return $context;
} }
......
...@@ -93,7 +93,7 @@ class TospurDao ...@@ -93,7 +93,7 @@ class TospurDao
{ {
global $wpdb; global $wpdb;
$sql = 'select c.id, c.cityId, c.mobile, c.imageUrl, c.name as display_name, c.introduction, s.average_score from ' . Config::TOSPUR_CONSULTANT . ' c ' . $sql = 'select c.id, c.cityId, c.mobile, c.imageUrl, c.name as display_name, c.introduction, s.average_score from ' . Config::TOSPUR_CONSULTANT . ' c ' .
'left join (select consultant_id,sum(score)/count(score) as average_score from ' . Config::TOSPUR_CONSULTANT_SCORE_TABLE . ' group by consultant_id) s ' . 'left join (select consultant_id,sum(score)/count(score) as average_score from ' . Config::TOSPUR_CONSULTANT_SCORE_TABLE . ' where valid = 1 group by consultant_id) s ' .
'on c.id = s.consultant_id where c.id = ' . $consultant_id; 'on c.id = s.consultant_id where c.id = ' . $consultant_id;
return $wpdb->get_row($sql); return $wpdb->get_row($sql);
} }
......
...@@ -43,11 +43,22 @@ ...@@ -43,11 +43,22 @@
}); });
},false); },false);
var sliderTap = false;
$("#slider").bind("tap",function(){ $("#slider").bind("tap",function(){
$("#carouselModal").modal('show'); $("#carouselModal").modal('show');
var carousel = $("#carousel_wrapper"); var carousel = $("#carousel_wrapper");
var carouselWidth = carousel.width(); var carouselWidth = carousel.width();
if (!sliderTap) {
$.each(JSON.parse('{{ images|json_encode() }}'), function (index, item) {
carousel.find('#carousel_scroller ul').append('<li><p><span>' +
'<img src="{{ siteUrl }}' + item.path + '">' +
'</span></p></li>');
$('#carousel_indicator').append('<li/>');
});
}
carousel.find("#carousel_scroller ul li").css({"width":carouselWidth}); carousel.find("#carousel_scroller ul li").css({"width":carouselWidth});
carousel.find("#carousel_indicator li").removeClass("carousel_active"); carousel.find("#carousel_indicator li").removeClass("carousel_active");
carousel.find("#carousel_indicator li:first").addClass("carousel_active"); carousel.find("#carousel_indicator li:first").addClass("carousel_active");
...@@ -64,6 +75,7 @@ ...@@ -64,6 +75,7 @@
$("#carousel_indicator li").removeClass("carousel_active"); $("#carousel_indicator li").removeClass("carousel_active");
$("#carousel_indicator li").eq(this.currentPage.pageX).addClass("carousel_active"); $("#carousel_indicator li").eq(this.currentPage.pageX).addClass("carousel_active");
}); });
sliderTap = true;
return false; return false;
}); });
$("#carouselModal,#photoModal").bind("click",function(){ $("#carouselModal,#photoModal").bind("click",function(){
...@@ -114,7 +126,7 @@ ...@@ -114,7 +126,7 @@
<div class="addWrap"> <div class="addWrap">
<div id="slider" class="swipe"> <div id="slider" class="swipe">
<div class="swipe-wrap"> <div class="swipe-wrap">
{% for item in images %} {% for item in normalImages %}
<div> <div>
<img src="{{siteUrl}}{{item.path}}"> <img src="{{siteUrl}}{{item.path}}">
</div> </div>
...@@ -122,7 +134,7 @@ ...@@ -122,7 +134,7 @@
</div> </div>
</div> </div>
<ul id="indicator" class="list-inline text-center"> <ul id="indicator" class="list-inline text-center">
{% for i in 1..images|length %} {% for i in 1..normalImages|length %}
<li {% if loop.index0 == 0 %}class="active"{% endif %}></li> <li {% if loop.index0 == 0 %}class="active"{% endif %}></li>
{% endfor %} {% endfor %}
</ul> </ul>
...@@ -158,7 +170,7 @@ ...@@ -158,7 +170,7 @@
<ul class="list-inline text-nowrap"> <ul class="list-inline text-nowrap">
{% for item in mainImage %} {% for item in mainImage %}
<li data-image-url="{{siteUrl}}{{ item.path }}"> <li data-image-url="{{siteUrl}}{{ item.path }}">
<p><img src="{{siteUrl}}{{ item.path }}"></p> <p><img src="{{siteUrl}}{{ item.smallPath }}"></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>
...@@ -308,19 +320,9 @@ ...@@ -308,19 +320,9 @@
<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">
{% for item in images %}
<li>
<p>
<span><img src="{{siteUrl}}{{item.path}}"></span>
</p>
</li>
{% endfor %}
</ul> </ul>
</div> </div>
<ul id="carousel_indicator" class="list-inline text-center indicators"> <ul id="carousel_indicator" class="list-inline text-center indicators">
{% for i in 1..images|length %}
<li></li>
{% endfor %}
</ul> </ul>
</div> </div>
</div> </div>
......
...@@ -42,10 +42,21 @@ ...@@ -42,10 +42,21 @@
}); });
},false); },false);
var sliderTap = false;
$("#slider").bind("tap",function(){ $("#slider").bind("tap",function(){
$("#carouselModal").modal("show"); $("#carouselModal").modal("show");
var carousel = $("#carousel_wrapper"); var carousel = $("#carousel_wrapper");
var carouselWidth = carousel.width(); var carouselWidth = carousel.width();
if (!sliderTap) {
$.each(JSON.parse('{{ images|json_encode() }}'), function (index, item) {
carousel.find('#carousel_scroller ul').append('<li><p><span>' +
'<img src="{{ siteUrl }}' + item.path + '">' +
'</span></p></li>');
$('#carousel_indicator').append('<li/>');
});
}
carousel.find("#carousel_scroller ul li").css({"width":carouselWidth}); carousel.find("#carousel_scroller ul li").css({"width":carouselWidth});
carousel.find("#carousel_indicator li").removeClass("carousel_active"); carousel.find("#carousel_indicator li").removeClass("carousel_active");
carousel.find("#carousel_indicator li:first").addClass("carousel_active"); carousel.find("#carousel_indicator li:first").addClass("carousel_active");
...@@ -113,7 +124,7 @@ ...@@ -113,7 +124,7 @@
<div class="addWrap"> <div class="addWrap">
<div id="slider" class="swipe"> <div id="slider" class="swipe">
<div class="swipe-wrap"> <div class="swipe-wrap">
{% for item in images %} {% for item in normalImages %}
<div> <div>
<img src="{{siteUrl}}{{item.path}}"> <img src="{{siteUrl}}{{item.path}}">
</div> </div>
...@@ -121,7 +132,7 @@ ...@@ -121,7 +132,7 @@
</div> </div>
</div> </div>
<ul id="indicator" class="list-inline text-center"> <ul id="indicator" class="list-inline text-center">
{% for i in 1..images|length %} {% for i in 1..normalImages|length %}
<li {% if loop.index0 == 0 %}class="active"{% endif %}></li> <li {% if loop.index0 == 0 %}class="active"{% endif %}></li>
{% endfor %} {% endfor %}
</ul> </ul>
...@@ -294,19 +305,9 @@ ...@@ -294,19 +305,9 @@
<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">
{% for item in images %}
<li>
<p>
<span><img src="{{siteUrl}}{{item.path}}"></span>
</p>
</li>
{% endfor %}
</ul> </ul>
</div> </div>
<ul id="carousel_indicator" class="list-inline text-center indicators"> <ul id="carousel_indicator" class="list-inline text-center indicators">
{% for i in 1..images|length %}
<li></li>
{% endfor %}
</ul> </ul>
</div> </div>
</div> </div>
......
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