Commit 1103c7a0 by shz

first commit

parent 768a71cc
<?php
class TCSync {
const user_url = 'http://218.1.67.130:8988/api/NanTongWechat/GetPropertyConsultant?cityId=1';
public static function user_sync(){
$response = wp_remote_post( TCSync::user_url );
$res = array(
'code' => 200,
'msg' => "success"
);
//判断请求是否成功
if( is_wp_error( $response ) || wp_remote_retrieve_response_code( $response ) !== 200 ){
$res['code'] = 500;
$res['msg'] = "get user info error";
}else{
set_time_limit(0) ;
//获取请求内容
$result = wp_remote_retrieve_body( $response );
$result = json_decode($result,true);
foreach($result['data'] as $item){
if(username_exists($item['WorkNum'])){
$user = get_user_by( "login", $item['WorkNum'] );
$userdata = array(
'ID' => $user->data->ID,
'display_name' => $item['Name']
);
$user_id = wp_update_user( $userdata ) ;
}else{
$userdata = array(
'user_login' => $item['WorkNum'],
'user_pass' => $item['WorkNumAndID'], // When creating an user, `user_pass` is expected.
'role' => 'editor',
'wp_user_level' => 7,
'display_name' => $item['Name']
);
$user_id = wp_insert_user( $userdata ) ;
}
if(is_numeric($user_id) && !is_null($item['ImageUrl'])){
update_user_meta( $user_id, "tc_image", $item['ImageUrl'] );
}
}
}
return $res;
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: UGEN79
* Date: 2015/8/6
* Time: 16:51
*/
if (!class_exists('WP_List_Table')) {
require_once(ABSPATH . 'wp-admin/includes/class-wp-list-table.php');
}
class consultantScoreList extends WP_List_Table
{
function __construct()
{
global $status, $page;
//Set parent defaults
parent::__construct(array(
'singular' => 'score', //singular name of the listed records
'plural' => 'scores', //plural name of the listed records
'ajax' => false //does this table support ajax?
));
}
function column_default($item, $column_name)
{
switch ($column_name) {
case 'id':
case 'consultant':
case 'user':
case 'score':
return $item[$column_name];
case 'valid':
if ($item[$column_name]) {
return '<button data-valid="0" data-score-id="' . $item['id'] . '">设为无效</button>';
} else {
return '<button data-valid="1" data-score-id="' . $item['id'] . '">设为有效</button>';
}
default:
return print_r($item, true); //Show the whole array for troubleshooting purposes
}
}
function column_cb($item)
{
return sprintf(
'<input type="checkbox" name="%1$s[]" value="%2$s" />',
/*$1%s*/
$this->_args['singular'], //Let's simply repurpose the table's singular label ("score")
/*$2%s*/
$item['id'] //The value of the checkbox should be the record's id
);
}
function get_columns()
{
$columns = array(
'cb' => '<input type="checkbox" />', //Render a checkbox instead of text
'id' => 'ID',
'consultant' => '置业顾问',
'user' => '用户',
'score' => '评分',
'valid' => '状态'
);
return $columns;
}
function get_sortable_columns()
{
$sortable_columns = array(
'id' => array('id', false),
'consultant' => array('consultant', false),
'user' => array('user', false),
'score' => array('score', false),
'valid' => array('valid', false)
);
return $sortable_columns;
}
function get_bulk_actions()
{
$actions = array(
'invalid' => '设为无效',
'valid' => '设为有效',
);
return $actions;
}
function process_bulk_action()
{
$action = $this->current_action();
if ($action) {
$string = null;
$valid = null;
switch ($action) {
case 'invalid':
$score = $_GET['score'];
if ($score) {
$string = '(' . implode(',', array_map('intval', $score)) . ')';
$valid = 0;
}
break;
case 'valid':
$score = $_GET['score'];
if ($score) {
$valid = 1;
$string = '(' . implode(',', array_map('intval', $score)) . ')';
}
break;
}
global $wpdb;
$result = $wpdb->query('update tospur_consultant_score SET valid=' . $valid . ' where id in ' . $string);
}
}
function prepare_items()
{
global $wpdb;
$per_page = 5;
$columns = $this->get_columns();
$hidden = array();
$sortable = $this->get_sortable_columns();
$this->_column_headers = array($columns, $hidden, $sortable);
$this->process_bulk_action();
//$data = $this->example_data;
$sql = "SELECT s.id,c.user_login 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 c on s.consultant_id = c.ID";
$result = $wpdb->get_results($sql);
$data = array();
foreach ($result as $key => $value) {
$data[$key] = array(
'id' => $value->id,
'consultant' => $value->consultant,
'user' => $value->user,
'score' => $value->score,
'valid' => $value->valid,
);
}
function usort_reorder($a, $b)
{
$orderby = (!empty($_REQUEST['orderby'])) ? $_REQUEST['orderby'] : 'valid'; //If no sort, default to title
$order = (!empty($_REQUEST['order'])) ? $_REQUEST['order'] : 'desc'; //If no order, default to asc
$result = strcmp($a[$orderby], $b[$orderby]); //Determine sort order
return ($order === 'asc') ? $result : -$result; //Send final sort direction to usort
}
usort($data, 'usort_reorder');
$current_page = $this->get_pagenum();
$total_items = count($data);
$data = array_slice($data, (($current_page - 1) * $per_page), $per_page);
$this->items = $data;
$this->set_pagination_args(array(
'total_items' => $total_items, //WE have to calculate the total number of items
'per_page' => $per_page, //WE have to determine how many items to show on a page
'total_pages' => ceil($total_items / $per_page) //WE have to calculate the total number of pages
));
}
}
function add_consultant_score_menu()
{
add_menu_page('置业顾问评分', '置业顾问评分', 'activate_plugins', 'consultant_score', 'consultant_score_page', 'dashicons-menu', 26);
}
add_action('admin_menu', 'add_consultant_score_menu');
function consultant_score_page()
{
$consultantScoreList = new consultantScoreList();
$consultantScoreList->prepare_items();
?>
<div class="wrap">
<h2>置业顾问评分列表</h2>
<form id="scores-filter" method="get">
<!-- For plugins, we also need to ensure that the form posts back to our current page -->
<input type="hidden" name="page" value="<?php echo $_REQUEST['page'] ?>"/>
<!-- Now we can render the completed list table -->
<?php $consultantScoreList->display() ?>
</form>
</div>
<script>
(function ($) {
$('button[data-score-id]').click(function () {
var self = $(this);
var score_id = $(this).data('score-id');
var valid = $(this).data('valid');
$.ajax({
type: 'POST',
url: '<?php echo admin_url()?>admin-ajax.php/',
data: 'action=valid_consultant_score&id=' + score_id + '&valid=' + valid,
success: function (data) {
if (data.code == 2000) {
if (valid == 0) {
self.text('设为有效');
self.data('valid', 1);
} else {
self.text('设为无效');
self.data('valid', 0);
}
alert('设置成功');
} else {
alert('设置失败');
}
}
});
return false;
});
})(jQuery);
</script>
<?php
}
?>
\ No newline at end of file
<?php
$house_id = $_GET['id'];
$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 view_house v '
. 'left join tospur_house h on v.house_id = h.id '
. 'left join wp_users u on v.user_id = u.id '
. 'where v.id = ' . $house_id;
$consultant_sql = 'SELECT u.id,u.display_name FROM wp_users u '
. '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['consultant_result'] = $wpdb->get_results($consultant_sql);
$context['url'] = home_url();
$context['id'] = $house_id;
Timber::render('views/handle.html', $context);
?>
\ No newline at end of file
<?php
/*
Plugin Name: tospur
Plugin URI:
Description: tospur
Version: 1.0
Author: Sun
Author URI:
*/
add_action('init', 'tospur_init');
function tospur_init()
{
require_once('consultant_score.php');
require_once('view_house.php');
}
//后台处理 置业顾问
add_action('wp_ajax_update_consultant', 'update_consultant');
function update_consultant()
{
$house_id = $_POST['id'];
$consultant_id = $_POST['consultant_id'];
if (isset($consultant_id) && isset($house_id)) {
$result = dao::update_view_house_consultant($house_id, $consultant_id);
$array = array();
if ($result) {
$array['code'] = 2000;
} else {
$array['code'] = 2001;
}
wp_send_json($array);
}
}
//后台处理 置业顾问评分
add_action('wp_ajax_valid_consultant_score', 'valid_consultant_score');
function valid_consultant_score()
{
$score_id = $_POST['id'];
$valid = $_POST['valid'];
if (isset($score_id) && isset($valid)) {
$result = dao::update_consultant_score($score_id, $valid);
$array = array();
if ($result) {
$array['code'] = 2000;
} else {
$array['code'] = 2001;
}
wp_send_json($array);
}
}
?>
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: UGEN79
* Date: 2015/8/6
* Time: 16:51
*/
if (!class_exists('WP_List_Table')) {
require_once(ABSPATH . 'wp-admin/includes/class-wp-list-table.php');
}
class viewHouseList extends WP_List_Table
{
function __construct()
{
global $status, $page;
//Set parent defaults
parent::__construct(array(
'singular' => 'house', //singular name of the listed records
'plural' => 'houses', //plural name of the listed records
'ajax' => false //does this table support ajax?
));
}
function column_default($item, $column_name)
{
switch ($column_name) {
case 'name':
$handle = $item['handle'];
if ($handle == 0) {
return '<a href="' . admin_url() . 'admin.php?page=view_house&id=' . $item['id'] . '">' . $item[$column_name] . '</a>';
} else {
return $item[$column_name];
}
case 'handle':
$handle = $item[$column_name];
if ($handle == 1) {
return '已处理';
} else {
return '未处理';
}
case 'handle_date':
$handle = $item['handle'];
if ($handle == 1) {
return $item[$column_name];
} else {
return false;
}
default:
return $item[$column_name];
}
}
function column_title($item)
{
//Build row actions
$actions = array(
'edit' => sprintf('<a href="?page=%s&action=%s&house=%s">Edit</a>', $_REQUEST['page'], 'edit', $item['ID']),
'delete' => sprintf('<a href="?page=%s&action=%s&house=%s">Delete</a>', $_REQUEST['page'], 'delete', $item['ID']),
);
//Return the title contents
return sprintf('%1$s <span style="color:silver">(id:%2$s)</span>%3$s',
/*$1%s*/
$item['title'],
/*$2%s*/
$item['ID'],
/*$3%s*/
$this->row_actions($actions)
);
}
function column_cb($item)
{
return sprintf(
'<input type="checkbox" name="%1$s[]" value="%2$s" />',
/*$1%s*/
$this->_args['singular'], //Let's simply repurpose the table's singular label ("house")
/*$2%s*/
$item['ID'] //The value of the checkbox should be the record's id
);
}
function get_columns()
{
$columns = array(
'cb' => '<input type="checkbox">', //Render a checkbox instead of text
'name' => '楼盘名/房源名',
'date' => '时间',
'phone' => '手机号',
'consultant' => '置业顾问',
'handle' => '处理状态',
'handle_date' => '处理时间'
);
return $columns;
}
function get_sortable_columns()
{
$sortable_columns = array(
'name' => array('name', false),
'date' => array('date', false),
'phone' => array('phone', false),
'consultant' => array('consultant', false),
'handle' => array('handle', false),
'handle_date' => array('handle_date', false)
);
return $sortable_columns;
}
function get_bulk_actions()
{
$actions = array(
'delete' => 'Delete'
);
return $actions;
}
function process_bulk_action()
{
if ('delete' === $this->current_action()) {
wp_die('Items deleted (or they would be if we had items to delete)!');
}
}
function prepare_items()
{
global $wpdb;
$per_page = 5;
$columns = $this->get_columns();
$hidden = array();
//$sortable = $this->get_sortable_columns();
$this->_column_headers = array($columns, $hidden);
$this->process_bulk_action();
$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 view_house v '
. '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 c on v.consultant_id = c.id '
. 'order by handle';
$result = $wpdb->get_results($sql);
$data = array();
foreach ($result as $key => $value) {
$data[$key] = array(
'id' => $value->id,
'name' => $value->name,
'date' => $value->date,
'phone' => $value->phone,
'consultant' => $value->consultant,
'handle' => $value->handle,
'handle_date' => $value->handle_date
);
}
/*function usort_reorder($a, $b)
{
$orderby = (!empty($_REQUEST['orderby'])) ? $_REQUEST['orderby'] : 'handle'; //If no sort, default to title
$order = (!empty($_REQUEST['order'])) ? $_REQUEST['order'] : 'asc'; //If no order, default to asc
$result = strcmp($a[$orderby], $b[$orderby]); //Determine sort order
return ($order === 'asc') ? $result : -$result; //Send final sort direction to usort
}
usort($data, 'usort_reorder');*/
$current_page = $this->get_pagenum();
$total_items = count($data);
$data = array_slice($data, (($current_page - 1) * $per_page), $per_page);
$this->items = $data;
$this->set_pagination_args(array(
'total_items' => $total_items, //WE have to calculate the total number of items
'per_page' => $per_page, //WE have to determine how many items to show on a page
'total_pages' => ceil($total_items / $per_page) //WE have to calculate the total number of pages
));
}
}
function add_view_house_menu()
{
add_menu_page('预约列表', '预约列表', 'activate_plugins', 'view_house', 'view_house_page', 'dashicons-menu', 27);
}
add_action('admin_menu', 'add_view_house_menu');
function view_house_page()
{
if ($_GET['id']) {
require_once('handle_view_house.php');
} else {
//Create an instance our package class...
$viewHouseList = new viewHouseList();
//Fetch, prepare, sort, and filter our data...
$viewHouseList->prepare_items();
?>
<div class="wrap">
<h2>预约列表</h2>
<form id="houses-filter" method="get">
<!-- For plugins, we also need to ensure that the form posts back to our current page -->
<input type="hidden" name="page" value="<?php echo $_REQUEST['page'] ?>"/>
<!-- Now we can render the completed list table -->
<?php $viewHouseList->display() ?>
</form>
</div>
<?php
}
}
?>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head lang="en">
<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('提交处理失败');
}
}
});
});
});
})(jQuery);
</script>
</head>
<body>
<div>
<ul>
<li>楼盘名/房源名:{{ house_result.name }}</li>
<li>用户:{{ house_result.phone }}</li>
<li>预约时间:{{ house_result.date }} {{ house_result.time }}</li>
</ul>
</div>
<label for="consultant"></label>
<select id="consultant">
{% for consultant in consultant_result %}
<option value="{{ consultant.id }}"
{% if(house_result.consultant_id==consultant.id) %}selected="selected"{% endif %}>{{ consultant.display_name }}</option>
{% endfor %}
</select>
<button id="handle">提交处理</button>
</body>
</html>
\ No newline at end of file
<?php
require_once('const.php');
$context = array();
$context['theme'] = get_template_directory_uri();
$context['url'] = home_url();
$current_user = wp_get_current_user();
$user_id = $current_user->ID;
if ($user_id != 0) {
$context['user_id'] = $user_id;
$consultant_id = $_GET['consultant_id'];
$context['consultant_id'] = $consultant_id;
$context['consultant_name'] = get_user_by('id', $consultant_id)->user_nicename;
$context['consultant_score'] = get_consultant_score($consultant_id);
$context['consultant_score_url'] = $const_score_page . '&consultant_id=' . $consultant_id;
}
Timber::render('consultant_info.html', $context);
?>
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
@font-face {
font-family: 'iconfont';
src: url('http://at.alicdn.com/t/font_1439179733_4587424.eot');
src: url('http://at.alicdn.com/t/font_1439179733_4587424.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */ url('http://at.alicdn.com/t/font_1439179733_4587424.woff') format('woff'), /* chrome、firefox */ url('http://at.alicdn.com/t/font_1439179733_4587424.ttf') format('truetype'), /* chrome、firefox、opera、Safari, Android, iOS 4.2+*/ url('http://at.alicdn.com/t/font_1439179733_4587424.svg#iconfont') format('svg');
/* IE9*/
/* iOS 4.1- */
}
.iconfont {
font-family: "iconfont" !important;
font-size: 16px;
font-style: normal;
-webkit-font-smoothing: antialiased;
-webkit-text-stroke-width: 0.2px;
-moz-osx-font-smoothing: grayscale;
}
.modal .modal-dialog {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
width: 280px;
height: 130px;
}
.modal .modal-dialog .modal-content {
color: #000000;
border: 0;
border-top-left-radius: 8px;
border-top-right-radius: 8px;
border-bottom-left-radius: 8px;
border-bottom-right-radius: 8px;
-webkit-border-top-left-radius: 8px;
-webkit-border-top-right-radius: 8px;
-webkit-border-bottom-left-radius: 8px;
-webkit-border-bottom-right-radius: 8px;
box-shadow: none;
-webkit-box-shadow: none;
}
.modal .modal-dialog .modal-content h4 {
font-size: 19px;
font-weight: bold;
margin: 0 20px;
padding-top: 15px;
}
.modal .modal-dialog .modal-content p {
font-size: 16px;
margin: 12px 20px 14px;
}
.modal .modal-dialog .modal-content .btn {
border-top-color: #cfd0d0;
background-color: transparent;
font-weight: bold;
border-top-left-radius: 0;
border-top-right-radius: 0;
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
-webkit-border-top-left-radius: 0;
-webkit-border-top-right-radius: 0;
-webkit-border-bottom-left-radius: 0;
-webkit-border-bottom-right-radius: 0;
}
.modal .modal-dialog .modal-content .btn:active {
box-shadow: none;
-webkit-box-shadow: none;
background-color: #e9e9e9;
border-bottom-left-radius: 8px;
border-bottom-right-radius: 8px;
-webkit-border-bottom-left-radius: 8px;
-webkit-border-bottom-right-radius: 8px;
}
.modal .modal-dialog .modal-content .btn:focus {
outline: 0;
}
html,
body {
width: 100%;
height: 100%;
}
body {
user-select: none;
-webkit-user-select: none;
tap-highlight-color: rgba(0, 0, 0, 0);
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
color: #707070;
background-color: #f9f9f9;
}
.container-fluid {
width: 100%;
height: 100%;
background: url("../img/formBg.jpg") no-repeat;
background-size: 100% 100%;
-webkit-background-size: 100% 100%;
}
.container-fluid form h2 {
margin: 20% 0;
color: #ffffff;
font-weight: bold;
}
.container-fluid form .has-feedback {
margin-bottom: 0;
background-color: #fff;
border: 1px solid #DED6D9;
}
.container-fluid form .has-feedback .form-control {
height: 60px;
color: #7d7d7d;
box-shadow: none;
-webkit-box-shadow: none;
-webkit-appearance: none;
}
.container-fluid form .has-feedback .form-control::-webkit-input-placeholder {
color: #7d7d7d;
}
.container-fluid form .has-feedback:first-of-type {
border-top-left-radius: 4px;
border-top-right-radius: 4px;
-webkit-border-top-left-radius: 4px;
-webkit-border-top-right-radius: 4px;
margin-bottom: -1px;
}
.container-fluid form .has-feedback:last-of-type {
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
-webkit-border-bottom-left-radius: 4px;
-webkit-border-bottom-right-radius: 4px;
margin-top: -1px;
}
.container-fluid form .has-feedback.username .form-control-feedback {
width: 30px;
height: 30px;
background: url("../img/gray_username_icon.png") no-repeat;
background-size: cover;
-webkit-background-size: cover;
top: 15px;
right: 15px;
}
.container-fluid form .has-feedback.password .form-control-feedback {
width: 30px;
height: 30px;
background: url("../img/gray_password_icon.png") no-repeat;
background-size: cover;
-webkit-background-size: cover;
top: 15px;
right: 15px;
}
.container-fluid form .has-feedback.code .form-control {
width: 65%;
}
.container-fluid form .has-feedback.code .form-control-feedback {
top: 4px;
right: 4px;
width: 30%;
height: 50px;
line-height: 50px;
color: #ffffff;
background-color: #0bacd3;
box-shadow: 0 2px 0 0 #088aa9;
-webkit-box-shadow: 0 2px 0 0 #088aa9;
border-top-left-radius: 4px;
border-top-right-radius: 4px;
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
-webkit-border-top-left-radius: 4px;
-webkit-border-top-right-radius: 4px;
-webkit-border-bottom-left-radius: 4px;
-webkit-border-bottom-right-radius: 4px;
pointer-events: auto;
}
.container-fluid form .btn {
color: #ffffff;
margin: 10% 0 5%;
background-color: #008cd7;
border-top-left-radius: 4px;
border-top-right-radius: 4px;
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
-webkit-border-top-left-radius: 4px;
-webkit-border-top-right-radius: 4px;
-webkit-border-bottom-left-radius: 4px;
-webkit-border-bottom-right-radius: 4px;
box-shadow: 0 2px 0 0 #117bb9;
-webkit-box-shadow: 0 2px 0 0 #117bb9;
}
.container-fluid form a {
display: block;
color: #ffffff;
font-size: 16px;
}
.container-fluid form a span {
width: 30px;
height: 1px;
display: inline-block;
vertical-align: middle;
margin: 0 5px;
background-color: rgba(255, 255, 255, 0.4);
}
.container-fluid form a:active {
color: ;
}
.container-fluid form a:hover {
text-decoration: none;
}
.container-fluid form a.link-register {
margin-top: 100px;
}
@font-face {
font-family: 'iconfont';
src: url('http://at.alicdn.com/t/font_1439179733_4587424.eot');
src: url('http://at.alicdn.com/t/font_1439179733_4587424.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */ url('http://at.alicdn.com/t/font_1439179733_4587424.woff') format('woff'), /* chrome、firefox */ url('http://at.alicdn.com/t/font_1439179733_4587424.ttf') format('truetype'), /* chrome、firefox、opera、Safari, Android, iOS 4.2+*/ url('http://at.alicdn.com/t/font_1439179733_4587424.svg#iconfont') format('svg');
/* IE9*/
/* iOS 4.1- */
}
.iconfont {
font-family: "iconfont" !important;
font-size: 16px;
font-style: normal;
-webkit-font-smoothing: antialiased;
-webkit-text-stroke-width: 0.2px;
-moz-osx-font-smoothing: grayscale;
}
.modal .modal-dialog {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
width: 280px;
height: 130px;
}
.modal .modal-dialog .modal-content {
color: #000000;
border: 0;
border-top-left-radius: 8px;
border-top-right-radius: 8px;
border-bottom-left-radius: 8px;
border-bottom-right-radius: 8px;
-webkit-border-top-left-radius: 8px;
-webkit-border-top-right-radius: 8px;
-webkit-border-bottom-left-radius: 8px;
-webkit-border-bottom-right-radius: 8px;
box-shadow: none;
-webkit-box-shadow: none;
}
.modal .modal-dialog .modal-content h4 {
font-size: 19px;
font-weight: bold;
margin: 0 20px;
padding-top: 15px;
}
.modal .modal-dialog .modal-content p {
font-size: 16px;
margin: 12px 20px 14px;
}
.modal .modal-dialog .modal-content .btn {
border-top-color: #cfd0d0;
background-color: transparent;
font-weight: bold;
border-top-left-radius: 0;
border-top-right-radius: 0;
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
-webkit-border-top-left-radius: 0;
-webkit-border-top-right-radius: 0;
-webkit-border-bottom-left-radius: 0;
-webkit-border-bottom-right-radius: 0;
}
.modal .modal-dialog .modal-content .btn:active {
box-shadow: none;
-webkit-box-shadow: none;
background-color: #e9e9e9;
border-bottom-left-radius: 8px;
border-bottom-right-radius: 8px;
-webkit-border-bottom-left-radius: 8px;
-webkit-border-bottom-right-radius: 8px;
}
.modal .modal-dialog .modal-content .btn:focus {
outline: 0;
}
html,
body {
width: 100%;
height: 100%;
}
body {
user-select: none;
-webkit-user-select: none;
tap-highlight-color: rgba(0, 0, 0, 0);
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
color: #707070;
background-color: #f9f9f9;
}
.search {
width: 100%;
height: 54px;
padding: 10px 10px 10px 5px;
position: relative;
background-color: #008cd7;
}
.search .btn-group {
position: static;
}
.search .btn-group .btn {
color: #ffffff;
font-weight: bold;
}
.search .btn-group .btn .iconfont {
color: #ffffff;
font-size: 12px;
font-weight: normal;
margin-left: 5px;
}
.search .btn-group .btn .iconfont:after {
content: "\e601";
}
.search .btn-group.open .btn .iconfont:after {
content: "\e602";
}
.search .btn-group .dropdown-menu {
left: 0;
width: 100%;
height: 300px;
border: 0;
padding: 0;
margin-top: 1px;
overflow: hidden;
border-top-left-radius: 0;
border-top-right-radius: 0;
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
-webkit-border-top-left-radius: 0;
-webkit-border-top-right-radius: 0;
-webkit-border-bottom-left-radius: 0;
-webkit-border-bottom-right-radius: 0;
}
.search .btn-group .dropdown-menu a {
color: #000000;
margin: 0 10px;
padding: 20px;
display: block;
border-bottom: 1px solid;
}
.search .btn-group .dropdown-menu a:hover {
text-decoration: none;
}
.search .btn-group .dropdown-menu a.active {
color: #008cd7;
}
.search .btn-group .dropdown-menu .left-menu {
height: 100%;
overflow: hidden;
padding: 0;
background-color: #f9f9f9;
}
.search .btn-group .dropdown-menu .left-menu a {
margin: 0;
border-bottom-color: transparent;
}
.search .btn-group .dropdown-menu .left-menu a.active-bg {
background-color: #ffffff;
}
.search .btn-group .dropdown-menu .right-menu {
height: 100%;
overflow: hidden;
padding: 0;
}
.search .has-feedback {
width: 75%;
}
.search .has-feedback .form-control {
color: #b7b7b7;
border-color: #117bb9;
-webkit-appearance: none;
}
.search .has-feedback .form-control::-webkit-input-placeholder {
color: #b7b7b7;
}
.search .has-feedback .form-control-feedback {
top: 3px;
right: 3px;
width: 26px;
height: 26px;
line-height: 26px;
color: #ffffff;
background-color: #0bacd3;
border-top-left-radius: 4px;
border-top-right-radius: 4px;
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
-webkit-border-top-left-radius: 4px;
-webkit-border-top-right-radius: 4px;
-webkit-border-bottom-left-radius: 4px;
-webkit-border-bottom-right-radius: 4px;
box-shadow: 0 2px 0 0 #088aa9;
-webkit-box-shadow: 0 2px 0 0 #088aa9;
pointer-events: auto;
}
.btn-group-justified {
width: 100%;
height: 45px;
position: relative;
box-sizing: content-box;
-webkit-box-sizing: content-box;
border-bottom: 1px solid #b7b7b7;
}
.btn-group-justified .btn-group {
position: static;
}
.btn-group-justified .btn-group .btn {
color: #000000;
font-weight: bold;
}
.btn-group-justified .btn-group .btn .iconfont {
color: #b7b7b7;
font-size: 12px;
font-weight: normal;
margin-left: 5px;
}
.btn-group-justified .btn-group .btn .iconfont:after {
content: "\e601";
}
.btn-group-justified .btn-group.open .btn .iconfont:after {
content: "\e602";
}
.btn-group-justified .btn-group .dropdown-menu {
left: 0;
width: 100%;
height: 300px;
border: 0;
padding: 0;
margin-top: 1px;
overflow: hidden;
border-top-left-radius: 0;
border-top-right-radius: 0;
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
-webkit-border-top-left-radius: 0;
-webkit-border-top-right-radius: 0;
-webkit-border-bottom-left-radius: 0;
-webkit-border-bottom-right-radius: 0;
}
.btn-group-justified .btn-group .dropdown-menu a {
color: #000000;
margin: 0 10px;
padding: 20px;
display: block;
border-bottom: 1px solid;
}
.btn-group-justified .btn-group .dropdown-menu a:hover {
text-decoration: none;
}
.btn-group-justified .btn-group .dropdown-menu a.active {
color: #008cd7;
}
.btn-group-justified .btn-group .dropdown-menu .left-menu {
height: 100%;
overflow: hidden;
padding: 0;
background-color: #f9f9f9;
}
.btn-group-justified .btn-group .dropdown-menu .left-menu a {
margin: 0;
border-bottom-color: transparent;
}
.btn-group-justified .btn-group .dropdown-menu .left-menu a.active-bg {
background-color: #ffffff;
}
.btn-group-justified .btn-group .dropdown-menu .right-menu {
height: 100%;
overflow: hidden;
padding: 0;
}
.btn-group-justified .btn-group .btn {
padding: 2px 12px;
border-right-color: #b7b7b7;
}
.btn-group-justified .btn-group:last-child .btn {
border: 0;
}
#wrapper {
position: absolute;
z-index: 1;
top: 100px;
bottom: 0;
left: 0;
width: 100%;
overflow: hidden;
}
#wrapper #scroller {
padding-bottom: 45px;
}
#wrapper #scroller div {
width: 100%;
height: 121px;
padding: 15px 0;
border-bottom: 1px solid #b7b7b7;
}
#wrapper #scroller div p {
width: 140px;
height: 100%;
float: left;
padding: 0 10px;
margin-bottom: 0;
overflow: hidden;
}
#wrapper #scroller div p img {
height: 100%;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
border-bottom-left-radius: 5px;
border-bottom-right-radius: 5px;
-webkit-border-top-left-radius: 5px;
-webkit-border-top-right-radius: 5px;
-webkit-border-bottom-left-radius: 5px;
-webkit-border-bottom-right-radius: 5px;
}
#wrapper #scroller div ul {
height: 100%;
padding-right: 10px;
margin-bottom: 0;
overflow: hidden;
zoom: 1;
position: relative;
color: #5a5a5a;
}
#wrapper #scroller div ul li {
line-height: 18px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
#wrapper #scroller div ul li.multiLine_omit {
color: #000000;
font-weight: bold;
height: 36px;
-webkit-line-clamp: 2;
display: -webkit-box;
-webkit-box-orient: vertical;
white-space: normal;
}
#wrapper #scroller div ul li .address {
color: #000000;
font-size: 22px;
font-weight: bold;
}
#wrapper #scroller div ul li:last-child {
position: absolute;
left: 0;
right: 10px;
bottom: 0;
}
#wrapper #scroller div ul li:last-child .label {
color: #ff0000;
font-size: 9px;
padding: 0 3px;
border: 1px solid #acacac;
vertical-align: bottom;
}
#wrapper #scroller div ul li:last-child span {
color: #000000;
}
#wrapper #scroller div ul li:last-child span em {
font-style: normal;
}
#wrapper #scroller div ul li:last-child span em:nth-child(1) {
color: #ff0000;
font-size: 22px;
font-weight: bold;
}
#wrapper #scroller div ul li:last-child span em:nth-child(2) {
font-size: 7px;
vertical-align: top;
}
.footer {
width: 100%;
height: 45px;
line-height: 45px;
color: #008cd7;
font-size: 22px;
font-weight: bold;
background-color: rgba(255, 255, 255, 0.9);
}
/*!
* @copyright &copy; Kartik Visweswaran, Krajee.com, 2013 - 2015
* @version 3.5.4
*
* A simple yet powerful JQuery star rating plugin that allows rendering
* fractional star ratings and supports Right to Left (RTL) input.
*
* For more JQuery/Bootstrap plugins and demos visit http://plugins.krajee.com
* For more Yii related demos visit http://demos.krajee.com
*/.rating-loading{width:25px;height:25px;font-size:0;color:#fff;background:transparent url(../img/loading.gif) top left no-repeat;border:none}.rating-fa{font-family:FontAwesome;padding-left:1px}.rating-fa .rating-stars:before{padding-left:1px}.rating-gly{font-family:'Glyphicons Halflings'}.rating-gly-star{font-family:'Glyphicons Halflings';padding-left:2px}.rating-gly-star .rating-stars:before{padding-left:2px}.rating-lg .rating-gly-star,.rating-lg .rating-gly-star .rating-stars:before{padding-left:4px}.rating-xl .rating-gly-star,.rating-xl .rating-gly-star .rating-stars:before{padding-left:2px}.rating-active{cursor:default}.rating-disabled{cursor:not-allowed}.rating-uni{font-size:1.2em;margin-top:-5px}.rating-container{position:relative;vertical-align:middle;display:inline-block;color:#e3e3e3;overflow:hidden}.rating-container:before{content:attr(data-content)}.rating-container .rating-stars{position:absolute;left:0;top:0;white-space:nowrap;overflow:hidden;color:#fde16d;transition:all .25s ease-out;-o-transition:all .25s ease-out;-moz-transition:all .25s ease-out;-webkit-transition:all .25s ease-out}.rating-container .rating-stars:before{content:attr(data-content);text-shadow:0 0 1px rgba(0,0,0,.7)}.rating-container-rtl{position:relative;vertical-align:middle;display:inline-block;overflow:hidden;color:#fde16d}.rating-container-rtl:before{content:attr(data-content);text-shadow:0 0 1px rgba(0,0,0,.7)}.rating-container-rtl .rating-stars{position:absolute;left:0;top:0;white-space:nowrap;overflow:hidden;color:#e3e3e3;transition:all .25s ease-out;-o-transition:all .25s ease-out;-moz-transition:all .25s ease-out;-webkit-transition:all .25s ease-out}.rating-container-rtl .rating-stars:before{content:attr(data-content)}.rating-xl{font-size:4.89em}.rating-lg{font-size:3.91em}.rating-md{font-size:3.13em}.rating-sm{font-size:2.5em}.rating-xs{font-size:2em}.star-rating .clear-rating,.star-rating-rtl .clear-rating{color:#aaa;cursor:not-allowed;display:inline-block;vertical-align:middle;font-size:60%}.clear-rating-active{cursor:pointer!important}.clear-rating-active:hover{color:#843534}.star-rating .clear-rating{padding-right:5px}.star-rating .caption,.star-rating-rtl .caption{color:#999;display:inline-block;vertical-align:middle;font-size:55%}.star-rating .caption{padding-left:5px}.star-rating-rtl .caption{padding-right:5px}
\ No newline at end of file
<?php
class dao
{
//insert 预约看房
public static function insert_view_house($house_id, $user_id, $date, $index, $time, $consultant_id)
{
$insert_view_house_array = array(
'house_id' => $house_id,
'user_id' => $user_id,
'date' => $date,
'time_index' => $index,
'time' => $time,
'consultant_id' => $consultant_id,
'handle' => 0
);
global $wpdb;
$result = $wpdb->insert('view_house', $insert_view_house_array);
return $result;
}
public static function update_view_house($id)
{
global $wpdb;
$result = $wpdb->update('view_house', array(
'handle' => 1,
'handle_date' => current_time('Y-m-d H:i:s')
), array(
'id' => $id
));
return $result;
}
public static function update_view_house_consultant($house_id, $consultant_id)
{
global $wpdb;
$result = $wpdb->update('view_house', array(
'consultant_id' => $consultant_id
), array(
'id' => $house_id
));
return $result;
}
//search 预约看房 user_id
public static function search_view_house_by_user_id($user_id)
{
global $wpdb;
$sql = "select v.house_id,v.date,v.time,v.consultant_id,v.handle from view_house v where user_id = " . $user_id . " order by v.date desc";
return $wpdb->get_results($sql);
}
//search 预约看房 consultant_id
public static function search_view_house_by_consultant_id($consultant_id)
{
global $wpdb;
$sql = "select v.id,v.house_id,v.user_id,v.date,v.time,v.handle from view_house v where consultant_id = " . $consultant_id . " order by v.date desc";
return $wpdb->get_results($sql);
}
//insert 置业顾问评分
public static function insert_consultant_score($consultant_id, $user_id, $score, $valid = 1)
{
$insert_consultant_score_array = array(
'consultant_id' => $consultant_id,
'user_id' => $user_id,
'score' => $score,
'valid' => $valid
);
global $wpdb;
$result = $wpdb->insert('tospur_consultant_score', $insert_consultant_score_array);
return $result;
}
//search 置业顾问评分
public static function search_consultant_score($consultant_id)
{
global $wpdb;
$sql = "select sum(score)/count(score) as average_score from tospur_consultant_score where consultant_id = " . $consultant_id . " and valid = 1;";
return $wpdb->get_var($sql);
}
public static function update_consultant_score($score_id, $valid)
{
global $wpdb;
$result = $wpdb->update('tospur_consultant_score', array(
'valid' => $valid
), array(
'id' => $score_id
));
return $result;
}
public static function search_tospur_verify($phone, $code)
{
global $wpdb;
$sql = "select code from tospur_verify where phone = " . $phone . " and status = 0 " .
"and create_time > NOW() - INTERVAL 30 MINUTE " .
"order by create_time desc limit 1";
return $wpdb->get_var($sql);
}
public static function insert_tospur_verify($phone, $code)
{
$insert_tospur_verify_array = array(
'phone' => $phone,
'code' => $code,
'create_time' => current_time('Y-m-d H:i:s'),
'status' => 0
);
global $wpdb;
$result = $wpdb->insert('tospur_verify', $insert_tospur_verify_array);
return $result;
}
public static function update_tospur_verify($phone)
{
global $wpdb;
$wpdb->update('tospur_verify', array(
'status' => 1
), array(
'phone' => $phone
));
}
}
?>
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
function addEventHandler(oTarget, sEventType, fnHandler) {
if (oTarget.addEventListener) {
oTarget.addEventListener(sEventType, fnHandler, false);
} else if (oTarget.attachEvent) {
oTarget.attachEvent("on" + sEventType, fnHandler);
} else {
oTarget["on" + sEventType] = fnHandler;
}
}
var Class = {
create: function() {
return function() {
this.initialize.apply(this, arguments);
}
}
};
var Extend = function(destination, source) {
for (var property in source) {
destination[property] = source[property];
}
return destination;
};
var DateSelector = Class.create();
DateSelector.prototype = {
initialize: function(oYear, oMonth, oDay, options) {
this.SelYear = document.getElementById(oYear);//年选择对象
this.SelMonth = document.getElementById(oMonth);//月选择对象
this.SelDay = document.getElementById(oDay);//日选择对象
this.SetOptions(options);
var dt = new Date(), iMonth = parseInt(this.options.Month), iDay = parseInt(this.options.Day), iMinYear = parseInt(this.options.MinYear), iMaxYear = parseInt(this.options.MaxYear);
this.Year = parseInt(this.options.Year) || dt.getFullYear();
this.Month = 1 <= iMonth && iMonth <= 12 ? iMonth : dt.getMonth() + 1;
this.Day = iDay > 0 ? iDay : dt.getDate();
this.MinYear = iMinYear && iMinYear < this.Year ? iMinYear : this.Year;
this.MaxYear = iMaxYear && iMaxYear > this.Year ? iMaxYear : this.Year;
this.onChange = this.options.onChange;
//年设置
this.SetSelect(this.SelYear, this.MinYear, this.MaxYear - this.MinYear + 1, this.Year - this.MinYear);
//月设置
this.SetSelect(this.SelMonth, 1, 12, this.Month - 1);
//日设置
this.SetDay();
var oThis = this;
//日期改变事件
addEventHandler(this.SelYear, "change", function(){
oThis.Year = oThis.SelYear.value; oThis.SetDay(); oThis.onChange();
});
addEventHandler(this.SelMonth, "change", function(){
oThis.Month = oThis.SelMonth.value; oThis.SetDay(); oThis.onChange();
});
addEventHandler(this.SelDay, "change", function(){ oThis.Day = oThis.SelDay.value; oThis.onChange(); });
},
//设置默认属性
SetOptions: function(options) {
this.options = {//默认值
Year: 0,//年
Month: 0,//月
Day: 0,//日
MinYear: 0,//最小年份
MaxYear: 0,//最大年份
onChange: function(){}//日期改变时执行
};
Extend(this.options, options || {});
},
//日设置
SetDay: function() {
//取得月份天数
var daysInMonth = new Date(this.Year, this.Month, 0).getDate();
if (this.Day > daysInMonth) { this.Day = daysInMonth; }
this.SetSelect(this.SelDay, 1, daysInMonth, this.Day - 1);
},
//select设置
SetSelect: function(oSelect, iStart, iLength, iIndex) {
//添加option
oSelect.options.length = iLength;
for (var i = 0; i < iLength; i++) { oSelect.options[i].text = oSelect.options[i].value = iStart + i; }
//设置选中项
oSelect.selectedIndex = iIndex;
}
};
\ No newline at end of file
......@@ -11,7 +11,8 @@ function clickSendCode(event) {
self.unbind('click');
ajaxSendCode(ajaxUrl, self, phone, validate);
} else {
$('#phone-error').text('请输入11位手机号');
$('#notice').html('<span>请输入11位手机号</span>');
$('#myModal').modal('show');
}
}
......@@ -30,6 +31,8 @@ function countDown(ajaxUrl, self, validate) {
}
function ajaxSendCode(ajaxUrl, self, phone, validate) {
var notice = $('#notice');
var myModal = $('#myModal');
$.ajax({
type: 'POST',
url: ajaxUrl + '/wp-admin/admin-ajax.php/',
......@@ -41,12 +44,12 @@ function ajaxSendCode(ajaxUrl, self, phone, validate) {
break;
case 2001:
self.bind('click', {ajaxUrl: ajaxUrl, validate: validate}, clickSendCode);
alert('发送验证码失败');
notice.html('<span>发送验证码失败</span>');
myModal.modal('show');
break;
case 2002:
var phoneError = $('#phone-error');
phoneError.text('请输入有效的手机号');
phoneError.removeAttr('style');
notice.html('<span>请输入有效的手机号</span>');
myModal.modal('show');
self.bind('click', {ajaxUrl: ajaxUrl, validate: validate}, clickSendCode);
break;
default:
......
<?php
$context = array();
$context['theme'] = get_template_directory_uri();
$context['url'] = home_url();
$current_user = wp_get_current_user();
$user_id = $current_user->ID;
if ($user_id != 0) {
$context['user_id'] = $user_id;
$context['consultant_id'] = $_GET['consultant_id'];
}
Timber::render('score.html', $context);
?>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/>
<meta name="apple-mobile-web-app-capable" content="yes"/>
<meta name="apple-mobile-web-app-status-bar-style" content="black"/>
<title></title>
<style></style>
<link rel="stylesheet" href="{{ theme }}/css/bootstrap.min.css">
<link rel="stylesheet" href="{{ theme }}/css/star-rating.min.css">
<script src="{{ theme }}/js/jquery.min.js"></script>
<script src="{{ theme }}/js/star-rating.min.js"></script>
<script>
$(document).ready(function () {
var score = $('#score');
score.rating({
size: 'xs',
showClear: false,
showCaption: false,
hoverEnabled: false,
readonly: true
});
var consultant_score = {{ consultant_score }};
var decimal = consultant_score % 0.5;
score.rating('update', consultant_score - decimal);
});
</script>
</head>
<body>
<p>{{ consultant_name }}</p>
<label for="score">星级</label>
<input type="hidden" id="score" name="score">
<input type="hidden" name="consultant_id" value="{{ consultant_id }}">
<a href="{{ consultant_score_url }}">评分</a>
<br>
</body>
</html>
\ No newline at end of file
......@@ -2,16 +2,22 @@
<html>
<head lang="en">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/>
<meta name="viewport" content="width=360, user-scalable=0"/>
<meta name="apple-mobile-web-app-capable" content="yes"/>
<meta name="apple-mobile-web-app-status-bar-style" content="black"/>
<title></title>
<style></style>
<title>登录</title>
<link rel="stylesheet" type="text/css" href="{{ theme }}/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="{{ theme }}/css/form.css">
<script src="{{ theme }}/js/jquery.min.js"></script>
<script src="{{ theme }}/js/jquery.validate.js"></script>
<script src="{{ theme }}/js/bootstrap.min.js"></script>
<script>
$(document).ready(function () {
var notice = $('#notice');
var myModal = $('#myModal');
$('#loginForm').validate({
onkeyup: false,
onfocusout: false,
rules: {
phone: 'required',
password: 'required'
......@@ -19,32 +25,59 @@
messages: {
phone: '请输入用户名',
password: '请输入密码'
},
errorLabelContainer: "#notice",
errorElement: 'span',
invalidHandler: function () {
myModal.modal('show');
},
submitHandler: function (form) {
form.submit();
}
});
notice.bind('DOMNodeInserted',function(){
$(this).children(':not(:first)').remove();
});
myModal.on('hide.bs.modal',function(){
notice.children().remove();
});
});
</script>
</head>
<body>
<form id="loginForm" method="post">
<p>
<label for="phone">用户名<br>
<input type="tel" name="phone" id="phone">
<label id="phone-error" class="error" for="phone">{{ phoneError }}</label>
</label>
</p>
<p>
<label for="password">密码<br>
<input type="password" name="password" id="password">
<label id="password-error" class="error" for="password">{{ passwordError }}</label>
</label>
</p>
<div class="container-fluid text-center">
<form id="loginForm" method="post">
<h2>登录</h2>
<p class="has-feedback username">
<label for="phone" class="sr-only">用户名</label>
<input type="tel" name="phone" id="phone" class="form-control input-lg" placeholder="手机号码/账号">
<span class="form-control-feedback"></span>
</p>
<p class="has-feedback password">
<label for="password" class="sr-only">密码</label>
<input type="password" name="password" id="password" class="form-control input-lg" placeholder="密码">
<span class="form-control-feedback"></span>
</p>
<input type="submit" id="login_submit" value="登录" class="btn btn-lg btn-block">
<a href="{{ forget }}" class="link-fgtpwd">忘记密码?</a>
<a href="{{ register }}" class="link-register">
<span></span>新用户注册<span></span>
</a>
</form>
</div>
<div class="modal fade" id="myModal">
<div class="modal-dialog">
<div class="modal-content text-center">
<h4>提示</h4>
<p id="notice"></p>
<button type="button" class="btn btn-lg btn-block" data-dismiss="modal">确认</button>
</div>
</div>
</div>
<p class="submit">
<input type="submit" id="login_submit" value="登录">
</p>
</form>
<a href="{{ register }}">注册</a>
<a href="{{ forget }}">忘记密码</a>
</body>
</html>
\ No newline at end of file
......@@ -2,16 +2,23 @@
<html>
<head lang="en">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/>
<meta name="viewport" content="width=360, user-scalable=0"/>
<meta name="apple-mobile-web-app-capable" content="yes"/>
<meta name="apple-mobile-web-app-status-bar-style" content="black"/>
<title></title>
<title>注册</title>
<link rel="stylesheet" type="text/css" href="{{ theme }}/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="{{ theme }}/css/form.css">
<script src="{{ theme }}/js/jquery.min.js"></script>
<script src="{{ theme }}/js/jquery.validate.js"></script>
<script src="{{ theme }}/js/bootstrap.min.js"></script>
<script src="{{ theme }}/js/public.js"></script>
<script>
$(document).ready(function () {
var notice = $('#notice');
var myModal = $('#myModal');
$('#registerForm').validate({
onkeyup: false,
onfocusout: false,
rules: {
phone: {
required: true,
......@@ -23,42 +30,66 @@
password: 'required'
},
messages: {
phone: '请输入11位手机号',
phone: '请输入11位手机号',
code: '请输入验证码',
password: '请输入密码'
},
errorLabelContainer: "#notice",
errorElement: 'span',
invalidHandler: function () {
myModal.modal('show');
},
submitHandler: function (form) {
form.submit();
}
});
notice.bind('DOMNodeInserted', function () {
$(this).children(':not(:first)').remove();
});
myModal.on('hide.bs.modal', function () {
notice.children().remove();
});
sendCodeBindClick("{{ url }}", 0);
});
</script>
</head>
<body>
<form id="registerForm" method="post">
<p>
<label for="phone">用户名<br>
<input type="tel" name="phone" id="phone">
<label id="phone-error" class="error" for="phone">{{ phoneError }}</label>
</label>
</p>
<p>
<label for="code">验证码<br>
<input type="text" name="code" id="code">
<label id="code-error" class="error" for="code">{{ codeError }}</label>
</label>
<span id="send">发送验证码</span>
</p>
<div class="container-fluid text-center">
<form id="registerForm" method="post">
<h2>注册</h2>
<p class="has-feedback username">
<label for="phone" class="sr-only">用户名</label>
<input type="tel" name="phone" id="phone" class="form-control input-lg" placeholder="手机号码">
<span class="form-control-feedback"></span>
</p>
<p class="has-feedback password">
<label for="password" class="sr-only">密码</label>
<input type="password" name="password" id="password" class="form-control input-lg" placeholder="密码">
<span class="form-control-feedback"></span>
</p>
<p class="has-feedback code">
<label for="code" class="sr-only">验证码</label>
<input type="text" name="code" id="code" class="form-control input-lg" placeholder="验证码">
<span id="send" class="form-control-feedback">发送验证码</span>
</p>
<input type="submit" id="register_submit" value="注册" class="btn btn-lg btn-block">
</form>
</div>
<div class="modal fade" id="myModal">
<div class="modal-dialog">
<div class="modal-content text-center">
<h4>提示</h4>
<p>
<label for="password">密码<br>
<input type="password" name="password" id="password">
<label id="password-error" class="error" for="password">{{ passwordError }}</label>
</label>
</p>
<p id="notice"></p>
<button type="button" class="btn btn-lg btn-block" data-dismiss="modal">确认</button>
</div>
</div>
</div>
<p class="submit">
<input type="submit" id="register_submit" value="注册">
</p>
</form>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/>
<meta name="apple-mobile-web-app-capable" content="yes"/>
<meta name="apple-mobile-web-app-status-bar-style" content="black"/>
<title></title>
<style></style>
<link rel="stylesheet" href="{{ theme }}/css/bootstrap.min.css">
<link rel="stylesheet" href="{{ theme }}/css/star-rating.min.css">
<script src="{{ theme }}/js/jquery.min.js"></script>
<script src="{{ theme }}/js/star-rating.min.js"></script>
<script>
$(document).ready(function () {
var score = 0;
$('#score').rating({
min: 0,
max: 5,
step: 0.5,
size: 'xs',
showClear: false,
showCaption: false,
hoverEnabled: false,
starCaptions: function (data) {
console.log(data);
score = data;
$(this).val(score);
}
});
var scoreForm = $('#scoreForm');
scoreForm.submit(function () {
if (score > 0) {
$.ajax({
type: 'POST',
url: '{{ url }}/wp-admin/admin-ajax.php/',
data: 'action=add_score&' + scoreForm.serialize(),
success: function (data) {
if (data.code == 2000) {
alert('评分成功');
}else{
alert('不能重复评分');
}
}
});
} else {
alert('请选择评分');
}
return false;
});
});
</script>
</head>
<body>
<form id="scoreForm" method="post">
<br>
<label for="score">评分</label>
<input type="hidden" id="score" name="score" value="0">
<input type="hidden" name="user_id" value="{{ user_id }}">
<input type="hidden" name="consultant_id" value="{{ consultant_id }}">
<br>
<p class="submit">
<input type="submit" id="score_submit" value="提交">
</p>
</form>
</body>
</html>
\ No newline at end of file
......@@ -22,19 +22,6 @@
ds.onChange();
var viewForm = $('#viewForm');
viewForm.validate({
rules: {
time: 'required'
},
messages: {
time: '请选择时间'
},
errorPlacement: function (error, element) {
console.log(error);
console.log(element);
alert('请选择时间');
}
});
viewForm.submit(function () {
$.ajax({
type: 'POST',
......
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